ref: 987ed1fafb2ed4920276089f8c93f1be3f31acac
parent: 3d36f1a83711f117274c56f3ddb285d81a869bb3
author: PikalaxALT <PikalaxALT@gmail.com>
date: Sat Dec 19 09:48:30 EST 2015
More work on slots; WRAM cleanup, Move Deleter
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -5308,7 +5308,7 @@
call UpdateBattleHUDs
call WaitBGMap
call LoadTileMapToTempTileMap
- call ResetTextRelatedRAM
+ call ClearWindowData
call FinishBattleAnim
and a
ret
@@ -5319,7 +5319,7 @@
ld a, [wBattleResult]
and $c0
ld [wBattleResult], a
- call ResetTextRelatedRAM
+ call ClearWindowData
call SetPalettes
scf
ret
@@ -5661,9 +5661,9 @@
ld a, 17 - NUM_MOVES - 4
.got_default_coord
- ld [wcfa1], a
+ ld [w2DMenuCursorInitY], a
ld a, b
- ld [wcfa2], a
+ ld [w2DMenuCursorInitX], a
ld a, [wMoveSelectionMenuType]
cp $1
jr z, .skip_inc
@@ -5676,9 +5676,9 @@
ld [wMenuCursorX], a
ld a, [wNumMoves]
inc a
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
ld a, $1
- ld [wcfa4], a
+ ld [w2DMenuNumCols], a
ld c, $2c
ld a, [wMoveSelectionMenuType]
dec a
@@ -5694,13 +5694,13 @@
.okay
ld a, b
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ld a, c
- ld [wcfa5], a
+ ld [w2DMenuFlags1], a
xor a
- ld [wcfa6], a
+ ld [w2DMenuFlags2], a
ld a, $10
- ld [wcfa7], a
+ ld [w2DMenuFlags3], a
.menu_loop
ld a, [wMoveSelectionMenuType]
and a
@@ -8557,9 +8557,9 @@
BackUpVBGMap2: ; 3f568
ld a, [rSVBK]
push af
- ld a, $6 ; BANK(wBackupTilemap)
+ ld a, $6 ; BANK(wDecompressScratch)
ld [rSVBK], a
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
ld bc, $40 tiles ; VBGMap3 - VBGMap2
ld a, $2
call ByteFill
@@ -8567,7 +8567,7 @@
push af
ld a, $1
ld [rVBK], a
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
hlbgcoord 0, 0 ; VBGMap2
lb bc, BANK(BackUpVBGMap2), $40
call Request2bpp
@@ -9453,12 +9453,12 @@
ld a, $6
ld [rSVBK], a
- ld hl, wBackupTilemap
- ld bc, wBackupAttrMap - wBackupTilemap
+ ld hl, wDecompressScratch
+ ld bc, wBackupAttrMap - wDecompressScratch
ld a, " "
call ByteFill
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
hlbgcoord 0, 0
lb bc, BANK(.BlankBGMap), $40
call Request2bpp
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -912,7 +912,7 @@
ld a, 1
ld [AlreadyDisobeyed], a
- ld a, [wcfa3]
+ ld a, [w2DMenuNumRows]
ld b, a
; Save the move we originally picked for afterward.
--- a/engine/battle_start.asm
+++ b/engine/battle_start.asm
@@ -120,7 +120,7 @@
ld a, $6
ld [rSVBK], a
push hl
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
ld bc, $28 * $10
.loop
@@ -132,7 +132,7 @@
jr nz, .loop
pop hl
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld b, BANK(Function8c2cf) ; BANK(@)
ld c, $28
call Request2bpp
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -61,17 +61,17 @@
ld [rSVBK], a
ld hl, IntroLogoGFX
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld a, BANK(IntroLogoGFX)
call FarDecompress
ld hl, VTiles0
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
lb bc, 1, 8 tiles
call Request2bpp
ld hl, VTiles1
- ld de, wBackupTilemap + $80 tiles
+ ld de, wDecompressScratch + $80 tiles
lb bc, 1, 8 tiles
call Request2bpp
@@ -1919,7 +1919,7 @@
ld a, $6
ld [rSVBK], a
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
decoord 0, 0
ld b, SCREEN_HEIGHT
.row
@@ -2039,11 +2039,11 @@
ld [rSVBK], a
push de
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
call Decompress
pop hl
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
lb bc, $01, $80
call Request2bpp
@@ -2058,11 +2058,11 @@
ld [rSVBK], a
push de
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
call Decompress
pop hl
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
lb bc, $01, $ff
call Request2bpp
@@ -2077,11 +2077,11 @@
ld [rSVBK], a
push de
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
call Decompress
pop hl
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
lb bc, $01, $40
call Request2bpp
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -395,7 +395,7 @@
hlcoord 4, 1
call PlaceString
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
hlcoord 12, 3
call _PrepMonFrontpic
ld de, VTiles2 tile $31
--- a/engine/evolution_animation.asm
+++ b/engine/evolution_animation.asm
@@ -111,10 +111,10 @@
call .check_statused
jr c, .no_anim
- ld a, [wc2c6]
+ ld a, [wBoxAlignment]
push af
ld a, $1
- ld [wc2c6], a
+ ld [wBoxAlignment], a
ld a, [CurPartySpecies]
push af
@@ -128,7 +128,7 @@
pop af
ld [CurPartySpecies], a
pop af
- ld [wc2c6], a
+ ld [wBoxAlignment], a
ret
.no_anim
@@ -167,11 +167,11 @@
.LoadFrontpic: ; 4e711
call GetBaseData
ld a, $1
- ld [wc2c6], a
+ ld [wBoxAlignment], a
ld de, VTiles2
predef FrontpicPredef
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
ret
; 4e726
--- a/engine/intro_menu.asm
+++ b/engine/intro_menu.asm
@@ -50,7 +50,7 @@
call ClearTileMap
call LoadFontsExtra
call LoadStandardFont
- call ResetTextRelatedRAM
+ call ClearWindowData
ret
; 5b54
@@ -1410,7 +1410,7 @@
GameInit:: ; 642e
callba TryLoadSaveData
- call ResetTextRelatedRAM
+ call ClearWindowData
call ClearBGPalettes
call ClearTileMap
ld a, VBGMap0 / $100
--- a/engine/learn.asm
+++ b/engine/learn.asm
@@ -147,24 +147,24 @@
predef ListMoves
; wMenuData3
ld a, $4
- ld [wcfa1], a
+ ld [w2DMenuCursorInitY], a
ld a, $6
- ld [wcfa2], a
+ ld [w2DMenuCursorInitX], a
ld a, [wNumMoves]
inc a
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
ld a, $1
- ld [wcfa4], a
+ ld [w2DMenuNumCols], a
ld [wMenuCursorY], a
ld [wMenuCursorX], a
ld a, $3
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ld a, $20
- ld [wcfa5], a
+ ld [w2DMenuFlags1], a
xor a
- ld [wcfa6], a
+ ld [w2DMenuFlags2], a
ld a, $20
- ld [wcfa7], a
+ ld [w2DMenuFlags3], a
call StaticMenuJoypad
push af
call Call_LoadTempTileMapToTileMap
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -1229,23 +1229,23 @@
ld a, $1
ld [MonType], a
ld a, $c1
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ld a, [OTPartyCount]
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
ld a, $1
- ld [wcfa4], a
+ ld [w2DMenuNumCols], a
ld a, $9
- ld [wcfa1], a
+ ld [w2DMenuCursorInitY], a
ld a, $6
- ld [wcfa2], a
+ ld [w2DMenuCursorInitX], a
ld a, $1
ld [wMenuCursorX], a
ld a, $10
- ld [wcfa7], a
+ ld [w2DMenuFlags3], a
ld a, $20
- ld [wcfa5], a
+ ld [w2DMenuFlags1], a
xor a
- ld [wcfa6], a
+ ld [w2DMenuFlags2], a
Function28835: ; 28835
callba Function16d70c
@@ -1294,23 +1294,23 @@
xor a
ld [MonType], a
ld a, $c1
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ld a, [PartyCount]
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
ld a, $1
- ld [wcfa4], a
+ ld [w2DMenuNumCols], a
ld a, $1
- ld [wcfa1], a
+ ld [w2DMenuCursorInitY], a
ld a, $6
- ld [wcfa2], a
+ ld [w2DMenuCursorInitX], a
ld a, $1
ld [wMenuCursorX], a
ld a, $10
- ld [wcfa7], a
+ ld [w2DMenuFlags3], a
ld a, $20
- ld [wcfa5], a
+ ld [w2DMenuFlags1], a
xor a
- ld [wcfa6], a
+ ld [w2DMenuFlags2], a
call WaitBGMap2
Function288c5: ; 288c5
@@ -1388,23 +1388,23 @@
ld a, $7f
ldcoord_a 11, 16
ld a, $13
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ld a, $1
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
ld a, $1
- ld [wcfa4], a
+ ld [w2DMenuNumCols], a
ld a, $10
- ld [wcfa1], a
+ ld [w2DMenuCursorInitY], a
ld a, $1
- ld [wcfa2], a
+ ld [w2DMenuCursorInitX], a
ld a, $1
ld [wMenuCursorY], a
ld [wMenuCursorX], a
ld a, $20
- ld [wcfa7], a
+ ld [w2DMenuFlags3], a
xor a
- ld [wcfa5], a
- ld [wcfa6], a
+ ld [w2DMenuFlags1], a
+ ld [w2DMenuFlags2], a
call ScrollingMenuJoypad
bit 4, a
jr nz, .asm_2898d
@@ -1420,23 +1420,23 @@
ld a, $7f
ldcoord_a 1, 16
ld a, $23
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ld a, $1
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
ld a, $1
- ld [wcfa4], a
+ ld [w2DMenuNumCols], a
ld a, $10
- ld [wcfa1], a
+ ld [w2DMenuCursorInitY], a
ld a, $b
- ld [wcfa2], a
+ ld [w2DMenuCursorInitX], a
ld a, $1
ld [wMenuCursorY], a
ld [wMenuCursorX], a
ld a, $20
- ld [wcfa7], a
+ ld [w2DMenuFlags3], a
xor a
- ld [wcfa5], a
- ld [wcfa6], a
+ ld [w2DMenuFlags1], a
+ ld [w2DMenuFlags2], a
call ScrollingMenuJoypad
bit 5, a
jp nz, .asm_28946
@@ -1700,20 +1700,20 @@
hlcoord 12, 8
call PlaceString
ld a, $8
- ld [wcfa1], a
+ ld [w2DMenuCursorInitY], a
ld a, $b
- ld [wcfa2], a
+ ld [w2DMenuCursorInitX], a
ld a, $1
- ld [wcfa4], a
+ ld [w2DMenuNumCols], a
ld a, $2
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
xor a
- ld [wcfa5], a
- ld [wcfa6], a
+ ld [w2DMenuFlags1], a
+ ld [w2DMenuFlags2], a
ld a, $20
- ld [wcfa7], a
+ ld [w2DMenuFlags3], a
ld a, $3
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ld a, $1
ld [wMenuCursorY], a
ld [wMenuCursorX], a
--- a/engine/main_menu.asm
+++ b/engine/main_menu.asm
@@ -75,7 +75,7 @@
db 2
db NEW_GAME
db OPTION
- db $ff
+ db -1
ContinueMenu: ; 0x49d70
db 3
@@ -82,7 +82,7 @@
db CONTINUE
db NEW_GAME
db OPTION
- db $ff
+ db -1
MobileMysteryMenu: ; 0x49d75
db 5
@@ -91,7 +91,7 @@
db OPTION
db MYSTERY_GIFT
db MOBILE
- db $ff
+ db -1
MobileMenu: ; 0x49d7c
db 4
@@ -99,7 +99,7 @@
db NEW_GAME
db OPTION
db MOBILE
- db $ff
+ db -1
MobileStudiumMenu: ; 0x49d82
db 5
@@ -108,7 +108,7 @@
db OPTION
db MOBILE
db MOBILE_STUDIUM
- db $ff
+ db -1
MysteryMobileStudiumMenu: ; 0x49d89
db 6
@@ -118,7 +118,7 @@
db MYSTERY_GIFT
db MOBILE
db MOBILE_STUDIUM
- db $ff
+ db -1
MysteryMenu: ; 0x49d91
db 4
@@ -126,7 +126,7 @@
db NEW_GAME
db OPTION
db MYSTERY_GIFT
- db $ff
+ db -1
MysteryStudiumMenu: ; 0x49d97
db 5
@@ -135,7 +135,7 @@
db OPTION
db MYSTERY_GIFT
db MOBILE_STUDIUM
- db $ff
+ db -1
StudiumMenu: ; 0x49d9e
db 4
@@ -143,7 +143,7 @@
db NEW_GAME
db OPTION
db MOBILE_STUDIUM
- db $ff
+ db -1
Function49da4: ; 49da4
@@ -198,9 +198,9 @@
call SetUpMenu
.asm_49de7
call Function49e09
- ld a, [wcfa5]
+ ld a, [w2DMenuFlags1]
set 5, a
- ld [wcfa5], a
+ ld [w2DMenuFlags1], a
call Function1f1a
ld a, [wMenuJoypad]
cp $2
@@ -333,7 +333,7 @@
call ClearTileMap
call LoadFontsExtra
call LoadStandardFont
- call ResetTextRelatedRAM
+ call ClearWindowData
ret
; 49ee0
@@ -370,19 +370,19 @@
call Function4a492
call ClearBGPalettes
Function49f16: ; 49f16
- call Function4a071
+ call MobileMenu_InitMenuBuffers
ld c, 12
call DelayFrames
hlcoord 4, 0
- ld b, $a
- ld c, $a
+ ld b, 10
+ ld c, 10
call Function48cdc
hlcoord 6, 2
ld de, MobileString1
call PlaceString
hlcoord 0, 12
- ld b, $4
- ld c, $12
+ ld b, 4
+ ld c, SCREEN_HEIGHT
call TextBox
xor a
ld de, String_0x49fe9
@@ -394,36 +394,35 @@
ld hl, wMenuCursorY
ld b, [hl]
push bc
- jr .asm_49f5d
+ jr .check_buttons
-.asm_49f55
+.joy_loop
call ScrollingMenuJoypad
ld hl, wMenuCursorY
ld b, [hl]
push bc
-.asm_49f5d
- bit 0, a
- jr nz, .asm_49f67
- bit 1, a
- jr nz, .asm_49f84
- jr .asm_49f97
+.check_buttons
+ bit A_BUTTON_F, a
+ jr nz, .a_button
+ bit B_BUTTON_F, a
+ jr nz, .b_button
+ jr .next
-.asm_49f67
+.a_button
ld hl, wMenuCursorY
ld a, [hl]
- cp $1
+ cp 1
jp z, Function4a098
- cp $2
+ cp 2
jp z, Function4a0b9
- cp $3
+ cp 3
jp z, Function4a0c2
- cp $4
+ cp 4
jp z, Function4a100
- ld a, $1
+ ld a, 1
call MenuClickSound
-
-.asm_49f84
+.b_button
pop bc
call ClearBGPalettes
call ClearTileMap
@@ -433,7 +432,7 @@
call Function4a6c5
ret
-.asm_49f97
+.next
ld hl, wMenuCursorY
ld a, [hl]
dec a
@@ -442,15 +441,15 @@
ld d, h
ld e, l
hlcoord 1, 13
- ld b, $4
- ld c, $12
+ ld b, 4
+ ld c, SCREEN_HEIGHT
call ClearBox
hlcoord 1, 14
call PlaceString
- jp .asm_49fb7
+ jp .useless_jump
-.asm_49fb7
- call Function4a071
+.useless_jump
+ call MobileMenu_InitMenuBuffers
pop bc
ld hl, wMenuCursorY
ld [hl], b
@@ -458,7 +457,7 @@
ld c, $1
hlcoord 5, 1
call ClearBox
- jp .asm_49f55
+ jp .joy_loop
; 49fcc
@@ -499,36 +498,37 @@
next "@"
; 4a071
-Function4a071: ; 4a071 (12:6071)
- ld hl, wcfa1
- ld a, $2
+MobileMenu_InitMenuBuffers: ; 4a071 (12:6071)
+ ld hl, w2DMenuCursorInitY
+ ld a, 2
ld [hli], a
- ld a, $5
+ ld a, 5 ; w2DMenuCursorInitX
ld [hli], a
- ld a, $5
+ ld a, 5 ; w2DMenuNumRows
ld [hli], a
- ld a, $1
+ ld a, 1 ; w2DMenuNumCols
ld [hli], a
- ld [hl], $0
+ ld [hl], $0 ; w2DMenuFlags1
set 5, [hl]
inc hl
- xor a
+ xor a ; w2DMenuFlags2
ld [hli], a
- ld a, $20
+ ld a, $20 ; w2DMenuFlags3
ld [hli], a
+ ; this is a stupid way to load $c3
ld a, $1
add $40
add $80
add $2
- ld [hli], a
- ld a, $1
+ ld [hli], a ; w2DMenuFlags4
+ ld a, 1
rept 2
- ld [hli], a
+ ld [hli], a ; wMenuCursorY, wMenuCursorX
endr
ret
Function4a098: ; 4a098 (12:6098)
- ld a, $2
+ ld a, 2
call MenuClickSound
call PlaceHollowCursor
call WaitBGMap
@@ -541,19 +541,19 @@
jp Function49f16
Function4a0b9: ; 4a0b9 (12:60b9)
- ld a, $2
+ ld a, 2
call MenuClickSound
pop bc
jp Function4a4c4
Function4a0c2: ; 4a0c2 (12:60c2)
- ld a, $2
+ ld a, 2
call MenuClickSound
ld a, BANK(sPlayerData)
call GetSRAMBank
ld hl, sPlayerData + PlayerName - wPlayerData
ld de, PlayerName
- ld bc, $6
+ ld bc, 6 ; japanese name length
call CopyBytes
call CloseSRAM
callba _LoadData
@@ -565,15 +565,15 @@
call ClearBGPalettes
pop af
and a
- jr nz, .asm_4a0f9
+ jr nz, .skip_save
callba _SaveData
-.asm_4a0f9
+.skip_save
ld c, 5
call DelayFrames
jr asm_4a111
Function4a100: ; 4a100 (12:6100)
- ld a, $2
+ ld a, 2
call MenuClickSound
call ClearBGPalettes
call Function4a13b
@@ -586,7 +586,7 @@
jp Function49f0a
Function4a118: ; 4a118 (12:6118)
- ld hl, wcfa1
+ ld hl, w2DMenuCursorInitY
ld a, $1
ld [hli], a
ld a, $d
@@ -860,7 +860,7 @@
; 0x4a373
Function4a373: ; 4a373 (12:6373)
- ld hl, wcfa1
+ ld hl, w2DMenuCursorInitY
ld a, $4
ld [hli], a
ld a, $2
@@ -991,7 +991,7 @@
Function4a485: ; 4a485 (12:6485)
ld de, GFX_49c0c
ld hl, VTiles2 tile $00
- lb bc, BANK(GFX_49c0c), $d
+ lb bc, BANK(GFX_49c0c), 13
call Get2bpp
ret
@@ -1173,7 +1173,7 @@
; 4a680
Function4a680: ; 4a680 (12:6680)
- ld hl, wcfa1
+ ld hl, w2DMenuCursorInitY
ld a, $2
ld [hli], a
ld a, $3
--- a/engine/mon_menu.asm
+++ b/engine/mon_menu.asm
@@ -86,7 +86,7 @@
ld a, [Buffer1] ; items
ld [wMenuData2Items], a
call InitVerticalMenuCursor
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 6, [hl]
call StaticMenuJoypad
ld de, SFX_READ_TEXT_2
@@ -308,7 +308,7 @@
bit 7, a
jr z, .set_carry
call InitVerticalMenuCursor
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 6, [hl]
call StaticMenuJoypad
ld de, SFX_READ_TEXT_2
--- a/engine/party_menu.asm
+++ b/engine/party_menu.asm
@@ -682,7 +682,7 @@
call InitMenu3
ld a, [PartyCount]
inc a
- ld [wcfa3], a ; list length
+ ld [w2DMenuNumRows], a ; list length
dec a
ld b, a
ld a, [wPartyMenuCursor]
@@ -698,7 +698,7 @@
.done
ld [wMenuCursorY], a
ld a, A_BUTTON | B_BUTTON
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ret
; 5042d
@@ -707,7 +707,7 @@
ld de, PartyMenuAttributes
call InitMenu3
ld a, [PartyCount]
- ld [wcfa3], a ; list length
+ ld [w2DMenuNumRows], a ; list length
ld b, a
ld a, [wPartyMenuCursor]
and a
@@ -720,7 +720,7 @@
.done
ld [wMenuCursorY], a
ld a, A_BUTTON | B_BUTTON
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ret
; 5044f (14:444f)
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -36,7 +36,7 @@
call DelayFrame
call DisableLCD
hlbgcoord 0, 0
- lb bc, 4, 0
+ ld bc, VBGMap1 - VBGMap0
ld a, " "
call ByteFill
ld b, SCGB_05
@@ -97,13 +97,13 @@
ret
Slots_GetPals: ; 9279b (24:679b)
- ld a, $e4
+ ld a, %11100100
call DmgToCgbBGPals
- lb de, $e4, $e4
+ lb de, %11100100, %11100100
ld a, [hCGB]
and a
jr nz, .cgb
- lb de, $c0, $e4
+ lb de, %11000000, %11100100
.cgb
call DmgToCgbObjPals
ret
@@ -139,7 +139,7 @@
ld a, [wFirstTwoReelsMatchingSevens]
and a
jr nz, .matching_sevens
- ld a, $e4
+ ld a, %11100100
call DmgToCgbBGPals
ret
@@ -148,7 +148,7 @@
and $7
ret nz
ld a, [rBGP]
- xor %1100
+ xor %00001100
call DmgToCgbBGPals
ret
@@ -280,9 +280,9 @@
ld [wReel2ReelAction], a
ld [wReel3ReelAction], a
ld a, $4
- ld [wReel1 + 9], a
- ld [wReel2 + 9], a
- ld [wReel3 + 9], a
+ ld [wReel1Slot09], a
+ ld [wReel2Slot09], a
+ ld [wReel3Slot09], a
call WaitSFX
ld a, SFX_SLOT_MACHINE_START
call Slots_PlaySFX
@@ -401,7 +401,7 @@
xor a
ld [wFirstTwoReelsMatching], a
ld [wFirstTwoReelsMatchingSevens], a
- ld a, $e4
+ ld a, %11100100
call DmgToCgbBGPals
call SlotGetPayout
xor a
@@ -524,22 +524,22 @@
Slots_StopReel2: ; 92a2e (24:6a2e)
ld a, [wSlotBet]
cp $2
- jr c, .eight
+ jr c, .dont_jump
ld a, [wSlotBias]
and a
jr z, .skip
cp SLOTS_NOMATCH
- jr nz, .eight
+ jr nz, .dont_jump
.skip
call .CheckReel1ForASeven
- jr nz, .eight
+ jr nz, .dont_jump
call Random
cp $50 ; 32%
- jr nc, .eight
+ jr nc, .dont_jump
ld a, $a
ret
-.eight
+.dont_jump
ld a, $8
ret
@@ -557,20 +557,20 @@
Slots_StopReel3: ; 92a60 (24:6a60)
ld a, [wFirstTwoReelsMatching]
and a
- jr z, .not_matching_sevens
+ jr z, .stop
ld a, [wFirstTwoReelsMatchingSevens]
and a
- jr z, .not_matching_sevens
+ jr z, .stop
ld a, [wSlotBias]
and a
jr nz, .biased
call Random
cp 180
- jr nc, .not_matching_sevens
+ jr nc, .stop
cp 120
- jr nc, .sixteen
+ jr nc, .slow_advance
cp 60
- jr nc, .eighteen
+ jr nc, .golem
ld a, $15
ret
@@ -577,18 +577,18 @@
.biased
call Random
cp 160
- jr nc, .not_matching_sevens
+ jr nc, .stop
cp 80
- jr nc, .sixteen
-.eighteen
+ jr nc, .slow_advance
+.golem
ld a, $12
ret
-.sixteen
+.slow_advance
ld a, $10
ret
-.not_matching_sevens
+.stop
ld a, $9
ret
@@ -817,37 +817,38 @@
.jumptable: ; 92be4
jumptable_start
- jumptable ReelAction_DoNothing ; 00
- jumptable Slots_StopReelIgnoreJoypad ; 01
+ jumptable ReelAction_DoNothing ; 00
+ jumptable Slots_StopReelIgnoreJoypad ; 01
- jumptable ReelAction_QuadrupleRate ; 02
- jumptable ReelAction_DoubleRate ; 03
- jumptable ReelAction_NormalRate ; 04
- jumptable ReelAction_HalfRate ; 05
- jumptable ReelAction_QuarterRate ; 06
+ jumptable ReelAction_QuadrupleRate ; 02
+ jumptable ReelAction_DoubleRate ; 03
+ jumptable ReelAction_NormalRate ; 04
+ jumptable ReelAction_HalfRate ; 05
+ jumptable ReelAction_QuarterRate ; 06
- jumptable ReelAction_StopReel1 ; 07
- jumptable ReelAction_StopReel2 ; 08
- jumptable ReelAction_StopReel3 ; 09
+ jumptable ReelAction_StopReel1 ; 07
+ jumptable ReelAction_StopReel2 ; 08
+ jumptable ReelAction_StopReel3 ; 09
- jumptable Function92cd2 ; 0a
- jumptable Function92cf8 ; 0b
- jumptable Function92d13 ; 0c
- jumptable Function92df7 ; 0d
- jumptable Function92e10 ; 0e
- jumptable Function92e31 ; 0f
+ jumptable ReelAction_SetUpReel2SkipTo7 ; 0a
+ jumptable ReelAction_WaitReel2SkipTo7 ; 0b
+ jumptable ReelAction_FastSpinReel2UntilLinedUp7s ; 0c
- jumptable Function92e47 ; 10
- jumptable Function92e64 ; 11
+ jumptable ReelAction_BoringReelDrops ; 0d
+ jumptable ReelAction_CheckDropReel ; 0e
+ jumptable ReelAction_WaitDropReel ; 0f
- jumptable Function92d20 ; 12
- jumptable Function92d4f ; 13
- jumptable Function92d6e ; 14
+ jumptable ReelAction_StartSlowAdvanceReel3 ; 10
+ jumptable ReelAction_WaitSlowAdvanceReel3 ; 11
- jumptable Slots_InitChansey ; 15
- jumptable Function92da4 ; 16
- jumptable Function92db3 ; 17
- jumptable Function92dca ; 18
+ jumptable ReelAction_InitGolem ; 12
+ jumptable ReelAction_WaitGolem ; 13
+ jumptable ReelAction_EndGolem ; 14
+
+ jumptable Slots_InitChansey ; 15
+ jumptable ReelAction_WaitChansey ; 16
+ jumptable ReelAction_WaitEgg ; 17
+ jumptable ReelAction_DropReel ; 18
; 92c16
ReelAction_DoNothing: ; 92c16
@@ -963,20 +964,20 @@
ld a, [wSlotBuildingMatch]
ld hl, wSlotBias
cp [hl]
- jr z, .biased_match
+ jr z, .NoBias
.nope
ld a, [wSlotBias]
- cp $ff
- jr z, .biased_match
+ cp SLOTS_NOMATCH
+ jr z, .NoBias
ld hl, wReel1Slot09 - wReel1
add hl, bc
ld a, [hl]
and a
- jr z, .biased_match
+ jr z, .NoBias
dec [hl]
ret
-.biased_match
+.NoBias
call Slots_StopReel
ret
@@ -987,7 +988,7 @@
jr nc, .NoMatch
ld hl, wSlotBias
cp [hl]
- jr z, .bias
+ jr z, .NoBias
ld hl, wReel1Slot09 - wReel1
add hl, bc
ld a, [hl]
@@ -999,22 +1000,22 @@
.NoMatch
ld a, [wSlotBias]
cp SLOTS_NOMATCH
- jr z, .bias
+ jr z, .NoBias
ld hl, wReel1Slot09 - wReel1
add hl, bc
ld a, [hl]
and a
- jr z, .bias
+ jr z, .NoBias
dec [hl]
ret
-.bias
+.NoBias
call Slots_StopReel
ret
; 92cd2
-Function92cd2: ; 92cd2
+ReelAction_SetUpReel2SkipTo7: ; 92cd2
call Slots_CheckMatchedFirstTwoReels
jr nc, .no_match
ld a, [wFirstTwoReelsMatchingSevens]
@@ -1039,7 +1040,7 @@
; 92cf8
-Function92cf8: ; 92cf8
+ReelAction_WaitReel2SkipTo7: ; 92cf8
ld hl, wReel1Slot0a - wReel1
add hl, bc
ld a, [hl]
@@ -1061,7 +1062,7 @@
; 92d13
-Function92d13: ; 92d13
+ReelAction_FastSpinReel2UntilLinedUp7s: ; 92d13
call Slots_CheckMatchedFirstTwoReels
ret nc
ld a, [wFirstTwoReelsMatchingSevens]
@@ -1072,7 +1073,7 @@
; 92d20
-Function92d20: ; 92d20
+ReelAction_InitGolem: ; 92d20
call Slots_CheckMatchedAllThreeReels
ret c
ld a, SFX_STOP_SLOT
@@ -1097,21 +1098,20 @@
pop bc
xor a
ld [wcf64], a
-
-Function92d4f: ; 92d4f
+ReelAction_WaitGolem: ; 92d4f
ld a, [wcf64]
- cp $2
- jr z, .asm_92d5b
- cp $1
- jr z, .asm_92d62
+ cp 2
+ jr z, .two
+ cp 1
+ jr z, .one
ret
-.asm_92d5b
+.two
call Slots_CheckMatchedAllThreeReels
call Slots_StopReel
ret
-.asm_92d62
+.one
ld hl, wReel1ReelAction - wReel1
add hl, bc
inc [hl]
@@ -1122,7 +1122,7 @@
; 92d6e
-Function92d6e: ; 92d6e
+ReelAction_EndGolem: ; 92d6e
xor a
ld [wcf64], a
ld hl, wReel1ReelAction - wReel1
@@ -1158,7 +1158,7 @@
; 92da4
-Function92da4: ; 92da4
+ReelAction_WaitChansey: ; 92da4
ld a, [wcf64]
and a
ret z
@@ -1167,8 +1167,7 @@
inc [hl]
ld a, $2
ld [wcf64], a
-
-Function92db3: ; 92db3
+ReelAction_WaitEgg: ; 92db3
ld a, [wcf64]
cp $4
ret c
@@ -1181,27 +1180,26 @@
ld hl, wReel1Slot0a - wReel1
add hl, bc
ld [hl], $11
-
-Function92dca: ; 92dca
+ReelAction_DropReel: ; 92dca
ld hl, wReel1Slot0a - wReel1
add hl, bc
ld a, [hl]
and a
- jr z, .asm_92dd4
+ jr z, .check_match
dec [hl]
ret
-.asm_92dd4
+.check_match
call Slots_CheckMatchedAllThreeReels
- jr nc, .asm_92de5
+ jr nc, .EggAgain
and a
- jr nz, .asm_92de5
+ jr nz, .EggAgain
ld a, $5
ld [wcf64], a
call Slots_StopReel
ret
-.asm_92de5
+.EggAgain
ld hl, wReel1SpinRate - wReel1
add hl, bc
ld [hl], $0
@@ -1216,7 +1214,7 @@
; 92df7
-Function92df7: ; 92df7
+ReelAction_BoringReelDrops: ; 92df7
call Slots_CheckMatchedAllThreeReels
ret c
ld a, SFX_STOP_SLOT
@@ -1229,7 +1227,7 @@
ld hl, wReel1Slot0a - wReel1
add hl, bc
ld [hl], a
-Function92e10: ; 92e10
+ReelAction_CheckDropReel: ; 92e10
ld hl, wReel1Slot0a - wReel1
add hl, bc
ld a, [hl]
@@ -1250,16 +1248,16 @@
ld hl, wReel1SpinRate - wReel1
add hl, bc
ld [hl], $0
-Function92e31: ; 92e31
+ReelAction_WaitDropReel: ; 92e31
ld hl, wReel1Slot0b - wReel1
add hl, bc
ld a, [hl]
and a
- jr z, .asm_92e3b
+ jr z, .DropReel
dec [hl]
ret
-.asm_92e3b
+.DropReel
ld hl, wReel1ReelAction - wReel1
add hl, bc
dec [hl]
@@ -1270,7 +1268,7 @@
; 92e47
-Function92e47: ; 92e47
+ReelAction_StartSlowAdvanceReel3: ; 92e47
call Slots_CheckMatchedAllThreeReels
ret c
ld a, SFX_STOP_SLOT
@@ -1285,34 +1283,33 @@
ld hl, wReel1Slot0a - wReel1
add hl, bc
ld [hl], $10
-
-Function92e64: ; 92e64
+ReelAction_WaitSlowAdvanceReel3: ; 92e64
ld hl, wReel1Slot0a - wReel1
add hl, bc
ld a, [hl]
and a
- jr z, .asm_92e73
+ jr z, .check1
dec [hl]
-.asm_92e6d
+.play_sfx
ld a, SFX_GOT_SAFARI_BALLS
call Slots_PlaySFX
ret
-.asm_92e73
+.check1
ld a, [wSlotBias]
and a
- jr nz, .asm_92e88
+ jr nz, .check2
call Slots_CheckMatchedAllThreeReels
- jr nc, .asm_92e6d
+ jr nc, .play_sfx
and a
- jr nz, .asm_92e6d
+ jr nz, .play_sfx
call Slots_StopReel
call WaitSFX
ret
-.asm_92e88
+.check2
call Slots_CheckMatchedAllThreeReels
- jr c, .asm_92e6d
+ jr c, .play_sfx
call Slots_StopReel
call WaitSFX
ret
@@ -1575,7 +1572,7 @@
ld a, [hl]
push af
push hl
- call Function92fcf
+ call .Check7Bias
pop hl
pop af
ld [hl], a
@@ -1584,7 +1581,7 @@
; 92fcf
-Function92fcf: ; 92fcf
+.Check7Bias: ; 92fcf
ld a, [wSlotBias]
and a
jr nz, .not_biased_to_seven
@@ -1605,7 +1602,7 @@
.not_biased_to_seven
call Random
and $7
- cp $4
+ cp $4 ; ((50 percent) & 7) + 1
jr c, .not_biased_to_seven
ld e, a
.loop2
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -1,6 +1,6 @@
StartMenu:: ; 125cd
- call ResetTextRelatedRAM
+ call ClearWindowData
ld de, SFX_MENU
call PlaySFX
@@ -1478,7 +1478,7 @@
ld de, Unknown_12fb2
call InitMenu3
call SetUpMoveList
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 6, [hl]
jr .asm_12f93
@@ -1506,7 +1506,7 @@
push af
xor a
ld [wSwitchMon], a
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
res 6, [hl]
call ClearSprites
call ClearTileMap
@@ -1546,7 +1546,7 @@
call InitMenu3
.loop
call SetUpMoveList
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 6, [hl]
jr .skip_joy
@@ -1740,7 +1740,7 @@
.exit: ; 13154
xor a
ld [wMoveSwapBuffer], a
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
res 6, [hl]
call ClearSprites
jp ClearTileMap
@@ -1822,7 +1822,7 @@
call SetPalettes
ld a, [wNumMoves]
inc a
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
hlcoord 0, 11
ld b, 5
ld c, 18
--- a/engine/stats_screen.asm
+++ b/engine/stats_screen.asm
@@ -21,7 +21,7 @@
push af
xor a
ld [hMapAnims], a ; disable overworld tile animations
- ld a, [wc2c6] ; whether sprite is to be mirrorred
+ ld a, [wBoxAlignment] ; whether sprite is to be mirrorred
push af
ld a, [wJumptableIndex]
ld b, a
@@ -46,7 +46,7 @@
ld a, c
ld [wcf64], a
pop af
- ld [wc2c6], a
+ ld [wBoxAlignment], a
pop af
ld [hMapAnims], a
ret
@@ -823,7 +823,7 @@
ret
.asm_4e266
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
hlcoord 0, 0
call _PrepMonFrontpic
ret
@@ -833,12 +833,12 @@
cp UNOWN
jr z, .asm_4e281
ld a, $1
- ld [wc2c6], a
+ ld [wBoxAlignment], a
call Function4e289
ret
.asm_4e281
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
call Function4e289
ret
@@ -1048,7 +1048,7 @@
.asm_4e4ab
push de
ld a, $1
- ld [wc2c6], a
+ ld [wBoxAlignment], a
call Function4e307
ld de, VTiles2 tile $00
predef FrontpicPredef
--- a/engine/tmhm2.asm
+++ b/engine/tmhm2.asm
@@ -80,7 +80,7 @@
callba LoadPartyMenuGFX
callba InitPartyMenuWithCancel
callba InitPartyMenuGFX
- ld a, $3
+ ld a, $3 ; TeachWhichPKMNString
ld [PartyMenuActionText], a
.loopback
callba WritePartyMenuTilemap
@@ -197,11 +197,11 @@
ld [hBGMapMode], a
call TMHM_DisplayPocketItems
ld a, $2
- ld [wcfa1], a
+ ld [w2DMenuCursorInitY], a
ld a, $7
- ld [wcfa2], a
+ ld [w2DMenuCursorInitX], a
ld a, $1
- ld [wcfa4], a
+ ld [w2DMenuNumCols], a
ld a, $5
sub d
inc a
@@ -209,15 +209,15 @@
jr nz, .okay
dec a
.okay
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
ld a, $c
- ld [wcfa5], a
+ ld [w2DMenuFlags1], a
xor a
- ld [wcfa6], a
+ ld [w2DMenuFlags2], a
ld a, $20
- ld [wcfa7], a
+ ld [w2DMenuFlags3], a
ld a, $f3
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ld a, [wTMHMPocketCursor]
inc a
ld [wMenuCursorY], a
@@ -234,7 +234,7 @@
ld [wTMHMPocketCursor], a
xor a
ld [hBGMapMode], a
- ld a, [wcfa6]
+ ld a, [w2DMenuFlags2]
bit 7, a
jp nz, TMHM_ScrollPocket
ld a, b
--- a/engine/warp_connection.asm
+++ b/engine/warp_connection.asm
@@ -256,13 +256,13 @@
ld a, $1
ld [rVBK], a
xor a
- lb bc, 4, 0
+ ld bc, VBGMap1 - VBGMap0
hlbgcoord 0, 0
call ByteFill
pop af
ld [rVBK], a
ld a, $60
- lb bc, 4, 0
+ ld bc, VBGMap1 - VBGMap0
hlbgcoord 0, 0
call ByteFill
ret
--- a/event/halloffame.asm
+++ b/event/halloffame.asm
@@ -267,7 +267,7 @@
call SetPalettes
call HOF_SlideBackpic
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
@@ -486,7 +486,7 @@
ld hl, TempMonDVs
predef GetUnownLetter
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
hlcoord 6, 5
call _PrepMonFrontpic
ld a, [CurPartySpecies]
@@ -566,7 +566,7 @@
call SetPalettes
call HOF_SlideBackpic
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
--- a/event/move_deleter.asm
+++ b/event/move_deleter.asm
@@ -1,15 +1,15 @@
MoveDeletion:
- ld hl, UnknownText_0x2c5ef
+ ld hl, .IntroText
call PrintText
call YesNoBox
- jr c, .asm_2c5c3
- ld hl, UnknownText_0x2c5f4
+ jr c, .declined
+ ld hl, .AskWhichMonText
call PrintText
callba SelectMonFromParty
- jr c, .asm_2c5c3
+ jr c, .declined
ld a, [CurPartySpecies]
cp EGG
- jr z, .asm_2c5bc
+ jr z, .egg
ld a, [CurPartyMon]
ld hl, PartyMon1Moves + 1
ld bc, PARTYMON_STRUCT_LENGTH
@@ -16,8 +16,8 @@
call AddNTimes
ld a, [hl]
and a
- jr z, .asm_2c5ca
- ld hl, UnknownText_0x2c5ea
+ jr z, .onlyonemove
+ ld hl, .AskWhichMoveText
call PrintText
call LoadStandardMenuDataHeader
callba ChooseMoveToDelete
@@ -24,90 +24,90 @@
push af
call ReturnToMapWithSpeechTextbox
pop af
- jr c, .asm_2c5c3
+ jr c, .declined
ld a, [wMenuCursorY]
push af
ld a, [CurSpecies]
ld [wd265], a
call GetMoveName
- ld hl, UnknownText_0x2c5d6
+ ld hl, .ConfirmDeleteText
call PrintText
call YesNoBox
pop bc
- jr c, .asm_2c5c3
- call Function2c5f9
+ jr c, .declined
+ call .DeleteMove
call WaitSFX
ld de, SFX_MOVE_DELETED
call PlaySFX
call WaitSFX
- ld hl, UnknownText_0x2c5db
+ ld hl, .MoveDeletedText
call PrintText
ret
-.asm_2c5bc
- ld hl, UnknownText_0x2c5e0
+.egg
+ ld hl, .EggText
call PrintText
ret
-.asm_2c5c3
- ld hl, UnknownText_0x2c5e5
+.declined
+ ld hl, .DeclinedDeletionText
call PrintText
ret
-.asm_2c5ca
- ld hl, UnknownText_0x2c5d1
+.onlyonemove
+ ld hl, .OnlyOneMoveText
call PrintText
ret
-UnknownText_0x2c5d1: ; 0x2c5d1
+.OnlyOneMoveText: ; 0x2c5d1
; That #MON knows only one move.
text_jump UnknownText_0x1c5eba
db "@"
; 0x2c5d6
-UnknownText_0x2c5d6: ; 0x2c5d6
+.ConfirmDeleteText: ; 0x2c5d6
; Oh, make it forget @ ?
text_jump UnknownText_0x1c5eda
db "@"
; 0x2c5db
-UnknownText_0x2c5db: ; 0x2c5db
+.MoveDeletedText: ; 0x2c5db
; Done! Your #MON forgot the move.
text_jump UnknownText_0x1c5ef5
db "@"
; 0x2c5e0
-UnknownText_0x2c5e0: ; 0x2c5e0
+.EggText: ; 0x2c5e0
; An EGG doesn't know any moves!
text_jump UnknownText_0x1c5f17
db "@"
; 0x2c5e5
-UnknownText_0x2c5e5: ; 0x2c5e5
+.DeclinedDeletionText: ; 0x2c5e5
; No? Come visit me again.
text_jump UnknownText_0x1c5f36
db "@"
; 0x2c5ea
-UnknownText_0x2c5ea: ; 0x2c5ea
+.AskWhichMoveText: ; 0x2c5ea
; Which move should it forget, then?
text_jump UnknownText_0x1c5f50
db "@"
; 0x2c5ef
-UnknownText_0x2c5ef: ; 0x2c5ef
+.IntroText: ; 0x2c5ef
; Um… Oh, yes, I'm the MOVE DELETER. I can make #MON forget moves. Shall I make a #MON forget?
text_jump UnknownText_0x1c5f74
db "@"
; 0x2c5f4
-UnknownText_0x2c5f4: ; 0x2c5f4
+.AskWhichMonText: ; 0x2c5f4
; Which #MON?
text_jump UnknownText_0x1c5fd1
db "@"
; 0x2c5f9
-Function2c5f9: ; 2c5f9
+.DeleteMove: ; 2c5f9
ld a, b
push bc
dec a
@@ -121,18 +121,18 @@
pop bc
push bc
inc b
-.asm_2c60f
+.loop
ld a, b
cp NUM_MOVES + 1
- jr z, .asm_2c61b
+ jr z, .okay
inc hl
ld a, [hld]
ld [hl], a
inc hl
inc b
- jr .asm_2c60f
+ jr .loop
-.asm_2c61b
+.okay
xor a
ld [hl], a
pop bc
@@ -149,18 +149,18 @@
call AddNTimes
pop bc
inc b
-.asm_2c633
+.loop2
ld a, b
cp NUM_MOVES + 1
- jr z, .asm_2c63f
+ jr z, .done
inc hl
ld a, [hld]
ld [hl], a
inc hl
inc b
- jr .asm_2c633
+ jr .loop2
-.asm_2c63f
+.done
xor a
ld [hl], a
ret
--- a/event/photo.asm
+++ b/event/photo.asm
@@ -50,7 +50,7 @@
xor a
ld [wJumptableIndex], a
- call Function16cc8
+ call .UpdateUnownFrontpic
call WaitBGMap
ld a, UNOWN
@@ -74,7 +74,7 @@
and A_BUTTON
jr nz, .pressed_a
- call Function16ca0
+ call .LeftRight
call DelayFrame
jr .joy_loop
@@ -96,7 +96,7 @@
ret
; 16ca0
-Function16ca0: ; 16ca0
+.LeftRight: ; 16ca0
ld a, [hJoyLast]
and D_RIGHT
jr nz, .press_right
@@ -110,8 +110,7 @@
ld a, [hl]
and a
jr nz, .wrap_around_left
- ld [hl], $1b
-
+ ld [hl], 26 + 1
.wrap_around_left
dec [hl]
jr .return
@@ -119,19 +118,18 @@
.press_right
ld hl, wJumptableIndex
ld a, [hl]
- cp $1a
+ cp 26
jr c, .wrap_around_right
- ld [hl], $ff
-
+ ld [hl], -1
.wrap_around_right
inc [hl]
.return
- call Function16cc8
+ call .UpdateUnownFrontpic
ret
; 16cc8
-Function16cc8: ; 16cc8
+.UpdateUnownFrontpic: ; 16cc8
ld a, [wJumptableIndex]
cp 26
jr z, Function16d20
@@ -140,7 +138,7 @@
ld a, UNOWN
ld [CurPartySpecies], a
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
ld de, VTiles2
predef GetFrontpic
call Function16cff
@@ -162,7 +160,7 @@
ld a, BANK(sScratch)
call GetSRAMBank
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld hl, sScratch
ld a, [hROMBank]
ld b, a
--- a/gfx/pics/animation.asm
+++ b/gfx/pics/animation.asm
@@ -663,7 +663,7 @@
ld a, [w2_d186]
ld bc, SCREEN_WIDTH
call AddNTimes
- ld a, [wc2c6]
+ ld a, [wBoxAlignment]
and a
jr nz, .go
ld a, [w2_d185]
@@ -786,7 +786,7 @@
ld bc, 45
.okay
- ld a, [wc2c6]
+ ld a, [wBoxAlignment]
and a
jr nz, .add_bc
add hl, de
@@ -824,7 +824,7 @@
Functiond04bd: ; d04bd
call Functiond04f6
- ld a, [wc2c6]
+ ld a, [wBoxAlignment]
and a
jr nz, .minus_one_and_six
ld de, 1
@@ -1117,7 +1117,7 @@
Functiond0669: ; d0669
ld a, $1
- ld [wc2c6], a
+ ld [wBoxAlignment], a
Functiond066e: ; d066e
call AnimateMon_CheckIfPokemon
@@ -1134,12 +1134,12 @@
ld e, c
call AnimateFrontpic
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
ret
.asm_d068c
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
inc a
ld [CurPartySpecies], a
ret
--- a/home.asm
+++ b/home.asm
@@ -1714,7 +1714,7 @@
PrepMonFrontpic:: ; 3786
ld a, $1
- ld [wc2c6], a
+ ld [wBoxAlignment], a
_PrepMonFrontpic:: ; 378b
ld a, [CurPartySpecies]
@@ -1730,12 +1730,12 @@
lb bc, 7, 7
predef FillBox
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
ret
.not_pokemon
xor a
- ld [wc2c6], a
+ ld [wBoxAlignment], a
inc a
ld [CurPartySpecies], a
ret
@@ -2192,7 +2192,7 @@
; 3f88
Function3f88:: ; 3f88
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
ld b, $0
.asm_3f8d
push bc
@@ -2213,7 +2213,7 @@
; 3f9f
Function3f9f:: ; 3f9f
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
.asm_3fa2
push bc
ld c, $8
--- a/home/map.asm
+++ b/home/map.asm
@@ -1405,10 +1405,10 @@
ld [rSVBK], a
ld a, e
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
call FarDecompress
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
ld de, VTiles2
ld bc, $60 tiles
call CopyBytes
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -489,7 +489,7 @@
ret
; 1fbf
-ResetTextRelatedRAM:: ; 1fbf
+ClearWindowData:: ; 1fbf
ld hl, wWindowStackPointer
call .bytefill
ld hl, wMenuDataHeader
@@ -496,7 +496,7 @@
call .bytefill
ld hl, wMenuData2Flags
call .bytefill
- ld hl, wcfa1
+ ld hl, w2DMenuCursorInitY
call .bytefill
ld a, [rSVBK]
--- a/home/window.asm
+++ b/home/window.asm
@@ -1,6 +1,6 @@
ResetWindow:: ; 2dba
- call ResetTextRelatedRAM
+ call ClearWindowData
ld a, [hROMBank]
push af
ld a, BANK(Function6454) ; and BANK(Function64bf)
@@ -32,7 +32,7 @@
; 2de2
.CloseText ; 2de2
- call ResetTextRelatedRAM
+ call ClearWindowData
xor a
ld [hBGMapMode], a
call OverworldTextModeSwitch
@@ -49,7 +49,7 @@
; 2e08
OpenText:: ; 2e08
- call ResetTextRelatedRAM
+ call ClearWindowData
ld a, [hROMBank]
push af
ld a, BANK(Function6454) ; and BANK(Function64bf)
--- a/main.asm
+++ b/main.asm
@@ -146,12 +146,12 @@
ld [rSVBK], a
ld a, $60
- ld hl, wBackupTilemap
- lb bc, 4, 0
+ ld hl, wDecompressScratch
+ ld bc, wBackupAttrMap - wDecompressScratch
call ByteFill
- ld a, wBackupTilemap / $100
+ ld a, wDecompressScratch / $100
ld [rHDMA1], a
- ld a, wBackupTilemap % $100
+ ld a, wDecompressScratch % $100
ld [rHDMA2], a
ld a, (VBGMap0 % $8000) / $100
ld [rHDMA3], a
@@ -9173,7 +9173,7 @@
callab ResetEnemyStatLevels
- call ResetTextRelatedRAM
+ call ClearWindowData
ld hl, hBGMapAddress
xor a
@@ -9183,13 +9183,13 @@
; 2ef6e
FillBox: ; 2ef6e
-; Fill wc2c6-aligned box width b height c
+; Fill wBoxAlignment-aligned box width b height c
; with iterating tile starting from hFillBox at hl.
; Predef $13
ld de, SCREEN_WIDTH
- ld a, [wc2c6]
+ ld a, [wBoxAlignment]
and a
jr nz, .right
@@ -11616,12 +11616,12 @@
push af
ld a, $6
ld [rSVBK], a
- ld hl, wBackupTilemap
- ld bc, wBackupAttrMap - wBackupTilemap
+ ld hl, wDecompressScratch
+ ld bc, wBackupAttrMap - wDecompressScratch
ld a, " "
call ByteFill
hlbgcoord 0, 0
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld b, $0
ld c, $40
call Request2bpp
@@ -13028,15 +13028,15 @@
ld a, $6
ld [rSVBK], a
ld a, b
- ld de, wBackupTilemap + $800
+ ld de, wDecompressScratch + $800
call FarDecompress
pop bc
- ld hl, wBackupTilemap
- ld de, wBackupTilemap + $800
+ ld hl, wDecompressScratch
+ ld de, wDecompressScratch + $800
call Function512ab
pop hl
push hl
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld c, 7 * 7
ld a, [hROMBank]
ld b, a
@@ -13079,7 +13079,7 @@
ld a, $1
ld [rVBK], a
push hl
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld c, 7 * 7
ld a, [hROMBank]
ld b, a
@@ -13110,7 +13110,7 @@
call Function5114f
pop bc
pop hl
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld a, [hROMBank]
ld b, a
call Get2bpp
@@ -13120,7 +13120,7 @@
; 5114f
Function5114f: ; 5114f
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
swap c
ld a, c
and $f
@@ -13129,12 +13129,12 @@
and $f0
ld c, a
push bc
- call Function512f2
+ call LoadFrontpic
pop bc
.asm_51161
push bc
ld c, $0
- call Function512f2
+ call LoadFrontpic
pop bc
dec b
jr nz, .asm_51161
@@ -13179,14 +13179,14 @@
inc hl
ld a, d
call GetFarHalfword
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
pop af
call FarDecompress
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
ld c, 6 * 6
- call Function5127c
+ call FixBackpicAlignment
pop hl
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld a, [hROMBank]
ld b, a
call Get2bpp
@@ -13283,10 +13283,10 @@
ld a, BANK(TrainerPicPointers)
call GetFarHalfword
pop af
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
call FarDecompress
pop hl
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld c, 7 * 7
ld a, [hROMBank]
ld b, a
@@ -13310,10 +13310,10 @@
push de
push bc
ld a, b
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
call FarDecompress
pop bc
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
pop hl
ld a, [hROMBank]
ld b, a
@@ -13324,12 +13324,12 @@
ret
; 5127c
-Function5127c: ; 5127c
+FixBackpicAlignment: ; 5127c
push de
push bc
- ld a, [wc2c6]
+ ld a, [wBoxAlignment]
and a
- jr z, .asm_512a8
+ jr z, .keep_dims
ld a, c
cp 7 * 7
ld de, 7 * 7 tiles
@@ -13355,7 +13355,7 @@
or d
jr nz, .got_dims
-.asm_512a8
+.keep_dims
pop bc
pop de
ret
@@ -13368,11 +13368,11 @@
cp 5
jr z, .five
-.seven
+.seven_loop
ld c, $70
- call Function512f2
+ call LoadFrontpic
dec b
- jr nz, .seven
+ jr nz, .seven_loop
ret
.six
@@ -13379,14 +13379,14 @@
ld c, $70
xor a
call .Fill
-.asm_512c3
+.six_loop
ld c, $10
xor a
call .Fill
ld c, $60
- call Function512f2
+ call LoadFrontpic
dec b
- jr nz, .asm_512c3
+ jr nz, .six_loop
ret
.five
@@ -13393,14 +13393,14 @@
ld c, $70
xor a
call .Fill
-.asm_512d8
+.five_loop
ld c, $20
xor a
call .Fill
ld c, $50
- call Function512f2
+ call LoadFrontpic
dec b
- jr nz, .asm_512d8
+ jr nz, .five_loop
ld c, $70
xor a
call .Fill
@@ -13413,21 +13413,21 @@
ret
; 512f2
-Function512f2: ; 512f2
- ld a, [wc2c6]
+LoadFrontpic: ; 512f2
+ ld a, [wBoxAlignment]
and a
- jr nz, .asm_512ff
-.asm_512f8
+ jr nz, .x_flip
+.left_loop
ld a, [de]
inc de
ld [hli], a
dec c
- jr nz, .asm_512f8
+ jr nz, .left_loop
ret
-.asm_512ff
+.x_flip
push bc
-.asm_51300
+.right_loop
ld a, [de]
inc de
ld b, a
@@ -13438,7 +13438,7 @@
endr
ld [hli], a
dec c
- jr nz, .asm_51300
+ jr nz, .right_loop
pop bc
ret
; 51322
@@ -13453,7 +13453,7 @@
ld [wd265], a
ld hl, sBoxMonNicknames
ld bc, PKMN_NAME_LENGTH
- ld de, wd002
+ ld de, wBufferMonNick
call Function513e0
ld a, [sBoxCount]
dec a
@@ -13460,7 +13460,7 @@
ld [wd265], a
ld hl, sBoxMonOT
ld bc, NAME_LENGTH
- ld de, wd00d
+ ld de, wBufferMonOT
call Function513e0
ld a, [sBoxCount]
dec a
@@ -13491,7 +13491,7 @@
ld [wd265], a
ld hl, PartyMonNicknames
ld bc, PKMN_NAME_LENGTH
- ld de, wd002
+ ld de, wBufferMonNick
call Function513e0
ld a, [PartyCount]
dec a
@@ -13498,7 +13498,7 @@
ld [wd265], a
ld hl, PartyMonOT
ld bc, NAME_LENGTH
- ld de, wd00d
+ ld de, wBufferMonOT
call Function513e0
ld a, [PartyCount]
dec a
@@ -15208,7 +15208,7 @@
.Decompress: ; e0057
ld hl, wd012
- ld e, $80
+ ld e, %10000000
ld d, 8
.loop_decompress
push hl
--- a/misc/gfx_41.asm
+++ b/misc/gfx_41.asm
@@ -8,11 +8,11 @@
ld hl, wBackupAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call CutAndPasteTilemap
ld a, $0
ld [rVBK], a
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call Function10419d
ld a, $1
ld [rVBK], a
@@ -28,11 +28,11 @@
Function104033: ; 104033
decoord 0, 0
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call CutAndPasteTilemap
ld a, $0
ld [rVBK], a
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call Function10419d
ret
; 104047
@@ -63,7 +63,7 @@
ld hl, wBackupAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call CutAndPasteTilemap
call DelayFrame
di
@@ -75,7 +75,7 @@
call Function1041ad
ld a, $0
ld [rVBK], a
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call Function1041ad
pop af
ld [rVBK], a
@@ -93,7 +93,7 @@
ld hl, wBackupAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call CutAndPasteTilemap
call DelayFrame
di
@@ -105,7 +105,7 @@
call Function1041c1
ld a, $0
ld [rVBK], a
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call Function1041c1
pop af
ld [rVBK], a
@@ -164,7 +164,7 @@
ld hl, wBackupAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call CutAndPasteTilemap
call DelayFrame
@@ -177,7 +177,7 @@
call Function1041b7
ld a, $0
ld [rVBK], a
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call Function1041b7
pop af
ld [rVBK], a
@@ -196,7 +196,7 @@
call CutAndPasteAttrMap
ld c, $ff
decoord 0, 0
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call CutAndPasteMap
ld a, $1
ld [rVBK], a
@@ -204,7 +204,7 @@
call Function1041ad
ld a, $0
ld [rVBK], a
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call Function1041ad
ret
; 104177
@@ -450,7 +450,7 @@
push bc
push hl
- ; Copy c tiles of the 2bpp from b:de to wBackupTilemap
+ ; Copy c tiles of the 2bpp from b:de to wDecompressScratch
ld a, b ; bank
ld l, c ; number of tiles
ld h, $0
@@ -461,7 +461,7 @@
ld c, l
ld h, d ; address
ld l, e
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
call FarCopyBytes
pop hl
@@ -473,7 +473,7 @@
ld d, h
ld e, l
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call Function104209
; restore the previous bank
@@ -528,7 +528,7 @@
ld b, h
ld h, d
ld l, e
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
call FarCopyBytesDouble_DoubleBankSwitch
pop hl
@@ -540,7 +540,7 @@
ld d, h
ld e, l
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
call Function104209
pop af
@@ -554,22 +554,22 @@
; 104309
Function104309:
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
decoord 0, 0
call Function10433a
- ld hl, wBackupTilemap + $80
+ ld hl, wDecompressScratch + $80
decoord 0, 0, AttrMap
call Function10433a
ld a, $1
ld [rVBK], a
ld c, $8
- ld hl, wBackupTilemap + $80
+ ld hl, wDecompressScratch + $80
debgcoord 0, 0, VBGMap1
call Function104209
ld a, $0
ld [rVBK], a
ld c, $8
- ld hl, wBackupTilemap
+ ld hl, wDecompressScratch
debgcoord 0, 0, VBGMap1
call Function104209
ret
--- a/misc/mobile_12.asm
+++ b/misc/mobile_12.asm
@@ -687,7 +687,7 @@
ret
Function486bf: ; 486bf (12:46bf)
- ld hl, wcfa1
+ ld hl, w2DMenuCursorInitY
ld a, [wd002]
bit 6, a
jr nz, .asm_486ce
@@ -772,7 +772,7 @@
ret
Function4873c: ; 4873c (12:473c)
- ld hl, wcfa1
+ ld hl, w2DMenuCursorInitY
ld a, $4
ld [hli], a
ld a, $c
@@ -1217,9 +1217,9 @@
call LoadMenuDataHeader
call Function4873c
ld a, $a
- ld [wcfa1], a
+ ld [w2DMenuCursorInitY], a
ld a, $b
- ld [wcfa2], a
+ ld [w2DMenuCursorInitX], a
ld a, $1
ld [wMenuCursorY], a
hlcoord 10, 8
@@ -1605,7 +1605,8 @@
; 48c8e
Function48c8e: ; 48c8e
- ld hl, wd02a
+; unreferenced
+ ld hl, $d02a
ld d, h
ld e, l
callba Function48c63
--- a/misc/mobile_12_2.asm
+++ b/misc/mobile_12_2.asm
@@ -488,11 +488,11 @@
Function4ab1a: ; 4ab1a
.asm_4ab1a
ld a, $fb
- ld [wcfa8], a
+ ld [w2DMenuFlags4], a
ld a, $26
- ld [wcfa7], a
+ ld [w2DMenuFlags3], a
ld a, $2
- ld [wcfa4], a
+ ld [w2DMenuNumCols], a
call Function4adf7
call StaticMenuJoypad
call Function4abc3
@@ -748,7 +748,7 @@
ld a, $1
ld [wMenuCursorBuffer], a
call InitVerticalMenuCursor
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 6, [hl]
call StaticMenuJoypad
ld de, SFX_READ_TEXT_2
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -2200,7 +2200,7 @@
call Function8923c
call PlaceVerticalMenuItems
call InitVerticalMenuCursor
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 7, [hl]
ret
@@ -2242,7 +2242,7 @@
callba MobileMenuJoypad
call Function8923c
ld a, c
- ld hl, wcfa8
+ ld hl, w2DMenuFlags4
and [hl]
ret z
bit 0, a
@@ -2253,7 +2253,7 @@
ret
.asm_89dc7
call PlayClickSFX
- ld a, [wcfa3]
+ ld a, [w2DMenuNumRows]
ld c, a
ld a, [wMenuCursorY]
cp c
@@ -2384,8 +2384,8 @@
ld a, $5
ld [rSVBK], a
ld hl, Palette_89eb1
- ld de, wd028
- ld bc, $8
+ ld de, UnknBGPals + 5 palettes
+ ld bc, 1 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -3056,7 +3056,7 @@
ld [MenuSelection], a
call PlaceVerticalMenuItems
call InitVerticalMenuCursor
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 7, [hl]
.asm_8a34e
call Function8a3a2
@@ -3088,7 +3088,7 @@
Function8a383: ; 8a383 (22:6383)
callba MobileMenuJoypad
ld a, c
- ld hl, wcfa8
+ ld hl, w2DMenuFlags4
and [hl]
ret z
bit 0, a
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -820,7 +820,7 @@
call Function3f7c
call PlaceVerticalMenuItems
call InitVerticalMenuCursor
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 7, [hl]
ret
; 100522
@@ -860,7 +860,7 @@
Function10054d: ; 10054d
callba MobileMenuJoypad
ld a, c
- ld hl, wcfa8
+ ld hl, w2DMenuFlags4
and [hl]
ret z
call MenuClickSound
@@ -1829,7 +1829,7 @@
call Function100e2d
pop bc
jr c, .asm_100b6b
- ld a, [wcfa8]
+ ld a, [w2DMenuFlags4]
and c
jr z, .asm_100b48
callba Mobile_GetMenuSelection
@@ -1836,9 +1836,9 @@
ret
.asm_100b6b
- ld a, [wcfa4]
+ ld a, [w2DMenuNumCols]
ld c, a
- ld a, [wcfa3]
+ ld a, [w2DMenuNumRows]
call SimpleMultiply
ld [wMenuCursorBuffer], a
and a
@@ -1854,7 +1854,7 @@
call UpdateSprites
call ApplyTilemap
callba Init2DMenuCursorPosition
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 7, [hl]
ret
; 100b9f
@@ -1890,7 +1890,7 @@
call Function100e2d
pop bc
jr c, .asm_100c25
- ld a, [wcfa8]
+ ld a, [w2DMenuFlags4]
and c
bit 6, a
jp nz, .asm_100bff
@@ -1996,7 +1996,7 @@
call InitMenu3
ld a, [wNumMoves]
inc a
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
ld a, [CurMoveNum]
inc a
ld [wMenuCursorY], a
@@ -2009,7 +2009,7 @@
Function100cb5: ; 100cb5
call Function100dd8
ret c
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 7, [hl]
res 6, [hl]
.asm_100cc0
@@ -2021,7 +2021,7 @@
call Function100dfd
pop bc
jr c, .asm_100d17
- ld a, [wcfa8]
+ ld a, [w2DMenuFlags4]
and c
jr z, .asm_100cc0
call PlaceHollowCursor
@@ -2063,7 +2063,7 @@
call Function100dd8
ret c
call Function100d67
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 7, [hl]
res 6, [hl]
.asm_100d30
@@ -2075,7 +2075,7 @@
call Function100dfd
pop bc
jr c, .asm_100d54
- ld a, [wcfa8]
+ ld a, [w2DMenuFlags4]
and c
jr nz, .asm_100d56
jr .asm_100d30
@@ -2111,7 +2111,7 @@
call WaitBGMap
call CopyMenuData2
call InitVerticalMenuCursor
- ld hl, wcfa5
+ ld hl, w2DMenuFlags1
set 6, [hl]
ret
; 100d88
@@ -5722,7 +5722,7 @@
callba Function1009f3
ret c
callba MobileMenuJoypad
- ld a, [wcfa8]
+ ld a, [w2DMenuFlags4]
and c
ret z
bit 0, c
@@ -5784,7 +5784,7 @@
callba Function1009f3
ret c
callba MobileMenuJoypad
- ld a, [wcfa8]
+ ld a, [w2DMenuFlags4]
and c
ret z
bit 0, c
@@ -6494,7 +6494,7 @@
pop af
ld [wMenuCursorY], a
ld a, [OTPartyCount]
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
ret
; 102b68
@@ -6519,7 +6519,7 @@
pop af
ld [wMenuCursorY], a
ld a, [PartyCount]
- ld [wcfa3], a
+ ld [w2DMenuNumRows], a
ret
; 102b94
--- a/misc/mobile_41.asm
+++ b/misc/mobile_41.asm
@@ -1054,7 +1054,7 @@
jr asm_1064ed
asm_1064ed
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld b, $0
ld a, [rSVBK]
push af
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -5662,7 +5662,7 @@
ld [rSVBK], a
ld hl, Unknown_117356
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
ld bc, $0300
call CopyBytes
--- a/misc/mobile_5b.asm
+++ b/misc/mobile_5b.asm
@@ -1084,7 +1084,7 @@
; 16d725
Function16d725: ; 16d725
- ld hl, wcfa6
+ ld hl, w2DMenuFlags2
res 7, [hl]
ld a, [hBGMapMode]
push af
@@ -1102,12 +1102,12 @@
jr nc, .asm_16d758
callba _2DMenuInterpretJoypad
jr c, .asm_16d758
- ld a, [wcfa5]
+ ld a, [w2DMenuFlags1]
bit 7, a
jr nz, .asm_16d758
call Function16d713
ld b, a
- ld a, [wcfa8]
+ ld a, [w2DMenuFlags4]
and b
jr z, .asm_16d734
@@ -1133,7 +1133,7 @@
call RTC
call Function16d7e7
ret c
- ld a, [wcfa5]
+ ld a, [w2DMenuFlags1]
bit 7, a
jr z, .asm_16d76a
and a
@@ -1159,12 +1159,12 @@
pop hl
.asm_16d792
- ld a, [wcfa1]
+ ld a, [w2DMenuCursorInitY]
ld b, a
- ld a, [wcfa2]
+ ld a, [w2DMenuCursorInitX]
ld c, a
call Coord2Tile
- ld a, [wcfa7]
+ ld a, [w2DMenuFlags3]
swap a
and $f
ld c, a
@@ -1181,7 +1181,7 @@
.asm_16d7b1
ld c, $14
call AddNTimes
- ld a, [wcfa7]
+ ld a, [w2DMenuFlags3]
and $f
ld c, a
ld a, [wMenuCursorX]
@@ -1219,7 +1219,7 @@
; 16d7e7
Function16d7e7: ; 16d7e7
- ld a, [wcfa5]
+ ld a, [w2DMenuFlags1]
bit 6, a
jr z, .asm_16d7f4
callba PlaySpriteAnimationsAndDelayFrame
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -270,7 +270,7 @@
ld a, $6
ld [rSVBK], a
ld hl, LZ_170d16
- ld de, wBackupTilemap
+ ld de, wDecompressScratch
call Decompress
ld a, $1
ld [rVBK], a
--- a/misc/printer_77.asm
+++ b/misc/printer_77.asm
@@ -214,7 +214,7 @@
call Function1dc52c
ld hl, TempMonDVs
predef GetUnownLetter
- ld hl, wc2c6
+ ld hl, wBoxAlignment
xor a
ld [hl], a
ld a, [CurPartySpecies]
--- a/wram.asm
+++ b/wram.asm
@@ -320,7 +320,7 @@
ds 1
-wc2c6:: ds 1
+wBoxAlignment:: ds 1
InputType:: ; c2c7
ds 1
AutoInputAddress:: ; c2c8
@@ -1548,24 +1548,18 @@
wMenuData2_ScrollingMenuFunction3::
wcf9e:: ds 3
wMenuData2End::
+
wMenuData3::
-w2DMenuCursorInitY::
-wcfa1:: ds 1
-w2DMenuCursorInitX::
-wcfa2:: ds 1
-w2DMenuNumRows::
-wcfa3:: ds 1
-w2DMenuNumCols::
-wcfa4:: ds 1
-w2DMenuFlags1::
-wcfa5:: ds 1
-w2DMenuFlags2::
-wcfa6:: ds 1
-w2DMenuFlags3::
-wcfa7:: ds 1
-w2DMenuFlags4::
-wcfa8:: ds 1
+w2DMenuCursorInitY:: ds 1
+w2DMenuCursorInitX:: ds 1
+w2DMenuNumRows:: ds 1
+w2DMenuNumCols:: ds 1
+w2DMenuFlags1:: ds 1
+w2DMenuFlags2:: ds 1
+w2DMenuFlags3:: ds 1
+w2DMenuFlags4:: ds 1
wMenuData3End::
+
wMenuCursorY:: ds 1
wMenuCursorX:: ds 1
wCursorOffCharacter:: ds 1
@@ -1783,10 +1777,7 @@
wMartItem10BCD:: ds 2
wd01f:: ds 1
wMartItemBCDEnd::
-wd020:: ds 3
-wd023:: ds 5
-wd028:: ds 2
-wd02a:: ds 3
+ ds 13
wd02d:: ds 1
wd02e:: ds 1
wd02f:: ds 1
@@ -3270,10 +3261,8 @@
SECTION "WRAM 6", WRAMX, BANK [6]
-wBackupTilemap:: ds $20 * SCREEN_HEIGHT
- ds $1c0
-wBackupAttrMap:: ds $20 * SCREEN_HEIGHT
- ds -$40
+wDecompressScratch:: ds $400
+wBackupAttrMap:: ds $200
w6_d600:: ds $200
w6_d800::