104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
-
-
+
+
|
#define SW(w, x, y) SWS(w, x, y, ssize)
#define S(x, y) SW(world, x, y) // convenient lookup of a lowest mip cube
#define SMALLEST_FACTOR 6 // determines number of mips there can be
#define DEFAULT_FACTOR 8
#define LARGEST_FACTOR 11 // 10 is already insane
#define SOLID(x) ((x)->type == SOLID)
#define MINBORD 2 // 2 cubes from the edge of the world are always solid
#define OUTBORD(x, y) \
((x) < MINBORD || (y) < MINBORD || (x) >= ssize - MINBORD || \
#define OUTBORD(x, y) \
((x) < MINBORD || (y) < MINBORD || (x) >= ssize - MINBORD || \
(y) >= ssize - MINBORD)
struct block {
int x, y, xs, ys;
};
enum {
|
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
|
// globals ooh naughty
#ifdef __cplusplus
extern "C" {
#endif
// map data, the mips are sequential 2D arrays in memory
extern struct sqr *world, *wmip[];
extern struct header hdr; // current map header
extern int sfactor, ssize; // ssize = 2^sfactor
extern int cubicsize, mipsize; // cubicsize = ssize^2
extern struct header hdr; // current map header
extern int sfactor, ssize; // ssize = 2^sfactor
extern int cubicsize, mipsize; // cubicsize = ssize^2
// all the other clients (in multiplayer)
extern OFMutableArray *players;
extern bool editmode;
extern OFMutableArray<Entity *> *ents; // map entities
extern OFVector3D worldpos; // current target of the crosshair in the world
extern int lastmillis; // last time
extern int curtime; // current frame time
extern OFVector3D worldpos; // current target of the crosshair in the world
extern int lastmillis; // last time
extern int curtime; // current frame time
extern int gamemode, nextmode;
extern int xtraverts;
extern bool demoplayback;
#ifdef __cplusplus
}
#endif
#define DMF 16.0f
#define DAF 1.0f
#define DVF 100.0f
#define VIRTW 2400 // virtual screen size for text & HUD
#define VIRTH 1800
#define FONTH 64
#define PIXELTAB (VIRTW / 12)
#define PI (3.1415927f)
#define PI2 (2 * PI)
#define vreject(v, u, max) \
((v).x > (u).x + (max) || (v).x < (u).x - (max) || \
#define vreject(v, u, max) \
((v).x > (u).x + (max) || (v).x < (u).x - (max) || \
(v).y > (u).y + (max) || (v).y < (u).y - (max))
#define vlinterp(v, f, u, g) \
{ \
(v).x = (v).x * f + (u).x * g; \
(v).y = (v).y * f + (u).y * g; \
(v).z = (v).z * f + (u).z * g; \
#define vlinterp(v, f, u, g) \
{ \
(v).x = (v).x * f + (u).x * g; \
(v).y = (v).y * f + (u).y * g; \
(v).z = (v).z * f + (u).z * g; \
}
#define sgetstr() \
{ \
char *t = text; \
do { \
*t = getint(&p); \
} while (*t++); \
#define sgetstr() \
{ \
char *t = text; \
do { \
*t = getint(&p); \
} while (*t++); \
} // used by networking
#define m_noitems (gamemode >= 4)
#define m_noitemsrail (gamemode <= 5)
#define m_arena (gamemode >= 8)
#define m_tarena (gamemode >= 10)
#define m_teammode (gamemode & 1 && gamemode > 2)
|