File: vaders.h

package info (click to toggle)
xinvaders 2.0-12
  • links: PTS
  • area: non-free
  • in suites: potato
  • size: 312 kB
  • ctags: 443
  • sloc: ansic: 2,364; makefile: 256; sh: 6
file content (235 lines) | stat: -rw-r--r-- 4,645 bytes parent folder | download
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
/* 
Copyright notice:

This is mine.  I'm only letting you use it.  Period.  Feel free to rip off
any of the code you see fit, but have the courtesy to give me credit.
Otherwise great hairy beasties will rip your eyes out and eat your flesh
when you least expect it.

Jonny Goldman <jonathan@think.com>

Wed May  8 1991
*/

/* vaders.h - definitions of vaders data structures. */

#ifndef _vaders_h
#define _vaders_h

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <X11/Xlib.h>
#include <X11/Xos.h>

/* #include <X11/Xutil.h> */
#include <X11/cursorfont.h>

#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>

#include <X11/Xaw/Command.h>

#include <libintl.h>
#define _(x) gettext(x)

#ifndef XtRFloat
#define XtRFloat "Float"
#endif

#define rint(x) ((int) (x))
#define MIN(x, y)	((x) < (y) ? (x) : (y))
#define MAX(x, y)	((x) > (y) ? (x) : (y))

#define VWIDTH 		240
#define IWIDTH		 75
#define VHEIGHT 	190

#ifndef M_PI
#define	M_PI	3.14159265358979323846
#define	M_PI_2	1.57079632679489661923
#define	M_PI_4	0.78539816339744830962
#endif

#ifdef MAIN
#define ext
#else
#define ext extern
#endif

/*
 * Definitions to make us act as a widget.
 */

/* New fields for the Vaders widget class record */
typedef struct {
     int mumble;   /* No new procedures */
} VadersClassPart;

/* Full class record declaration */
typedef struct _VadersClassRec {
    CoreClassPart       core_class;
    VadersClassPart    vaders_class;
} VadersClassRec;

extern VadersClassRec vadersClassRec;
extern WidgetClass vadersWidgetClass;

/* New fields for the Vaders widget record */
typedef struct _VadersPart {
    int dummy;
} VadersPart;



/* Full instance record declaration */

typedef struct _VadersRec {
    CorePart core;
    VadersPart vaders;
} VadersRec, *VadersWidget;




/*
 * Actual vaders definitions.
 */

ext Widget pausebutton, infobutton;
ext int scale;

ext Boolean debug;
ext int level;

ext Display *dpy;
ext Window gamewindow, labelwindow;
ext VadersWidget gamewidget, labelwidget;
ext int gamewidth, gameheight;
ext Widget toplevel;
ext int score;
ext int basesleft;

/* Base info: */

ext int basewait;		/* Number of milleseconds to wait between */
				/* moving base. */

ext XtIntervalId basetimerid;

ext Pixel basepixel;
ext Pixel buildingpixel;
ext Boolean basedestroyed;	/* TRUE if the base is non-existant */

/* Vader info: */

ext XtIntervalId vadertimerid;
ext Pixel vader1pixel;
ext Pixel vader2pixel;
ext Pixel vader3pixel;
ext int vaderwait;		/* Number of milleseconds to wait between */
				/* moving vaders. */

/* Spacer info */

ext Pixel spacerpixel;
ext XtIntervalId spacertimerid;
ext int spacerwait;		/* Number of milliseconds to wait between */
				/* moving spacers. */
ext int spacerappear;		/* same, but for the interval between appearances */

ext Boolean spacer_shown;    	/* Currnet_Spacer is something */
ext int spacer_counter;		/* number of cycles to create a spacer */

/* Shot info. */

ext XtIntervalId shottimerid;
ext XtIntervalId vshottimerid;
ext Pixel shotpixel;
ext Pixel vshotpixel;
ext int shotwait;
ext int vshotwait;
ext int maxshots;		/* How many shots are allowed to exist at */
				/* once. */
ext int maxvshots;		/* How many shots are allowed to exist at */
				/* once. */
ext int numshots;		/* how many shots (from the base) there are right now. */
ext int numvshots;		/* how many shots (from vaders) there are right now. */

/* Score info */

ext Pixel scorepixel;

ext int bases, nextbonus, lastscore;
extern int hiscore;

ext GC
  foregc, backgc, basegc, buildinggc, vadergc[3],
  shotgc, vshotgc, spacergc, scoregc;

ext XImage *me_image;

/* From widget.c */

void Quit();
void Pause();
extern int paused;
void SuspendTimers();
void EnableTimers();
void ShowInfo();

/* From base.c */

void MoveBase();
void MoveLeft();
void MoveRight();
void Stop();
void Fire();
Boolean ShotHitsBase();
Boolean ShotHitsBuilding();
void InitBase();
void InitBuildings();
void PaintBase();
void PaintBasesLeft();
void DrawBuildings();
void ResetGame();
void ShowBase(int i, GC gc);

/* From vaders.c */

Boolean ShotHitsVader();
void MoveVaders();
void InitVaders();
void AddVShot();
void MoveVShots();
void CreateVaders();
void PaintAllVaders();

/* from score.c */

void InitScore();
void PaintScore();
void SaveScore();

/* from spacer.c */

Boolean ShotHitsSpacer();
void MoveSpacer();
void MakeSpacer();
void InitSpacers();
void PaintSpacer();

/* From shot.c */

void AddLine();
void AddShot();
void AddVshot();
void InitShot();
void MoveShots();
void MoveVshots();
void PaintAllShots();
ext Pixel defaultfore, defaultback;

ext char *vaderfont;

#endif _vaders_h