Rev 4386 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4386 | Rev 5188 | ||
---|---|---|---|
1 | ;=============================================================================; |
1 | ;=============================================================================; |
2 | ; Hidnplayr's invaders, Compilable for DexOs and Kolibrios ; |
2 | ; Hidnplayr's invaders for Kolibrios ; |
3 | ;-----------------------------------------------------------------------------; |
3 | ;-----------------------------------------------------------------------------; |
4 | ; ; |
4 | ; ; |
5 | ; Copyright (C) hidnplayr 2007. All rights reserved. ; |
5 | ; Copyright (C) hidnplayr 2007-2014. All rights reserved. ; |
6 | ; ; |
6 | ; ; |
7 | ; Invaders is distributed in the hope that it will be useful, but WITHOUT ANY ; |
7 | ; Invaders is distributed in the hope that it will be useful, but WITHOUT ANY ; |
8 | ; WARRANTY. No author or distributor accepts responsibility to anyone for the ; |
8 | ; WARRANTY. No author or distributor accepts responsibility to anyone for the ; |
9 | ; consequences of using it or for whether it serves any particular purpose or ; |
9 | ; consequences of using it or for whether it serves any particular purpose or ; |
10 | ; works at all, unless he says so in writing. Refer to the GNU General Public ; |
10 | ; works at all, unless he says so in writing. Refer to the GNU General Public ; |
11 | ; License (the "GPL") for full details. ; |
11 | ; License (the "GPL") for full details. ; |
12 | ; Everyone is granted permission to copy, modify and redistribute KolibriOS, ; |
12 | ; Everyone is granted permission to copy, modify and redistribute KolibriOS, ; |
13 | ; but only under the conditions described in the GPL. A copy of this license ; |
13 | ; but only under the conditions described in the GPL. A copy of this license ; |
14 | ; is supposed to have been given to you along with KolibriOS so you can know ; |
14 | ; is supposed to have been given to you along with KolibriOS so you can know ; |
15 | ; your rights and responsibilities. It should be in a file named COPYING. ; |
15 | ; your rights and responsibilities. It should be in a file named COPYING. ; |
16 | ; Among other things, the copyright notice and this notice must be preserved ; |
16 | ; Among other things, the copyright notice and this notice must be preserved ; |
17 | ; on all copies. ; |
17 | ; on all copies. ; |
18 | ; ; |
18 | ; ; |
19 | ; see copying.txt ; |
19 | ; see copying.txt ; |
20 | ; ; |
20 | ; ; |
21 | ; contact me on hidnplayr@gmail.com ; |
21 | ; contact me on hidnplayr@gmail.com ; |
22 | ; ; |
22 | ; ; |
23 | ;-----------------------------------------------------------------------------; |
23 | ;-----------------------------------------------------------------------------; |
- | 24 | ||
- | 25 | format binary as "" |
|
24 | 26 | ||
25 | 27 | ; Screen size |
|
- | 28 | SCREEN_X = 640 |
|
- | 29 | SCREEN_Y = 480 |
|
- | 30 | ||
- | 31 | ; Ship size |
|
- | 32 | SHIP_X = 32 |
|
- | 33 | SHIP_Y = 32 |
|
- | 34 | ||
- | 35 | ; Ship begin position |
|
- | 36 | SHIP_X_POS = (SCREEN_X-SHIP_X)/2 |
|
- | 37 | SHIP_Y_POS = SCREEN_Y-SHIP_Y-27 |
|
- | 38 | ||
- | 39 | ; Enemy size |
|
- | 40 | ENEMY_X = 32 |
|
- | 41 | ENEMY_Y = 32 |
|
- | 42 | ||
- | 43 | ; Alien size and position |
|
- | 44 | ALIEN_X = 48 |
|
- | 45 | ALIEN_Y = 38 |
|
- | 46 | ALIEN_Y_POS = 1 |
|
- | 47 | ||
- | 48 | ; |
|
- | 49 | BOUNDARY = 10 |
|
- | 50 | MOVEMENT = 7 ; pixels/frame |
|
- | 51 | ||
- | 52 | TRANSPARENCY = 0x00ffffff ; color used as transparant |
|
- | 53 | ||
- | 54 | ; Window start position |
|
- | 55 | WINDOW_X = 100 |
|
- | 56 | WINDOW_Y = 100 |
|
- | 57 | ||
- | 58 | ; Bullet size |
|
- | 59 | BULLET_X = 10 |
|
- | 60 | BULLET_Y = 10 |
|
- | 61 | ||
- | 62 | ; Number of stars |
|
- | 63 | STARS_ = 226 |
|
- | 64 | ||
- | 65 | ; Number of star levels (depth) |
|
- | 66 | STARLEVELS = 3 |
|
- | 67 | ||
- | 68 | ENEMY_STARTING_X = 25 |
|
- | 69 | ENEMY_STARTING_Y = 50 |
|
26 | SCREEN_X equ 640 |
70 | |
- | 71 | BULLETSPEED = 12 ; pixels/frame |
|
- | 72 | ||
- | 73 | use32 |
|
- | 74 | org 0x0 |
|
- | 75 | db 'MENUET01' ; 8 byte id |
|
- | 76 | dd 0x01 ; header version |
|
- | 77 | dd START ; start of code |
|
- | 78 | dd IM_END ; size of image |
|
- | 79 | dd I_END+1000 ; memory for app |
|
- | 80 | dd I_END+1000 ; esp |
|
- | 81 | dd 0x0, 0x0 ; I_Param , I_Path |
|
- | 82 | ||
- | 83 | include '../../macros.inc' |
|
- | 84 | include '../../proc32.inc' |
|
- | 85 | include '../../dll.inc' |
|
- | 86 | include '../../develop/libraries/libs-dev/libimg/libimg.inc' |
|
- | 87 | ||
- | 88 | KEY_RIGHT = 179 |
|
- | 89 | KEY_LEFT = 176 |
|
- | 90 | KEY_UP = 178 |
|
- | 91 | KEY_P = 'p' |
|
- | 92 | KEY_DOWN = 177 |
|
- | 93 | KEY_ENTER = 13 |
|
- | 94 | KEY_ESC = 27 |
|
27 | SCREEN_Y equ 480 |
95 | |
- | 96 | proc aimgtoimg img, x, y, canvas, acolor |
|
- | 97 | ||
- | 98 | pusha |
|
- | 99 | ; Calculate offset on canvas in edi |
|
- | 100 | mov eax, [y] |
|
- | 101 | mov ecx, [canvas] |
|
- | 102 | mul dword[ecx] ; canvas xsize |
|
- | 103 | add eax, [x] |
|
- | 104 | ||
- | 105 | lea edi, [eax*2 + eax + 8] |
|
- | 106 | add edi, [canvas] |
|
- | 107 | ||
- | 108 | ; get img size in ecx and edx |
|
- | 109 | mov esi, [img] |
|
- | 110 | mov ecx, dword[esi+0] ; img x size |
|
- | 111 | mov edx, dword[esi+4] ; img y size |
|
- | 112 | ||
- | 113 | ; caluclate number of bytes between 2 lines in ebx |
|
- | 114 | mov ebx, [canvas] |
|
- | 115 | mov ebx, [ebx] ; canvas xsize |
|
- | 116 | sub ebx, [esi] ; img xsize |
|
- | 117 | lea ebx, [ebx*2 + ebx] |
|
- | 118 | ||
- | 119 | ; get image start ptr in esi |
|
- | 120 | add esi, 8 |
|
- | 121 | ||
- | 122 | .loop2: |
|
- | 123 | push ecx edx |
|
- | 124 | mov edx, [acolor] |
|
- | 125 | .loop: |
|
- | 126 | mov eax, [esi] |
|
- | 127 | and eax, 0x00ffffff |
|
- | 128 | cmp eax, edx |
|
- | 129 | je @f |
|
- | 130 | mov word[edi], ax |
|
- | 131 | shr eax, 16 |
|
- | 132 | mov byte[edi+2], al |
|
- | 133 | @@: |
|
- | 134 | add esi, 3 |
|
- | 135 | add edi, 3 |
|
- | 136 | dec ecx |
|
- | 137 | jnz .loop |
|
- | 138 | pop edx ecx |
|
- | 139 | ||
- | 140 | add edi, ebx |
|
- | 141 | dec edx |
|
- | 142 | jnz .loop2 |
|
28 | - | ||
29 | SHIP_X equ 32 |
143 | |
- | 144 | popa |
|
- | 145 | ret |
|
30 | SHIP_Y equ 32 |
146 | |
- | 147 | endp |
|
31 | 148 | ||
- | 149 | proc aimgtoimg2 img, x, y, canvas, acolor |
|
- | 150 | ||
- | 151 | pusha |
|
32 | SHIP_X_POS equ (SCREEN_X-SHIP_X)/2 |
152 | ; Calculate offset on canvas in edi |
- | 153 | mov eax, [y] |
|
33 | SHIP_Y_POS equ SCREEN_Y-SHIP_Y-27 |
154 | mov ecx, [canvas] |
- | 155 | mul dword[ecx] ; canvas xsize |
|
34 | 156 | add eax, [x] |
|
35 | ENEMY_X equ 32 |
157 | |
- | 158 | lea edi, [eax*2 + eax + 8] |
|
- | 159 | add edi, [canvas] |
|
36 | ENEMY_Y equ 32 |
160 | |
- | 161 | ; get img size in ecx and edx |
|
37 | 162 | mov esi, [img] |
|
- | 163 | mov ecx, dword[esi+0] ; img x size |
|
- | 164 | mov edx, dword[esi+4] ; img y size |
|
- | 165 | ||
- | 166 | ; caluclate number of bytes between 2 lines in ebx |
|
- | 167 | mov ebx, [canvas] |
|
38 | ALIEN_X equ 48 |
168 | mov ebx, [ebx] ; canvas xsize |
39 | ALIEN_Y equ 38 |
169 | sub ebx, [esi] ; img xsize |
- | 170 | lea ebx, [ebx*2 + ebx] |
|
- | 171 | ||
- | 172 | ; get image start ptr in esi |
|
- | 173 | add esi, 8 |
|
- | 174 | ||
40 | ALIEN_Y_POS equ 1 |
175 | .loop2: |
- | 176 | push ecx edx |
|
- | 177 | mov edx, [acolor] |
|
- | 178 | .loop: |
|
- | 179 | mov eax, [esi] |
|
- | 180 | and eax, 0x00ffffff |
|
- | 181 | cmp eax, edx |
|
- | 182 | je @f |
|
- | 183 | mov byte[edi+2], al |
|
- | 184 | shr eax, 8 |
|
- | 185 | mov word[edi], ax |
|
- | 186 | @@: |
|
41 | 187 | add esi, 3 |
|
- | 188 | add edi, 3 |
|
42 | BOUNDARY equ 10 |
189 | dec ecx |
43 | MOVEMENT equ 7 |
190 | jnz .loop |
44 | 191 | pop edx ecx |
|
45 | TRANSPARENCY equ 0x00000000 |
192 | |
46 | 193 | add edi, ebx |
|
- | 194 | dec edx |
|
- | 195 | jnz .loop2 |
|
- | 196 | ||
- | 197 | popa |
|
47 | WINDOW_X equ 100 |
198 | ret |
48 | WINDOW_Y equ 100 |
199 | |
- | 200 | endp |
|
- | 201 | ||
- | 202 | proc getimg imgsrc, x, y, xs, ys, imgdest |
|
49 | 203 | ||
- | 204 | pusha |
|
- | 205 | ||
- | 206 | mov esi, [imgsrc] |
|
- | 207 | mov eax, dword[esi+0] ; xsize |
|
- | 208 | mov ebx, [y] |
|
- | 209 | mul ebx ; xsize*y |
|
- | 210 | add eax, [x] ; xsize*y+x |
|
- | 211 | lea eax, [eax+2*eax] ; (xsize*y+x)*3 |
|
- | 212 | ||
50 | BULLET_X equ 10 |
213 | mov edx, dword[esi+0] ; xsize |
- | 214 | sub edx, [xs] ; xsize-xs |
|
51 | BULLET_Y equ 10 |
215 | lea edx, [edx*2+edx] ; (xsize-xs)*3 |
- | 216 | ||
52 | 217 | lea esi, [esi + eax + 8] ; imgsrc + (xsize*y+x)*3 + 8 |
|
- | 218 | ||
- | 219 | mov edi, [imgdest] |
|
53 | STARS_ equ 226 |
220 | mov ecx, [xs] |
- | 221 | mov dword[edi+0], ecx ; xsize |
|
- | 222 | mov ebx, [ys] |
|
- | 223 | mov dword[edi+4], ebx ; ysize |
|
- | 224 | add edi, 8 ; imgdest + 8 |
|
54 | STARLEVELS equ 3 |
225 | |
- | 226 | cld |
|
55 | 227 | .loop: |
|
56 | ENEMY_STARTING_X equ 25 |
228 | movsw |
- | 229 | movsb |
|
57 | ENEMY_STARTING_Y equ 50 |
230 | dec ecx |
- | 231 | jnz .loop |
|
- | 232 | ||
- | 233 | add esi, edx |
|
- | 234 | mov ecx, [xs] |
|
- | 235 | dec ebx |
|
- | 236 | jnz .loop |
|
58 | 237 | ||
59 | BULLETSPEED equ 12 |
238 | popa |
60 | 239 | ret |
|
- | 240 | ||
- | 241 | endp |
|
- | 242 | ||
- | 243 | macro decodeimg source, size, dest { |
|
- | 244 | ||
- | 245 | invoke img.decode, source, size, 0 |
|
- | 246 | or eax, eax |
|
61 | SCREEN_X_POS equ 5 |
247 | jz exit |
- | 248 | push [eax + Image.Width] |
|
- | 249 | pop dword[dest+0] |
|
62 | SCREEN_Y_POS equ 25 |
250 | push [eax + Image.Height] |
- | 251 | pop dword[dest+4] |
|
- | 252 | push eax |
|
- | 253 | invoke img.to_rgb2, eax, dest+8 |
|
- | 254 | pop eax |
|
- | 255 | invoke img.destroy, eax |
|
63 | 256 | } |
|
- | 257 | ||
- | 258 | ||
- | 259 | START: |
|
64 | gif_hash_offset = gif_hash_area |
260 | mcall 68, 11 |
- | 261 | ||
- | 262 | stdcall dll.Load, @IMPORT |
|
- | 263 | or eax, eax |
|
- | 264 | jz @f |
|
- | 265 | exit: |
|
65 | 266 | mcall -1 |
|
66 | include 'ascgl.inc' |
267 | @@: |
67 | include 'invaders_kolibri.inc' |
268 | |
68 | 269 | call draw_window |
|
69 | decodegif: |
270 | |
70 | giftoimg gif_bullet,bullet |
271 | decodeimg gif_bullet,gif_bullet.size,img_bullet |
71 | giftoimg gif_bullet2,bullet2 |
272 | decodeimg gif_bullet2,gif_bullet2.size,img_bullet2 |
72 | giftoimg gif_ship,ship |
273 | decodeimg gif_ship,gif_ship.size,img_ship |
73 | giftoimg gif_enemy1,enemy1 |
274 | decodeimg gif_enemy1,gif_enemy1.size,img_enemy1 |
74 | giftoimg gif_enemy2,enemy2 |
275 | decodeimg gif_enemy2,gif_enemy2.size,img_enemy2 |
75 | giftoimg gif_enemy3,enemy3 |
276 | decodeimg gif_enemy3,gif_enemy3.size,img_enemy3 |
76 | giftoimg gif_enemy4,enemy4 |
277 | decodeimg gif_enemy4,gif_enemy4.size,img_enemy4 |
77 | giftoimg gif_enemy5,enemy5 |
278 | decodeimg gif_enemy5,gif_enemy5.size,img_enemy5 |
78 | giftoimg gif_alien,alien |
279 | decodeimg gif_alien,gif_alien.size,img_alien |
79 | giftoimg gif_menu1,menu1 |
280 | decodeimg gif_menu1,gif_menu1.size,img_menu1 |
80 | giftoimg gif_menu2,menu2 |
281 | decodeimg gif_menu2,gif_menu2.size,img_menu2 |
81 | giftoimg gif_menu3,menu3 |
282 | decodeimg gif_menu3,gif_menu3.size,img_menu3 |
82 | giftoimg gif_menu4,menu4 |
283 | decodeimg gif_menu4,gif_menu4.size,img_menu4 |
83 | giftoimg gif_logo,logo |
284 | decodeimg gif_logo,gif_logo.size,img_logo |
84 | giftoimg gif_pause,pause_ |
285 | decodeimg gif_pause,gif_pause.size,img_pause |
85 | giftoimg gif_levelup,levelup |
286 | decodeimg gif_levelup,gif_levelup.size,img_levelup |
86 | giftoimg gif_gameover,gameover |
287 | decodeimg gif_gameover,gif_gameover.size,img_gameover |
87 | giftoimg gif_highscore,highscore |
288 | decodeimg gif_highscore,gif_highscore.size,img_highscore |
88 | giftoimg gif_smallfont,smallfont |
289 | decodeimg gif_smallfont,gif_smallfont.size,img_smallfont |
89 | giftoimg gif_bigfont,bigfont |
290 | decodeimg gif_bigfont,gif_bigfont.size,img_bigfont |
90 | giftoimg gif_numbers,numbers |
291 | decodeimg gif_numbers,gif_numbers.size,img_numbers |
91 | 292 | ||
92 | call createstars |
293 | call init_starfield |
93 | call drawit |
294 | call render_frame |
94 | call [drawroutine] |
295 | call draw_to_screen |
95 | 296 | ||
96 | mainloop: |
297 | mainloop: |
- | 298 | ||
- | 299 | call render_frame |
|
- | 300 | call draw_to_screen |
|
- | 301 | call bullet_collision_detection |
|
97 | 302 | ||
- | 303 | cmp [status], 3 ; if game is paused,... |
|
- | 304 | jne .wait |
|
98 | cmp byte[status],3 ; if game is paused,... |
305 | |
- | 306 | mcall 10 |
|
99 | je waitfordraw |
307 | jmp .switch |
100 | 308 | ||
101 | call drawit |
- | |
- | 309 | .wait: |
|
- | 310 | mcall 5, 1 ; wait 1/100 s |
|
- | 311 | ||
- | 312 | mcall 11 ; check for events |
|
- | 313 | .switch: |
|
- | 314 | test eax, eax |
|
- | 315 | jz mainloop |
|
- | 316 | dec eax |
|
- | 317 | jz .redraw |
|
- | 318 | dec eax |
|
- | 319 | jz .key |
|
102 | call [drawroutine] |
320 | dec eax |
- | 321 | jz .button |
|
- | 322 | ||
- | 323 | .redraw: |
|
- | 324 | call draw_window |
|
- | 325 | jmp .wait |
|
- | 326 | ||
- | 327 | .button: |
|
- | 328 | mcall 17 ; get button id |
|
- | 329 | ||
- | 330 | cmp ah, 1 |
|
103 | call checkbullet |
331 | jne .wait |
104 | 332 | mcall -1 |
|
105 | waitfordraw: |
333 | |
106 | 334 | .key: |
|
107 | call waitandgetkey ;;; |
335 | mcall 2 ; get key code |
108 | test ah,ah |
336 | test ah, ah |
109 | jz mainloop |
337 | jz mainloop |
- | 338 | ||
- | 339 | cmp [status], 1 |
|
110 | 340 | je key_game |
|
- | 341 | cmp [status], 0 |
|
- | 342 | je key_menu |
|
- | 343 | cmp [status], 3 |
|
- | 344 | je key_pause |
|
- | 345 | cmp [status], 6 |
|
- | 346 | je key_levelup |
|
- | 347 | cmp [status], 7 |
|
- | 348 | je key_highscore |
|
- | 349 | cmp [status], 2 |
|
- | 350 | je key_gameover |
|
- | 351 | ||
111 | cmp byte[status],1 ; |
352 | cmp ah, KEY_ESC |
- | 353 | jne .no_escape |
|
- | 354 | ||
- | 355 | mov [status], 0 |
|
- | 356 | mov [intro], 0 |
|
- | 357 | .no_escape: |
|
- | 358 | ||
- | 359 | jmp mainloop |
|
- | 360 | ||
112 | jne nogame |
361 | |
113 | 362 | key_game: |
|
114 | cmp ah, KEY_RIGHT |
- | |
115 | jnz noright |
- | |
116 | cmp dword[ship_x],SCREEN_X-SHIP_X-BOUNDARY |
- | |
- | 363 | cmp ah, KEY_RIGHT |
|
- | 364 | jnz .no_right |
|
- | 365 | ||
117 | jge mainloop |
366 | cmp [ship_x], SCREEN_X-SHIP_X-BOUNDARY |
- | 367 | jge mainloop |
|
118 | add dword[ship_x],MOVEMENT |
- | |
119 | 368 | add [ship_x], MOVEMENT |
|
120 | jmp mainloop |
369 | jmp mainloop |
121 | - | ||
122 | noright: |
- | |
123 | cmp ah, KEY_LEFT |
- | |
- | 370 | .no_right: |
|
- | 371 | ||
- | 372 | cmp ah, KEY_LEFT |
|
124 | jnz noleft |
373 | jne .no_left |
- | 374 | ||
125 | cmp dword[ship_x],BOUNDARY |
- | |
126 | jle mainloop |
375 | cmp [ship_x], BOUNDARY |
127 | sub dword[ship_x],MOVEMENT |
376 | jle mainloop |
128 | 377 | sub [ship_x], MOVEMENT |
|
129 | jmp mainloop |
378 | jmp mainloop |
130 | 379 | .no_left: |
|
131 | noleft: |
380 | |
132 | cmp ah, KEY_UP |
381 | cmp ah, KEY_UP |
133 | jnz noup |
382 | jne .no_up |
134 | - | ||
135 | cmp dword[bullet_y],1 |
383 | |
- | 384 | cmp [bullet_y], 1 |
|
136 | jg mainloop |
- | |
137 | 385 | jg mainloop |
|
138 | mov eax,dword[ship_x] |
386 | |
139 | add eax,(SHIP_X-BULLET_X)/2 |
387 | mov eax, [ship_x] |
140 | mov dword[bullet_x],eax |
388 | add eax, (SHIP_X-BULLET_X)/2 |
141 | mov dword[bullet_y],SHIP_Y_POS;-BULLET_Y |
389 | mov [bullet_x], eax |
142 | 390 | mov [bullet_y], SHIP_Y_POS;-BULLET_Y |
|
- | 391 | jmp mainloop |
|
- | 392 | .no_up: |
|
- | 393 | ||
- | 394 | cmp ah, KEY_P |
|
- | 395 | jne no_pause |
|
143 | jmp mainloop |
396 | |
- | 397 | mov [status], 3 |
|
144 | - | ||
145 | noup: |
- | |
146 | cmp ah,KEY_P |
- | |
- | 398 | stdcall aimgtoimg, img_pause, 150, 180, vscreen, TRANSPARENCY |
|
147 | jnz no_pause1 |
399 | call draw_to_screen |
148 | 400 | ||
149 | mov byte[status],3 |
- | |
150 | aimgtoimg pause_,150,180,vscreen,TRANSPARENCY,0 |
- | |
151 | call [drawroutine] |
- | |
- | 401 | jmp mainloop |
|
- | 402 | no_pause: |
|
152 | 403 | cmp ah, KEY_ESC |
|
153 | jmp mainloop |
404 | jne .no_escape |
154 | 405 | ||
155 | no_pause1: |
406 | mov [status], 0 |
156 | 407 | mov [intro], 0 |
|
- | 408 | .no_escape: |
|
157 | nogame: |
- | |
158 | cmp byte[status],0 |
409 | jmp mainloop |
159 | jne nomenu |
410 | |
160 | - | ||
161 | cmp ah, KEY_DOWN |
- | |
162 | jnz no_down |
- | |
- | 411 | ||
- | 412 | key_menu: |
|
163 | 413 | cmp ah, KEY_DOWN |
|
164 | cmp byte[menu],3 |
414 | jne .no_down |
165 | jne no_menu1 |
415 | |
166 | 416 | cmp [menu], 3 |
|
167 | mov byte[menu],0 |
417 | jne @f |
168 | jmp nomenu |
- | |
169 | 418 | mov [menu], 0 |
|
170 | no_menu1: |
419 | jmp mainloop |
171 | inc byte[menu] |
420 | @@: |
- | 421 | inc [menu] |
|
- | 422 | jmp mainloop |
|
172 | - | ||
173 | no_down: |
423 | .no_down: |
174 | cmp ah, KEY_UP |
424 | |
175 | jnz no_up |
- | |
176 | - | ||
177 | cmp byte[menu],0 |
- | |
178 | jne no_menu0 |
- | |
179 | - | ||
180 | mov byte[menu],3 |
- | |
181 | jmp nomenu |
- | |
182 | - | ||
183 | no_menu0: |
- | |
184 | dec byte[menu] |
- | |
185 | - | ||
186 | no_up: |
- | |
187 | - | ||
188 | cmp ah, KEY_ESC |
- | |
189 | je exit |
- | |
190 | - | ||
191 | no_esc: |
- | |
192 | cmp ah, KEY_ENTER |
- | |
193 | jnz no_enter |
- | |
194 | - | ||
195 | exemenu: |
425 | cmp ah, KEY_UP |
- | 426 | jnz .no_up |
|
- | 427 | ||
- | 428 | cmp [menu], 0 |
|
- | 429 | jne @f |
|
196 | cmp byte[menu],0 ;start |
430 | mov [menu], 3 |
- | 431 | jmp mainloop |
|
197 | jne exemenu1 |
- | |
198 | - | ||
199 | new_game: |
- | |
200 | mov dword[score],0 |
- | |
201 | mov eax,[score] |
- | |
202 | call convertscore |
- | |
203 | - | ||
204 | mov esi, level1 |
432 | @@: |
205 | mov word[levelnumb],'01' |
433 | dec [menu] |
206 | load_level: |
434 | jmp mainloop |
207 | mov byte[enemy_speed],1 |
435 | .no_up: |
208 | mov dword[enemy_x], ENEMY_STARTING_X |
436 | |
- | 437 | cmp ah, KEY_ESC |
|
209 | mov dword[enemy_y], ENEMY_STARTING_Y |
- | |
210 | 438 | jne @f |
|
- | 439 | mcall -1 |
|
- | 440 | @@: |
|
- | 441 | ||
- | 442 | cmp ah, KEY_ENTER |
|
211 | mov edi, enemy_table |
443 | jnz .no_enter |
212 | mov ecx, 5 |
- | |
213 | rep movsd |
- | |
214 | - | ||
215 | mov byte[status],1 |
- | |
- | 444 | ||
216 | 445 | cmp [menu], 0 ;start |
|
217 | jmp mainloop |
446 | je new_game |
218 | 447 | ||
- | 448 | cmp [menu], 1 ;about |
|
- | 449 | jne @f |
|
219 | exemenu1: |
- | |
220 | cmp byte[menu],1 ;about |
- | |
221 | jne exemenu2 |
- | |
222 | mov byte[status],4 |
- | |
223 | jmp mainloop |
450 | mov [status], 4 |
- | 451 | jmp mainloop |
|
224 | 452 | @@: |
|
225 | exemenu2: |
- | |
226 | cmp byte[menu],2 ;highscores |
- | |
227 | jne exemenu3 |
453 | |
228 | mov byte[status],5 |
- | |
229 | call load_highscores |
454 | cmp [menu], 2 ;highscores |
230 | jmp mainloop |
455 | jne @f |
231 | 456 | mov [status], 5 |
|
232 | exemenu3: |
457 | call load_highscores |
233 | cmp byte[menu],3 ;exit |
458 | jmp mainloop |
234 | je exit |
459 | @@: |
235 | 460 | ||
236 | no_enter: |
461 | cmp byte[menu], 3 ;exit |
237 | nomenu: |
462 | jne @f |
238 | cmp byte[status],3 |
463 | mcall -1 |
239 | jne nopause |
464 | @@: |
240 | 465 | .no_enter: |
|
241 | cmp ah, KEY_P |
466 | jmp mainloop |
242 | jnz nopause |
467 | |
243 | 468 | ||
244 | mov byte[status],1 |
469 | key_pause: |
245 | 470 | cmp ah, KEY_P |
|
246 | nopause: |
471 | jnz no_pause |
247 | cmp byte[status],6 |
472 | |
248 | jne nolevelup |
473 | mov [status], 1 |
249 | 474 | .nopause: |
|
250 | cmp ah, KEY_ENTER |
475 | jmp mainloop |
251 | jne nolevelup |
476 | |
252 | 477 | ||
253 | inc byte[level] |
478 | key_levelup: |
254 | 479 | ||
255 | ; cmp byte[level],5 |
480 | cmp ah, KEY_ENTER |
256 | ; jne @f |
481 | jne .no_enter |
257 | ; mov byte[level],0 |
482 | |
258 | 483 | inc [level] |
|
259 | ;@@: |
484 | |
260 | inc byte[levelnumb+1] |
485 | inc byte[levelnumb+1] |
261 | cmp byte[levelnumb+1],'9' |
486 | cmp byte[levelnumb+1], '9' |
262 | jle @f |
487 | jle @f |
263 | mov byte[levelnumb+1],'0' |
488 | mov byte[levelnumb+1], '0' |
264 | inc byte[levelnumb] |
489 | inc byte[levelnumb] |
265 | 490 | ||
266 | @@: |
491 | @@: |
267 | mov eax,20 |
492 | mov eax,20 |
268 | mov ah,byte[level] |
493 | mov ah,byte[level] |
269 | and ah,7 |
494 | and ah,7 |
270 | mul ah |
495 | mul ah |
271 | add eax,level1 |
496 | add eax,level1 |
272 | mov esi,eax |
497 | mov esi,eax |
273 | jmp load_level |
498 | jmp load_level |
274 | 499 | ||
- | 500 | .no_enter: |
|
- | 501 | cmp ah, KEY_ESC |
|
- | 502 | jne .no_escape |
|
275 | nolevelup: |
503 | |
- | 504 | mov [status], 0 |
|
- | 505 | mov [intro], 0 |
|
- | 506 | .no_escape: |
|
- | 507 | jmp mainloop |
|
- | 508 | ||
276 | cmp byte[status],7 |
509 | |
277 | jne nohighscore |
510 | key_highscore: |
278 | 511 | ||
279 | cmp ah, KEY_ENTER |
512 | cmp ah, KEY_ENTER |
280 | jne @f |
513 | jne @f |
281 | 514 | ||
282 | call load_highscores |
515 | call load_highscores |
283 | mov eax,dword[score] |
516 | mov eax, [score] |
284 | mov ebx,gif_hash_area+140 |
517 | mov ebx, highscorebuffer+140 |
285 | .findscore: |
518 | .findscore: |
286 | cmp ebx,gif_hash_area+100 |
519 | cmp ebx, highscorebuffer+100 |
287 | je .topscore |
520 | je .topscore |
288 | sub ebx,4 |
521 | sub ebx, 4 |
289 | cmp eax,dword[ebx] |
522 | cmp eax, dword[ebx] |
290 | jg .findscore |
523 | jg .findscore |
291 | 524 | ||
292 | .topscore: |
525 | .topscore: |
293 | mov esi,name |
526 | mov esi, name |
294 | mov edi,gif_hash_area |
527 | mov edi, highscorebuffer |
295 | mov ecx,10 |
528 | mov ecx, 10 |
296 | rep movsb |
529 | rep movsb |
297 | 530 | ||
298 | mov eax,dword[score] |
531 | mov eax, [score] |
299 | mov dword[gif_hash_area+100],eax |
532 | mov dword[highscorebuffer+100], eax |
300 | 533 | ||
301 | call save_highscores |
534 | call save_highscores |
302 | mov byte[status],5 |
535 | mov [status], 5 |
303 | 536 | ||
304 | @@: |
537 | @@: |
305 | cmp ah,14 |
538 | cmp ah, 14 |
306 | jne @f |
539 | jne @f |
307 | 540 | ||
308 | cmp byte[namepos],0 |
541 | cmp byte[namepos],0 |
309 | je @f |
542 | je @f |
310 | 543 | ||
311 | dec byte[namepos] |
544 | dec byte[namepos] |
312 | movzx ebx,byte[namepos] |
545 | movzx ebx,byte[namepos] |
313 | add ebx,name |
546 | add ebx,name |
314 | mov byte[ebx],0x11 ; this is a character we dont print |
547 | mov byte[ebx], 0x11 ; this is a character we dont print |
315 | 548 | ||
316 | @@: |
549 | @@: |
317 | cmp byte[namepos],10 |
550 | cmp byte[namepos],10 |
318 | jge nohighscore |
551 | jge mainloop |
319 | 552 | ||
320 | cmp al,'0' |
553 | cmp al,'0' |
321 | jl nohighscore |
554 | jl mainloop |
322 | cmp al,'9' |
555 | cmp al,'9' |
323 | jle @f |
556 | jle @f |
324 | 557 | ||
325 | cmp al,'z' |
558 | cmp al,'z' |
326 | jg nohighscore |
559 | jg mainloop |
327 | cmp al,'a' |
560 | cmp al,'a' |
328 | jge @f |
561 | jge @f |
329 | 562 | ||
330 | cmp al,'Z' |
563 | cmp al,'Z' |
331 | jg nohighscore |
564 | jg mainloop |
332 | cmp al,'A' |
565 | cmp al,'A' |
333 | jl nohighscore |
566 | jl mainloop |
334 | @@: |
567 | @@: |
335 | 568 | ||
336 | movzx ebx,byte[namepos] |
569 | movzx ebx, byte[namepos] |
337 | add ebx,name |
570 | add ebx, name |
338 | mov byte[ebx],al |
571 | mov byte[ebx], al |
339 | 572 | ||
340 | inc byte[namepos] |
573 | inc byte[namepos] |
341 | 574 | ||
342 | jmp mainloop |
575 | jmp mainloop |
343 | - | ||
344 | nohighscore: |
- | |
345 | cmp byte[status],2 ; gameover |
- | |
- | 576 | ||
346 | jne nogameover |
577 | |
347 | 578 | key_gameover: |
|
348 | cmp ah, KEY_ENTER |
579 | cmp ah, KEY_ENTER |
349 | jne nogameover |
580 | jne .no_enter |
- | 581 | ||
- | 582 | ; TODO: test if score is high enough to put in highscore list... |
|
350 | 583 | mov [status],7 |
|
351 | ; test if score is high enough to put in highscore list... |
- | |
352 | mov byte[status],7 |
- | |
353 | - | ||
- | 584 | jmp mainloop |
|
- | 585 | ||
- | 586 | .no_enter: |
|
354 | jmp mainloop |
587 | jmp mainloop |
355 | 588 | ||
- | 589 | ||
356 | nogameover: |
590 | new_game: |
- | 591 | ||
- | 592 | mov [score], 0 |
|
- | 593 | mov eax, [score] |
|
- | 594 | call convertscore |
|
- | 595 | ||
- | 596 | mov word[levelnumb], '01' |
|
- | 597 | mov esi, level1 |
|
- | 598 | ||
- | 599 | load_level: |
|
- | 600 | mov [enemy_speed], 1 |
|
357 | cmp byte[status],0 |
601 | mov [enemy_x], ENEMY_STARTING_X |
358 | je mainloop |
602 | mov [enemy_y], ENEMY_STARTING_Y |
359 | 603 | ||
360 | cmp ah, KEY_ESC |
604 | mov edi, enemy_table |
361 | jnz mainloop |
605 | mov ecx, 5 |
362 | 606 | rep movsd |
|
363 | mov byte[status],0 |
607 | |
364 | mov word[intro],0 |
608 | mov [status],1 |
365 | 609 | ||
366 | jmp mainloop |
610 | jmp mainloop |
- | 611 | ||
- | 612 | ||
- | 613 | draw_window: |
|
367 | 614 | ||
- | 615 | mcall 12, 1 ; Start of window draw |
|
- | 616 | ||
- | 617 | mov ebx, WINDOW_X shl 16 + 9 + SCREEN_X ; [x start] shl 16 + [x size] |
|
- | 618 | mov ecx, WINDOW_Y shl 16 + 25 + SCREEN_Y ; [y start] shl 16 + [y size] |
|
- | 619 | mov edx, 0x64000000 ; color of work area RRGGBB |
|
368 | ;----------------------------------------------------; |
620 | mov esi, 0x805080d0 ; color of grab bar RRGGBB |
- | 621 | mov edi, 0x005080d0 ; color of frames RRGGBB |
|
- | 622 | mcall 0 |
|
- | 623 | ||
- | 624 | mcall 71, 1, title |
|
- | 625 | ||
- | 626 | call draw_to_screen |
|
369 | ; Drawing routine: create image in buffer ; |
627 | |
- | 628 | mcall 12, 2 ; End of window draw |
|
- | 629 | ||
- | 630 | ret |
|
- | 631 | ||
- | 632 | ||
370 | ;----------------------------------------------------; |
633 | |
- | 634 | draw_to_screen: |
|
- | 635 | ||
- | 636 | ; Draw buffer to the screen |
|
- | 637 | mov ebx, vscreen+8 |
|
- | 638 | mov ecx, SCREEN_X shl 16 + SCREEN_Y |
|
- | 639 | mov edx, 0 shl 16 + 0 |
|
- | 640 | mcall 7 |
|
- | 641 | ||
- | 642 | ret |
|
- | 643 | ||
- | 644 | ||
- | 645 | load_highscores: |
|
- | 646 | ||
- | 647 | ret |
|
- | 648 | ||
- | 649 | ||
- | 650 | save_highscores: |
|
- | 651 | ||
- | 652 | ret |
|
- | 653 | ||
- | 654 | ||
- | 655 | render_frame: |
|
371 | drawit: |
656 | |
372 | mov eax,0x00000000 |
657 | mov eax, 0x00000000 |
373 | call fillscreen |
658 | call fillscreen |
374 | call drawstars |
659 | call render_starfield |
- | 660 | ||
- | 661 | cmp [status], 1 |
|
- | 662 | je render_game |
|
- | 663 | cmp [status], 2 |
|
- | 664 | je render_gameover |
|
- | 665 | cmp [status], 4 |
|
- | 666 | je render_about |
|
- | 667 | cmp [status], 6 |
|
- | 668 | je render_levelup |
|
- | 669 | cmp [status], 0 |
|
- | 670 | je render_menu |
|
- | 671 | cmp [status], 5 |
|
- | 672 | je render_highscorelist |
|
- | 673 | cmp [status], 7 |
|
375 | 674 | je render_highscore |
|
- | 675 | ||
- | 676 | ret |
|
- | 677 | ||
376 | cmp byte[status],1 |
678 | |
377 | jne @f |
679 | render_game: |
378 | 680 | ||
379 | call drawbullet |
681 | call render_bullet |
380 | call drawenemys ; Draw the enemy's to buffer |
682 | call render_enemies ; Draw the enemies to buffer |
381 | aimgtoimg ship,dword[ship_x],SHIP_Y_POS,vscreen,TRANSPARENCY,0 ; Draw the ship to buffer |
683 | stdcall aimgtoimg, img_ship, [ship_x], SHIP_Y_POS, vscreen, TRANSPARENCY; Draw the ship to buffer |
382 | 684 | ||
383 | mov esi,scoretext |
685 | mov esi, scoretext |
384 | mov ebx,0 |
686 | mov ebx, 0 |
385 | mov ecx,SCREEN_Y-24 |
687 | mov ecx, SCREEN_Y-24 |
386 | call printtext |
688 | call printtext |
387 | 689 | ||
388 | mov esi,leveltext |
690 | mov esi, leveltext |
389 | mov ebx,300 |
691 | mov ebx, 300 |
390 | call printtext |
692 | call printtext |
391 | 693 | ||
392 | ret |
694 | ret |
393 | - | ||
394 | @@: |
- | |
395 | cmp byte[status],2 ; game over, dude ! |
- | |
- | 695 | ||
- | 696 | ||
396 | jne @f |
697 | render_gameover: |
397 | 698 | ||
398 | aimgtoimg ship,dword[ship_x],SHIP_Y_POS,vscreen,TRANSPARENCY,0 ; Draw the ship to buffer |
699 | stdcall aimgtoimg, img_ship, [ship_x], SHIP_Y_POS, vscreen, TRANSPARENCY; Draw the ship to buffer |
399 | 700 | ||
400 | mov esi,scoretext |
701 | mov esi, scoretext |
401 | mov ebx,0 |
702 | mov ebx, 0 |
402 | mov ecx,SCREEN_Y-24 |
703 | mov ecx, SCREEN_Y-24 |
403 | call printtext |
704 | call printtext |
404 | 705 | ||
405 | mov esi,leveltext |
706 | mov esi, leveltext |
406 | mov ebx,300 |
707 | mov ebx, 300 |
407 | call printtext |
708 | call printtext |
408 | aimgtoimg gameover,150,180,vscreen,TRANSPARENCY,0 |
709 | stdcall aimgtoimg, img_gameover, 150, 180, vscreen, TRANSPARENCY |
409 | 710 | ||
410 | ret |
711 | ret |
411 | 712 | ||
412 | @@: |
- | |
413 | cmp byte[status],4 ; about screen |
713 | |
414 | jne @f |
714 | render_about: |
415 | 715 | ||
416 | mov esi,msgAbout |
716 | mov esi, msgAbout |
417 | mov ebx,50 |
717 | mov ebx, 50 |
418 | mov ecx,100 |
718 | mov ecx, 100 |
419 | call printtext |
719 | call printtext |
420 | 720 | ||
421 | ret |
721 | ret |
422 | 722 | ||
423 | @@: |
723 | |
424 | cmp byte[status],6 ; level up! |
724 | render_levelup: |
425 | jne @f |
725 | |
426 | aimgtoimg ship,dword[ship_x],SHIP_Y_POS,vscreen,TRANSPARENCY,0 ; Draw the ship to buffer |
726 | stdcall aimgtoimg, img_ship, [ship_x], SHIP_Y_POS, vscreen, TRANSPARENCY; Draw the ship to buffer |
427 | 727 | ||
428 | mov esi,scoretext |
728 | mov esi, scoretext |
429 | mov ebx,0 |
729 | mov ebx, 0 |
430 | mov ecx,SCREEN_Y-24 |
730 | mov ecx, SCREEN_Y-24 |
431 | call printtext |
731 | call printtext |
432 | 732 | ||
433 | mov esi,leveltext |
733 | mov esi, leveltext |
434 | mov ebx,300 |
734 | mov ebx, 300 |
435 | call printtext |
735 | call printtext |
436 | aimgtoimg levelup,150,180,vscreen,TRANSPARENCY,0 |
736 | stdcall aimgtoimg, img_levelup, 150, 180, vscreen, TRANSPARENCY |
437 | 737 | ||
438 | ret |
738 | ret |
439 | - | ||
440 | @@: |
- | |
441 | cmp byte[status],0 ; menu! |
- | |
442 | jne @f |
739 | |
- | 740 | ||
443 | 741 | render_menu: |
|
444 | aimgtoimg logo,50,80,vscreen,TRANSPARENCY,0 |
742 | |
445 | 743 | stdcall aimgtoimg, img_logo, 50, 80, vscreen, TRANSPARENCY |
|
446 | 744 | ||
447 | cmp byte[menu],0 |
745 | cmp [menu], 0 |
448 | jne .menu_0 |
746 | jne .menu_0 |
449 | aimgtoimg menu1,30,200,vscreen,TRANSPARENCY,1 |
747 | stdcall aimgtoimg2, img_menu1, 30, 200, vscreen, TRANSPARENCY |
450 | jmp .menu_1 |
748 | jmp .menu_1 |
451 | .menu_0: |
749 | .menu_0: |
452 | aimgtoimg menu1,30,200,vscreen,TRANSPARENCY,0 |
750 | stdcall aimgtoimg, img_menu1, 30, 200, vscreen, TRANSPARENCY |
453 | .menu_1: |
751 | .menu_1: |
454 | cmp byte[menu],1 |
752 | cmp [menu], 1 |
455 | jne .menu_2 |
753 | jne .menu_2 |
456 | aimgtoimg menu2,80,250,vscreen,TRANSPARENCY,1 |
754 | stdcall aimgtoimg2, img_menu2, 80, 250, vscreen, TRANSPARENCY |
457 | jmp .menu_3 |
755 | jmp .menu_3 |
458 | .menu_2: |
756 | .menu_2: |
459 | aimgtoimg menu2,80,250,vscreen,TRANSPARENCY,0 |
757 | stdcall aimgtoimg, img_menu2, 80, 250, vscreen, TRANSPARENCY |
460 | .menu_3: |
758 | .menu_3: |
461 | cmp byte[menu],2 |
759 | cmp [menu], 2 |
462 | jne .menu_4 |
760 | jne .menu_4 |
463 | aimgtoimg menu3,120,300,vscreen,TRANSPARENCY,1 |
761 | stdcall aimgtoimg2, img_menu3, 120, 300, vscreen, TRANSPARENCY |
464 | jmp .menu_5 |
762 | jmp .menu_5 |
465 | .menu_4: |
763 | .menu_4: |
466 | aimgtoimg menu3,120,300,vscreen,TRANSPARENCY,0 |
764 | stdcall aimgtoimg, img_menu3, 120, 300, vscreen,TRANSPARENCY |
467 | .menu_5: |
765 | .menu_5: |
468 | cmp byte[menu],3 |
766 | cmp [menu], 3 |
469 | jne .menu_6 |
767 | jne .menu_6 |
470 | aimgtoimg menu4,150,350,vscreen,TRANSPARENCY,1 |
768 | stdcall aimgtoimg2, img_menu4, 150, 350, vscreen, TRANSPARENCY |
471 | jmp .menu_7 |
769 | jmp .menu_7 |
472 | .menu_6: |
770 | .menu_6: |
473 | aimgtoimg menu4,150,350,vscreen,TRANSPARENCY,0 |
771 | stdcall aimgtoimg, img_menu4, 150, 350, vscreen, TRANSPARENCY |
474 | .menu_7: |
772 | .menu_7: |
475 | 773 | ||
476 | cmp word[intro],200 |
774 | cmp [intro], 200 |
477 | je .menu_75 |
775 | je .menu_75 |
478 | inc word[intro] |
776 | inc [intro] |
479 | 777 | ||
480 | .menu_75: |
778 | .menu_75: |
481 | cmp word[intro],0 |
779 | cmp [intro], 0 |
482 | jl .menu_8 |
780 | jl .menu_8 |
483 | aimgtoimg enemy1,390,180,vscreen,TRANSPARENCY,0 |
781 | stdcall aimgtoimg, img_enemy1, 390, 180, vscreen, TRANSPARENCY |
484 | 782 | ||
485 | cmp word[intro],15 |
783 | cmp [intro], 15 |
486 | jl .menu_8 |
784 | jl .menu_8 |
487 | mov esi,points_50 |
785 | mov esi, points_50 |
488 | mov ebx,470 |
786 | mov ebx, 470 |
489 | mov ecx,180 |
787 | mov ecx, 180 |
490 | call printtext |
788 | call printtext |
491 | 789 | ||
492 | cmp word[intro],30 |
790 | cmp [intro],30 |
493 | jl .menu_8 |
791 | jl .menu_8 |
494 | aimgtoimg enemy2,390,220,vscreen,TRANSPARENCY,0 |
792 | stdcall aimgtoimg, img_enemy2, 390, 220, vscreen, TRANSPARENCY |
495 | 793 | ||
496 | cmp word[intro],45 |
794 | cmp [intro], 45 |
497 | jl .menu_8 |
795 | jl .menu_8 |
498 | mov esi,points_100 |
796 | mov esi, points_100 |
499 | mov ebx,450 |
797 | mov ebx, 450 |
500 | mov ecx,220 |
798 | mov ecx, 220 |
501 | call printtext |
799 | call printtext |
502 | 800 | ||
503 | cmp word[intro],60 |
801 | cmp [intro], 60 |
504 | jl .menu_8 |
802 | jl .menu_8 |
505 | aimgtoimg enemy3,390,260,vscreen,TRANSPARENCY,0 |
803 | stdcall aimgtoimg, img_enemy3, 390, 260, vscreen, TRANSPARENCY |
506 | 804 | ||
507 | cmp word[intro],75 |
805 | cmp [intro], 75 |
508 | jl .menu_8 |
806 | jl .menu_8 |
509 | mov esi,points_150 |
807 | mov esi, points_150 |
510 | mov ebx,450 |
808 | mov ebx, 450 |
511 | mov ecx,260 |
809 | mov ecx, 260 |
512 | call printtext |
810 | call printtext |
513 | 811 | ||
514 | cmp word[intro],90 |
812 | cmp [intro],90 |
515 | jl .menu_8 |
813 | jl .menu_8 |
516 | aimgtoimg enemy4,390,300,vscreen,TRANSPARENCY,0 |
814 | stdcall aimgtoimg, img_enemy4, 390, 300, vscreen, TRANSPARENCY |
517 | 815 | ||
518 | cmp word[intro],105 |
816 | cmp [intro], 105 |
519 | jl .menu_8 |
817 | jl .menu_8 |
520 | mov esi,points_200 |
818 | mov esi, points_200 |
521 | mov ebx,450 |
819 | mov ebx, 450 |
522 | mov ecx,300 |
820 | mov ecx, 300 |
523 | call printtext |
821 | call printtext |
524 | 822 | ||
525 | cmp word[intro],120 |
823 | cmp [intro], 120 |
526 | jl .menu_8 |
824 | jl .menu_8 |
527 | aimgtoimg enemy5,390,340,vscreen,TRANSPARENCY,0 |
825 | stdcall aimgtoimg, img_enemy5, 390, 340, vscreen, TRANSPARENCY |
528 | 826 | ||
529 | cmp word[intro],135 |
827 | cmp [intro],135 |
530 | jl .menu_8 |
828 | jl .menu_8 |
531 | mov esi,points_250 |
829 | mov esi, points_250 |
532 | mov ebx,450 |
830 | mov ebx, 450 |
533 | mov ecx,340 |
831 | mov ecx, 340 |
534 | call printtext |
832 | call printtext |
535 | 833 | ||
536 | cmp word[intro],150 |
834 | cmp [intro],150 |
537 | jl .menu_8 |
835 | jl .menu_8 |
538 | aimgtoimg alien,380,380,vscreen,TRANSPARENCY,0 |
836 | stdcall aimgtoimg, img_alien, 380, 380, vscreen, TRANSPARENCY |
539 | 837 | ||
540 | cmp word[intro],165 |
838 | cmp [intro],165 |
541 | jl .menu_8 |
839 | jl .menu_8 |
542 | mov esi,points_1000 |
840 | mov esi, points_1000 |
543 | mov ebx,430 |
841 | mov ebx, 430 |
544 | mov ecx,380 |
842 | mov ecx, 380 |
545 | call printtext |
843 | call printtext |
546 | 844 | ||
547 | .menu_8: |
845 | .menu_8: |
548 | ret |
846 | ret |
549 | @@: |
- | |
550 | cmp byte[status],5 ;highscorelist |
- | |
551 | jne @f |
- | |
- | 847 | ||
- | 848 | ||
- | 849 | render_highscorelist: |
|
552 | 850 | ||
553 | aimgtoimg highscore,60,40,vscreen,TRANSPARENCY,0 |
851 | stdcall aimgtoimg, img_highscore, 60, 40, vscreen, TRANSPARENCY |
554 | 852 | ||
555 | mov ebx,100 ; print names |
853 | mov ebx, 100 ; print names |
556 | mov ecx,120 |
854 | mov ecx, 120 |
557 | mov esi,gif_hash_area |
855 | mov esi, highscorebuffer |
558 | call printtext |
856 | call printtext |
559 | 857 | ||
560 | mov edi,gif_hash_area+100 ; print scores |
858 | mov edi, highscorebuffer+100 ; print scores |
561 | mov esi,scorenumb |
859 | mov esi, scorenumb |
562 | mov ebx,420 |
860 | mov ebx, 420 |
563 | mov ecx,120 |
861 | mov ecx, 120 |
564 | 862 | ||
565 | .highscoreloop: |
863 | .loop: |
566 | mov eax,[edi] |
864 | mov eax,[edi] |
567 | push ecx |
865 | push ecx |
568 | call convertscore |
866 | call convertscore |
569 | pop ecx |
867 | pop ecx |
570 | push esi |
868 | push esi |
571 | call printtext |
869 | call printtext |
572 | pop esi |
870 | pop esi |
573 | add ecx,26 |
871 | add ecx, 26 |
574 | add edi,4 |
872 | add edi, 4 |
575 | cmp edi,gif_hash_area+140 |
873 | cmp edi, highscorebuffer+140 |
576 | jl .highscoreloop |
874 | jl .loop |
- | 875 | ||
- | 876 | ret |
|
577 | 877 | ||
578 | @@: |
878 | |
579 | cmp byte[status],7 ;highscore |
- | |
580 | jne @f |
879 | render_highscore: |
581 | 880 | ||
582 | aimgtoimg highscore,60,40,vscreen,TRANSPARENCY,0 |
881 | stdcall aimgtoimg, img_highscore, 60, 40, vscreen, TRANSPARENCY |
583 | 882 | ||
584 | mov ebx,60 |
883 | mov ebx, 60 |
585 | mov ecx,200 |
884 | mov ecx, 200 |
586 | mov esi,entername |
885 | mov esi, entername |
587 | call printtext |
886 | call printtext |
588 | 887 | ||
589 | mov ebx,250 |
888 | mov ebx, 250 |
590 | mov ecx,250 |
889 | mov ecx, 250 |
591 | mov esi,name |
890 | mov esi, name |
592 | call printtext |
891 | call printtext |
593 | 892 | ||
594 | mov esi,scoretext |
893 | mov esi, scoretext |
595 | mov ebx,0 |
894 | mov ebx, 0 |
596 | mov ecx,SCREEN_Y-24 |
895 | mov ecx, SCREEN_Y-24 |
597 | call printtext |
896 | call printtext |
598 | 897 | ||
599 | mov esi,leveltext |
898 | mov esi, leveltext |
600 | mov ebx,300 |
899 | mov ebx, 300 |
601 | call printtext |
900 | call printtext |
602 | @@: |
- | |
603 | 901 | ||
604 | ret |
902 | ret |
605 | 903 | ||
606 | 904 | ||
607 | drawenemys: |
905 | render_enemies: |
608 | ; check if direction should change |
906 | ; check if direction should change |
609 | test byte[enemy_d],2 |
907 | test [enemy_d], 2 |
610 | jz @f |
908 | jz @f |
611 | 909 | ||
612 | add dword[enemy_y],5 |
910 | add [enemy_y], 5 |
613 | 911 | ||
614 | mov eax,[enemy_y] |
912 | mov eax, [enemy_y] |
615 | shr eax,5 |
913 | shr eax, 5 |
616 | add al, byte[level] |
914 | add al, [level] |
617 | mov byte[enemy_speed],al |
915 | mov [enemy_speed], al |
618 | 916 | ||
619 | and byte[enemy_d],1 |
917 | and [enemy_d], 1 |
620 | 918 | ||
621 | @@: |
919 | @@: |
622 | ; move the aliens to left or right |
920 | ; move the aliens to left or right |
623 | movzx eax,byte[enemy_speed] |
921 | movzx eax, [enemy_speed] |
624 | test byte[enemy_d],1 |
922 | test [enemy_d], 1 |
625 | jz other_dir |
923 | jz .other_dir |
626 | 924 | ||
627 | sub dword[enemy_x],eax |
925 | sub [enemy_x], eax |
628 | jmp no_other_dir |
926 | jmp .no_other_dir |
629 | 927 | ||
630 | other_dir: |
928 | .other_dir: |
631 | add dword[enemy_x],eax |
929 | add [enemy_x], eax |
632 | no_other_dir: |
930 | .no_other_dir: |
633 | 931 | ||
634 | ; initialization |
932 | ; initialization |
635 | mov byte[alldeadb],1 |
933 | mov [alldeadb],1 |
636 | mov edi,enemy_table |
934 | mov edi, enemy_table |
637 | mov eax,dword[enemy_x] |
935 | mov eax, [enemy_x] |
638 | mov dword[current_enemy_x],eax |
936 | mov [current_enemy_x], eax |
639 | mov eax,dword[enemy_y] |
937 | mov eax, [enemy_y] |
640 | mov dword[current_enemy_y],eax |
- | |
641 | - | ||
642 | loopit: |
- | |
643 | cmp byte[edi],1 |
- | |
644 | je drawenemy1 |
- | |
645 | - | ||
646 | cmp byte[edi],2 |
- | |
647 | je drawenemy2 |
- | |
648 | - | ||
649 | cmp byte[edi],3 |
- | |
650 | je drawenemy3 |
- | |
651 | - | ||
652 | cmp byte[edi],4 |
- | |
653 | je drawenemy4 |
- | |
654 | - | ||
655 | cmp byte[edi],5 |
- | |
656 | je drawenemy5 |
- | |
657 | - | ||
658 | jmp dead_alien |
- | |
659 | - | ||
660 | drawenemy1: |
- | |
661 | mov byte[alldeadb],0 |
- | |
662 | pusha |
- | |
663 | aimgtoimg enemy1,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0 |
- | |
664 | popa |
- | |
665 | - | ||
666 | jmp checknext |
- | |
667 | - | ||
668 | drawenemy2: |
- | |
669 | mov byte[alldeadb],0 |
- | |
670 | pusha |
- | |
671 | aimgtoimg enemy2,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0 |
- | |
672 | popa |
- | |
673 | - | ||
674 | jmp checknext |
- | |
675 | - | ||
676 | drawenemy3: |
- | |
677 | mov byte[alldeadb],0 |
- | |
678 | pusha |
- | |
679 | aimgtoimg enemy3,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0 |
- | |
680 | popa |
- | |
681 | - | ||
682 | jmp checknext |
- | |
683 | - | ||
684 | drawenemy4: |
- | |
685 | mov byte[alldeadb],0 |
- | |
686 | pusha |
- | |
687 | aimgtoimg enemy4,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0 |
- | |
688 | popa |
- | |
689 | - | ||
690 | jmp checknext |
- | |
691 | - | ||
692 | drawenemy5: |
- | |
693 | mov byte[alldeadb],0 |
- | |
694 | pusha |
- | |
695 | aimgtoimg enemy5,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0 |
- | |
- | 938 | mov [current_enemy_y], eax |
|
- | 939 | ||
- | 940 | .loopit: |
|
- | 941 | movzx eax, byte[edi] |
|
- | 942 | test al, al |
|
- | 943 | jz .next_alien |
|
- | 944 | cmp al, 5 |
|
- | 945 | ja .next_alien |
|
- | 946 | dec eax |
|
- | 947 | mov eax, [enemy_img_list+eax*4] |
|
- | 948 | ||
- | 949 | .drawenemy: |
|
696 | popa |
950 | mov [alldeadb], 0 |
697 | 951 | stdcall aimgtoimg, eax, [current_enemy_x], [current_enemy_y], vscreen, TRANSPARENCY |
|
698 | ; jmp checknext |
952 | ; jmp checknext |
699 | 953 | ||
700 | checknext: |
954 | .checknext: |
701 | cmp byte[enemy_d],2 |
955 | cmp [enemy_d], 2 |
702 | jge dont_change_dir |
956 | jge .dont_change_dir |
703 | 957 | ||
704 | movzx eax,byte[enemy_speed] |
958 | movzx eax, [enemy_speed] |
705 | 959 | ||
- | 960 | cmp [enemy_d], 0 |
|
706 | cmp byte[enemy_d],0 |
- | |
707 | jbe change_dir |
- | |
708 | 961 | jbe .change_dir |
|
709 | cmp dword[current_enemy_x],eax |
962 | |
710 | jg dont_change_dir |
963 | cmp dword[current_enemy_x],eax |
711 | 964 | jg .dont_change_dir |
|
712 | mov byte[enemy_d],2 |
965 | |
713 | 966 | mov [enemy_d], 2 |
|
714 | jmp dont_change_dir |
967 | jmp .dont_change_dir |
715 | 968 | ||
716 | change_dir: |
969 | .change_dir: |
717 | mov ebx, SCREEN_X-ENEMY_X |
970 | mov ebx, SCREEN_X-ENEMY_X |
718 | sub ebx, eax |
971 | sub ebx, eax |
719 | cmp dword[current_enemy_x],ebx |
972 | cmp dword[current_enemy_x],ebx |
720 | jl dont_change_dir |
973 | jl .dont_change_dir |
- | 974 | ||
- | 975 | mov [enemy_d], 3 |
|
- | 976 | ||
721 | 977 | .dont_change_dir: |
|
- | 978 | cmp [current_enemy_y], SHIP_Y_POS-ENEMY_Y-BOUNDARY |
|
722 | mov byte[enemy_d],3 |
979 | jle .next_alien ;;;;;; |
723 | - | ||
724 | dont_change_dir: |
980 | |
725 | cmp dword[current_enemy_y],SHIP_Y_POS-ENEMY_Y-BOUNDARY |
981 | mov [status], 2 |
726 | je gameover_ |
982 | ret |
727 | 983 | ||
728 | dead_alien: |
984 | .next_alien: |
729 | cmp edi,enemy_table+20 |
985 | cmp edi, enemy_table+20 |
730 | jge alldead |
986 | jge .alldead |
731 | 987 | ||
732 | inc edi |
988 | inc edi |
733 | add dword[current_enemy_x],ENEMY_X+BOUNDARY |
989 | add dword[current_enemy_x],ENEMY_X+BOUNDARY |
734 | mov eax,dword[current_enemy_x] |
990 | mov eax,dword[current_enemy_x] |
735 | sub eax,dword[enemy_x] |
991 | sub eax,dword[enemy_x] |
736 | cmp eax,5*(ENEMY_X+BOUNDARY) |
992 | cmp eax,5*(ENEMY_X+BOUNDARY) |
737 | jl no_newline |
993 | jl .no_newline |
738 | 994 | ||
739 | sub dword[current_enemy_x],5*(ENEMY_X+BOUNDARY) |
995 | sub [current_enemy_x], 5*(ENEMY_X+BOUNDARY) |
740 | add dword[current_enemy_y],ENEMY_Y+BOUNDARY |
996 | add [current_enemy_y], ENEMY_Y+BOUNDARY |
741 | no_newline: |
997 | .no_newline: |
742 | jmp loopit |
998 | jmp .loopit |
743 | 999 | ||
744 | alldead: |
1000 | .alldead: |
745 | cmp byte[alldeadb],0 |
1001 | cmp [alldeadb], 0 |
746 | je enemy_end |
1002 | je .enemy_end |
747 | 1003 | ||
748 | mov byte[status],6 |
1004 | mov [status], 6 |
749 | jmp mainloop |
- | |
750 | 1005 | ret |
|
751 | enemy_end: |
1006 | |
752 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1007 | .enemy_end: |
753 | cmp dword[alien_x],5 ; |
1008 | cmp [alien_x], 5 |
754 | jge @f |
1009 | jge @f |
755 | 1010 | ||
756 | call random_generator |
1011 | call random_generator |
757 | cmp eax,0xffffffff/50 ; one out of 500 chances that it appears during this frame |
1012 | cmp eax,0xffffffff/50 ; one out of 500 chances that it appears during this frame |
758 | jl alien_end |
1013 | jl .alien_end |
759 | - | ||
760 | mov dword [alien_x],SCREEN_X-ALIEN_X |
1014 | mov [alien_x], SCREEN_X-ALIEN_X |
761 | - | ||
762 | @@: |
1015 | @@: |
763 | push eax |
1016 | push eax |
764 | 1017 | ||
765 | mov eax, SCREEN_X ; mov eax, SCREEN_X |
1018 | mov eax, SCREEN_X ; mov eax, SCREEN_X |
766 | sub eax, dword [alien_x] |
1019 | sub eax, dword [alien_x] |
767 | 1020 | ||
768 | cmp eax, ALIEN_X |
1021 | cmp eax, ALIEN_X |
769 | jle @f |
1022 | jle @f |
770 | mov eax, ALIEN_X |
1023 | mov eax, ALIEN_X |
771 | @@: |
1024 | @@: |
772 | 1025 | ||
773 | getimg alien,0,0,10,ALIEN_Y,alienpiece |
1026 | ; stdcall getimg, img_alien, 0, 0, 10, ALIEN_Y, img_alienpiece |
774 | aimgtoimg alien,dword [alien_x],ALIEN_Y_POS,vscreen,TRANSPARENCY,0 |
1027 | stdcall aimgtoimg, img_alien, [alien_x], ALIEN_Y_POS, vscreen, TRANSPARENCY |
775 | sub dword[alien_x],5 ; |
- | |
- | 1028 | sub [alien_x], 5 |
|
776 | ; |
1029 | |
777 | pop eax ; |
- | |
- | 1030 | pop eax |
|
778 | ; |
1031 | |
779 | alien_end: ; |
- | |
780 | ; |
- | |
781 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1032 | .alien_end: |
782 | ret |
- | |
783 | - | ||
784 | drawbullet: |
- | |
785 | cmp dword[bullet_y],BULLETSPEED |
- | |
786 | jl nobullet |
- | |
- | 1033 | ret |
|
- | 1034 | ||
- | 1035 | ||
- | 1036 | ||
- | 1037 | render_bullet: |
|
- | 1038 | cmp [bullet_y], BULLETSPEED |
|
- | 1039 | jl .nobullet |
|
787 | sub dword[bullet_y],BULLETSPEED |
1040 | sub [bullet_y], BULLETSPEED |
788 | 1041 | ||
789 | aimgtoimg bullet,dword[bullet_x],dword[bullet_y],vscreen,TRANSPARENCY,0 |
- | |
790 | - | ||
791 | nobullet: |
- | |
792 | ret |
- | |
793 | - | ||
794 | checkbullet: |
- | |
795 | cmp dword[bullet_y],BULLETSPEED ; does the bullet hit top of the screen? |
- | |
796 | jle hidebullet ; yes, hide bullet |
1042 | stdcall aimgtoimg, img_bullet, [bullet_x], [bullet_y], vscreen, TRANSPARENCY |
797 | - | ||
798 | ; ; check if bullet is inside the enemy field (you can disble this if you want) |
1043 | |
799 | ; mov eax,dword[enemy_y] |
- | |
800 | ; cmp dword[bullet_y],eax |
1044 | .nobullet: |
801 | ; jl nohit |
- | |
802 | ; |
1045 | ret |
803 | ; add eax,4*(ENEMY_Y+BOUNDARY) |
- | |
804 | ; cmp dword[bullet_y],eax |
- | |
805 | ; jg nohit |
- | |
806 | ; |
1046 | |
807 | ; mov eax,dword[enemy_x] |
- | |
808 | ; cmp dword[bullet_x],eax |
1047 | |
809 | ; jl nohit |
1048 | |
810 | ; |
1049 | bullet_collision_detection: |
811 | ; add eax,5*(ENEMY_Y+BOUNDARY) |
1050 | |
812 | ; cmp dword[bullet_x],eax |
1051 | cmp [bullet_y], BULLETSPEED ; does the bullet hit top of the screen? |
813 | ; jg nohit |
1052 | jle .hidebullet ; yes, hide bullet |
814 | ; |
1053 | |
815 | mov edi,enemy_table |
1054 | mov edi, enemy_table |
816 | mov eax,dword[enemy_x] |
1055 | mov eax, [enemy_x] |
817 | mov dword[current_enemy_x],eax |
1056 | mov [current_enemy_x], eax |
818 | mov eax,dword[enemy_y] |
1057 | mov eax, [enemy_y] |
819 | mov dword[current_enemy_y],eax |
1058 | mov [current_enemy_y], eax |
820 | 1059 | ||
821 | check: |
1060 | .check: |
822 | cmp byte[edi],0 ; is the enemy at this position alive? |
1061 | cmp byte[edi],0 ; is the enemy at this position alive? |
823 | je nextcheck ; no, try next enemy |
1062 | je .nextcheck ; no, try next enemy |
824 | ; check if bullet hits current enemy |
1063 | ; check if bullet hits current enemy |
825 | 1064 | ||
826 | mov eax,dword[current_enemy_y] ; move the enemy y position into eax |
1065 | mov eax, [current_enemy_y] ; move the enemy y position into eax |
827 | cmp dword[bullet_y],eax ; is the bullet's y position less than eax (enemy y pos) |
1066 | cmp [bullet_y], eax ; is the bullet's y position less than eax (enemy y pos) |
828 | jl nextcheck ; yes, bullet can't be colliding, check next enemy |
1067 | jl .nextcheck ; yes, bullet can't be colliding, check next enemy |
829 | 1068 | ||
830 | add eax,ENEMY_Y ; add the width of the enemy to the enemy's y position (wich is still stored in eax) |
1069 | add eax, ENEMY_Y ; add the width of the enemy to the enemy's y position (wich is still stored in eax) |
831 | cmp dword[bullet_y],eax ; is the bullet's y position greater than eax (the end of the enemy) |
1070 | cmp [bullet_y], eax ; is the bullet's y position greater than eax (the end of the enemy) |
832 | jg nextcheck ; yes, bullet can't be colliding, check next enemy |
1071 | jg .nextcheck ; yes, bullet can't be colliding, check next enemy |
833 | 1072 | ||
834 | mov eax,dword[current_enemy_x] ; now do the same but for the x positions |
1073 | mov eax, [current_enemy_x] ; now do the same but for the x positions |
835 | cmp dword[bullet_x],eax ; |
1074 | cmp [bullet_x], eax ; |
836 | jl nextcheck ; |
1075 | jl .nextcheck ; |
837 | ; |
1076 | ; |
838 | add eax,ENEMY_Y ; |
1077 | add eax, ENEMY_Y ; |
839 | cmp dword[bullet_x],eax ; |
1078 | cmp [bullet_x], eax ; |
840 | jg nextcheck ; |
1079 | jg .nextcheck ; |
841 | 1080 | ||
842 | jmp hit |
1081 | jmp .hit |
843 | 1082 | ||
844 | nextcheck: |
1083 | .nextcheck: |
845 | inc edi |
1084 | inc edi |
846 | add dword[current_enemy_x],ENEMY_X+BOUNDARY |
1085 | add [current_enemy_x], ENEMY_X+BOUNDARY |
847 | mov eax,dword[current_enemy_x] |
1086 | mov eax, [current_enemy_x] |
848 | sub eax,dword[enemy_x] |
1087 | sub eax, [enemy_x] |
849 | cmp eax,5*(ENEMY_X+BOUNDARY) |
1088 | cmp eax, 5*(ENEMY_X+BOUNDARY) |
850 | jl no_newline_ |
1089 | jl .no_newline |
851 | 1090 | ||
852 | sub dword[current_enemy_x],5*(ENEMY_X+BOUNDARY) |
1091 | sub [current_enemy_x], 5*(ENEMY_X+BOUNDARY) |
853 | add dword[current_enemy_y],ENEMY_Y+BOUNDARY |
1092 | add [current_enemy_y], ENEMY_Y+BOUNDARY |
854 | no_newline_: |
1093 | .no_newline: |
855 | 1094 | ||
856 | cmp edi,enemy_table+20 ; is this the last enemy? |
1095 | cmp edi, enemy_table+20 ; is this the last enemy? |
857 | jg nohit ; yes, none of them was hit |
1096 | jg .nohit ; yes, none of them was hit |
858 | jmp check ; no, check if enemy is alive and draw it |
1097 | jmp .check ; no, check if enemy is alive and draw it |
859 | 1098 | ||
860 | hit: |
1099 | .hit: |
861 | movzx ebx,byte[edi] ; mov the enemy number onto ebx |
1100 | movzx ebx, byte[edi] ; mov the enemy number onto ebx |
862 | add dword[score],ebx ; add this number to the score dword |
1101 | add [score], ebx ; add this number to the score dword |
863 | 1102 | ||
864 | mov eax,[score] |
1103 | mov eax,[score] |
865 | call convertscore |
1104 | call convertscore |
866 | 1105 | ||
867 | mov byte[edi],0 ; hide the enemy |
1106 | mov byte[edi],0 ; hide the enemy |
868 | hidebullet: |
1107 | .hidebullet: |
869 | mov dword[bullet_y],1 ; mov the bullet to top of screen (hide it) |
1108 | mov [bullet_y], 1 ; mov the bullet to top of screen (hide it) |
870 | jmp noalienhit |
1109 | jmp .noalienhit |
871 | 1110 | ||
872 | nohit: |
1111 | .nohit: |
873 | mov eax,[alien_x] ; check if we hit the big alien in the ufo |
1112 | mov eax, [alien_x] ; check if we hit the big alien in the ufo |
874 | cmp [bullet_x],eax |
1113 | cmp [bullet_x], eax |
875 | jl noalienhit |
1114 | jl .noalienhit |
876 | add eax,ALIEN_X-BULLET_X |
1115 | add eax, ALIEN_X-BULLET_X |
877 | cmp [bullet_x],eax |
1116 | cmp [bullet_x], eax |
878 | jg noalienhit |
1117 | jg .noalienhit |
879 | cmp [bullet_y],ALIEN_Y_POS+ALIEN_Y |
1118 | cmp [bullet_y], ALIEN_Y_POS+ALIEN_Y |
880 | jg noalienhit |
1119 | jg .noalienhit |
881 | 1120 | ||
882 | add dword[score],100/5 |
1121 | add [score], 100/5 |
883 | mov eax,[score] |
1122 | mov eax, [score] |
884 | call convertscore |
1123 | call convertscore |
885 | 1124 | ||
886 | mov [alien_x],0 |
1125 | mov [alien_x], 0 |
887 | 1126 | ||
888 | noalienhit: |
- | |
889 | 1127 | .noalienhit: |
|
- | 1128 | ret |
|
- | 1129 | ||
890 | ret |
1130 | |
- | 1131 | ||
891 | 1132 | convertscore: |
|
892 | convertscore: |
1133 | |
893 | test al,1 |
1134 | test al,1 |
894 | jz .1 |
1135 | jz .1 |
895 | mov byte[scorenumb+5],'5' |
1136 | mov byte[scorenumb+5],'5' |
896 | jmp .2 |
1137 | jmp .2 |
897 | .1: |
1138 | .1: |
898 | mov byte[scorenumb+5],'0' |
1139 | mov byte[scorenumb+5],'0' |
899 | .2: |
1140 | .2: |
900 | shr eax,1 |
1141 | shr eax,1 |
901 | mov ecx,10 |
1142 | mov ecx,10 |
902 | xor edx,edx |
1143 | xor edx,edx |
903 | div ecx |
1144 | div ecx |
904 | add dl,'0' |
1145 | add dl,'0' |
905 | mov byte[scorenumb+4],dl |
1146 | mov byte[scorenumb+4],dl |
906 | xor edx,edx |
1147 | xor edx,edx |
907 | div ecx |
1148 | div ecx |
908 | add dl,'0' |
1149 | add dl,'0' |
909 | mov byte[scorenumb+3],dl |
1150 | mov byte[scorenumb+3],dl |
910 | xor edx,edx |
1151 | xor edx,edx |
911 | div ecx |
1152 | div ecx |
912 | add dl,'0' |
1153 | add dl,'0' |
913 | mov byte[scorenumb+2],dl |
1154 | mov byte[scorenumb+2],dl |
914 | xor edx,edx |
1155 | xor edx,edx |
915 | div ecx |
1156 | div ecx |
916 | add dl,'0' |
1157 | add dl,'0' |
917 | mov byte[scorenumb+1],dl |
1158 | mov byte[scorenumb+1],dl |
918 | xor edx,edx |
1159 | xor edx,edx |
919 | div ecx |
1160 | div ecx |
920 | add dl,'0' |
1161 | add dl,'0' |
921 | mov byte[scorenumb+0],dl |
1162 | mov byte[scorenumb+0],dl |
922 | 1163 | ||
923 | ret |
1164 | ret |
924 | 1165 | ||
925 | 1166 | ||
926 | fillscreen: ; eax - screen color ( 0x00RRGGBB ) |
1167 | fillscreen: ; eax - screen color ( 0x00RRGGBB ) |
927 | 1168 | ||
928 | mov edi,vscreen+8 |
1169 | mov edi, vscreen+8 |
929 | cld |
1170 | cld |
930 | mov ecx,SCREEN_X*SCREEN_Y |
1171 | mov ecx, SCREEN_X*SCREEN_Y |
931 | .lab1: |
1172 | .lab1: |
932 | mov [edi],eax |
1173 | mov [edi], eax |
933 | add edi,3 |
1174 | add edi, 3 |
934 | loop .lab1 |
1175 | loop .lab1 |
935 | 1176 | ||
936 | ret |
1177 | ret |
937 | 1178 | ||
938 | 1179 | ||
939 | printtext: |
1180 | printtext: |
940 | push ebx |
- | |
941 | - | ||
942 | loadbyte: |
- | |
943 | movzx eax, byte[esi] |
- | |
944 | test eax, eax |
- | |
945 | jnz checkbyte |
- | |
946 | 1181 | ||
947 | pop ebx |
- | |
948 | - | ||
- | 1182 | push ebx |
|
949 | ret |
1183 | |
- | 1184 | .loop: |
|
- | 1185 | lodsb |
|
950 | 1186 | test al, al |
|
951 | checkbyte: |
1187 | jz .done |
952 | cmp al,13 |
1188 | cmp al, 13 |
953 | je nextline |
1189 | je .nextline |
954 | cmp al,' ' |
1190 | cmp al,' ' |
955 | je space |
1191 | je .space |
956 | 1192 | ||
957 | cmp al,'0' |
1193 | cmp al,'0' |
958 | jl nextchar |
1194 | jl .loop |
959 | cmp al,'9' |
1195 | cmp al,'9' |
960 | jle usenumbers |
1196 | jle .usenumbers |
961 | 1197 | ||
962 | cmp al,'z' |
1198 | cmp al,'z' |
963 | jg nextchar |
1199 | jg .loop |
964 | cmp al,'a' |
1200 | cmp al,'a' |
965 | jge usesmallfont |
1201 | jge .usesmallfont |
966 | - | ||
967 | cmp al,'Z' |
1202 | |
968 | jg nextchar |
- | |
969 | cmp al,'A' |
1203 | cmp al,'Z' |
970 | jge usebigfont |
1204 | jg .loop |
971 | 1205 | cmp al,'A' |
|
972 | jmp nextchar |
1206 | jge .usebigfont |
973 | 1207 | jmp .loop |
|
974 | 1208 | ||
975 | usesmallfont: |
1209 | .usesmallfont: |
976 | mov edx,eax |
1210 | movzx edx, al |
977 | sub edx,'a' |
1211 | sub edx, 'a' |
978 | mov eax,12 |
1212 | mov eax, 12 |
979 | mul edx |
1213 | mul edx |
980 | mov edx,eax |
- | |
981 | - | ||
982 | pusha |
1214 | |
983 | getimg smallfont,0,edx,20,12,char |
- | |
984 | popa |
- | |
985 | 1215 | stdcall getimg, img_smallfont, 0, eax, 20, 12, img_char |
|
986 | pusha |
1216 | push ecx |
987 | add ecx,4 |
1217 | add ecx, 4 |
988 | aimgtoimg char,ebx,ecx,vscreen,TRANSPARENCY,0 |
1218 | stdcall aimgtoimg, img_char, ebx, ecx, vscreen, TRANSPARENCY |
989 | popa |
- | |
990 | 1219 | pop ecx |
|
- | 1220 | add ebx, 20 |
|
991 | add ebx,20 |
- | |
992 | - | ||
993 | jmp nextchar |
1221 | jmp .loop |
994 | 1222 | ||
995 | usebigfont: |
1223 | .usebigfont: |
996 | mov edx,eax |
1224 | movzx edx, al |
997 | sub edx,'A' |
1225 | sub edx, 'A' |
998 | mov eax,20 |
1226 | mov eax, 20 |
999 | mul edx |
1227 | mul edx |
1000 | mov edx,eax |
- | |
1001 | - | ||
1002 | pusha |
- | |
1003 | getimg bigfont,0,edx,28,20,char |
- | |
1004 | popa |
- | |
1005 | - | ||
1006 | pusha |
- | |
1007 | aimgtoimg char,ebx,ecx,vscreen,TRANSPARENCY,0 |
- | |
1008 | popa |
- | |
- | 1228 | ||
- | 1229 | stdcall getimg, img_bigfont, 0, eax, 28, 20, img_char |
|
1009 | 1230 | stdcall aimgtoimg, img_char, ebx, ecx, vscreen, TRANSPARENCY |
|
- | 1231 | add ebx, 28 |
|
1010 | add ebx,28 |
- | |
1011 | - | ||
1012 | jmp nextchar |
1232 | jmp .loop |
1013 | 1233 | ||
1014 | usenumbers: |
1234 | .usenumbers: |
1015 | mov edx,eax |
1235 | movzx edx, al |
1016 | sub edx,'0' |
1236 | sub edx, '0' |
1017 | mov eax,20 |
1237 | mov eax, 20 |
1018 | mul edx |
1238 | mul edx |
1019 | mov edx,eax |
- | |
1020 | - | ||
1021 | pusha |
- | |
1022 | getimg numbers,0,edx,16,20,char |
- | |
1023 | popa |
- | |
1024 | - | ||
1025 | pusha |
- | |
1026 | aimgtoimg char,ebx,ecx,vscreen,TRANSPARENCY,0 |
- | |
1027 | popa |
- | |
- | 1239 | ||
- | 1240 | stdcall getimg, img_numbers, 0, eax, 16, 20, img_char |
|
1028 | 1241 | stdcall aimgtoimg, img_char, ebx, ecx, vscreen, TRANSPARENCY |
|
- | 1242 | add ebx, 20 |
|
1029 | add ebx,20 |
- | |
1030 | - | ||
1031 | jmp nextchar |
1243 | jmp .loop |
1032 | 1244 | ||
- | 1245 | .space: |
|
1033 | space: |
- | |
1034 | add ebx,20 |
- | |
1035 | - | ||
1036 | nextchar: |
- | |
1037 | inc esi |
- | |
1038 | 1246 | add ebx, 20 |
|
1039 | jmp loadbyte |
1247 | jmp .loop |
1040 | 1248 | ||
1041 | nextline: |
1249 | .nextline: |
1042 | pop ebx |
1250 | pop ebx |
1043 | push ebx |
1251 | push ebx |
1044 | add ecx,26 |
1252 | add ecx, 26 |
- | 1253 | jmp .loop |
|
- | 1254 | ||
- | 1255 | .done: |
|
1045 | inc esi |
1256 | pop ebx |
- | 1257 | ret |
|
1046 | - | ||
1047 | jmp loadbyte |
1258 | |
1048 | - | ||
- | 1259 | ||
- | 1260 | init_starfield: |
|
- | 1261 | ||
- | 1262 | mov ebx, STARS |
|
- | 1263 | .loop: |
|
- | 1264 | cmp ebx, STARS+(STARS_*5) |
|
- | 1265 | jge .done |
|
- | 1266 | ||
- | 1267 | call random_generator |
|
- | 1268 | and al, STARLEVELS |
|
- | 1269 | test al,al |
|
- | 1270 | jnz @f |
|
- | 1271 | inc al |
|
- | 1272 | @@: |
|
- | 1273 | mov byte[ebx],al |
|
- | 1274 | ||
- | 1275 | call random_generator |
|
- | 1276 | and eax, SCREEN_X-1 |
|
- | 1277 | inc eax |
|
- | 1278 | mov word[ebx+1],ax |
|
- | 1279 | ||
- | 1280 | call random_generator |
|
- | 1281 | and eax, SCREEN_Y-1 |
|
- | 1282 | inc eax |
|
- | 1283 | mov word[ebx+3],ax |
|
- | 1284 | ||
1049 | gameover_: |
1285 | add ebx, 5 |
1050 | mov byte[status],2 |
1286 | jmp .loop |
1051 | 1287 | .done: |
|
1052 | ret |
1288 | ret |
1053 | 1289 | ||
1054 | 1290 | ||
1055 | drawstars: |
- | |
- | 1291 | render_starfield: |
|
1056 | mov esi, STARS |
1292 | |
1057 | 1293 | mov esi, STARS |
|
1058 | .loop: |
1294 | .loop: |
1059 | cmp esi, STARS+(STARS_*5) |
1295 | cmp esi, STARS+(STARS_*5) |
1060 | jge .done |
1296 | jge .done |
1061 | 1297 | ||
1062 | movzx eax, byte[esi] ; z (speed, brightness) |
1298 | movzx eax, byte[esi] ; z (speed, brightness) |
1063 | movzx ebx, word[esi+1] ; x |
1299 | movzx ebx, word[esi+1] ; x |
1064 | movzx ecx, word[esi+3] ; y |
1300 | movzx ecx, word[esi+3] ; y |
1065 | add bx , ax |
1301 | add bx, ax |
1066 | cmp bx , SCREEN_X |
1302 | cmp bx, SCREEN_X |
1067 | jl .moveit |
1303 | jl .moveit |
1068 | 1304 | ||
1069 | xor ebx,ebx |
1305 | xor ebx, ebx |
1070 | inc ebx |
1306 | inc ebx |
1071 | 1307 | ||
1072 | call random_generator |
1308 | call random_generator |
1073 | mov ecx, [generator] |
1309 | mov ecx, [generator] |
1074 | and ecx, SCREEN_Y-1 |
1310 | and ecx, SCREEN_Y-1 |
1075 | inc ecx |
1311 | inc ecx |
1076 | mov word[esi+3],cx |
1312 | mov word[esi+3], cx |
1077 | 1313 | ||
1078 | call random_generator |
1314 | call random_generator |
1079 | and al, STARLEVELS |
1315 | and al, STARLEVELS |
1080 | test al,al |
1316 | test al, al |
1081 | jnz @f |
1317 | jnz @f |
1082 | inc al |
1318 | inc al |
1083 | @@: |
1319 | @@: |
1084 | mov [esi],al |
1320 | mov [esi], al |
1085 | 1321 | ||
1086 | .moveit: |
1322 | .moveit: |
1087 | mov word [esi+1],bx |
1323 | mov word[esi+1], bx |
1088 | 1324 | ||
1089 | movzx eax, byte[esi] |
1325 | movzx eax, byte[esi] |
1090 | inc eax |
1326 | inc eax |
1091 | mov edx, 0xff/(STARLEVELS+1) |
1327 | mov edx, 0xff/(STARLEVELS+1) |
1092 | mul edx |
1328 | mul edx |
1093 | 1329 | ||
1094 | mov ah,al |
1330 | mov ah, al |
1095 | shl eax,8 |
1331 | shl eax, 8 |
1096 | mov al,ah |
1332 | mov al, ah |
1097 | mov ebp, eax |
1333 | mov ebp, eax |
1098 | 1334 | ||
1099 | mov eax, SCREEN_X |
1335 | mov eax, SCREEN_X |
1100 | mul ecx |
1336 | mul ecx |
1101 | add eax, ebx |
1337 | add eax, ebx |
1102 | mov edx, 3 |
1338 | mov edx, 3 |
1103 | mul edx |
1339 | mul edx |
1104 | 1340 | ||
1105 | cmp eax, SCREEN_X*SCREEN_Y*3 |
1341 | cmp eax, SCREEN_X*SCREEN_Y*3 |
1106 | jg @f |
1342 | jg @f |
1107 | add eax, vscreen+8 |
1343 | add eax, vscreen+8 |
1108 | and dword[eax],0xff000000 |
1344 | and dword[eax], 0xff000000 |
1109 | or dword[eax],ebp |
1345 | or dword[eax], ebp |
1110 | @@: |
1346 | @@: |
1111 | 1347 | ||
1112 | add esi, 5 |
1348 | add esi, 5 |
1113 | jmp .loop |
1349 | jmp .loop |
1114 | .done: |
- | |
1115 | - | ||
1116 | ret |
- | |
1117 | - | ||
1118 | - | ||
1119 | createstars: |
- | |
1120 | - | ||
1121 | mov ebx, STARS |
- | |
1122 | .loop: |
- | |
1123 | cmp ebx, STARS+(STARS_*5) |
- | |
1124 | jge .done |
- | |
1125 | - | ||
1126 | call random_generator |
- | |
1127 | and al, STARLEVELS |
- | |
1128 | test al,al |
- | |
1129 | jnz @f |
- | |
1130 | inc al |
- | |
1131 | @@: |
- | |
1132 | mov byte[ebx],al |
- | |
1133 | - | ||
1134 | call random_generator |
- | |
1135 | and eax, SCREEN_X-1 |
- | |
1136 | inc eax |
- | |
1137 | mov word[ebx+1],ax |
- | |
1138 | - | ||
1139 | call random_generator |
- | |
1140 | and eax, SCREEN_Y-1 |
- | |
1141 | inc eax |
- | |
1142 | mov word[ebx+3],ax |
- | |
1143 | - | ||
1144 | add ebx, 5 |
- | |
1145 | jmp .loop |
1350 | |
1146 | .done: |
- | |
1147 | 1351 | .done: |
|
1148 | ret |
- | |
1149 | 1352 | ret |
|
1150 | 1353 | ||
1151 | random_generator: ; (pseudo random, actually :) |
1354 | random_generator: ; (pseudo random, actually :) |
1152 | 1355 | ||
1153 | xor eax,[generator] |
1356 | xor eax, [generator] |
1154 | imul eax,214013 |
1357 | imul eax, 214013 |
1155 | xor eax,0xdeadbeef |
1358 | xor eax, 0xdeadbeef |
1156 | rol eax,9 |
1359 | rol eax, 9 |
1157 | mov [generator],eax |
1360 | mov [generator], eax |
1158 | ror eax,16 |
1361 | ror eax, 16 |
1159 | and eax,0x7fff |
1362 | and eax, 0x7fff |
1160 | 1363 | ||
1161 | ret |
1364 | ret |
1162 | 1365 | ||
1163 | 1366 | ||
1164 | 1367 | ||
1165 | 1368 | ||
1166 | level1: |
1369 | level1: |
1167 | db 4,4,4,4,4 |
1370 | db 4,4,4,4,4 |
1168 | db 3,3,3,3,3 |
1371 | db 3,3,3,3,3 |
1169 | db 2,2,2,2,2 |
1372 | db 2,2,2,2,2 |
1170 | db 1,1,1,1,1 |
1373 | db 1,1,1,1,1 |
1171 | 1374 | ||
1172 | level2: |
1375 | level2: |
1173 | db 4,1,3,1,4 |
1376 | db 4,1,3,1,4 |
1174 | db 4,3,2,3,4 |
1377 | db 4,3,2,3,4 |
1175 | db 0,4,1,4,0 |
1378 | db 0,4,1,4,0 |
1176 | db 0,0,2,0,0 |
1379 | db 0,0,2,0,0 |
1177 | 1380 | ||
1178 | level3: |
1381 | level3: |
1179 | db 1,5,5,5,1 |
1382 | db 1,5,5,5,1 |
1180 | db 1,2,2,2,1 |
1383 | db 1,2,2,2,1 |
1181 | db 3,1,2,1,3 |
1384 | db 3,1,2,1,3 |
1182 | db 4,3,1,3,4 |
1385 | db 4,3,1,3,4 |
1183 | 1386 | ||
1184 | level4: |
1387 | level4: |
1185 | db 4,5,2,5,4 |
1388 | db 4,5,2,5,4 |
1186 | db 5,3,3,3,5 |
1389 | db 5,3,3,3,5 |
1187 | db 4,5,4,5,4 |
1390 | db 4,5,4,5,4 |
1188 | db 1,5,5,5,1 |
1391 | db 1,5,5,5,1 |
1189 | 1392 | ||
1190 | level5: |
1393 | level5: |
1191 | db 5,4,3,4,5 |
1394 | db 5,4,3,4,5 |
1192 | db 5,4,4,4,5 |
1395 | db 5,4,4,4,5 |
1193 | db 4,5,4,5,4 |
1396 | db 4,5,4,5,4 |
1194 | db 3,5,1,5,3 |
1397 | db 3,5,1,5,3 |
1195 | 1398 | ||
1196 | level6: |
1399 | level6: |
1197 | db 1,2,5,4,5 |
1400 | db 1,2,5,4,5 |
1198 | db 5,4,5,2,1 |
1401 | db 5,4,5,2,1 |
1199 | db 1,2,5,4,5 |
1402 | db 1,2,5,4,5 |
1200 | db 1,1,5,1,1 |
1403 | db 1,1,5,1,1 |
1201 | 1404 | ||
1202 | level7: |
1405 | level7: |
1203 | db 1,2,3,2,1 |
1406 | db 1,2,3,2,1 |
1204 | db 1,3,3,3,1 |
1407 | db 1,3,3,3,1 |
1205 | db 3,4,3,4,3 |
1408 | db 3,4,3,4,3 |
1206 | db 5,5,5,5,5 |
1409 | db 5,5,5,5,5 |
1207 | 1410 | ||
1208 | level8: |
1411 | level8: |
1209 | db 1,2,3,4,5 |
1412 | db 1,2,3,4,5 |
1210 | db 3,5,3,5,4 |
1413 | db 3,5,3,5,4 |
1211 | db 4,2,3,2,3 |
1414 | db 4,2,3,2,3 |
1212 | db 5,4,3,2,1 |
1415 | db 5,4,3,2,1 |
1213 | 1416 | ||
1214 | enemy_table: |
1417 | enemy_table: |
1215 | db 0,0,0,0,0 |
1418 | db 0,0,0,0,0 |
1216 | db 0,0,0,0,0 |
1419 | db 0,0,0,0,0 |
1217 | db 0,0,0,0,0 |
1420 | db 0,0,0,0,0 |
1218 | db 0,0,0,0,0 |
1421 | db 0,0,0,0,0 |
1219 | - | ||
1220 | - | ||
1221 | msg1 db 'Vesa mode not supported',13,'Press any key to exit.',13,0 |
1422 | |
- | 1423 | msgAbout db 'Hidnplayrs invaders',13,'KolibriOS version',13,13,'released under GPL',13,'make this game better',13,'if you want to',0 |
|
1222 | msgAbout db 'Hidnplayrs invaders',13,'KolibriOS version',13,13,'released under GPL',13,'make this game better',13,'if you want to',0 |
1424 | title db 'Invaders',0 |
1223 | msgdone db 'You have saved the planet!',0 |
1425 | msgdone db 'You have saved the planet!',0 |
1224 | entername db 'Enter your name highscorer!',0 |
1426 | entername db 'Enter your name highscorer!',0 |
1225 | highscorefile db 'invaders.dat',0 |
1427 | highscorefile db 'invaders.dat',0 |
1226 | points_50 db '5 pt',0 |
1428 | points_50 db '5 pt',0 |
1227 | points_100 db '10 pt',0 |
1429 | points_100 db '10 pt',0 |
1228 | points_150 db '15 pt',0 |
1430 | points_150 db '15 pt',0 |
1229 | points_200 db '20 pt',0 |
1431 | points_200 db '20 pt',0 |
1230 | points_250 db '25 pt',0 |
1432 | points_250 db '25 pt',0 |
1231 | points_1000 db '100 pt',0 |
1433 | points_1000 db '100 pt',0 |
1232 | ship_x dd SHIP_X_POS |
1434 | ship_x dd SHIP_X_POS |
1233 | enemy_x dd 0 |
1435 | enemy_x dd 0 |
1234 | enemy_y dd 0 |
1436 | enemy_y dd 0 |
1235 | enemy_d db 0 |
1437 | enemy_d db 0 |
1236 | current_enemy_x dd 0 |
1438 | current_enemy_x dd 0 |
1237 | current_enemy_y dd 0 |
1439 | current_enemy_y dd 0 |
1238 | bullet_x dd 0 |
1440 | bullet_x dd 0 |
1239 | bullet_y dd 1 |
1441 | bullet_y dd 1 |
1240 | score dd 0 |
1442 | score dd 0 |
1241 | alldeadb db 0 |
1443 | alldeadb db 0 |
1242 | status db 0 ; status: 0=menu 1=game 2=gameover 3=paused 4=about 5=highscorelist 6=levelup 7=highscore... |
1444 | status db 0 ; status: 0=menu 1=game 2=gameover 3=paused 4=about 5=highscorelist 6=levelup 7=highscore... |
1243 | menu db 0 ; menu: 0=start 1=about 2=highscores 3=exit... |
1445 | menu db 0 ; menu: 0=start 1=about 2=highscores 3=exit... |
1244 | generator dd 0x45dd4d15 |
1446 | generator dd 0x45dd4d15 |
1245 | alien_x dd 0 |
1447 | alien_x dd 0 |
1246 | drawroutine dd 0 |
1448 | ;drawroutine dd 0 |
1247 | returnaddr dd 0 |
1449 | returnaddr dd 0 |
1248 | intro dw 0 |
1450 | intro dw 0 |
1249 | scoretext db 'score ' |
1451 | scoretext db 'score ' |
1250 | scorenumb db 0,0,0,0,0,0,0 |
1452 | scorenumb db 0,0,0,0,0,0,0 |
1251 | leveltext db 'level ' |
1453 | leveltext db 'level ' |
1252 | levelnumb db 0,0,0 |
1454 | levelnumb db 0,0,0 |
1253 | lives db 0 |
1455 | lives db 0 |
1254 | level db 1 |
1456 | level db 1 |
1255 | enemy_speed db 1 |
1457 | enemy_speed db 1 |
1256 | namepos db 0 |
1458 | namepos db 0 |
1257 | name db 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x0d,0x00 |
1459 | name db 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x0d,0x00 |
- | 1460 | ||
- | 1461 | enemy_img_list: |
|
- | 1462 | dd img_enemy1 |
|
- | 1463 | dd img_enemy2 |
|
- | 1464 | dd img_enemy3 |
|
- | 1465 | dd img_enemy4 |
|
1258 | - | ||
1259 | - | ||
- | 1466 | dd img_enemy5 |
|
- | 1467 | ||
1260 | gif_bullet file 'bullet2.gif' |
1468 | |
1261 | rb 4 |
1469 | gif_bullet file 'bullet2.gif' |
1262 | - | ||
1263 | gif_bullet2 file 'bullet2.gif' |
1470 | .size = $ - gif_bullet |
1264 | rb 4 |
1471 | gif_bullet2 file 'bullet2.gif' |
1265 | - | ||
1266 | gif_ship file 'ship.gif' |
1472 | .size = $ - gif_bullet2 |
1267 | rb 4 |
1473 | gif_ship file 'ship.gif' |
1268 | - | ||
1269 | gif_enemy1 file 'enemy1.gif' |
1474 | .size = $ - gif_ship |
1270 | rb 4 |
1475 | gif_enemy1 file 'enemy1.gif' |
1271 | - | ||
1272 | gif_enemy2 file 'enemy2.gif' |
1476 | .size = $ - gif_enemy1 |
1273 | rb 4 |
1477 | gif_enemy2 file 'enemy2.gif' |
1274 | - | ||
1275 | gif_enemy3 file 'enemy3.gif' |
1478 | .size = $ - gif_enemy2 |
1276 | rb 4 |
1479 | gif_enemy3 file 'enemy3.gif' |
1277 | - | ||
1278 | gif_enemy4 file 'enemy4.gif' |
1480 | .size = $ - gif_enemy3 |
1279 | rb 4 |
1481 | gif_enemy4 file 'enemy4.gif' |
1280 | - | ||
1281 | gif_enemy5 file 'enemy5.gif' |
1482 | .size = $ - gif_enemy4 |
1282 | rb 4 |
1483 | gif_enemy5 file 'enemy5.gif' |
1283 | - | ||
1284 | gif_alien file 'alien.gif' |
1484 | .size = $ - gif_enemy5 |
1285 | rb 4 |
1485 | gif_alien file 'alien.gif' |
1286 | - | ||
1287 | gif_menu1 file 'menu1.gif' |
1486 | .size = $ - gif_alien |
1288 | rb 4 |
1487 | gif_menu1 file 'menu1.gif' |
1289 | - | ||
1290 | gif_menu2 file 'menu2.gif' |
1488 | .size = $ - gif_menu1 |
1291 | rb 4 |
1489 | gif_menu2 file 'menu2.gif' |
1292 | - | ||
1293 | gif_menu3 file 'menu3.gif' |
1490 | .size = $ - gif_menu2 |
1294 | rb 4 |
1491 | gif_menu3 file 'menu3.gif' |
1295 | - | ||
1296 | gif_menu4 file 'menu4.gif' |
1492 | .size = $ - gif_menu3 |
1297 | rb 4 |
1493 | gif_menu4 file 'menu4.gif' |
1298 | - | ||
1299 | gif_logo file 'logo.gif' |
1494 | .size = $ - gif_menu3 |
1300 | rb 4 |
1495 | gif_logo file 'logo.gif' |
1301 | - | ||
1302 | gif_pause file 'pause.gif' |
1496 | .size = $ - gif_logo |
1303 | rb 4 |
1497 | gif_pause file 'pause.gif' |
1304 | - | ||
1305 | gif_highscore file 'highscores.gif' |
1498 | .size = $ - gif_pause |
1306 | rb 4 |
1499 | gif_highscore file 'highscores.gif' |
1307 | - | ||
1308 | gif_smallfont file 'font_small.gif' |
1500 | .size = $ - gif_highscore |
1309 | rb 4 |
1501 | gif_smallfont file 'font_small.gif' |
1310 | - | ||
1311 | gif_bigfont file 'font_capital.gif' |
1502 | .size = $ - gif_smallfont |
1312 | rb 4 |
1503 | gif_bigfont file 'font_capital.gif' |
1313 | - | ||
1314 | gif_numbers file 'numbers.gif' |
1504 | .size = $ - gif_bigfont |
1315 | rb 4 |
1505 | gif_numbers file 'numbers.gif' |
1316 | - | ||
1317 | gif_levelup file 'nextlevel.gif' |
1506 | .size = $ - gif_numbers |
1318 | rb 4 |
- | |
1319 | - | ||
1320 | gif_gameover file 'gameover.gif' |
- | |
1321 | rb 4 |
- | |
1322 | - | ||
1323 | vscreen: |
- | |
1324 | dd SCREEN_X |
- | |
1325 | dd SCREEN_Y |
- | |
1326 | rb SCREEN_X*SCREEN_Y*3+10 |
- | |
1327 | - | ||
1328 | IM_END: |
- | |
1329 | - | ||
1330 | STARS: |
- | |
1331 | rb STARS_*5 |
- | |
1332 | - | ||
1333 | bullet: |
- | |
1334 | rb BULLET_X*BULLET_Y*3+8+10 |
1507 | gif_levelup file 'nextlevel.gif' |
1335 | - | ||
1336 | bullet2: |
- | |
1337 | rb BULLET_X*BULLET_Y*3+8+10 |
- | |
1338 | - | ||
1339 | ship: |
- | |
1340 | rb SHIP_X*SHIP_Y*3+10 |
- | |
1341 | - | ||
1342 | enemy1: |
- | |
1343 | rb ENEMY_X*ENEMY_Y*3+10 |
- | |
1344 | - | ||
1345 | enemy2: |
- | |
1346 | rb ENEMY_X*ENEMY_Y*3+10 |
- | |
1347 | - | ||
1348 | enemy3: |
- | |
1349 | rb ENEMY_X*ENEMY_Y*3+10 |
- | |
1350 | - | ||
1351 | enemy4: |
- | |
1352 | rb ENEMY_X*ENEMY_Y*3+10 |
- | |
1353 | 1508 | .size = $ - gif_levelup |
|
1354 | enemy5: |
1509 | gif_gameover file 'gameover.gif' |
1355 | rb ENEMY_X*ENEMY_Y*3+10 |
1510 | .size = $ - gif_gameover |
1356 | 1511 | ||
- | 1512 | align 16 |
|
- | 1513 | @IMPORT: |
|
- | 1514 | ||
1357 | alien: |
1515 | library \ |
1358 | rb ALIEN_X*ALIEN_Y*3+10 |
1516 | libimg , 'libimg.obj' |
1359 | - | ||
1360 | menu1: |
- | |
1361 | rb 220*18*3+10 |
- | |
1362 | - | ||
1363 | menu2: |
- | |
1364 | rb 135*18*3+10 |
- | |
1365 | - | ||
1366 | menu3: |
- | |
1367 | rb 245*18*3+10 |
1517 | |
1368 | - | ||
1369 | menu4: |
- | |
1370 | rb 110*18*3+10 |
- | |
1371 | 1518 | import libimg , \ |
|
1372 | logo: |
- | |
1373 | rb 40*540*3+10 |
- | |
1374 | 1519 | libimg.init , 'lib_init' , \ |
|
1375 | pause_: |
- | |
1376 | rb 40*320*3+10 |
- | |
1377 | - | ||
1378 | levelup: |
- | |
1379 | rb 40*320*3+10 |
- | |
1380 | 1520 | img.decode , 'img_decode' , \ |
|
1381 | gameover: |
1521 | img.to_rgb2 , 'img_to_rgb2', \ |
1382 | rb 40*320*3+10 |
- | |
1383 | - | ||
1384 | highscore: |
1522 | img.destroy , 'img_destroy' |
- | 1523 | ||
- | 1524 | ||
- | 1525 | vscreen: |
|
- | 1526 | dd SCREEN_X |
|
- | 1527 | dd SCREEN_Y |
|
- | 1528 | rb SCREEN_X*SCREEN_Y*3 |
|
- | 1529 | ||
- | 1530 | IM_END: |
|
- | 1531 | ||
- | 1532 | STARS rb STARS_*5 |
|
- | 1533 | ||
- | 1534 | img_bullet rb BULLET_X*BULLET_Y*3+8 |
|
- | 1535 | img_bullet2 rb BULLET_X*BULLET_Y*3+8 |
|
- | 1536 | img_ship rb SHIP_X*SHIP_Y*3+8 |
|
1385 | rb 40*530*3+10 |
1537 | img_enemy1 rb ENEMY_X*ENEMY_Y*3+8 |
- | 1538 | img_enemy2 rb ENEMY_X*ENEMY_Y*3+8 |
|
- | 1539 | img_enemy3 rb ENEMY_X*ENEMY_Y*3+8 |
|
- | 1540 | img_enemy4 rb ENEMY_X*ENEMY_Y*3+8 |
|
- | 1541 | img_enemy5 rb ENEMY_X*ENEMY_Y*3+8 |
|
1386 | 1542 | img_alien rb ALIEN_X*ALIEN_Y*3+8 |
|
- | 1543 | img_menu1 rb 220*18*3+8 |
|
1387 | smallfont: |
1544 | img_menu2 rb 135*18*3+8 |
1388 | rb 20*312*3+10 |
1545 | img_menu3 rb 245*18*3+8 |
1389 | 1546 | img_menu4 rb 110*18*3+8 |
|
1390 | bigfont: |
- | |
1391 | rb 28*520*3+10 |
1547 | img_logo rb 40*540*3+8 |
1392 | - | ||
1393 | numbers: |
- | |
1394 | rb 16*200*3+10 |
- | |
1395 | 1548 | img_pause rb 40*320*3+8 |
|
1396 | char: |
1549 | img_levelup rb 40*320*3+8 |
1397 | rb 28*20*3+20 ; biggest char's are 28x20 |
1550 | img_gameover rb 40*320*3+8 |
1398 | 1551 | img_highscore rb 40*530*3+8 |
|
1399 | alienpiece: |
1552 | img_smallfont rb 20*312*3+8 |
1400 | rb ALIEN_X*ALIEN_Y*3+20 |
1553 | img_bigfont rb 28*520*3+8 |
1401 | 1554 | img_numbers rb 16*200*3+8 |
|
1402 | gif_hash_area: |
1555 | |
1403 | rd 4096+1 ;hash area size for unpacking GIF |
1556 | img_char rb 28*20*3+8 |
1404 | 1557 | img_alienpiece rb ALIEN_X*ALIEN_Y*3+8 |
|
1405 | I_END: |
1558 | |
1406 | 1559 | highscorebuffer rb 1024 |
|
1407 | ;include 'dex.inc' |
1560 | |
- | 1561 | I_END: |