-
Notifications
You must be signed in to change notification settings - Fork 0
/
atari.h
307 lines (257 loc) · 6.19 KB
/
atari.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
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
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
/***
*Atari.h -
*
*Purpose:
* Contains definitions/declarations for Atari "space invedars" game.
*
****************************************************************************/
#ifndef __ATARI_H__
#define __ATARI_H__
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
//TIMERS
#define TANK_SPEED 20
#define BOMB_SPEED 20
#define ROCKET_SPEED 50
#define ARROW_SPEED 20
#define BONUS_SPEED 100
#define MONSTER_DOWN 5000
//TIMERS MACROS
#define MilliSecond (CLOCKS_PER_SEC / 1000)
#define TIMER(time, speed)\
time = (clock_t) speed * MilliSecond + clock();
//KEYBOARD
#define RIGHT 77
#define LEFT 75
#define SHOT 72
//SCREEN SIZE
#define COL 80
#define ROW 23
//ASCII
#define ESC 27
#define ARROW_SIGN 30
#define SPACE 32
#define BOMB_SIGN 3
//TOOLS
#define TANK_ON 1
#define ARROW_ON 2
#define MONSTER_ON 3
#define BOMB_ON 4
#define BONUS_ON 5
//SCORE
#define TIE 0
#define WIN 1
#define LOOSE 2
//ARREYS
#define ARROW_SIZE 2
#define BOMB_SIZE 2
#define MONSTER_SIZE 45
//COLORS
#define BLACK 0
#define DARK_BLUE 1
#define DARK_GREEN 2
#define TURQUOISE 3
#define DARK_RED 4
#define PURPLE 5
#define BROWN 6
#define LIGHT_GREY 7
#define DARK_GREY 8
#define LIGHT_BLUE 9
#define LIGHT_GREEN 10
#define AZURE 11
#define LIGHT_RED 12
#define PINK 13
#define YELLOW 14
#define WHITE 15
#define MON 0
#define ARR 1
#define BOM 2
#define TAN 3
#define BON 4
//STRUCTS
typedef struct
{
bool on;
int x;
int y;
} ARROW;
typedef struct
{
bool on;
int x;
int y;
} MONSTER;
typedef struct
{
bool on;
int x;
int y;
} BOMB;
typedef struct
{
char name[8];
short score;
}SCORE;
//FUNCTIONS DECLERS:
void main ();
void tank_define (
short screen[][ROW],
char *tank_shape, int tank_x,
short BackGround[80][ROW + 1],
short Tools_Color[]
);
void bonus_monster (
MONSTER *bonus,
short BackGround[][ROW + 1],
short screen[][ROW],
short Tools_Color[]
);
int drop_bombs (
BOMB *skad,
MONSTER *monster_arrey,
int *tank_x,
int *tanks,
short screen[][ROW],
char *tank_shape,
short BackGround[][ROW + 1],
short Tools_Color[]
);
int drop_rocket (
BOMB *rocket,
int *tank_x,
int *tanks,
short screen[][ROW],
char *tank_shape,
short BackGround[][ROW + 1],
short Tools_Color[]
);
void direction (
char key,
int *tank_x,
char *tank_shape,
short screen[][ROW],
short BackGround[][ROW + 1],
short Tools_Color[]
);
void shoting (
ARROW arrow_arrey[],
short screen[][ROW],
MONSTER *monster_arrey,
BOMB *skad,
int *counter,
int *monster_faster,
short BackGround[][ROW + 1],
MONSTER *bonus,
int *tanks,
short Tools_Color[]
);
void monster_define (
MONSTER *monster_arrey,
char *monster_shape,
short screen[][ROW],
short Background[][ROW + 1],
short Tools_Color[],
int level
);
int monster_move (
MONSTER *monster_arrey,
char *monster_shape,
short screen[][ROW],
int *newline,
short BackGround[][ROW + 1],
short Tools_Color[]
);
void SetColor (
int forecolor,
int backcolor
);
void SetCursor (
int x,
int y
);
char Engine (
int *counter,
int *tanks,
short BackGround[][ROW + 1],
int level
);
void screen_location (
short screen[][ROW],
int x,
int y,
int tool
);
void hit_monster (
short screen[][ROW],
MONSTER *monster_arrey,
int Dead_Monster,
ARROW *Killing_Arrow,
int *monster_faster,
int *counter,
short BackGround[][ROW + 1]
);
void new_arrow_approval (
short BackGround[][ROW + 1],
ARROW arrow_arrey[],
int *newarrow,
int tank_x,
int *counter
);
void hit_bomb (
short screen[][ROW],
ARROW *Killing_Arrow,
BOMB *Dead_Skad,
short BackGround[][ROW + 1]
);
void BackGround_define (
short BackGround[][ROW + 1],
short Tools_Color[],
int *BOMBWAIT,
int *MONSTERMOVE,
int *BONUSWAIT,
int level
);
void Hit_Bonus (
short screen[][ROW],
short BackGround[][ROW + 1],
ARROW *Killing_Arrow,
MONSTER *Dead_Bonus,
int *tanks
);
void Clear_Object (
short screen[][ROW],
short BackGround[][ROW + 1],
int X,
int Y,
int Wide,
int High
);
void Move_Object (
short BackGround[][ROW + 1],
char *Shape,
int Color,
int X,
int Y,
int Wide,
int High
);
void bomber_choose (
MONSTER *monster_arrey,
BOMB *skad
);
void openning (
short BackGround[][ROW + 1],
short HeadLine[],
SCORE High_Score[],
char New_Player[]
);
void End_Of_Game (
short BackGround[][ROW + 1],
SCORE High_Score[],
char New_Player[],
int counter
);
#endif