ref: 748d4249805c19399b3c72c0f60d0f1a6ffe43ad
parent: 60ffde3752d079d557dab9a8acecb0bc9e5d46aa
parent: 9a1ae1332cd98abd65c2f26a1ae4d65c6450530a
author: yenatch <yenatch@gmail.com>
date: Thu Jul 26 17:25:12 EDT 2018
Merge pull request #544 from Rangi42/master Various fixes found while writing tutorials
--- a/constants/battle_constants.asm
+++ b/constants/battle_constants.asm
@@ -63,7 +63,7 @@
const STAT_SATK
NUM_EXP_STATS EQU const_value + -1
const STAT_SDEF
-NUM_STATS EQU const_value
+NUM_STATS EQU const_value +- 1
STAT_SPC EQU STAT_SATK
; stat formula constants
--- a/constants/gfx_constants.asm
+++ b/constants/gfx_constants.asm
@@ -49,6 +49,6 @@
const ANIM_MON_TRADE
const ANIM_MON_EVOLVE
const ANIM_MON_HATCH
- const ANIM_MON_UNUSED
+ const ANIM_MON_HOF
const ANIM_MON_EGG1
const ANIM_MON_EGG2
--- a/data/events/odd_eggs.asm
+++ b/data/events/odd_eggs.asm
@@ -94,7 +94,7 @@
bigdw 0
bigdw 0
bigdw 0
- db $0, $0 ; DVs
+ dn 0, 0, 0, 0 ; DVs
db 35, 20, 10, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@@ -146,7 +146,7 @@
bigdw 0
bigdw 0
bigdw 0
- db $0, $0 ; DVs
+ dn 0, 0, 0, 0 ; DVs
db 15, 20, 10, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@@ -198,7 +198,7 @@
bigdw 0
bigdw 0
bigdw 0
- db $0, $0 ; DVs
+ dn 0, 0, 0, 0 ; DVs
db 35, 30, 10, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@@ -250,7 +250,7 @@
bigdw 0
bigdw 0
bigdw 0
- db $0, $0 ; DVs
+ dn 0, 0, 0, 0 ; DVs
db 25, 10, 0, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@@ -302,7 +302,7 @@
bigdw 0
bigdw 0
bigdw 0
- db $0, $0 ; DVs
+ dn 0, 0, 0, 0 ; DVs
db 30, 30, 10, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
@@ -354,7 +354,7 @@
bigdw 0
bigdw 0
bigdw 0
- db $0, $0 ; DVs
+ dn 0, 0, 0, 0 ; DVs
db 35, 10, 0, 0 ; PP
db 20 ; Happiness
db 0, 0, 0 ; Pokerus, Caught data
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -530,7 +530,7 @@
ld de, wBattleMonSpeed
ld hl, wEnemyMonSpeed
ld c, 2
- call StringCmp
+ call CompareBytes
jr z, .speed_tie
jp nc, .player_first
jp .enemy_first
@@ -3715,19 +3715,19 @@
inc a
ld [wNumFleeAttempts], a
ld a, [hli]
- ld [hStringCmpString2 + 0], a
+ ld [hPartyMon1Speed + 0], a
ld a, [hl]
- ld [hStringCmpString2 + 1], a
+ ld [hPartyMon1Speed + 1], a
ld a, [de]
inc de
- ld [hStringCmpString1 + 0], a
+ ld [hEnemyMonSpeed + 0], a
ld a, [de]
- ld [hStringCmpString1 + 1], a
+ ld [hEnemyMonSpeed + 1], a
call Call_LoadTempTileMapToTileMap
- ld de, hStringCmpString2
- ld hl, hStringCmpString1
- ld c, $2
- call StringCmp
+ ld de, hPartyMon1Speed
+ ld hl, hEnemyMonSpeed
+ ld c, 2
+ call CompareBytes
jr nc, .can_escape
xor a
@@ -3739,9 +3739,9 @@
ld [hDividend + 0], a
ld a, [hProduct + 3]
ld [hDividend + 1], a
- ld a, [hStringCmpString1 + 0]
+ ld a, [hEnemyMonSpeed + 0]
ld b, a
- ld a, [hStringCmpString1 + 1]
+ ld a, [hEnemyMonSpeed + 1]
srl b
rr a
srl b
@@ -7113,7 +7113,7 @@
push bc
call LoadTileMapToTempTileMap
pop bc
- ld hl, MON_STAT_EXP - 1
+ ld hl, MON_EXP + 2
add hl, bc
ld d, [hl]
ld a, [hQuotient + 2]
@@ -7145,7 +7145,7 @@
ld d, MAX_LEVEL
callfar CalcExpAtLevel
pop bc
- ld hl, MON_STAT_EXP - 1
+ ld hl, MON_EXP + 2
add hl, bc
push bc
ld a, [hQuotient]
@@ -8712,7 +8712,7 @@
push de
ld bc, 12
ld de, wStringBuffer1
- call CompareLong
+ call CompareBytesLong
pop de
pop hl
jr c, .done
@@ -8821,7 +8821,7 @@
pop hl
push bc
ld c, 3
- call StringCmp
+ call CompareBytes
pop bc
jr z, .equal
jr nc, .done2
@@ -9094,7 +9094,7 @@
jr .skip_cry ; cry is played during the animation
.cry_no_anim
- ld a, $0f
+ ld a, $f
ld [wCryTracks], a
ld a, [wTempEnemyMonSpecies]
call PlayStereoCry
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -6154,7 +6154,7 @@
push de
push bc
ld c, 2
- call StringCmp
+ call CompareBytes
pop bc
pop de
pop hl
@@ -6573,7 +6573,7 @@
; Don't bother healing if HP is already full.
push bc
- call StringCmp
+ call CompareBytes
pop bc
jr z, .Full
--- a/engine/battle/move_effects/false_swipe.asm
+++ b/engine/battle/move_effects/false_swipe.asm
@@ -13,7 +13,7 @@
ld c, 2
push hl
push de
- call StringCmp
+ call CompareBytes
pop de
pop hl
jr c, .done
--- a/engine/events/bug_contest/judging.asm
+++ b/engine/events/bug_contest/judging.asm
@@ -171,7 +171,7 @@
ld de, wBugContestTempScore
ld hl, wBugContestFirstPlaceScore
ld c, 2
- call StringCmp
+ call CompareBytes
jr c, .not_first_place
ld hl, wBugContestSecondPlaceWinnerID
ld de, wBugContestThirdPlaceWinnerID
@@ -189,7 +189,7 @@
ld de, wBugContestTempScore
ld hl, wBugContestSecondPlaceScore
ld c, 2
- call StringCmp
+ call CompareBytes
jr c, .not_second_place
ld hl, wBugContestSecondPlaceWinnerID
ld de, wBugContestThirdPlaceWinnerID
@@ -203,7 +203,7 @@
ld de, wBugContestTempScore
ld hl, wBugContestThirdPlaceScore
ld c, 2
- call StringCmp
+ call CompareBytes
jr c, .done
ld hl, wBugContestThirdPlaceWinnerID
call CopyTempContestant
--- a/engine/events/halloffame.asm
+++ b/engine/events/halloffame.asm
@@ -124,7 +124,7 @@
call PlaceString
call WaitBGMap
decoord 6, 5
- ld c, $6
+ ld c, ANIM_MON_HOF
predef HOF_AnimateFrontpic
ld c, 60
call DelayFrames
@@ -390,7 +390,7 @@
call GetSGBLayout
call SetPalettes
decoord 6, 5
- ld c, $6
+ ld c, ANIM_MON_HOF
predef HOF_AnimateFrontpic
and a
ret
--- a/engine/events/magikarp.asm
+++ b/engine/events/magikarp.asm
@@ -36,7 +36,7 @@
ld hl, wMagikarpLength
ld de, wBestMagikarpLengthFeet
ld c, 2
- call StringCmp
+ call CompareBytes
jr nc, .not_long_enough
; NEW RECORD!!! Let's save that.
--- a/engine/events/pokecenter_pc.asm
+++ b/engine/events/pokecenter_pc.asm
@@ -478,7 +478,7 @@
push af
ld a, [wBuffer2]
push af
- call .DepositItem_
+ call .DepositItem
pop af
ld [wBuffer2], a
pop af
@@ -485,7 +485,7 @@
ld [wBuffer1], a
ret
-.DepositItem_:
+.DepositItem:
farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
@@ -492,7 +492,7 @@
jr z, .AskQuantity
ld a, $1
ld [wItemQuantityChangeBuffer], a
- jr .DepositItem
+ jr .ContinueDeposit
.AskQuantity:
ld hl, .HowManyText
@@ -504,7 +504,7 @@
pop af
jr c, .DeclinedToDeposit
-.DepositItem:
+.ContinueDeposit:
ld a, [wItemQuantityChangeBuffer]
ld [wBuffer1], a
ld a, [wCurItemQuantity]
--- a/engine/gfx/cgb_layouts.asm
+++ b/engine/gfx/cgb_layouts.asm
@@ -266,7 +266,7 @@
jr .got_palette
.is_pokemon
- call GetMonPalettePointer_
+ call GetMonPalettePointer
call LoadPalette_White_Col1_Col2_Black ; mon palette
.got_palette
call WipeAttrMap
@@ -352,7 +352,7 @@
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [wCurPartySpecies]
- call GetMonPalettePointer_
+ call GetMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
call WipeAttrMap
hlcoord 7, 5, wAttrMap
@@ -914,7 +914,7 @@
_CGB1e:
ld de, wBGPals1
ld a, [wCurPartySpecies]
- call GetMonPalettePointer_
+ call GetMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
call WipeAttrMap
call ApplyAttrMap
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -94,9 +94,9 @@
ld a, d
ld [wSGBPals + 6], a
ld hl, wSGBPals
- call PushSGBPals_
+ call PushSGBPals
ld hl, BlkPacket_9a86
- call PushSGBPals_
+ call PushSGBPals
ret
InitPartyMenuPalettes:
@@ -173,7 +173,7 @@
and a
ret z
ld hl, BlkPacket_9a86
- jp PushSGBPals_
+ jp PushSGBPals
Unreferenced_Function8b4d:
call CheckCGB
@@ -182,7 +182,7 @@
and a
ret z
ld hl, PalPacket_BetaIntroVenusaur
- jp PushSGBPals_
+ jp PushSGBPals
.cgb
ld de, wOBPals1
@@ -197,7 +197,7 @@
and a
ret z
ld hl, PalPacket_Pack
- jp PushSGBPals_
+ jp PushSGBPals
.cgb
ld de, wOBPals1
@@ -218,7 +218,7 @@
ld bc, PALPACKET_LENGTH
call CopyBytes
pop af
- call GetMonPalettePointer_
+ call GetMonPalettePointer
ld a, [hli]
ld [wSGBPals + 3], a
ld a, [hli]
@@ -228,12 +228,12 @@
ld a, [hl]
ld [wSGBPals + 6], a
ld hl, wSGBPals
- jp PushSGBPals_
+ jp PushSGBPals
.cgb
ld de, wOBPals1
ld a, c
- call GetMonPalettePointer_
+ call GetMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
ret
@@ -245,7 +245,7 @@
LoadMonPaletteAsNthBGPal:
ld a, [wCurPartySpecies]
- call GetMonPalettePointer
+ call _GetMonPalettePointer
ld a, e
bit 7, a
jr z, got_palette_pointer_8bd7
@@ -278,7 +278,7 @@
and a
jr nz, .cgb
ld hl, wPlayerLightScreenCount
- jp PushSGBPals_
+ jp PushSGBPals
.cgb
ld a, [wEnemyLightScreenCount] ; col
@@ -310,7 +310,7 @@
and a
jr z, .get_trainer
ld a, [wCurPartySpecies]
- call GetMonPalettePointer_
+ call GetMonPalettePointer
jr .load_palettes
.get_trainer
@@ -426,9 +426,9 @@
ld a, [hli]
ld [wSGBPals + 6], a
ld hl, wSGBPals
- call PushSGBPals_
+ call PushSGBPals
ld hl, BlkPacket_9a86
- call PushSGBPals_
+ call PushSGBPals
ret
.cgb
@@ -732,8 +732,8 @@
add hl, bc
ret
-GetMonPalettePointer_:
- call GetMonPalettePointer
+GetMonPalettePointer:
+ call _GetMonPalettePointer
ret
Unreferenced_Function9779:
@@ -781,7 +781,7 @@
jr nz, .loop
ret
-GetMonPalettePointer:
+_GetMonPalettePointer:
ld l, a
ld h, $0
add hl, hl
@@ -793,7 +793,7 @@
GetMonNormalOrShinyPalettePointer:
push bc
- call GetMonPalettePointer
+ call _GetMonPalettePointer
pop bc
push hl
call CheckShininess
@@ -804,17 +804,17 @@
endr
ret
-PushSGBPals_:
+PushSGBPals:
ld a, [wcfbe]
push af
set 7, a
ld [wcfbe], a
- call PushSGBPals
+ call _PushSGBPals
pop af
ld [wcfbe], a
ret
-PushSGBPals:
+_PushSGBPals:
ld a, [hl]
and $7
ret z
@@ -878,7 +878,7 @@
call SGBDelayCycles
call SGB_ClearVRAM
ld hl, MaskEnCancelPacket
- call PushSGBPals
+ call _PushSGBPals
.skip
pop af
@@ -950,7 +950,7 @@
push hl
ld h, [hl]
ld l, a
- call PushSGBPals
+ call _PushSGBPals
pop hl
inc hl
pop bc
@@ -974,12 +974,12 @@
xor a
ld [rJOYP], a
ld hl, MaskEnFreezePacket
- call PushSGBPals
+ call _PushSGBPals
call PushSGBBorder
call SGBDelayCycles
call SGB_ClearVRAM
ld hl, MaskEnCancelPacket
- call PushSGBPals
+ call _PushSGBPals
ei
ret
@@ -1005,7 +1005,7 @@
PushSGBBorderPalsAndWait:
ld hl, MltReq2Packet
- call PushSGBPals
+ call _PushSGBPals
call SGBDelayCycles
ld a, [rJOYP]
and $3
@@ -1050,7 +1050,7 @@
.FinalPush:
ld hl, MltReq1Packet
- call PushSGBPals
+ call _PushSGBPals
jp SGBDelayCycles
SGBBorder_PushBGPals:
@@ -1065,7 +1065,7 @@
ld a, LCDC_DEFAULT
ld [rLCDC], a
ld hl, PalTrnPacket
- call PushSGBPals
+ call _PushSGBPals
xor a
ld [rBGP], a
ret
@@ -1099,7 +1099,7 @@
ld a, LCDC_DEFAULT
ld [rLCDC], a
ld hl, PctTrnPacket
- call PushSGBPals
+ call _PushSGBPals
xor a
ld [rBGP], a
ret
@@ -1123,7 +1123,7 @@
ld a, LCDC_DEFAULT
ld [rLCDC], a
ld hl, ChrTrnPacket
- call PushSGBPals
+ call _PushSGBPals
xor a
ld [rBGP], a
ret
--- a/engine/gfx/crystal_layouts.asm
+++ b/engine/gfx/crystal_layouts.asm
@@ -284,7 +284,7 @@
call ByteFill
ret
-LoadTradeRoomBGPals:
+_LoadTradeRoomBGPals:
ld hl, TradeRoomPalette
ld de, wBGPals1 palette PAL_BG_GREEN
ld bc, 6 palettes
--- a/engine/gfx/pic_animation.asm
+++ b/engine/gfx/pic_animation.asm
@@ -40,8 +40,8 @@
call AnimateFrontpic
ret
-AnimateMon_Unused:
- ld e, ANIM_MON_UNUSED
+AnimateMon_HOF:
+ ld e, ANIM_MON_HOF
ld d, $0
call AnimateFrontpic
ret
@@ -59,6 +59,7 @@
ENDM
PokeAnims:
+; entries correspond to ANIM_MON_* constants
dw .Slow
dw .Normal
dw .Menu
@@ -65,7 +66,7 @@
dw .Trade
dw .Evolve
dw .Hatch
- dw .Unused ; same as .Menu
+ dw .HOF
dw .Egg1
dw .Egg2
@@ -75,7 +76,7 @@
.Trade: pokeanim Idle, Play2, Idle, Play, SetWait, Wait, Cry, Setup, Play
.Evolve: pokeanim Idle, Play, SetWait, Wait, CryNoWait, Setup, Play
.Hatch: pokeanim Idle, Play, CryNoWait, Setup, Play, SetWait, Wait, Idle, Play
-.Unused: pokeanim CryNoWait, Setup, Play, SetWait, Wait, Idle, Play
+.HOF: pokeanim CryNoWait, Setup, Play, SetWait, Wait, Idle, Play
.Egg1: pokeanim Setup, Play
.Egg2: pokeanim Idle, Play
@@ -108,7 +109,7 @@
SetUpPokeAnim:
ld a, [rSVBK]
push af
- ld a, BANK(wPokeAnimSceneIndex)
+ ld a, BANK(wPokeAnimStruct)
ld [rSVBK], a
ld a, [wPokeAnimSceneIndex]
ld c, a
@@ -283,14 +284,14 @@
PokeAnim_InitPicAttributes:
ld a, [rSVBK]
push af
- ld a, BANK(wPokeAnimSceneIndex)
+ ld a, BANK(wPokeAnimStruct)
ld [rSVBK], a
push bc
push de
push hl
- ld hl, wPokeAnimSceneIndex
- ld bc, wPokeAnimStructEnd - wPokeAnimSceneIndex
+ ld hl, wPokeAnimStruct
+ ld bc, wPokeAnimStructEnd - wPokeAnimStruct
xor a
call ByteFill
pop hl
--- a/engine/gfx/sgb_layouts.asm
+++ b/engine/gfx/sgb_layouts.asm
@@ -61,7 +61,7 @@
.SGB_BattleColors:
ld hl, BlkPacket_Battle
- call PushSGBPals_
+ call PushSGBPals
ld hl, PalPacket_9ce6
ld de, wSGBPals
@@ -210,7 +210,7 @@
inc hl
ld [hl], HIGH(palred 26 + palgreen 10 + palblue 6)
ld a, [wCurPartySpecies]
- call GetMonPalettePointer_
+ call GetMonPalettePointer
ld a, [hli]
ld [wSGBPals + 9], a
ld a, [hli]
@@ -566,6 +566,6 @@
_LoadSGBLayout_ReturnFromJumpTable:
push de
- call PushSGBPals_
+ call PushSGBPals
pop hl
- jp PushSGBPals_
+ jp PushSGBPals
--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -1971,7 +1971,7 @@
ret
SetTradeRoomBGPals:
- farcall LoadTradeRoomBGPals_ ; just a nested farcall; so wasteful
+ farcall LoadTradeRoomBGPals ; just a nested farcall; so wasteful
call SetPalettes
ret
--- a/engine/link/link_trade.asm
+++ b/engine/link/link_trade.asm
@@ -133,8 +133,8 @@
call Get2bpp
ret
-LoadTradeRoomBGPals_:
- farcall LoadTradeRoomBGPals
+LoadTradeRoomBGPals:
+ farcall _LoadTradeRoomBGPals
ret
Function16d6ae:
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -164,7 +164,7 @@
ret
SaveGameData:
- call SaveGameData_
+ call _SaveGameData
ret
AskOverwriteSaveFile:
@@ -228,7 +228,7 @@
_SavingDontTurnOffThePower:
call SavingDontTurnOffThePower
SavedTheGame:
- call SaveGameData_
+ call _SaveGameData
; wait 32 frames
ld c, $20
call DelayFrames
@@ -252,7 +252,7 @@
call DelayFrames
ret
-SaveGameData_:
+_SaveGameData:
ld a, TRUE
ld [wSaveFileExists], a
farcall StageRTCTimeForSave
--- a/engine/menus/start_menu.asm
+++ b/engine/menus/start_menu.asm
@@ -29,7 +29,7 @@
call .SetUpMenuItems
ld a, [wBattleMenuCursorBuffer]
ld [wMenuCursorBuffer], a
- call .DrawMenuAccount_
+ call .DrawMenuAccount
call DrawVariableLengthMenuBox
call .DrawBugContestStatusBox
call SafeUpdateSprites
@@ -49,7 +49,7 @@
.Select:
call .GetInput
jr c, .Exit
- call .DrawMenuAccount
+ call ._DrawMenuAccount
ld a, [wMenuCursorBuffer]
ld [wBattleMenuCursorBuffer], a
call PlayClickSFX
@@ -96,7 +96,7 @@
; Return carry on exit, and no-carry on selection.
xor a
ld [hBGMapMode], a
- call .DrawMenuAccount
+ call ._DrawMenuAccount
call SetUpMenu
ld a, $ff
ld [wMenuSelection], a
@@ -147,7 +147,7 @@
call ClearBGPalettes
call Call_ExitMenu
call ReloadTilesetAndPalettes
- call .DrawMenuAccount_
+ call .DrawMenuAccount
call DrawVariableLengthMenuBox
call .DrawBugContestStatus
call UpdateSprites
@@ -360,17 +360,17 @@
inc c
ret
-.DrawMenuAccount_:
- jp .DrawMenuAccount
+.DrawMenuAccount:
+ jp ._DrawMenuAccount
.PrintMenuAccount:
call .IsMenuAccountOn
ret z
- call .DrawMenuAccount
+ call ._DrawMenuAccount
decoord 0, 14
jp .MenuDesc
-.DrawMenuAccount:
+._DrawMenuAccount:
call .IsMenuAccountOn
ret z
hlcoord 0, 13
--- a/engine/pokemon/evolve.asm
+++ b/engine/pokemon/evolve.asm
@@ -99,7 +99,7 @@
ld de, wTempMonAttack
ld hl, wTempMonDefense
ld c, 2
- call StringCmp
+ call CompareBytes
ld a, ATK_EQ_DEF
jr z, .got_tyrogue_evo
ld a, ATK_LT_DEF
--- a/engine/pokemon/mail_2.asm
+++ b/engine/pokemon/mail_2.asm
@@ -59,7 +59,7 @@
.pressed_start
ld a, [wJumptableIndex]
push af
- callfar PrintMail ; printer
+ callfar PrintMailAndExit ; printer
pop af
ld [wJumptableIndex], a
jr .loop
--- a/engine/printer/printer.asm
+++ b/engine/printer/printer.asm
@@ -268,12 +268,12 @@
ld [wPrinterQueueLength], a
ret
-PrintMail:
- call PrintMail_
+PrintMailAndExit:
+ call PrintMail
call Printer_ExitPrinter
ret
-PrintMail_:
+PrintMail:
ld a, [wPrinterQueueLength]
push af
xor a
--- a/engine/printer/printer_serial.asm
+++ b/engine/printer/printer_serial.asm
@@ -44,14 +44,14 @@
dw Printer_WaitUntilFinished ; 0c
dw Printer_Quit ; 0d
- dw Printer_NextSection_ ; 0e
+ dw Printer_NextSection ; 0e
dw Printer_WaitSerial ; 0f
dw Printer_SignalLoopBack ; 10
dw Printer_SectionOne ; 11
- dw Printer_WaitLoopBack ; 12
- dw Printer_WaitLoopBack_ ; 13
+ dw Printer_NextSectionWaitLoopBack ; 12
+ dw Printer_WaitLoopBack ; 13
-Printer_NextSection:
+_Printer_NextSection:
ld hl, wJumptableIndex
inc [hl]
ret
@@ -68,8 +68,8 @@
set 7, [hl]
ret
-Printer_NextSection_:
- call Printer_NextSection
+Printer_NextSection:
+ call _Printer_NextSection
ret
Printer_SectionOne:
@@ -86,7 +86,7 @@
ld [wPrinterSendByteCounter + 1], a
ld a, [wPrinterQueueLength]
ld [wPrinterRowIndex], a
- call Printer_NextSection
+ call _Printer_NextSection
call Printer_WaitHandshake
ld a, PRINTER_STATUS_CHECKING
ld [wPrinterStatus], a
@@ -110,7 +110,7 @@
ld [wPrinterSendByteCounter + 1], a
; compute the checksum
call Printer_ComputeChecksum
- call Printer_NextSection
+ call _Printer_NextSection
call Printer_WaitHandshake
ld a, PRINTER_STATUS_TRANSMITTING
ld [wPrinterStatus], a
@@ -127,7 +127,7 @@
xor a
ld [wPrinterSendByteCounter], a
ld [wPrinterSendByteCounter + 1], a
- call Printer_NextSection
+ call _Printer_NextSection
call Printer_WaitHandshake
ret
@@ -143,7 +143,7 @@
ld [wPrinterSendByteCounter + 1], a
; compute the checksum
call Printer_ComputeChecksum
- call Printer_NextSection
+ call _Printer_NextSection
call Printer_WaitHandshake
ld a, PRINTER_STATUS_PRINTING
ld [wPrinterStatus], a
@@ -160,7 +160,7 @@
ld [wPrinterSendByteCounter + 1], a
ld a, [wPrinterQueueLength]
ld [wPrinterRowIndex], a
- call Printer_NextSection
+ call _Printer_NextSection
call Printer_WaitHandshake
ret
@@ -172,7 +172,7 @@
ret c
xor a
ld [hl], a
- call Printer_NextSection
+ call _Printer_NextSection
ret
Printer_WaitSerialAndLoopBack2:
@@ -211,7 +211,7 @@
set 1, [hl]
ld a, $5
ld [wHandshakeFrameDelay], a
- call Printer_NextSection
+ call _Printer_NextSection
ret
.printer_error
@@ -232,7 +232,7 @@
ld a, [wPrinterStatusFlags]
and $1
jr nz, .cycle_back
- call Printer_NextSection
+ call _Printer_NextSection
ret
.cycle_back
@@ -240,7 +240,7 @@
ret
.enter_wait_loop
- ld a, $12 ; Printer_WaitLoopBack
+ ld a, $12 ; Printer_NextSectionWaitLoopBack
ld [wJumptableIndex], a
ret
@@ -251,12 +251,12 @@
ld a, [wPrinterStatusFlags]
and $f3
ret nz
- call Printer_NextSection
+ call _Printer_NextSection
ret
+Printer_NextSectionWaitLoopBack:
+ call _Printer_NextSection
Printer_WaitLoopBack:
- call Printer_NextSection
-Printer_WaitLoopBack_:
ld a, [wPrinterOpcode]
and a
ret nz
@@ -474,31 +474,31 @@
dw Printer_SendNextByte ; 06
dw Printer_SendwPrinterChecksumLo ; 07
dw Printer_SendwPrinterChecksumHi ; 08
- dw Printer_Send0x00 ; 09
- dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 0a
- dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop ; 0b
+ dw Printer_Send0x00_2 ; 09
+ dw Printer_ReceiveTwoPrinterHandshakeAndSend0x00 ; 0a
+ dw Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop ; 0b
dw Printer_Send0x33 ; 0c triggered by AskSerial
dw Printer_Send0x0f ; 0d
- dw Printer_Send0x00_ ; 0e
- dw Printer_Send0x00_ ; 0f
- dw Printer_Send0x00_ ; 10
+ dw Printer_Send0x00 ; 0e
+ dw Printer_Send0x00 ; 0f
+ dw Printer_Send0x00 ; 10
dw Printer_Send0x0f ; 11
- dw Printer_Send0x00_ ; 12
- dw Printer_Send0x00 ; 13
- dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 14
- dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop_ ; 15
+ dw Printer_Send0x00 ; 12
+ dw Printer_Send0x00_2 ; 13
+ dw Printer_ReceiveTwoPrinterHandshakeAndSend0x00 ; 14
+ dw Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop_2 ; 15
dw Printer_Send0x33 ; 16 triggered by pressing B
dw Printer_Send0x08 ; 17
- dw Printer_Send0x00_ ; 18
- dw Printer_Send0x00_ ; 19
- dw Printer_Send0x00_ ; 1a
+ dw Printer_Send0x00 ; 18
+ dw Printer_Send0x00 ; 19
+ dw Printer_Send0x00 ; 1a
dw Printer_Send0x08 ; 1b
- dw Printer_Send0x00_ ; 1c
- dw Printer_Send0x00 ; 1d
- dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 1e
- dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop ; 1f
+ dw Printer_Send0x00 ; 1c
+ dw Printer_Send0x00_2 ; 1d
+ dw Printer_ReceiveTwoPrinterHandshakeAndSend0x00 ; 1e
+ dw Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop ; 1f
Printer_NextInstruction:
ld hl, wPrinterOpcode
@@ -580,13 +580,14 @@
call Printer_NextInstruction
ret
-Printer_Send0x00:
+Printer_Send0x00_2:
+; identical to Printer_Send0x00, but referenced less
ld a, $0
call Printer_SerialSend
call Printer_NextInstruction
ret
-Printer_ReceiveTowPrinterHandshakeAndSend0x00:
+Printer_ReceiveTwoPrinterHandshakeAndSend0x00:
ld a, [rSB]
ld [wPrinterHandshake], a
ld a, $0
@@ -594,7 +595,7 @@
call Printer_NextInstruction
ret
-Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop:
+Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop:
ld a, [rSB]
ld [wPrinterStatusFlags], a
xor a
@@ -607,7 +608,7 @@
call Printer_NextInstruction
ret
-Printer_Send0x00_:
+Printer_Send0x00:
ld a, $0
call Printer_SerialSend
call Printer_NextInstruction
@@ -627,7 +628,8 @@
ld [rSC], a
ret
-Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop_:
+Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop_2:
+; identical to Printer_ReceiveTwoPrinterStatusFlagsAndExitSendLoop, but referenced less
ld a, [rSB]
ld [wPrinterStatusFlags], a
xor a
--- a/home.asm
+++ b/home.asm
@@ -162,55 +162,8 @@
rst Bankswitch
ret
-QueueScript::
-; Push pointer hl in the current bank to wQueuedScriptBank.
- ld a, [hROMBank]
-
-FarQueueScript::
-; Push pointer a:hl to wQueuedScriptBank.
- ld [wQueuedScriptBank], a
- ld a, l
- ld [wQueuedScriptAddr], a
- ld a, h
- ld [wQueuedScriptAddr + 1], a
- ret
-
-StringCmp::
-; Compare c bytes at de and hl.
-; Return z if they all match.
-.loop
- ld a, [de]
- cp [hl]
- ret nz
- inc de
- inc hl
- dec c
- jr nz, .loop
- ret
-
-CompareLong::
-; Compare bc bytes at de and hl.
-; Return carry if they all match.
-
- ld a, [de]
- cp [hl]
- jr nz, .Diff
-
- inc de
- inc hl
- dec bc
-
- ld a, b
- or c
- jr nz, CompareLong
-
- scf
- ret
-
-.Diff:
- and a
- ret
-
+INCLUDE "home/queue_script.asm"
+INCLUDE "home/compare.asm"
INCLUDE "home/tilemap.asm"
INCLUDE "home/hp_pals.asm"
--- /dev/null
+++ b/home/compare.asm
@@ -1,0 +1,35 @@
+CompareBytes::
+; Compare c bytes at de and hl.
+; Return z if they all match.
+.loop
+ ld a, [de]
+ cp [hl]
+ ret nz
+ inc de
+ inc hl
+ dec c
+ jr nz, .loop
+ ret
+
+CompareBytesLong::
+; Compare bc bytes at de and hl.
+; Return carry if they all match.
+.loop
+ ld a, [de]
+ cp [hl]
+ jr nz, .diff
+
+ inc de
+ inc hl
+ dec bc
+
+ ld a, b
+ or c
+ jr nz, .loop
+
+ scf
+ ret
+
+.diff:
+ and a
+ ret
--- /dev/null
+++ b/home/queue_script.asm
@@ -1,0 +1,12 @@
+QueueScript::
+; Push pointer hl in the current bank to wQueuedScriptBank.
+ ld a, [hROMBank]
+
+FarQueueScript::
+; Push pointer a:hl to wQueuedScriptBank.
+ ld [wQueuedScriptBank], a
+ ld a, l
+ ld [wQueuedScriptAddr], a
+ ld a, h
+ ld [wQueuedScriptAddr + 1], a
+ ret
--- a/hram.asm
+++ b/hram.asm
@@ -48,8 +48,8 @@
hPastLeadingZeroes EQU $ffb3
-hStringCmpString1 EQU $ffb1
-hStringCmpString2 EQU $ffb5
+hEnemyMonSpeed EQU $ffb1
+hPartyMon1Speed EQU $ffb5
hDividend EQU $ffb3 ; length in b register, before 'call Divide' (max 4 bytes)
hDivisor EQU $ffb7 ; 1 byte long
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -2063,7 +2063,7 @@
ld [rSVBK], a
call SetPalettes
- farcall PrintMail_
+ farcall PrintMail
call Mobile22_SetBGMapMode1
ld c, 24
call DelayFrames
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -2967,7 +2967,7 @@
ENDM
IncCrashCheckPointer_SaveGameData:
- inc_crash_check_pointer_farcall SaveGameData_
+ inc_crash_check_pointer_farcall _SaveGameData
IncCrashCheckPointer_SaveAfterLinkTrade:
inc_crash_check_pointer_farcall SaveAfterLinkTrade
--- a/wram.asm
+++ b/wram.asm
@@ -2893,6 +2893,7 @@
ds SCREEN_WIDTH * SCREEN_HEIGHT ; $168 = 360
; PokeAnim data
+wPokeAnimStruct::
wPokeAnimSceneIndex:: db
wPokeAnimPointer:: dw
wPokeAnimSpecies:: db
@@ -2901,7 +2902,6 @@
wPokeAnimGraphicStartTile:: db
wPokeAnimCoord:: dw
wPokeAnimFrontpicHeight:: db
-; PokeAnim Data
wPokeAnimIdleFlag:: db
wPokeAnimSpeed:: db
wPokeAnimPointerBank:: db