-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathetr_types.h
239 lines (202 loc) · 4.89 KB
/
etr_types.h
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/* --------------------------------------------------------------------
EXTREME TUXRACER
Copyright (C) 1999-2001 Jasmin F. Patry (Tuxracer)
Copyright (C) 2010 Extreme Tuxracer Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
---------------------------------------------------------------------*/
#ifndef ETR_TYPES_H
#define ETR_TYPES_H
#define COURSE_VERTEX(x,y) MakeVector ( (double)(x)/(nx-1.)*course_width, \
ELEV((x),(y)), -(double)(y)/(ny-1.)*course_length )
#ifndef MIN
# define MIN(x,y) ((x)<(y)?(x):(y))
#endif
#ifndef MAX
# define MAX(x,y) ((x)>(y)?(x):(y))
#endif
#ifndef ROUND_TO_NEAREST
# define ROUND_TO_NEAREST(x) ((int) ((x)+0.5))
#endif
#define ANGLES_TO_RADIANS(x) (M_PI / 180.0 * (x) )
#define RADIANS_TO_ANGLES(x) (180.0 / M_PI * (x) )
#ifndef M_PI
# define M_PI 3.1415926535
#endif
#define MAG_SQD(vec) ((vec).x * (vec).x + (vec).y * (vec).y + (vec).z * (vec).z )
#ifndef EPS
# define EPS 1.0e-13
#endif
#define OR_TOP 0 // top-orientated menu widgets
#define OR_BOTTOM 1 // bottom-orientated
#define TUX_WIDTH 0.45
#define MAX_ROLL_ANGLE 30
#define BRAKING_ROLL_ANGLE 55
#define BUFF_LEN 1024
#define CENTER -1
#define FIT -1
typedef double scalar_t;
typedef struct {scalar_t x, y;} TVector2;
typedef struct {scalar_t x, y, z;} TVector3;
typedef struct {scalar_t x, y, z, w;} TVector4;
typedef struct {int i, j;} TIndex2;
typedef struct {int i, j, k;} TIndex3;
typedef struct {int i, j, k, l;} TIndex4;
typedef struct {scalar_t r, g, b, a;} TColor;
typedef struct {scalar_t r, g, b;} TColor3;
typedef struct {scalar_t x, y, z;} TTuple;
typedef struct {scalar_t a, b, c, d;} TTuple4;
typedef scalar_t TMatrix[4][4];
typedef scalar_t TMatrixGL[16];
typedef struct {scalar_t x, y, z, w;} TQuaternion;
typedef struct {TVector3 nml; scalar_t d;} TPlane;
typedef struct {int num_vertices; int *vertices;} TPolygon;
typedef struct {scalar_t radius; int divisions;} TSphere;
typedef struct {TVector3 pt; TVector3 vec;} TRay;
typedef struct {int width, height;} TScreenRes;
typedef struct {
int num_vertices;
int num_polygons;
TVector3 *vertices;
TPolygon *polygons;
} TPolyhedron;
typedef struct {
TColor diffuse;
TColor specular_colour;
scalar_t specular_exp;
} TMaterial;
typedef struct {
scalar_t time;
TVector3 pos;
scalar_t yaw;
scalar_t pitch;
scalar_t l_shldr;
scalar_t r_shldr;
scalar_t l_hip;
scalar_t r_hip;
} key_frame_t;
typedef struct {
TVector3 pt;
scalar_t height;
scalar_t diam;
int tree_type;
} TCollidable;
typedef struct {
TVector3 pt;
scalar_t height;
scalar_t diam;
int item_type;
int collectable;
bool drawable;
} TItem;
typedef struct {
int left;
int top;
int width;
int height;
} TRect;
typedef struct {
int left;
int right;
int top;
int bottom;
} TArea;
typedef enum {
NO_MODE,
SPLASH,
REGIST,
NEWPLAYER,
GAME_TYPE_SELECT,
EVENT_SELECT,
EVENT,
RACE_SELECT,
LOADING,
INTRO,
RACING,
GAME_OVER,
PAUSED,
RESET,
CREDITS,
GAME_CONFIG,
HELP,
SCORE,
TOOLS,
OGLTEST,
NUM_GAME_MODES
} TGameMode;
typedef enum {
NONE,
TUXSHAPE,
KEYFRAME,
TREEGEN,
LEARN,
} TToolMode;
typedef enum {
PRACTICING,
CUPRACING,
TRAINING
} TGameType;
typedef enum {
BEHIND,
FOLLOW,
ABOVE,
NUM_VIEW_MODES
} TViewMode;
typedef enum {
START,
FINISH,
WONRACE,
LOSTRACE,
NUM_FRAME_TYPES
} TFrameType;
typedef struct {
TGameMode mode;
TGameMode prev_mode;
TToolMode toolmode;
double time_step;
double secs_since_start;
double fps;
int timesteps;
TGameType game_type;
bool force_treemap;
int treesize;
int treevar;
int argument;
string group_arg;
string dir_arg;
string file_arg;
int loopdelay;
bool finish;
bool use_keyframe;
double finish_brake;
// course and race params
int player_id;
int start_player;
int cup_id;
int race_id;
int numraces;
int mirror_id;
int char_id;
int course_id;
int location_id;
int light_id;
int snow_id;
int wind_id;
int theme_id;
// requirements
TIndex3 herring_req; // 3 levels of needed herrings
TVector3 time_req; // 3 levels of allowed time
// race results (better in player.ctrl ?)
double time; // reached time
int score; // reached score
int herring; // catched herrings during the race
int race_result; // tuxlifes, only for a single race, see game_ctrl
bool raceaborted;
} TGameData;
#endif