From 4fd7a42b235b68ffc11d4f02305b695c2ed05549 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 7 Feb 2015 16:24:16 -0800 Subject: commented battle stuff --- engine/predefs.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/predefs.asm') diff --git a/engine/predefs.asm b/engine/predefs.asm index 8a98bd3d..f2bedf96 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -127,7 +127,7 @@ PredefPointers:: ; 4fe79 (13:7e79) add_predef UpdateHPBar2 add_predef DrawEnemyHUDAndHPBar add_predef LoadTownMap_Nest - add_predef Func_27d6b + add_predef PrintMonType add_predef EmotionBubble; 4C player exclamation add_predef EmptyFunc3; return immediately add_predef AskName @@ -145,7 +145,7 @@ PredefPointers:: ; 4fe79 (13:7e79) add_predef CheckForCollisionWhenPushingBoulder add_predef PrintStrengthTxt add_predef PickupItem - add_predef Func_27d98 + add_predef PrintMoveType add_predef LoadMovePPs add_predef DrawHP ; 5F add_predef Func_128f6 -- cgit v1.3.1-sl0p From 72bbaed99f725b2b8b0d2653968042ce1625354c Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 7 Feb 2015 22:18:42 -0800 Subject: fixed hp bar wram label and misc --- engine/battle/1.asm | 2 +- engine/battle/4.asm | 22 ++++---- engine/battle/4_2.asm | 22 ++++---- engine/battle/core.asm | 8 +-- engine/battle/e.asm | 2 +- engine/battle/e_2.asm | 2 +- engine/clear_save.asm | 4 +- engine/give_pokemon.asm | 2 +- engine/hp_bar.asm | 2 +- engine/items/items.asm | 46 ++++++++-------- engine/menu/bills_pc.asm | 120 +++++++++++++++++++++--------------------- engine/menu/party_menu.asm | 2 +- engine/menu/players_pc.asm | 52 +++++++++--------- engine/menu/status_screen.asm | 2 +- engine/predefs.asm | 2 +- engine/predefs7.asm | 12 ++--- engine/save.asm | 2 +- engine/titlescreen.asm | 12 ++--- engine/town_map.asm | 4 +- home.asm | 4 +- wram.asm | 6 +++ 21 files changed, 169 insertions(+), 161 deletions(-) (limited to 'engine/predefs.asm') diff --git a/engine/battle/1.asm b/engine/battle/1.asm index ccc82c55..517d53d1 100755 --- a/engine/battle/1.asm +++ b/engine/battle/1.asm @@ -77,7 +77,7 @@ DrainHPEffect_: ; 783f (1:783f) hlCoord 2, 2 xor a .next2 - ld [wListMenuID], a + ld [wHPBarType], a predef UpdateHPBar2 predef DrawPlayerHUDAndHPBar predef DrawEnemyHUDAndHPBar diff --git a/engine/battle/4.asm b/engine/battle/4.asm index 97db1ba3..e96267c4 100755 --- a/engine/battle/4.asm +++ b/engine/battle/4.asm @@ -18,27 +18,28 @@ IsPlayerJustOutsideMap: ; 128d8 (4:68d8) DrawHP: ; 128ef (4:68ef) call GetPredefRegisters ld a, $1 - jr asm_128fb + jr DrawHP_ -Func_128f6: ; 128f6 (4:68f6) +DrawHP2: ; 128f6 (4:68f6) call GetPredefRegisters ld a, $2 -asm_128fb: ; 128fb (4:68fb) - ld [wListMenuID], a + +DrawHP_: ; 128fb (4:68fb) + ld [wHPBarType], a push hl ld a, [wLoadedMonHP] ld b, a ld a, [wLoadedMonHP + 1] ld c, a or b - jr nz, .asm_12913 + jr nz, .nonzeroHP xor a ld c, a ld e, a ld a, $6 ld d, a - jp DrawHPBarAndFraction -.asm_12913 + jp .drawHPBarAndPrintFraction +.nonzeroHP ld a, [wLoadedMonMaxHP] ld d, a ld a, [wLoadedMonMaxHP + 1] @@ -47,8 +48,7 @@ asm_128fb: ; 128fb (4:68fb) ld a, $6 ld d, a ld c, a - -DrawHPBarAndFraction: ; 12924 (4:6924) +.drawHPBarAndPrintFraction pop hl push de push hl @@ -59,10 +59,10 @@ DrawHPBarAndFraction: ; 12924 (4:6924) bit 0, a jr z, .printFractionBelowBar ld bc, $9 ; right of bar - jr .printHPFraction + jr .printFraction .printFractionBelowBar ld bc, SCREEN_WIDTH + 1 ; below bar -.printHPFraction +.printFraction add hl, bc ld de, wLoadedMonHP ld bc, $203 diff --git a/engine/battle/4_2.asm b/engine/battle/4_2.asm index 287c8eae..8d8c6077 100755 --- a/engine/battle/4_2.asm +++ b/engine/battle/4_2.asm @@ -207,16 +207,16 @@ WildMonEncounterSlotChances: ; 13918 (4:7918) db $FF, $12 ; 3/256 = 1.2% chance of slot 9 RecoilEffect_: ; 1392c (4:792c) - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a - ld a, [W_PLAYERMOVENUM] ; wcfd2 - ld hl, wBattleMonMaxHP ; wd023 + ld a, [W_PLAYERMOVENUM] + ld hl, wBattleMonMaxHP jr z, .asm_1393d - ld a, [W_ENEMYMOVENUM] ; W_ENEMYMOVENUM - ld hl, wEnemyMonMaxHP ; wEnemyMonMaxHP + ld a, [W_ENEMYMOVENUM] + ld hl, wEnemyMonMaxHP .asm_1393d ld d, a - ld a, [W_DAMAGE] ; W_DAMAGE + ld a, [W_DAMAGE] ld b, a ld a, [W_DAMAGE + 1] ld c, a @@ -260,16 +260,16 @@ RecoilEffect_: ; 1392c (4:792c) ld [hl], a .asm_13982 hlCoord 10, 9 - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a ld a, $1 jr z, .asm_13990 hlCoord 2, 2 xor a .asm_13990 - ld [wListMenuID], a ; wListMenuID + ld [wHPBarType], a predef UpdateHPBar2 - ld hl, HitWithRecoilText ; $799e + ld hl, HitWithRecoilText jp PrintText HitWithRecoilText: ; 1399e (4:799e) TX_FAR _HitWithRecoilText @@ -392,8 +392,8 @@ GetTrainerName_: ; 13a58 (4:7a58) ld a, [wLinkState] and a jr nz, .rival - ld hl, W_RIVALNAME ; wd34a - ld a, [W_TRAINERCLASS] ; wd031 + ld hl, W_RIVALNAME + ld a, [W_TRAINERCLASS] cp SONY1 jr z, .rival cp SONY2 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index a502ed7c..d51abb43 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -768,7 +768,7 @@ UpdateCurMonHPBar: ; 3c4f6 (f:44f6) xor a .playersTurn push bc - ld [wListMenuID], a + ld [wHPBarType], a predef UpdateHPBar2 pop bc ret @@ -2029,7 +2029,7 @@ DrawEnemyHUDAndHPBar: ; 3cdec (f:4dec) ld c, a .drawHPBar xor a - ld [wListMenuID], a + ld [wHPBarType], a hlCoord 2, 2 call DrawHPBar ld a, $1 @@ -4899,7 +4899,7 @@ ApplyDamageToEnemyPokemon: ; 3e142 (f:6142) ld [wHPBarNewHP],a hlCoord 2, 2 xor a - ld [wListMenuID],a + ld [wHPBarType],a predef UpdateHPBar2 ; animate the HP bar shortening ApplyAttackToEnemyPokemonDone: ; 3e19d (f:619d) jp DrawHUDsAndHPBars @@ -5017,7 +5017,7 @@ ApplyDamageToPlayerPokemon: ; 3e200 (f:6200) ld [wHPBarMaxHP],a hlCoord 10, 9 ld a,$01 - ld [wListMenuID],a + ld [wHPBarType],a predef UpdateHPBar2 ; animate the HP bar shortening ApplyAttackToPlayerPokemonDone jp DrawHUDsAndHPBars diff --git a/engine/battle/e.asm b/engine/battle/e.asm index ff3ac839..5592702a 100755 --- a/engine/battle/e.asm +++ b/engine/battle/e.asm @@ -1174,7 +1174,7 @@ Func_3a718: ; 3a718 (e:6718) call AIPrintItemUse_ hlCoord 2, 2 xor a - ld [wListMenuID],a + ld [wHPBarType],a predef UpdateHPBar2 jp DecrementAICount diff --git a/engine/battle/e_2.asm b/engine/battle/e_2.asm index 1106f531..9400282d 100755 --- a/engine/battle/e_2.asm +++ b/engine/battle/e_2.asm @@ -91,7 +91,7 @@ HealEffect_: ; 3b9ec (e:79ec) hlCoord 2, 2 xor a .asm_3ba83 - ld [wListMenuID], a + ld [wHPBarType], a predef UpdateHPBar2 ld hl, DrawHUDsAndHPBars call BankswitchEtoF diff --git a/engine/clear_save.asm b/engine/clear_save.asm index c1140531..66d7e920 100755 --- a/engine/clear_save.asm +++ b/engine/clear_save.asm @@ -1,4 +1,4 @@ -Func_1c98a: ; 1c98a (7:498a) +DoClearSaveDialogue: ; 1c98a (7:498a) call ClearScreen call GoPAL_SET_CF1C call LoadFontTilePatterns @@ -15,7 +15,7 @@ Func_1c98a: ; 1c98a (7:498a) ld a, [wCurrentMenuItem] and a jp z, Init - callba Func_73b6a + callba ClearSAV jp Init ClearSaveDataText: ; 1c9c1 (7:49c1) diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm index d4d58d33..64876d22 100755 --- a/engine/give_pokemon.asm +++ b/engine/give_pokemon.asm @@ -14,7 +14,7 @@ _GivePokemon: ; 4fda5 (13:7da5) ld [wEnemyMonSpecies2], a callab LoadEnemyMonData call SetPokedexOwnedFlag - callab Func_e7a4 + callab SendNewMonToBox ld hl, wcf4b ld a, [wd5a0] and $7f diff --git a/engine/hp_bar.asm b/engine/hp_bar.asm index a53511c7..333b0b90 100755 --- a/engine/hp_bar.asm +++ b/engine/hp_bar.asm @@ -203,7 +203,7 @@ UpdateHPBar_CalcHPDifference: ; fad7 (3:7ad7) UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5) push af push de - ld a, [wListMenuID] ; wListMenuID + ld a, [wHPBarType] and a jr z, .asm_fb2d ld a, [wHPBarOldHP] diff --git a/engine/items/items.asm b/engine/items/items.asm index 99c97fef..aaee9403 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -430,7 +430,7 @@ ItemUseBall: ; d687 (3:5687) jr .End .sendToBox ;$5907 call ClearSprites - call Func_e7a4 + call SendNewMonToBox ld hl,ItemUseBallText07 ld a,[wd7f1] bit 0,a ;already met Bill? @@ -923,7 +923,7 @@ ItemUseMedicine: ; dabb (3:5abb) set 0,a ld [hFlags_0xFFF6],a ld a,$02 - ld [wListMenuID],a + ld [wHPBarType],a predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled ld a,[hFlags_0xFFF6] res 0,a @@ -1073,7 +1073,7 @@ ItemUseMedicine: ; dabb (3:5abb) set 0,a ld [hFlags_0xFFF6],a ld a,$02 - ld [wListMenuID],a + ld [wHPBarType],a predef UpdateHPBar2 ; animate the HP bar lengthening ld a,[hFlags_0xFFF6] res 0,a @@ -1090,7 +1090,7 @@ ItemUseMedicine: ; dabb (3:5abb) jr .showHealingItemMessage .playStatusAilmentCuringSound ld a,(SFX_02_3e - SFX_Headers_02) / 3 ; status ailment curing sound - call PlaySoundWaitForCurrent ; play sound + call PlaySoundWaitForCurrent .showHealingItemMessage xor a ld [H_AUTOBGTRANSFERENABLED],a @@ -1102,7 +1102,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld [H_AUTOBGTRANSFERENABLED],a ld c,50 call DelayFrames - call WaitForTextScrollButtonPress ; wait for a button press + call WaitForTextScrollButtonPress jr .done .canceledItemUse xor a @@ -1118,7 +1118,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld a,[W_ISINBATTLE] and a ret nz - jp ReloadMapData ; restore saved screen + jp ReloadMapData .useVitamin push hl ld a,[hl] @@ -2567,7 +2567,7 @@ IsKeyItem_: ; e764 (3:6764) INCLUDE "data/key_items.asm" -Func_e7a4: ; e7a4 (3:67a4) +SendNewMonToBox: ; e7a4 (3:67a4) ld de, W_NUMINBOX ; wda80 ld a, [de] inc a @@ -2818,49 +2818,51 @@ ItemUseReloadOverworldData: ; e9c5 (3:69c5) call LoadCurrentMapView jp UpdateSprites -Func_e9cb: ; e9cb (3:69cb) - ld hl, WildDataPointers ; $4eeb - ld de, wHPBarMaxHP +; creates a list at wBuffer of maps where the mon in [wd11e] can be found. +; this is used by the pokedex to display locations the mon can be found on the map. +FindWildLocationsOfMon: ; e9cb (3:69cb) + ld hl, WildDataPointers + ld de, wBuffer ld c, $0 -.asm_e9d3 +.loop inc hl ld a, [hld] inc a - jr z, .asm_e9ec + jr z, .done push hl ld a, [hli] ld h, [hl] ld l, a ld a, [hli] and a - call nz, Func_e9f0 + call nz, CheckMapForMon ; land ld a, [hli] and a - call nz, Func_e9f0 + call nz, CheckMapForMon ; water pop hl inc hl inc hl inc c - jr .asm_e9d3 -.asm_e9ec - ld a, $ff + jr .loop +.done + ld a, $ff ; list terminator ld [de], a ret -Func_e9f0: ; e9f0 (3:69f0) +CheckMapForMon: ; e9f0 (3:69f0) inc hl ld b, $a -.asm_e9f3 +.loop ld a, [wd11e] cp [hl] - jr nz, .asm_e9fc + jr nz, .nextEntry ld a, c ld [de], a inc de -.asm_e9fc +.nextEntry inc hl inc hl dec b - jr nz, .asm_e9f3 + jr nz, .loop dec hl ret diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index 9e8422c0..f4a40cf9 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -1,6 +1,6 @@ Func_213c8:: ; 213c8 (8:53c8) xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a call SaveScreenTilesToBuffer2 ld a, [wd5a2] and a @@ -28,64 +28,64 @@ Func_213c8:: ; 213c8 (8:53c8) call TextBoxBorder call UpdateSprites ld a, $3 - ld [wMaxMenuItem], a ; wMaxMenuItem + ld [wMaxMenuItem], a ld a, [wd7f1] bit 0, a jr nz, .asm_21414 hlCoord 2, 2 - ld de, SomeonesPCText ; $548b + ld de, SomeonesPCText jr .asm_2141a .asm_21414 hlCoord 2, 2 - ld de, BillsPCText ; $5497 + ld de, BillsPCText .asm_2141a call PlaceString hlCoord 2, 4 - ld de, wPlayerName ; wd158 + ld de, wPlayerName call PlaceString ld l, c ld h, b - ld de, PlayersPCText ; $54a0 + ld de, PlayersPCText call PlaceString ld a, [wd74b] bit 5, a jr z, .asm_21462 hlCoord 2, 6 - ld de, OaksPCText ; $54a5 + ld de, OaksPCText call PlaceString ld a, [wd5a2] and a jr z, .asm_2145a ld a, $4 - ld [wMaxMenuItem], a ; wMaxMenuItem + ld [wMaxMenuItem], a hlCoord 2, 8 - ld de, PKMNLeaguePCText ; $54b2 + ld de, PKMNLeaguePCText call PlaceString hlCoord 2, 10 - ld de, LogOffPCText ; $54ba + ld de, LogOffPCText jr .asm_2146d .asm_2145a hlCoord 2, 8 - ld de, LogOffPCText ; $54ba + ld de, LogOffPCText jr .asm_2146d .asm_21462 ld a, $2 - ld [wMaxMenuItem], a ; wMaxMenuItem + ld [wMaxMenuItem], a hlCoord 2, 6 - ld de, LogOffPCText ; $54ba + ld de, LogOffPCText .asm_2146d call PlaceString ld a, $3 - ld [wMenuWatchedKeys], a ; wMenuWatchedKeys + ld [wMenuWatchedKeys], a ld a, $2 - ld [wTopMenuItemY], a ; wTopMenuItemY + ld [wTopMenuItemY], a ld a, $1 - ld [wTopMenuItemX], a ; wTopMenuItemX + ld [wTopMenuItemX], a xor a - ld [wCurrentMenuItem], a ; wCurrentMenuItem - ld [wLastMenuItem], a ; wLastMenuItem + ld [wCurrentMenuItem], a + ld [wLastMenuItem], a ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ret SomeonesPCText: db "SOMEONE's PC@" @@ -103,7 +103,7 @@ BillsPC_:: ; 0x214c2 inc a ; MONSTER_NAME ld [W_LISTTYPE], a call LoadHpBarAndStatusTilePatterns - ld a, [wListScrollOffset] ; wcc36 + ld a, [wListScrollOffset] push af ld a, [wFlags_0xcd60] bit 3, a @@ -116,9 +116,9 @@ BillsPC_:: ; 0x214c2 Func_214e8: ; 214e8 (8:54e8) BillsPCMenu: ld a, [wccd3] - ld [wCurrentMenuItem], a ; wCurrentMenuItem + ld [wCurrentMenuItem], a ld hl, vChars2 + $780 - ld de, PokeballTileGraphics ; $697e + ld de, PokeballTileGraphics ld bc, (BANK(PokeballTileGraphics) << 8) + $01 call CopyVideoData call LoadScreenTilesFromBuffer2DisableBGTransfer @@ -127,9 +127,9 @@ BillsPCMenu: ld c, $c call TextBoxBorder hlCoord 2, 2 - ld de, BillsPCMenuText ; $56e1 + ld de, BillsPCMenuText call PlaceString - ld hl, wTopMenuItemY ; wTopMenuItemY + ld hl, wTopMenuItemY ld a, $2 ld [hli], a dec a @@ -143,10 +143,10 @@ BillsPCMenu: xor a ld [hli], a ld [hli], a - ld hl, wListScrollOffset ; wcc36 + ld hl, wListScrollOffset ld [hli], a ld [hl], a - ld [wPlayerMonNumber], a ; wPlayerMonNumber + ld [wPlayerMonNumber], a ld hl, WhatText call PrintText hlCoord 9, 14 @@ -167,16 +167,16 @@ BillsPCMenu: .asm_21551 Coorda 18, 16 hlCoord 10, 16 - ld de, BoxNoPCText ; $5713 + ld de, BoxNoPCText call PlaceString ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a call Delay3 call HandleMenuInput bit 1, a jp nz, Func_21588 ; b button call PlaceUnfilledArrowMenuCursor - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] ld [wccd3], a and a jp z, Func_21618 ; withdraw @@ -200,28 +200,28 @@ Func_21588: ; 21588 (8:5588) res 5, [hl] call LoadScreenTilesFromBuffer2 pop af - ld [wListScrollOffset], a ; wcc36 + ld [wListScrollOffset], a ld hl, wd730 res 6, [hl] ret Func_215ac: ; 215ac (8:55ac) BillsPCDeposit: - ld a, [wPartyCount] ; wPartyCount + ld a, [wPartyCount] dec a jr nz, .asm_215bb ld hl, CantDepositLastMonText call PrintText jp BillsPCMenu .asm_215bb - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] cp MONS_PER_BOX jr nz, .asm_215cb - ld hl, BoxFullText ; $5802 + ld hl, BoxFullText call PrintText jp BillsPCMenu .asm_215cb - ld hl, wPartyCount ; wPartyCount + ld hl, wPartyCount call Func_216be jp c, BillsPCMenu call Func_2174b @@ -236,7 +236,7 @@ BillsPCDeposit: ld [wcf95], a call RemovePokemon call WaitForSoundToFinish - ld hl, wWhichTrade ; wWhichTrade + ld hl, wWhichTrade ld a, [wd5a0] and $7f cp 9 @@ -251,31 +251,31 @@ BillsPCDeposit: .asm_2160c ld [hli], a ld [hl], $50 - ld hl, MonWasStoredText ; $57f8 + ld hl, MonWasStoredText call PrintText jp BillsPCMenu Func_21618: ; 21618 (8:5618) - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] and a jr nz, .asm_21627 - ld hl, NoMonText ; $580c + ld hl, NoMonText call PrintText jp Func_214e8 .asm_21627 - ld a, [wPartyCount] ; wPartyCount + ld a, [wPartyCount] cp PARTY_LENGTH jr nz, .asm_21637 - ld hl, CantTakeMonText ; $5811 + ld hl, CantTakeMonText call PrintText jp Func_214e8 .asm_21637 - ld hl, W_NUMINBOX ; wda80 + ld hl, W_NUMINBOX call Func_216be jp c, Func_214e8 call Func_2174b jp nc, Func_214e8 - ld a, [wWhichPokemon] ; wWhichPokemon + ld a, [wWhichPokemon] ld hl, wBoxMonNicks call GetPartyMonName ld a, [wcf91] @@ -288,25 +288,25 @@ Func_21618: ; 21618 (8:5618) ld [wcf95], a call RemovePokemon call WaitForSoundToFinish - ld hl, MonIsTakenOutText ; $5807 + ld hl, MonIsTakenOutText call PrintText jp Func_214e8 Func_21673: ; 21673 (8:5673) - ld a, [W_NUMINBOX] ; wda80 + ld a, [W_NUMINBOX] and a jr nz, .asm_21682 - ld hl, NoMonText ; $580c + ld hl, NoMonText call PrintText jp Func_214e8 .asm_21682 - ld hl, W_NUMINBOX ; wda80 + ld hl, W_NUMINBOX call Func_216be jp c, Func_214e8 - ld hl, OnceReleasedText ; $581b + ld hl, OnceReleasedText call PrintText call YesNoChoice - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] and a jr nz, .asm_21682 inc a @@ -315,7 +315,7 @@ Func_21673: ; 21673 (8:5673) call WaitForSoundToFinish ld a, [wcf91] call PlayCry - ld hl, MonWasReleasedText ; $5820 + ld hl, MonWasReleasedText call PrintText jp Func_214e8 @@ -330,13 +330,13 @@ Func_216be: ; 216be (8:56be) ld [wList + 1], a xor a ld [wcf93], a - ld [wListMenuID], a ; wListMenuID + ld [wListMenuID], a inc a ; MONSTER_NAME ld [W_LISTTYPE], a ld a, [wcc2b] - ld [wCurrentMenuItem], a ; wCurrentMenuItem + ld [wCurrentMenuItem], a call DisplayListMenuID - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] ld [wcc2b], a ret @@ -368,7 +368,7 @@ Func_2171b:: ; 2171b (8:571b) ld a, [hli] push hl push bc - ld hl, HMMoveArray ; $5745 + ld hl, HMMoveArray ld de, 1 call IsInArray pop bc @@ -394,16 +394,16 @@ Func_2174b: ; 2174b (8:574b) call TextBoxBorder ld a, [wccd3] and a - ld de, DepositPCText ; $57cb + ld de, DepositPCText jr nz, .asm_21761 - ld de, WithdrawPCText ; $57d3 + ld de, WithdrawPCText .asm_21761 hlCoord 11, 12 call PlaceString hlCoord 11, 14 - ld de, StatsCancelPCText ; $57dc + ld de, StatsCancelPCText call PlaceString - ld hl, wTopMenuItemY ; wTopMenuItemY + ld hl, wTopMenuItemY ld a, $c ld [hli], a ld a, $a @@ -417,16 +417,16 @@ Func_2174b: ; 2174b (8:574b) ld [hli], a xor a ld [hl], a - ld hl, wListScrollOffset ; wcc36 + ld hl, wListScrollOffset ld [hli], a ld [hl], a - ld [wPlayerMonNumber], a ; wPlayerMonNumber + ld [wPlayerMonNumber], a ld [wcc2b], a .asm_2178f call HandleMenuInput bit 1, a jr nz, .asm_2179f - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] and a jr z, .asm_217a1 dec a diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm index 86474be9..97e520c2 100755 --- a/engine/menu/party_menu.asm +++ b/engine/menu/party_menu.asm @@ -92,7 +92,7 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3) set 0,a ld [hFlags_0xFFF6],a add hl,bc - predef Func_128f6 ; draw HP bar and prints current / max HP + predef DrawHP2 ; draw HP bar and prints current / max HP ld a,[hFlags_0xFFF6] res 0,a ld [hFlags_0xFFF6],a diff --git a/engine/menu/players_pc.asm b/engine/menu/players_pc.asm index 5217befa..ad6c8140 100755 --- a/engine/menu/players_pc.asm +++ b/engine/menu/players_pc.asm @@ -17,7 +17,7 @@ PlayerPC: ; 78e6 (1:78e6) Func_790c: ; 790c (1:790c) ld a, [wccd3] - ld [wCurrentMenuItem], a ; wCurrentMenuItem + ld [wCurrentMenuItem], a ld hl, wFlags_0xcd60 set 5, [hl] call LoadScreenTilesFromBuffer2 @@ -27,9 +27,9 @@ Func_790c: ; 790c (1:790c) call TextBoxBorder call UpdateSprites hlCoord 2, 2 - ld de, PlayersPCMenuEntries ; $7af5 + ld de, PlayersPCMenuEntries call PlaceString - ld hl, wTopMenuItemY ; wTopMenuItemY + ld hl, wTopMenuItemY ld a, $2 ld [hli], a dec a @@ -42,17 +42,17 @@ Func_790c: ; 790c (1:790c) ld [hli], a xor a ld [hl], a - ld hl, wListScrollOffset ; wcc36 + ld hl, wListScrollOffset ld [hli], a ld [hl], a - ld [wPlayerMonNumber], a ; wPlayerMonNumber + ld [wPlayerMonNumber], a ld hl, WhatDoYouWantText call PrintText call HandleMenuInput bit 1, a jp nz, Func_796d call PlaceUnfilledArrowMenuCursor - ld a, [wCurrentMenuItem] ; wCurrentMenuItem + ld a, [wCurrentMenuItem] ld [wccd3], a and a jp z, Func_7a12 @@ -73,7 +73,7 @@ Func_796d: ; 796d (1:796d) res 5, [hl] call LoadScreenTilesFromBuffer2 xor a - ld [wListScrollOffset], a ; wcc36 + ld [wListScrollOffset], a ld [wcc2c], a ld hl, wd730 res 6, [hl] @@ -83,9 +83,9 @@ Func_796d: ; 796d (1:796d) Func_7995: ; 7995 (1:7995) xor a - ld [wCurrentMenuItem], a ; wCurrentMenuItem - ld [wListScrollOffset], a ; wcc36 - ld a, [wNumBagItems] ; wNumBagItems + ld [wCurrentMenuItem], a + ld [wListScrollOffset], a + ld a, [wNumBagItems] and a jr nz, Func_79ab ld hl, NothingToDepositText @@ -95,7 +95,7 @@ Func_7995: ; 7995 (1:7995) Func_79ab: ; 79ab (1:79ab) ld hl, WhatToDepositText call PrintText - ld hl, wNumBagItems ; wNumBagItems + ld hl, wNumBagItems ld a, l ld [wList], a ld a, h @@ -103,7 +103,7 @@ Func_79ab: ; 79ab (1:79ab) xor a ld [wcf93], a ld a, $3 - ld [wListMenuID], a ; wListMenuID + ld [wListMenuID], a call DisplayListMenuID jp c, Func_790c call IsKeyItem @@ -118,14 +118,14 @@ Func_79ab: ; 79ab (1:79ab) cp $ff jp z, Func_79ab .asm_79e7 - ld hl, wNumBoxItems ; wNumBoxItems + ld hl, wNumBoxItems call AddItemToInventory jr c, .asm_79f8 ld hl, NoRoomToStoreText call PrintText jp Func_79ab .asm_79f8 - ld hl, wNumBagItems ; wNumBagItems + ld hl, wNumBagItems call RemoveItemFromInventory call WaitForSoundToFinish ld a, (SFX_02_55 - SFX_Headers_02) / 3 @@ -137,9 +137,9 @@ Func_79ab: ; 79ab (1:79ab) Func_7a12: ; 7a12 (1:7a12) xor a - ld [wCurrentMenuItem], a ; wCurrentMenuItem - ld [wListScrollOffset], a ; wcc36 - ld a, [wNumBoxItems] ; wNumBoxItems + ld [wCurrentMenuItem], a + ld [wListScrollOffset], a + ld a, [wNumBoxItems] and a jr nz, Func_7a28 ld hl, NothingStoredText @@ -149,7 +149,7 @@ Func_7a12: ; 7a12 (1:7a12) Func_7a28: ; 7a28 (1:7a28) ld hl, WhatToWithdrawText call PrintText - ld hl, wNumBoxItems ; wNumBoxItems + ld hl, wNumBoxItems ld a, l ld [wList], a ld a, h @@ -157,7 +157,7 @@ Func_7a28: ; 7a28 (1:7a28) xor a ld [wcf93], a ld a, $3 - ld [wListMenuID], a ; wListMenuID + ld [wListMenuID], a call DisplayListMenuID jp c, Func_790c call IsKeyItem @@ -172,14 +172,14 @@ Func_7a28: ; 7a28 (1:7a28) cp $ff jp z, Func_7a28 .asm_7a64 - ld hl, wNumBagItems ; wNumBagItems + ld hl, wNumBagItems call AddItemToInventory jr c, .asm_7a75 ld hl, CantCarryMoreText call PrintText jp Func_7a28 .asm_7a75 - ld hl, wNumBoxItems ; wNumBoxItems + ld hl, wNumBoxItems call RemoveItemFromInventory call WaitForSoundToFinish ld a, (SFX_02_55 - SFX_Headers_02) / 3 @@ -191,9 +191,9 @@ Func_7a28: ; 7a28 (1:7a28) Func_7a8f: ; 7a8f (1:7a8f) xor a - ld [wCurrentMenuItem], a ; wCurrentMenuItem - ld [wListScrollOffset], a ; wcc36 - ld a, [wNumBoxItems] ; wNumBoxItems + ld [wCurrentMenuItem], a + ld [wListScrollOffset], a + ld a, [wNumBoxItems] and a jr nz, Func_7aa5 ld hl, NothingStoredText @@ -203,7 +203,7 @@ Func_7a8f: ; 7a8f (1:7a8f) Func_7aa5: ; 7aa5 (1:7aa5) ld hl, WhatToTossText call PrintText - ld hl, wNumBoxItems ; wNumBoxItems + ld hl, wNumBoxItems ld a, l ld [wList], a ld a, h @@ -211,7 +211,7 @@ Func_7aa5: ; 7aa5 (1:7aa5) xor a ld [wcf93], a ld a, $3 - ld [wListMenuID], a ; wListMenuID + ld [wListMenuID], a push hl call DisplayListMenuID pop hl diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index 79daa0c0..685839cb 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -55,7 +55,7 @@ StatusScreen: ; 12953 (4:6953) ld de, Type1Text call PlaceString ; "TYPE1/" hlCoord 11, 3 - predef DrawHP ; predef $5f + predef DrawHP ld hl, wcf25 call GetHealthBarColor ld b, $3 diff --git a/engine/predefs.asm b/engine/predefs.asm index f2bedf96..23eb8cd1 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -148,6 +148,6 @@ PredefPointers:: ; 4fe79 (13:7e79) add_predef PrintMoveType add_predef LoadMovePPs add_predef DrawHP ; 5F - add_predef Func_128f6 + add_predef DrawHP2 add_predef Func_1c9c6 add_predef OaksAideScript diff --git a/engine/predefs7.asm b/engine/predefs7.asm index e2f58ca8..9786c097 100755 --- a/engine/predefs7.asm +++ b/engine/predefs7.asm @@ -6,23 +6,23 @@ Func_1c9c6: ; 1c9c6 (7:49c6) ld [wList], a ld a, h ld [wList + 1], a - ld a, [wListScrollOffset] ; wcc36 + ld a, [wListScrollOffset] push af xor a - ld [wCurrentMenuItem], a ; wCurrentMenuItem - ld [wListScrollOffset], a ; wcc36 + ld [wCurrentMenuItem], a + ld [wListScrollOffset], a ld [wcf93], a ld a, $4 - ld [wListMenuID], a ; wListMenuID + ld [wListMenuID], a call DisplayListMenuID pop bc ld a, b - ld [wListScrollOffset], a ; wcc36 + ld [wListScrollOffset], a ret c ld hl, wd126 set 7, [hl] ld hl, wcc5b - ld a, [wWhichPokemon] ; wWhichPokemon + ld a, [wWhichPokemon] add a ld d, $0 ld e, a diff --git a/engine/save.asm b/engine/save.asm index c1231871..d3127f04 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -665,7 +665,7 @@ HallOfFame_Copy: ; 73b51 (1c:7b51) ld [MBC1SRamEnable], a ret -Func_73b6a: ; 73b6a (1c:7b6a) +ClearSAV: ; 73b6a (1c:7b6a) ld a, SRAM_ENABLE ld [MBC1SRamEnable], a ld a, $1 diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index 5e8a15d5..ed23fbc4 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -237,14 +237,14 @@ ENDC call LoadGBPal ld a, [hJoyHeld] ld b, a - and $46 - cp $46 - jp z, Func_448e + and D_UP | SELECT | B_BUTTON + cp D_UP | SELECT | B_BUTTON + jp z, .doClearSaveDialogue jp MainMenu -Func_448e: ; 448e (1:448e) - ld b, BANK(Func_1c98a) - ld hl, Func_1c98a +.doClearSaveDialogue + ld b, BANK(DoClearSaveDialogue) + ld hl, DoClearSaveDialogue jp Bankswitch Func_4496: ; 4496 (1:4496) diff --git a/engine/town_map.asm b/engine/town_map.asm index dece8d1f..7974cf1a 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -364,10 +364,10 @@ Func_711c4: ; 711c4 (1c:51c4) jp CopyData Func_711ef: ; 711ef (1c:51ef) - callba Func_e9cb + callba FindWildLocationsOfMon call Func_712d9 ld hl, wOAMBuffer - ld de, wHPBarMaxHP + ld de, wBuffer .asm_71200 ld a, [de] cp $ff diff --git a/home.asm b/home.asm index ef7d35bb..1557755a 100644 --- a/home.asm +++ b/home.asm @@ -173,7 +173,7 @@ LoadDestinationWarpPosition:: ; 1313 (0:1313) DrawHPBar:: ; 1336 (0:1336) ; Draw an HP bar d tiles long, and fill it to e pixels. ; If c is nonzero, show at least a sliver regardless. -; The right end of the bar changes with [wListMenuID]. +; The right end of the bar changes with [wHPBarType]. push hl push de @@ -195,7 +195,7 @@ DrawHPBar:: ; 1336 (0:1336) jr nz, .draw ; Right - ld a,[wListMenuID] + ld a,[wHPBarType] dec a ld a, $6d ; status screen and battle jr z, .ok diff --git a/wram.asm b/wram.asm index 2cde6d12..b2fd4eb8 100755 --- a/wram.asm +++ b/wram.asm @@ -803,6 +803,12 @@ wWhichPokemon:: ; cf92 wcf93:: ds 1 +wHPBarType:: ; cf94 +; type of HP bar +; $00 = enemy HUD in battle +; $01 = player HUD in battle / status screen +; $02 = party menu + wListMenuID:: ; cf94 ; ID used by DisplayListMenuID ds 1 -- cgit v1.3.1-sl0p From 3870f5e10a1e17f35c78b176272df6b1f516f24e Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 8 Feb 2015 01:44:41 -0800 Subject: named misc functions --- constants/misc_constants.asm | 2 +- engine/battle/4_2.asm | 4 +- engine/battle/core.asm | 21 ++--- engine/battle/e.asm | 177 ++++++++++++++++++++++--------------------- engine/evos_moves.asm | 2 +- engine/items/items.asm | 2 +- engine/menu/bills_pc.asm | 4 +- engine/menu/players_pc.asm | 2 +- engine/predefs.asm | 2 +- home.asm | 10 +-- main.asm | 2 +- wram.asm | 20 +++-- 12 files changed, 133 insertions(+), 115 deletions(-) (limited to 'engine/predefs.asm') diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index d2270b6c..3452a393 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -82,4 +82,4 @@ LINK_STATE_START_TRADE EQU $02 ; pre-trade selection screen initialisation LINK_STATE_START_BATTLE EQU $03 ; pre-battle initialisation LINK_STATE_BATTLING EQU $04 ; in a link battle LINK_STATE_RESET EQU $05 ; reset game (unused) -LINK_STATE_TRADING EQU $32 ; in a link trade \ No newline at end of file +LINK_STATE_TRADING EQU $32 ; in a link trade diff --git a/engine/battle/4_2.asm b/engine/battle/4_2.asm index 8d8c6077..bac0a2d1 100755 --- a/engine/battle/4_2.asm +++ b/engine/battle/4_2.asm @@ -60,7 +60,7 @@ EndOfBattle: ; 137aa (4:77aa) ld [hli], a ld [hl], a ld [wListScrollOffset], a - ld hl, wd060 + ld hl, wPlayerStatsToDouble ld b, $18 .loop ld [hli], a @@ -402,7 +402,7 @@ GetTrainerName_: ; 13a58 (4:7a58) jr z, .rival ld [wd0b5], a ld a, TRAINER_NAME - ld [W_LISTTYPE], a + ld [wNameListType], a ld a, BANK(TrainerNames) ld [wPredefBank], a call GetName diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5c25e5b0..63be5676 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -839,7 +839,7 @@ FaintEnemyPokemon ; 0x3c567 res AttackingMultipleTimes, [hl] xor a ld [wPlayerNumHits], a - ld hl, wd065 ; clear enemy statuses + ld hl, wEnemyStatsToDouble ; clear enemy statuses ld [hli], a ld [hli], a ld [hli], a @@ -1366,7 +1366,7 @@ EnemySendOut: ; 3c90e (f:490e) ; don't change wPartyGainExpFlags or wPartyFoughtCurrentEnemyFlags EnemySendOutFirstMon: ; 3c92a (f:492a) xor a - ld hl,wd065 ; clear enemy statuses + ld hl,wEnemyStatsToDouble ; clear enemy statuses ld [hli],a ld [hli],a ld [hli],a @@ -1815,7 +1815,7 @@ SendOutMon: ; 3cc91 (f:4c91) ld hl, wPlayerUsedMove ld [hli], a ld [hl], a - ld hl, wd060 + ld hl, wPlayerStatsToDouble ld [hli], a ld [hli], a ld [hli], a @@ -5671,7 +5671,7 @@ EnemyCanExecuteChargingMove: ; 3e70b (f:670b) ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME - ld [W_LISTTYPE], a + ld [wNameListType], a call GetName ld de, wcd6d call CopyStringToCF4B @@ -6148,7 +6148,7 @@ GetCurrentMove: ; 3eabe (f:6abe) ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME - ld [W_LISTTYPE], a + ld [wNameListType], a call GetName ld de, wcd6d jp CopyStringToCF4B @@ -6339,7 +6339,7 @@ DoBattleTransitionAndInitBattleVariables: ; 3ec32 (f:6c32) ld [hWY], a ld [rWY], a ld [hTilesetType], a - ld hl, wd060 + ld hl, wPlayerStatsToDouble ld [hli], a ld [hli], a ld [hli], a @@ -6423,10 +6423,11 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92) hlCoord 1, 5 predef_jump Func_3f0c6 -Func_3ed02: ; 3ed02 (f:6d02) - callab Func_39680 - ld hl, Func_396a7 - ld b, BANK(Func_396a7) +; does nothing since no stats are ever selected (barring glitches) +DoubleOrHalveSelectedStats: ; 3ed02 (f:6d02) + callab DoubleSelectedStats + ld hl, HalveSelectedStats + ld b, BANK(HalveSelectedStats) jp Bankswitch ScrollTrainerPicAfterBattle: ; 3ed12 (f:6d12) diff --git a/engine/battle/e.asm b/engine/battle/e.asm index d60718cc..d124b77a 100755 --- a/engine/battle/e.asm +++ b/engine/battle/e.asm @@ -1,24 +1,25 @@ -Func_39680: ; 39680 (e:5680) - ld a, [H_WHOSETURN] ; $fff3 +; does nothing since no stats are ever selected (barring glitches) +DoubleSelectedStats: ; 39680 (e:5680) + ld a, [H_WHOSETURN] and a - ld a, [wd060] + ld a, [wPlayerStatsToDouble] ld hl, wBattleMonAttack + 1 - jr z, .asm_39691 - ld a, [wd065] + jr z, .notEnemyTurn + ld a, [wEnemyStatsToDouble] ld hl, wEnemyMonAttack + 1 -.asm_39691 - ld c, $4 +.notEnemyTurn + ld c, 4 ld b, a -.asm_39694 +.loop srl b - call c, Func_3969f + call c, .doubleStat inc hl inc hl dec c ret z - jr .asm_39694 + jr .loop -Func_3969f: ; 3969f (e:569f) +.doubleStat ld a, [hl] add a ld [hld], a @@ -27,35 +28,36 @@ Func_3969f: ; 3969f (e:569f) ld [hli], a ret -Func_396a7: ; 396a7 (e:56a7) - ld a, [H_WHOSETURN] ; $fff3 +; does nothing since no stats are ever selected (barring glitches) +HalveSelectedStats: ; 396a7 (e:56a7) + ld a, [H_WHOSETURN] and a - ld a, [wd061] + ld a, [wPlayerStatsToHalve] ld hl, wBattleMonAttack - jr z, .asm_396b8 - ld a, [wd066] + jr z, .notEnemyTurn + ld a, [wEnemyStatsToHalve] ld hl, wEnemyMonAttack -.asm_396b8 - ld c, $4 +.notEnemyTurn + ld c, 4 ld b, a -.asm_396bb +.loop srl b - call c, Func_396c6 + call c, .halveStat inc hl inc hl dec c ret z - jr .asm_396bb + jr .loop -Func_396c6: ; 396c6 (e:56c6) +.halveStat ld a, [hl] srl a ld [hli], a rr [hl] or [hl] - jr nz, .asm_396d1 - ld [hl], $1 -.asm_396d1 + jr nz, .nonzeroStat + ld [hl], 1 +.nonzeroStat dec hl ret @@ -69,41 +71,42 @@ _ScrollTrainerPicAfterBattle: ; 396d3 (e:56d3) callab _LoadTrainerPic hlCoord 19, 0 ld c, $0 -.asm_396e9 +.scrollLoop inc c ld a, c - cp $7 + cp 7 ret z ld d, $0 push bc push hl -.asm_396f2 - call Func_39707 +.drawTrainerPicLoop + call DrawTrainerPicColumn inc hl - ld a, $7 + ld a, 7 add d ld d, a dec c - jr nz, .asm_396f2 - ld c, $4 + jr nz, .drawTrainerPicLoop + ld c, 4 call DelayFrames pop hl pop bc dec hl - jr .asm_396e9 + jr .scrollLoop -Func_39707: ; 39707 (e:5707) +; write one 7-tile column of the trainer pic to the tilemap +DrawTrainerPicColumn: ; 39707 (e:5707) push hl push de push bc - ld e, $7 -.asm_3970c + ld e, 7 +.loop ld [hl], d - ld bc, $14 + ld bc, SCREEN_WIDTH add hl, bc inc d dec e - jr nz, .asm_3970c + jr nz, .loop pop bc pop de pop hl @@ -591,7 +594,7 @@ FormatMovesString: ; 39b87 (e:5b87) ld a, BANK(MoveNames) ld [wPredefBank], a ld a, MOVE_NAME - ld [W_LISTTYPE], a + ld [wNameListType], a call GetName ld hl, wcd6d .copyNameLoop @@ -630,41 +633,42 @@ FormatMovesString: ; 39b87 (e:5b87) ld [de], a ret +; XXX this is called in a few places, but it doesn't appear to do anything useful Func_39bd5: ; 39bd5 (e:5bd5) ld a, [wd11b] cp $1 jr nz, .asm_39be6 - ld hl, wEnemyPartyCount ; wEnemyPartyCount - ld de, wEnemyMonOT ; wd9ac OT names of other player - ld a, $6 + ld hl, wEnemyPartyCount + ld de, wEnemyMonOT + ld a, ENEMYOT_NAME jr .asm_39c18 .asm_39be6 cp $4 jr nz, .calcAttackStat4 - ld hl, wPartyCount ; wPartyCount - ld de, wPartyMonOT ; wd273 - ld a, $5 + ld hl, wPartyCount + ld de, wPartyMonOT + ld a, PLAYEROT_NAME jr .asm_39c18 .calcAttackStat4 cp $5 jr nz, .asm_39c02 ld hl, wStringBuffer2 + 11 - ld de, MonsterNames ; $421e - ld a, $1 + ld de, MonsterNames + ld a, MONSTER_NAME jr .asm_39c18 .asm_39c02 cp $2 jr nz, .asm_39c10 - ld hl, wNumBagItems ; wNumBagItems - ld de, ItemNames ; $472b - ld a, $4 + ld hl, wNumBagItems + ld de, ItemNames + ld a, ITEM_NAME jr .asm_39c18 .asm_39c10 ld hl, wStringBuffer2 + 11 - ld de, ItemNames ; $472b + ld de, ItemNames ld a, ITEM_NAME .asm_39c18 - ld [W_LISTTYPE], a + ld [wNameListType], a ld a, l ld [wList], a ld a, h @@ -680,19 +684,20 @@ Func_39bd5: ; 39bd5 (e:5bd5) ld [wItemPrices + 1], a ret -Func_39c37: ; 39c37 (e:5c37) +; get species of mon e in list [wcc49] for LoadMonData +GetMonSpecies: ; 39c37 (e:5c37) ld hl, wPartySpecies ld a, [wcc49] and a - jr z, .asm_39c4b + jr z, .getSpecies dec a - jr z, .asm_39c48 + jr z, .enemyParty ld hl, wBoxSpecies - jr .asm_39c4b -.asm_39c48 + jr .getSpecies +.enemyParty ld hl, wEnemyPartyMons -.asm_39c4b - ld d, $0 +.getSpecies + ld d, 0 add hl, de ld a, [hl] ld [wcf91], a @@ -955,7 +960,7 @@ TrainerAIPointers: ; 3a55c (e:655c) JugglerAI: ; 3a5e9 (e:65e9) cp $40 ret nc - jp Func_3a72a + jp AISwitchIfEnoughMons BlackbeltAI: ; 3a5ef (e:65ef) cp $20 @@ -975,12 +980,12 @@ CooltrainerMAI: ; 3a5fb (e:65fb) CooltrainerFAI: ; 3a601 (e:6601) cp $40 ld a,$A - call Func_3a7cf + call AICheckIfHPBelowFraction jp c,AIUseHyperPotion ld a,5 - call Func_3a7cf + call AICheckIfHPBelowFraction ret nc - jp Func_3a72a + jp AISwitchIfEnoughMons BrockAI: ; 3a614 (e:6614) ; if his active monster has a status condition, use a full heal @@ -1003,7 +1008,7 @@ ErikaAI: ; 3a628 (e:6628) cp $80 ret nc ld a,$A - call Func_3a7cf + call AICheckIfHPBelowFraction ret nc jp AIUseSuperPotion @@ -1021,7 +1026,7 @@ SabrinaAI: ; 3a640 (e:6640) cp $40 ret nc ld a,$A - call Func_3a7cf + call AICheckIfHPBelowFraction ret nc jp AIUseHyperPotion @@ -1029,7 +1034,7 @@ Sony2AI: ; 3a64c (e:664c) cp $20 ret nc ld a,5 - call Func_3a7cf + call AICheckIfHPBelowFraction ret nc jp AIUsePotion @@ -1037,7 +1042,7 @@ Sony3AI: ; 3a658 (e:6658) cp $20 ret nc ld a,5 - call Func_3a7cf + call AICheckIfHPBelowFraction ret nc jp AIUseFullRestore @@ -1045,7 +1050,7 @@ LoreleiAI: ; 3a664 (e:6664) cp $80 ret nc ld a,5 - call Func_3a7cf + call AICheckIfHPBelowFraction ret nc jp AIUseSuperPotion @@ -1056,11 +1061,11 @@ BrunoAI: ; 3a670 (e:6670) AgathaAI: ; 3a676 (e:6676) cp $14 - jp c,Func_3a72a + jp c,AISwitchIfEnoughMons cp $80 ret nc ld a,4 - call Func_3a7cf + call AICheckIfHPBelowFraction ret nc jp AIUseSuperPotion @@ -1068,7 +1073,7 @@ LanceAI: ; 3a687 (e:6687) cp $80 ret nc ld a,5 - call Func_3a7cf + call AICheckIfHPBelowFraction ret nc jp AIUseHyperPotion @@ -1110,7 +1115,7 @@ AIUseFullRestore: ; 3a6a0 (e:66a0) ld [de],a ld [wHPBarMaxHP+1],a ld [wEnemyMonHP],a - jr Func_3a718 + jr AIPrintItemUseAndUpdateHPBar AIUsePotion: ; 3a6ca (e:66ca) ; enemy trainer heals his monster with a potion @@ -1160,7 +1165,7 @@ AIRecoverHP: ; 3a6da (e:66da) ld a,[de] ld [wHPBarMaxHP+1],a sbc b - jr nc,Func_3a718 + jr nc,AIPrintItemUseAndUpdateHPBar inc de ld a,[de] dec de @@ -1171,7 +1176,7 @@ AIRecoverHP: ; 3a6da (e:66da) ld [wHPBarNewHP+1],a ; fallthrough -Func_3a718: ; 3a718 (e:6718) +AIPrintItemUseAndUpdateHPBar: ; 3a718 (e:6718) call AIPrintItemUse_ hlCoord 2, 2 xor a @@ -1179,7 +1184,8 @@ Func_3a718: ; 3a718 (e:6718) predef UpdateHPBar2 jp DecrementAICount -Func_3a72a: ; 3a72a (e:672a) +AISwitchIfEnoughMons: ; 3a72a (e:672a) +; enemy trainer switches if there are 3 or more unfainted mons in party ld a,[wEnemyPartyCount] ld c,a ld hl,wEnemyMon1HP @@ -1281,7 +1287,8 @@ AIUseDireHit: ; 0x3a7c2 unused ld a,DIRE_HIT jp AIPrintItemUse -Func_3a7cf: ; 3a7cf (e:67cf) +AICheckIfHPBelowFraction: ; 3a7cf (e:67cf) +; return carry if enemy trainer's current HP is below 1 / a of the maximum ld [H_DIVISOR],a ld hl,wEnemyMonMaxHP ld a,[hli] @@ -1395,7 +1402,7 @@ SetupOwnPartyPokeballs: ; 3a869 (e:6869) ld a, $8 ld [wTrainerEngageDistance], a ld hl, wOAMBuffer - jp Func_3a8e1 + jp WritePokeballOAMData SetupEnemyPartyPokeballs: ; 3a887 (e:6887) call PlaceEnemyHUDTiles @@ -1409,7 +1416,7 @@ SetupEnemyPartyPokeballs: ; 3a887 (e:6887) ld a, $f8 ld [wTrainerEngageDistance], a ld hl, wOAMBuffer + PARTY_LENGTH * 4 - jp Func_3a8e1 + jp WritePokeballOAMData SetupPokeballs: ; 0x3a8a6 ld a, [de] @@ -1421,7 +1428,7 @@ SetupPokeballs: ; 0x3a8a6 ld [de], a inc de dec c - jr nz, .emptyloop ; 0x3a8b2 $fb + jr nz, .emptyloop pop af ld de, wBuffer .monloop @@ -1461,10 +1468,10 @@ PickPokeball: ; 3a8c2 (e:68c2) add hl, bc ret -Func_3a8e1: ; 3a8e1 (e:68e1) - ld de, wHPBarMaxHP +WritePokeballOAMData: ; 3a8e1 (e:68e1) + ld de, wBuffer ld c, PARTY_LENGTH -.asm_3a8e6 +.loop ld a, [W_BASECOORDY] ; wd082 ld [hli], a ld a, [W_BASECOORDX] ; wd081 @@ -1480,7 +1487,7 @@ Func_3a8e1: ; 3a8e1 (e:68e1) ld [W_BASECOORDX], a ; wd081 inc de dec c - jr nz, .asm_3a8e6 + jr nz, .loop ret PlacePlayerHUDTiles: ; 3a902 (e:6902) @@ -1542,7 +1549,7 @@ SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948) ld a, $8 ld [wTrainerEngageDistance], a ld hl, wOAMBuffer - call Func_3a8e1 + call WritePokeballOAMData ld hl, wEnemyMons ; wEnemyMon1Species ld de, wEnemyPartyCount ; wEnemyPartyCount call SetupPokeballs @@ -1551,7 +1558,7 @@ SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948) ld [hli], a ld [hl], $68 ld hl, wOAMBuffer + $18 - jp Func_3a8e1 + jp WritePokeballOAMData ; four tiles: pokeball, black pokeball (status ailment), crossed out pokeball (faited) and pokeball slot (no mon) PokeballTileGraphics:: ; 3a97e (e:697e) diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index 86b49d30..23bffa8d 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -139,7 +139,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld [wLoadedMonSpecies], a ld [wHPBarMaxHP + 1], a ld a, MONSTER_NAME - ld [W_LISTTYPE], a + ld [wNameListType], a ld a, BANK(TrainerNames) ; bank is not used for monster names ld [wPredefBank], a call GetName diff --git a/engine/items/items.asm b/engine/items/items.asm index c9b1aead..c1268cd5 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -777,7 +777,7 @@ ItemUseMedicine: ; dabb (3:5abb) ld de,wBattleMonMaxHP ld bc,10 call CopyData ; copy party stats to in-battle stat data - predef Func_3ed02 + predef DoubleOrHalveSelectedStats jp .doneHealing .healHP inc hl ; hl = address of current HP diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index f4a40cf9..61e6204e 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -101,7 +101,7 @@ BillsPC_:: ; 0x214c2 xor a ld [wccd3], a inc a ; MONSTER_NAME - ld [W_LISTTYPE], a + ld [wNameListType], a call LoadHpBarAndStatusTilePatterns ld a, [wListScrollOffset] push af @@ -332,7 +332,7 @@ Func_216be: ; 216be (8:56be) ld [wcf93], a ld [wListMenuID], a inc a ; MONSTER_NAME - ld [W_LISTTYPE], a + ld [wNameListType], a ld a, [wcc2b] ld [wCurrentMenuItem], a call DisplayListMenuID diff --git a/engine/menu/players_pc.asm b/engine/menu/players_pc.asm index ad6c8140..147a27a4 100755 --- a/engine/menu/players_pc.asm +++ b/engine/menu/players_pc.asm @@ -2,7 +2,7 @@ PlayerPC: ; 78e6 (1:78e6) ld hl, wd730 set 6, [hl] ld a, ITEM_NAME - ld [W_LISTTYPE], a + ld [wNameListType], a call SaveScreenTilesToBuffer1 xor a ld [wcc2c], a diff --git a/engine/predefs.asm b/engine/predefs.asm index 23eb8cd1..bb8866da 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -92,7 +92,7 @@ PredefPointers:: ; 4fe79 (13:7e79) add_predef UpdateHPBar add_predef HPBarLength add_predef Diploma_TextBoxBorder - add_predef Func_3ed02 + add_predef DoubleOrHalveSelectedStats add_predef ShowPokedexMenu add_predef EvolutionAfterBattle add_predef SaveSAVtoSRAM0 diff --git a/home.asm b/home.asm index e9f37763..7a908f78 100644 --- a/home.asm +++ b/home.asm @@ -1931,7 +1931,7 @@ GetItemName:: ; 2fcf (0:2fcf) ld [wd0b5],a ld a,ITEM_NAME - ld [W_LISTTYPE],a + ld [wNameListType],a ld a,BANK(ItemNames) ld [wPredefBank],a call GetName @@ -2028,7 +2028,7 @@ HMMoves:: ; 3052 (0:3052) GetMoveName:: ; 3058 (0:3058) push hl ld a,MOVE_NAME - ld [W_LISTTYPE],a + ld [wNameListType],a ld a,[wd11e] ld [wd0b5],a ld a,BANK(MoveNames) @@ -3252,7 +3252,7 @@ NamePointers:: ; 375d (0:375d) GetName:: ; 376b (0:376b) ; arguments: ; [wd0b5] = which name -; [wd0b6] = which list (W_LISTTYPE) +; [wNameListType] = which list ; [wPredefBank] = bank of list ; ; returns pointer to name in de @@ -3269,7 +3269,7 @@ GetName:: ; 376b (0:376b) push hl push bc push de - ld a,[W_LISTTYPE] ;List3759_entrySelector + ld a,[wNameListType] ;List3759_entrySelector dec a jr nz,.otherEntries ;1 = MON_NAMES @@ -3284,7 +3284,7 @@ GetName:: ; 376b (0:376b) ld a,[wPredefBank] ld [H_LOADEDROMBANK],a ld [$2000],a - ld a,[W_LISTTYPE] ;VariousNames' entryID + ld a,[wNameListType] ;VariousNames' entryID dec a add a ld d,0 diff --git a/main.asm b/main.asm index a342b2b9..1b59a5d0 100755 --- a/main.asm +++ b/main.asm @@ -96,7 +96,7 @@ LoadMonData_: ld a, [wWhichPokemon] ld e, a - callab Func_39c37 ; get pokemon ID + callab GetMonSpecies .GetMonHeader ld a, [wcf91] diff --git a/wram.asm b/wram.asm index ba641ec3..6aabd27a 100755 --- a/wram.asm +++ b/wram.asm @@ -979,8 +979,13 @@ wCriticalHitOrOHKO:: ; d05e W_MOVEMISSED:: ; d05f ds 1 -wd060:: ds 1 -wd061:: ds 1 +wPlayerStatsToDouble:: ; d060 +; always 0 + ds 1 + +wPlayerStatsToHalve:: ; d061 +; always 0 + ds 1 W_PLAYERBATTSTATUS1:: ; d062 ; bit 0 - bide @@ -1010,8 +1015,13 @@ W_PLAYERBATTSTATUS3:: ; d064 ; bit 3 - tranformed ds 1 -wd065:: ds 1 -wd066:: ds 1 +wEnemyStatsToDouble:: ; d065 +; always 0 + ds 1 + +wEnemyStatsToHalve:: ; d066 +; always 0 + ds 1 W_ENEMYBATTSTATUS1:: ; d067 ds 1 @@ -1213,7 +1223,7 @@ W_SPRITEDECODETABLE1PTR:: ; d0b3 wd0b5:: ds 1 -W_LISTTYPE:: ; d0b6 +wNameListType:: ; d0b6 ds 1 wPredefBank:: ; d0b7 -- cgit v1.3.1-sl0p