From 6220200f0f223a4077fcc716c105c01f3e1d3691 Mon Sep 17 00:00:00 2001 From: Rangi Date: Sun, 1 Nov 2020 12:36:38 -0500 Subject: [PATCH] Identify some more labels, and make some more consistent --- data/text/common_2.asm | 10 ++-- engine/battle/core.asm | 38 ++++++------ engine/battle/read_trainer_party.asm | 3 +- engine/events/battle_tower/battle_tower.asm | 2 +- engine/events/battle_tower/load_trainer.asm | 6 +- engine/events/battle_tower/rules.asm | 22 +++---- engine/games/unown_puzzle.asm | 2 +- engine/gfx/crystal_layouts.asm | 8 +-- engine/gfx/player_gfx.asm | 60 +++++++++---------- engine/link/link.asm | 13 ++-- engine/link/link_trade.asm | 29 +++++---- engine/menus/intro_menu.asm | 3 +- engine/menus/save.asm | 17 ++---- engine/movie/unused_title.asm | 6 +- engine/pokemon/mon_stats.asm | 6 +- ...llscreen.tilemap => border_mobile.tilemap} | 0 mobile/fixed_words.asm | 10 ++-- mobile/mobile_40.asm | 2 +- 18 files changed, 121 insertions(+), 116 deletions(-) rename gfx/trade/{border_mobile_fullscreen.tilemap => border_mobile.tilemap} (100%) diff --git a/data/text/common_2.asm b/data/text/common_2.asm index 09cd24e4d..927c0ffea 100644 --- a/data/text/common_2.asm +++ b/data/text/common_2.asm @@ -114,20 +114,20 @@ _ExpPointsText:: text " EXP. Points!" prompt -Text_GoMon:: +_GoMonText:: text "Go! @" text_end -Text_DoItMon:: +_DoItMonText:: text "Do it! @" text_end -Text_GoForItMon:: +_GoForItMonText:: text "Go for it," line "@" text_end -Text_YourFoesWeakGetmMon:: +_YourFoesWeakGetmMonText:: text "Your foe's weak!" line "Get'm, @" text_end @@ -137,7 +137,7 @@ _BattleMonNicknameText:: text "!" done -Text_BattleMonNickComma:: +_BattleMonNickCommaText:: text_ram wBattleMonNick text ",@" text_end diff --git a/engine/battle/core.asm b/engine/battle/core.asm index f84864a95..39e4e165b 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -7616,7 +7616,7 @@ SendOutMonText: and a jr z, .not_linked - ld hl, JumpText_GoMon ; If we're in a LinkBattle print just "Go " + ld hl, GoMonText ; If we're in a LinkBattle print just "Go " ld a, [wBattleHasJustStarted] ; unless this (unidentified) variable is set and a @@ -7627,7 +7627,7 @@ SendOutMonText: ld hl, wEnemyMonHP ld a, [hli] or [hl] - ld hl, JumpText_GoMon + ld hl, GoMonText jr z, .skip_to_textbox ; compute enemy helth remaining as a percentage @@ -7656,41 +7656,41 @@ SendOutMonText: call Divide ldh a, [hQuotient + 3] - ld hl, JumpText_GoMon + ld hl, GoMonText cp 70 jr nc, .skip_to_textbox - ld hl, JumpText_DoItMon + ld hl, DoItMonText cp 40 jr nc, .skip_to_textbox - ld hl, JumpText_GoForItMon + ld hl, GoForItMonText cp 10 jr nc, .skip_to_textbox - ld hl, JumpText_YourFoesWeakGetmMon + ld hl, YourFoesWeakGetmMonText .skip_to_textbox jp BattleTextbox -JumpText_GoMon: - text_far Text_GoMon +GoMonText: + text_far _GoMonText text_asm - jr Function_TextJump_BattleMonNick01 + jr PrepareBattleMonNicknameText -JumpText_DoItMon: - text_far Text_DoItMon +DoItMonText: + text_far _DoItMonText text_asm - jr Function_TextJump_BattleMonNick01 + jr PrepareBattleMonNicknameText -JumpText_GoForItMon: - text_far Text_GoForItMon +GoForItMonText: + text_far _GoForItMonText text_asm - jr Function_TextJump_BattleMonNick01 + jr PrepareBattleMonNicknameText -JumpText_YourFoesWeakGetmMon: - text_far Text_YourFoesWeakGetmMon +YourFoesWeakGetmMonText: + text_far _YourFoesWeakGetmMonText text_asm -Function_TextJump_BattleMonNick01: +PrepareBattleMonNicknameText: ld hl, BattleMonNicknameText ret @@ -7703,7 +7703,7 @@ WithdrawMonText: jp BattleTextbox .WithdrawMonText: - text_far Text_BattleMonNickComma + text_far _BattleMonNickCommaText text_asm ; Print text to withdraw mon ; depending on HP the message is different diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 1c1ff1c4b..cf7de20c6 100644 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -380,7 +380,8 @@ CopyTrainerName: pop de ret -Function39990: ; unreferenced +IncompleteCopyNameFunction: ; unreferenced +; Copy of CopyTrainerName but without "call CopyBytes" ld de, wStringBuffer1 push de ld bc, NAME_LENGTH diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index 0164ede48..50daff895 100644 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -1531,7 +1531,7 @@ BattleTowerAction_UbersCheck: ret LoadOpponentTrainerAndPokemonWithOTSprite: - farcall Function_LoadOpponentTrainerAndPokemons + farcall LoadOpponentTrainerAndPokemon ldh a, [rSVBK] push af ld a, BANK(wBT_OTTrainerClass) diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm index 165efb8dd..0368a1268 100644 --- a/engine/events/battle_tower/load_trainer.asm +++ b/engine/events/battle_tower/load_trainer.asm @@ -1,4 +1,4 @@ -Function_LoadOpponentTrainerAndPokemons: +LoadOpponentTrainerAndPokemon: ldh a, [rSVBK] push af ld a, BANK(wBT_OTTrainer) @@ -68,7 +68,7 @@ endc ld bc, NAME_LENGTH call CopyBytes - call Function_LoadRandomBattleTowerMon + call LoadRandomBattleTowerMon pop af ld hl, BattleTowerTrainerData @@ -91,7 +91,7 @@ endc ret -Function_LoadRandomBattleTowerMon: +LoadRandomBattleTowerMon: ld c, BATTLETOWER_PARTY_LENGTH .loop push bc diff --git a/engine/events/battle_tower/rules.asm b/engine/events/battle_tower/rules.asm index 54910c37d..7ffa9f67f 100644 --- a/engine/events/battle_tower/rules.asm +++ b/engine/events/battle_tower/rules.asm @@ -42,10 +42,10 @@ _CheckForBattleTowerRules: dw .TextPointers .Functions: - dw Function_PartyCountEq3 - dw Function_PartySpeciesAreUnique - dw Function_PartyItemsAreUnique - dw Function_HasPartyAnEgg + dw CheckBTRule_PartyCountEq3 + dw CheckBTRule_PartySpeciesAreUnique + dw CheckBTRule_PartyItemsAreUnique + dw CheckBTRule_HasPartyAnEgg .TextPointers: dw ExcuseMeYoureNotReadyText @@ -203,19 +203,19 @@ BattleTower_CheckPartyHasThreeMonsThatAreNotEggs: cp BATTLETOWER_PARTY_LENGTH ret -Function_PartyCountEq3: +CheckBTRule_PartyCountEq3: ld a, [wPartyCount] cp BATTLETOWER_PARTY_LENGTH ret z scf ret -Function_PartySpeciesAreUnique: +CheckBTRule_PartySpeciesAreUnique: ld hl, wPartyMon1Species - call VerifyUniqueness + call CheckPartyValueIsUnique ret -VerifyUniqueness: +CheckPartyValueIsUnique: ld de, wPartyCount ld a, [de] inc de @@ -276,12 +276,12 @@ VerifyUniqueness: pop bc ret -Function_PartyItemsAreUnique: +CheckBTRule_PartyItemsAreUnique: ld hl, wPartyMon1Item - call VerifyUniqueness + call CheckPartyValueIsUnique ret -Function_HasPartyAnEgg: +CheckBTRule_HasPartyAnEgg: ld hl, wPartyCount ld a, [hli] ld c, a diff --git a/engine/games/unown_puzzle.asm b/engine/games/unown_puzzle.asm index 48e36b899..c5db774b8 100644 --- a/engine/games/unown_puzzle.asm +++ b/engine/games/unown_puzzle.asm @@ -171,7 +171,7 @@ PlaceStartCancelBoxBorder: UnownPuzzleJumptable: jumptable .Jumptable, wJumptableIndex -.Jumptable: +.Jumptable: ; redundant one-entry jumptable dw .Function .Function: diff --git a/engine/gfx/crystal_layouts.asm b/engine/gfx/crystal_layouts.asm index caf4f4775..f77d420f3 100644 --- a/engine/gfx/crystal_layouts.asm +++ b/engine/gfx/crystal_layouts.asm @@ -150,11 +150,11 @@ _CrystalCGB_MobileLayout1: ld a, [wd002] bit 6, a jr z, .asm_49464 - call Function49480 + call .Function49480 jr .done .asm_49464 - call Function49496 + call .Function49496 .done farcall ApplyAttrmap farcall ApplyPals @@ -165,7 +165,7 @@ _CrystalCGB_MobileLayout1: .TextPalette: INCLUDE "gfx/mystery_gift/mobile_text.pal" -Function49480: +.Function49480: hlcoord 0, 0, wAttrmap lb bc, 4, SCREEN_WIDTH ld a, $7 @@ -177,7 +177,7 @@ Function49480: ld [hl], a ret -Function49496: +.Function49496: hlcoord 0, 0, wAttrmap lb bc, 2, SCREEN_WIDTH ld a, $7 diff --git a/engine/gfx/player_gfx.asm b/engine/gfx/player_gfx.asm index 149c0ef4a..ca53a644c 100644 --- a/engine/gfx/player_gfx.asm +++ b/engine/gfx/player_gfx.asm @@ -1,11 +1,10 @@ -Function88248: ; unreferenced +BetaLoadPlayerTrainerClass: ; unreferenced ld c, CAL ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a - jr z, .okay - ld c, KAREN - -.okay + jr z, .got_class + ld c, KAREN ; not KRIS? +.got_class ld a, c ld [wTrainerClass], a ret @@ -59,9 +58,9 @@ ShowPlayerNamingChoices: ld hl, ChrisNameMenuHeader ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a - jr z, .GotGender + jr z, .got_header ld hl, KrisNameMenuHeader -.GotGender: +.got_header call LoadMenuHeader call VerticalMenu ld a, [wMenuCursorY] @@ -77,38 +76,30 @@ GetPlayerNameArray: ; unreferenced ld de, MalePlayerNameArray ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a - jr z, .done + jr z, .got_array ld de, FemalePlayerNameArray - -.done +.got_array call InitName ret GetPlayerIcon: -; Get the player icon corresponding to gender - -; Male ld de, ChrisSpriteGFX ld b, BANK(ChrisSpriteGFX) - ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a - jr z, .done - -; Female + jr z, .got_gfx ld de, KrisSpriteGFX ld b, BANK(KrisSpriteGFX) - -.done +.got_gfx ret GetCardPic: ld hl, ChrisCardPic ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a - jr z, .GotClass + jr z, .got_pic ld hl, KrisCardPic -.GotClass: +.got_pic ld de, vTiles2 tile $00 ld bc, $23 tiles ld a, BANK(ChrisCardPic) ; aka BANK(KrisCardPic) @@ -148,26 +139,29 @@ HOF_LoadTrainerFrontpic: call WaitBGMap xor a ldh [hBGMapMode], a - ld e, 0 + +; Get class + ld e, CHRIS ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a - jr z, .GotClass - ld e, 1 - -.GotClass: + jr z, .got_class + ld e, KRIS +.got_class ld a, e ld [wTrainerClass], a + +; Load pic ld de, ChrisPic ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a - jr z, .GotPic + jr z, .got_pic ld de, KrisPic - -.GotPic: +.got_pic ld hl, vTiles2 ld b, BANK(ChrisPic) ; aka BANK(KrisPic) ld c, 7 * 7 call Get2bpp + call WaitBGMap ld a, $1 ldh [hBGMapMode], a @@ -180,9 +174,9 @@ DrawIntroPlayerPic: ld e, CHRIS ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a - jr z, .GotClass + jr z, .got_class ld e, KRIS -.GotClass: +.got_class ld a, e ld [wTrainerClass], a @@ -190,9 +184,9 @@ DrawIntroPlayerPic: ld de, ChrisPic ld a, [wPlayerGender] bit PLAYERGENDER_FEMALE_F, a - jr z, .GotPic + jr z, .got_pic ld de, KrisPic -.GotPic: +.got_pic ld hl, vTiles2 ld b, BANK(ChrisPic) ; aka BANK(KrisPic) ld c, 7 * 7 ; dimensions diff --git a/engine/link/link.asm b/engine/link/link.asm index 3fa34df03..72d785c3f 100644 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -1249,7 +1249,7 @@ LinkTradeOTPartymonMenuLoop: .not_d_up bit D_DOWN_F, a jp z, LinkTradePartiesMenuMasterLoop - jp LinkTradeCheckCancel + jp LinkTradeOTPartymonMenuCheckCancel LinkTrade_PlayerPartyMenu: farcall InitMG_Mobile_LinkTradePalMap @@ -1323,7 +1323,7 @@ LinkTradePartymonMenuLoop: ld [hl], " " pop bc pop hl - jp Function28ade + jp LinkTradePartymonMenuCheckCancel LinkTradePartiesMenuMasterLoop: ld a, [wMonType] @@ -1501,11 +1501,12 @@ LinkTrade_TradeStatsMenu: text_far _LinkAbnormalMonText text_end -LinkTradeCheckCancel: +LinkTradeOTPartymonMenuCheckCancel: ld a, [wMenuCursorY] cp 1 jp nz, LinkTradePartiesMenuMasterLoop call HideCursor + push hl push bc ld bc, NAME_LENGTH @@ -1513,7 +1514,9 @@ LinkTradeCheckCancel: ld [hl], " " pop bc pop hl -Function28ade: + ; fallthrough + +LinkTradePartymonMenuCheckCancel: .loop1 ld a, "▶" ldcoord_a 9, 17 @@ -1548,6 +1551,8 @@ Function28ade: ld a, [wOtherPlayerLinkMode] cp $f jr nz, .loop1 + ; fallthrough + ExitLinkCommunications: call RotateThreePalettesRight call ClearScreen diff --git a/engine/link/link_trade.asm b/engine/link/link_trade.asm index 4f4d3c5ce..101a3dc70 100644 --- a/engine/link/link_trade.asm +++ b/engine/link/link_trade.asm @@ -8,20 +8,23 @@ __LoadTradeScreenBorderGFX: call Get2bpp ret -Function16d42e: - ld hl, Tilemap_MobileTradeBorderFullscreen +LoadMobileTradeBorderTilemap: + ld hl, MobileTradeBorderTilemap decoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyBytes ret -Function16d43b: ; unreferenced +TestMobileTradeBorderTilemap: ; unreferenced +; Loads the mobile trade border graphics and tilemap, +; with a placeholder SCGB_DIPLOMA layout, and exits +; after pressing A or B. Possibly used for testing. call LoadStandardMenuHeader call ClearBGPalettes call ClearTilemap call ClearSprites farcall __LoadTradeScreenBorderGFX ; useless to farcall - farcall Function16d42e ; useless to farcall + farcall LoadMobileTradeBorderTilemap ; useless to farcall ld b, SCGB_DIPLOMA call GetSGBLayout call SetPalettes @@ -30,13 +33,13 @@ Function16d43b: ; unreferenced call Call_ExitMenu ret -Tilemap_MobileTradeBorderFullscreen: -INCBIN "gfx/trade/border_mobile_fullscreen.tilemap" +MobileTradeBorderTilemap: +INCBIN "gfx/trade/border_mobile.tilemap" -Tilemap_CableTradeBorderTop: +CableTradeBorderTopTilemap: INCBIN "gfx/trade/border_cable_top.tilemap" -Tilemap_CableTradeBorderBottom: +CableTradeBorderBottomTilemap: INCBIN "gfx/trade/border_cable_bottom.tilemap" _LinkTextbox: @@ -111,7 +114,7 @@ _LinkTextbox: InitTradeSpeciesList: call _LoadTradeScreenBorderGFX - call Function16d6ae + call LoadCableTradeBorderTilemap farcall InitMG_Mobile_LinkTradePalMap farcall PlaceTradePartnerNamesAndParty hlcoord 10, 17 @@ -137,13 +140,13 @@ LoadTradeRoomBGPals: farcall _LoadTradeRoomBGPals ret -Function16d6ae: - call Function16d42e - ld hl, Tilemap_CableTradeBorderTop +LoadCableTradeBorderTilemap: + call LoadMobileTradeBorderTilemap + ld hl, CableTradeBorderTopTilemap decoord 0, 0 ld bc, 2 * SCREEN_WIDTH call CopyBytes - ld hl, Tilemap_CableTradeBorderBottom + ld hl, CableTradeBorderBottomTilemap decoord 0, 16 ld bc, 2 * SCREEN_WIDTH call CopyBytes diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index 5849fa0f9..b6f761d05 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -1049,7 +1049,8 @@ RunTitleScreen: scf ret -Function6292: ; unreferenced +UnusedTitlePerspectiveScroll: ; unreferenced +; Similar behavior to Intro_PerspectiveScrollBG. ldh a, [hVBlankCounter] and $7 ret nz diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 8f77e9b55..1a22f24fd 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -391,24 +391,19 @@ EraseHallOfFame: jp CloseSRAM Function14d18: ; unreferenced - ld a, BANK(s4_a007) + ld a, BANK(s4_a007) ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call OpenSRAM ld hl, .Data ld de, s4_a007 - ld bc, .DataEnd - .Data + ld bc, 4 * 12 call CopyBytes jp CloseSRAM .Data: - db $0d, $02, $00, $05, $00, $00 - db $22, $02, $01, $05, $00, $00 - db $03, $04, $05, $08, $03, $05 - db $0e, $06, $03, $02, $00, $00 - db $39, $07, $07, $04, $00, $05 - db $04, $07, $01, $05, $00, $00 - db $0f, $05, $14, $07, $05, $05 - db $11, $0c, $0c, $06, $06, $04 -.DataEnd + db $0d, $02, $00, $05, $00, $00, $22, $02, $01, $05, $00, $00 + db $03, $04, $05, $08, $03, $05, $0e, $06, $03, $02, $00, $00 + db $39, $07, $07, $04, $00, $05, $04, $07, $01, $05, $00, $00 + db $0f, $05, $14, $07, $05, $05, $11, $0c, $0c, $06, $06, $04 EraseBattleTowerStatus: ld a, BANK(sBattleTowerChallengeState) diff --git a/engine/movie/unused_title.asm b/engine/movie/unused_title.asm index 4b8845f6f..5f9d6bdab 100644 --- a/engine/movie/unused_title.asm +++ b/engine/movie/unused_title.asm @@ -154,13 +154,15 @@ UnusedTitleFG_OAM: dbsprite 13, 11, 0, 0, $4c, 1 dbsprite 14, 11, 0, 0, $4e, 1 -Function10ed51: ; unreferenced +TestCrystalTitleScreen: ; unreferenced +; Runs the title screen until A is pressed. +; Possibly used for testing. call _TitleScreen .loop call JoyTextDelay ldh a, [hJoyLast] ld b, a - and 1 + and A_BUTTON jr nz, .done call SuicuneFrameIterator call DelayFrame diff --git a/engine/pokemon/mon_stats.asm b/engine/pokemon/mon_stats.asm index 418ca8554..b8592a971 100644 --- a/engine/pokemon/mon_stats.asm +++ b/engine/pokemon/mon_stats.asm @@ -323,7 +323,11 @@ ListMovePP: jr nz, .load_loop ret -Function50cd0: ; unreferenced +BrokenPlacePPUnits: ; unreferenced +; Probably would have these parameters: +; hl = starting coordinate +; de = SCREEN_WIDTH or SCREEN_WIDTH * 2 +; c = the number of moves (1-4) .loop ld [hl], $32 ; typo for P? inc hl diff --git a/gfx/trade/border_mobile_fullscreen.tilemap b/gfx/trade/border_mobile.tilemap similarity index 100% rename from gfx/trade/border_mobile_fullscreen.tilemap rename to gfx/trade/border_mobile.tilemap diff --git a/mobile/fixed_words.asm b/mobile/fixed_words.asm index dc60aafe7..1243a4dbe 100644 --- a/mobile/fixed_words.asm +++ b/mobile/fixed_words.asm @@ -339,7 +339,7 @@ Function11c1b9: Function11c254: push af - ld a, $4 + ld a, BANK(s4_a007) call OpenSRAM ld hl, s4_a007 pop af @@ -349,7 +349,7 @@ Function11c254: sla a add c ld c, a - ld b, $0 + ld b, 0 add hl, bc ld de, wcd36 ld bc, 12 @@ -1762,7 +1762,7 @@ Function11cb66: ld a, [hl] and a jr nz, .asm_11cbd4 - ld a, $4 + ld a, BANK(s4_a007) call OpenSRAM ld hl, s4_a007 ld a, [wMenuCursorY] @@ -1773,10 +1773,10 @@ Function11cb66: sla a add c ld c, a - ld b, $0 + ld b, 0 add hl, bc ld de, wcd36 - ld c, $c + ld c, 12 .asm_11cba2 ld a, [de] ld [hli], a diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm index 677216bc6..b22302ec5 100644 --- a/mobile/mobile_40.asm +++ b/mobile/mobile_40.asm @@ -6496,7 +6496,7 @@ Function102e3e: db "CANCEL@" Function102e4f: - farcall Function16d42e + farcall LoadMobileTradeBorderTilemap farcall _InitMG_Mobile_LinkTradePalMap ld de, wPlayerName hlcoord 4, 0