Subversion Repositories Kolibri OS

Rev

Rev 4386 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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