-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathc_struct.h
142 lines (124 loc) · 4.33 KB
/
c_struct.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
/*
* cbzone_structs.h
* -- Todd W Mummert, December 1990, CMU
*
* This file contains the two major structures that we use in
* the game. Every object is of type Generic...while we have an
* Option type in order to allow us to pass options easily and
* quickly.
*
* The most hazardous piece of this code is assuming that
* XSegments and XPoints continue to be made of shorts. However,
* I don't want to address the drawing elements by their
* structure names, so I'm betting on them remaining shorts.
*/
typedef struct {
int delay; /* the true delay will be delay * 0.012 */
int mblocks;
int mlanders;
int mmissiles;
int msalvos;
int mtanks;
int menemies;
int mobjects;
int estart; /* indices into the object array */
int lstart;
int sstart;
int bstart;
Bool copters; /* just helicopters */
Bool loud; /* to beep, or not to beep */
Bool practice; /* valid score? */
Bool output; /* print messages to tty? */
Bool scores;
Bool version;
Bool help;
Bool original;
Bool cursor;
/* Now pick up the color options...pick up the color as a string first */
/* This will later be a pixel value after we set up the colormap */
char* cname[MAX_COLORS];
int cpi[MAX_COLORS];
Bool mono;
Bool fullscreen;
Bool defaultcolormap;
int fading_colors;
int max_colors;
} Option, *Optionp;
typedef struct {
short x, y, z;
} Coord3d, *Coord3dp;
typedef struct {
short x, y;
} Coord2d, *Coord2dp;
typedef struct {
float x, y;
} Float2d, *Float2dp;
typedef struct {
float x, y, z;
} Float3d, *Float3dp;
typedef struct {
int num;
void (*calc)();
float* vars;
} Method, *Methodp;
typedef struct { /* in the drawing contexts */
Coord3dp object; /* this information will */
int *pnum, *mnum; /* not change, therefore */
Methodp methods; /* we just need a pointer */
int basecolor; /* to the correct info */
} StaticDC, *StaticDCp;
typedef struct { /* the information in this */
StaticDCp s; /* block may change during */
int basecolor; /* a call to drawobject or */
Bool fades; /* explode object */
Coord2d points[60];
Float3d pos;
Float3d vel;
float cta, sta, ctp, stp;
Bool seen;
Bool last;
} DC, *DCp;
typedef struct generic_s Generic;
typedef Generic* Genericp;
struct generic_s {
int type; /* uses the defines in */
int lntype;
int attr; /* cbzone_defs.h */
float x; /* coordinates in 3 space */
float y;
float z;
float prox; /* projection into player-centric */
float proy; /* coordinates */
float azm; /* direction we are pointing */
float ca; /* typically the sin and cos of */
float sa; /* the object's azm */
float speed; /* current speed */
float rotate; /* current rotational speed */
float range; /* range from player */
float criticalx; /* critical distance */
float criticaly; /* critical distance */
float orientation;
int ecount; /* explosion or existance count */
int ccount; /* cycle count (lander explosion) */
int pcount; /* plan count for movement plans */
int bcount; /* how long we've been blocked */
int fcount; /* how long since we've fired */
int pieces; /* # of pieces in the drawable */
DC dc[5]; /* the drawing context */
/* now we need a method for associating a salvo with an object */
/* since a salvo is another generic item, we just create a */
/* pointer to the first salvo owned by this object */
Genericp salvo;
int nsalvos; /* how many salvos do he have */
};
typedef struct {
int x, y;
} Position_t;
typedef struct {
unsigned int x, y;
} Offset_t;
typedef struct {
Position_t base;
Offset_t size;
} Window_t;
/* Now some useful globals */