-
Notifications
You must be signed in to change notification settings - Fork 1
/
gameUtil.inc
115 lines (69 loc) · 1.48 KB
/
gameUtil.inc
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
backupGridData MACRO
MOV BX , 0
_label_backupGridData_loop:
MOVZX AX , DS:[grid][BX]
PUSH AX
INC BX
CMP BX , GRID_WIDTH * GRID_HEIGHT
JNE _label_backupGridData_loop
ENDM backupGridData
restoreGridData MACRO
MOV BX , GRID_WIDTH * GRID_HEIGHT -1
_label_restoreGridData_loop:
POP AX
MOV DS:[grid][BX] , AL
DEC BX
CMP BX , -1
JNE _label_restoreGridData_loop
ENDM restoreGridData
callUpdateGrid MACRO x1 , y1 , newData
PUSHA
MOV BX , x1
MOV AX , y1
MOV CL , newData
CALL updateGrid
POPA
ENDM callUpdateGrid
; Parameters:
; BX -> X
; AX -> Y
callExplodeBlock MACRO whoseBomb
PUSHA
MOV DL , whoseBomb
CALL explodeBlock
POPA
ENDM callExplodeBlock
callExplodeBomb MACRO bomb , whoseBomb
PUSHA
MOV bomb.to_be_drawn , false
MOV BX , bomb.bomb_x
MOV AX , bomb.bomb_y
MOV CL , bomb.level
MOV DL , whoseBomb
CALL explodeBomb
POPA
ENDM callExplodeBomb
callTakePowerupIfAny_Player1 MACRO PowerupType
PUSH CX
MOV CL , PowerupType
CALL takePowerupIfAny_Player1
POP CX
ENDM callTakePowerupIfAny_Player1
callMoveIfAvailable_Player1 MACRO direction
PUSHA
LEA BP , direction
CALL moveIfAvailable_Player1
POPA
ENDM callMoveIfAvailable_Player1
callTakePowerupIfAny_Player2 MACRO PowerupType
PUSH CX
MOV CL , PowerupType
CALL takePowerupIfAny_Player2
POP CX
ENDM callTakePowerupIfAny_Player2
callMoveIfAvailable_Player2 MACRO direction
PUSHA
LEA BP , direction
CALL moveIfAvailable_Player2
POPA
ENDM callMoveIfAvailable_Player2