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
|
INCLUDE "constants.asm"
; FieldDebugMenu.ReturnJumptable constants
const_def
const FIELDDEBUG_RETURN_REOPEN ; 0
const FIELDDEBUG_RETURN_WAIT_INPUT ; 1
const FIELDDEBUG_RETURN_CLOSE ; 2
const FIELDDEBUG_RETURN_CLEANUP ; 3
const FIELDDEBUG_RETURN_EXIT ; 4
SECTION "engine/menu/field_debug_menu.asm@FieldDebugMenuHeader", ROMX
FieldDebugMenuHeader:
db MENU_BACKUP_TILES
menu_coords 0, 0, 7, 17
dw .MenuData
db 1
.MenuData:
db STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR
db 0
dw FieldDebug_Pages
dw PlaceMenuStrings
dw FieldDebug_MenuStrings
INCLUDE "data/debug/field_debug_entries.inc"
FieldDebugMenu::
call RefreshScreen
ld de, SFX_MENU
call PlaySFX
ld hl, FieldDebugMenuHeader
call LoadMenuHeader
; load first page
ld a, 0
ld [wFieldDebugPage], a
.Reopen:
call UpdateTimePals
call UpdateSprites
ld a, [wFieldDebugMenuCursorBuffer]
ld [wMenuCursorBuffer], a
call OpenMenu
jr c, .WaitInput
ld a, [wMenuCursorBuffer]
ld [wFieldDebugMenuCursorBuffer], a
call PlaceHollowCursor
ld a, [wMenuJoypad]
cp A_BUTTON
jr z, .DoJumptable
call FieldDebug_ChangePage
jr .DoReturn
.DoJumptable:
ld a, [wMenuSelection]
ld hl, FieldDebug_Jumptable
call CallJumptable
.DoReturn:
ld hl, .ReturnJumptable
jp CallJumptable
.ReturnJumptable:
dw .Reopen
dw .WaitInput
dw .Close
dw .Cleanup
dw .Exit
.WaitInput:
call GetJoypad
ldh a, [hJoyDown]
bit A_BUTTON_F, a
jr nz, .WaitInput
call LoadFontExtra
.Close:
call CloseWindow
.Cleanup:
push af
call Function1fea
pop af
ret
.Exit:
call ExitMenu
ld a, -1
ldh [hStartmenuCloseAndSelectHookEnable], a
jr .Cleanup
FieldDebug_CloseMenu:
ld a, FIELDDEBUG_RETURN_CLOSE
ret
FieldDebug_ChangePage:
ld a, [wMenuJoypad]
cp D_LEFT
jr z, .previous
ld a, [wFieldDebugPage]
inc a
cp FIELDDEBUG_NUM_PAGES
jr nz, .next
xor a
.next
ld [wFieldDebugPage], a
jr FieldDebug_PlayMenuSound
.previous
ld a, [wFieldDebugPage]
dec a
cp -1
jr nz, .load_previous
ld a, FIELDDEBUG_NUM_PAGES - 1
.load_previous
ld [wFieldDebugPage], a
jr FieldDebug_PlayMenuSound
FieldDebug_GoToNextPage:
; This will only scroll between the first two pages
; instead of the available three.
ld a, [wFieldDebugPage]
and a
jr z, .page_1
xor a
jr .load_page
.page_1
ld a, 1
.load_page
ld [wFieldDebugPage], a
FieldDebug_PlayMenuSound:
ld de, SFX_MENU
call PlaySFX
.loop
call GetJoypad
ldh a, [hJoyDown]
bit A_BUTTON_F, a
jr nz, .loop
ld a, FIELDDEBUG_RETURN_REOPEN
ret
FieldDebug_WaitJoypadInput:
push bc
ld b, a
.loop
call GetJoypad
ldh a, [hJoyDown]
and b
jr z, .loop
pop bc
ret
FieldDebug_ShowTextboxAndExit:
call MenuTextBox
ld a, A_BUTTON | B_BUTTON
call FieldDebug_WaitJoypadInput
call CloseWindow
ret
FieldDebug_FrameType:
call FrameTypeDialog
ld a, FIELDDEBUG_RETURN_REOPEN
ret
FieldDebug_Reset:
call DisplayResetDialog
ld a, FIELDDEBUG_RETURN_REOPEN
ret
FieldDebug_ShowTrainerCard: ; unreferenced?
callab _TrainerCard
ld a, FIELDDEBUG_RETURN_REOPEN
ret
INCLUDE "engine/debug/field/change_transportation.inc"
INCLUDE "engine/debug/field/change_tileset.inc"
FieldDebug_TownMap:
call LoadStandardMenuHeader
call ClearSprites
callab FlyMap
call ClearPalettes
call Function3657
call LoadFontExtra
call CloseWindow
call GetMemSGBLayout
call SetPalettes
ld a, FIELDDEBUG_RETURN_REOPEN
ret
INCLUDE "engine/debug/field/sprite_viewer.inc"
FieldDebug_NamePlayer:
call LoadStandardMenuHeader
ld de, wPlayerName
ld b, 1
callab NamingScreen
call ClearBGPalettes
call ClearTileMap
call CloseWindow
call ClearSprites
call GetMemSGBLayout
call SetPalettes
ld hl, wce5f
res 4, [hl]
call LoadFontExtra
ld a, FIELDDEBUG_RETURN_REOPEN
ret
INCLUDE "engine/debug/field/toolgear.inc"
FieldDebug_HealPokemon:
predef HealParty
ld hl, .HealedText
call MenuTextBoxBackup
ld a, FIELDDEBUG_RETURN_REOPEN
ret
.HealedText:
text "#の たいりょくを"
line "かいふくしました"
prompt
FieldDebug_CableClub:
callab Function29abf
ld a, FIELDDEBUG_RETURN_REOPEN
ret
INCLUDE "engine/debug/field/npc_movement_test.inc"
INCLUDE "engine/debug/field/mon_following.inc"
INCLUDE "engine/debug/field/follow_npc_test.inc"
INCLUDE "engine/debug/field/warp.inc"
INCLUDE "engine/debug/field/toggle_npc_movement.inc"
INCLUDE "engine/debug/field/field_cut.inc"
INCLUDE "engine/debug/field/check_tile.inc"
INCLUDE "engine/debug/field/move_to_entrance.inc"
FieldDebug_TrainerGear:
call .OpenTrainerGear
ld a, FIELDDEBUG_RETURN_REOPEN
ret
.OpenTrainerGear:
call LoadStandardMenuHeader
callab OpenTrainerGear
call ClearPalettes
callab StartMenuLoadSprites
call CloseWindow
ret
INCLUDE "engine/debug/field/map_viewer.inc"
INCLUDE "engine/debug/field/item_test.inc"
FieldDebug_PCMenu:
callab PokemonCenterPC
ld a, FIELDDEBUG_RETURN_REOPEN
ret
INCLUDE "engine/debug/field/pokemart_menu.inc"
INCLUDE "engine/debug/field/teleport.inc"
INCLUDE "engine/debug/field/minigames.inc"
FieldDebug_VRAMViewer:
call FieldDebug_DoVRAMViewer
ld a, FIELDDEBUG_RETURN_REOPEN
ret
FieldDebug_ClearEventFlags:
call FieldDebug_DoClearEventFlags
ld a, FIELDDEBUG_RETURN_REOPEN
ret
INCLUDE "engine/debug/field/unused_flag_menu.inc"
INCLUDE "engine/debug/field/unused_priority_menu.inc"
INCLUDE "engine/debug/field/vram_viewer.inc"
|