From 83023cda1927525d942f53f87a11b642b979ea96 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 7 Feb 2015 12:27:36 -0800 Subject: commented menu stuff --- engine/overworld/pokemart.asm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm index 644c155b..4bc4c341 100755 --- a/engine/overworld/pokemart.asm +++ b/engine/overworld/pokemart.asm @@ -11,10 +11,10 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) ld [wPlayerMonNumber],a inc a ld [wcf93],a - ld a,$13 + ld a,MONEY_BOX ld [wTextBoxID],a call DisplayTextBoxID ; draw money text box - ld a,$15 + ld a,BUY_SELL_QUIT_MENU ld [wTextBoxID],a call DisplayTextBoxID ; do buy/sell/quit menu ld hl,wd128 ; pointer to this pokemart's inventory @@ -45,7 +45,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) call SaveScreenTilesToBuffer1 ; save screen .sellMenuLoop call LoadScreenTilesFromBuffer1 ; restore saved screen - ld a,$13 + ld a,MONEY_BOX ld [wTextBoxID],a call DisplayTextBoxID ; draw money text box ld hl,wNumBagItems @@ -79,7 +79,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) call PrintText hlCoord 14, 7 ld bc,$080f - ld a,$14 + ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu ld a,[wd12e] @@ -119,7 +119,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) call SaveScreenTilesToBuffer1 ; save screen .buyMenuLoop call LoadScreenTilesFromBuffer1 ; restore saved screen - ld a,$13 + ld a,MONEY_BOX ld [wTextBoxID],a call DisplayTextBoxID ; draw money text box ld hl,wStringBuffer2 + 11 @@ -150,7 +150,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) call PrintText hlCoord 14, 7 ld bc,$080f - ld a,$14 + ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu ld a,[wd12e] @@ -180,7 +180,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) jp .buyMenuLoop .returnToMainPokemartMenu call LoadScreenTilesFromBuffer1 - ld a,$13 + ld a,MONEY_BOX ld [wTextBoxID],a call DisplayTextBoxID ; draw money text box ld hl,PokemartAnythingElseText -- cgit v1.3.1-sl0p 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/battle/14.asm | 64 ++++++++++----------- engine/battle/16.asm | 2 +- engine/battle/1c.asm | 73 +++++++++++++----------- engine/battle/4.asm | 36 ++++++------ engine/battle/4_2.asm | 60 ++++++++++---------- engine/battle/5.asm | 10 ++-- engine/battle/9.asm | 48 +++++++++------- engine/battle/a.asm | 2 +- engine/battle/c.asm | 2 +- engine/battle/core.asm | 30 +++++----- engine/battle/e_2.asm | 107 +++++++++++++++++------------------ engine/cable_club.asm | 8 +-- engine/hall_of_fame.asm | 2 +- engine/hp_bar.asm | 2 +- engine/items/items.asm | 16 +++--- engine/learn_move.asm | 12 ++-- engine/menu/party_menu.asm | 8 +-- engine/menu/status_screen.asm | 2 +- engine/overworld/healing_machine.asm | 17 +++--- engine/predefs.asm | 4 +- engine/save.asm | 8 +-- home.asm | 4 +- home/text.asm | 2 +- hram.asm | 3 + main.asm | 2 +- wram.asm | 1 + 26 files changed, 272 insertions(+), 253 deletions(-) (limited to 'engine/overworld') diff --git a/engine/battle/14.asm b/engine/battle/14.asm index cabaae07..1b2d7462 100755 --- a/engine/battle/14.asm +++ b/engine/battle/14.asm @@ -1,4 +1,4 @@ -Func_525af: ; 525af (14:65af) +InitBattleVariables: ; 525af (14:65af) ld a, [hTilesetType] ld [wd0d4], a xor a @@ -9,7 +9,7 @@ Func_525af: ; 525af (14:65af) ld [hli], a ld [hli], a ld [hl], a - ld [wListScrollOffset], a ; wcc36 + ld [wListScrollOffset], a ld [wCriticalHitOrOHKO], a ld [wBattleMonSpecies], a ld [wPartyGainExpFlags], a @@ -21,73 +21,73 @@ Func_525af: ; 525af (14:65af) ld [hl], a ld hl, wccd3 ld b, $3c -.asm_525e1 +.loop ld [hli], a dec b - jr nz, .asm_525e1 + jr nz, .loop inc a ld [wccd9], a ld a, [W_CURMAP] cp SAFARI_ZONE_EAST - jr c, .asm_525f9 + jr c, .notSafariBattle cp SAFARI_ZONE_REST_HOUSE_1 - jr nc, .asm_525f9 - ld a, $2 - ld [W_BATTLETYPE], a ; wd05a -.asm_525f9 + jr nc, .notSafariBattle + ld a, $2 ; safari battle + ld [W_BATTLETYPE], a +.notSafariBattle ld hl, PlayBattleMusic ld b, BANK(PlayBattleMusic) jp Bankswitch ParalyzeEffect_: ; 52601 (14:6601) - ld hl, wEnemyMonStatus ; wcfe9 - ld de, W_PLAYERMOVETYPE ; wcfd5 - ld a, [H_WHOSETURN] ; $fff3 + ld hl, wEnemyMonStatus + ld de, W_PLAYERMOVETYPE + ld a, [H_WHOSETURN] and a - jp z, .asm_52613 + jp z, .next ld hl, wBattleMonStatus - ld de, W_ENEMYMOVETYPE ; wcfcf - -.asm_52613 + ld de, W_ENEMYMOVETYPE +.next ld a, [hl] - and a - jr nz, .asm_52659 + and a ; does the target already have a status ailment? + jr nz, .didntAffect +; check if the target is immune due to types ld a, [de] - cp EVASION_DOWN1_EFFECT - jr nz, .asm_5262a + cp ELECTRIC + jr nz, .hitTest ld b, h ld c, l inc bc ld a, [bc] - cp $4 - jr z, .asm_52666 + cp GROUND + jr z, .doesntAffect inc bc ld a, [bc] - cp $4 - jr z, .asm_52666 -.asm_5262a + cp GROUND + jr z, .doesntAffect +.hitTest push hl callab MoveHitTest pop hl ld a, [W_MOVEMISSED] and a - jr nz, .asm_52659 + jr nz, .didntAffect set PAR, [hl] callab QuarterSpeedDueToParalysis - ld c, $1e + ld c, 30 call DelayFrames - callab Func_3fba8 + callab PlayCurrentMoveAnimation ld hl, PrintMayNotAttackText ld b, BANK(PrintMayNotAttackText) jp Bankswitch -.asm_52659 - ld c, $32 +.didntAffect + ld c, 50 call DelayFrames ld hl, PrintDidntAffectText ld b, BANK(PrintDidntAffectText) jp Bankswitch -.asm_52666 - ld c, $32 +.doesntAffect + ld c, 50 call DelayFrames ld hl, PrintDoesntAffectText ld b, BANK(PrintDoesntAffectText) diff --git a/engine/battle/16.asm b/engine/battle/16.asm index d1cecbbe..4a215a37 100755 --- a/engine/battle/16.asm +++ b/engine/battle/16.asm @@ -55,7 +55,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) ld hl, UnveiledGhostText call PrintText callab LoadEnemyMonData - callab Func_708ca + callab DoGhostMarowakRevelationAnimation ld hl, WildMonAppearedText call PrintText diff --git a/engine/battle/1c.asm b/engine/battle/1c.asm index b905777b..2e360e65 100755 --- a/engine/battle/1c.asm +++ b/engine/battle/1c.asm @@ -1,85 +1,90 @@ -Func_708ca: ; 708ca (1c:48ca) +DoGhostMarowakRevelationAnimation: ; 708ca (1c:48ca) ld a, $e4 - ld [rOBP1], a ; $ff49 - call Func_7092a + ld [rOBP1], a + call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same +; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap hlCoord 12, 0 ld bc, $707 call ClearScreenArea call Delay3 xor a - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba - ld a, $91 + ld [H_AUTOBGTRANSFERENABLED], a ; disable BG transfer so we don't see the Marowak too soon +; replace ghost pic with Marowak in BG + ld a, MAROWAK ld [wHPBarMaxHP], a ld a, $1 - ld [H_WHOSETURN], a ; $fff3 + ld [H_WHOSETURN], a callab Func_79793 + ; alternate between black and light grey 8 times. + ; this makes the ghost's body appear to flash ld d, $80 - call Func_704f3 -.asm_708f6 - ld c, $a + call FlashSprite8Times +.fadeOutGhostLoop + ld c, 10 call DelayFrames - ld a, [rOBP1] ; $ff49 + ld a, [rOBP1] sla a sla a - ld [rOBP1], a ; $ff49 - jr nz, .asm_708f6 + ld [rOBP1], a + jr nz, .fadeOutGhostLoop call ClearSprites - call Func_7092a + call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM ld b, $e4 -.asm_7090d - ld c, $a +.fadeInMarowakLoop + ld c, 10 call DelayFrames - ld a, [rOBP1] ; $ff49 + ld a, [rOBP1] srl b rra srl b rra - ld [rOBP1], a ; $ff49 + ld [rOBP1], a ld a, b and a - jr nz, .asm_7090d + jr nz, .fadeInMarowakLoop ld a, $1 - ld [H_AUTOBGTRANSFERENABLED], a ; $ffba + ld [H_AUTOBGTRANSFERENABLED], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared call Delay3 jp ClearSprites -Func_7092a: ; 7092a (1c:492a) +; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM +CopyMonPicFromBGToSpriteVRAM: ; 7092a (1c:492a) ld de, vFrontPic ld hl, vSprites ld bc, 7 * 7 call CopyVideoData ld a, $10 - ld [W_BASECOORDY], a ; wd082 + ld [W_BASECOORDY], a ld a, $70 - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a ld hl, wOAMBuffer ld bc, $606 ld d, $8 -.asm_70948 +.oamLoop push bc - ld a, [W_BASECOORDY] ; wd082 + ld a, [W_BASECOORDY] ld e, a -.asm_7094d +.oamInnerLoop ld a, e add $8 ld e, a ld [hli], a - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] ld [hli], a ld a, d ld [hli], a - ld a, $10 + ld a, $10 ; use OBP1 ld [hli], a inc d dec c - jr nz, .asm_7094d + jr nz, .oamInnerLoop inc d - ld a, [W_BASECOORDX] ; wd081 + ld a, [W_BASECOORDX] add $8 - ld [W_BASECOORDX], a ; wd081 + ld [W_BASECOORDX], a pop bc dec b - jr nz, .asm_70948 + jr nz, .oamLoop ret BattleTransition: ; 7096d (1c:496d) @@ -270,9 +275,9 @@ BattleTransitionTile: ; 70a59 (1c:4a59) BattleTransition_BlackScreen: ; 70a69 (1c:4a69) ld a, $ff - ld [rBGP], a ; $ff47 - ld [rOBP0], a ; $ff48 - ld [rOBP1], a ; $ff49 + ld [rBGP], a + ld [rOBP0], a + ld [rOBP1], a ret ; for non-dungeon trainer battles diff --git a/engine/battle/4.asm b/engine/battle/4.asm index db6614cc..37ffaa05 100755 --- a/engine/battle/4.asm +++ b/engine/battle/4.asm @@ -1,14 +1,14 @@ -Func_128d8: ; 128d8 (4:68d8) - ld a, [W_YCOORD] ; wd361 +; returns whether the player is one tile outside the map in Z +IsPlayerJustOutsideMap: ; 128d8 (4:68d8) + ld a, [W_YCOORD] ld b, a - ld a, [W_CURMAPHEIGHT] ; wd368 - call Func_128ea + ld a, [W_CURMAPHEIGHT] + call .compareCoordWithMapDimension ret z - ld a, [W_XCOORD] ; wd362 + ld a, [W_XCOORD] ld b, a - ld a, [W_CURMAPWIDTH] ; wd369 - -Func_128ea: ; 128ea (4:68ea) + ld a, [W_CURMAPWIDTH] +.compareCoordWithMapDimension add a cp b ret z @@ -24,7 +24,7 @@ Func_128f6: ; 128f6 (4:68f6) call GetPredefRegisters ld a, $2 asm_128fb: ; 128fb (4:68fb) - ld [wListMenuID], a ; wListMenuID + ld [wListMenuID], a push hl ld a, [wcf99] ld b, a @@ -37,7 +37,7 @@ asm_128fb: ; 128fb (4:68fb) ld e, a ld a, $6 ld d, a - jp Func_12924 + jp DrawHPBarAndFraction .asm_12913 ld a, [wcfba] ld d, a @@ -48,21 +48,21 @@ asm_128fb: ; 128fb (4:68fb) ld d, a ld c, a -Func_12924: ; 12924 (4:6924) +DrawHPBarAndFraction: ; 12924 (4:6924) pop hl push de push hl push hl call DrawHPBar pop hl - ld a, [$fff6] + ld a, [hFlags_0xFFF6] bit 0, a - jr z, .asm_12937 - ld bc, $9 - jr .asm_1293a -.asm_12937 - ld bc, $15 -.asm_1293a + jr z, .printFractionBelowBar + ld bc, $9 ; right of bar + jr .printHPFraction +.printFractionBelowBar + ld bc, SCREEN_WIDTH + 1 ; below bar +.printHPFraction add hl, bc ld de, wcf99 ld bc, $203 diff --git a/engine/battle/4_2.asm b/engine/battle/4_2.asm index a3ef1264..287c8eae 100755 --- a/engine/battle/4_2.asm +++ b/engine/battle/4_2.asm @@ -87,7 +87,9 @@ PickUpPayDayMoneyText: ; 1386b (4:786b) TX_FAR _PickUpPayDayMoneyText db "@" -Func_13870: ; 13870 (4:7870) +; try to initiate a wild pokemon encounter +; returns success in Z +TryDoWildEncounter: ; 13870 (4:7870) ld a, [wNPCMovementScriptPointerTableNum] and a ret nz @@ -95,14 +97,14 @@ Func_13870: ; 13870 (4:7870) and a ret nz callab IsPlayerStandingOnDoorTileOrWarpTile - jr nc, .asm_13888 -.asm_13884 + jr nc, .notStandingOnDoorOrWarpTile +.CantEncounter ld a, $1 and a ret -.asm_13888 - callab Func_128d8 - jr z, .asm_13884 +.notStandingOnDoorOrWarpTile + callab IsPlayerJustOutsideMap + jr z, .CantEncounter ld a, [wRepelRemainingSteps] and a jr z, .asm_1389e @@ -110,8 +112,8 @@ Func_13870: ; 13870 (4:7870) jr z, .lastRepelStep ld [wRepelRemainingSteps], a .asm_1389e -; determine if wild pokémon can appear in the half-block we’re standing -; is the bottom right tile (9,9) of the half-block are we standing a grass/water tile? +; determine if wild pokémon can appear in the half-block we’re standing in +; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile? hlCoord 9, 9 ld c, [hl] ld a, [W_GRASSTILE] @@ -127,17 +129,17 @@ Func_13870: ; 13870 (4:7870) ; …as long as it’s not Viridian Forest or Safari Zone. ld a, [W_CURMAP] cp REDS_HOUSE_1F ; is this an indoor map? - jr c, .CantEncounter + jr c, .CantEncounter2 ld a, [W_CURMAPTILESET] cp FOREST ; Viridian Forest/Safari Zone - jr z, .CantEncounter + jr z, .CantEncounter2 ld a, [W_GRASSRATE] .CanEncounter -; weigh encounter chance to a random number to determine if there will be an encounter +; compare encounter chance with a random number to determine if there will be an encounter ld b, a ld a, [hRandomAdd] cp b - jr nc, .CantEncounter + jr nc, .CantEncounter2 ld a, [hRandomSub] ld b, a ld hl, WildMonEncounterSlotChances @@ -148,15 +150,15 @@ Func_13870: ; 13870 (4:7870) inc hl jr .determineEncounterSlot .gotEncounterSlot -; determine which wild pokémon (grass or water) can appear in the half-block we’re standing +; determine which wild pokémon (grass or water) can appear in the half-block we’re standing in ld c, [hl] ld hl, W_GRASSMONS aCoord 8, 9 - cp $14 ; is the bottom left tile (8,9) of the half-block are we standing a water tile? + cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile? jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default ld hl, W_WATERMONS ; since the bottom right tile of a "left shore" half-block is $14 but the bottom left tile is not, -; "left shore" half-blocks (such as the one in the east coast of Cinnabar), load grass encounters. +; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters. .gotWildEncounterType ld b, $0 add hl, bc @@ -172,15 +174,15 @@ Func_13870: ; 13870 (4:7870) ld b, a ld a, [W_CURENEMYLVL] cp b - jr c, .CantEncounter + jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon jr .willEncounter .lastRepelStep ld [wRepelRemainingSteps], a ld a, $d2 - ld [H_DOWNARROWBLINKCNT2], a ; $ff8c + ld [H_DOWNARROWBLINKCNT2], a call EnableAutoTextBoxDrawing call DisplayTextID -.CantEncounter +.CantEncounter2 ld a, $1 and a ret @@ -293,8 +295,8 @@ ConversionEffect_: ; 139a3 (4:79a3) inc de ld a, [hl] ld [de], a - ld hl, Func_3fba8 - call Func_139d5 + ld hl, PlayCurrentMoveAnimation + call CallBankF ld hl, ConvertedTypeText jp PrintText @@ -304,22 +306,22 @@ ConvertedTypeText: ; 139cd (4:79cd) PrintButItFailedText: ; 139d2 (4:79d2) ld hl, PrintButItFailedText_ -Func_139d5: ; 139d5 (4:79d5) +CallBankF: ; 139d5 (4:79d5) ld b, BANK(PrintButItFailedText_) jp Bankswitch HazeEffect_: ; 139da (4:79da) ld a, $7 ld hl, wPlayerMonAttackMod - call Func_13a43 + call ResetStatMods ld hl, wEnemyMonAttackMod - call Func_13a43 + call ResetStatMods ld hl, wPlayerMonUnmodifiedAttack ld de, wBattleMonAttack - call Func_13a4a + call ResetStats ld hl, wEnemyMonUnmodifiedAttack ld de, wEnemyMonAttack - call Func_13a4a + call ResetStats ld hl, wEnemyMonStatus ld de, wEnemySelectedMove ld a, [H_WHOSETURN] @@ -347,8 +349,8 @@ HazeEffect_: ; 139da (4:79da) call CureStatuses ld hl, W_ENEMYBATTSTATUS1 call CureStatuses - ld hl, Func_3fba8 - call Func_139d5 + ld hl, PlayCurrentMoveAnimation + call CallBankF ld hl, StatusChangesEliminatedText jp PrintText @@ -363,7 +365,7 @@ CureStatuses: ; 13a37 (4:7a37) ld [hl], a ret -Func_13a43: ; 13a43 (4:7a43) +ResetStatMods: ; 13a43 (4:7a43) ld b, $8 .loop ld [hli], a @@ -371,7 +373,7 @@ Func_13a43: ; 13a43 (4:7a43) jr nz, .loop ret -Func_13a4a: ; 13a4a (4:7a4a) +ResetStats: ; 13a4a (4:7a4a) ld b, $8 .loop ld a, [hli] diff --git a/engine/battle/5.asm b/engine/battle/5.asm index e534470d..ef3e1362 100755 --- a/engine/battle/5.asm +++ b/engine/battle/5.asm @@ -4,7 +4,7 @@ SubstituteEffectHandler: ; 17dad (5:7dad) ld hl, wBattleMonMaxHP ld de, wPlayerSubstituteHP ld bc, W_PLAYERBATTSTATUS2 - ld a, [$fff3] ;whose turn? + ld a, [H_WHOSETURN] and a jr z, .notEnemy ld hl, wEnemyMonMaxHP @@ -23,8 +23,8 @@ SubstituteEffectHandler: ; 17dad (5:7dad) srl a rr b push de - ld de, $fff2 ;subtract 8 to point to [current hp] instead of [max hp] - add hl, de ;HL -= 8 + ld de, wBattleMonHP - wBattleMonMaxHP + add hl, de ; point hl to current HP pop de ld a, b ld [de], a ;save copy of HP to subtract in ccd7/ccd8 [how much HP substitute has] @@ -44,8 +44,8 @@ SubstituteEffectHandler: ; 17dad (5:7dad) set HasSubstituteUp, [hl] ;set bit 4 of flags, user now has substitute ld a, [W_OPTIONS] ;load options bit 7, a ;battle animation is enabled? - ld hl, Func_3fba8 ;animation enabled: 0F:7BA8 - ld b, BANK(Func_3fba8) + ld hl, PlayCurrentMoveAnimation ;animation enabled: 0F:7BA8 + ld b, BANK(PlayCurrentMoveAnimation) jr z, .animationEnabled ld hl, AnimationSubstitute ;animation disabled: 1E:56E0 ld b, BANK(AnimationSubstitute) diff --git a/engine/battle/9.asm b/engine/battle/9.asm index eb86cce0..e7265f41 100755 --- a/engine/battle/9.asm +++ b/engine/battle/9.asm @@ -1,35 +1,43 @@ -Func_27d6b: ; 27d6b (9:7d6b) +; [wd0b5] = pokemon ID +; hl = dest addr +PrintMonType: ; 27d6b (9:7d6b) call GetPredefRegisters push hl call GetMonHeader pop hl push hl ld a, [W_MONHTYPE1] - call Func_27d89 + call PrintType ld a, [W_MONHTYPE1] ld b, a ld a, [W_MONHTYPE2] cp b pop hl - jr z, asm_27d8c - ld bc, $28 + jr z, EraseType2Text + ld bc, SCREEN_WIDTH * 2 add hl, bc -Func_27d89: ; 27d89 (9:7d89) +; a = type +; hl = dest addr +PrintType: ; 27d89 (9:7d89) push hl - jr asm_27d9f -asm_27d8c: ; 27d8c (9:7d8c) - ld a, $7f + jr PrintType_ + +; erase "TYPE2/" if the mon only has 1 type +EraseType2Text: ; 27d8c (9:7d8c) + ld a, " " ld bc, $13 add hl, bc ld bc, $6 jp FillMemory -Func_27d98: ; 27d98 (9:7d98) +PrintMoveType: ; 27d98 (9:7d98) call GetPredefRegisters push hl - ld a, [W_PLAYERMOVETYPE] ; wcfd5 -asm_27d9f: ; 27d9f (9:7d9f) + ld a, [W_PLAYERMOVETYPE] +; fall through + +PrintType_: ; 27d9f (9:7d9f) add a ld hl, TypeNames ld e, a @@ -157,19 +165,19 @@ CooltrainerFName: ; 27f79 (9:7f79) db "COOLTRAINER♀@" FocusEnergyEffect_: ; 27f86 (9:7f86) - ld hl, W_PLAYERBATTSTATUS2 ; W_PLAYERBATTSTATUS2 - ld a, [H_WHOSETURN] ; $fff3 + ld hl, W_PLAYERBATTSTATUS2 + ld a, [H_WHOSETURN] and a - jr z, .asm_27f91 - ld hl, W_ENEMYBATTSTATUS2 ; W_ENEMYBATTSTATUS2 -.asm_27f91 + jr z, .notEnemy + ld hl, W_ENEMYBATTSTATUS2 +.notEnemy bit GettingPumped, [hl] ; is mon already using focus energy? - jr nz, .asm_27fa5 + jr nz, .alreadyUsing set GettingPumped, [hl] ; mon is now using focus energy - callab Func_3fba8 - ld hl, GettingPumpedText ; $7fb2 + callab PlayCurrentMoveAnimation + ld hl, GettingPumpedText jp PrintText -.asm_27fa5 +.alreadyUsing ld c, $32 call DelayFrames ld hl, PrintButItFailedText_ diff --git a/engine/battle/a.asm b/engine/battle/a.asm index 917a462b..a257d143 100755 --- a/engine/battle/a.asm +++ b/engine/battle/a.asm @@ -21,7 +21,7 @@ LeechSeedEffect_: ; 2bea9 (a:7ea9) bit Seeded, [hl] jr nz, .asm_2bee7 set Seeded, [hl] - callab Func_3fba8 + callab PlayCurrentMoveAnimation ld hl, WasSeededText ; $7ef2 jp PrintText .asm_2bee7 diff --git a/engine/battle/c.asm b/engine/battle/c.asm index 07369375..b7c20ef6 100755 --- a/engine/battle/c.asm +++ b/engine/battle/c.asm @@ -8,7 +8,7 @@ MistEffect_: ; 33f2b (c:7f2b) bit ProtectedByMist, [hl] ; is mon protected by mist? jr nz, .asm_33f4a set ProtectedByMist, [hl] ; mon is now protected by mist - callab Func_3fba8 + callab PlayCurrentMoveAnimation ld hl, ShroudedInMistText jp PrintText .asm_33f4a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index de6bc2e3..6ea2c55b 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2541,13 +2541,13 @@ MoveSelectionMenu: ; 3d219 (f:5219) .writemoves ld de, wd0e1 - ld a, [$fff6] + ld a, [hFlags_0xFFF6] set 2, a - ld [$fff6], a + ld [hFlags_0xFFF6], a call PlaceString - ld a, [$fff6] + ld a, [hFlags_0xFFF6] res 2, a - ld [$fff6], a + ld [hFlags_0xFFF6], a ret .regularmenu @@ -2666,10 +2666,10 @@ SelectMenuItem: ; 3d2fe (f:52fe) call AddNTimes ld [hl], $ec .select - ld hl, $fff6 + ld hl, hFlags_0xFFF6 set 1, [hl] call HandleMenuInput - ld hl, $fff6 + ld hl, hFlags_0xFFF6 res 1, [hl] bit 6, a jp nz, CursorUp ; up @@ -2959,7 +2959,7 @@ PrintMenuItem: ; 3d4b6 (f:54b6) call PrintNumber call GetCurrentMove hlCoord 2, 10 - predef Func_27d98 + predef PrintMoveType .moveDisabled ld a, $1 ld [H_AUTOBGTRANSFERENABLED], a @@ -6814,7 +6814,7 @@ asm_3ef23: ; 3ef23 (f:6f23) ld a, [wNumberOfNoRandomBattleStepsLeft] and a ret nz - callab Func_13870 + callab TryDoWildEncounter ret nz asm_3ef3d: ; 3ef3d (f:6f3d) ld a, [wMapPalOffset] @@ -6823,7 +6823,7 @@ asm_3ef3d: ; 3ef3d (f:6f3d) ld a, [hl] push af res 1, [hl] - callab Func_525af + callab InitBattleVariables ld a, [wEnemyMonSpecies2] sub $c8 jp c, InitWildBattle @@ -7637,7 +7637,7 @@ UpdateStatDone: ; 3f4ca (f:74ca) call nz, Bankswitch ; play Minimize animation unless there's Substitute involved pop de .asm_3f4f9 - call Func_3fba8 + call PlayCurrentMoveAnimation ld a, [de] cp MINIMIZE jr nz, .applyBadgeBoostsAndStatusPenalties @@ -8451,7 +8451,7 @@ MimicEffect: ; 3f9ed (f:79ed) ld [hl], a ld [wd11e], a call GetMoveName - call Func_3fba8 + call PlayCurrentMoveAnimation ld hl, MimicLearnedMoveText jp PrintText .asm_3fa74 @@ -8467,7 +8467,7 @@ LeechSeedEffect: ; 3fa7c (f:7a7c) jp Bankswitch SplashEffect: ; 3fa84 (f:7a84) - call Func_3fba8 + call PlayCurrentMoveAnimation jp PrintNoEffectText DisableEffect: ; 3fa8a (f:7a8a) @@ -8662,15 +8662,15 @@ Func_3fb96: ; 3fb96 (f:7b96) ld [wcc5b], a jp Func_3fbbc -Func_3fba8: ; 3fba8 (f:7ba8) +PlayCurrentMoveAnimation: ; 3fba8 (f:7ba8) xor a ld [wcc5b], a ld a, [H_WHOSETURN] and a ld a, [W_PLAYERMOVENUM] - jr z, .asm_3fbb7 + jr z, .notEnemyTurn ld a, [W_ENEMYMOVENUM] -.asm_3fbb7 +.notEnemyTurn and a ret z diff --git a/engine/battle/e_2.asm b/engine/battle/e_2.asm index 6c159c56..1106f531 100755 --- a/engine/battle/e_2.asm +++ b/engine/battle/e_2.asm @@ -1,13 +1,13 @@ HealEffect_: ; 3b9ec (e:79ec) - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a - ld de, wBattleMonHP ; wd015 - ld hl, wBattleMonMaxHP ; wd023 - ld a, [W_PLAYERMOVENUM] ; wcfd2 + ld de, wBattleMonHP + ld hl, wBattleMonMaxHP + ld a, [W_PLAYERMOVENUM] jr z, .asm_3ba03 - ld de, wEnemyMonHP ; wEnemyMonHP - ld hl, wEnemyMonMaxHP ; wEnemyMonMaxHP - ld a, [W_ENEMYMOVENUM] ; W_ENEMYMOVENUM + ld de, wEnemyMonHP + ld hl, wEnemyMonMaxHP + ld a, [W_ENEMYMOVENUM] .asm_3ba03 ld b, a ld a, [de] @@ -16,27 +16,27 @@ HealEffect_: ; 3b9ec (e:79ec) inc hl ld a, [de] sbc [hl] - jp z, Func_3ba97 + jp z, .failed ld a, b cp REST jr nz, .asm_3ba37 push hl push de push af - ld c, $32 + ld c, 50 call DelayFrames - ld hl, wBattleMonStatus ; wBattleMonStatus - ld a, [H_WHOSETURN] ; $fff3 + ld hl, wBattleMonStatus + ld a, [H_WHOSETURN] and a jr z, .asm_3ba25 - ld hl, wEnemyMonStatus ; wcfe9 + ld hl, wEnemyMonStatus .asm_3ba25 ld a, [hl] and a ld [hl], 2 ; Number of turns from Rest - ld hl, StartedSleepingEffect ; $7aa2 + ld hl, StartedSleepingEffect jr z, .asm_3ba31 - ld hl, FellAsleepBecameHealthyText ; $7aa7 + ld hl, FellAsleepBecameHealthyText .asm_3ba31 call PrintText pop af @@ -81,9 +81,9 @@ HealEffect_: ; 3b9ec (e:79ec) ld [de], a ld [wHPBarNewHP], a .asm_3ba6f - ld hl, Func_3fba8 ; $7ba8 + ld hl, PlayCurrentMoveAnimation call BankswitchEtoF - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a hlCoord 10, 9 ld a, $1 @@ -91,15 +91,14 @@ HealEffect_: ; 3b9ec (e:79ec) hlCoord 2, 2 xor a .asm_3ba83 - ld [wListMenuID], a ; wListMenuID + ld [wListMenuID], a predef UpdateHPBar2 - ld hl, DrawHUDsAndHPBars ; $4d5a + ld hl, DrawHUDsAndHPBars call BankswitchEtoF - ld hl, RegainedHealthText ; $7aac + ld hl, RegainedHealthText jp PrintText - -Func_3ba97: ; 3ba97 (e:7a97) - ld c, $32 +.failed + ld c, 50 call DelayFrames ld hl, PrintButItFailedText_ jp BankswitchEtoF @@ -119,37 +118,37 @@ RegainedHealthText: ; 3baac (e:7aac) TransformEffect_: ; 3bab1 (e:7ab1) ld hl, wBattleMonSpecies ld de, wEnemyMonSpecies - ld bc, W_ENEMYBATTSTATUS3 ; W_ENEMYBATTSTATUS3 - ld a, [W_ENEMYBATTSTATUS1] ; W_ENEMYBATTSTATUS1 - ld a, [H_WHOSETURN] ; $fff3 + ld bc, W_ENEMYBATTSTATUS3 + ld a, [W_ENEMYBATTSTATUS1] + ld a, [H_WHOSETURN] and a jr nz, .asm_3bad1 ld hl, wEnemyMonSpecies ld de, wBattleMonSpecies - ld bc, W_PLAYERBATTSTATUS3 ; W_PLAYERBATTSTATUS3 - ld [wPlayerMoveListIndex], a ; wPlayerMoveListIndex - ld a, [W_PLAYERBATTSTATUS1] ; W_PLAYERBATTSTATUS1 + ld bc, W_PLAYERBATTSTATUS3 + ld [wPlayerMoveListIndex], a + ld a, [W_PLAYERBATTSTATUS1] .asm_3bad1 bit Invulnerable, a ; is mon invulnerable to typical attacks? (fly/dig) - jp nz, Func_3bb8c + jp nz, .failed push hl push de push bc - ld hl, W_PLAYERBATTSTATUS2 ; W_PLAYERBATTSTATUS2 - ld a, [H_WHOSETURN] ; $fff3 + ld hl, W_PLAYERBATTSTATUS2 + ld a, [H_WHOSETURN] and a jr z, .asm_3bae4 - ld hl, W_ENEMYBATTSTATUS2 ; W_ENEMYBATTSTATUS2 + ld hl, W_ENEMYBATTSTATUS2 .asm_3bae4 bit HasSubstituteUp, [hl] push af ld hl, Func_79747 ld b, BANK(Func_79747) call nz, Bankswitch - ld a, [W_OPTIONS] ; W_OPTIONS + ld a, [W_OPTIONS] add a - ld hl, Func_3fba8 ; $7ba8 - ld b, BANK(Func_3fba8) + ld hl, PlayCurrentMoveAnimation + ld b, BANK(PlayCurrentMoveAnimation) jr nc, .asm_3baff ld hl, AnimationTransformMon ld b, BANK(AnimationTransformMon) @@ -178,7 +177,7 @@ TransformEffect_: ; 3bab1 (e:7ab1) inc bc inc bc call CopyData - ld a, [H_WHOSETURN] ; $fff3 + ld a, [H_WHOSETURN] and a jr z, .asm_3bb32 ld a, [de] @@ -228,15 +227,15 @@ TransformEffect_: ; 3bab1 (e:7ab1) call GetMonName ld hl, wEnemyMonUnmodifiedAttack ld de, wPlayerMonUnmodifiedAttack - call Func_3bb7d - ld hl, wEnemyMonStatMods ; wcd2e - ld de, wPlayerMonStatMods ; wcd1a - call Func_3bb7d - ld hl, TransformedText ; $7b92 + call .copyBasedOnTurn + ld hl, wEnemyMonStatMods + ld de, wPlayerMonStatMods + call .copyBasedOnTurn + ld hl, TransformedText jp PrintText -Func_3bb7d: ; 3bb7d (e:7b7d) - ld a, [H_WHOSETURN] ; $fff3 +.copyBasedOnTurn + ld a, [H_WHOSETURN] and a jr z, .asm_3bb86 push hl @@ -247,8 +246,8 @@ Func_3bb7d: ; 3bb7d (e:7b7d) ld bc, $8 jp CopyData -Func_3bb8c: ; 3bb8c (e:7b8c) - ld hl, PrintButItFailedText_ ; $7b53 +.failed + ld hl, PrintButItFailedText_ jp BankswitchEtoF TransformedText: ; 3bb92 (e:7b92) @@ -256,13 +255,13 @@ TransformedText: ; 3bb92 (e:7b92) db "@" ReflectLightScreenEffect_: ; 3bb97 (e:7b97) - ld hl, W_PLAYERBATTSTATUS3 ; W_PLAYERBATTSTATUS3 - ld de, W_PLAYERMOVEEFFECT ; wcfd3 - ld a, [H_WHOSETURN] ; $fff3 + ld hl, W_PLAYERBATTSTATUS3 + ld de, W_PLAYERMOVEEFFECT + ld a, [H_WHOSETURN] and a jr z, .asm_3bba8 - ld hl, W_ENEMYBATTSTATUS3 ; W_ENEMYBATTSTATUS3 - ld de, W_ENEMYMOVEEFFECT ; W_ENEMYMOVEEFFECT + ld hl, W_ENEMYBATTSTATUS3 + ld de, W_ENEMYMOVEEFFECT .asm_3bba8 ld a, [de] cp LIGHT_SCREEN_EFFECT @@ -270,23 +269,23 @@ ReflectLightScreenEffect_: ; 3bb97 (e:7b97) bit HasLightScreenUp, [hl] ; is mon already protected by light screen? jr nz, .moveFailed set HasLightScreenUp, [hl] ; mon is now protected by light screen - ld hl, LightScreenProtectedText ; $7bd7 + ld hl, LightScreenProtectedText jr .asm_3bbc1 .reflect bit HasReflectUp, [hl] ; is mon already protected by reflect? jr nz, .moveFailed set HasReflectUp, [hl] ; mon is now protected by reflect - ld hl, ReflectGainedArmorText ; $7bdc + ld hl, ReflectGainedArmorText .asm_3bbc1 push hl - ld hl, Func_3fba8 ; $7ba8 + ld hl, PlayCurrentMoveAnimation call BankswitchEtoF pop hl jp PrintText .moveFailed ld c, $32 call DelayFrames - ld hl, PrintButItFailedText_ ; $7b53 + ld hl, PrintButItFailedText_ jp BankswitchEtoF LightScreenProtectedText: ; 3bbd7 (e:7bd7) diff --git a/engine/cable_club.asm b/engine/cable_club.asm index 92a4e33b..68c6a8dc 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -338,10 +338,10 @@ TradeCenter_SelectMon: ld a, 1 ld [wTopMenuItemX], a .enemyMonMenu_HandleInput - ld hl, $fff6 + ld hl, hFlags_0xFFF6 set 1, [hl] call HandleMenuInput - ld hl, $fff6 + ld hl, hFlags_0xFFF6 res 1, [hl] and a jp z, .getNewInput @@ -403,10 +403,10 @@ TradeCenter_SelectMon: ld bc, $0601 call ClearScreenArea .playerMonMenu_HandleInput - ld hl, $fff6 + ld hl, hFlags_0xFFF6 set 1, [hl] call HandleMenuInput - ld hl, $fff6 + ld hl, hFlags_0xFFF6 res 1, [hl] and a ; was anything pressed? jr nz, .playerMonMenu_SomethingPressed diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index 80acfeeb..30979118 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -170,7 +170,7 @@ Func_702f0: ; 702f0 (1c:42f0) ld a, [wWhichTrade] ; wWhichTrade ld [wd0b5], a hlCoord 3, 9 - predef Func_27d6b + predef PrintMonType ld a, [wWhichTrade] ; wWhichTrade jp PlayCry diff --git a/engine/hp_bar.asm b/engine/hp_bar.asm index 9ff9e3cf..a53511c7 100755 --- a/engine/hp_bar.asm +++ b/engine/hp_bar.asm @@ -211,7 +211,7 @@ UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5) ld a, [wHPBarOldHP+1] ld [wcef0], a push hl - ld a, [$fff6] + ld a, [hFlags_0xFFF6] bit 0, a jr z, .asm_fb15 ld de, $9 diff --git a/engine/items/items.asm b/engine/items/items.asm index 05f77175..99c97fef 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -919,15 +919,15 @@ ItemUseMedicine: ; dabb (3:5abb) call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled ld a,(SFX_02_3d - SFX_Headers_02) / 3 call PlaySoundWaitForCurrent ; play sound - ld a,[$fff6] + ld a,[hFlags_0xFFF6] set 0,a - ld [$fff6],a + ld [hFlags_0xFFF6],a ld a,$02 ld [wListMenuID],a predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled - ld a,[$fff6] + ld a,[hFlags_0xFFF6] res 0,a - ld [$fff6],a + ld [hFlags_0xFFF6],a pop af ld b,a ; store heal amount (1/5 of max HP) ld hl,wHPBarOldHP + 1 @@ -1069,15 +1069,15 @@ ItemUseMedicine: ; dabb (3:5abb) jr z,.playStatusAilmentCuringSound ld a,(SFX_02_3d - SFX_Headers_02) / 3 ; HP healing sound call PlaySoundWaitForCurrent ; play sound - ld a,[$fff6] + ld a,[hFlags_0xFFF6] set 0,a - ld [$fff6],a + ld [hFlags_0xFFF6],a ld a,$02 ld [wListMenuID],a predef UpdateHPBar2 ; animate the HP bar lengthening - ld a,[$fff6] + ld a,[hFlags_0xFFF6] res 0,a - ld [$fff6],a + ld [hFlags_0xFFF6],a ld a,$f7 ; revived message ld [wd07d],a ld a,[wcf91] diff --git a/engine/learn_move.asm b/engine/learn_move.asm index f96c1aeb..c991058d 100755 --- a/engine/learn_move.asm +++ b/engine/learn_move.asm @@ -126,13 +126,13 @@ TryingToLearn: ; 6f07 (1:6f07) call TextBoxBorder hlCoord 6, 8 ld de, wd0e1 - ld a, [$fff6] + ld a, [hFlags_0xFFF6] set 2, a - ld [$fff6], a + ld [hFlags_0xFFF6], a call PlaceString - ld a, [$fff6] + ld a, [hFlags_0xFFF6] res 2, a - ld [$fff6], a + ld [hFlags_0xFFF6], a ld hl, wTopMenuItemY ld a, $8 ld [hli], a @@ -146,10 +146,10 @@ TryingToLearn: ; 6f07 (1:6f07) ld a, $3 ld [hli], a ld [hl], $0 - ld hl, $fff6 + ld hl, hFlags_0xFFF6 set 1, [hl] call HandleMenuInput - ld hl, $fff6 + ld hl, hFlags_0xFFF6 res 1, [hl] push af call LoadScreenTilesFromBuffer1 diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm index 10fc4182..a2c02481 100755 --- a/engine/menu/party_menu.asm +++ b/engine/menu/party_menu.asm @@ -88,14 +88,14 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3) pop hl push hl ld bc,20 + 1 ; down 1 row and right 1 column - ld a,[$FFF6] + ld a,[hFlags_0xFFF6] set 0,a - ld [$FFF6],a + ld [hFlags_0xFFF6],a add hl,bc predef Func_128f6 ; draw HP bar and prints current / max HP - ld a,[$FFF6] + ld a,[hFlags_0xFFF6] res 0,a - ld [$FFF6],a + ld [hFlags_0xFFF6],a call SetPartyMenuHealthBarColor ; color the HP bar (on SGB) pop hl jr .printLevel diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index f215fd0e..2fc5e713 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -82,7 +82,7 @@ StatusScreen: ; 12953 (4:6953) ld bc, $8103 ; Zero-padded, 3 call PrintNumber ; Pokémon no. hlCoord 11, 10 - predef Func_27d6b ; Prints the type (?) + predef PrintMonType ld hl, NamePointers2 ; $6a9d call .unk_12a7e ld d, h diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index 53174630..90d306c3 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -48,7 +48,7 @@ AnimateHealingMachine: ; 70433 (1c:4433) ld [wc0ee], a call PlaySound ld d, $28 - call Func_704f3 + call FlashSprite8Times .asm_704a2 ld a, [wc026] cp MUSIC_PKMN_HEALED @@ -74,16 +74,17 @@ PokeCenterOAMData: ; 704d7 (1c:44d7) db $35,$30,$7D,$10 db $35,$38,$7D,$30 -Func_704f3: ; 704f3 (1c:44f3) - ld b, $8 -.asm_704f5 - ld a, [rOBP1] ; $ff49 +; d = value to xor with palette +FlashSprite8Times: ; 704f3 (1c:44f3) + ld b, 8 +.loop + ld a, [rOBP1] xor d - ld [rOBP1], a ; $ff49 - ld c, $a + ld [rOBP1], a + ld c, 10 call DelayFrames dec b - jr nz, .asm_704f5 + jr nz, .loop ret Func_70503: ; 70503 (1c:4503) 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 diff --git a/engine/save.asm b/engine/save.asm index 29c839f3..c1231871 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -346,10 +346,10 @@ ChangeBox:: ; 738a1 (1c:78a1) call z, Func_73a29 call Func_7393f call UpdateSprites - ld hl, $fff6 + ld hl, hFlags_0xFFF6 set 1, [hl] call HandleMenuInput - ld hl, $fff6 + ld hl, hFlags_0xFFF6 res 1, [hl] bit 1, a ret nz @@ -436,12 +436,12 @@ Func_7393f: ; 7393f (1c:793f) ld b, $c ld c, $7 call TextBoxBorder - ld hl, $fff6 + ld hl, hFlags_0xFFF6 set 2, [hl] ld de, BoxNames ; $79d9 hlCoord 13, 1 call PlaceString - ld hl, $fff6 + ld hl, hFlags_0xFFF6 res 2, [hl] ld a, [wd5a0] and $7f diff --git a/home.asm b/home.asm index 00da859a..be56a70a 100644 --- a/home.asm +++ b/home.asm @@ -4046,7 +4046,7 @@ PlaceMenuCursor:: ; 3b7c (0:3b7c) and a ; was the previous menu id 0? jr z,.checkForArrow1 push af - ld a,[$fff6] + ld a,[hFlags_0xFFF6] bit 1,a ; is the menu double spaced? jr z,.doubleSpaced1 ld bc,20 @@ -4072,7 +4072,7 @@ PlaceMenuCursor:: ; 3b7c (0:3b7c) and a jr z,.checkForArrow2 push af - ld a,[$fff6] + ld a,[hFlags_0xFFF6] bit 1,a ; is the menu double spaced? jr z,.doubleSpaced2 ld bc,20 diff --git a/home/text.asm b/home/text.asm index 362347cc..276b652e 100644 --- a/home/text.asm +++ b/home/text.asm @@ -62,7 +62,7 @@ PlaceNextChar:: ; 1956 (0:1956) cp $4E jr nz,.next ld bc,$0028 - ld a,[$FFF6] + ld a,[hFlags_0xFFF6] bit 2,a jr z,.next2 ld bc,$14 diff --git a/hram.asm b/hram.asm index dfe14d66..29eb4353 100644 --- a/hram.asm +++ b/hram.asm @@ -151,5 +151,8 @@ H_CURRENTSPRITEOFFSET EQU $FFDA ; multiple of $10 H_WHOSETURN EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn +; bit 0: draw HP fraction to the right of bar instead of below (for party menu) +hFlags_0xFFF6 EQU $FFF6 + hJoyInput EQU $FFF8 diff --git a/main.asm b/main.asm index b40093aa..6f5b5324 100755 --- a/main.asm +++ b/main.asm @@ -126,7 +126,7 @@ LoadMonData_: .copyMonData ld de, wcf98 - ld bc, 44 + ld bc, wPartyMon2 - wPartyMon1 jp CopyData diff --git a/wram.asm b/wram.asm index f55b383a..389b4cc4 100755 --- a/wram.asm +++ b/wram.asm @@ -824,6 +824,7 @@ wcfbc:: ds 2 wcfbe:: ds 2 wcfc0:: ds 2 wcfc2:: ds 2 + wcfc4:: ds 1 wWalkCounter:: ; cfc5 -- cgit v1.3.1-sl0p From 32f7cf12de9f841f76a3f2010caf6d7a80d47bcc Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 7 Feb 2015 18:37:40 -0800 Subject: Named wram symbols --- engine/battle/4.asm | 12 ++++----- engine/battle/core.asm | 22 ++++++++-------- engine/battle/e.asm | 10 ++++---- engine/cable_club.asm | 4 +-- engine/evos_moves.asm | 16 ++++++------ engine/experience.asm | 4 +-- engine/menu/bills_pc.asm | 4 +-- engine/menu/party_menu.asm | 4 +-- engine/menu/players_pc.asm | 12 ++++----- engine/menu/start_sub_menus.asm | 4 +-- engine/menu/status_screen.asm | 40 ++++++++++++++--------------- engine/overworld/map_sprites.asm | 6 ++--- engine/overworld/movement.asm | 4 +-- engine/overworld/pokemart.asm | 8 +++--- engine/predefs7.asm | 4 +-- home.asm | 54 ++++++++++++++++++++-------------------- hram.asm | 3 +++ main.asm | 16 ++++++------ scripts/ceruleanhouse2.asm | 4 +-- wram.asm | 39 ++++++++++++----------------- 20 files changed, 133 insertions(+), 137 deletions(-) (limited to 'engine/overworld') diff --git a/engine/battle/4.asm b/engine/battle/4.asm index 37ffaa05..97db1ba3 100755 --- a/engine/battle/4.asm +++ b/engine/battle/4.asm @@ -26,9 +26,9 @@ Func_128f6: ; 128f6 (4:68f6) asm_128fb: ; 128fb (4:68fb) ld [wListMenuID], a push hl - ld a, [wcf99] + ld a, [wLoadedMonHP] ld b, a - ld a, [wcf9a] + ld a, [wLoadedMonHP + 1] ld c, a or b jr nz, .asm_12913 @@ -39,9 +39,9 @@ asm_128fb: ; 128fb (4:68fb) ld d, a jp DrawHPBarAndFraction .asm_12913 - ld a, [wcfba] + ld a, [wLoadedMonMaxHP] ld d, a - ld a, [wcfbb] + ld a, [wLoadedMonMaxHP + 1] ld e, a predef HPBarLength ld a, $6 @@ -64,12 +64,12 @@ DrawHPBarAndFraction: ; 12924 (4:6924) ld bc, SCREEN_WIDTH + 1 ; below bar .printHPFraction add hl, bc - ld de, wcf99 + ld de, wLoadedMonHP ld bc, $203 call PrintNumber ld a, "/" ld [hli], a - ld de, wcfba + ld de, wLoadedMonMaxHP ld bc, $203 call PrintNumber pop hl diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 6ea2c55b..a502ed7c 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1899,23 +1899,23 @@ DrawPlayerHUDAndHPBar: ; 3cd60 (f:4d60) call CenterMonName call PlaceString ld hl, wBattleMonSpecies - ld de, wcf98 + ld de, wLoadedMon ld bc, $c call CopyData ld hl, wBattleMonLevel - ld de, wcfb9 + ld de, wLoadedMonLevel ld bc, $b call CopyData hlCoord 14, 8 push hl inc hl - ld de, wcf9c + ld de, wLoadedMonStatus call PrintStatusConditionNotFainted pop hl jr nz, .asm_3cdae call PrintLevel .asm_3cdae - ld a, [wcf98] + ld a, [wLoadedMonSpecies] ld [wcf91], a hlCoord 10, 9 predef DrawHP @@ -1965,7 +1965,7 @@ DrawEnemyHUDAndHPBar: ; 3cdec (f:4dec) pop hl jr nz, .skipPrintLevel ; if the mon has a status condition, skip printing the level ld a, [wEnemyMonLevel] - ld [wcfb9], a + ld [wLoadedMonLevel], a call PrintLevel .skipPrintLevel ld hl, wEnemyMonHP @@ -2270,9 +2270,9 @@ BagWasSelected: jr nz, DisplayPlayerBag ; no, it is a normal battle ld hl, OldManItemList ld a, l - ld [wcf8b], a + ld [wList], a ld a, h - ld [wcf8c], a + ld [wList + 1], a jr DisplayBagMenu OldManItemList: @@ -2284,9 +2284,9 @@ DisplayPlayerBag: ; get the pointer to player's bag when in a normal battle ld hl, wNumBagItems ld a, l - ld [wcf8b], a + ld [wList], a ld a, h - ld [wcf8c], a + ld [wList + 1], a DisplayBagMenu: xor a @@ -4451,7 +4451,7 @@ GetEnemyMonStat: ; 3df1c (f:5f1c) ld [wd0b5], a call GetMonHeader ld hl, wEnemyMonDVs - ld de, wcfaf + ld de, wLoadedMonSpeedExp ld a, [hli] ld [de], a inc de @@ -4459,7 +4459,7 @@ GetEnemyMonStat: ; 3df1c (f:5f1c) ld [de], a pop bc ld b, $0 - ld hl, wcfa4 + ld hl, wLoadedMonSpeedExp - $b ; this base address makes CalcStat look in [wLoadedMonSpeedExp] for DVs call CalcStat pop de ret diff --git a/engine/battle/e.asm b/engine/battle/e.asm index 9f93baa6..ff3ac839 100755 --- a/engine/battle/e.asm +++ b/engine/battle/e.asm @@ -665,18 +665,18 @@ Func_39bd5: ; 39bd5 (e:5bd5) .asm_39c18 ld [W_LISTTYPE], a ld a, l - ld [wcf8b], a + ld [wList], a ld a, h - ld [wcf8c], a + ld [wList + 1], a ld a, e ld [wcf8d], a ld a, d ld [wcf8e], a - ld bc, ItemPrices ; $4608 + ld bc, ItemPrices ld a, c - ld [wcf8f], a + ld [wItemPrices], a ld a, b - ld [wcf90], a + ld [wItemPrices + 1], a ret Func_39c37: ; 39c37 (e:5c37) diff --git a/engine/cable_club.asm b/engine/cable_club.asm index 68c6a8dc..ff25fd5e 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -578,7 +578,7 @@ TradeCenter_SelectMon: ReturnToCableClubRoom: ; 577d (1:577d) call GBPalWhiteOutWithDelay3 - ld hl, wcfc4 + ld hl, wCharRAMInUseForText ld a, [hl] push af push hl @@ -808,7 +808,7 @@ TradeCenter_Trade: ld a, c ld bc, wEnemyMon2 - wEnemyMon1 call AddNTimes - ld de, wcf98 + ld de, wLoadedMon ld bc, wEnemyMon2 - wEnemyMon1 call CopyData call AddEnemyMonToPlayerParty diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index 2c504104..2eef7ba7 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -88,7 +88,7 @@ Evolution_PartyMonLoop: ; loop over party mons jp nz, .nextEvoEntry1 ; if not trading, go to the next evolution entry ld a, [hli] ; level requirement ld b, a - ld a, [wcfb9] + ld a, [wLoadedMonLevel] cp b ; is the mon's level greater than the evolution requirement? jp c, Evolution_PartyMonLoop ; if so, go the next mon jr .asm_3adb6 @@ -101,7 +101,7 @@ Evolution_PartyMonLoop: ; loop over party mons .checkLevel ld a, [hli] ; level requirement ld b, a - ld a, [wcfb9] + ld a, [wLoadedMonLevel] cp b ; is the mon's level greater than the evolution requirement? jp c, .nextEvoEntry2 ; if so, go the next evolution entry .asm_3adb6 @@ -136,7 +136,7 @@ Evolution_PartyMonLoop: ; loop over party mons pop hl ld a, [hl] ld [wd0b5], a - ld [wcf98], a + ld [wLoadedMonSpecies], a ld [wHPBarMaxHP + 1], a ld a, MONSTER_NAME ld [W_LISTTYPE], a @@ -169,8 +169,8 @@ Evolution_PartyMonLoop: ; loop over party mons ld [W_MONHDEXNUM], a pop af ld [wd11e], a - ld hl, wcfa8 - ld de, wcfba + ld hl, wLoadedMonHPExp - 1 + ld de, wLoadedMonStats ld b, $1 call CalcStats ld a, [wWhichPokemon] @@ -186,14 +186,14 @@ Evolution_PartyMonLoop: ; loop over party mons ld a, [hli] ld b, a ld c, [hl] - ld hl, wcfbb + ld hl, wLoadedMonMaxHP + 1 ld a, [hld] sub c ld c, a ld a, [hl] sbc b ld b, a - ld hl, wcf9a + ld hl, wLoadedMonHP + 1 ld a, [hl] add c ld [hld], a @@ -226,7 +226,7 @@ Evolution_PartyMonLoop: ; loop over party mons call Evolution_FlagAction pop de pop hl - ld a, [wcf98] + ld a, [wLoadedMonSpecies] ld [hl], a push hl ld l, e diff --git a/engine/experience.asm b/engine/experience.asm index 91f1dd5d..68d22843 100755 --- a/engine/experience.asm +++ b/engine/experience.asm @@ -1,6 +1,6 @@ ; calculates the level a mon should be based on its current exp CalcLevelFromExperience: ; 58f43 (16:4f43) - ld a, [wcf98] + ld a, [wLoadedMonSpecies] ld [wd0b5], a call GetMonHeader ld d, $1 ; init level to 1 @@ -8,7 +8,7 @@ CalcLevelFromExperience: ; 58f43 (16:4f43) inc d ; increment level call CalcExperience push hl - ld hl, wcfa8 ; current exp + ld hl, wLoadedMonExp + 2 ; current exp ; compare exp needed for level d with current exp ld a, [H_MULTIPLICAND + 2] ld c, a diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index a26c5aed..9e8422c0 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -325,9 +325,9 @@ Func_216b3: ; 216b3 (8:56b3) Func_216be: ; 216be (8:56be) ld a, l - ld [wcf8b], a + ld [wList], a ld a, h - ld [wcf8c], a + ld [wList + 1], a xor a ld [wcf93], a ld [wListMenuID], a ; wListMenuID diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm index a2c02481..86474be9 100755 --- a/engine/menu/party_menu.asm +++ b/engine/menu/party_menu.asm @@ -83,7 +83,7 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3) push hl ld bc,14 ; 14 columns to the right add hl,bc - ld de,wcf9c + ld de,wLoadedMonStatus call PrintStatusCondition pop hl push hl @@ -134,7 +134,7 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3) push hl ld hl,EvosMovesPointerTable ld b,0 - ld a,[wcf98] ; pokemon ID + ld a,[wLoadedMonSpecies] dec a add a rl b diff --git a/engine/menu/players_pc.asm b/engine/menu/players_pc.asm index 5f1175eb..5217befa 100755 --- a/engine/menu/players_pc.asm +++ b/engine/menu/players_pc.asm @@ -97,9 +97,9 @@ Func_79ab: ; 79ab (1:79ab) call PrintText ld hl, wNumBagItems ; wNumBagItems ld a, l - ld [wcf8b], a + ld [wList], a ld a, h - ld [wcf8c], a + ld [wList + 1], a xor a ld [wcf93], a ld a, $3 @@ -151,9 +151,9 @@ Func_7a28: ; 7a28 (1:7a28) call PrintText ld hl, wNumBoxItems ; wNumBoxItems ld a, l - ld [wcf8b], a + ld [wList], a ld a, h - ld [wcf8c], a + ld [wList + 1], a xor a ld [wcf93], a ld a, $3 @@ -205,9 +205,9 @@ Func_7aa5: ; 7aa5 (1:7aa5) call PrintText ld hl, wNumBoxItems ; wNumBoxItems ld a, l - ld [wcf8b], a + ld [wList], a ld a, h - ld [wcf8c], a + ld [wList + 1], a xor a ld [wcf93], a ld a, $3 diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 1bedb0ea..589224ab 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -308,10 +308,10 @@ StartMenu_Item: ; 13302 (4:7302) jr .exitMenu .notInCableClubRoom ld bc,wNumBagItems - ld hl,wcf8b + ld hl,wList ld a,c ld [hli],a - ld [hl],b ; store item bag pointer at wcf8b (for DisplayListMenuID) + ld [hl],b ; store item bag pointer at wList (for DisplayListMenuID) xor a ld [wcf93],a ld a,ITEMLISTMENU diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index 2fc5e713..79daa0c0 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -4,11 +4,11 @@ StatusScreen: ; 12953 (4:6953) ld a, [wcc49] cp $2 ; 2 means we're in a PC box jr c, .DontRecalculate ; 0x1295b $14 - ld a, [wcf9b] - ld [wcfb9], a + ld a, [wLoadedMonBoxLevel] + ld [wLoadedMonLevel], a ld [W_CURENEMYLVL], a - ld hl, wcfa8 - ld de, wcfba + ld hl, wLoadedMonHPExp - 1 + ld de, wLoadedMonStats ld b, $1 call CalcStats ; Recalculate stats .DontRecalculate @@ -61,7 +61,7 @@ StatusScreen: ; 12953 (4:6953) ld b, $3 call GoPAL_SET ; SGB palette hlCoord 16, 6 - ld de, wcf9c + ld de, wLoadedMonStatus call PrintStatusCondition jr nz, .StatusWritten ; 0x129fc $9 hlCoord 16, 6 @@ -96,7 +96,7 @@ StatusScreen: ; 12953 (4:6953) hlCoord 12, 16 call PlaceString ; OT hlCoord 12, 14 - ld de, wcfa4 + ld de, wLoadedMonOTID ld bc, $8205 ; 5 call PrintNumber ; ID Number ld d, $0 @@ -203,14 +203,14 @@ PrintStatsBox: ; 12ae4 (4:6ae4) pop hl pop bc add hl, bc - ld de, wcfbc + ld de, wLoadedMonAttack ld bc, $0203 ; three digits call PrintStat - ld de, wcfbe + ld de, wLoadedMonDefense call PrintStat - ld de, wcfc0 + ld de, wLoadedMonSpeed call PrintStat - ld de, wcfc2 + ld de, wLoadedMonSpecial jp PrintNumber PrintStat push hl @@ -235,7 +235,7 @@ StatusScreen2: ; 12b57 (4:6b57) ld bc, $0005 ld hl, wd0dc call FillMemory - ld hl, wcfa0 + ld hl, wLoadedMonMoves ld de, wd0dc ld bc, $0004 call CopyData @@ -269,7 +269,7 @@ StatusScreen2: ; 12b57 (4:6b57) ld a, "-" call Func_12ccb ; Fill the rest with -- .InitPP ; 12bbb - ld hl, wcfa0 + ld hl, wLoadedMonMoves deCoord 14, 10 ld b, $0 .PrintPP ; 12bc3 @@ -323,12 +323,12 @@ StatusScreen2: ; 12b57 (4:6b57) hlCoord 9, 3 ld de, EXPPointsText call PlaceString - ld a, [wcfb9] ; level + ld a, [wLoadedMonLevel] ; level push af cp MAX_LEVEL jr z, .Level100 ; 0x12c20 $4 inc a - ld [wcfb9], a ; Increase temporarily if not 100 + ld [wLoadedMonLevel], a ; Increase temporarily if not 100 .Level100 hlCoord 14, 6 ld [hl], $70 ; 1-tile "to" @@ -336,13 +336,13 @@ StatusScreen2: ; 12b57 (4:6b57) inc hl call PrintLevel pop af - ld [wcfb9], a - ld de, wcfa6 + ld [wLoadedMonLevel], a + ld de, wLoadedMonExp hlCoord 12, 4 ld bc, $0307 call PrintNumber ; exp call .asm_12c86 - ld de, wcfa6 + ld de, wLoadedMonExp hlCoord 7, 6 ld bc, $0307 call PrintNumber @@ -368,13 +368,13 @@ StatusScreen2: ; 12b57 (4:6b57) call GBPalWhiteOut jp ClearScreen .asm_12c86 ; This does some magic with lvl/exp? - ld a, [wcfb9] ; Load level + ld a, [wLoadedMonLevel] ; Load level cp MAX_LEVEL jr z, .asm_12ca7 ; 0x12c8b $1a ; If 100 inc a ld d, a callab CalcExperience - ld hl, wcfa8 + ld hl, wLoadedMonExp + 2 ld a, [$ff98] sub [hl] ld [hld], a @@ -386,7 +386,7 @@ StatusScreen2: ; 12b57 (4:6b57) ld [hld], a ret .asm_12ca7 - ld hl, wcfa6 + ld hl, wLoadedMonExp xor a ld [hli], a ld [hli], a diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 81443c9f..16403759 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -159,7 +159,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) ld l,e pop de ld b,a - ld a,[wcfc4] + ld a,[wCharRAMInUseForText] bit 0,a ; reloading upper half of tile patterns after displaying text? jr nz,.skipFirstLoad ; if so, skip loading data into the lower half ld a,b @@ -180,7 +180,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) jr nc,.noCarry3 inc d .noCarry3 - ld a,[wcfc4] + ld a,[wCharRAMInUseForText] bit 0,a ; reloading upper half of tile patterns after displaying text? jr nz,.loadWhileLCDOn pop af @@ -264,7 +264,7 @@ InitOutsideMapSprites: ; 1797b (5:797b) cp a,$f0 ; does the map have 2 sprite sets? call nc,GetSplitMapSpriteSetID ; if so, choose the appropriate one ld b,a ; b = spriteSetID - ld a,[wcfc4] + ld a,[wCharRAMInUseForText] bit 0,a ; reloading upper half of tile patterns after displaying text? jr nz,.loadSpriteSet ; if so, forcibly reload the sprite set ld a,[W_SPRITESETID] diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 3b9cac7d..1658b0e9 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -52,7 +52,7 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) jr .asm_4eab .asm_4e86 ld [wSpriteStateData1 + 9], a - ld a, [wcfc4] + ld a, [wCharRAMInUseForText] bit 0, a jr nz, .asm_4e7d .asm_4e90 @@ -130,7 +130,7 @@ Func_4ed1: ; 4ed1 (1:4ed1) bit 7, a jp nz, InitializeSpriteFacingDirection ; c1x1 >= $80 ld b, a - ld a, [wcfc4] + ld a, [wCharRAMInUseForText] bit 0, a jp nz, notYetMoving ld a, b diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm index 4bc4c341..8325b93f 100755 --- a/engine/overworld/pokemart.asm +++ b/engine/overworld/pokemart.asm @@ -50,9 +50,9 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) call DisplayTextBoxID ; draw money text box ld hl,wNumBagItems ld a,l - ld [wcf8b],a + ld [wList],a ld a,h - ld [wcf8c],a + ld [wList + 1],a xor a ld [wcf93],a ld [wCurrentMenuItem],a @@ -124,9 +124,9 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20) call DisplayTextBoxID ; draw money text box ld hl,wStringBuffer2 + 11 ld a,l - ld [wcf8b],a + ld [wList],a ld a,h - ld [wcf8c],a + ld [wList + 1],a xor a ld [wCurrentMenuItem],a inc a diff --git a/engine/predefs7.asm b/engine/predefs7.asm index b6c3bbbc..e2f58ca8 100755 --- a/engine/predefs7.asm +++ b/engine/predefs7.asm @@ -3,9 +3,9 @@ Func_1c9c6: ; 1c9c6 (7:49c6) call PrintText ld hl, wStringBuffer2 + 11 ld a, l - ld [wcf8b], a + ld [wList], a ld a, h - ld [wcf8c], a + ld [wList + 1], a ld a, [wListScrollOffset] ; wcc36 push af xor a diff --git a/home.asm b/home.asm index be56a70a..ef7d35bb 100644 --- a/home.asm +++ b/home.asm @@ -239,7 +239,7 @@ DrawHPBar:: ; 1336 (0:1336) ret -; loads pokemon data from one of multiple sources to wcf98 +; loads pokemon data from one of multiple sources to wLoadedMon ; loads base stats to W_MONHDEXNUM ; INPUT: ; [wWhichPokemon] = index of pokemon within party/box @@ -250,7 +250,7 @@ DrawHPBar:: ; 1336 (0:1336) ; 03: daycare ; OUTPUT: ; [wcf91] = pokemon ID -; wcf98 = base address of pokemon data +; wLoadedMon = base address of pokemon data ; W_MONHDEXNUM = base address of base stats LoadMonData:: ; 1372 (0:1372) ld hl, LoadMonData_ @@ -515,12 +515,12 @@ PrintStatusConditionNotFainted ; 14f6 ; function to print pokemon level, leaving off the ":L" if the level is at least 100 ; INPUT: ; hl = destination address -; [wcfb9] = level +; [wLoadedMonLevel] = level PrintLevel:: ; 150b (0:150b) ld a,$6e ; ":L" tile ID ld [hli],a ld c,2 ; number of digits - ld a,[wcfb9] ; level + ld a,[wLoadedMonLevel] ; level cp a,100 jr c,PrintLevelCommon ; if level at least 100, write over the ":L" tile @@ -531,12 +531,12 @@ PrintLevel:: ; 150b (0:150b) ; prints the level without leaving off ":L" regardless of level ; INPUT: ; hl = destination address -; [wcfb9] = level +; [wLoadedMonLevel] = level PrintLevelFull:: ; 151b (0:151b) ld a,$6e ; ":L" tile ID ld [hli],a ld c,3 ; number of digits - ld a,[wcfb9] ; level + ld a,[wLoadedMonLevel] ; level PrintLevelCommon:: ; 1523 (0:1523) ld [wd11e],a @@ -1183,7 +1183,7 @@ CloseTextDisplay:: ; 29e8 (0:29e8) ld [H_LOADEDROMBANK],a ld [$2000],a call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) - ld hl,wcfc4 + ld hl,wCharRAMInUseForText res 0,[hl] ld a,[wd732] bit 3,a ; used fly warp @@ -1372,7 +1372,7 @@ AddItemToInventory:: ; 2bcf (0:2bcf) ; INPUT: ; [wListMenuID] = list menu ID -; [wcf8b] = address of the list (2 bytes) +; [wList] = address of the list (2 bytes) DisplayListMenuID:: ; 2be6 (0:2be6) xor a ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer @@ -1392,9 +1392,9 @@ DisplayListMenuID:: ; 2be6 (0:2be6) xor a ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped ld [wd12a],a - ld a,[wcf8b] + ld a,[wList] ld l,a - ld a,[wcf8c] + ld a,[wList + 1] ld h,a ; hl = address of the list ld a,[hl] ld [wd12a],a ; [wd12a] = number of list entries @@ -1485,9 +1485,9 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53) ; if it's an item menu sla c ; item entries are 2 bytes long, so multiply by 2 .skipMultiplying - ld a,[wcf8b] + ld a,[wList] ld l,a - ld a,[wcf8c] + ld a,[wList + 1] ld h,a inc hl ; hl = beginning of list entries ld b,0 @@ -1516,7 +1516,7 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53) jr .storeChosenEntry .pokemonList ld hl,wPartyCount - ld a,[wcf8b] + ld a,[wList] cp l ; is it a list of party pokemon or box pokemon? ld hl,wPartyMonNicks jr z,.getPokemonName @@ -1707,9 +1707,9 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) ld b,$09 ld c,$0e call ClearScreenArea - ld a,[wcf8b] + ld a,[wList] ld e,a - ld a,[wcf8c] + ld a,[wList + 1] ld d,a inc de ; de = beginning of list entries ld a,[wListScrollOffset] @@ -1753,7 +1753,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) .pokemonPCMenu push hl ld hl,wPartyCount - ld a,[wcf8b] + ld a,[wList] cp l ; is it a list of party pokemon or box pokemon? ld hl,wPartyMonNicks jr z,.getPokemonName @@ -1798,7 +1798,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) push af push hl ld hl,wPartyCount - ld a,[wcf8b] + ld a,[wList] cp l ; is it a list of party pokemon or box pokemon? ld a,$00 jr z,.next @@ -1819,8 +1819,8 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a) and a ; is it a list of party pokemon or box pokemon? jr z,.skipCopyingLevel .copyLevel - ld a,[wcf9b] - ld [wcfb9],a + ld a,[wLoadedMonBoxLevel] + ld [wLoadedMonLevel],a .skipCopyingLevel pop hl ld bc,$001c @@ -3335,11 +3335,11 @@ GetName:: ; 376b (0:376b) ret GetItemPrice:: ; 37df (0:37df) -; Stores item's price as BCD in [H_DOWNARROWBLINKCNT1] and [[H_DOWNARROWBLINKCNT2] +; Stores item's price as BCD at hItemPrice (3 bytes) ; Input: [wcf91] = item id ld a, [H_LOADEDROMBANK] push af - ld a, [wListMenuID] ; wListMenuID + ld a, [wListMenuID] cp MOVESLISTMENU ld a, BANK(ItemPrices) jr nz, .asm_37ed @@ -3347,7 +3347,7 @@ GetItemPrice:: ; 37df (0:37df) .asm_37ed ld [H_LOADEDROMBANK], a ld [$2000], a - ld hl, wcf8f + ld hl, wItemPrices ld a, [hli] ld h, [hl] ld l, a @@ -3361,11 +3361,11 @@ GetItemPrice:: ; 37df (0:37df) jr nz, .asm_3802 dec hl ld a, [hld] - ld [$ff8d], a + ld [hItemPrice + 2], a ld a, [hld] - ld [H_DOWNARROWBLINKCNT2], a ; $ff8c + ld [hItemPrice + 1], a ld a, [hl] - ld [H_DOWNARROWBLINKCNT1], a ; $ff8b + ld [hItemPrice], a jr .asm_381c .getTMPrice ld a, Bank(GetMachinePrice) @@ -3373,7 +3373,7 @@ GetItemPrice:: ; 37df (0:37df) ld [$2000], a call GetMachinePrice .asm_381c - ld de, H_DOWNARROWBLINKCNT1 ; $ff8b + ld de, hItemPrice pop af ld [H_LOADEDROMBANK], a ld [$2000], a @@ -4540,7 +4540,7 @@ GetHealthBarColor:: ; Copy the current map's sprites' tile patterns to VRAM again after they have ; been overwritten by other tile patterns. ReloadMapSpriteTilePatterns:: ; 3e08 (0:3e08) - ld hl, wcfc4 + ld hl, wCharRAMInUseForText ld a, [hl] push af res 0, [hl] diff --git a/hram.asm b/hram.asm index 29eb4353..da56997e 100644 --- a/hram.asm +++ b/hram.asm @@ -12,6 +12,8 @@ hSoftReset EQU $FF8A hBaseTileID EQU $FF8B +hItemPrice EQU $FF8B + ; counters for blinking down arrow H_DOWNARROWBLINKCNT1 EQU $FF8B H_DOWNARROWBLINKCNT2 EQU $FF8C @@ -152,6 +154,7 @@ H_CURRENTSPRITEOFFSET EQU $FFDA ; multiple of $10 H_WHOSETURN EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn ; bit 0: draw HP fraction to the right of bar instead of below (for party menu) +; bit 1: menu is double spaced hFlags_0xFFF6 EQU $FFF6 hJoyInput EQU $FFF8 diff --git a/main.asm b/main.asm index 6f5b5324..a342b2b9 100755 --- a/main.asm +++ b/main.asm @@ -85,7 +85,7 @@ LoadMonData_: ; 1: enemymon ; 2: boxmon ; 3: daycaremon -; Return monster id at wcf91 and its data at wcf98. +; Return monster id at wcf91 and its data at wLoadedMon. ; Also load base stats at W_MONHDEXNUM for convenience. ld a, [wDayCareMonSpecies] @@ -125,7 +125,7 @@ LoadMonData_: call AddNTimes .copyMonData - ld de, wcf98 + ld de, wLoadedMon ld bc, wPartyMon2 - wPartyMon1 jp CopyData @@ -808,7 +808,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44) cp a,ITEMLISTMENU jp nz,DisplayListMenuIDLoop ; only rearrange item list menus push hl - ld hl,wcf8b + ld hl,wList ld a,[hli] ld h,[hl] ld l,a @@ -854,7 +854,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44) call DelayFrames push hl push de - ld hl,wcf8b + ld hl,wList ld a,[hli] ld h,[hl] ld l,a @@ -916,7 +916,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44) jr .done .combineItemSlots ld [hl],a ; put the sum in the second item slot - ld hl,wcf8b + ld hl,wList ld a,[hli] ld h,[hl] ld l,a @@ -1022,7 +1022,7 @@ DisplayTextIDInit: ; 7096 (1:7096) .drawTextBoxBorder call TextBoxBorder .skipDrawingTextBoxBorder - ld hl,wcfc4 + ld hl,wCharRAMInUseForText set 0,[hl] ld hl,wFlags_0xcd60 bit 4,[hl] @@ -3823,8 +3823,8 @@ _AddEnemyMonToPlayerParty: ; f49d (3:749d) call AddNTimes ld e, l ld d, h - ld hl, wcf98 - call CopyData ; write new mon's data (from wcf98) + ld hl, wLoadedMon + call CopyData ; write new mon's data (from wLoadedMon) ld hl, wPartyMonOT ld a, [wPartyCount] dec a diff --git a/scripts/ceruleanhouse2.asm b/scripts/ceruleanhouse2.asm index 3fa72183..a40d9224 100755 --- a/scripts/ceruleanhouse2.asm +++ b/scripts/ceruleanhouse2.asm @@ -22,9 +22,9 @@ CeruleanHouse2Text1: ; 74e15 (1d:4e15) call LoadItemList ld hl, wStringBuffer2 + 11 ld a, l - ld [wcf8b], a + ld [wList], a ld a, h - ld [wcf8c], a + ld [wList + 1], a xor a ld [wcf93], a ld [wMenuItemToSwap], a diff --git a/wram.asm b/wram.asm index 389b4cc4..2cde6d12 100755 --- a/wram.asm +++ b/wram.asm @@ -786,12 +786,15 @@ wStringBuffer2:: ; cf70 wStringBuffer3:: ; cf81 ds 9 + 1 -wcf8b:: ds 1 -wcf8c:: ds 1 +wList:: ; cf8b + ds 2 + wcf8d:: ds 1 wcf8e:: ds 1 -wcf8f:: ds 1 -wcf90:: ds 1 + +wItemPrices:: ; cf8f + ds 2 + wcf91:: ds 1 wWhichPokemon:: ; cf92 @@ -807,25 +810,15 @@ wListMenuID:: ; cf94 wcf95:: ds 1 wcf96:: ds 1 wcf97:: ds 1 -wcf98:: ds 1 -wcf99:: ds 1 -wcf9a:: ds 1 -wcf9b:: ds 1 -wcf9c:: ds 4 -wcfa0:: ds 4 -wcfa4:: ds 2 -wcfa6:: ds 2 -wcfa8:: ds 7 -wcfaf:: ds 10 -wcfb9:: ds 1 -wcfba:: ds 1 -wcfbb:: ds 1 -wcfbc:: ds 2 -wcfbe:: ds 2 -wcfc0:: ds 2 -wcfc2:: ds 2 - -wcfc4:: ds 1 + +; LoadMonData copies mon data here +wLoadedMon:: party_struct wLoadedMon ; cf98 + +wCharRAMInUseForText:: ; cfc4 +; bit 0: the space in VRAM that is used to store walking tile patterns for +; the player and NPCs is in use for text tile patterns. this means +; that movement must be disabled. + ds 1 wWalkCounter:: ; cfc5 ; walk animation counter -- cgit v1.3.1-sl0p From 7b7c563c93155e121e05149779cfb78b0bf9d259 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 8 Feb 2015 18:40:08 -0800 Subject: Rename some labels --- engine/battle/16.asm | 2 +- engine/battle/1c.asm | 3 ++- engine/cable_club.asm | 2 +- engine/overworld/map_sprites.asm | 6 +++--- engine/overworld/movement.asm | 4 ++-- home.asm | 4 ++-- main.asm | 2 +- wram.asm | 9 +++++---- 8 files changed, 17 insertions(+), 15 deletions(-) (limited to 'engine/overworld') diff --git a/engine/battle/16.asm b/engine/battle/16.asm index 4a215a37..9a00bd98 100755 --- a/engine/battle/16.asm +++ b/engine/battle/16.asm @@ -55,7 +55,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) ld hl, UnveiledGhostText call PrintText callab LoadEnemyMonData - callab DoGhostMarowakRevelationAnimation + callab MarowakAnim ld hl, WildMonAppearedText call PrintText diff --git a/engine/battle/1c.asm b/engine/battle/1c.asm index 2e360e65..ce0296f7 100755 --- a/engine/battle/1c.asm +++ b/engine/battle/1c.asm @@ -1,4 +1,5 @@ -DoGhostMarowakRevelationAnimation: ; 708ca (1c:48ca) +MarowakAnim: ; 708ca (1c:48ca) +; animate the ghost being unveiled as a Marowak ld a, $e4 ld [rOBP1], a call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same diff --git a/engine/cable_club.asm b/engine/cable_club.asm index ff25fd5e..4fbb13d9 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -578,7 +578,7 @@ TradeCenter_SelectMon: ReturnToCableClubRoom: ; 577d (1:577d) call GBPalWhiteOutWithDelay3 - ld hl, wCharRAMInUseForText + ld hl, wFontLoaded ld a, [hl] push af push hl diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index 16403759..df39d112 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -159,7 +159,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) ld l,e pop de ld b,a - ld a,[wCharRAMInUseForText] + ld a,[wFontLoaded] bit 0,a ; reloading upper half of tile patterns after displaying text? jr nz,.skipFirstLoad ; if so, skip loading data into the lower half ld a,b @@ -180,7 +180,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871) jr nc,.noCarry3 inc d .noCarry3 - ld a,[wCharRAMInUseForText] + ld a,[wFontLoaded] bit 0,a ; reloading upper half of tile patterns after displaying text? jr nz,.loadWhileLCDOn pop af @@ -264,7 +264,7 @@ InitOutsideMapSprites: ; 1797b (5:797b) cp a,$f0 ; does the map have 2 sprite sets? call nc,GetSplitMapSpriteSetID ; if so, choose the appropriate one ld b,a ; b = spriteSetID - ld a,[wCharRAMInUseForText] + ld a,[wFontLoaded] bit 0,a ; reloading upper half of tile patterns after displaying text? jr nz,.loadSpriteSet ; if so, forcibly reload the sprite set ld a,[W_SPRITESETID] diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 1658b0e9..c4482700 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -52,7 +52,7 @@ UpdatePlayerSprite: ; 4e31 (1:4e31) jr .asm_4eab .asm_4e86 ld [wSpriteStateData1 + 9], a - ld a, [wCharRAMInUseForText] + ld a, [wFontLoaded] bit 0, a jr nz, .asm_4e7d .asm_4e90 @@ -130,7 +130,7 @@ Func_4ed1: ; 4ed1 (1:4ed1) bit 7, a jp nz, InitializeSpriteFacingDirection ; c1x1 >= $80 ld b, a - ld a, [wCharRAMInUseForText] + ld a, [wFontLoaded] bit 0, a jp nz, notYetMoving ld a, b diff --git a/home.asm b/home.asm index 7a908f78..37e128f0 100644 --- a/home.asm +++ b/home.asm @@ -1183,7 +1183,7 @@ CloseTextDisplay:: ; 29e8 (0:29e8) ld [H_LOADEDROMBANK],a ld [$2000],a call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) - ld hl,wCharRAMInUseForText + ld hl,wFontLoaded res 0,[hl] ld a,[wd732] bit 3,a ; used fly warp @@ -4540,7 +4540,7 @@ GetHealthBarColor:: ; Copy the current map's sprites' tile patterns to VRAM again after they have ; been overwritten by other tile patterns. ReloadMapSpriteTilePatterns:: ; 3e08 (0:3e08) - ld hl, wCharRAMInUseForText + ld hl, wFontLoaded ld a, [hl] push af res 0, [hl] diff --git a/main.asm b/main.asm index 1b59a5d0..cb77e5a3 100755 --- a/main.asm +++ b/main.asm @@ -1022,7 +1022,7 @@ DisplayTextIDInit: ; 7096 (1:7096) .drawTextBoxBorder call TextBoxBorder .skipDrawingTextBoxBorder - ld hl,wCharRAMInUseForText + ld hl,wFontLoaded set 0,[hl] ld hl,wFlags_0xcd60 bit 4,[hl] diff --git a/wram.asm b/wram.asm index 6aabd27a..7091bd4c 100755 --- a/wram.asm +++ b/wram.asm @@ -820,10 +820,11 @@ wcf97:: ds 1 ; LoadMonData copies mon data here wLoadedMon:: party_struct wLoadedMon ; cf98 -wCharRAMInUseForText:: ; cfc4 -; bit 0: the space in VRAM that is used to store walking tile patterns for -; the player and NPCs is in use for text tile patterns. this means -; that movement must be disabled. +wFontLoaded:: ; cfc4 +; bit 0: The space in VRAM that is used to store walk animation tile patterns +; for the player and NPCs is in use for font tile patterns. +; This means that NPC movement must be disabled. +; The other bits are unused. ds 1 wWalkCounter:: ; cfc5 -- cgit v1.3.1-sl0p