-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmastrix.hpp
executable file
·142 lines (121 loc) · 2.74 KB
/
mastrix.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#ifndef MASTRIX_HPP
#define MASTRIX_HPP
#ifdef MACOS
#include "GLUT/glut.h"
#else
#include "GL/glut.h"
#endif
#include "SDL.h"
#include "SDL_image.h"
#ifndef DISBALE_NETWORK
#include "nl.h"
#endif
//#include "gamex.hpp"
#include "msvcfix.hpp"
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <string>
#include "float.h"
#include "graphics.hpp"
#include "audio.hpp"
#include "resourcepool.hpp"
#include "command.hpp"
#include "cvar.hpp"
#include "message.hpp"
#include "console.hpp"
#include "position.hpp"
#include "cl_entity.hpp"
#include "client.hpp"
#include "UI.hpp"
#include "particlepool.hpp"
#include "sv_entity.hpp"
#include "shot.hpp"
#include "shiptype.hpp"
#include "player.hpp"
#include "humanplayer.hpp"
#include "aipathfinding.hpp"
#include "aisteering.hpp"
#include "aiplayer.hpp"
#include "mapmarker.hpp"
#include "server.hpp"
#include "protocol.hpp"
#include "keybuffer.hpp"
#include "keyboard.hpp"
#include "scripting.hpp"
#include "clientedge.hpp"
#include "events.hpp"
#include "weapons.hpp"
#include "mine.hpp"
#include "powerup.hpp"
//mouse functions
static inline int getMouseX()
{
static int x;
SDL_GetMouseState(&x, 0);
return x;
}
static inline int getMouseY()
{
static int y;
SDL_GetMouseState(0, &y);
return y;
}
//timer functions
void updateTime(void);
void syncTime(float time);
double getTime(void);
float getDt(void);
float getRealDt(void);
double getRealTime(void);
double getFrameRate();
extern bool needSinglePlayerInit;
extern bool gameFrozen;
extern double FrozenTime;
extern double unFrozenTime;
//utility functions
static inline float randFloat(float min, float max)
{ return min+((float)rand()*(max-min)/(float)RAND_MAX); }
static inline int randInt(int min, int max)
{
if(min>max)
{
int temp = max;
max=min;
min=temp;
}
return min+(rand()%(max-min+1));
}
float getClampedAngleRad(float angleInRadians);
float distSquaredBetween(
const Position &point1,
const Position &point2);
float distSquaredBetween(
float x1,
float y1,
float x2,
float y2);
float getAngleBetween(
const Vector2D &vector1,
const Vector2D &vector2);
float getHeading(const Position& source, const Position& dest);
std::string retprintf(const char *fmt, ...);
void errorDialog(const char *msg);
std::string quotify(std::string str);
const char *buttonName(int button);
//const int screenWidth = 1024;
//const int screenHeight = 768;
//network functions
void initNetwork(void);
void initNetTarget(NetworkNode *node);
void connectToServer(void);
void acceptConnections(void);
const char *getNlError(void);
extern bool networkServer;
extern bool networkDedicatedServer;
extern bool networkClient;
extern const char *networkAddress;
extern int serverPort;
extern NLsocket serverSock;
#endif