Subversion Repositories Kolibri OS

Rev

Rev 1808 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
950 leency 1
 
1808 Albom 2
#include "system/stdlib.h"
3
#include "system/string.h"
4
950 leency 5
 
1808 Albom 6
950 leency 7
 
8
#include "car_02.h"
9
#include "donkey_01.h"
10
#include "donkey_02.h"
11
#include "az.h"
12
13
 
1811 yogev_ezra 14
950 leency 15
 
16
int dox, doy;
17
int drx, dry;
18
19
 
20
21
 
22
23
 
1811 yogev_ezra 24
char snd_game_over[]={0x08, 0xa9, 0x0f, 0x09, 0x99, 0x0f, 0x11, 0x59, 0x0f, 0};
25
950 leency 26
 
1811 yogev_ezra 27
 
950 leency 28
29
 
30
 
31
{
32
gb_image_set_t(&screen, x, y, &az, (c-'!')*11, 0, 11, 16, 0);
33
}
34
35
 
36
 
37
 
38
{
39
unsigned i;
40
i = 0;
41
while (*(s+i))
42
	{
43
	az_putc(*(s+i), x+i*11, y);
44
	i++;
45
	}
46
47
 
48
49
 
50
 
51
 
52
{
53
drx = -1;
54
dry = 0;
55
doy = random(40)+130;
56
57
 
58
if (0 == dox)
59
	dox--;
60
61
 
62
paintbg = 1;
63
64
 
65
66
 
67
}
68
69
 
70
 
71
{
72
73
 
74
75
 
76
gb_bar(&screen, 183, 6, 305-183, 195-6, 0x488888);
77
78
 
79
az_puts("Driver", 189, 30);
80
81
 
82
az_putc (drn/10+'0', 189, 48);
83
84
 
85
az_puts("Space Bar", 189, 116);
86
az_puts("Enter", 189, 132);
87
az_puts("Esc", 189, 148);
88
89
 
90
 
91
gb_line(&screen, 180, 0, 180, 199, 0xffffff);
92
93
 
94
}
95
96
 
97
 
98
 
99
{
100
101
 
102
103
 
104
	{
105
	screen_back();
106
107
 
108
	az_puts ("P A U S E", 5, 30);
109
	az_puts ("Press Enter to continue", 5, 60);
110
111
 
112
	kol_paint_image( 0, 0, 320, 200, screen.bmp);
113
114
 
115
	return;
116
	}
117
118
 
119
	{
120
	gb_bar(&screen, 0, 0, 320, 200, 0x880000);
121
	az_puts ("G A M E    O V E R", 5, 30);
122
123
 
124
	kol_paint_image( 0, 0, 320, 200, screen.bmp);
125
126
 
127
	game_start();
128
	start = 1;
129
	}
130
131
 
132
	{
133
	gb_bar(&screen, 0, 0, 320, 200, 0x88);
134
	az_puts ("CONGRATULATIONS !!!", 5, 30);
135
136
 
137
	kol_paint_image( 0, 0, 320, 200, screen.bmp);
138
139
 
140
	game_start();
141
	start = 1;
142
	}
143
144
 
145
	speed = 1;
146
147
 
148
	speed = 2;
149
150
 
151
 
152
	{
153
	if (!paintbg)
154
		return;
155
156
 
157
158
 
159
	az_puts ("remake for KolibriOS", 5, 78);
160
	az_puts ("by Albom", 5, 78+16);
161
162
 
163
	az_puts ("to continue", 5, 156);
164
165
 
166
 
167
	kol_paint_image( 0, 0, 320, 200, screen.bmp);
168
	paintbg = 0;
169
	return;
170
	}
171
172
 
173
	screen_back();
174
else
175
	gb_bar(&screen, 102, 0, 180-102, 200, 0x888888);
176
177
 
178
	gb_line(&screen, 140, y-10*(doy%2), 140, y+10-10*(doy%2), 0xffffff);
179
180
 
181
if (doy < -50)
182
	{
183
184
 
185
	if (0 == dox)
186
		dox--;
187
188
 
189
	dry += 10;
190
	drn++;
191
	if (0 == drn%10)
192
		dry = 0;
193
	paintbg = 1;
194
	}
195
196
 
197
	{
198
	kol_sound_speaker(snd_game_over);
1811 yogev_ezra 199
	don++;
950 leency 200
	dry = 0;
201
	drn /= 10;
202
	drn *= 10;
203
	for (y = 0; y<2; y++)
204
		{
205
		kol_sleep(8);
206
		screen_back();
207
		az_puts("BOOM!", 6, 120);
208
209
 
210
		gb_image_set_t(&screen, 120+(y+3)*20, 120-dry+(y+1)*20, &car02, 0, 0, 13, 34, 0x888888);
211
212
 
213
		gb_image_set_t(&screen, 140+(y+3)*20, 120-(y+1)*20, &donkey02, 0, 0, 13, 17, 0x888888);
214
215
 
216
		kol_paint_image(0, 0, 320, 200, screen.bmp);
217
		}
218
219
 
220
	if (0 == dox)
221
		dox--;
222
223
 
224
	paintbg = 1;
225
	}
226
227
 
228
gb_image_set_t(&screen, 140-drx*20, 130-dry, &car02, 0, 0, 13, 34, 0x888888);
229
230
 
231
gb_image_set_t(&screen, 140-dox*20, 130-doy, &donkey02, 0, 0, 13, 17, 0x888888);
232
233
 
234
kol_paint_image(0, 0, 320, 200, screen.bmp);
235
236
 
237
238
 
239
 
240
 
241
{
242
kol_paint_start();
243
kol_wnd_define(280, 200, 328, 204+kol_skin_height(), 0x34888888);
244
kol_wnd_caption(STR_DONKEY);
245
screen_draw();
246
kol_paint_end();
247
}
248
249
 
250
 
251
 
252
 
253
{
254
255
 
256
unsigned key;
257
258
 
259
start = 1;
260
paintbg = 1;
261
262
 
263
264
 
265
266
 
267
screen.w = 320;
268
screen.h = 200;
269
270
 
271
car01.w = 13;
272
car01.h = 34;
273
274
 
275
car02.w = 13;
276
car02.h = 34;
277
278
 
279
donkey01.w = 17;
280
donkey01.h = 17;
281
282
 
283
donkey02.w = 13;
284
donkey02.h = 17;
285
286
 
287
az.w = 1012;
288
az.h = 16;
289
290
 
291
 
292
293
 
294
	{
295
296
 
297
	screen_draw();
298
	event = kol_event_check();
299
300
 
301
		{
302
		case 1:
303
			paintbg = 1;
304
			wnd_draw();
305
			break;
306
307
 
308
			key = (kol_key_get() & 0xff00)>>8;
309
			if (start && (32==key))
310
				{
311
				start = 0;
312
				game_start();
313
				screen_draw();
314
				break;
315
				}
316
317
 
318
				{
319
				if (-1 == pause)
320
					break;
321
				start = 1;
322
				paintbg = 1;
323
				break;
324
				}
325
326
 
327
				{
328
				if (-1 == pause)
329
					break;
330
1811 yogev_ezra 331
 
332
333
 
950 leency 334
				screen_draw();
335
				}
336
337
 
338
				{
339
				pause *= -1;
340
				screen_draw();
341
				}
342
343
 
344
 
345
346
 
347
			if ( 1 == (kol_btn_get() & 0xff00)>>8 )
348
				kol_exit();
349
			break;
350
351
 
352
	}
353
354
 
355
start>