-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_death.asm
266 lines (231 loc) · 4.39 KB
/
game_death.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
;Airaki! - FSE 2014
;Released under the GPL V3, see LICENSE.TXT
pdeath:
ld a,(GAME_MODE)
bit 0,a
jr nz,p2pdeath
di
ld hl,GAMEOVER_CALL
ld de,goc_p1death
ld (hl),e
inc hl
ld (hl),d
jr +
p2edeath:
di
ld a,1
ld (LINK_SENDDEAD),a
ld (LINK_QUIT),a
ld hl,GAMEOVER_CALL
ld de,goc_p2edeath
ld (hl),e
inc hl
ld (hl),d
jr ++
p2pdeath:
di
ld a,1
ld (LINK_QUIT),a
ld hl,GAMEOVER_CALL
ld de,goc_p2pdeath
ld (hl),e
inc hl
ld (hl),d
+:
xor a
ld (GAMEOVER_TIMER),a
ld hl,VBL_HANDLER
ld de,pdeath_vbl
ld (hl),e
inc hl
ld (hl),d
call dxcp_over
ld hl,sfxdata_pdeath
call sfx_play
xor a
ldh ($42),a ;Scroll X
ldh ($43),a ;Scroll Y
ei
ret
edeath:
di
ld hl,GAMEOVER_CALL
ld de,goc_p1edeath
ld (hl),e
inc hl
ld (hl),d
++:
ld hl,VBL_HANDLER
ld de,edeath_vbl
ld (hl),e
inc hl
ld (hl),d
xor a
ld (EDEATH_TIMER),a
call dxcp_over
ld hl,sfxdata_pdeath
call sfx_play
xor a
ldh ($42),a ;Scroll X
ldh ($43),a ;Scroll Y
ei
ret
edeath_vbl:
call sfx_update
call do_comm
call readinput
ld hl,OAMCOPY
ld bc,$A0
call clear
ld a,(EDEATH_TIMER)
inc a
cp 30
jr nz,+
ld (EDEATH_TIMER),a
ld hl,$9C00+(32*4)+1 ;Draw dead enemy :(
ld bc,$0404
ld a,T_ENEMY
call mapinc_w
ld hl,ENEMYGFX_DEAD
call loadenemy
ret
+:
cp 60
jr nz,++
ld (EDEATH_TIMER),a
ld hl,GAMEOVER_CALL
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
call dojump
ret
++:
cp 61
jr c,+
ld a,(JOYP_ACTIVE)
bit 3,a
ret z
ld a,(GAME_MODE)
or a
jp z,menu_setup
di
call screen_off
call clearbkg
ld a,%11110111 ;Display on, BG on, sprites on 8x16, window on, tiles at $8000
ldh ($40),a
jp restart
+:
ld (EDEATH_TIMER),a
ret
pdeath_vbl:
call sfx_update
call do_comm
call readinput
ld hl,OAMCOPY
ld bc,$A0
call clear
ld a,(GAMEOVER_TIMER)
inc a
cp 30
jr nz,+
ld (GAMEOVER_TIMER),a
;Draw player
ld hl,$9C00+(32*10)+1
ld bc,$0404
ld a,T_PLAYER
call mapinc_w
ld de,$8000+(T_PLAYER*16)
ld hl,(:tiles_player_d*$4000)+tiles_player_d
call loadtiles_auto
ret
+:
cp 60
jr nz,++
ld (GAMEOVER_TIMER),a
ld hl,GAMEOVER_CALL
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
call dojump
ret
++:
cp 61
jr c,+
ld a,(JOYP_ACTIVE)
bit 3,a
jp nz,menu_setup
ret
+:
ld (GAMEOVER_TIMER),a
ret
goc_p1death:
ld hl,$9800
ld bc,32*32
call clear_w
ld hl,$9800+(32*10)+2
ld de,text_battleover
ld b,T_ALPHA-96
call maptext
ld a,PALETTE_RED
ld hl,$9800+(32*10)+2
ld bc,$1006
call settilepal
ret
goc_p1edeath:
xor a
ld (EDEATH_TIMER),a
ld hl,$9800
ld bc,32*32
call clear_w
ld hl,$9800+(32*3)+3 ;"VICTORY!"
ld de,text_victory
ld b,T_ALPHA-96
call maptext
ld a,PALETTE_RED
ld hl,$9800
ld bc,$2020
call settilepal
ld hl,VBL_HANDLER
ld de,victory_vbl
ld (hl),e
inc hl
ld (hl),d
ret
text_battleover:
.db " BATTLE",$FE
.db " OVER",$FE,$FE,$FE
.db "PUSH START",$FF
goc_p2pdeath:
ld hl,$9800
ld bc,32*32
call clear_w
ld hl,$9800+(32*10)+2
ld de,text_2plost
ld b,T_ALPHA-96
call maptext
ld a,PALETTE_RED
ld hl,$9800+(32*10)+2
ld bc,$1006
call settilepal
ret
text_2plost:
.db " YOU LOST ",$FE,$FE,$FE
.db "PUSH START",$FF
goc_p2edeath:
ld hl,$9800
ld bc,32*32
call clear_w
ld hl,$9800+(32*10)+2
ld de,text_2pwin
ld b,T_ALPHA-96
call maptext
ld a,PALETTE_SHIELD
ld hl,$9800+(32*10)+2
ld bc,$1006
call settilepal
ret
text_2pwin:
.db " YOU WON! ",$FE,$FE,$FE
.db "PUSH START",$FF