-
Notifications
You must be signed in to change notification settings - Fork 1
/
c_defs.h
73 lines (67 loc) · 2.49 KB
/
c_defs.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
/*
* cbzone_defs.h
* -- Todd W Mummert, December 1990, CMU
*
* This file shouldn't need to be changed.
*/
/* Generally useful information */
#define PI 3.14159265358
#define PI2 6.28318530716
/* some tolerances for certain objects */
#define BMT_TOL 14400 /* tank */
#define BMC_TOL 6000 /* copter */
#define BMS_TOL 14400 /* supertank */
/*
* the following types and attributes are defined
*
* The attributes are pretty self explanatory. The important
* thing to remember is that an object should not be removed
* if it is STILL_THERE. The components of STILL_THERE are
* IS_ALIVE, IS_EXPLODING, ERASE, EXERASE. ERASE and EXERASE means
* the object should be removed, but before reclaiming its space we
* should check if we need to undraw it. ERASE and EXERASE are
* typically used when removing an object prematurely, as in the
* case of a missile run, though ERASE is also used while an
* object moves from the IS_ALIVE state to IS_EXPLODING.
*/
#define IS_PYRAMID 0x1
#define IS_CUBE 0x2
#define IS_ABLOCK 0x3
#define IS_TANK 0x4
#define IS_SUPER 0x8
#define IS_MISSILE 0x10
#define IS_COPTER 0x20
#define IS_LANDER 0x40
#define IS_SALVO 0x80
#define IS_PLAYER 0x100
#define IS_ENEMY 0x3c /* derived */
#define IS_ANYTHING 0x1ff /* derived */
#define IS_NOTBLOCK 0x1fc /* derived */
#define LN_PYRAMID 0x0 /* the log base 2 of the above values */
#define LN_CUBE 0x1 /* we use this number to index into an */
#define LN_TANK 0x2 /* array in the drawobject stage */
#define LN_SUPER 0x3
#define LN_MISSILE 0x4
#define LN_COPTER 0x5
#define LN_LANDER 0x6
#define LN_SALVO 0x7
#define IS_ALIVE 0x1
#define IS_NEW 0x2
#define ERASE 0x8
#define EXERASE 0x10
#define CAN_SHOOT 0x20
#define IS_PRESET 0x40
#define IS_EVADING 0x80
#define IS_EXPLODING 0x100
#define BLOCKED_BY_ENEMY 0x200
#define BLOCKED_BY_BLOCK 0x400
#define LAST_BLOCKED 0x800
#define HAS_DC 0x1000
#define IS_BLOCKED 0x600 /* derived */
#define STILL_THERE 0x119 /* derived */
#define START_LIVING 0x3 /* derived */
#define START_EXPLODING 0x10a /* derived */
#define DIST(a,b) ((a->x-b->x)*(a->x-b->x)+(a->y-b->y)*(a->y-b->y))
#define frand() ((random() & 0xffff) / 65535.0)
#define ra(x) (x)*PI/180.0
#define sign(v,c) ((c)<0.0?-(v):(v))