-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.asm
2992 lines (2417 loc) · 47.9 KB
/
main.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
JUMPS
IDEAL
MODEL small
STACK 100h
FLOOR_y equ 200 / 2
FLOOR_x equ 320 / 2
MARIO_w equ 11
MARIO_h equ 15
MARIO_bg equ 255
ALIEN_h equ 15
ALIEN_w equ 15
ALIEN_bg equ 255
ROBOT_h equ 15
ROBOT_w equ 15
ROBOT_bg equ 255
OBJ_bg equ 255
OBJ_w equ 11
OBJ_h equ 11
CYCLES equ 50000
GAME_t equ 15
GAME_w equ 320
GAME_h equ 200
GAME_mpt equ 1000
MENU_mpt equ 1
DATASEG
MENU_ticks dw 0
GAME_ticks dw 0
GAME_state db 30
GAME_menu_is_hover db 0
GAME_score dw 0
GAME_is_over db 0
CURSOR_x dw 0
CURSOR_y dw 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FLAG_should_setup_game db 0
FLAG_should_exit_game db 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ALIEN_is_alive db 1
ALIEN_death_time dw 0
ROBOT_is_alive db 1
ROBOT_death_time dw 0
BLACK_HOLE_death_time dw 0
LANDMINE_death_time dw 0
MARIO_i_x dw FLOOR_x - (MARIO_w / 2)
MARIO_i_y dw FLOOR_y - (MARIO_h / 2)
MARIO_i_dir db 0
MARIO_x dw FLOOR_x - (MARIO_w / 2)
MARIO_y dw FLOOR_y - (MARIO_h / 2)
MARIO_dir db 4
MARIO_r_dir db 0
MARIO_speed dw 3
ALIEN_i_x dw FLOOR_x - (ALIEN_w * 3)
ALIEN_i_y dw FLOOR_y + (ALIEN_h * 3)
ALIEN_i_dir db 0
ALIEN_x dw FLOOR_x + (ALIEN_w * 2)
ALIEN_y dw FLOOR_y + (ALIEN_h * 2)
ALIEN_dir db 0
ALIEN_speed dw 2
ROBOT_i_x dw GAME_w - ROBOT_w
ROBOT_i_y dw GAME_t + 1
ROBOT_i_dir db 2
ROBOT_x dw GAME_w - ROBOT_w
ROBOT_y dw GAME_t + 1
ROBOT_dir db 2
ROBOT_speed dw 5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
BMP_line db 320 dup (0)
BMP_screen_line db 324 dup (0)
BMP_starting db 'start.bmp', 0
BMP_cycles db 'cycles.bmp' , 0
BMP_menu db 'menu.bmp' , 0
BMP_menu_guide db 'menug.bmp' , 0
BMP_menu_play db 'menup.bmp' , 0
BMP_go db 'go.bmp' , 0
BMP_go_exit db 'goe.bmp' , 0
BMP_go_play db 'gop.bmp' , 0
BMP_guide db 'guide.bmp' , 0
BMP_robot db 'robot.bmp' , 0
BMP_robot_d db 'robotd.bmp' , 0
BMP_mario_r db 'marior.bmp' , 0
BMP_mario_l db 'mariol.bmp' , 0
BMP_landmine db 'grnd.bmp' , 0
BMP_landmine_d db 'grndd.bmp' , 0
BMP_black_hole db 'bh.bmp' , 0
BMP_black_hole_d db 'bhd.bmp' , 0
BMP_alien db 'alien.bmp' , 0
BMP_alien_d db 'aliend.bmp' , 0
BMP_star db 'star.bmp', 0
BMP_sky db 'sky.bmp' , 0
BMP_handle dw ?
BMP_header db 54 dup(0)
BMP_palette db 400h dup(0)
BMP_error_file db 0
BMP_x dw ?
BMP_y dw ?
BMP_w dw ?
BMP_h dw ?
BMP_skip_color db 0
BMP_should_skip db 0
BMP_dragging db 0
BMP_dragging_ptr dw 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LANDMINE_is_placed db 0
LANDMINE_did_explode db 0
LANDMINE_x dw 0
LANDMINE_y dw 0
BLACK_HOLE_is_placed db 0
BLACK_HOLE_is_inactive db 0
BLACK_HOLE_x dw 0
BLACK_HOLE_y dw 0
STAR_x dw 0
STAR_y dw 0
STAR_last_time dw 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ERROR_opening_bmp_file db 'Error when opening BMP file.', 0dh, 0ah, '$'
ERROR_too_many_instances db 'Too many instances.', 0dh, 0ah, '$'
ERROR_exit db 'Press any key to exit.', 0dh, 0ah, '$'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rnd_pos dw start
SEGMENT SCREEN
s db 320 * 200 dup(0)
ENDS
CODESEG
start:
mov ax, @data
mov ds, ax
xor ax, ax
int 33h
mov ax, 13h
int 10h
call HideCursor
push offset BMP_starting
push 0
push 0
push 320
push 200
call RenderBmp
call UpdateScreen
mov ax, 40h
mov es, ax
mov cx, [es:6Ch]
push 300
call Sleep
mov ax, [es:6Ch]
sub ax, cx
cmp ax, 4
je skip_err
cmp ax, 5
je skip_err
cmp ax, 6
jne cpu_cycles_error
skip_err:
mov ax, seg OnCursorEvent
mov es, ax
mov ax, 0Ch
mov dx, offset OnCursorEvent
mov cx, 1111b
int 33h
mov [GAME_state], 0
call ShowCursor
call UpdateScreen
l:
call OnGameTick
jmp l
cpu_cycles_error:
push offset BMP_cycles
push 0
push 0
push 320
push 200
call RenderBmp
call UpdateScreen
call AwaitKeypress
call ExitGame
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: RenderBmp
;
; Arguments:
; stack - (filename asciiz offset, x, y, w, h)
;
; Returns:
; none
;
; Description:
; renders bmp on screen at given coordinates
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
filename equ [word bp + 12]
x equ [word bp + 10]
y equ [word bp + 8 ]
w equ [word bp + 6 ]
h equ [word bp + 4 ]
proc RenderBmp
push bp
mov bp, sp
push ax
push bx
push cx
push dx
mov bx, x
mov [BMP_x], bx
mov bx, y
mov [BMP_y], bx
mov bx, w
mov [BMP_w], bx
mov bx, h
mov [BMP_h], bx
mov dx, filename
call OpenShowBmp
cmp [BMP_error_file], 1
jne @@ret
jmp @@exit_error
@@exit_error:
jmp @@ret
; push offset ERROR_opening_bmp_file
; call HandleError
@@exit:
call ExitGame
@@ret:
pop dx
pop cx
pop bx
pop ax
pop bp
ret 10
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: ClearScreen
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; clears B800 screen
;
; Register usage:
; ax - 0 to place in memory (nothing, clear)
; cx - loop index
; di - offset to render
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc ClearScreen
push ax
push bx
push cx
push di
mov cx, 5000
mov di, 0
mov ax, 0B800h
mov es, ax
@@loop:
push ax
xor ax, ax
mov [es:di], al
inc di
inc di
pop ax
loop @@loop
@@ret:
pop di
pop cx
pop bx
pop ax
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: ShowCursor
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; shows the cursor
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc ShowCursor
push ax
push bx
push cx
push dx
mov ax, 1
int 33h
@@ret:
pop dx
pop cx
pop bx
pop ax
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: HideCursor
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; hides the cursor
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc HideCursor
push ax
push bx
push cx
push dx
mov ax, 2
int 33h
@@ret:
pop dx
pop cx
pop bx
pop ax
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: OnCursorEvent
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; listener to all mouse events, does hover effects for menu
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc OnCursorEvent far
push ax
push bx
push cx
push dx
push ds
push di
mov di, @data
mov ds, di
shr cx, 1
mov bl, [GAME_state]
cmp bl, 0 ; main menu
jne @@check_game
jmp @@main_menu
@@check_game:
cmp bl, 10 ; game
jne @@check_starting
jmp @@game
@@check_starting:
cmp bl, 30 ; starting
jne @@check_guide
jmp @@starting
@@check_guide:
cmp bl, 1 ; guide
jne @@ret
jmp @@check_next
@@check_next:
jmp @@ret
@@main_menu:
inc [MENU_ticks]
cmp [MENU_ticks], MENU_mpt
jne @@skip_main_menu
mov [MENU_ticks], 0
cmp cx, 105
jna @@not_play
cmp cx, 212
jnb @@not_play
cmp dx, 95
jna @@not_play
cmp dx, 121
jnb @@not_play
cmp [GAME_is_over], 1
je @@game_over_play
push offset BMP_menu_play
jmp @@cont_play
@@game_over_play:
push offset BMP_go_play
@@cont_play:
cmp ax, 10b
jne @@cont
mov [FLAG_should_setup_game], 1
jmp @@cont
@@not_play:
cmp cx, 105
jna @@not_guide
cmp cx, 212
jnb @@not_guide
cmp dx, 141
jna @@not_guide
cmp dx, 167
jnb @@not_guide
cmp [GAME_is_over], 1
je @@game_over_exit
push offset BMP_menu_guide
jmp @@cont_guide
@@game_over_exit:
push offset BMP_go_exit
@@cont_guide:
cmp ax, 10b
jne @@cont
cmp [GAME_is_over], 1
je @@menu_exit
call ViewGuide
jmp @@cont_menu_exit
@@menu_exit:
mov [FLAG_should_exit_game], 1
@@cont_menu_exit:
jmp @@cont
@@not_guide:
cmp [GAME_is_over], 1
je @@game_over_primary
push offset BMP_menu
jmp @@cont_primary
@@game_over_primary:
push offset BMP_go
@@cont_primary:
@@cont:
push 0
push 0
push 320
push 200
call RenderBmp
call UpdateScreen
cmp [GAME_is_over], 1
jne @@ret
mov bh, 0
mov ah, 2
; set cursor position to 10, 7
mov dl, 10
mov dh, 7
int 10h
mov ax, [GAME_score]
call ShowAxDecimal
jmp @@ret
@@skip_main_menu:
@@game:
cmp ax, 10b ; left press
jne @@not_left_press
; check if hovering on any tool
; landmine
cmp cx, 2
jna @@not_landmine
cmp cx, 2 + OBJ_w
jnb @@not_landmine
cmp dx, 2
jna @@not_landmine
cmp dx, 2 + OBJ_h
jnb @@not_landmine
; yes
cmp [LANDMINE_is_placed], 1
je @@not_landmine
mov [CURSOR_x], cx
mov [CURSOR_y], dx
mov [BMP_dragging], 1
mov [BMP_dragging_ptr], offset BMP_landmine
@@not_landmine:
; black hole
cmp cx, 2 + OBJ_w + 2
jna @@not_black_hole
cmp cx, 2 + OBJ_w + 2 + OBJ_w
jnb @@not_black_hole
cmp dx, 2
jna @@not_black_hole
cmp dx, 2 + OBJ_h
jnb @@not_black_hole
; yes
cmp [BLACK_HOLE_is_placed], 1
je @@not_black_hole
mov [CURSOR_x], cx
mov [CURSOR_y], dx
mov [BMP_dragging], 1
mov [BMP_dragging_ptr], offset BMP_black_hole
@@not_black_hole:
jmp @@ret
@@not_left_press:
cmp ax, 100b ; left release
jne @@not_left_release
cmp [BMP_dragging], 1
jne @@not_left_release
mov [BMP_dragging], 0
cmp [BMP_dragging_ptr], offset BMP_landmine
jne @@check_black_hole_release
mov [LANDMINE_is_placed], 1
sub cx, OBJ_W / 2
sub dx, OBJ_H / 2
mov [LANDMINE_x], cx
mov [LANDMINE_y], dx
@@check_black_hole_release:
cmp [BMP_dragging_ptr], offset BMP_black_hole
jne @@ret
mov [BLACK_HOLE_is_placed], 1
sub cx, OBJ_W / 2
sub dx, OBJ_H / 2
mov [BLACK_HOLE_x], cx
mov [BLACK_HOLE_y], dx
jmp @@ret
@@not_left_release:
cmp ax, 1b ; pos change
jne @@not_pos_change
sub cx, OBJ_W / 2
sub dx, OBJ_H / 2
mov [CURSOR_x], cx
mov [CURSOR_y], dx
jmp @@ret
@@not_pos_change:
jmp @@ret
@@starting:
jmp @@ret
@@ret:
call ShowCursor
pop di
pop ds
pop dx
pop cx
pop bx
pop ax
retf
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: ResetCursorPos
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; resets cursor position to 0, 0
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc ResetCursorPos
push ax
push bx
push cx
push dx
mov bh, 0
mov ah, 2
mov dh, 0
mov dl, 0
int 10h
@@ret:
pop dx
pop cx
pop bx
pop ax
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: HandleError
;
; Arguments:
; stack - ($ error message offset)
;
; Returns:
; none
;
; Description:
; logs error message and exits game
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
error_message equ [word bp + 4]
proc HandleError
push bp
mov bp, sp
push ax
push bx
push cx
push dx
mov ax, 2
int 10h
mov dx, error_message
mov ah, 9
int 21h
lea dx, [ERROR_exit]
mov ah, 9
int 21h
call AwaitKeypress
call ExitGame
@@ret:
pop dx
pop cx
pop bx
pop ax
pop bp
ret 2
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: DrawBackground
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; draws sky background
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc DrawBackground
push ax
push bx
push cx
push dx
push offset BMP_sky
push 0
push GAME_t
push GAME_w
push GAME_h - GAME_t
call RenderBmp
@@ret:
pop dx
pop cx
pop bx
pop ax
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: AwaitKeypress
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; waits for any key to be pressed
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc AwaitKeypress
push ax
mov ah, 1
int 21h
@@ret:
pop ax
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: GameOver
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; shows game over screen
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc GameOver
mov [BMP_should_skip], 0
mov [GAME_is_over], 1
mov [GAME_state], 0
@@ret:
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: ExitGame
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; exits game
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc ExitGame
mov ax, 2
int 10h
xor ax, ax
int 33h
mov ax, 4C00h
int 21h
@@ret:
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: DrawLandmineInTools
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; draws the landmine in the tools section
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc DrawLandmineInTools
mov [BMP_should_skip], 1
mov [BMP_skip_color], OBJ_bg
push offset BMP_landmine
push 2
push 2
push OBJ_w
push OBJ_h
call RenderBmp
@@ret:
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: DrawBlackHoleInTools
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; draws the black hole in the tools section
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc DrawBlackHoleInTools
mov [BMP_should_skip], 1
mov [BMP_skip_color], OBJ_bg
push offset BMP_black_hole
push 2 + OBJ_w + 2
push 2
push OBJ_w
push OBJ_h
call RenderBmp
@@ret:
ret
endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure: DrawTools
;
; Arguments:
; none
;
; Returns:
; none
;
; Description:
; draws tools on screen
;
; Register usage:
; none
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
proc DrawTools
mov [BMP_should_skip], 0
push 0
push 0
push 320 * 16
push 0
call DrawHorizontalLine
mov [BMP_should_skip], 1
mov [BMP_skip_color], OBJ_bg
cmp [BMP_dragging], 1
jne @@not_dragging
cmp [BMP_dragging_ptr], offset BMP_landmine
je @@skip_landmine_drag
cmp [LANDMINE_is_placed], 1
je @@skip_landmine_drag
call DrawLandmineInTools
@@skip_landmine_drag:
cmp [BMP_dragging_ptr], offset BMP_black_hole
je @@skip_black_hole_drag
cmp [BLACK_HOLE_is_placed], 1
je @@skip_black_hole_drag
call DrawBlackHoleInTools
@@skip_black_hole_drag:
jmp @@ret
@@not_dragging:
cmp [LANDMINE_is_placed], 1
je @@skip_landmine_placed
call DrawLandmineInTools
@@skip_landmine_placed:
cmp [BLACK_HOLE_is_placed], 1
je @@skip_black_hole_placed
call DrawBlackHoleInTools
@@skip_black_hole_placed:
jmp @@ret