ref: 30b37da3870217da1eaecca82bb77ca4343ada49
parent: d08199c79d8168368aeac0381427d533e09f073d
author: PikalaxALT <[email protected]>
date: Tue Dec 22 17:19:33 EST 2015
More stats screen shenanigans
--- a/constants/cgb_constants.asm
+++ b/constants/cgb_constants.asm
@@ -2,7 +2,7 @@
const SCGB_00
const SCGB_01
const SCGB_02
- const SCGB_03
+ const SCGB_STATS_SCREEN_HP_PALS
const SCGB_04
const SCGB_05
const SCGB_06
@@ -31,5 +31,5 @@
const SCGB_1D
const SCGB_1E
-SCGB_FC EQU -4
+SCGB_PARTY_MENU_HP_PALS EQU -4
SCGB_RAM EQU -1
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -117,8 +117,8 @@
ret
; 8ade
-Function8ade: ; 8ade SGB layout $fc
- ld hl, wcd9b
+SGB_ApplyPartyMenuHPPals: ; 8ade SGB layout $fc
+ ld hl, wHPPals
ld a, [wSGBPals]
ld e, a
ld d, $0
@@ -399,10 +399,10 @@
ret
; 8c8a
-Function8c8a: ; 8c8a
+LoadStatsScreenPals: ; 8c8a
call CheckCGB
ret z
- ld hl, Unknown_8f6a
+ ld hl, StatsScreenPals
ld b, 0
dec c
rept 2
@@ -734,8 +734,8 @@
ret
; 96f3
-Function96f3: ; 96f3 CGB layout $fc
- ld hl, wcd9b
+CGB_ApplyPartyMenuHPPals: ; 96f3 CGB layout $fc
+ ld hl, wHPPals
ld a, [wSGBPals]
ld e, a
ld d, $0
@@ -746,16 +746,15 @@
inc a
ld e, a
hlcoord 11, 2, AttrMap
- ld bc, $28
+ ld bc, 2 * SCREEN_WIDTH
ld a, [wSGBPals]
-.asm_970b
+.loop
and a
- jr z, .asm_9712
+ jr z, .done
add hl, bc
dec a
- jr .asm_970b
-
-.asm_9712
+ jr .loop
+.done
lb bc, 2, 8
ld a, e
call FillBoxCGB
@@ -966,7 +965,6 @@
ld a, $10
jr nz, .okay
ld a, $20
-
.okay
ld [rJOYP], a
ld a, $30
@@ -980,7 +978,7 @@
ld [rJOYP], a
ld a, $30
ld [rJOYP], a
- call Function9a7a
+ call SGBDelayCycles
pop bc
dec b
jr nz, .loop
@@ -1004,10 +1002,10 @@
ld [hSGB], a
call Function98eb
call Function99b4
- call Function9a7a
+ call SGBDelayCycles
call Function993f
call Function992c
- call Function9a7a
+ call SGBDelayCycles
call Function993f
ld hl, PalPacket_9d66
call Function981a
@@ -1113,7 +1111,7 @@
ld hl, PalPacket_9d56
call Function981a
call Function992c
- call Function9a7a
+ call SGBDelayCycles
call Function993f
ld hl, PalPacket_9d66
call Function981a
@@ -1147,7 +1145,7 @@
Function994a: ; 994a
ld hl, PalPacket_9d26
call Function981a
- call Function9a7a
+ call SGBDelayCycles
ld a, [rJOYP]
and $3
cp $3
@@ -1157,26 +1155,26 @@
rept 2
ld a, [rJOYP]
endr
- call Function9a7a
- call Function9a7a
+ call SGBDelayCycles
+ call SGBDelayCycles
ld a, $30
ld [rJOYP], a
- call Function9a7a
- call Function9a7a
+ call SGBDelayCycles
+ call SGBDelayCycles
ld a, $10
ld [rJOYP], a
rept 6
ld a, [rJOYP]
endr
- call Function9a7a
- call Function9a7a
+ call SGBDelayCycles
+ call SGBDelayCycles
ld a, $30
ld [rJOYP], a
rept 3
ld a, [rJOYP]
endr
- call Function9a7a
- call Function9a7a
+ call SGBDelayCycles
+ call SGBDelayCycles
ld a, [rJOYP]
and $3
cp $3
@@ -1194,7 +1192,7 @@
Function99ab: ; 99ab
ld hl, PalPacket_9d16
call Function981a
- jp Function9a7a
+ jp SGBDelayCycles
; 99b4
Function99b4: ; 99b4
@@ -1319,9 +1317,9 @@
ret
; 0x9a7a
-Function9a7a: ; 9a7a
- ld de, $1b58
-.asm_9a7d
+SGBDelayCycles: ; 9a7a
+ ld de, 7000
+.wait
nop
nop
nop
@@ -1328,7 +1326,7 @@
dec de
ld a, d
or e
- jr nz, .asm_9a7d
+ jr nz, .wait
ret
; 9a86
--- a/engine/menu.asm
+++ b/engine/menu.asm
@@ -583,8 +583,7 @@
ret
; 24374
-_BackUpTiles:: ; 24374
-; Push the window
+_PushWindow:: ; 24374
ld a, [rSVBK]
push af
ld a, $7
--- a/engine/party_menu.asm
+++ b/engine/party_menu.asm
@@ -143,15 +143,14 @@
ld d, $6
ld b, $0
call DrawBattleHPBar
- ld hl, wcd9b
+ ld hl, wHPPals
ld a, [wSGBPals]
ld c, a
ld b, $0
add hl, bc
call SetHPPal
- ld b, SCGB_FC
+ ld b, SCGB_PARTY_MENU_HP_PALS
call GetSGBLayout
-
.skip
ld hl, wSGBPals
inc [hl]
--- a/engine/stats_screen.asm
+++ b/engine/stats_screen.asm
@@ -66,7 +66,7 @@
and $7f
ld hl, StatsScreenPointerTable
rst JumpTable
- call Function4dd3a ; check for keys?
+ call StatsScreen_WaitAnim ; check for keys?
ld a, [wJumptableIndex]
bit 7, a
jr z, .loop
@@ -88,7 +88,7 @@
and $7f
ld hl, StatsScreenPointerTable
rst JumpTable
- call Function4dd3a
+ call StatsScreen_WaitAnim
callba Function100dfd
jr c, .exit
ld a, [wJumptableIndex]
@@ -100,37 +100,39 @@
; 4dd2a
StatsScreenPointerTable: ; 4dd2a
- dw MonStatsInit ; regular pokémon
- dw EggStatsInit ; egg
- dw StatsScreenWaitCry
- dw Function4ddac
- dw Function4ddc6
- dw StatsScreenWaitCry
- dw Function4ddd6
- dw Function4dd6c
+ jumptable_start
+ jumptable MonStatsInit ; regular pokémon
+ jumptable EggStatsInit ; egg
+ jumptable StatsScreenWaitCry
+ jumptable EggStatsJoypad
+ jumptable StatsScreen_LoadPage
+ jumptable StatsScreenWaitCry
+ jumptable MonStatsJoypad
+ jumptable StatsScreen_Exit
; 4dd3a
-Function4dd3a: ; 4dd3a (13:5d3a)
+StatsScreen_WaitAnim: ; 4dd3a (13:5d3a)
ld hl, wcf64
bit 6, [hl]
- jr nz, .asm_4dd49
+ jr nz, .try_anim
bit 5, [hl]
- jr nz, .asm_4dd56
+ jr nz, .finish
call DelayFrame
ret
-.asm_4dd49
+
+.try_anim
callba SetUpPokeAnim
- jr nc, .asm_4dd56
+ jr nc, .finish
ld hl, wcf64
res 6, [hl]
-.asm_4dd56
+.finish
ld hl, wcf64
res 5, [hl]
callba Function10402d
ret
-Function4dd62: ; 4dd62 (13:5d62)
+StatsScreen_SetJumptableIndex: ; 4dd62 (13:5d62)
ld a, [wJumptableIndex]
and $80
or h
@@ -137,7 +139,7 @@
ld [wJumptableIndex], a
ret
-Function4dd6c: ; 4dd6c (13:5d6c)
+StatsScreen_Exit: ; 4dd6c (13:5d6c)
ld hl, wJumptableIndex
set 7, [hl]
ret
@@ -151,16 +153,17 @@
call Function4ddf2
ld a, [CurPartySpecies]
cp EGG
- jr z, .asm_4dd9b
- call Function4deea
+ jr z, .egg
+ call StatsScreen_InitUpperHalf
ld hl, wcf64
set 4, [hl]
- ld h, $4
- call Function4dd62
+ ld h, StatsScreen_LoadPageTableIndex
+ call StatsScreen_SetJumptableIndex
ret
-.asm_4dd9b
- ld h, $1
- call Function4dd62
+
+.egg
+ ld h, EggStatsInitTableIndex
+ call StatsScreen_SetJumptableIndex
ret
EggStatsInit: ; 4dda1
@@ -172,24 +175,26 @@
; 0x4ddac
-Function4ddac: ; 4ddac (13:5dac)
- call Function4de2c
- jr nc, .asm_4ddb7
- ld h, $0
- call Function4dd62
+EggStatsJoypad: ; 4ddac (13:5dac)
+ call StatsScreen_GetJoypad
+ jr nc, .check
+ ld h, MonStatsInitTableIndex
+ call StatsScreen_SetJumptableIndex
ret
-.asm_4ddb7
- bit 0, a
- jr nz, .asm_4ddc0
- and $c3
- jp Function4de54
-.asm_4ddc0
- ld h, $7
- call Function4dd62
+
+.check
+ bit A_BUTTON_F, a
+ jr nz, .quit
+ and D_DOWN | D_UP | A_BUTTON | B_BUTTON
+ jp StatsScreen_JoypadAction
+
+.quit
+ ld h, StatsScreen_ExitTableIndex
+ call StatsScreen_SetJumptableIndex
ret
-Function4ddc6: ; 4ddc6 (13:5dc6)
- call Function4dfb6
+StatsScreen_LoadPage: ; 4ddc6 (13:5dc6)
+ call StatsScreen_LoadGFX
ld hl, wcf64
res 4, [hl]
ld a, [wJumptableIndex]
@@ -197,16 +202,16 @@
ld [wJumptableIndex], a
ret
-Function4ddd6: ; 4ddd6 (13:5dd6)
- call Function4de2c
- jr nc, .asm_4dde1
- ld h, $0
- call Function4dd62
+MonStatsJoypad: ; 4ddd6 (13:5dd6)
+ call StatsScreen_GetJoypad
+ jr nc, .next
+ ld h, MonStatsInitTableIndex
+ call StatsScreen_SetJumptableIndex
ret
-.asm_4dde1
- and $f3
- jp Function4de54
+.next
+ and D_DOWN | D_UP | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON
+ jp StatsScreen_JoypadAction
StatsScreenWaitCry: ; 4dde6 (13:5de6)
call IsSFXPlaying
@@ -241,7 +246,7 @@
and a
ret
-Function4de2c: ; 4de2c (13:5e2c)
+StatsScreen_GetJoypad: ; 4de2c (13:5e2c)
call GetJoypad
ld a, [MonType]
cp BREEDMON
@@ -254,7 +259,7 @@
pop de
pop hl
ld a, [wMenuJoypad]
- and $c0
+ and D_DOWN | D_UP
jr nz, .set_carry
ld a, [wMenuJoypad]
jr .clear_flags
@@ -269,100 +274,102 @@
scf
ret
-Function4de54: ; 4de54 (13:5e54)
+StatsScreen_JoypadAction: ; 4de54 (13:5e54)
push af
ld a, [wcf64]
and $3
ld c, a
pop af
- bit 1, a
- jp nz, Function4dee4
- bit 5, a
- jr nz, .asm_4dec7
- bit 4, a
- jr nz, .asm_4debd
- bit 0, a
- jr nz, .asm_4deb8
- bit 6, a
- jr nz, .asm_4dea0
- bit 7, a
- jr nz, .asm_4de77
- jr .asm_4dece
-.asm_4de77
+ bit B_BUTTON_F, a
+ jp nz, .b_button
+ bit D_LEFT_F, a
+ jr nz, .d_left
+ bit D_RIGHT_F, a
+ jr nz, .d_right
+ bit A_BUTTON_F, a
+ jr nz, .a_button
+ bit D_UP_F, a
+ jr nz, .d_up
+ bit D_DOWN_F, a
+ jr nz, .d_down
+ jr .done
+.d_down
ld a, [MonType]
cp BOXMON
- jr nc, .asm_4dece
+ jr nc, .done
and a
ld a, [PartyCount]
- jr z, .asm_4de87
+ jr z, .next_mon
ld a, [OTPartyCount]
-.asm_4de87
+.next_mon
ld b, a
ld a, [CurPartyMon]
inc a
cp b
- jr z, .asm_4dece
+ jr z, .done
ld [CurPartyMon], a
ld b, a
ld a, [MonType]
and a
- jr nz, .asm_4dede
+ jr nz, .load_mon
ld a, b
inc a
ld [wd0d8], a
- jr .asm_4dede
-.asm_4dea0
+ jr .load_mon
+.d_up
ld a, [CurPartyMon]
and a
- jr z, .asm_4dece
+ jr z, .done
dec a
ld [CurPartyMon], a
ld b, a
ld a, [MonType]
and a
- jr nz, .asm_4dede
+ jr nz, .load_mon
ld a, b
inc a
ld [wd0d8], a
- jr .asm_4dede
-.asm_4deb8
+ jr .load_mon
+.a_button
ld a, c
cp $3
- jr z, Function4dee4
-.asm_4debd
+ jr z, .b_button
+.d_right
inc c
ld a, $3
cp c
- jr nc, .asm_4decf
+ jr nc, .set_page
ld c, $1
- jr .asm_4decf
-.asm_4dec7
+ jr .set_page
+.d_left
dec c
- jr nz, .asm_4decf
+ jr nz, .set_page
ld c, $3
- jr .asm_4decf
-.asm_4dece
+ jr .set_page
+.done
ret
-.asm_4decf
+
+.set_page
ld a, [wcf64]
- and $fc
+ and %11111100
or c
ld [wcf64], a
- ld h, $4
- call Function4dd62
+ ld h, StatsScreen_LoadPageTableIndex
+ call StatsScreen_SetJumptableIndex
ret
-.asm_4dede
- ld h, $0
- call Function4dd62
+
+.load_mon
+ ld h, MonStatsInitTableIndex
+ call StatsScreen_SetJumptableIndex
ret
-Function4dee4: ; 4dee4 (13:5ee4)
- ld h, $7
- call Function4dd62
+.b_button: ; 4dee4 (13:5ee4)
+ ld h, StatsScreen_ExitTableIndex
+ call StatsScreen_SetJumptableIndex
ret
-Function4deea: ; 4deea (13:5eea)
- call Function4df45
+StatsScreen_InitUpperHalf: ; 4deea (13:5eea)
+ call .PlaceHPBar
xor a
ld [hBGMapMode], a
ld a, [CurBaseData] ; wd236 (aliases: BaseDexNo)
@@ -379,13 +386,13 @@
call PrintNum
hlcoord 14, 0
call PrintLevel
- ld hl, Unknown_4df77
- call Function4e528
- call Function4e505
+ ld hl, .NicknamePointers
+ call GetNicknamePointer
+ call CopyNickname
hlcoord 8, 2
call PlaceString
hlcoord 18, 0
- call Function4df66
+ call .PlaceGenderChar
hlcoord 9, 4
ld a, "/"
ld [hli], a
@@ -393,12 +400,12 @@
ld [wd265], a
call GetPokemonName
call PlaceString
- call Function4df8f
- call Function4df9b
- call Function4dfa6
+ call StatsScreen_PlaceHorizontalDivider
+ call StatsScreen_PlacePageSwitchArrows
+ call StatsScreen_PlaceShinyIcon
ret
-Function4df45: ; 4df45 (13:5f45)
+.PlaceHPBar: ; 4df45 (13:5f45)
ld hl, TempMonHP
ld a, [hli]
ld b, a
@@ -410,12 +417,12 @@
callba ComputeHPBarPixels
ld hl, wcda1
call SetHPPal
- ld b, SCGB_03
+ ld b, SCGB_STATS_SCREEN_HP_PALS
call GetSGBLayout
call DelayFrame
ret
-Function4df66: ; 4df66 (13:5f66)
+.PlaceGenderChar: ; 4df66 (13:5f66)
push hl
callba GetGender
pop hl
@@ -428,11 +435,11 @@
ret
; 4df77 (13:5f77)
-Unknown_4df77: ; 4df77
+.NicknamePointers: ; 4df77
dw PartyMonNicknames
dw OTPartyMonNicknames
dw sBoxMonNicknames
- dw wd002
+ dw wBufferMonNick
; 4df7f
Function4df7f: ; 4df7f
@@ -448,7 +455,7 @@
ret
; 4df8f
-Function4df8f: ; 4df8f (13:5f8f)
+StatsScreen_PlaceHorizontalDivider: ; 4df8f (13:5f8f)
hlcoord 0, 7
ld b, SCREEN_WIDTH
ld a, "_"
@@ -458,7 +465,7 @@
jr nz, .loop
ret
-Function4df9b: ; 4df9b (13:5f9b)
+StatsScreen_PlacePageSwitchArrows: ; 4df9b (13:5f9b)
hlcoord 12, 6
ld [hl], "◀"
hlcoord 19, 6
@@ -465,7 +472,7 @@
ld [hl], "▶"
ret
-Function4dfa6: ; 4dfa6 (13:5fa6)
+StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6)
ld bc, TempMonDVs
callba CheckShininess
ret nc
@@ -473,15 +480,15 @@
ld [hl], "<SHINY>"
ret
-Function4dfb6: ; 4dfb6 (13:5fb6)
+StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
ld a, [BaseDexNo] ; wd236 (aliases: BaseDexNo)
ld [wd265], a
ld [CurSpecies], a
xor a
ld [hBGMapMode], a
- call Function4dfda
- call DrawStatsScreenPage
- call Function4dfed
+ call .ClearBox
+ call .PageTilemap
+ call .LoadPals
ld hl, wcf64
bit 4, [hl]
jr nz, .place_frontpic
@@ -492,7 +499,7 @@
call StatsScreen_PlaceFrontpic
ret
-Function4dfda: ; 4dfda (13:5fda)
+.ClearBox: ; 4dfda (13:5fda)
ld a, [wcf64]
and $3
ld c, a
@@ -502,17 +509,17 @@
call ClearBox
ret
-Function4dfed: ; 4dfed (13:5fed)
+.LoadPals: ; 4dfed (13:5fed)
ld a, [wcf64]
and $3
ld c, a
- callba Function8c8a
+ callba LoadStatsScreenPals
call DelayFrame
ld hl, wcf64
set 5, [hl]
ret
-DrawStatsScreenPage: ; 4e002 (13:6002)
+.PageTilemap: ; 4e002 (13:6002)
ld a, [wcf64]
and $3
dec a
@@ -755,8 +762,8 @@
ld de, TempMonID
call PrintNum
ld hl, .OTNamePointers
- call Function4e528
- call Function4e505
+ call GetNicknamePointer
+ call CopyNickname
callba CheckNickErrors
hlcoord 2, 13
call PlaceString
@@ -964,9 +971,9 @@
ld [hBGMapMode], a
ld hl, wcda1
call SetHPPal
- ld b, SCGB_03
+ ld b, SCGB_STATS_SCREEN_HP_PALS
call GetSGBLayout
- call Function4df8f
+ call StatsScreen_PlaceHorizontalDivider
ld de, EggString
hlcoord 8, 1
call PlaceString
@@ -1101,7 +1108,7 @@
pop bc
ret
-Function4e505: ; 4e505 (13:6505)
+CopyNickname: ; 4e505 (13:6505)
ld de, StringBuffer1
ld bc, PKMN_NAME_LENGTH
jr .okay ; uuterly pointless
@@ -1123,7 +1130,7 @@
pop de
ret
-Function4e528: ; 4e528 (13:6528)
+GetNicknamePointer: ; 4e528 (13:6528)
ld a, [MonType]
add a
ld c, a
@@ -1133,7 +1140,7 @@
ld h, [hl]
ld l, a
ld a, [MonType]
- cp $3
+ cp BREEDMON
ret z
ld a, [CurPartyMon]
jp SkipNames
--- a/event/buena.asm
+++ b/event/buena.asm
@@ -10,7 +10,7 @@
add c
add $2
ld [wMenuBorderRightCoord], a
- call BackUpTiles
+ call PushWindow
call DoNthMenu ; menu
callba Buena_ExitMenu
ld b, $0
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -3,7 +3,7 @@
LoadMenuDataHeader::
call CopyMenuDataHeader
- call BackUpTiles
+ call PushWindow
ret
CopyMenuDataHeader::
@@ -160,7 +160,7 @@
ld [wMenuBorderTopCoord], a
add 4
ld [wMenuBorderBottomCoord], a
- call BackUpTiles
+ call PushWindow
InterpretTwoOptionMenu:: ; 1dfe
call VerticalMenu
@@ -200,7 +200,7 @@
OffsetMenuDataHeader:: ; 1e2e
call _OffsetMenuDataHeader
- call BackUpTiles
+ call PushWindow
ret
; 1e35
--- a/home/tilemap.asm
+++ b/home/tilemap.asm
@@ -1,5 +1,5 @@
-BackUpTiles:: ; 1c00
- callab _BackUpTiles
+PushWindow:: ; 1c00
+ callab _PushWindow
ret
; 1c07
--- a/main.asm
+++ b/main.asm
@@ -9836,7 +9836,7 @@
ld [wMenuBorderTopCoord], a
add $4
ld [wMenuBorderBottomCoord], a
- call BackUpTiles
+ call PushWindow
call VerticalMenu
push af
ld c, 15
--- a/misc/gfx_41.asm
+++ b/misc/gfx_41.asm
@@ -1,9 +1,8 @@
Function104000:: ; 104000
- ld hl, Function104006
+ ld hl, .Function
jp CallInSafeGFXMode
-; 104006
-Function104006: ; 104006
+.Function
decoord 0, 0, AttrMap
ld hl, wBackupAttrMap
call CutAndPasteAttrMap
@@ -22,11 +21,10 @@
; 10402d
Function10402d:: ; 10402d
- ld hl, Function104033
+ ld hl, .Function
jp CallInSafeGFXMode
-; 104033
-Function104033: ; 104033
+.Function
decoord 0, 0
ld hl, wDecompressScratch
call CutAndPasteTilemap
@@ -38,11 +36,10 @@
; 104047
Function104047: ; 104047
- ld hl, Function10404d
+ ld hl, .Function
jp CallInSafeGFXMode
-; 10404d
-Function10404d: ; 10404d
+.Function
decoord 0, 0, AttrMap
ld hl, wBackupAttrMap
call CutAndPasteAttrMap
@@ -54,11 +51,10 @@
; 104061
ReloadMapPart:: ; 104061
- ld hl, Function104067
+ ld hl, .Function
jp CallInSafeGFXMode
-; 104067
-Function104067: ; 104067
+.Function
decoord 0, 0, AttrMap
ld hl, wBackupAttrMap
call CutAndPasteAttrMap
@@ -84,11 +80,10 @@
Function104099: ; 104099
ld hl, ReloadMapPart ; useless
- ld hl, Function1040a2
+ ld hl, .Function
jp CallInSafeGFXMode
-; 1040a2
-Function1040a2: ; 1040a2
+.Function
decoord 0, 0, AttrMap
ld hl, wBackupAttrMap
call CutAndPasteAttrMap
@@ -114,11 +109,10 @@
; 1040d4
Function1040d4: ; 1040d4
- ld hl, Function1040da
+ ld hl, .Function
jp CallInSafeGFXMode
-; 1040da
-Function1040da: ; 1040da
+.Function
ld a, $1
ld [rVBK], a
ld a, $3
@@ -134,16 +128,15 @@
ld [rHDMA4], a
ld a, $23
ld [hDMATransfer], a
- call Function1041a4
+ call WaitDMATransfer
ret
; 1040fb
Function1040fb: ; 1040fb
- ld hl, Function104101
+ ld hl, .Function
jp CallInSafeGFXMode
-; 104101
-Function104101: ; 104101
+.Function
ld a, $1
ld [rVBK], a
ld a, $3
@@ -155,11 +148,10 @@
Function104110:: ; 104110
; OpenText
- ld hl, Function104116
+ ld hl, .Function
jp CallInSafeGFXMode
-; 104116
-Function104116: ; 104116
+.Function
decoord 0, 0, AttrMap
ld hl, wBackupAttrMap
call CutAndPasteAttrMap
@@ -186,11 +178,10 @@
; 104148
Function104148: ; 104148 (41:4148)
- ld hl, Function10414e
+ ld hl, .Function
jp CallInSafeGFXMode
-; 10414e (41:414e)
-Function10414e: ; 10414e
+.Function
decoord 0, 0, AttrMap
ld hl, wBackupAttrMap
call CutAndPasteAttrMap
@@ -247,12 +238,12 @@
ld a, $23
ld [hDMATransfer], a
-Function1041a4: ; 104a14
-.asm_1041a4
+WaitDMATransfer: ; 104a14
+.loop
call DelayFrame
ld a, [hDMATransfer]
and a
- jr nz, .asm_1041a4
+ jr nz, .loop
ret
Function1041ad: ; 1041ad (41:41ad)
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -248,7 +248,7 @@
ld [hl], a
pop af
ld [wMenuCursorBuffer], a
- call BackUpTiles
+ call PushWindow
call Function8923c
call Function89209
call VerticalMenu
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -4563,7 +4563,7 @@
ld [wMenuBorderRightCoord], a
ld a, $5
ld [wMenuBorderBottomCoord], a
- call BackUpTiles
+ call PushWindow
callba Function11765d
callba Function117ab4
callba MobileFunc_106462
@@ -4586,7 +4586,7 @@
ld [wMenuBorderRightCoord], a
ld a, $11
ld [wMenuBorderBottomCoord], a
- call BackUpTiles
+ call PushWindow
callba Function11765d
callba Function17d3f6
callba MobileFunc_106462
@@ -5270,7 +5270,7 @@
ld [wMenuBorderRightCoord], a
ld a, $5
ld [wMenuBorderBottomCoord], a
- call BackUpTiles
+ call PushWindow
hlcoord 0, 0, AttrMap
ld b, $6
ld c, $14
@@ -5296,7 +5296,7 @@
ld [wMenuBorderTopCoord], a
ld a, $a
ld [wMenuBorderBottomCoord], a
- call BackUpTiles
+ call PushWindow
hlcoord 14, 6, AttrMap
ld b, $5
ld c, $6
--- a/misc/printer_77.asm
+++ b/misc/printer_77.asm
@@ -226,7 +226,7 @@
hlcoord 0, 0
call _PrepMonFrontpic
call WaitBGMap
- ld b, SCGB_03
+ ld b, SCGB_STATS_SCREEN_HP_PALS
call GetSGBLayout
call SetPalettes
ret
@@ -278,7 +278,7 @@
ld de, TempMonSpeed
call .PrintTempMonStats
call WaitBGMap
- ld b, SCGB_03
+ ld b, SCGB_STATS_SCREEN_HP_PALS
call GetSGBLayout
call SetPalettes
ret
--- a/predef/cgb.asm
+++ b/predef/cgb.asm
@@ -12,8 +12,8 @@
jr nz, .not_ram
ld a, [SGBPredef]
.not_ram
- cp SCGB_FC
- jp z, Function96f3
+ cp SCGB_PARTY_MENU_HP_PALS
+ jp z, CGB_ApplyPartyMenuHPPals
call Function9673
ld l, a
ld h, 0
@@ -277,7 +277,7 @@
RGB 00, 00, 00
; 8f6a
-Unknown_8f6a: ; 8f6a
+StatsScreenPals: ; 8f6a
RGB 31, 19, 31
RGB 21, 31, 14
--- a/predef/sgb.asm
+++ b/predef/sgb.asm
@@ -8,8 +8,8 @@
jr nz, .not_ram
ld a, [SGBPredef]
.not_ram
- cp SCGB_FC
- jp z, Function8ade
+ cp SCGB_PARTY_MENU_HP_PALS
+ jp z, SGB_ApplyPartyMenuHPPals
ld l, a
ld h, 0
add hl, hl
@@ -390,7 +390,7 @@
pop bc
ld a, c
and a
- jr z, .asm_88ef
+ jr z, .partymon
ld hl, wSGBPals + 3
ld [hl], $e7
inc hl
@@ -399,11 +399,11 @@
ld [hl], $62
inc hl
ld [hl], $c
- jr .asm_8913
+ jr .done
-.asm_88ef
+.partymon
ld hl, PartyMon1DVs
- ld bc, $30
+ ld bc, PARTYMON_STRUCT_LENGTH
ld a, [CurPartyMon]
call AddNTimes
ld c, l
@@ -419,7 +419,7 @@
ld a, [hl]
ld [wSGBPals + 6], a
-.asm_8913
+.done
ld hl, wSGBPals
ld de, BlkPacket_9a86
ret
--- a/wram.asm
+++ b/wram.asm
@@ -1487,7 +1487,7 @@
EnemyHPPal:: ; cd9a
ds 1
-wcd9b:: ds 6
+wHPPals:: ds PARTY_LENGTH
wcda1:: ds 8
wSGBPals:: ds 48 ; cda9
@@ -1660,7 +1660,9 @@
ds 1
-wcfbe:: ds 2
+wcfbe::
+; SGB flags?
+ ds 2
InBattleTowerBattle:: ; cfc0
; 0 not in BattleTower-Battle