Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/debug/debug_menu.asm
1271 views
1
DebugMenu:
2
IF DEF(_DEBUG)
3
call ClearScreen
4
5
; These debug names are used for TestBattle.
6
; StartNewGameDebug uses the debug names from PrepareOakSpeech.
7
ld hl, DebugBattlePlayerName
8
ld de, wPlayerName
9
ld bc, NAME_LENGTH
10
call CopyData
11
12
ld hl, DebugBattleRivalName
13
ld de, wRivalName
14
ld bc, NAME_LENGTH
15
call CopyData
16
17
call LoadFontTilePatterns
18
call LoadHpBarAndStatusTilePatterns
19
call ClearSprites
20
call RunDefaultPaletteCommand
21
22
hlcoord 5, 6
23
ld b, 3
24
ld c, 9
25
call TextBoxBorder
26
27
hlcoord 7, 7
28
ld de, DebugMenuOptions
29
call PlaceString
30
31
ld a, TEXT_DELAY_MEDIUM
32
ld [wOptions], a
33
34
ld a, PAD_A | PAD_B | PAD_START
35
ld [wMenuWatchedKeys], a
36
xor a
37
ld [wMenuJoypadPollCount], a
38
inc a
39
ld [wMaxMenuItem], a
40
ld a, 7
41
ld [wTopMenuItemY], a
42
dec a
43
ld [wTopMenuItemX], a
44
xor a
45
ld [wCurrentMenuItem], a
46
ld [wLastMenuItem], a
47
ld [wMenuWatchMovingOutOfBounds], a
48
49
call HandleMenuInput
50
bit B_PAD_B, a
51
jp nz, DisplayTitleScreen
52
53
ld a, [wCurrentMenuItem]
54
and a ; FIGHT?
55
jp z, TestBattle
56
57
; DEBUG
58
ld hl, wStatusFlags6
59
set BIT_DEBUG_MODE, [hl]
60
jp StartNewGameDebug
61
62
DebugBattlePlayerName:
63
db "Tom@"
64
65
DebugBattleRivalName:
66
db "Juerry@"
67
68
DebugMenuOptions:
69
db "FIGHT"
70
next "DEBUG@"
71
ELSE
72
ret
73
ENDC
74
75
TestBattle: ; unreferenced except in _DEBUG
76
.loop
77
call GBPalNormal
78
79
; Don't mess around with obedience.
80
ld a, 1 << BIT_EARTHBADGE
81
ld [wObtainedBadges], a
82
83
ld hl, wStatusFlags7
84
set BIT_TEST_BATTLE, [hl]
85
86
; wNumBagItems and wBagItems are not initialized here,
87
; and their garbage values happen to act as if EXP_ALL
88
; is in the bag at the end of the test battle.
89
; pokeyellow fixes this by initializing them with a
90
; list of items.
91
92
; Reset the party.
93
ld hl, wPartyCount
94
xor a
95
ld [hli], a
96
dec a
97
ld [hl], a
98
99
; Give the player a level 20 Rhydon.
100
ld a, RHYDON
101
ld [wCurPartySpecies], a
102
ld a, 20
103
ld [wCurEnemyLevel], a
104
xor a
105
ld [wMonDataLocation], a
106
ld [wCurMap], a
107
call AddPartyMon
108
109
; Fight against a level 20 Rhydon.
110
ld a, RHYDON
111
ld [wCurOpponent], a
112
113
predef InitOpponent
114
115
; When the battle ends, do it all again.
116
; There are some graphical quirks in SGB mode.
117
ld a, 1
118
ld [wUpdateSpritesEnabled], a
119
ldh [hAutoBGTransferEnabled], a
120
jr .loop
121
122