1 |
80 |
olivier.gi |
//************************************************************
|
2 |
|
|
//
|
3 |
|
|
// spacewar.h
|
4 |
|
|
//
|
5 |
|
|
//
|
6 |
|
|
|
7 |
|
|
#define full_shields 6 // 6 hits on rkt to win
|
8 |
|
|
#define ammo 2 // # photon torpedos per rocket- only memory for 2
|
9 |
|
|
#define rktsiz 128 // size of rockets
|
10 |
|
|
#define max_dac 4095 // max value on scrn
|
11 |
|
|
#define min_dac 0 // max value on scrn
|
12 |
|
|
#define fixed_inc 16 // space between dots in lines
|
13 |
|
|
#define center (max_dac / 2) // center of the display
|
14 |
|
|
#define collide 256 // size of rocket for a collision
|
15 |
|
|
#define fire_bit 1 // fire button is pressed
|
16 |
|
|
#define time_tick 1 // 10 ms timer tick for system time
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
/* Description:
|
20 |
|
|
The structure contain all the data for each rocket. Two of these structures
|
21 |
|
|
are defined in main, rkt1 and rkt2. The xdisp, ydisp is the 12 bit position of
|
22 |
|
|
the rocket. The xvel, yvel is the velocity if the rocket. xvel, yvel is added
|
23 |
|
|
into xdisp, ydisp every 10ms to cause motion. The xsize, ysize are the scaled
|
24 |
|
|
vectors of the rocket size used to draw the rocket. The angle is the present
|
25 |
|
|
angle the rocket is flying. The angle is 0 - 255 for 0 - 359 degrees. Flags
|
26 |
|
|
contains a single bit to debounce the single firing of torpedos. The pt_dx[],
|
27 |
|
|
pt_dy[] is the array position for this rockets torpedos. The pt_vx[], pt_vy[]
|
28 |
|
|
is the array velocity for this rockets torpedos.
|
29 |
|
|
*/
|
30 |
|
|
struct rkt_data {
|
31 |
|
|
int xdisp, ydisp; // rockets x,y position, 0 <= pos <= 4095
|
32 |
|
|
long xvel, yvel; // rockets x,y velocity
|
33 |
|
|
int xsize, ysize; // sine/cosine size of rocket for drawing it
|
34 |
|
|
unsigned char ang; // rockets angle
|
35 |
|
|
unsigned char shield; // shield value, if =0 game over
|
36 |
|
|
unsigned char game; // game points scored
|
37 |
|
|
unsigned char flags; // bit 1 fire flag if = 1 fire button is down
|
38 |
|
|
int pt_dx[ammo], pt_dy[ammo]; // torps x,y position
|
39 |
|
|
int pt_vx[ammo], pt_vy[ammo]; // torps x,y velocity
|
40 |
|
|
};
|
41 |
|
|
|
42 |
|
|
typedef struct rkt_data rkt_data;
|