Subversion Repositories Kolibri OS

Rev

Rev 950 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 950 Rev 4386
Line 48... Line 48...
48
WINDOW_Y equ 100
48
WINDOW_Y equ 100
Line 49... Line 49...
49
 
49
 
50
BULLET_X equ 10
50
BULLET_X equ 10
Line 51... Line 51...
51
BULLET_Y equ 10
51
BULLET_Y equ 10
52
 
52
 
Line 53... Line 53...
53
STARS_	 equ 226
53
STARS_   equ 226
54
STARLEVELS equ 3
54
STARLEVELS equ 3
Line 65... Line 65...
65
 
65
 
66
include 'ascgl.inc'
66
include 'ascgl.inc'
Line 67... Line 67...
67
include 'invaders_kolibri.inc'
67
include 'invaders_kolibri.inc'
68
 
68
 
69
decodegif:
69
decodegif:
70
	giftoimg gif_bullet,bullet
70
        giftoimg gif_bullet,bullet
71
	giftoimg gif_bullet2,bullet2
71
        giftoimg gif_bullet2,bullet2
72
	giftoimg gif_ship,ship
72
        giftoimg gif_ship,ship
73
	giftoimg gif_enemy1,enemy1
73
        giftoimg gif_enemy1,enemy1
74
	giftoimg gif_enemy2,enemy2
74
        giftoimg gif_enemy2,enemy2
75
	giftoimg gif_enemy3,enemy3
75
        giftoimg gif_enemy3,enemy3
76
	giftoimg gif_enemy4,enemy4
76
        giftoimg gif_enemy4,enemy4
77
	giftoimg gif_enemy5,enemy5
77
        giftoimg gif_enemy5,enemy5
78
	giftoimg gif_alien,alien
78
        giftoimg gif_alien,alien
79
	giftoimg gif_menu1,menu1
79
        giftoimg gif_menu1,menu1
80
	giftoimg gif_menu2,menu2
80
        giftoimg gif_menu2,menu2
81
	giftoimg gif_menu3,menu3
81
        giftoimg gif_menu3,menu3
82
	giftoimg gif_menu4,menu4
82
        giftoimg gif_menu4,menu4
83
	giftoimg gif_logo,logo
83
        giftoimg gif_logo,logo
84
	giftoimg gif_pause,pause_
84
        giftoimg gif_pause,pause_
85
	giftoimg gif_levelup,levelup
85
        giftoimg gif_levelup,levelup
86
	giftoimg gif_gameover,gameover
86
        giftoimg gif_gameover,gameover
87
	giftoimg gif_highscore,highscore
87
        giftoimg gif_highscore,highscore
88
	giftoimg gif_smallfont,smallfont
88
        giftoimg gif_smallfont,smallfont
89
	giftoimg gif_bigfont,bigfont
89
        giftoimg gif_bigfont,bigfont
90
	giftoimg gif_numbers,numbers
90
        giftoimg gif_numbers,numbers
91
 
91
 
92
	call  createstars
92
        call  createstars
Line 93... Line 93...
93
	call  drawit
93
        call  drawit
Line 94... Line 94...
94
	call  [drawroutine]
94
        call  [drawroutine]
95
 
95
 
Line 96... Line 96...
96
mainloop:
96
mainloop:
97
 
97
 
98
    cmp  byte[status],3 ; if game is paused,...
98
    cmp  byte[status],3 ; if game is paused,...
Line 99... Line 99...
99
    je	 waitfordraw
99
    je   waitfordraw
Line 100... Line 100...
100
 
100
 
101
    call drawit
101
    call drawit
102
    call [drawroutine]
102
    call [drawroutine]
Line 103... Line 103...
103
    call checkbullet
103
    call checkbullet
104
 
104
 
Line 105... Line 105...
105
   waitfordraw:
105
   waitfordraw:
106
 
106
 
107
    call waitandgetkey ;;;
107
    call waitandgetkey ;;;
108
    test ah,ah
108
    test ah,ah
109
    jz	 mainloop
109
    jz   mainloop
Line 110... Line 110...
110
 
110
 
Line 111... Line 111...
111
    cmp  byte[status],1      ;
111
    cmp  byte[status],1      ;
112
    jne  nogame
112
    jne  nogame
113
 
113
 
114
	 cmp  ah, KEY_RIGHT
114
         cmp  ah, KEY_RIGHT
115
	 jnz  noright
115
         jnz  noright
116
	 cmp  dword[ship_x],SCREEN_X-SHIP_X-BOUNDARY
116
         cmp  dword[ship_x],SCREEN_X-SHIP_X-BOUNDARY
Line 117... Line 117...
117
	 jge  mainloop
117
         jge  mainloop
Line 118... Line 118...
118
	 add  dword[ship_x],MOVEMENT
118
         add  dword[ship_x],MOVEMENT
119
 
119
 
120
	 jmp  mainloop
120
         jmp  mainloop
Line 121... Line 121...
121
 
121
 
122
       noright:
122
       noright:
Line 123... Line 123...
123
	 cmp  ah, KEY_LEFT
123
         cmp  ah, KEY_LEFT
124
	 jnz  noleft
124
         jnz  noleft
125
	 cmp  dword[ship_x],BOUNDARY
125
         cmp  dword[ship_x],BOUNDARY
126
	 jle  mainloop
126
         jle  mainloop
Line 127... Line 127...
127
	 sub  dword[ship_x],MOVEMENT
127
         sub  dword[ship_x],MOVEMENT
Line 128... Line 128...
128
 
128
 
129
	 jmp  mainloop
129
         jmp  mainloop
130
 
130
 
Line 131... Line 131...
131
       noleft:
131
       noleft:
132
	 cmp  ah, KEY_UP
132
         cmp  ah, KEY_UP
133
	 jnz  noup
133
         jnz  noup
Line 134... Line 134...
134
 
134
 
Line 135... Line 135...
135
	 cmp  dword[bullet_y],1
135
         cmp  dword[bullet_y],1
Line 136... Line 136...
136
	 jg   mainloop
136
         jg   mainloop
137
 
137
 
138
	 mov  eax,dword[ship_x]
138
         mov  eax,dword[ship_x]
Line 139... Line 139...
139
	 add  eax,(SHIP_X-BULLET_X)/2
139
         add  eax,(SHIP_X-BULLET_X)/2
140
	 mov  dword[bullet_x],eax
140
         mov  dword[bullet_x],eax
Line 141... Line 141...
141
	 mov  dword[bullet_y],SHIP_Y_POS;-BULLET_Y
141
         mov  dword[bullet_y],SHIP_Y_POS;-BULLET_Y
142
 
142
 
Line 143... Line 143...
143
	 jmp  mainloop
143
         jmp  mainloop
144
 
144
 
Line 145... Line 145...
145
       noup:
145
       noup:
146
	 cmp  ah,KEY_P
146
         cmp  ah,KEY_P
Line 147... Line 147...
147
	 jnz  no_pause1
147
         jnz  no_pause1
148
 
148
 
149
	 mov  byte[status],3
149
         mov  byte[status],3
Line 150... Line 150...
150
	 aimgtoimg pause_,150,180,vscreen,TRANSPARENCY,0
150
         aimgtoimg pause_,150,180,vscreen,TRANSPARENCY,0
151
	 call [drawroutine]
151
         call [drawroutine]
Line 152... Line 152...
152
 
152
 
153
	 jmp  mainloop
153
         jmp  mainloop
Line 154... Line 154...
154
 
154
 
155
       no_pause1:
155
       no_pause1:
Line 156... Line 156...
156
 
156
 
Line 157... Line 157...
157
nogame:
157
nogame:
158
    cmp  byte[status],0
158
    cmp  byte[status],0
Line 159... Line 159...
159
    jne  nomenu
159
    jne  nomenu
160
 
160
 
161
	 cmp  ah, KEY_DOWN
161
         cmp  ah, KEY_DOWN
Line 162... Line 162...
162
	 jnz  no_down
162
         jnz  no_down
163
 
163
 
164
	 cmp  byte[menu],3
164
         cmp  byte[menu],3
165
	 jne  no_menu1
165
         jne  no_menu1
166
 
166
 
167
	 mov  byte[menu],0
167
         mov  byte[menu],0
168
	 jmp  nomenu
168
         jmp  nomenu
169
 
169
 
170
       no_menu1:
170
       no_menu1:
171
	 inc  byte[menu]
171
         inc  byte[menu]
172
 
172
 
173
       no_down:
173
       no_down:
174
	 cmp  ah, KEY_UP
174
         cmp  ah, KEY_UP
175
	 jnz  no_up
175
         jnz  no_up
176
 
176
 
177
	 cmp  byte[menu],0
177
         cmp  byte[menu],0
178
	 jne  no_menu0
178
         jne  no_menu0
179
 
179
 
180
	 mov  byte[menu],3
180
         mov  byte[menu],3
181
	 jmp  nomenu
181
         jmp  nomenu
182
 
182
 
183
       no_menu0:
183
       no_menu0:
184
	 dec  byte[menu]
184
         dec  byte[menu]
185
 
185
 
186
       no_up:
186
       no_up:
187
 
187
 
188
	 cmp  ah, KEY_ESC
188
         cmp  ah, KEY_ESC
189
	 je   exit
189
         je   exit
190
 
190
 
191
       no_esc:
191
       no_esc:
192
	 cmp  ah, KEY_ENTER
192
         cmp  ah, KEY_ENTER
193
	 jnz  no_enter
193
         jnz  no_enter
194
 
194
 
195
	exemenu:
195
        exemenu:
196
		cmp  byte[menu],0  ;start
196
                cmp  byte[menu],0  ;start
197
		jne  exemenu1
197
                jne  exemenu1
198
 
198
 
199
	      new_game:
199
              new_game:
200
			mov  dword[score],0
200
                        mov  dword[score],0
201
			mov  eax,[score]
201
                        mov  eax,[score]
Line 202... Line 202...
202
			call convertscore
202
                        call convertscore
203
 
203
 
204
			mov  esi, level1
204
                        mov  esi, level1
205
			mov  word[levelnumb],'01'
205
                        mov  word[levelnumb],'01'
Line 248... Line 248...
248
    jne  nolevelup
248
    jne  nolevelup
Line 249... Line 249...
249
 
249
 
250
    cmp  ah, KEY_ENTER
250
    cmp  ah, KEY_ENTER
Line 251... Line 251...
251
    jne  nolevelup
251
    jne  nolevelup
Line 252... Line 252...
252
 
252
 
253
	inc  byte[level]
253
        inc  byte[level]
254
 
254
 
Line 255... Line 255...
255
;        cmp  byte[level],5
255
;        cmp  byte[level],5
256
;        jne  @f
256
;        jne  @f
257
;        mov  byte[level],0
257
;        mov  byte[level],0
258
 
258
 
259
;@@:
259
;@@:
260
	inc  byte[levelnumb+1]
260
        inc  byte[levelnumb+1]
Line 261... Line 261...
261
	cmp  byte[levelnumb+1],'9'
261
        cmp  byte[levelnumb+1],'9'
262
	jle  @f
262
        jle  @f
263
	mov  byte[levelnumb+1],'0'
263
        mov  byte[levelnumb+1],'0'
264
	inc  byte[levelnumb]
264
        inc  byte[levelnumb]
265
 
265
 
266
       @@:
266
       @@:
267
	mov  eax,20
267
        mov  eax,20
268
	mov  ah,byte[level]
268
        mov  ah,byte[level]
Line 269... Line 269...
269
	and  ah,7
269
        and  ah,7
270
	mul  ah
270
        mul  ah
271
	add  eax,level1
271
        add  eax,level1
Line 272... Line 272...
272
	mov  esi,eax
272
        mov  esi,eax
273
	jmp  load_level
273
        jmp  load_level
Line 274... Line 274...
274
 
274
 
275
nolevelup:
275
nolevelup:
276
    cmp  byte[status],7
276
    cmp  byte[status],7
277
    jne  nohighscore
277
    jne  nohighscore
278
 
278
 
279
	cmp   ah, KEY_ENTER
279
        cmp   ah, KEY_ENTER
280
	jne   @f
280
        jne   @f
281
 
281
 
282
	call  load_highscores
282
        call  load_highscores
Line 283... Line 283...
283
	mov   eax,dword[score]
283
        mov   eax,dword[score]
284
	mov   ebx,gif_hash_area+140
284
        mov   ebx,gif_hash_area+140
285
    .findscore:
285
    .findscore:
286
	cmp   ebx,gif_hash_area+100
286
        cmp   ebx,gif_hash_area+100
287
	je    .topscore
287
        je    .topscore
Line 288... Line 288...
288
	sub   ebx,4
288
        sub   ebx,4
289
	cmp   eax,dword[ebx]
289
        cmp   eax,dword[ebx]
Line 290... Line 290...
290
	jg    .findscore
290
        jg    .findscore
291
 
291
 
Line 292... Line 292...
292
    .topscore:
292
    .topscore:
293
	mov   esi,name
293
        mov   esi,name
294
	mov   edi,gif_hash_area
294
        mov   edi,gif_hash_area
Line 295... Line 295...
295
	mov   ecx,10
295
        mov   ecx,10
296
	rep   movsb
296
        rep   movsb
Line 297... Line 297...
297
 
297
 
298
	mov   eax,dword[score]
298
        mov   eax,dword[score]
299
	mov   dword[gif_hash_area+100],eax
299
        mov   dword[gif_hash_area+100],eax
300
 
300
 
Line 301... Line 301...
301
	call  save_highscores
301
        call  save_highscores
302
	mov   byte[status],5
302
        mov   byte[status],5
303
 
303
 
Line 304... Line 304...
304
@@:
304
@@:
305
	cmp   ah,14
305
        cmp   ah,14
306
	jne   @f
306
        jne   @f
307
 
307
 
308
	cmp   byte[namepos],0
308
        cmp   byte[namepos],0
309
	je    @f
309
        je    @f
310
 
310
 
311
	dec   byte[namepos]
311
        dec   byte[namepos]
312
	movzx ebx,byte[namepos]
312
        movzx ebx,byte[namepos]
313
	add   ebx,name
313
        add   ebx,name
314
	mov   byte[ebx],0x11  ; this is a character we dont print
314
        mov   byte[ebx],0x11  ; this is a character we dont print
315
 
315
 
316
@@:
316
@@:
317
	cmp   byte[namepos],10
317
        cmp   byte[namepos],10
318
	jge   nohighscore
318
        jge   nohighscore
Line 319... Line 319...
319
 
319
 
320
	cmp   al,'0'
320
        cmp   al,'0'
321
	jl    nohighscore
321
        jl    nohighscore
Line 322... Line 322...
322
	cmp   al,'9'
322
        cmp   al,'9'
Line 323... Line 323...
323
	jle   @f
323
        jle   @f
Line 324... Line 324...
324
 
324
 
325
	cmp   al,'z'
325
        cmp   al,'z'
326
	jg    nohighscore
326
        jg    nohighscore
Line 327... Line 327...
327
	cmp   al,'a'
327
        cmp   al,'a'
328
	jge   @f
328
        jge   @f
Line 329... Line 329...
329
 
329
 
330
	cmp   al,'Z'
330
        cmp   al,'Z'
Line 331... Line 331...
331
	jg    nohighscore
331
        jg    nohighscore
Line 332... Line 332...
332
	cmp   al,'A'
332
        cmp   al,'A'
333
	jl    nohighscore
333
        jl    nohighscore
334
@@:
334
@@:
Line 335... Line 335...
335
 
335
 
336
	movzx ebx,byte[namepos]
336
        movzx ebx,byte[namepos]
Line 337... Line 337...
337
	add   ebx,name
337
        add   ebx,name
Line 374... Line 374...
374
    call drawstars
374
    call drawstars
Line 375... Line 375...
375
 
375
 
376
    cmp  byte[status],1
376
    cmp  byte[status],1
Line 377... Line 377...
377
    jne  @f
377
    jne  @f
378
 
378
 
379
	call drawbullet
379
        call drawbullet
380
	call drawenemys 					      ; Draw the enemy's to buffer
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
381
        aimgtoimg ship,dword[ship_x],SHIP_Y_POS,vscreen,TRANSPARENCY,0  ; Draw the ship to buffer
382
 
382
 
383
	mov  esi,scoretext
383
        mov  esi,scoretext
384
	mov  ebx,0
384
        mov  ebx,0
385
	mov  ecx,SCREEN_Y-24
385
        mov  ecx,SCREEN_Y-24
386
	call printtext
386
        call printtext
387
 
387
 
388
	mov  esi,leveltext
388
        mov  esi,leveltext
Line 389... Line 389...
389
	mov  ebx,300
389
        mov  ebx,300
Line 390... Line 390...
390
	call printtext
390
        call printtext
391
 
391
 
392
    ret
392
    ret
Line 393... Line 393...
393
 
393
 
Line 394... Line 394...
394
@@:
394
@@:
395
    cmp  byte[status],2 ; game over, dude !
395
    cmp  byte[status],2 ; game over, dude !
396
    jne  @f
396
    jne  @f
397
 
397
 
398
	aimgtoimg ship,dword[ship_x],SHIP_Y_POS,vscreen,TRANSPARENCY,0	; Draw the ship to buffer
398
        aimgtoimg ship,dword[ship_x],SHIP_Y_POS,vscreen,TRANSPARENCY,0  ; Draw the ship to buffer
399
 
399
 
400
	mov  esi,scoretext
400
        mov  esi,scoretext
401
	mov  ebx,0
401
        mov  ebx,0
402
	mov  ecx,SCREEN_Y-24
402
        mov  ecx,SCREEN_Y-24
Line 403... Line 403...
403
	call printtext
403
        call printtext
Line 404... Line 404...
404
 
404
 
405
	mov  esi,leveltext
405
        mov  esi,leveltext
406
	mov  ebx,300
406
        mov  ebx,300
Line 407... Line 407...
407
	call printtext
407
        call printtext
408
	aimgtoimg gameover,150,180,vscreen,TRANSPARENCY,0
408
        aimgtoimg gameover,150,180,vscreen,TRANSPARENCY,0
409
 
409
 
410
	ret
410
        ret
Line 411... Line 411...
411
 
411
 
Line 412... Line 412...
412
@@:
412
@@:
413
    cmp  byte[status],4 ; about screen
413
    cmp  byte[status],4 ; about screen
414
    jne  @f
414
    jne  @f
415
 
415
 
Line 416... Line 416...
416
	mov  esi,msgAbout
416
        mov  esi,msgAbout
417
	mov  ebx,50
417
        mov  ebx,50
418
	mov  ecx,100
418
        mov  ecx,100
419
	call printtext
419
        call printtext
420
 
420
 
421
	ret
421
        ret
422
 
422
 
423
@@:
423
@@:
424
    cmp  byte[status],6 ; level up!
424
    cmp  byte[status],6 ; level up!
Line 425... Line 425...
425
    jne  @f
425
    jne  @f
Line 426... Line 426...
426
	aimgtoimg ship,dword[ship_x],SHIP_Y_POS,vscreen,TRANSPARENCY,0	; Draw the ship to buffer
426
        aimgtoimg ship,dword[ship_x],SHIP_Y_POS,vscreen,TRANSPARENCY,0  ; Draw the ship to buffer
427
 
427
 
428
	mov  esi,scoretext
428
        mov  esi,scoretext
Line 429... Line 429...
429
	mov  ebx,0
429
        mov  ebx,0
Line 430... Line 430...
430
	mov  ecx,SCREEN_Y-24
430
        mov  ecx,SCREEN_Y-24
431
	call printtext
431
        call printtext
432
 
432
 
433
	mov  esi,leveltext
433
        mov  esi,leveltext
434
	mov  ebx,300
434
        mov  ebx,300
435
	call printtext
435
        call printtext
436
	aimgtoimg levelup,150,180,vscreen,TRANSPARENCY,0
436
        aimgtoimg levelup,150,180,vscreen,TRANSPARENCY,0
437
 
437
 
438
	ret
438
        ret
439
 
439
 
440
@@:
440
@@:
441
    cmp  byte[status],0 ; menu!
441
    cmp  byte[status],0 ; menu!
442
    jne  @f
442
    jne  @f
443
 
443
 
444
	aimgtoimg logo,50,80,vscreen,TRANSPARENCY,0
444
        aimgtoimg logo,50,80,vscreen,TRANSPARENCY,0
445
 
445
 
446
 
446
 
447
	cmp  byte[menu],0
447
        cmp  byte[menu],0
448
	jne  .menu_0
448
        jne  .menu_0
449
	aimgtoimg menu1,30,200,vscreen,TRANSPARENCY,1
449
        aimgtoimg menu1,30,200,vscreen,TRANSPARENCY,1
450
	jmp  .menu_1
450
        jmp  .menu_1
451
    .menu_0:
451
    .menu_0:
452
	aimgtoimg menu1,30,200,vscreen,TRANSPARENCY,0
452
        aimgtoimg menu1,30,200,vscreen,TRANSPARENCY,0
453
    .menu_1:
453
    .menu_1:
454
	cmp  byte[menu],1
454
        cmp  byte[menu],1
455
	jne  .menu_2
455
        jne  .menu_2
456
	aimgtoimg menu2,80,250,vscreen,TRANSPARENCY,1
456
        aimgtoimg menu2,80,250,vscreen,TRANSPARENCY,1
457
	jmp  .menu_3
457
        jmp  .menu_3
Line 458... Line 458...
458
    .menu_2:
458
    .menu_2:
459
	aimgtoimg menu2,80,250,vscreen,TRANSPARENCY,0
459
        aimgtoimg menu2,80,250,vscreen,TRANSPARENCY,0
460
    .menu_3:
460
    .menu_3:
Line 461... Line 461...
461
	cmp  byte[menu],2
461
        cmp  byte[menu],2
462
	jne  .menu_4
462
        jne  .menu_4
463
	aimgtoimg menu3,120,300,vscreen,TRANSPARENCY,1
463
        aimgtoimg menu3,120,300,vscreen,TRANSPARENCY,1
464
	jmp  .menu_5
464
        jmp  .menu_5
465
    .menu_4:
465
    .menu_4:
466
	aimgtoimg menu3,120,300,vscreen,TRANSPARENCY,0
466
        aimgtoimg menu3,120,300,vscreen,TRANSPARENCY,0
467
    .menu_5:
467
    .menu_5:
468
	cmp  byte[menu],3
468
        cmp  byte[menu],3
469
	jne  .menu_6
469
        jne  .menu_6
470
	aimgtoimg menu4,150,350,vscreen,TRANSPARENCY,1
470
        aimgtoimg menu4,150,350,vscreen,TRANSPARENCY,1
471
	jmp  .menu_7
471
        jmp  .menu_7
472
    .menu_6:
472
    .menu_6:
473
	aimgtoimg menu4,150,350,vscreen,TRANSPARENCY,0
473
        aimgtoimg menu4,150,350,vscreen,TRANSPARENCY,0
474
    .menu_7:
474
    .menu_7:
475
 
475
 
476
	cmp  word[intro],200
476
        cmp  word[intro],200
477
	je   .menu_75
477
        je   .menu_75
478
	inc  word[intro]
478
        inc  word[intro]
479
 
479
 
480
    .menu_75:
480
    .menu_75:
481
	cmp  word[intro],0
481
        cmp  word[intro],0
482
	jl   .menu_8
482
        jl   .menu_8
483
	aimgtoimg enemy1,390,180,vscreen,TRANSPARENCY,0
483
        aimgtoimg enemy1,390,180,vscreen,TRANSPARENCY,0
484
 
484
 
485
	cmp  word[intro],15
485
        cmp  word[intro],15
486
	jl   .menu_8
486
        jl   .menu_8
487
	mov  esi,points_50
487
        mov  esi,points_50
488
	mov  ebx,470
488
        mov  ebx,470
489
	mov  ecx,180
489
        mov  ecx,180
490
	call printtext
490
        call printtext
491
 
491
 
492
	cmp  word[intro],30
492
        cmp  word[intro],30
493
	jl   .menu_8
493
        jl   .menu_8
494
	aimgtoimg enemy2,390,220,vscreen,TRANSPARENCY,0
494
        aimgtoimg enemy2,390,220,vscreen,TRANSPARENCY,0
495
 
495
 
496
	cmp  word[intro],45
496
        cmp  word[intro],45
497
	jl   .menu_8
497
        jl   .menu_8
498
	mov  esi,points_100
498
        mov  esi,points_100
499
	mov  ebx,450
499
        mov  ebx,450
500
	mov  ecx,220
500
        mov  ecx,220
501
	call printtext
501
        call printtext
502
 
502
 
503
	cmp  word[intro],60
503
        cmp  word[intro],60
504
	jl   .menu_8
504
        jl   .menu_8
505
	aimgtoimg enemy3,390,260,vscreen,TRANSPARENCY,0
505
        aimgtoimg enemy3,390,260,vscreen,TRANSPARENCY,0
506
 
506
 
507
	cmp  word[intro],75
507
        cmp  word[intro],75
508
	jl   .menu_8
508
        jl   .menu_8
509
	mov  esi,points_150
509
        mov  esi,points_150
510
	mov  ebx,450
510
        mov  ebx,450
511
	mov  ecx,260
511
        mov  ecx,260
512
	call printtext
512
        call printtext
513
 
513
 
514
	cmp  word[intro],90
514
        cmp  word[intro],90
515
	jl   .menu_8
515
        jl   .menu_8
516
	aimgtoimg enemy4,390,300,vscreen,TRANSPARENCY,0
516
        aimgtoimg enemy4,390,300,vscreen,TRANSPARENCY,0
517
 
517
 
518
	cmp  word[intro],105
518
        cmp  word[intro],105
519
	jl   .menu_8
519
        jl   .menu_8
520
	mov  esi,points_200
520
        mov  esi,points_200
521
	mov  ebx,450
521
        mov  ebx,450
522
	mov  ecx,300
522
        mov  ecx,300
523
	call printtext
523
        call printtext
524
 
524
 
525
	cmp  word[intro],120
525
        cmp  word[intro],120
526
	jl   .menu_8
526
        jl   .menu_8
Line 527... Line 527...
527
	aimgtoimg enemy5,390,340,vscreen,TRANSPARENCY,0
527
        aimgtoimg enemy5,390,340,vscreen,TRANSPARENCY,0
528
 
528
 
529
	cmp  word[intro],135
529
        cmp  word[intro],135
530
	jl   .menu_8
530
        jl   .menu_8
531
	mov  esi,points_250
531
        mov  esi,points_250
Line 532... Line 532...
532
	mov  ebx,450
532
        mov  ebx,450
Line 533... Line 533...
533
	mov  ecx,340
533
        mov  ecx,340
534
	call printtext
534
        call printtext
535
 
535
 
536
	cmp  word[intro],150
536
        cmp  word[intro],150
537
	jl   .menu_8
537
        jl   .menu_8
538
	aimgtoimg alien,380,380,vscreen,TRANSPARENCY,0
538
        aimgtoimg alien,380,380,vscreen,TRANSPARENCY,0
539
 
539
 
540
	cmp  word[intro],165
540
        cmp  word[intro],165
541
	jl   .menu_8
541
        jl   .menu_8
Line 542... Line 542...
542
	mov  esi,points_1000
542
        mov  esi,points_1000
543
	mov  ebx,430
543
        mov  ebx,430
544
	mov  ecx,380
544
        mov  ecx,380
545
	call printtext
545
        call printtext
546
 
546
 
547
    .menu_8:
547
    .menu_8:
548
	ret
548
        ret
549
@@:
549
@@:
550
    cmp  byte[status],5 ;highscorelist
550
    cmp  byte[status],5 ;highscorelist
551
    jne  @f
551
    jne  @f
552
 
552
 
553
	aimgtoimg highscore,60,40,vscreen,TRANSPARENCY,0
553
        aimgtoimg highscore,60,40,vscreen,TRANSPARENCY,0
Line 554... Line 554...
554
 
554
 
555
	mov  ebx,100		    ; print names
555
        mov  ebx,100                ; print names
556
	mov  ecx,120
556
        mov  ecx,120
Line 557... Line 557...
557
	mov  esi,gif_hash_area
557
        mov  esi,gif_hash_area
Line 558... Line 558...
558
	call printtext
558
        call printtext
559
 
559
 
560
	mov  edi,gif_hash_area+100  ; print scores
560
        mov  edi,gif_hash_area+100  ; print scores
561
	mov  esi,scorenumb
561
        mov  esi,scorenumb
562
	mov  ebx,420
562
        mov  ebx,420
563
	mov  ecx,120
563
        mov  ecx,120
564
 
564
 
565
.highscoreloop:
565
.highscoreloop:
566
	mov  eax,[edi]
566
        mov  eax,[edi]
567
	push ecx
567
        push ecx
568
	call convertscore
568
        call convertscore
569
	pop  ecx
569
        pop  ecx
570
	push esi
570
        push esi
571
	call printtext
571
        call printtext
572
	pop  esi
572
        pop  esi
573
	add  ecx,26
573
        add  ecx,26
574
	add  edi,4
574
        add  edi,4
575
	cmp  edi,gif_hash_area+140
575
        cmp  edi,gif_hash_area+140
576
	jl  .highscoreloop
576
        jl  .highscoreloop
Line 577... Line 577...
577
 
577
 
Line 578... Line 578...
578
@@:
578
@@:
579
    cmp  byte[status],7 ;highscore
579
    cmp  byte[status],7 ;highscore
580
    jne  @f
580
    jne  @f
581
 
581
 
Line 582... Line 582...
582
	aimgtoimg highscore,60,40,vscreen,TRANSPARENCY,0
582
        aimgtoimg highscore,60,40,vscreen,TRANSPARENCY,0
Line 583... Line 583...
583
 
583
 
584
	mov  ebx,60
584
        mov  ebx,60
585
	mov  ecx,200
585
        mov  ecx,200
586
	mov  esi,entername
586
        mov  esi,entername
Line 587... Line 587...
587
	call printtext
587
        call printtext
Line 588... Line 588...
588
 
588
 
589
	mov  ebx,250
589
        mov  ebx,250
590
	mov  ecx,250
590
        mov  ecx,250
591
	mov  esi,name
591
        mov  esi,name
592
	call printtext
592
        call printtext
Line 593... Line 593...
593
 
593
 
594
	mov  esi,scoretext
594
        mov  esi,scoretext
Line 595... Line 595...
595
	mov  ebx,0
595
        mov  ebx,0
596
	mov  ecx,SCREEN_Y-24
596
        mov  ecx,SCREEN_Y-24
597
	call printtext
597
        call printtext
Line 598... Line 598...
598
 
598
 
599
	mov  esi,leveltext
599
        mov  esi,leveltext
600
	mov  ebx,300
600
        mov  ebx,300
601
	call printtext
601
        call printtext
602
@@:
602
@@:
603
 
603
 
604
    ret
604
    ret
Line 605... Line 605...
605
 
605
 
606
 
606
 
607
drawenemys:
607
drawenemys:
Line 608... Line 608...
608
; check if direction should change
608
; check if direction should change
609
	test byte[enemy_d],2
609
        test byte[enemy_d],2
Line 610... Line 610...
610
	jz   @f
610
        jz   @f
611
 
611
 
Line 612... Line 612...
612
	add  dword[enemy_y],5
612
        add  dword[enemy_y],5
613
 
613
 
Line 614... Line 614...
614
	mov  eax,[enemy_y]
614
        mov  eax,[enemy_y]
615
	shr  eax,5
615
        shr  eax,5
Line 616... Line 616...
616
	add  al, byte[level]
616
        add  al, byte[level]
Line 617... Line 617...
617
	mov  byte[enemy_speed],al
617
        mov  byte[enemy_speed],al
618
 
618
 
619
	and  byte[enemy_d],1
619
        and  byte[enemy_d],1
620
 
620
 
621
       @@:
621
       @@:
Line 622... Line 622...
622
; move the aliens to left or right
622
; move the aliens to left or right
Line 623... Line 623...
623
	movzx eax,byte[enemy_speed]
623
        movzx eax,byte[enemy_speed]
624
	test byte[enemy_d],1
624
        test byte[enemy_d],1
625
	jz   other_dir
625
        jz   other_dir
626
 
626
 
627
	sub  dword[enemy_x],eax
627
        sub  dword[enemy_x],eax
Line 628... Line 628...
628
	jmp  no_other_dir
628
        jmp  no_other_dir
Line 629... Line 629...
629
 
629
 
630
     other_dir:
630
     other_dir:
631
	add  dword[enemy_x],eax
631
        add  dword[enemy_x],eax
632
     no_other_dir:
632
     no_other_dir:
633
 
633
 
Line 634... Line 634...
634
; initialization
634
; initialization
Line 635... Line 635...
635
	mov  byte[alldeadb],1
635
        mov  byte[alldeadb],1
636
	mov  edi,enemy_table
636
        mov  edi,enemy_table
637
	mov  eax,dword[enemy_x]
637
        mov  eax,dword[enemy_x]
638
	mov  dword[current_enemy_x],eax
638
        mov  dword[current_enemy_x],eax
639
	mov  eax,dword[enemy_y]
639
        mov  eax,dword[enemy_y]
Line 640... Line 640...
640
	mov  dword[current_enemy_y],eax
640
        mov  dword[current_enemy_y],eax
Line 641... Line 641...
641
 
641
 
642
     loopit:
642
     loopit:
643
	cmp  byte[edi],1
643
        cmp  byte[edi],1
644
	je   drawenemy1
644
        je   drawenemy1
645
 
645
 
Line 646... Line 646...
646
	cmp  byte[edi],2
646
        cmp  byte[edi],2
Line 647... Line 647...
647
	je   drawenemy2
647
        je   drawenemy2
648
 
648
 
649
	cmp  byte[edi],3
649
        cmp  byte[edi],3
Line 650... Line 650...
650
	je   drawenemy3
650
        je   drawenemy3
Line 651... Line 651...
651
 
651
 
652
	cmp  byte[edi],4
652
        cmp  byte[edi],4
Line 653... Line 653...
653
	je   drawenemy4
653
        je   drawenemy4
654
 
654
 
Line 655... Line 655...
655
	cmp  byte[edi],5
655
        cmp  byte[edi],5
Line 656... Line 656...
656
	je   drawenemy5
656
        je   drawenemy5
Line 657... Line 657...
657
 
657
 
658
	jmp  dead_alien
658
        jmp  dead_alien
659
 
659
 
660
     drawenemy1:
660
     drawenemy1:
661
	mov  byte[alldeadb],0
661
        mov  byte[alldeadb],0
Line 662... Line 662...
662
	pusha
662
        pusha
Line 663... Line 663...
663
	aimgtoimg enemy1,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
663
        aimgtoimg enemy1,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
664
	popa
664
        popa
665
 
665
 
Line 666... Line 666...
666
	jmp  checknext
666
        jmp  checknext
667
 
667
 
668
     drawenemy2:
668
     drawenemy2:
Line 669... Line 669...
669
	mov  byte[alldeadb],0
669
        mov  byte[alldeadb],0
670
	pusha
670
        pusha
671
	aimgtoimg enemy2,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
671
        aimgtoimg enemy2,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
672
	popa
672
        popa
673
 
673
 
674
	jmp  checknext
674
        jmp  checknext
Line 675... Line 675...
675
 
675
 
676
     drawenemy3:
676
     drawenemy3:
677
	mov  byte[alldeadb],0
677
        mov  byte[alldeadb],0
678
	pusha
678
        pusha
Line 679... Line 679...
679
	aimgtoimg enemy3,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
679
        aimgtoimg enemy3,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
680
	popa
680
        popa
681
 
681
 
Line 682... Line 682...
682
	jmp  checknext
682
        jmp  checknext
683
 
683
 
Line 684... Line 684...
684
     drawenemy4:
684
     drawenemy4:
685
	mov  byte[alldeadb],0
685
        mov  byte[alldeadb],0
686
	pusha
686
        pusha
687
	aimgtoimg enemy4,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
687
        aimgtoimg enemy4,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
Line 688... Line 688...
688
	popa
688
        popa
689
 
689
 
690
	jmp  checknext
690
        jmp  checknext
Line 691... Line 691...
691
 
691
 
Line 692... Line 692...
692
     drawenemy5:
692
     drawenemy5:
693
	mov  byte[alldeadb],0
693
        mov  byte[alldeadb],0
Line 694... Line 694...
694
	pusha
694
        pusha
695
	aimgtoimg enemy5,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
695
        aimgtoimg enemy5,dword[current_enemy_x],dword[current_enemy_y],vscreen,TRANSPARENCY,0
Line 696... Line 696...
696
	popa
696
        popa
697
 
697
 
698
;        jmp  checknext
698
;        jmp  checknext
699
 
699
 
Line 700... Line 700...
700
     checknext:
700
     checknext:
701
	cmp  byte[enemy_d],2
701
        cmp  byte[enemy_d],2
702
	jge  dont_change_dir
702
        jge  dont_change_dir
703
 
-
 
-
 
703
 
704
	   movzx eax,byte[enemy_speed]
704
           movzx eax,byte[enemy_speed]
705
 
-
 
-
 
705
 
706
	   cmp	byte[enemy_d],0
706
           cmp  byte[enemy_d],0
707
	   jbe	change_dir
-
 
-
 
707
           jbe  change_dir
708
 
708
 
709
	   cmp	dword[current_enemy_x],eax
709
           cmp  dword[current_enemy_x],eax
Line 710... Line 710...
710
	   jg	dont_change_dir
710
           jg   dont_change_dir
711
 
711
 
712
	   mov	byte[enemy_d],2
712
           mov  byte[enemy_d],2
713
 
713
 
Line 714... Line 714...
714
	   jmp	dont_change_dir
714
           jmp  dont_change_dir
Line 715... Line 715...
715
 
715
 
716
	change_dir:
716
        change_dir:
Line 717... Line 717...
717
	   mov	ebx, SCREEN_X-ENEMY_X
717
           mov  ebx, SCREEN_X-ENEMY_X
718
	   sub	ebx, eax
718
           sub  ebx, eax
719
	   cmp	dword[current_enemy_x],ebx
719
           cmp  dword[current_enemy_x],ebx
Line 720... Line 720...
720
	   jl	dont_change_dir
720
           jl   dont_change_dir
721
 
721
 
722
	   mov	byte[enemy_d],3
722
           mov  byte[enemy_d],3
723
 
723
 
Line 810... Line 810...
810
;
810
;
811
;        add  eax,5*(ENEMY_Y+BOUNDARY)
811
;        add  eax,5*(ENEMY_Y+BOUNDARY)
812
;        cmp  dword[bullet_x],eax
812
;        cmp  dword[bullet_x],eax
813
;        jg   nohit
813
;        jg   nohit
814
;
814
;
815
	mov  edi,enemy_table
815
        mov  edi,enemy_table
816
	mov  eax,dword[enemy_x]
816
        mov  eax,dword[enemy_x]
817
	mov  dword[current_enemy_x],eax
817
        mov  dword[current_enemy_x],eax
818
	mov  eax,dword[enemy_y]
818
        mov  eax,dword[enemy_y]
819
	mov  dword[current_enemy_y],eax
819
        mov  dword[current_enemy_y],eax
Line 820... Line 820...
820
 
820
 
821
       check:
821
       check:
822
	cmp  byte[edi],0		 ; is the enemy at this position alive?
822
        cmp  byte[edi],0                 ; is the enemy at this position alive?
823
	je   nextcheck			 ; no, try next enemy
823
        je   nextcheck                   ; no, try next enemy
824
	; check if bullet hits current enemy
824
        ; check if bullet hits current enemy
825
 
825
 
826
	mov  eax,dword[current_enemy_y]  ; move the enemy y position into eax
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)
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
828
        jl   nextcheck                   ; yes, bullet can't be colliding, check next enemy
829
 
829
 
830
	add  eax,ENEMY_Y		 ; add the width of the enemy to the enemy's y position (wich is still stored in eax)
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)
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
832
        jg   nextcheck                   ; yes, bullet can't be colliding, check next enemy
833
 
833
 
834
	mov  eax,dword[current_enemy_x]  ; now do the same but for the x positions
834
        mov  eax,dword[current_enemy_x]  ; now do the same but for the x positions
835
	cmp  dword[bullet_x],eax	 ;
835
        cmp  dword[bullet_x],eax         ;
836
	jl   nextcheck			 ;
836
        jl   nextcheck                   ;
837
					 ;
837
                                         ;
838
	add  eax,ENEMY_Y		 ;
838
        add  eax,ENEMY_Y                 ;
839
	cmp  dword[bullet_x],eax	 ;
839
        cmp  dword[bullet_x],eax         ;
Line 840... Line 840...
840
	jg   nextcheck			 ;
840
        jg   nextcheck                   ;
Line 841... Line 841...
841
 
841
 
842
	jmp  hit
842
        jmp  hit
843
 
843
 
844
      nextcheck:
844
      nextcheck:
845
	inc  edi
845
        inc  edi
846
	add  dword[current_enemy_x],ENEMY_X+BOUNDARY
846
        add  dword[current_enemy_x],ENEMY_X+BOUNDARY
847
	mov  eax,dword[current_enemy_x]
847
        mov  eax,dword[current_enemy_x]
Line 848... Line 848...
848
	sub  eax,dword[enemy_x]
848
        sub  eax,dword[enemy_x]
849
	cmp  eax,5*(ENEMY_X+BOUNDARY)
849
        cmp  eax,5*(ENEMY_X+BOUNDARY)
850
	jl   no_newline_
850
        jl   no_newline_
Line 851... Line 851...
851
 
851
 
852
	sub  dword[current_enemy_x],5*(ENEMY_X+BOUNDARY)
852
        sub  dword[current_enemy_x],5*(ENEMY_X+BOUNDARY)
853
	add  dword[current_enemy_y],ENEMY_Y+BOUNDARY
853
        add  dword[current_enemy_y],ENEMY_Y+BOUNDARY
Line 854... Line 854...
854
      no_newline_:
854
      no_newline_:
855
 
855
 
856
	cmp  edi,enemy_table+20 	; is this the last enemy?
856
        cmp  edi,enemy_table+20         ; is this the last enemy?
Line 857... Line 857...
857
	jg   nohit			; yes, none of them was hit
857
        jg   nohit                      ; yes, none of them was hit
858
	jmp  check			; no, check if enemy is alive and draw it
858
        jmp  check                      ; no, check if enemy is alive and draw it
Line 859... Line 859...
859
 
859
 
860
      hit:
860
      hit:
861
	movzx ebx,byte[edi]		; mov the enemy number onto ebx
861
        movzx ebx,byte[edi]             ; mov the enemy number onto ebx
862
	add  dword[score],ebx		; add this number to the score dword
862
        add  dword[score],ebx           ; add this number to the score dword
Line 863... Line 863...
863
 
863
 
864
	mov  eax,[score]
864
        mov  eax,[score]
865
	call convertscore
865
        call convertscore
866
 
866
 
867
	mov  byte[edi],0		; hide the enemy
867
        mov  byte[edi],0                ; hide the enemy
868
     hidebullet:
868
     hidebullet:
869
	mov  dword[bullet_y],1		; mov the bullet to top of screen (hide it)
869
        mov  dword[bullet_y],1          ; mov the bullet to top of screen (hide it)
870
	jmp  noalienhit
870
        jmp  noalienhit
871
 
871
 
872
     nohit:
872
     nohit:
873
	mov  eax,[alien_x]		; check if we hit the big alien in the ufo
873
        mov  eax,[alien_x]              ; check if we hit the big alien in the ufo
874
	cmp  [bullet_x],eax
874
        cmp  [bullet_x],eax
875
	jl   noalienhit
875
        jl   noalienhit
Line 876... Line 876...
876
	add  eax,ALIEN_X-BULLET_X
876
        add  eax,ALIEN_X-BULLET_X
Line 877... Line 877...
877
	cmp  [bullet_x],eax
877
        cmp  [bullet_x],eax
Line 878... Line 878...
878
	jg   noalienhit
878
        jg   noalienhit
Line 879... Line 879...
879
	cmp  [bullet_y],ALIEN_Y_POS+ALIEN_Y
879
        cmp  [bullet_y],ALIEN_Y_POS+ALIEN_Y
880
	jg   noalienhit
880
        jg   noalienhit
881
 
881
 
882
	add  dword[score],100/5
882
        add  dword[score],100/5
883
	mov  eax,[score]
883
        mov  eax,[score]
884
	call convertscore
884
        call convertscore
885
 
885
 
886
	mov  [alien_x],0
886
        mov  [alien_x],0
887
 
887
 
888
     noalienhit:
888
     noalienhit:
889
 
889
 
890
ret
890
ret
891
 
891
 
892
convertscore:
892
convertscore:
893
	test al,1
893
        test al,1
894
	jz   .1
894
        jz   .1
895
	mov  byte[scorenumb+5],'5'
895
        mov  byte[scorenumb+5],'5'
896
	jmp  .2
896
        jmp  .2
897
.1:
897
.1:
898
	mov  byte[scorenumb+5],'0'
898
        mov  byte[scorenumb+5],'0'
899
.2:
899
.2:
900
	shr  eax,1
900
        shr  eax,1
901
	mov  ecx,10
901
        mov  ecx,10
902
	xor  edx,edx
902
        xor  edx,edx
903
	div  ecx
903
        div  ecx
904
	add  dl,'0'
904
        add  dl,'0'
905
	mov  byte[scorenumb+4],dl
905
        mov  byte[scorenumb+4],dl
906
	xor  edx,edx
906
        xor  edx,edx
907
	div  ecx
907
        div  ecx
908
	add  dl,'0'
908
        add  dl,'0'
Line 909... Line 909...
909
	mov  byte[scorenumb+3],dl
909
        mov  byte[scorenumb+3],dl
Line 910... Line 910...
910
	xor  edx,edx
910
        xor  edx,edx
Line 911... Line 911...
911
	div  ecx
911
        div  ecx
912
	add  dl,'0'
912
        add  dl,'0'
913
	mov  byte[scorenumb+2],dl
913
        mov  byte[scorenumb+2],dl
914
	xor  edx,edx
914
        xor  edx,edx
915
	div  ecx
915
        div  ecx
916
	add  dl,'0'
916
        add  dl,'0'
917
	mov  byte[scorenumb+1],dl
917
        mov  byte[scorenumb+1],dl
Line 918... Line 918...
918
	xor  edx,edx
918
        xor  edx,edx
Line 919... Line 919...
919
	div  ecx
919
        div  ecx
920
	add  dl,'0'
920
        add  dl,'0'
Line 921... Line 921...
921
	mov  byte[scorenumb+0],dl
921
        mov  byte[scorenumb+0],dl
922
 
922
 
923
ret
923
ret
924
 
924
 
Line 925... Line 925...
925
 
925
 
Line 926... Line 926...
926
fillscreen: ; eax - screen color ( 0x00RRGGBB )
926
fillscreen: ; eax - screen color ( 0x00RRGGBB )
Line 927... Line 927...
927
 
927
 
928
	mov  edi,vscreen+8
928
        mov  edi,vscreen+8
929
	cld
929
        cld
930
	mov  ecx,SCREEN_X*SCREEN_Y
930
        mov  ecx,SCREEN_X*SCREEN_Y
931
    .lab1:
931
    .lab1:
932
	mov  [edi],eax
932
        mov  [edi],eax
933
	add  edi,3
933
        add  edi,3
934
	loop .lab1
934
        loop .lab1
935
 
935
 
936
	ret
936
        ret
937
 
937
 
938
 
938
 
939
printtext:
939
printtext:
940
	push  ebx
940
        push  ebx
941
 
941
 
942
     loadbyte:
942
     loadbyte:
943
	movzx eax, byte[esi]
943
        movzx eax, byte[esi]
944
	test  eax, eax
944
        test  eax, eax
945
	jnz   checkbyte
945
        jnz   checkbyte
946
 
946
 
Line 947... Line 947...
947
	pop   ebx
947
        pop   ebx
Line 948... Line 948...
948
 
948
 
949
	ret
949
        ret
950
 
950
 
951
    checkbyte:
951
    checkbyte:
952
	cmp  al,13
952
        cmp  al,13
953
	je   nextline
953
        je   nextline
954
	cmp  al,' '
954
        cmp  al,' '
955
	je   space
955
        je   space
956
 
956
 
957
	cmp  al,'0'
957
        cmp  al,'0'
958
	jl   nextchar
958
        jl   nextchar
959
	cmp  al,'9'
959
        cmp  al,'9'
960
	jle  usenumbers
960
        jle  usenumbers
961
 
961
 
962
	cmp  al,'z'
962
        cmp  al,'z'
Line 963... Line 963...
963
	jg   nextchar
963
        jg   nextchar
Line 964... Line 964...
964
	cmp  al,'a'
964
        cmp  al,'a'
Line 965... Line 965...
965
	jge  usesmallfont
965
        jge  usesmallfont
966
 
966
 
967
	cmp  al,'Z'
967
        cmp  al,'Z'
968
	jg   nextchar
968
        jg   nextchar
969
	cmp  al,'A'
969
        cmp  al,'A'
970
	jge  usebigfont
970
        jge  usebigfont
971
 
971
 
972
	jmp  nextchar
972
        jmp  nextchar
973
 
973
 
974
 
974
 
975
    usesmallfont:
975
    usesmallfont:
976
	mov  edx,eax
976
        mov  edx,eax
977
	sub  edx,'a'
977
        sub  edx,'a'
978
	mov  eax,12
978
        mov  eax,12
Line 979... Line 979...
979
	mul  edx
979
        mul  edx
Line 980... Line 980...
980
	mov  edx,eax
980
        mov  edx,eax
Line 981... Line 981...
981
 
981
 
982
	pusha
982
        pusha
983
	getimg smallfont,0,edx,20,12,char
983
        getimg smallfont,0,edx,20,12,char
984
	popa
984
        popa
985
 
985
 
986
	pusha
986
        pusha
987
	add  ecx,4
987
        add  ecx,4
988
	aimgtoimg char,ebx,ecx,vscreen,TRANSPARENCY,0
988
        aimgtoimg char,ebx,ecx,vscreen,TRANSPARENCY,0
989
	popa
989
        popa
990
 
990
 
991
	add  ebx,20
991
        add  ebx,20
992
 
992
 
993
	jmp  nextchar
993
        jmp  nextchar
994
 
994
 
Line 995... Line 995...
995
    usebigfont:
995
    usebigfont:
Line 996... Line 996...
996
	mov  edx,eax
996
        mov  edx,eax
Line 997... Line 997...
997
	sub  edx,'A'
997
        sub  edx,'A'
998
	mov  eax,20
998
        mov  eax,20
Line 999... Line 999...
999
	mul  edx
999
        mul  edx
1000
	mov  edx,eax
1000
        mov  edx,eax
Line 1001... Line 1001...
1001
 
1001
 
Line 1002... Line 1002...
1002
	pusha
1002
        pusha
1003
	getimg bigfont,0,edx,28,20,char
1003
        getimg bigfont,0,edx,28,20,char
1004
	popa
1004
        popa
1005
 
1005
 
1006
	pusha
1006
        pusha
Line 1007... Line 1007...
1007
	aimgtoimg char,ebx,ecx,vscreen,TRANSPARENCY,0
1007
        aimgtoimg char,ebx,ecx,vscreen,TRANSPARENCY,0
Line 1008... Line 1008...
1008
	popa
1008
        popa
1009
 
1009
 
Line 1010... Line 1010...
1010
	add  ebx,28
1010
        add  ebx,28
Line 1062... Line 1062...
1062
    movzx eax, byte[esi]    ; z (speed, brightness)
1062
    movzx eax, byte[esi]    ; z (speed, brightness)
1063
    movzx ebx, word[esi+1]  ; x
1063
    movzx ebx, word[esi+1]  ; x
1064
    movzx ecx, word[esi+3]  ; y
1064
    movzx ecx, word[esi+3]  ; y
1065
    add   bx , ax
1065
    add   bx , ax
1066
    cmp   bx , SCREEN_X
1066
    cmp   bx , SCREEN_X
1067
    jl	  .moveit
1067
    jl    .moveit
Line 1068... Line 1068...
1068
 
1068
 
1069
    xor   ebx,ebx
1069
    xor   ebx,ebx
Line 1070... Line 1070...
1070
    inc   ebx
1070
    inc   ebx
Line 1101... Line 1101...
1101
    add   eax, ebx
1101
    add   eax, ebx
1102
    mov   edx, 3
1102
    mov   edx, 3
1103
    mul   edx
1103
    mul   edx
Line 1104... Line 1104...
1104
 
1104
 
1105
    cmp   eax, SCREEN_X*SCREEN_Y*3
1105
    cmp   eax, SCREEN_X*SCREEN_Y*3
1106
    jg	  @f
1106
    jg    @f
1107
    add   eax, vscreen+8
1107
    add   eax, vscreen+8
1108
    and   dword[eax],0xff000000
1108
    and   dword[eax],0xff000000
1109
    or	  dword[eax],ebp
1109
    or    dword[eax],ebp
Line 1110... Line 1110...
1110
   @@:
1110
   @@:
1111
 
1111
 
1112
    add   esi, 5
1112
    add   esi, 5
Line 1216... Line 1216...
1216
db 0,0,0,0,0
1216
db 0,0,0,0,0
1217
db 0,0,0,0,0
1217
db 0,0,0,0,0
1218
db 0,0,0,0,0
1218
db 0,0,0,0,0
Line 1219... Line 1219...
1219
 
1219
 
1220
 
1220
 
1221
msg1		db 'Vesa mode not supported',13,'Press any key to exit.',13,0
1221
msg1            db 'Vesa mode not supported',13,'Press any key to exit.',13,0
1222
msgAbout	db 'Hidnplayrs invaders',13,'DexOS 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
1223
msgdone 	db 'You have saved the planet!',0
1223
msgdone         db 'You have saved the planet!',0
1224
entername	db 'Enter your name highscorer!',0
1224
entername       db 'Enter your name highscorer!',0
1225
highscorefile	db 'invaders.dat',0
1225
highscorefile   db 'invaders.dat',0
1226
points_50	db '5 pt',0
1226
points_50       db '5 pt',0
1227
points_100	db '10 pt',0
1227
points_100      db '10 pt',0
1228
points_150	db '15 pt',0
1228
points_150      db '15 pt',0
1229
points_200	db '20 pt',0
1229
points_200      db '20 pt',0
1230
points_250	db '25 pt',0
1230
points_250      db '25 pt',0
1231
points_1000	db '100 pt',0
1231
points_1000     db '100 pt',0
1232
ship_x		dd SHIP_X_POS
1232
ship_x          dd SHIP_X_POS
1233
enemy_x 	dd 0
1233
enemy_x         dd 0
1234
enemy_y 	dd 0
1234
enemy_y         dd 0
1235
enemy_d 	db 0
1235
enemy_d         db 0
1236
current_enemy_x dd 0
1236
current_enemy_x dd 0
1237
current_enemy_y dd 0
1237
current_enemy_y dd 0
1238
bullet_x	dd 0
1238
bullet_x        dd 0
1239
bullet_y	dd 1
1239
bullet_y        dd 1
1240
score		dd 0
1240
score           dd 0
1241
alldeadb	db 0
1241
alldeadb        db 0
1242
status		db 0	    ; status: 0=menu  1=game  2=gameover   3=paused  4=about 5=highscorelist 6=levelup 7=highscore...
1242
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...
1243
menu            db 0        ; menu:   0=start 1=about 2=highscores 3=exit...
1244
generator	dd 0x45dd4d15
1244
generator       dd 0x45dd4d15
1245
alien_x 	dd 0
1245
alien_x         dd 0
1246
drawroutine	dd 0
1246
drawroutine     dd 0
1247
returnaddr	dd 0
1247
returnaddr      dd 0
1248
intro		dw 0
1248
intro           dw 0
1249
scoretext	db 'score '
1249
scoretext       db 'score '
1250
scorenumb	db 0,0,0,0,0,0,0
1250
scorenumb       db 0,0,0,0,0,0,0
1251
leveltext	db 'level '
1251
leveltext       db 'level '
1252
levelnumb	db 0,0,0
1252
levelnumb       db 0,0,0
1253
lives		db 0
1253
lives           db 0
1254
level		db 1
1254
level           db 1
1255
enemy_speed	db 1
1255
enemy_speed     db 1
Line 1256... Line 1256...
1256
namepos 	db 0
1256
namepos         db 0
1257
name		db 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x0d,0x00
1257
name            db 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x0d,0x00
Line 1398... Line 1398...
1398
 
1398
 
1399
alienpiece:
1399
alienpiece:
Line 1400... Line 1400...
1400
rb ALIEN_X*ALIEN_Y*3+20
1400
rb ALIEN_X*ALIEN_Y*3+20
1401
 
1401
 
Line 1402... Line 1402...
1402
gif_hash_area:
1402
gif_hash_area:
Line 1403... Line 1403...
1403
rd 4096+1			   ;hash area size for unpacking GIF
1403
rd 4096+1                          ;hash area size for unpacking GIF