ref: e95d42e0af1921f516c1fd4269024aa3f586514f
parent: bb58230ca7a3f0f3c58af2b182051cf33ba609ac
author: pikalaxalt <[email protected]>
date: Sun May 8 10:11:24 EDT 2016
All functions in main.asm have non-generic names
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -183,7 +183,7 @@
call IsMobileBattle
jr nz, .not_disconnected
callba Function100da5
- callba Function100641
+ callba StartMobileInactivityTimer
callba Function100dd8
jp c, .quit
.not_disconnected
@@ -2503,8 +2503,8 @@
call BattleWinSlideInEnemyTrainerFrontpic
ld c, 40
call DelayFrames
- ld c, $4
- callba Function4ea0a
+ ld c, $4 ; win
+ callba Mobile_PrintOpponentBattleMessage
ret
.battle_tower
@@ -3176,8 +3176,8 @@
ld c, 40
call DelayFrames
- ld c, $3
- callba Function4ea0a
+ ld c, $3 ; lost
+ callba Mobile_PrintOpponentBattleMessage
scf
ret
; 3d432
@@ -9621,8 +9621,8 @@
call IsMobileBattle2
ret nz
- ld c, $2
- callba Function4ea0a
+ ld c, $2 ; start
+ callba Mobile_PrintOpponentBattleMessage
ret
; 3fd26
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -518,39 +518,39 @@
; object struct
const_def
- const OBJECT_SPRITE
- const OBJECT_MAP_OBJECT_INDEX
- const OBJECT_SPRITE_TILE
- const OBJECT_MOVEMENTTYPE
- const OBJECT_FLAGS1
- const OBJECT_FLAGS2
- const OBJECT_PALETTE
- const OBJECT_DIRECTION_WALKING
- const OBJECT_FACING
- const OBJECT_STEP_TYPE
- const OBJECT_STEP_DURATION
- const OBJECT_ACTION
- const OBJECT_STEP_FRAME
- const OBJECT_FACING_STEP
- const OBJECT_NEXT_TILE
- const OBJECT_STANDING_TILE
- const OBJECT_NEXT_MAP_X
- const OBJECT_NEXT_MAP_Y
- const OBJECT_MAP_X
- const OBJECT_MAP_Y
- const OBJECT_INIT_X
- const OBJECT_INIT_Y
- const OBJECT_RADIUS
- const OBJECT_SPRITE_X
- const OBJECT_SPRITE_Y
- const OBJECT_SPRITE_X_OFFSET
- const OBJECT_SPRITE_Y_OFFSET
- const OBJECT_MOVEMENT_BYTE_INDEX
- const OBJECT_28
- const OBJECT_29
- const OBJECT_30
- const OBJECT_31
- const OBJECT_RANGE
+ const OBJECT_SPRITE ; 00
+ const OBJECT_MAP_OBJECT_INDEX ; 01
+ const OBJECT_SPRITE_TILE ; 02
+ const OBJECT_MOVEMENTTYPE ; 03
+ const OBJECT_FLAGS1 ; 04
+ const OBJECT_FLAGS2 ; 05
+ const OBJECT_PALETTE ; 06
+ const OBJECT_DIRECTION_WALKING ; 07
+ const OBJECT_FACING ; 08
+ const OBJECT_STEP_TYPE ; 09
+ const OBJECT_STEP_DURATION ; 0a
+ const OBJECT_ACTION ; 0b
+ const OBJECT_STEP_FRAME ; 0c
+ const OBJECT_FACING_STEP ; 0d
+ const OBJECT_NEXT_TILE ; 0e
+ const OBJECT_STANDING_TILE ; 0f
+ const OBJECT_NEXT_MAP_X ; 10
+ const OBJECT_NEXT_MAP_Y ; 11
+ const OBJECT_MAP_X ; 12
+ const OBJECT_MAP_Y ; 13
+ const OBJECT_INIT_X ; 14
+ const OBJECT_INIT_Y ; 15
+ const OBJECT_RADIUS ; 16
+ const OBJECT_SPRITE_X ; 17
+ const OBJECT_SPRITE_Y ; 18
+ const OBJECT_SPRITE_X_OFFSET ; 19
+ const OBJECT_SPRITE_Y_OFFSET ; 1a
+ const OBJECT_MOVEMENT_BYTE_INDEX ; 1b
+ const OBJECT_28 ; 1c
+ const OBJECT_29 ; 1d
+ const OBJECT_30 ; 1e
+ const OBJECT_31 ; 1f
+ const OBJECT_RANGE ; 20
; 33-39 are not used
; map object struct
--- a/data/map_objects.asm
+++ b/data/map_objects.asm
@@ -25,20 +25,20 @@
sprite_movement_data SPRITEMOVEFN_0E, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 12
sprite_movement_data SPRITEMOVEFN_FOLLOW, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 13
sprite_movement_data SPRITEMOVEFN_SCRIPTED, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 14
- sprite_movement_data SPRITEMOVEFN_BIG_SNORLAX, DOWN, PERSON_ACTION_09, $2e, $01, %1100 ; 15
- sprite_movement_data SPRITEMOVEFN_BOUNCE, DOWN, PERSON_ACTION_0A, $2e, $00, %0000 ; 16
+ sprite_movement_data SPRITEMOVEFN_BIG_SNORLAX, DOWN, PERSON_ACTION_09, $2e, $01, %1100 ; 15
+ sprite_movement_data SPRITEMOVEFN_BOUNCE, DOWN, PERSON_ACTION_0A, $2e, $00, %0000 ; 16
sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $0c, $00, %0000 ; 17
sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $2e, $10, %0000 ; 18
sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_STAND, $2e, $00, %0100 ; 19
sprite_movement_data SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 1a
- sprite_movement_data SPRITEMOVEFN_SHADOW, DOWN, PERSON_ACTION_00, $8e, $01, %0000 ; 1b
+ sprite_movement_data SPRITEMOVEFN_SHADOW, DOWN, PERSON_ACTION_00, $8e, $01, %0000 ; 1b
sprite_movement_data SPRITEMOVEFN_EMOTE, DOWN, PERSON_ACTION_EMOTE, $8e, $02, %0000 ; 1c
- sprite_movement_data SPRITEMOVEFN_SCREENSHAKE, DOWN, PERSON_ACTION_00, $82, $00, %0000 ; 1d
+ sprite_movement_data SPRITEMOVEFN_SCREENSHAKE, DOWN, PERSON_ACTION_00, $82, $00, %0000 ; 1d
sprite_movement_data SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, PERSON_ACTION_STAND, $00, $00, %0000 ; 1e
sprite_movement_data SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, PERSON_ACTION_STAND, $00, $00, %0000 ; 1f
- sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0C, $2e, $01, %1100 ; 20
- sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0D, $2e, $01, %1100 ; 21
- sprite_movement_data SPRITEMOVEFN_BOULDERDUST, DOWN, PERSON_ACTION_0E, $8e, $01, %0000 ; 22
- sprite_movement_data SPRITEMOVEFN_GRASS, DOWN, PERSON_ACTION_0F, $8e, $02, %0000 ; 23
+ sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0C, $2e, $01, %1100 ; 20
+ sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0D, $2e, $01, %1100 ; 21
+ sprite_movement_data SPRITEMOVEFN_BOULDERDUST, DOWN, PERSON_ACTION_0E, $8e, $01, %0000 ; 22
+ sprite_movement_data SPRITEMOVEFN_GRASS, DOWN, PERSON_ACTION_0F, $8e, $02, %0000 ; 23
sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_STAND, $00, $00, %0010 ; 24
sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 25
\ No newline at end of file
--- a/engine/billspc.asm
+++ b/engine/billspc.asm
@@ -1159,10 +1159,10 @@
add [hl]
ld e, a
ld d, $0
- ld hl, wBillsPCPokemonList + 1
-rept 3
+ ld hl, wBillsPCPokemonList + 1 ; box number
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hl]
and a
jr z, .party
@@ -1274,9 +1274,9 @@
ld e, a
ld d, 0
ld hl, wBillsPCPokemonList
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld e, l
ld d, h
hlcoord 9, 4
@@ -1290,9 +1290,9 @@
ld de, 2 * SCREEN_WIDTH
add hl, de
pop de
-rept 3
inc de
-endr
+ inc de
+ inc de
pop af
dec a
jr nz, .loop
@@ -1493,9 +1493,9 @@
ld e, a
ld d, $0
ld hl, wBillsPCPokemonList
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hl]
ret
@@ -2055,10 +2055,10 @@
.PartyToBox: ; e3267
call .CopyFromParty
ld a, $1
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
callba SaveGameData
xor a
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
call .CopyToBox
ret
; e327d
@@ -2211,9 +2211,9 @@
ld c, b
ld b, 0
ld hl, .boxes
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
ld b, a
ld a, [hli]
@@ -2429,9 +2429,9 @@
ld c, a
ld b, 0
ld hl, .boxbanks
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
ld b, a
call GetSRAMBank
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -495,7 +495,7 @@
pop de
pop hl
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call RotateThreePalettesRight
call ClearScreen
ld b, SCGB_08
@@ -1255,7 +1255,7 @@
jr z, .not_a_button
ld a, $1
ld [wd263], a
- callab Function50db9
+ callab LoadAddrsForLinkMonStatsScreen
ld hl, OTPartyMon1Species
callba LinkMonStatsScreen
jp LinkTradePartiesMenuMasterLoop
@@ -1448,7 +1448,7 @@
ld [wMenuCursorY], a
ld a, $4
ld [wd263], a
- callab Function50db9
+ callab LoadAddrsForLinkMonStatsScreen
callba LinkMonStatsScreen
call Call_LoadTempTileMapToTileMap
hlcoord 6, 1
@@ -1490,7 +1490,7 @@
callba Link_WaitBGMap
ld hl, .Text_CantTradeLastMon
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
jr .cancel_trade
.abnormal
@@ -1512,7 +1512,7 @@
callba Link_WaitBGMap
ld hl, .Text_Abnormal
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
.cancel_trade
hlcoord 0, 12
@@ -1688,7 +1688,7 @@
call GetPokemonName
ld hl, UnknownText_0x28eb8
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call LoadStandardMenuDataHeader
hlcoord 10, 7
ld b, 3
@@ -2030,7 +2030,7 @@
; 28eff
Function28eff: ; 28eff
- callba Function16d6a7
+ callba Function16d6a7 ; just a nested farcall; so wasteful
call SetPalettes
ret
; 28f09
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -137,7 +137,7 @@
cp STEP_TYPE_SLEEP
ret z
.ok3
- ld hl, Pointers4b45
+ ld hl, StepTypesJumptable
rst JumpTable
ret
@@ -1084,7 +1084,7 @@
ret
; 4b45
-Pointers4b45: ; 4b45
+StepTypesJumptable: ; 4b45
; These pointers use OBJECT_STEP_TYPE. See constants/sprite_constants.asm
dw ObjectMovementReset ; 00
dw MapObjectMovementPattern ; unused
--- a/engine/menu.asm
+++ b/engine/menu.asm
@@ -319,7 +319,7 @@
ret c
ld c, 1
ld b, 3
- call Function10062d ; BUG: This function is in another bank.
+ call AdvanceMobileInactivityTimerAndCheckExpired ; BUG: This function is in another bank.
; Pointer in current bank (9) is bogus.
ret c
callba Function100337
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -823,7 +823,7 @@
call DelayFrame
call Pokedex_CheckSGB
jr nz, .decompress
- callba Function1ddf26
+ callba LoadSGBPokedexGFX2
jr .done
.decompress
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -516,7 +516,7 @@
callba PrintHoursMins
ld hl, .DayText
bccoord 6, 6
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90fa8 (24:4fa8)
@@ -711,7 +711,7 @@
push de
callba GetLandmarkName
pop de
- callba Function1de2c5
+ callba TownMap_ConvertLineBreakCharacters
hlcoord 8, 0
ld [hl], $34
ret
--- a/engine/radio.asm
+++ b/engine/radio.asm
@@ -139,7 +139,7 @@
cp 2
jr nz, .print
bccoord 1, 16
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
jr .skip
call PrintTextBoxText
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -9,9 +9,9 @@
jr nz, .refused
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call _SavingDontTurnOffThePower
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
call ExitMenu
and a
ret
@@ -24,7 +24,7 @@
ret
Function14a58: ; 14a58
- call SetWRAMStateForSave
+ call PauseGameLogic
callba StageRTCTimeForSave
callba BackupMysteryGift
call SavePokemonData
@@ -33,7 +33,7 @@
call SaveBackupChecksum
callba BackupPartyMonMail
callba SaveRTC
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
ret
; 14a83
@@ -47,7 +47,7 @@
jr c, .refused
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call SavingDontTurnOffThePower
call SaveBox
pop de
@@ -55,7 +55,7 @@
ld [wCurBox], a
call LoadBox
call SavedTheGame
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
and a
ret
.refused
@@ -65,9 +65,9 @@
Link_SaveGame: ; 14ab2
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call _SavingDontTurnOffThePower
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
and a
.refused
@@ -75,7 +75,7 @@
; 14ac2
MovePkmnWOMail_SaveGame: ; 14ac2
- call SetWRAMStateForSave
+ call PauseGameLogic
push de
call SaveBox
pop de
@@ -82,12 +82,12 @@
ld a, e
ld [wCurBox], a
call LoadBox
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
ret
; 14ad5
Function14ad5: ; 14ad5
- call SetWRAMStateForSave
+ call PauseGameLogic
push de
call SaveBox
pop de
@@ -111,7 +111,7 @@
callba BackupMobileEventIndex
callba SaveRTC
call LoadBox
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
ld de, SFX_SAVE
call PlaySFX
ld c, 24
@@ -127,9 +127,9 @@
jr c, .refused
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call _SavingDontTurnOffThePower
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
and a
ret
@@ -138,15 +138,15 @@
ret
; 14b54
-SetWRAMStateForSave: ; 14b54
+PauseGameLogic: ; 14b54
ld a, $1
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
ret
; 14b5a
-ClearWRAMStateAfterSave: ; 14b5a
+ResumeGameLogic: ; 14b5a
xor a
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
ret
; 14b5f
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -1762,7 +1762,7 @@
call ClearSprites
xor a
ld [hBGMapMode], a
- callba Functionfb571
+ callba LoadStatsScreenPageTilesGFX
callba ClearSpriteAnims2
ld a, [CurPartyMon]
ld e, a
--- a/engine/stats_screen.asm
+++ b/engine/stats_screen.asm
@@ -6,14 +6,14 @@
ld a, [wBattleMode] ; wd22d (aliases: EnemyMonEnd)
and a
jr z, StatsScreenInit
- jr _BattleStatsScreenInit
+ jr _MobileStatsScreenInit
StatsScreenInit: ; 4dc8a
ld hl, StatsScreenMain
jr StatsScreenInit_gotaddress
-_BattleStatsScreenInit: ; 4dc8f
- ld hl, StatsScreenBattle
+_MobileStatsScreenInit: ; 4dc8f
+ ld hl, StatsScreenMobile
jr StatsScreenInit_gotaddress
StatsScreenInit_gotaddress: ; 4dc94
@@ -33,7 +33,7 @@
call ClearBGPalettes
call ClearTileMap
call UpdateSprites
- callba Functionfb53e
+ callba StatsScreen_LoadFont
pop hl
call _hl_
call ClearBGPalettes
@@ -73,7 +73,7 @@
ret
; 0x4dcf7
-StatsScreenBattle: ; 4dcf7
+StatsScreenMobile: ; 4dcf7
xor a
ld [wJumptableIndex], a
; stupid interns
@@ -89,7 +89,7 @@
ld hl, StatsScreenPointerTable
rst JumpTable
call StatsScreen_WaitAnim
- callba Function100dfd
+ callba MobileComms_CheckInactivityTimer
jr c, .exit
ld a, [wJumptableIndex]
bit 7, a
@@ -100,7 +100,6 @@
; 4dd2a
StatsScreenPointerTable: ; 4dd2a
-
dw MonStatsInit ; regular pokémon
dw EggStatsInit ; egg
dw StatsScreenWaitCry
--- a/engine/timeset.asm
+++ b/engine/timeset.asm
@@ -577,7 +577,7 @@
lb bc, 3, 18
call ClearBox
ld hl, .Text
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90a6c
@@ -608,7 +608,7 @@
lb bc, 3, 18
call ClearBox
ld hl, .Text
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90aa0
@@ -636,7 +636,7 @@
lb bc, 3, SCREEN_WIDTH - 2
call ClearBox
ld hl, .Text
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90acc
--- a/event/halloffame.asm
+++ b/event/halloffame.asm
@@ -3,7 +3,7 @@
ld a, [StatusFlags]
push af
ld a, 1
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
call DisableSpriteUpdates
ld a, SPAWN_LANCE
ld [wSpawnAfterChampion], a
@@ -25,7 +25,7 @@
callba AddHallOfFameEntry
xor a
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
call AnimateHallOfFame
pop af
ld b, a
@@ -44,7 +44,7 @@
xor a
ld [VramState], a
ld [hMapAnims], a
- callba Function4e8c2
+ callba InitDisplayForRedCredits
ld c, 8
call DelayFrames
call DisableSpriteUpdates
@@ -67,7 +67,7 @@
xor a
ld [VramState], a
ld [hMapAnims], a
- callba Function4e881
+ callba InitDisplayForHallOfFame
ld c, 100
jp DelayFrames
; 864b4
@@ -230,7 +230,7 @@
AnimateHOFMonEntrance: ; 865b5
push hl
call ClearBGPalettes
- callba Function4e906
+ callba ResetDisplayBetweenHallOfFameMons
pop hl
ld a, [hli]
ld [TempMonSpecies], a
--- a/event/mom.asm
+++ b/event/mom.asm
@@ -321,13 +321,13 @@
call .ClearBox
bccoord 1, 14
ld hl, .Text_AdjustClock
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call YesNoBox
ret c
call .ClearBox
bccoord 1, 14
ld hl, .Text_LostInstructionBooklet
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
.loop
@@ -337,7 +337,7 @@
bit 7, a
jr z, .SetDST
ld hl, .Text_IsDSTOver
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call YesNoBox
ret c
ld a, [wDST]
@@ -347,12 +347,12 @@
call .ClearBox
bccoord 1, 14
ld hl, .Text_SetClockBack
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
.SetDST:
ld hl, .Text_SwitchToDST
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call YesNoBox
ret c
ld a, [wDST]
@@ -362,7 +362,7 @@
call .ClearBox
bccoord 1, 14
ld hl, .Text_SetClockForward
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 164b9
--- a/event/photo.asm
+++ b/event/photo.asm
@@ -132,7 +132,7 @@
.UpdateUnownFrontpic: ; 16cc8
ld a, [wJumptableIndex]
cp 26
- jr z, Function16d20
+ jr z, .vacant
inc a
ld [UnownLetter], a
ld a, UNOWN
@@ -141,7 +141,7 @@
ld [wBoxAlignment], a
ld de, VTiles2
predef GetFrontpic
- call Function16cff
+ call .Load2bppToSRAM
hlcoord 1, 6
xor a
ld [hGraphicStartTile], a
@@ -148,11 +148,10 @@
lb bc, 7, 7
predef PlaceGraphic
ld de, VTiles2 tile $31
- callba Functione0000
+ callba RotateUnownFrontpic
ret
-; 16cff
-Function16cff: ; 16cff
+.Load2bppToSRAM: ; 16cff
ld a, [rSVBK]
push af
ld a, $6
@@ -171,9 +170,8 @@
pop af
ld [rSVBK], a
ret
-; 16d20
-Function16d20: ; 16d20
+.vacant
hlcoord 1, 6
lb bc, 7, 7
call ClearBox
--- a/gfx/font.asm
+++ b/gfx/font.asm
@@ -21,14 +21,16 @@
; TODO: Various misc graphics here.
-GFX_f89b0: ; f89b0
+StatsScreenPageTilesGFX: ; f89b0
INCBIN "gfx/unknown/0f89b0.2bpp"
; f8a90
ShinyIcon: ; f8a90
+; also part of StatsScreenPageTilesGFX
INCBIN "gfx/stats/shiny.2bpp"
-GFX_f8aa0: ; f8aa0
+StatsScreenPageTilesGFX_Part2: ; f8aa0
+; not referenced on its own, but part of StatsScreenPageTilesGFX
INCBIN "gfx/unknown/0f8aa0.2bpp"
; f8ac0
@@ -48,7 +50,7 @@
INCBIN "gfx/misc/town_map.2bpp.lz"
; f8ea4
-GFX_f8ea4: ; unused
+GFX_f8ea4: ; unused kanji
INCBIN "gfx/unknown/0f8ea4.2bpp"
; f8f24
@@ -56,8 +58,8 @@
INCBIN "gfx/mobile/overworld_phone_icon.2bpp"
; f8f34
-GFX_f8f34: ; unused
-INCBIN "gfx/unknown/0f8f34.2bpp"
+GFX_f8f34: ; unused bold letters + unown chars
+INCBIN "gfx/unknown/0f8f34.w64.1bpp"
; f9204
TextBoxSpaceGFX: ; f9204
@@ -72,7 +74,7 @@
INCBIN "gfx/frames/map_entry_sign.2bpp"
; f9424
-GFX_f9424: ; f9424
+FontsExtra2_UpArrowGFX: ; f9424
INCBIN "gfx/unknown/0f9424.2bpp"
; f9434
@@ -81,6 +83,7 @@
; fb434
; This and the following two functions are unreferenced.
+; Debug, perhaps?
Unknown_fb434:
db 0
@@ -143,9 +146,9 @@
; fb4b0
_LoadFontsExtra2:: ; fb4b0
- ld de, GFX_f9424
+ ld de, FontsExtra2_UpArrowGFX
ld hl, VTiles2 tile $61
- ld b, BANK(GFX_f9424)
+ ld b, BANK(FontsExtra2_UpArrowGFX)
ld c, 1
call Get2bpp_2
ret
@@ -208,7 +211,7 @@
ret
; fb53e
-Functionfb53e: ; fb53e
+StatsScreen_LoadFont: ; fb53e
call _LoadFontsBattleExtra
ld de, EnemyHPBarBorderGFX
ld hl, VTiles2 tile $6c
@@ -226,11 +229,10 @@
ld hl, VTiles2 tile $55
lb bc, BANK(ExpBarGFX), 8
call Get2bpp_2
-
-Functionfb571: ; fb571
- ld de, GFX_f89b0
+LoadStatsScreenPageTilesGFX: ; fb571
+ ld de, StatsScreenPageTilesGFX
ld hl, VTiles2 tile $31
- lb bc, BANK(GFX_f89b0), $11
+ lb bc, BANK(StatsScreenPageTilesGFX), $11
call Get2bpp_2
ret
; fb57e
binary files a/gfx/unknown/0f8f34.2bpp /dev/null differ
binary files /dev/null b/gfx/unknown/0f8f34.w64.1bpp differ
--- a/home/game_time.asm
+++ b/home/game_time.asm
@@ -33,7 +33,7 @@
; Don't update if game logic is paused.
- ld a, [wc2cd]
+ ld a, [wGameLogicPaused]
and a
ret nz
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -33,7 +33,7 @@
ret nz
; If we're saving, input is disabled.
- ld a, [wc2cd]
+ ld a, [wGameLogicPaused]
and a
ret nz
--- a/home/string.asm
+++ b/home/string.asm
@@ -8,8 +8,6 @@
; Intended for names, so this function is limited to ten characters.
push hl
ld c, 10
-; 2efc
-
_InitString:: ; 2efc
; if the string pointed to by hl is empty (defined as "zero or more spaces
; followed by a null"), then initialize it to the string pointed to by de.
@@ -31,6 +29,7 @@
inc c
call CopyBytes
ret
+
.notblank
pop bc
pop hl
--- a/home/text.asm
+++ b/home/text.asm
@@ -182,7 +182,7 @@
PrintTextBoxText:: ; 1065
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 106c
@@ -708,7 +708,7 @@
; 13e5
-PlaceWholeStringInBoxAtOnce:: ; 13e5
+PlaceHLTextAtBC:: ; 13e5
ld a, [TextBoxFlags]
push af
set 1, a
--- a/main.asm
+++ b/main.asm
@@ -3287,7 +3287,7 @@
INCLUDE "engine/evolution_animation.asm"
-Function4e881: ; 4e881
+InitDisplayForHallOfFame: ; 4e881
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -3317,7 +3317,7 @@
text_jump UnknownText_0x1bd39e
db "@"
-Function4e8c2: ; 4e8c2
+InitDisplayForRedCredits: ; 4e8c2
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -3333,7 +3333,7 @@
xor a
call ByteFill
ld hl, wd000 ; UnknBGPals
- ld c, 4 * $10
+ ld c, 4 tiles
.load_white_palettes
ld a, (palred 31 + palgreen 31 + palblue 31) % $100
ld [hli], a
@@ -3349,7 +3349,7 @@
call SetPalettes
ret
-Function4e906: ; 4e906
+ResetDisplayBetweenHallOfFameMons: ; 4e906
ld a, [rSVBK]
push af
ld a, $6
@@ -3360,8 +3360,8 @@
call ByteFill
hlbgcoord 0, 0
ld de, wDecompressScratch
- ld b, $0
- ld c, $40
+ ld b, 0
+ ld c, 4 tiles
call Request2bpp
pop af
ld [rSVBK], a
@@ -3455,7 +3455,7 @@
INCLUDE "battle/sliding_intro.asm"
-Function4ea0a: ; 4ea0a
+Mobile_PrintOpponentBattleMessage: ; 4ea0a
ld a, c
push af
call SpeechTextBox
@@ -3463,11 +3463,11 @@
pop af
dec a
ld bc, $c
- ld hl, w5_dc1a
+ ld hl, w5_MobileOpponentBattleMessages
call AddNTimes
- ld de, wcd53
+ ld de, wMobileOpponentBattleMessage
ld bc, $c
- ld a, $5 ; BANK(w5_dc1a)
+ ld a, $5 ; BANK(w5_MobileOpponentBattleMessages)
call FarCopyWRAM
ld a, [rSVBK]
@@ -3475,9 +3475,9 @@
ld a, $1
ld [rSVBK], a
- ld bc, wcd53
+ ld bc, wMobileOpponentBattleMessage
decoord 1, 14
- callba Function11c0c6
+ callba PrintFixedWordBattleMessage
pop af
ld [rSVBK], a
@@ -3679,7 +3679,8 @@
INCLUDE "text/types.asm"
Function50a28: ; 50a28
- ld hl, Strings50a42
+; XXX
+ ld hl, .Strings
ld a, [TrainerClass]
dec a
ld c, a
@@ -3698,7 +3699,7 @@
jr nz, .copy
ret
-Strings50a42: ; 50a42
+.Strings: ; 50a42
; Untranslated trainer class names from Red.
dw .Youngster
dw .BugCatcher
@@ -4096,7 +4097,8 @@
ret
Function50cd0: ; 50cd0
-.asm_50cd0
+; XXX
+.loop
ld [hl], $32
inc hl
ld [hl], $3e
@@ -4103,7 +4105,7 @@
dec hl
add hl, de
dec c
- jr nz, .asm_50cd0
+ jr nz, .loop
ret
Function50cdb: ; unreferenced predef
@@ -4118,7 +4120,7 @@
pop hl
ld a, [CurPartySpecies]
cp EGG
- jr z, .asm_50d09
+ jr z, .egg
push hl
ld bc, -12
add hl, bc
@@ -4131,7 +4133,7 @@
call PrintLevel
pop de
-.asm_50d09
+.egg
ret
PlaceStatusString: ; 50d0a
@@ -4255,7 +4257,7 @@
.done
ret
-Function50db9: ; 50db9
+LoadAddrsForLinkMonStatsScreen: ; 50db9
ld a, [wd263]
cp $1
@@ -4264,8 +4266,8 @@
ld de, OTPartyMonOT
ld a, ENEMY_OT_NAME
jr .done
-.check_party_ot_name
+.check_party_ot_name
cp $4
jr nz, .check_mon_name
ld hl, PartyCount
@@ -4272,8 +4274,8 @@
ld de, PartyMonOT
ld a, PARTY_OT_NAME
jr .done
-.check_mon_name
+.check_mon_name
cp $5
jr nz, .check_item_name
ld hl, CurMart
@@ -4280,8 +4282,8 @@
ld de, PokemonNames
ld a, PKMN_NAME
jr .done
-.check_item_name
+.check_item_name
cp $2
jr nz, .check_ob_item_name
ld hl, NumItems
@@ -4288,14 +4290,13 @@
ld de, ItemNames
ld a, ITEM_NAME
jr .done
-.check_ob_item_name
+.check_ob_item_name
ld hl, CurMart
ld de, ItemNames
ld a, ITEM_NAME
-
.done
- ld [wNamedObjectTypeBuffer], a
+ ld [wNamedObjectTypeBuffer], a ; d265
ld a, l
ld [wd100], a
ld a, h
@@ -4304,7 +4305,7 @@
ld [wd102], a
ld a, d
ld [wd103], a
- ld bc, ItemAttributes
+ ld bc, ItemAttributes ; ParseEnemyAction, HandleMapTimeAndJoypad, Music_LakeOfRage_Ch3, String_11a7c1 $67c1
ld a, c
ld [wd104], a
ld a, b
@@ -4694,6 +4695,7 @@
INCLUDE "event/kurt.asm"
Function88248: ; 88248
+; XXX
ld c, CAL
ld a, [PlayerGender]
bit 0, a
@@ -4975,7 +4977,8 @@
INCLUDE "engine/timeofdaypals.asm"
INCLUDE "engine/battle_start.asm"
-Function8c7c9: ; unreferenced
+Function8c7c9:
+; XXX
ld a, $1
ld [hBGMapMode], a
call WaitBGMap
@@ -5320,7 +5323,7 @@
SECTION "bank38", ROMX, BANK[$38]
-Functione0000: ; e0000
+RotateUnownFrontpic: ; e0000
; something to do with Unown printer
push de
xor a
@@ -5333,8 +5336,8 @@
push bc
ld de, wd002
call .Copy
- call .Decompress
- ld hl, Unknown_e008b
+ call .Rotate
+ ld hl, UnownPrinter_OverworldMapRectangle
pop bc
add hl, bc
add hl, bc
@@ -5349,7 +5352,7 @@
pop bc
inc c
ld a, c
- cp $31
+ cp 7 * 7
jr c, .loop
ld hl, OverworldMap
@@ -5375,7 +5378,7 @@
jr nz, .loop_copy
ret
-.Decompress: ; e0057
+.Rotate: ; e0057
ld hl, wd012
ld e, %10000000
ld d, 8
@@ -5417,13 +5420,12 @@
jr nz, .loop_count
ret
-overworldmaptile EQUS "dw OverworldMap + $10 *"
overworldmaprect: MACRO
y = 0
rept \1
x = \1 * (\2 +- 1) + y
rept \2
- overworldmaptile x
+ dw OverworldMap tile x
x = x +- \2
endr
y = y + 1
@@ -5430,7 +5432,7 @@
endr
endm
-Unknown_e008b: ; e008b
+UnownPrinter_OverworldMapRectangle: ; e008b
overworldmaprect 7, 7
Unknown_e00ed:
@@ -5590,6 +5592,7 @@
SECTION "bank77_2", ROMX, BANK[$77]
Function1dd6a9: ; 1dd6a9
+; XXX
ld a, b
ld b, c
ld c, a
@@ -5661,7 +5664,7 @@
call Decompress
ret
-Function1ddf26: ; 1ddf26 (77:5f26)
+LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26)
ld hl, LZ_1ddf33
ld de, VTiles2 tile $31
lb bc, BANK(LZ_1ddf33), $3a
@@ -5861,7 +5864,7 @@
db A_BUTTON, $00
db NO_INPUT, $ff ; end
-Function1de2c5: ; 1de2c5
+TownMap_ConvertLineBreakCharacters: ; 1de2c5
ld hl, StringBuffer1
.loop
ld a, [hl]
@@ -6033,9 +6036,10 @@
db $cc, $6b, $1e ; XXX
Function1f4003: ; 1f4003
+; XXX
ld a, $6
call GetSRAMBank
- ld hl, Unknown_1f4018
+ ld hl, .unknown_data
ld de, $a000
ld bc, $1000
call CopyBytes
@@ -6042,13 +6046,14 @@
call CloseSRAM
ret
-Unknown_1f4018:
+.unknown_data
INCBIN "unknown/1f4018.bin"
Function1f4dbe: ; 1f4dbe
+; XXX
ld a, $6
call GetSRAMBank
- ld hl, Unknown_1f4dd3
+ ld hl, .unknown_data
ld de, $a000
ld bc, $1000
call CopyBytes
@@ -6055,13 +6060,13 @@
call CloseSRAM
ret
-Unknown_1f4dd3:
+.unknown_data
INCBIN "unknown/1f4dd3.bin"
Function1f5d9f: ; 1f5d9f
ld a, $6
call GetSRAMBank
- ld hl, Unknown_1f5db4
+ ld hl, .unknown_data
ld de, $a000
ld bc, $1000
call CopyBytes
@@ -6068,7 +6073,7 @@
call CloseSRAM
ret
-Unknown_1f5db4:
+.unknown_data
INCBIN "unknown/1f5db4.bin"
SECTION "bank7E", ROMX, BANK[$7E]
--- a/misc/battle_tower_47.asm
+++ b/misc/battle_tower_47.asm
@@ -81,7 +81,7 @@
bccoord 1, 14
pop af
ld [rSVBK], a
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 11c05d
--- a/misc/fixed_words.asm
+++ b/misc/fixed_words.asm
@@ -10,7 +10,7 @@
cp $ff
jr z, .asm_11c071
push hl
- call Function11c156
+ call CopyMobileFixedWordToC608
pop hl
call PlaceString
and a
@@ -21,7 +21,6 @@
ld b, h
scf
ret
-
; 11c075
Function11c075: ; 11c075
@@ -32,7 +31,6 @@
ld bc, wcd36
call Function11c08f
ret
-
; 11c082
Function11c082: ; 11c082
@@ -41,9 +39,8 @@
call Function11c254
pop de
ld bc, wcd36
- call Function11c0c6
+ call PrintFixedWordBattleMessage
ret
-
; 11c08f
Function11c08f: ; 11c08f
@@ -96,27 +93,32 @@
dec a
jr nz, .asm_11c0b0
ret
-
; 11c0c6
-
-Function11c0c6: ; 11c0c6
+PrintFixedWordBattleMessage: ; 11c0c6
+; Use up to 6 words from bc to print text starting at de.
+ ; Preserve $cf63, $cf64
ld a, [wJumptableIndex]
ld l, a
ld a, [wcf64]
ld h, a
push hl
- ld hl, $c608 + 16
+ ; reset value at c618 (not preserved)
+ ld hl, $c618
ld a, $0
ld [hli], a
+ ; preserve de
push de
+ ; $cf63 keeps track of which line we're on (0, 1, or 2)
+ ; $cf64 keeps track of how much room we have left in the current line
xor a
ld [wJumptableIndex], a
- ld a, $12
+ ld a, 18
ld [wcf64], a
- ld a, $6
-.asm_11c0e1
+ ld a, $6 ; up to 6 times
+.loop
push af
+ ; load the 2-byte word data pointed to by bc
ld a, [bc]
ld e, a
inc bc
@@ -123,68 +125,85 @@
ld a, [bc]
ld d, a
inc bc
+ ; if $0000, we're done
or e
- jr z, .asm_11c133
+ jr z, .done
+ ; preserving hl and bc, get the length of the word
push hl
push bc
- call Function11c156
- call Function11c14a
+ call CopyMobileFixedWordToC608
+ call GetLengthOfWordAtC608
ld e, c
pop bc
pop hl
+ ; if the functions return 0, we're done
ld a, e
or a
- jr z, .asm_11c133
-.asm_11c0fa
+ jr z, .done
+.loop2
+ ; e contains the length of the word
+ ; add 1 for the space, unless we're at the start of the line
ld a, [wcf64]
- cp $12
- jr z, .asm_11c102
+ cp 18
+ jr z, .skip_inc
inc e
-.asm_11c102
+.skip_inc
+ ; if the word fits, put it on the same line
cp e
- jr nc, .asm_11c11c
+ jr nc, .same_line
+ ; otherwise, go to the next line
ld a, [wJumptableIndex]
inc a
ld [wJumptableIndex], a
- ld [hl], $4e
+ ; if we're on line 2, insert "<NEXT>"
+ ld [hl], "<NEXT>"
rra
- jr c, .asm_11c113
- ld [hl], $55
+ jr c, .got_line_terminator
+ ; else, insert "<CONT>"
+ ld [hl], "<CONT>"
-.asm_11c113
+.got_line_terminator
inc hl
- ld a, $12
+ ; init the next line, holding on to the same word
+ ld a, 18
ld [wcf64], a
dec e
- jr .asm_11c0fa
+ jr .loop2
-.asm_11c11c
- cp $12
- jr z, .asm_11c123
- ld [hl], $7f
+.same_line
+ ; add the space, unless we're at the start of the line
+ cp 18
+ jr z, .skip_space
+ ld [hl], " "
inc hl
-.asm_11c123
+.skip_space
+ ; deduct the length of the word
sub e
ld [wcf64], a
ld de, $c608
-.asm_11c12a
+.place_string_loop
+ ; load the string from de to hl
ld a, [de]
- cp $50
- jr z, .asm_11c133
+ cp "@"
+ jr z, .done
inc de
ld [hli], a
- jr .asm_11c12a
+ jr .place_string_loop
-.asm_11c133
+.done
+ ; next word?
pop af
dec a
- jr nz, .asm_11c0e1
- ld [hl], $57
+ jr nz, .loop
+ ; we're finished, place "<DONE>"
+ ld [hl], "<DONE>"
+ ; now, let's place the string from c618 to bc
pop bc
- ld hl, $c608 + 16
- call PlaceWholeStringInBoxAtOnce
+ ld hl, $c618
+ call PlaceHLTextAtBC
+ ; restore the original values of $cf63 and $cf64
pop hl
ld a, l
ld [wJumptableIndex], a
@@ -191,28 +210,27 @@
ld a, h
ld [wcf64], a
ret
-
; 11c14a
-Function11c14a: ; 11c14a
+GetLengthOfWordAtC608: ; 11c14a
ld c, $0
ld hl, $c608
-.asm_11c14f
+.loop
ld a, [hli]
- cp $50
+ cp "@"
ret z
inc c
- jr .asm_11c14f
+ jr .loop
; 11c156
-Function11c156: ; 11c156
+CopyMobileFixedWordToC608: ; 11c156
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
- ld a, $50
+ ld a, "@"
ld hl, $c608
- ld bc, $000b
+ ld bc, NAME_LENGTH
call ByteFill
ld a, d
and a
@@ -239,7 +257,7 @@
rl b
add hl, bc
ld bc, 5 ; length of a string
-.loop
+.copy_string
ld de, $c608
call CopyBytes
ld de, $c608
@@ -253,7 +271,7 @@
call GetPokemonName
ld hl, StringBuffer1
ld bc, PKMN_NAME_LENGTH - 1
- jr .loop
+ jr .copy_string
; 11c1ab
Function11c1ab: ; 11c1ab
@@ -265,7 +283,6 @@
pop af
ld [hInMenu], a
ret
-
; 11c1b9
Function11c1b9: ; 11c1b9
@@ -278,7 +295,6 @@
pop af
ld [rSVBK], a
ret
-
; 11c1ca
Function11c1ca: ; 11c1ca
@@ -329,7 +345,6 @@
call Function11d4aa
call Function11d3ba
ret
-
; 11c254
Function11c254: ; 11c254
@@ -351,10 +366,8 @@
call CopyBytes
call CloseSRAM
ret
-
; 11c277
-
Function11c277: ; 11c277 (47:4277)
ld a, " "
hlcoord 0, 6
@@ -379,7 +392,6 @@
callba ClearSpriteAnims
call ClearSprites
ret
-
; 11c2ac
.DoJumptableFunction: ; 11c2ac
@@ -386,7 +398,6 @@
jumptable .Jumptable, wJumptableIndex
; 11c2bb
-
.Jumptable: ; 11c2bb (47:42bb)
dw Function11c2e9 ; 00
dw Function11c346 ; 01
@@ -412,7 +423,6 @@
dw Function11ce0b ; 15
dw Function11ce2b ; 16
-
Function11c2e9: ; 11c2e9 (47:42e9)
depixel 3, 1, 2, 5
ld a, SPRITE_ANIM_INDEX_1D
@@ -535,7 +545,6 @@
dec a
jr nz, .asm_11c392
ret
-
; 11c3bc (47:43bc)
String_11c3bc: ; 11c3bc
@@ -705,7 +714,6 @@
call ByteFill
callba ReloadMapPart
ret
-
; 11c4db (47:44db)
String_11c4db: ; 11c4db
@@ -865,7 +873,6 @@
.asm_11c5ee
ld [hl], a
ret
-
; 11c5f0
Function11c5f0: ; 11c5f0 (47:45f0)
@@ -903,7 +910,6 @@
call ByteFill
callba ReloadMapPart
ret
-
; 11c62a (47:462a)
String_11c62a: ; 11c62a
@@ -1265,7 +1271,6 @@
pop hl
pop de
ret
-
; 11c854 (47:4854)
Unknown_11c854: ; 11c854
@@ -1339,7 +1344,6 @@
dec c
jr nz, .asm_11c8c2
ret
-
; 11c8c7 (47:48c7)
BCD2String: ; 11c8c7
@@ -1363,7 +1367,6 @@
add "0"
ld [hli], a
ret
-
; 11c8ec
MobileString_Page: ; 11c8ec
@@ -1480,7 +1483,6 @@
jr nz, .asm_11c980
pop hl
ret
-
; 11c986 (47:4986)
Unknown_11c986:
@@ -1606,7 +1608,6 @@
jr nz, .asm_11ca22
callba ReloadMapPart
ret
-
; 11ca38 (47:4a38)
String_11ca38: ; 11ca38
@@ -1736,7 +1737,6 @@
ret nz
inc [hl]
ret
-
; 11cb1c (47:4b1c)
String_11cb1c: ; 11cb1c
@@ -1867,7 +1867,6 @@
dec hl
set 7, [hl]
ret
-
; 11cc01 (47:4c01)
Unknown_11cc01: ; 11cc01
@@ -1933,7 +1932,6 @@
ld a, $4
ld [wJumptableIndex], a
ret
-
; 11cd10 (47:4d10)
String_11cd10: ; 11cd10
@@ -2033,7 +2031,6 @@
call ByteFill
callba ReloadMapPart
ret
-
; 11cdc7 (47:4dc7)
String_11cdc7: ; 11cdc7
@@ -2162,7 +2159,6 @@
ret z
ld [wcd22], a
ret
-
; 11ceb9 (47:4eb9)
Unknown_11ceb9: ; 11ceb9
@@ -2278,7 +2274,6 @@
ld hl, wJumptableIndex
inc [hl]
ret
-
; 11cfba (47:4fba)
Unknown_11cfba:
@@ -2522,7 +2517,6 @@
dw .nine
dw .ten
-
.zero ; 11d0dd (47:50dd)
ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
sla a
@@ -2702,7 +2696,6 @@
ld e, a
call Function11d2ee
ret
-
; 11d208 (47:5208)
Unknown_11d208: ; 11d208
@@ -2887,7 +2880,6 @@
pop af
ld [rSVBK], a
ret
-
; 11d33a
Palette_11d33a:
@@ -2970,7 +2962,6 @@
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
-
; 11d3ba
Function11d3ba: ; 11d3ba
@@ -3146,7 +3137,6 @@
pop af
ld [rSVBK], a
ret
-
; 11d493
.CheckSeenMon: ; 11d493
@@ -3165,7 +3155,6 @@
pop bc
pop hl
ret
-
; 11d4aa
Function11d4aa: ; 11d4aa
@@ -3226,9 +3215,7 @@
pop af
ld [rSVBK], a
ret
-
; 11d4fe
-
SortedPokemon:
; Pokemon sorted by kana.
--- a/misc/gfx_41.asm
+++ b/misc/gfx_41.asm
@@ -481,9 +481,11 @@
ld a, b ; bank
ld l, c ; number of tiles
ld h, $0
-rept 4
- add hl, hl ; multiply by 16 (16 bytes of a 2bpp = 8 x 8 tile)
-endr
+ ; multiply by 16 (16 bytes of a 2bpp = 8 x 8 tile)
+ add hl, hl
+ add hl, hl
+ add hl, hl
+ add hl, hl
ld b, h
ld c, l
ld h, d ; address
--- a/misc/mobile_12.asm
+++ b/misc/mobile_12.asm
@@ -11,7 +11,7 @@
call Function48d3d
ld a, [wd479]
bit 1, a
- jr z, .asm_4805a
+ jr z, .not_yet_initialized
ld a, [wd003]
set 0, a
set 1, a
@@ -18,7 +18,7 @@
set 2, a
set 3, a
ld [wd003], a
-.asm_4805a
+.not_yet_initialized
call Function486bf
call LoadFontsExtra
ld de, GFX_488c3
@@ -125,22 +125,22 @@
ld hl, wMenuCursorY
ld b, [hl]
push bc
-
asm_4815f: ; 4815f (12:415f)
- bit 0, a
+ bit A_BUTTON_F, a
jp nz, Function4820d
ld b, a
ld a, [wd002]
bit 6, a
- jr z, .asm_48177
+ jr z, .dont_check_b_button
ld hl, wd479
bit 1, [hl]
- jr z, .asm_48177
- bit 1, b
- jr nz, .asm_4817a
-.asm_48177
+ jr z, .dont_check_b_button
+ bit B_BUTTON_F, b
+ jr nz, .b_button
+.dont_check_b_button
jp Function48272
-.asm_4817a
+
+.b_button
call ClearBGPalettes
call Function48d30
pop bc
@@ -497,13 +497,14 @@
ld [hl], b
ld a, [wd002]
bit 6, a
- jr nz, .asm_48437
+ jr nz, .narrower_box
ld b, 9
ld c, 1
hlcoord 1, 4
call ClearBox
jp Function48157
-.asm_48437
+
+.narrower_box
ld b, 7
ld c, 1
hlcoord 1, 6
@@ -667,13 +668,13 @@
call GetMysteryGift_MobileAdapterLayout
call ClearBGPalettes
hlcoord 0, 0
- ld b, $4
- ld c, $14
+ ld b, 4
+ ld c, SCREEN_WIDTH
call ClearBox
hlcoord 0, 2
ld a, $c
ld [hl], a
- ld bc, $13
+ ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], a
ld de, MobileProfileString
@@ -689,121 +690,139 @@
ld hl, w2DMenuCursorInitY
ld a, [wd002]
bit 6, a
- jr nz, .asm_486ce
- ld a, $4
+ jr nz, .start_at_6
+ ld a, 4
ld [hli], a
- jr .asm_486d1
-.asm_486ce
- ld a, $6
+ jr .got_init_y
+
+.start_at_6
+ ld a, 6
ld [hli], a
-.asm_486d1
- ld a, $1
- ld [hli], a
+.got_init_y
+ ld a, 1
+ ld [hli], a ; init x
ld a, [wd002]
bit 6, a
- jr nz, .asm_486e7
+ jr nz, .check_wd479
call Function48725
- ld a, $4
- jr nc, .asm_486e4
- ld a, $5
-.asm_486e4
+ ld a, 4
+ jr nc, .got_num_rows_1
+ ld a, 5
+.got_num_rows_1
ld [hli], a
- jr .asm_486fb
-.asm_486e7
+ jr .got_num_rows_2
+
+.check_wd479
ld a, [wd479]
bit 1, a
- jr nz, .asm_486f8
+ jr nz, .four_rows
call Function48725
- jr c, .asm_486f8
- ld a, $3
+ jr c, .four_rows
+ ld a, 3
ld [hli], a
- jr .asm_486fb
-.asm_486f8
- ld a, $4
+ jr .got_num_rows_2
+
+.four_rows
+ ld a, 4
ld [hli], a
-.asm_486fb
- ld a, $1
- ld [hli], a
- ld [hl], $0
+.got_num_rows_2
+ ld a, 1
+ ld [hli], a ; num cols
+ ld [hl], $0 ; flags 1
set 5, [hl]
inc hl
xor a
- ld [hli], a
+ ld [hli], a ; flags 2
ld a, $20
- ld [hli], a
- ld a, $1
- add $40
- add $80
+ ld [hli], a ; cursor offsets
+ ld a, A_BUTTON
+ add D_UP
+ add D_DOWN
push af
ld a, [wd002]
bit 6, a
- jr z, .asm_4871a
+ jr z, .got_joypad_mask
pop af
- add $2
+ add B_BUTTON
push af
-.asm_4871a
+.got_joypad_mask
pop af
ld [hli], a
ld a, $1
- ld [hli], a
- ld [hli], a
+ ld [hli], a ; cursor y
+ ld [hli], a ; cursor x
xor a
-rept 3
- ld [hli], a
-endr
+ ld [hli], a ; off char
+ ld [hli], a ; cursor tile
+ ld [hli], a ; cursor tile + 1
ret
Function48725: ; 48725 (12:4725)
+; ld a, [wd003]
+; and $f
+; cp $f
+; jr nz, .clear_carry
+; scf
+; ret
+; .clear_carry
+; and a
+; ret
+
ld a, [wd003]
bit 0, a
- jr z, .asm_4873a
+ jr z, .clear_carry
bit 1, a
- jr z, .asm_4873a
+ jr z, .clear_carry
bit 2, a
- jr z, .asm_4873a
+ jr z, .clear_carry
bit 3, a
- jr z, .asm_4873a
+ jr z, .clear_carry
scf
ret
-.asm_4873a
+
+.clear_carry
and a
ret
Function4873c: ; 4873c (12:473c)
ld hl, w2DMenuCursorInitY
- ld a, $4
+ ld a, 4
ld [hli], a
- ld a, $c
- ld [hli], a
- ld a, $2
- ld [hli], a
- ld a, $1
- ld [hli], a
- ld [hl], $0
+ ld a, 12
+ ld [hli], a ; init x
+ ld a, 2
+ ld [hli], a ; num rows
+ ld a, 1
+ ld [hli], a ; num cols
+ ld [hl], $0 ; flags 1
set 5, [hl]
inc hl
xor a
- ld [hli], a
- ld a, $20
- ld [hli], a
- ld a, $1
- add $2
- ld [hli], a
+ ld [hli], a ; flags 2
+ ln a, 2, 0
+ ld [hli], a ; cursor offsets
+ ld a, A_BUTTON
+ add B_BUTTON
+ ld [hli], a ; joypad filter
+ ; ld a, [PlayerGender]
+ ; xor 1
+ ; inc a
ld a, [PlayerGender]
and a
- jr z, .asm_48764
- ld a, $2
- jr .asm_48766
-.asm_48764
+ jr z, .male
+ ld a, 2
+ jr .okay_gender
+
+.male
+ ld a, 1
+.okay_gender
+ ld [hli], a ; cursor y
ld a, $1
-.asm_48766
- ld [hli], a
- ld a, $1
- ld [hli], a
+ ld [hli], a ; cursor x
xor a
-rept 3
- ld [hli], a
-endr
+ ld [hli], a ; off char
+ ld [hli], a ; cursor tile
+ ld [hli], a ; cursor tile + 1
ret
Function4876f: ; 4876f (12:476f)
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -1001,17 +1001,17 @@
db "つうしんたいきちゅう!@"
; 10062d
-Function10062d: ; 10062d
+AdvanceMobileInactivityTimerAndCheckExpired: ; 10062d
push bc
- call Function10064e
+ call IncrementMobileInactivityTimerByCFrames
pop bc
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
cp b
- jr nc, .asm_10063a
+ jr nc, .timed_out
and a
ret
-.asm_10063a
+.timed_out
ld a, $fa
ld [wcd2b], a
scf
@@ -1018,35 +1018,34 @@
ret
; 100641
-Function100641: ; 100641
+StartMobileInactivityTimer: ; 100641
xor a
- ld [wcd44], a
- ld [wcd45], a
- ld [wcd46], a
+ ld [wMobileInactivityTimerMinutes], a
+ ld [wMobileInactivityTimerSeconds], a
+ ld [wMobileInactivityTimerFrames], a
ret
; 10064c
-Function10064c: ; 10064c
+IncrementMobileInactivityTimerBy1Frame: ; 10064c
ld c, 1
-
-Function10064e: ; 10064e
- ld hl, wcd46
+IncrementMobileInactivityTimerByCFrames: ; 10064e
+ ld hl, wMobileInactivityTimerFrames ; timer?
ld a, [hl]
add c
- cp $3c
- jr c, .asm_100658
+ cp 60
+ jr c, .seconds
xor a
-.asm_100658
+.seconds
ld [hld], a
ret c
ld a, [hl]
inc a
- cp $3c
- jr c, .asm_100661
+ cp 60
+ jr c, .minutes
xor a
-.asm_100661
+.minutes
ld [hld], a
ret c
inc [hl]
@@ -1268,35 +1267,35 @@
Function10079c: ; 10079c
ld a, [wcd21]
cp $01
- jr nz, .asm_1007f4
+ jr nz, .dont_quit
ld hl, wcd2a
bit 5, [hl]
- jr nz, .asm_1007f4
+ jr nz, .dont_quit
ld hl, wcd2a
bit 6, [hl]
- jr nz, .asm_1007f4
+ jr nz, .dont_quit
ld a, [wcd6a]
add c
- cp $3c
- jr nc, .asm_1007be
+ cp 60
+ jr nc, .overflow
ld [wcd6a], a
and a
ret
-.asm_1007be
- sub $3c
+.overflow
+ sub 60
ld [wcd6a], a
ld d, b
push de
call Function1007f6
pop de
- jr c, .asm_1007e5
+ jr c, .quit
ld a, c
and a
- jr nz, .asm_1007e5
+ jr nz, .quit
ld a, b
- cp $0a
- jr nc, .asm_1007e5
+ cp 10
+ jr nc, .quit
ld a, d
and a
ret z
@@ -1309,7 +1308,7 @@
and a
ret
-.asm_1007e5
+.quit
call Function1008e0
ld hl, wcd2a
set 4, [hl]
@@ -1318,7 +1317,7 @@
scf
ret
-.asm_1007f4
+.dont_quit
and a
ret
; 1007f6
@@ -1704,7 +1703,7 @@
.MobileBattle_SendReceiveAction: ; 100a87
call Function100acf
- call Function100641
+ call StartMobileInactivityTimer
ld a, 0
ld [wcd27], a
.asm_100a92
@@ -1714,7 +1713,7 @@
ld c, $01
ld b, $03
push bc
- call Function10062d
+ call AdvanceMobileInactivityTimerAndCheckExpired
pop bc
jr c, .asm_100ac7
ld b, $01
@@ -2019,7 +2018,7 @@
push bc
callba PlaySpriteAnimations
callba HDMATransferTileMapToWRAMBank3
- call Function100dfd
+ call MobileComms_CheckInactivityTimer
pop bc
jr c, .done
ld a, [wMenuJoypadFilter]
@@ -2073,7 +2072,7 @@
push bc
callba PlaySpriteAnimations
callba HDMATransferTileMapToWRAMBank3
- call Function100dfd
+ call MobileComms_CheckInactivityTimer
pop bc
jr c, .asm_100d54
ld a, [wMenuJoypadFilter]
@@ -2180,7 +2179,7 @@
Function100dd8: ; 100dd8
ld c, $01
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
jr c, .asm_100dfb
ld c, $3c
ld b, $01
@@ -2198,7 +2197,7 @@
ret
; 100dfd
-Function100dfd: ; 100dfd
+MobileComms_CheckInactivityTimer: ; 100dfd
ld a, [OverworldDelay]
ld c, a
ld a, 30
@@ -2206,22 +2205,22 @@
ld c, a
ld b, 3
push bc
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired ; useless to farcall
pop bc
- jr c, .asm_100e2b
+ jr c, .quit
ld b, 1
call Function10079c
- jr c, .asm_100e2b
+ jr c, .quit
call Function1009f3
- jr c, .asm_100e2b
- callba Function10032e
+ jr c, .quit
+ callba Function10032e ; useless to farcall
ld a, [wcd2b]
and a
- jr nz, .asm_100e2b
+ jr nz, .quit
xor a
ret
-.asm_100e2b
+.quit
scf
ret
; 100e2d
@@ -2234,7 +2233,7 @@
ld c, a
ld b, 3
push bc
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
pop bc
jr c, .asm_100e61
ld b, 1
@@ -3277,7 +3276,7 @@
Function1014ce: ; 1014ce
callba Function100720
- callba Function100641
+ callba StartMobileInactivityTimer
ld a, [wMobileCommsJumptableIndex]
inc a
ld [wMobileCommsJumptableIndex], a
@@ -3345,7 +3344,7 @@
; 101544
Function101544: ; 101544
- callba Function100641
+ callba StartMobileInactivityTimer
ld a, $12
call Function3e32
ld a, [wMobileCommsJumptableIndex]
@@ -3355,7 +3354,7 @@
; 101557
Function101557: ; 101557
- callba Function100641
+ callba StartMobileInactivityTimer
ld hl, wcd53
ld a, $08
call Function3e32
@@ -3387,8 +3386,8 @@
; 10158a
Function10158a: ; 10158a
- callba Function10064c
- ld a, [wcd44]
+ callba IncrementMobileInactivityTimerBy1Frame
+ ld a, [wMobileInactivityTimerMinutes]
cp $0a
jr c, Function10156d
ld a, $fb
@@ -3539,7 +3538,7 @@
ret c
ld c, $01
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
ret c
ld a, [wcd26]
ld hl, Jumptable_1016c3
@@ -3772,7 +3771,7 @@
ret c
ld c, $01
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
ret c
callba Function100382
ld a, [wcd27]
@@ -5277,7 +5276,7 @@
sub c
ld c, a
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
jr c, .asm_1022f3
xor a
ret
@@ -6153,7 +6152,7 @@
ld hl, wcd4b
res 6, [hl]
ld [wcd50], a
- callba Function100641
+ callba StartMobileInactivityTimer
ld a, 0
ld [wcd4a], a
ret
@@ -6557,7 +6556,7 @@
ld [CurPartyMon], a
call LowVolume
call ClearSprites
- callba _BattleStatsScreenInit
+ callba _MobileStatsScreenInit
ld a, [CurPartyMon]
inc a
ld [wMenuCursorY], a
--- a/misc/mobile_41.asm
+++ b/misc/mobile_41.asm
@@ -983,9 +983,9 @@
ld hl, VTiles2 tile $60
lb bc, BANK(MobilePhoneTilesGFX), 1
call Get2bpp
- ld de, GFX_f9424
+ ld de, FontsExtra2_UpArrowGFX
ld hl, VTiles2 tile $61
- lb bc, BANK(GFX_f9424), 1
+ lb bc, BANK(FontsExtra2_UpArrowGFX), 1
call Get2bpp
ld de, GFX_106514
ld hl, VTiles2 tile $62
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -1067,7 +1067,7 @@
ld [wcd3c], a
call Function119e2e
ld a, [wcd33]
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
Function118880: ; 118880 (46:4880)
call Function119ed8
@@ -1344,7 +1344,7 @@
ld a, $7
ld [wcf66], a
ld a, $0
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ret
@@ -1615,7 +1615,7 @@
ld a, $9
ld [wcd3c], a
ld a, $12
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function118d9b:
@@ -1830,9 +1830,9 @@
ld a, $1d
ld [wcd3c], a
ld a, $24
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $11
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $1c
ld [wcd47], a
jp Function119e2e
@@ -1871,9 +1871,9 @@
ld a, $9
ld [wcd3c], a
ld a, $24
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $13
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $1c
ld [wcd47], a
jp Function119e2e
@@ -2518,7 +2518,7 @@
ld a, $9
ld [wcd3c], a
ld a, $10
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function1193a0:
@@ -2565,7 +2565,7 @@
ld a, $9
ld [wcd3c], a
ld a, $11
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function1193fb:
@@ -2895,9 +2895,9 @@
ld a, $11
ld [wcd3c], a
ld a, $1c
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $f
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $14
ld [wcd47], a
call Function119e2e
@@ -2907,9 +2907,9 @@
ld a, $14
ld [wcd3c], a
ld a, $1c
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $10
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $14
ld [wcd47], a
jp Function119e2e
@@ -2925,7 +2925,7 @@
ld a, $9
ld [wcd3c], a
ld a, $1c
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $14
ld [wcd47], a
call Function119e2e
@@ -3219,7 +3219,7 @@
ld a, $9
ld [wcd3c], a
ld a, $12
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function1197dc:
@@ -3943,7 +3943,7 @@
Function119cec:
call Function119ed8
ret c
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
ld [wcf66], a
ret
; 119cf7
@@ -4301,16 +4301,16 @@
ld de, String_11a661
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 119f56
Function119f56: ; 119f56
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_119f62
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4320,16 +4320,16 @@
ld de, String_11a6aa
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 119f76
Function119f76: ; 119f76
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_119f82
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4340,7 +4340,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 119f98
@@ -4348,7 +4348,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_119fef
call ExitMenu
@@ -4385,7 +4385,7 @@
call ExitMenu
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
callba Function115dc3
ld a, $a
@@ -4504,12 +4504,12 @@
Function11a129: ; 11a129
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a131
Function11a131: ; 11a131
- ld hl, wcd44
+ ld hl, wMobileInactivityTimerMinutes
dec [hl]
ret nz
ld a, [wcd3c]
@@ -4541,16 +4541,16 @@
ld de, String_11a6f1
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a16d
Function11a16d: ; 11a16d
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a179
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4562,7 +4562,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a192
@@ -4570,7 +4570,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a1b6
call ExitMenu
@@ -4585,7 +4585,7 @@
.asm_11a1b6
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
ld [wcd80], a
call Function11a63c
@@ -4649,7 +4649,7 @@
ld a, $ed
ld [hl], a
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a235
@@ -4676,11 +4676,11 @@
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a24c
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 8
ld a, $ed
ld [hl], a
@@ -4693,11 +4693,11 @@
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a24c
inc a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 8
ld a, $7f
ld [hl], a
@@ -4711,12 +4711,12 @@
ld [wcd8a], a
ld [wcd8b], a
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a2c4
call ExitMenu
callba ReloadMapPart
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
cp $0
jr z, .asm_11a2b4
ld a, [wcd47]
@@ -4774,16 +4774,16 @@
ld de, String_11a71e
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a302
Function11a302: ; 11a302
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a30e
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4801,16 +4801,16 @@
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a33a
Function11a33a: ; 11a33a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a346
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4828,16 +4828,16 @@
ld de, String_11a743
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a36b
Function11a36b: ; 11a36b
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a377
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4848,7 +4848,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a38d
@@ -4856,7 +4856,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a3b1
call ExitMenu
@@ -4871,7 +4871,7 @@
.asm_11a3b1
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
ld [wcd80], a
scf
@@ -4884,16 +4884,16 @@
ld de, String_11a762
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a3d9
Function11a3d9: ; 11a3d9
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a3e5
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4903,16 +4903,16 @@
ld de, String_11a779
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a3f9
Function11a3f9: ; 11a3f9
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a405
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4923,7 +4923,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a41b
@@ -4931,7 +4931,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a43f
call ExitMenu
@@ -4959,7 +4959,7 @@
ld de, String_11a791
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a466
@@ -4969,16 +4969,16 @@
ld de, String_11a7c1
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a47a
Function11a47a: ; 11a47a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a486
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4994,7 +4994,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a49e
@@ -5002,7 +5002,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a4c7
call ExitMenu
@@ -5019,7 +5019,7 @@
.asm_11a4c7
call ExitMenu
callba ReloadMapPart
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
ld [wcf66], a
ld [wcd80], a
scf
@@ -5041,7 +5041,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a4fe
@@ -5049,7 +5049,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a522
call ExitMenu
@@ -5064,7 +5064,7 @@
.asm_11a522
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
ld [wcd80], a
scf
@@ -5102,11 +5102,11 @@
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a54d
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 7
ld a, $ed
ld [hl], a
@@ -5119,11 +5119,11 @@
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a54d
inc a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 7
ld a, $7f
ld [hl], a
@@ -5134,7 +5134,7 @@
.asm_11a5a2
ld a, $1
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
.asm_11a5a7
xor a
@@ -5308,7 +5308,7 @@
next "ちゅうし しますか?@"
; 11a7c1
-String_11a7c1: ; 11a7c1
+String_11a7c1: ; 11a7c1 ; new news?
db "あたらしい ニュースは"
next "ありません でした@"
; 11a7d7
--- a/misc/mobile_5b.asm
+++ b/misc/mobile_5b.asm
@@ -230,45 +230,7 @@
INCBIN "gfx/unknown/16c79b.tilemap"
UnknownMobilePalettes_16c903: ; 16c903
- RGB 31, 31, 31
- RGB 04, 10, 20
- RGB 16, 19, 25
- RGB 25, 27, 29
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
+INCLUDE "gfx/unknown/16c903.pal"
; 16c943
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -892,11 +892,11 @@
ld a, [hli]
ld [wcd43], a
ld a, [hli]
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
ld a, [hli]
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, [hli]
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, [hli]
and a
jr z, .asm_17d58a
@@ -2050,7 +2050,7 @@
push hl
pop bc
pop hl
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 17dd30
@@ -3420,16 +3420,16 @@
ret z
ld a, [wcd43]
ld l, a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
ld h, a
bccoord 0, 0
add hl, bc
ld bc, $ffec
add hl, bc
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld c, a
ld b, $0
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
call Function17e600
ld a, [wcd2e]
ld c, a
@@ -3453,7 +3453,7 @@
pop de
ld a, [wcd43]
ld l, a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
ld h, a
bccoord 0, 0
add hl, bc
--- a/wram.asm
+++ b/wram.asm
@@ -152,7 +152,7 @@
ds 1
wMonStatusFlags:: ds 1
-wc2cd:: ds 1
+wGameLogicPaused:: ds 1 ; c2cd
wSpriteUpdatesEnabled:: ds 1
wc2cf:: ds 1
wMapTimeOfDay:: ds 1
@@ -354,7 +354,9 @@
wMisc:: ; ds (SCREEN_WIDTH + 4) * (SCREEN_HEIGHT + 2)
ds 10
wc612::
- ds 10
+ ds 6
+wc618::
+ ds 4
wInitHourBuffer:: ; c61c
ds 10
wc626::
@@ -895,7 +897,7 @@
OverworldMapEnd::
ds OverworldMap - @
-wBillsPCPokemonList::
+wBillsPCPokemonList:: ; c800
; Pokemon, box number, list index
wMysteryGiftPartyTemp:: ; ds PARTY_LENGTH * (1 + 1 + NUM_MOVES)
@@ -1131,8 +1133,12 @@
wcd33:: ds 1
wcd34:: ds 1
wcd35:: ds 1
-wcd36:: ds 2
-wcd38:: ds 1
+
+; current time for link/mobile?
+wcd36:: ds 1 ; hours
+wcd37:: ds 1 ; mins
+wcd38:: ds 1 ; secs
+
wcd39:: ds 1
wcd3a:: ds 1
wcd3b:: ds 1
@@ -1144,9 +1150,12 @@
wcd41:: ds 1
wcd42:: ds 1
wcd43:: ds 1
-wcd44:: ds 1
-wcd45:: ds 1
-wcd46:: ds 1
+
+; some sort of timer in link battles
+wMobileInactivityTimerMinutes:: ds 1 ; mins
+wMobileInactivityTimerSeconds:: ds 1 ; secs
+wMobileInactivityTimerFrames:: ds 1 ; frames
+
wcd47:: ds 1
BGMapPalBuffer:: ; cd48
@@ -1163,6 +1172,7 @@
wcd50:: ds 1
wcd51:: ds 1
wcd52:: ds 1
+wMobileOpponentBattleMessage:: ; dc $c
wcd53:: ds 1
wcd54:: ds 1
wcd55:: ds 1
@@ -1231,10 +1241,14 @@
wSGBPals:: ds 48 ; cda9
AttrMap:: ; cdd9
-; 20x18 grid of palettes for 8x8 tiles
+; 20x18 grid of bg tile attributes for 8x8 tiles
; read horizontally from the top row
-; bit 3: vram bank
-; bit 0-2: palette id
+; bit 7: priority
+; bit 6: y flip
+; bit 5: x flip
+; bit 4: pal # (non-cgb)
+; bit 3: vram bank (cgb only)
+; bit 2-0: pal # (cgb only)
ds SCREEN_WIDTH * SCREEN_HEIGHT
AttrMapEnd::
ds 1
@@ -3042,10 +3056,10 @@
w5_dc00:: ds $d
w5_dc0d:: ds 4
w5_dc11:: ds 9
-w5_dc1a:: ds $c
-w5_dc26:: ds $c
-w5_dc32:: ds $c
-w5_dc3e:: ds $c
+w5_MobileOpponentBattleMessages:: ds $c ; dc1a
+w5_MobileOpponentBattleStartMessage:: ds $c ; dc26
+w5_MobileOpponentBattleWinMessage:: ds $c ; dc32
+w5_MobileOpponentBattleLossMessage:: ds $c ; dc3e
SECTION "WRAM 6", WRAMX, BANK [6]