Subversion Repositories Kolibri OS

Rev

Rev 4386 | Show entire file | Regard 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 -... Line 45...
-
 
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
Line 28... Line -...
28
 
-
 
29
SHIP_X equ 32
143
 
Line -... Line 144...
-
 
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
Line 90... Line 291...
90
        giftoimg gif_numbers,numbers
291
        decodeimg gif_numbers,gif_numbers.size,img_numbers
Line -... Line 292...
-
 
292
 
-
 
293
        call    init_starfield
-
 
294
        call    render_frame
-
 
295
        call    draw_to_screen
91
 
296
 
-
 
297
mainloop:
-
 
298
 
92
        call  createstars
299
        call    render_frame
-
 
300
        call    draw_to_screen
Line 93... Line 301...
93
        call  drawit
301
        call    bullet_collision_detection
94
        call  [drawroutine]
302
 
95
 
-
 
Line -... Line 303...
-
 
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
 
-
 
312
        mcall   11              ; check for events
-
 
313
  .switch:
96
mainloop:
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:
Line -... Line 324...
-
 
324
        call    draw_window
97
 
325
        jmp     .wait
98
    cmp  byte[status],3 ; if game is paused,...
326
 
99
    je   waitfordraw
327
  .button:
Line -... Line 328...
-
 
328
        mcall   17              ; get button id
-
 
329
 
100
 
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
101
    call drawit
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
Line -... Line 349...
-
 
349
        cmp     [status], 2
-
 
350
        je      key_gameover
102
    call [drawroutine]
351
 
103
    call checkbullet
352
        cmp     ah, KEY_ESC
104
 
-
 
105
   waitfordraw:
-
 
106
 
-
 
Line -... Line 353...
-
 
353
        jne     .no_escape
-
 
354
 
-
 
355
        mov     [status], 0
107
    call waitandgetkey ;;;
356
        mov     [intro], 0
-
 
357
  .no_escape:
Line 108... Line -...
108
    test ah,ah
-
 
109
    jz   mainloop
358
 
110
 
359
        jmp     mainloop
111
    cmp  byte[status],1      ;
-
 
112
    jne  nogame
-
 
113
 
-
 
Line -... Line 360...
-
 
360
 
-
 
361
 
-
 
362
key_game:
114
         cmp  ah, KEY_RIGHT
363
        cmp     ah, KEY_RIGHT
-
 
364
        jnz     .no_right
Line 115... Line -...
115
         jnz  noright
-
 
116
         cmp  dword[ship_x],SCREEN_X-SHIP_X-BOUNDARY
365
 
117
         jge  mainloop
366
        cmp     [ship_x], SCREEN_X-SHIP_X-BOUNDARY
Line 118... Line 367...
118
         add  dword[ship_x],MOVEMENT
367
        jge     mainloop
119
 
368
        add     [ship_x], MOVEMENT
Line 120... Line 369...
120
         jmp  mainloop
369
        jmp     mainloop
121
 
370
  .no_right:
122
       noright:
371
 
123
         cmp  ah, KEY_LEFT
372
        cmp     ah, KEY_LEFT
124
         jnz  noleft
-
 
125
         cmp  dword[ship_x],BOUNDARY
373
        jne     .no_left
-
 
374
 
Line 126... Line -...
126
         jle  mainloop
-
 
127
         sub  dword[ship_x],MOVEMENT
375
        cmp     [ship_x], BOUNDARY
128
 
376
        jle     mainloop
Line 129... Line 377...
129
         jmp  mainloop
377
        sub     [ship_x], MOVEMENT
130
 
378
        jmp     mainloop
131
       noleft:
379
  .no_left:
Line 132... Line 380...
132
         cmp  ah, KEY_UP
380
 
-
 
381
        cmp     ah, KEY_UP
-
 
382
        jne     .no_up
-
 
383
 
Line -... Line 384...
-
 
384
        cmp     [bullet_y], 1
-
 
385
        jg      mainloop
133
         jnz  noup
386
 
-
 
387
        mov     eax, [ship_x]
Line 134... Line -...
134
 
-
 
135
         cmp  dword[bullet_y],1
-
 
136
         jg   mainloop
-
 
Line -... Line 388...
-
 
388
        add     eax, (SHIP_X-BULLET_X)/2
137
 
389
        mov     [bullet_x], eax
138
         mov  eax,dword[ship_x]
390
        mov     [bullet_y], SHIP_Y_POS;-BULLET_Y
139
         add  eax,(SHIP_X-BULLET_X)/2
-
 
140
         mov  dword[bullet_x],eax
-
 
141
         mov  dword[bullet_y],SHIP_Y_POS;-BULLET_Y
-
 
Line -... Line 391...
-
 
391
        jmp     mainloop
-
 
392
  .no_up:
142
 
393
 
143
         jmp  mainloop
394
        cmp     ah, KEY_P
144
 
395
        jne     no_pause
145
       noup:
396
 
146
         cmp  ah,KEY_P
397
        mov     [status], 3
-
 
398
        stdcall aimgtoimg, img_pause, 150, 180, vscreen, TRANSPARENCY
Line 147... Line -...
147
         jnz  no_pause1
-
 
148
 
399
        call    draw_to_screen
149
         mov  byte[status],3
400
 
150
         aimgtoimg pause_,150,180,vscreen,TRANSPARENCY,0
-
 
151
         call [drawroutine]
-
 
152
 
-
 
Line -... Line 401...
-
 
401
        jmp     mainloop
-
 
402
  no_pause:
153
         jmp  mainloop
403
        cmp     ah, KEY_ESC
154
 
404
        jne     .no_escape
155
       no_pause1:
405
 
156
 
406
        mov     [status], 0
157
nogame:
407
        mov     [intro], 0
158
    cmp  byte[status],0
-
 
159
    jne  nomenu
408
  .no_escape:
Line 160... Line 409...
160
 
409
        jmp     mainloop
161
         cmp  ah, KEY_DOWN
410
 
-
 
411
 
-
 
412
key_menu:
Line 162... Line -...
162
         jnz  no_down
-
 
163
 
413
        cmp     ah, KEY_DOWN
164
         cmp  byte[menu],3
414
        jne     .no_down
165
         jne  no_menu1
-
 
166
 
-
 
167
         mov  byte[menu],0
-
 
168
         jmp  nomenu
-
 
169
 
-
 
170
       no_menu1:
-
 
171
         inc  byte[menu]
-
 
172
 
-
 
173
       no_down:
-
 
174
         cmp  ah, KEY_UP
-
 
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]
-
 
Line 185... Line 415...
185
 
415
 
-
 
416
        cmp     [menu], 3
Line -... Line 417...
-
 
417
        jne     @f
-
 
418
        mov     [menu], 0
-
 
419
        jmp     mainloop
186
       no_up:
420
  @@:
-
 
421
        inc     [menu]
Line 187... Line -...
187
 
-
 
188
         cmp  ah, KEY_ESC
-
 
189
         je   exit
-
 
190
 
-
 
191
       no_esc:
-
 
192
         cmp  ah, KEY_ENTER
-
 
193
         jnz  no_enter
-
 
194
 
422
        jmp     mainloop
195
        exemenu:
423
  .no_down:
196
                cmp  byte[menu],0  ;start
424
 
197
                jne  exemenu1
425
        cmp     ah, KEY_UP
198
 
426
        jnz     .no_up
-
 
427
 
Line 199... Line -...
199
              new_game:
-
 
200
                        mov  dword[score],0
428
        cmp     [menu], 0
-
 
429
        jne     @f
-
 
430
        mov     [menu], 3
-
 
431
        jmp     mainloop
-
 
432
  @@:
201
                        mov  eax,[score]
433
        dec     [menu]
Line 202... Line -...
202
                        call convertscore
-
 
203
 
-
 
204
                        mov  esi, level1
-
 
205
                        mov  word[levelnumb],'01'
-
 
Line -... Line 434...
-
 
434
        jmp     mainloop
206
              load_level:
435
  .no_up:
207
                        mov  byte[enemy_speed],1
436
 
Line 208... Line 437...
208
                        mov  dword[enemy_x], ENEMY_STARTING_X
437
        cmp     ah, KEY_ESC
-
 
438
        jne     @f
-
 
439
        mcall   -1
Line 209... Line -...
209
                        mov  dword[enemy_y], ENEMY_STARTING_Y
-
 
210
 
-
 
211
                        mov  edi, enemy_table
-
 
Line 212... Line -...
212
                        mov  ecx, 5
-
 
213
                        rep  movsd
440
  @@:
Line -... Line 441...
-
 
441
 
214
 
442
        cmp     ah, KEY_ENTER
Line 215... Line -...
215
                        mov  byte[status],1
-
 
216
 
-
 
217
                        jmp  mainloop
443
        jnz     .no_enter
Line 218... Line -...
218
 
-
 
219
        exemenu1:
444
 
220
                cmp  byte[menu],1  ;about
445
        cmp     [menu], 0       ;start
221
                jne  exemenu2
446
        je      new_game
222
                mov  byte[status],4
447
 
223
                jmp  mainloop
448
        cmp     [menu], 1       ;about
Line 270... Line 495...
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
Line 274... Line 499...
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
 
Line 277... Line 510...
277
    jne  nohighscore
510
key_highscore:
278
 
511
 
Line 279... Line 512...
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
Line 288... Line 521...
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:
Line 293... Line 526...
293
        mov   esi,name
526
        mov     esi, name
294
        mov   edi,gif_hash_area
527
        mov     edi, highscorebuffer
Line 295... Line 528...
295
        mov   ecx,10
528
        mov     ecx, 10
296
        rep   movsb
529
        rep     movsb
Line 297... Line 530...
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
Line 313... Line 546...
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
Line 315... Line 548...
315
 
548
 
316
@@:
549
  @@:
317
        cmp   byte[namepos],10
550
        cmp     byte[namepos],10
Line 318... Line 551...
318
        jge   nohighscore
551
        jge     mainloop
319
 
552
 
320
        cmp   al,'0'
553
        cmp     al,'0'
321
        jl    nohighscore
554
        jl      mainloop
Line 322... Line 555...
322
        cmp   al,'9'
555
        cmp     al,'9'
323
        jle   @f
556
        jle     @f
324
 
557
 
325
        cmp   al,'z'
558
        cmp     al,'z'
Line 326... Line 559...
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'
Line 331... Line 564...
331
        jg    nohighscore
564
        jg      mainloop
332
        cmp   al,'A'
565
        cmp     al,'A'
333
        jl    nohighscore
566
        jl      mainloop
Line 334... Line 567...
334
@@:
567
  @@:
Line 335... Line 568...
335
 
568
 
Line 336... Line -...
336
        movzx ebx,byte[namepos]
-
 
337
        add   ebx,name
-
 
338
        mov   byte[ebx],al
-
 
Line -... Line 569...
-
 
569
        movzx   ebx, byte[namepos]
339
 
570
        add     ebx, name
340
        inc   byte[namepos]
571
        mov     byte[ebx], al
Line 341... Line 572...
341
 
572
 
342
        jmp   mainloop
573
        inc     byte[namepos]
-
 
574
 
Line -... Line 575...
-
 
575
        jmp     mainloop
343
 
576
 
Line 344... Line -...
344
nohighscore:
-
 
345
    cmp  byte[status],2 ; gameover
-
 
346
    jne  nogameover
-
 
Line -... Line 577...
-
 
577
 
-
 
578
key_gameover:
-
 
579
        cmp     ah, KEY_ENTER
347
 
580
        jne     .no_enter
348
    cmp  ah, KEY_ENTER
581
 
Line -... Line 582...
-
 
582
        ; TODO: test if score is high enough to put in highscore list...
349
    jne  nogameover
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]
350
 
594
        call    convertscore
Line 351... Line 595...
351
        ; test if score is high enough to put in highscore list...
595
 
Line -... Line 596...
-
 
596
        mov     word[levelnumb], '01'
-
 
597
        mov     esi, level1
-
 
598
 
352
        mov   byte[status],7
599
load_level:
-
 
600
        mov     [enemy_speed], 1
-
 
601
        mov     [enemy_x], ENEMY_STARTING_X
-
 
602
        mov     [enemy_y], ENEMY_STARTING_Y
-
 
603
 
-
 
604
        mov     edi, enemy_table
353
 
605
        mov     ecx, 5
-
 
606
        rep     movsd
-
 
607
 
-
 
608
        mov     [status],1
-
 
609
 
-
 
610
        jmp     mainloop
-
 
611
 
354
        jmp   mainloop
612
 
-
 
613
draw_window:
-
 
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]
355
 
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
-
 
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
 
-
 
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
356
nogameover:
641
 
357
    cmp  byte[status],0
642
        ret
358
    je   mainloop
643
 
Line 359... Line 644...
359
 
644
 
-
 
645
load_highscores:
-
 
646
 
-
 
647
        ret
-
 
648
 
-
 
649
 
-
 
650
save_highscores:
-
 
651
 
-
 
652
        ret
-
 
653
 
-
 
654
 
-
 
655
render_frame:
-
 
656
 
-
 
657
        mov     eax, 0x00000000
-
 
658
        call    fillscreen
360
    cmp  ah, KEY_ESC
659
        call    render_starfield
Line -... Line 660...
-
 
660
 
-
 
661
        cmp     [status], 1
-
 
662
        je      render_game
361
    jnz  mainloop
663
        cmp     [status], 2
362
 
664
        je      render_gameover
363
    mov  byte[status],0
665
        cmp     [status], 4
Line 364... Line 666...
364
    mov  word[intro],0
666
        je      render_about
365
 
667
        cmp     [status], 6
366
    jmp  mainloop
668
        je      render_levelup
367
 
669
        cmp     [status], 0
Line 389... Line 691...
389
        mov  ebx,300
691
        mov     ebx, 300
390
        call printtext
692
        call    printtext
Line 391... Line 693...
391
 
693
 
Line 392... Line -...
392
    ret
-
 
393
 
-
 
394
@@:
-
 
Line -... Line 694...
-
 
694
        ret
-
 
695
 
395
    cmp  byte[status],2 ; game over, dude !
696
 
Line 396... Line 697...
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
 
Line 400... Line 701...
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
Line 404... Line 705...
404
 
705
 
Line 405... Line 706...
405
        mov  esi,leveltext
706
        mov     esi, leveltext
406
        mov  ebx,300
-
 
407
        call printtext
707
        mov     ebx, 300
Line 408... Line 708...
408
        aimgtoimg gameover,150,180,vscreen,TRANSPARENCY,0
708
        call    printtext
409
 
709
        stdcall aimgtoimg, img_gameover, 150, 180, vscreen, TRANSPARENCY
410
        ret
710
 
411
 
711
        ret
Line 412... Line 712...
412
@@:
712
 
Line 413... Line 713...
413
    cmp  byte[status],4 ; about screen
713
 
414
    jne  @f
714
render_about:
415
 
715
 
416
        mov  esi,msgAbout
716
        mov     esi, msgAbout
Line 417... Line 717...
417
        mov  ebx,50
717
        mov     ebx, 50
418
        mov  ecx,100
718
        mov     ecx, 100
419
        call printtext
719
        call    printtext
420
 
720
 
Line 421... Line 721...
421
        ret
721
        ret
422
 
722
 
423
@@:
723
 
424
    cmp  byte[status],6 ; level up!
724
render_levelup:
Line 425... Line 725...
425
    jne  @f
725
 
Line 426... Line -...
426
        aimgtoimg ship,dword[ship_x],SHIP_Y_POS,vscreen,TRANSPARENCY,0  ; Draw the ship to buffer
-
 
427
 
-
 
428
        mov  esi,scoretext
-
 
Line 429... Line 726...
429
        mov  ebx,0
726
        stdcall aimgtoimg, img_ship, [ship_x], SHIP_Y_POS, vscreen, TRANSPARENCY; Draw the ship to buffer
Line -... Line 727...
-
 
727
 
Line 430... Line 728...
430
        mov  ecx,SCREEN_Y-24
728
        mov     esi, scoretext
431
        call printtext
729
        mov     ebx, 0
432
 
730
        mov     ecx, SCREEN_Y-24
433
        mov  esi,leveltext
731
        call    printtext
434
        mov  ebx,300
732
 
435
        call printtext
733
        mov     esi, leveltext
436
        aimgtoimg levelup,150,180,vscreen,TRANSPARENCY,0
734
        mov     ebx, 300
437
 
735
        call    printtext
438
        ret
736
        stdcall aimgtoimg, img_levelup, 150, 180, vscreen, TRANSPARENCY
439
 
737
 
440
@@:
738
        ret
441
    cmp  byte[status],0 ; menu!
739
 
442
    jne  @f
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
Line 458... Line 756...
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:
Line 461... Line 759...
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
Line 465... Line 763...
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
Line 471... Line 769...
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
Line 474... Line 772...
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
 
Line 480... Line 778...
480
    .menu_75:
778
  .menu_75:
481
        cmp  word[intro],0
779
        cmp     [intro], 0
482
        jl   .menu_8
780
        jl      .menu_8
Line 483... Line 781...
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
Line 489... Line 787...
489
        mov  ecx,180
787
        mov     ecx, 180
490
        call printtext
788
        call    printtext
491
 
789
 
Line 492... Line 790...
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
Line 498... Line 796...
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
Line 501... Line 799...
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
 
Line 507... Line 805...
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
Line 510... Line 808...
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
Line 516... Line 814...
516
        aimgtoimg enemy4,390,300,vscreen,TRANSPARENCY,0
814
        stdcall aimgtoimg, img_enemy4, 390, 300, vscreen, TRANSPARENCY
517
 
815
 
518
        cmp  word[intro],105
-
 
519
        jl   .menu_8
-
 
520
        mov  esi,points_200
-
 
Line -... Line 816...
-
 
816
        cmp     [intro], 105
-
 
817
        jl      .menu_8
-
 
818
        mov     esi, points_200
521
        mov  ebx,450
819
        mov     ebx, 450
Line 522... Line 820...
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
Line 526... Line 824...
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
Line 530... Line 828...
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
Line -... Line 840...
-
 
840
        mov     esi, points_1000
-
 
841
        mov     ebx, 430
542
        mov  esi,points_1000
842
        mov     ecx, 380
543
        mov  ebx,430
843
        call    printtext
544
        mov  ecx,380
-
 
Line 545... Line 844...
545
        call printtext
844
 
Line 546... Line 845...
546
 
845
    .menu_8:
547
    .menu_8:
846
        ret
548
        ret
847
 
549
@@:
848
 
Line 597... Line 896...
597
        call printtext
896
        call    printtext
Line 598... Line 897...
598
 
897
 
599
        mov  esi,leveltext
898
        mov     esi, leveltext
600
        mov  ebx,300
899
        mov     ebx, 300
601
        call printtext
-
 
Line 602... Line 900...
602
@@:
900
        call    printtext
Line 603... Line 901...
603
 
901
 
604
    ret
902
        ret
605
 
903
 
606
 
904
 
Line 607... Line 905...
607
drawenemys:
905
render_enemies:
Line 608... Line 906...
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
 
Line 612... Line 910...
612
        add  dword[enemy_y],5
910
        add     [enemy_y], 5
Line 613... Line 911...
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
Line 625... Line 923...
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:
-
 
633
 
-
 
634
; initialization
-
 
635
        mov  byte[alldeadb],1
-
 
636
        mov  edi,enemy_table
-
 
637
        mov  eax,dword[enemy_x]
-
 
638
        mov  dword[current_enemy_x],eax
-
 
639
        mov  eax,dword[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
-
 
Line -... Line 930...
-
 
930
  .no_other_dir:
-
 
931
 
-
 
932
; initialization
-
 
933
        mov     [alldeadb],1
-
 
934
        mov     edi, enemy_table
-
 
935
        mov     eax, [enemy_x]
-
 
936
        mov     [current_enemy_x], eax
-
 
937
        mov     eax, [enemy_y]
-
 
938
        mov     [current_enemy_y], eax
-
 
939
 
-
 
940
  .loopit:
-
 
941
        movzx   eax, byte[edi]
688
        popa
942
        test    al, al
Line 689... Line 943...
689
 
943
        jz      .next_alien
690
        jmp  checknext
944
        cmp     al, 5
691
 
945
        ja      .next_alien
Line 692... Line 946...
692
     drawenemy5:
946
        dec     eax
Line 693... Line 947...
693
        mov  byte[alldeadb],0
947
        mov     eax, [enemy_img_list+eax*4]
694
        pusha
948
 
Line 695... Line 949...
695
        aimgtoimg enemy5,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
949
  .drawenemy:
696
        popa
950
        mov     [alldeadb], 0
Line 697... Line 951...
697
 
951
        stdcall aimgtoimg, eax, [current_enemy_x], [current_enemy_y], vscreen, TRANSPARENCY
-
 
952
;        jmp  checknext
Line 698... Line -...
698
;        jmp  checknext
-
 
699
 
-
 
700
     checknext:
953
 
701
        cmp  byte[enemy_d],2
954
  .checknext:
702
        jge  dont_change_dir
955
        cmp     [enemy_d], 2
703
 
956
        jge     .dont_change_dir
704
           movzx eax,byte[enemy_speed]
957
 
-
 
958
        movzx   eax, [enemy_speed]
-
 
959
 
Line -... Line 960...
-
 
960
        cmp     [enemy_d], 0
705
 
961
        jbe     .change_dir
-
 
962
 
Line 706... Line 963...
706
           cmp  byte[enemy_d],0
963
        cmp     dword[current_enemy_x],eax
707
           jbe  change_dir
-
 
708
 
964
        jg      .dont_change_dir
Line 709... Line 965...
709
           cmp  dword[current_enemy_x],eax
965
 
710
           jg   dont_change_dir
966
        mov     [enemy_d], 2
711
 
967
        jmp     .dont_change_dir
Line 712... Line 968...
712
           mov  byte[enemy_d],2
968
 
713
 
969
  .change_dir:
714
           jmp  dont_change_dir
970
        mov     ebx, SCREEN_X-ENEMY_X
715
 
971
        sub     ebx, eax
716
        change_dir:
972
        cmp     dword[current_enemy_x],ebx
717
           mov  ebx, SCREEN_X-ENEMY_X
973
        jl      .dont_change_dir
Line 718... Line 974...
718
           sub  ebx, eax
974
 
719
           cmp  dword[current_enemy_x],ebx
975
        mov     [enemy_d], 3
720
           jl   dont_change_dir
976
 
721
 
977
  .dont_change_dir:
722
           mov  byte[enemy_d],3
978
        cmp     [current_enemy_y], SHIP_Y_POS-ENEMY_Y-BOUNDARY
723
 
979
        jle     .next_alien                                     ;;;;;;
724
        dont_change_dir:
980
 
725
           cmp  dword[current_enemy_y],SHIP_Y_POS-ENEMY_Y-BOUNDARY
981
        mov     [status], 2
Line 726... Line 982...
726
           je   gameover_
982
        ret
727
 
983
 
Line 728... Line 984...
728
     dead_alien:
984
  .next_alien:
729
        cmp  edi,enemy_table+20
-
 
730
        jge  alldead
985
        cmp     edi, enemy_table+20
731
 
986
        jge     .alldead
Line 732... Line 987...
732
        inc  edi
987
 
733
        add  dword[current_enemy_x],ENEMY_X+BOUNDARY
988
        inc     edi
734
        mov  eax,dword[current_enemy_x]
989
        add     dword[current_enemy_x],ENEMY_X+BOUNDARY
735
        sub  eax,dword[enemy_x]
-
 
736
        cmp  eax,5*(ENEMY_X+BOUNDARY)
990
        mov     eax,dword[current_enemy_x]
737
        jl   no_newline
-
 
738
 
991
        sub     eax,dword[enemy_x]
739
        sub  dword[current_enemy_x],5*(ENEMY_X+BOUNDARY)
992
        cmp     eax,5*(ENEMY_X+BOUNDARY)
Line 740... Line 993...
740
        add  dword[current_enemy_y],ENEMY_Y+BOUNDARY
993
        jl      .no_newline
741
      no_newline:
994
 
Line 768... Line 1021...
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
  @@:
Line 772... Line 1025...
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:
Line 782... Line -...
782
        ret
-
 
783
 
-
 
784
drawbullet:
-
 
785
        cmp  dword[bullet_y],BULLETSPEED
-
 
Line 786... Line -...
786
        jl   nobullet
-
 
Line -... Line 1033...
-
 
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
 
Line 789... Line -...
789
        aimgtoimg bullet,dword[bullet_x],dword[bullet_y],vscreen,TRANSPARENCY,0
-
 
790
 
-
 
791
      nobullet:
-
 
Line 792... Line -...
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
Line 814... Line 1053...
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
Line 818... Line 1057...
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
 
Line 821... Line 1060...
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
Line 824... Line 1063...
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)
Line 831... Line 1070...
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)
Line 832... Line 1071...
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                    ;
Line 839... Line 1078...
839
        cmp  dword[bullet_x],eax         ;
1078
        cmp     [bullet_x], eax                 ;
840
        jg   nextcheck                   ;
1079
        jg      .nextcheck                      ;
841
 
1080
 
Line 842... Line 1081...
842
        jmp  hit
1081
        jmp     .hit
843
 
1082
 
844
      nextcheck:
1083
  .nextcheck:
Line 845... Line 1084...
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]
Line 848... Line 1087...
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)
Line 850... Line 1089...
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
Line 854... Line 1093...
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
Line 863... Line 1102...
863
 
1102
 
864
        mov  eax,[score]
1103
        mov     eax,[score]
865
        call convertscore
1104
        call    convertscore
Line 866... Line 1105...
866
 
1105
 
Line 867... Line 1106...
867
        mov  byte[edi],0                ; hide the enemy
1106
        mov     byte[edi],0                     ; hide the enemy
868
     hidebullet:
-
 
869
        mov  dword[bullet_y],1          ; mov the bullet to top of screen (hide it)
1107
  .hidebullet:
Line -... Line 1108...
-
 
1108
        mov     [bullet_y], 1                   ; mov the bullet to top of screen (hide it)
-
 
1109
        jmp     .noalienhit
870
        jmp  noalienhit
1110
 
-
 
1111
  .nohit:
871
 
1112
        mov     eax, [alien_x]                  ; check if we hit the big alien in the ufo
872
     nohit:
1113
        cmp     [bullet_x], eax
873
        mov  eax,[alien_x]              ; check if we hit the big alien in the ufo
1114
        jl      .noalienhit
874
        cmp  [bullet_x],eax
1115
        add     eax, ALIEN_X-BULLET_X
875
        jl   noalienhit
1116
        cmp     [bullet_x], eax
Line 935... Line 1176...
935
 
1176
 
Line 936... Line 1177...
936
        ret
1177
        ret
937
 
-
 
938
 
-
 
939
printtext:
-
 
940
        push  ebx
-
 
941
 
-
 
942
     loadbyte:
-
 
Line 943... Line 1178...
943
        movzx eax, byte[esi]
1178
 
944
        test  eax, eax
-
 
945
        jnz   checkbyte
-
 
Line -... Line 1179...
-
 
1179
 
946
 
1180
printtext:
-
 
1181
 
-
 
1182
        push    ebx
947
        pop   ebx
1183
 
948
 
1184
  .loop:
949
        ret
1185
        lodsb
950
 
1186
        test    al, al
Line 951... Line 1187...
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,' '
Line 955... Line 1191...
955
        je   space
1191
        je      .space
956
 
1192
 
957
        cmp  al,'0'
1193
        cmp     al,'0'
958
        jl   nextchar
1194
        jl      .loop
Line 959... Line 1195...
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
-
 
964
        cmp  al,'a'
1199
        jg      .loop
965
        jge  usesmallfont
-
 
Line 966... Line 1200...
966
 
1200
        cmp     al,'a'
967
        cmp  al,'Z'
1201
        jge     .usesmallfont
968
        jg   nextchar
1202
 
969
        cmp  al,'A'
1203
        cmp     al,'Z'
970
        jge  usebigfont
1204
        jg      .loop
971
 
-
 
Line 972... Line -...
972
        jmp  nextchar
-
 
973
 
1205
        cmp     al,'A'
974
 
-
 
975
    usesmallfont:
-
 
976
        mov  edx,eax
1206
        jge     .usebigfont
977
        sub  edx,'a'
1207
        jmp     .loop
978
        mov  eax,12
1208
 
979
        mul  edx
1209
  .usesmallfont:
980
        mov  edx,eax
-
 
981
 
1210
        movzx   edx, al
-
 
1211
        sub     edx, 'a'
Line 982... Line -...
982
        pusha
-
 
983
        getimg smallfont,0,edx,20,12,char
-
 
984
        popa
1212
        mov     eax, 12
985
 
1213
        mul     edx
986
        pusha
1214
 
987
        add  ecx,4
1215
        stdcall getimg, img_smallfont, 0, eax, 20, 12, img_char
988
        aimgtoimg char,ebx,ecx,vscreen,TRANSPARENCY,0
1216
        push    ecx
989
        popa
-
 
990
 
-
 
991
        add  ebx,20
-
 
992
 
-
 
993
        jmp  nextchar
-
 
994
 
-
 
995
    usebigfont:
-
 
996
        mov  edx,eax
-
 
997
        sub  edx,'A'
-
 
Line -... Line 1217...
-
 
1217
        add     ecx, 4
-
 
1218
        stdcall aimgtoimg, img_char, ebx, ecx, vscreen, TRANSPARENCY
998
        mov  eax,20
1219
        pop     ecx
-
 
1220
        add     ebx, 20
Line 999... Line -...
999
        mul  edx
-
 
1000
        mov  edx,eax
-
 
1001
 
1221
        jmp     .loop
1002
        pusha
1222
 
1003
        getimg bigfont,0,edx,28,20,char
1223
  .usebigfont:
1004
        popa
1224
        movzx   edx, al
1005
 
1225
        sub     edx, 'A'
1006
        pusha
-
 
1007
        aimgtoimg char,ebx,ecx,vscreen,TRANSPARENCY,0
-
 
1008
        popa
-
 
1009
 
-
 
1010
        add  ebx,28
-
 
1011
 
-
 
1012
        jmp  nextchar
-
 
1013
 
-
 
1014
    usenumbers:
-
 
Line -... Line 1226...
-
 
1226
        mov     eax, 20
-
 
1227
        mul     edx
1015
        mov  edx,eax
1228
 
-
 
1229
        stdcall getimg, img_bigfont, 0, eax, 28, 20, img_char
Line 1016... Line -...
1016
        sub  edx,'0'
-
 
1017
        mov  eax,20
-
 
1018
        mul  edx
1230
        stdcall aimgtoimg, img_char, ebx, ecx, vscreen, TRANSPARENCY
1019
        mov  edx,eax
1231
        add     ebx, 28
-
 
1232
        jmp     .loop
Line 1020... Line -...
1020
 
-
 
1021
        pusha
-
 
1022
        getimg numbers,0,edx,16,20,char
-
 
1023
        popa
-
 
1024
 
-
 
1025
        pusha
1233
 
1026
        aimgtoimg char,ebx,ecx,vscreen,TRANSPARENCY,0
1234
  .usenumbers:
1027
        popa
1235
        movzx   edx, al
1028
 
1236
        sub     edx, '0'
-
 
1237
        mov     eax, 20
-
 
1238
        mul     edx
-
 
1239
 
1029
        add  ebx,20
1240
        stdcall getimg, img_numbers, 0, eax, 16, 20, img_char
-
 
1241
        stdcall aimgtoimg, img_char, ebx, ecx, vscreen, TRANSPARENCY
Line 1030... Line -...
1030
 
-
 
Line 1031... Line 1242...
1031
        jmp  nextchar
1242
        add     ebx, 20
1032
 
-
 
Line -... Line 1243...
-
 
1243
        jmp     .loop
-
 
1244
 
-
 
1245
  .space:
-
 
1246
        add     ebx, 20
-
 
1247
        jmp     .loop
-
 
1248
 
-
 
1249
  .nextline:
-
 
1250
        pop     ebx
-
 
1251
        push    ebx
-
 
1252
        add     ecx, 26
-
 
1253
        jmp     .loop
-
 
1254
 
-
 
1255
  .done:
-
 
1256
        pop     ebx
-
 
1257
        ret
-
 
1258
 
-
 
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
1033
    space:
1269
        test    al,al
Line 1034... Line 1270...
1034
        add  ebx,20
1270
        jnz     @f
1035
 
-
 
Line -... Line 1271...
-
 
1271
        inc     al
1036
    nextchar:
1272
  @@:
1037
        inc  esi
1273
        mov     byte[ebx],al
1038
 
1274
 
Line 1039... Line 1275...
1039
        jmp  loadbyte
1275
        call    random_generator
Line 1109... Line 1345...
1109
    or    dword[eax],ebp
1345
        or      dword[eax], ebp
1110
   @@:
1346
  @@:
Line 1111... Line 1347...
1111
 
1347
 
1112
    add   esi, 5
1348
        add     esi, 5
1113
    jmp   .loop
-
 
1114
.done:
-
 
1115
 
-
 
Line 1116... Line -...
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
1349
        jmp     .loop
1145
    jmp   .loop
-
 
1146
.done:
1350
 
Line 1147... Line -...
1147
 
-
 
1148
    ret
1351
  .done:
Line 1149... Line 1352...
1149
 
1352
        ret
1150
 
1353
 
1151
random_generator:  ; (pseudo random, actually :)
1354
random_generator:  ; (pseudo random, actually :)
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
Line 1258... Line -...
1258
 
-
 
1259
 
-
 
Line -... Line 1466...
-
 
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
-
 
Line 1353... Line 1508...
1353
 
1508
  .size = $ - gif_levelup
1354
enemy5:
1509
gif_gameover    file 'gameover.gif'
Line 1355... Line 1510...
1355
rb ENEMY_X*ENEMY_Y*3+10
1510
  .size = $ - gif_gameover
1356
 
1511
 
Line -... Line 1512...
-
 
1512
align 16
-
 
1513
@IMPORT:
-
 
1514
 
1357
alien:
1515
library                         \
1358
rb ALIEN_X*ALIEN_Y*3+10
1516
        libimg , 'libimg.obj'
Line 1359... Line -...
1359
 
-
 
1360
menu1:
-
 
Line 1361... Line -...
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' , \
Line 1381... Line 1521...
1381
gameover:
1521
        img.to_rgb2 , 'img_to_rgb2', \
1382
rb 40*320*3+10
-
 
Line 1383... Line -...
1383
 
-
 
1384
highscore:
1522
        img.destroy , 'img_destroy'
Line -... Line 1523...
-
 
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
Line 1387... Line 1544...
1387
smallfont:
1544
img_menu2       rb 135*18*3+8
1388
rb 20*312*3+10
1545
img_menu3       rb 245*18*3+8
Line 1389... Line 1546...
1389
 
1546
img_menu4       rb 110*18*3+8
1390
bigfont:
-
 
Line 1391... Line 1547...
1391
rb 28*520*3+10
1547
img_logo        rb 40*540*3+8
1392
 
-
 
1393
numbers:
-
 
1394
rb 16*200*3+10
-