From 9a3088e50cf58158cbfb8de5ad80170967d975dc Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 13:24:05 +0100 Subject: Clean up XXX comments for unused content --- engine/battle/battle_transition.asm | 3 +-- engine/battle/core.asm | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 85ba44072..d3ac22698 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -863,8 +863,7 @@ ENDM ret ; 8c7c9 (23:47c9) -Function8c7c9: -; XXX +Unreferenced_Function8c7c9: ld a, $1 ld [hBGMapMode], a call WaitBGMap diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 08021fc8b..93eefb19c 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -8551,8 +8551,7 @@ InitEnemyWildmon: ; 3f607 ret ; 3f662 -Function3f662: ; 3f662 -; XXX +Unreferenced_Function3f662: ; 3f662 ld hl, EnemyMonMoves ld de, wListMoves_MoveIndicesBuffer ld b, NUM_MOVES -- cgit v1.2.3 From 7a24703398aba3ab112ed770368805a17c601c03 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 15:05:14 +0100 Subject: Clean up Predef function names --- engine/battle/battle_transition.asm | 6 +++--- engine/battle/start_battle.asm | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index d3ac22698..2b3f5510e 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -1,4 +1,4 @@ -Predef_StartBattle: ; 8c20f +DoBattleTransition: ; 8c20f call .InitGFX ld a, [rBGP] ld [wBGP], a @@ -16,7 +16,7 @@ Predef_StartBattle: ; 8c20f ld a, [wJumptableIndex] bit 7, a jr nz, .done - call FlashyTransitionToBattle + call BattleTransitionJumptable call DelayFrame jr .loop @@ -144,7 +144,7 @@ TrainerBattlePokeballTiles: ; 8c2f4 INCBIN "gfx/overworld/trainer_battle_pokeball_tiles.2bpp" -FlashyTransitionToBattle: ; 8c314 +BattleTransitionJumptable: ; 8c314 jumptable .dw, wJumptableIndex ; 8c323 diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index 7f0bff96b..18ca2df8d 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -33,7 +33,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f add hl, de ld a, [hl] ld [BattleMonLevel], a - predef Predef_StartBattle + predef DoBattleTransition farcall _LoadBattleFontsHPBar ld a, 1 ld [hBGMapMode], a -- cgit v1.2.3 From 6f0b81504d6471afe7df6adae83791cc81933ca6 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 16:04:21 +0100 Subject: More unreferenced labels cleanup --- engine/battle/core.asm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 93eefb19c..c82ae93c5 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1951,8 +1951,7 @@ GetMaxHP: ; 3ccac ret ; 3ccc2 -GetHalfHP: ; 3ccc2 -; unreferenced +Unreferenced_GetHalfHP: ; 3ccc2 ld hl, BattleMonHP ld a, [hBattleTurn] and a @@ -6769,8 +6768,7 @@ CheckUnownLetter: ; 3eb75 ; 3ebc7 -SwapBattlerLevels: ; 3ebc7 -; unreferenced +Unreferenced_SwapBattlerLevels: ; 3ebc7 push bc ld a, [BattleMonLevel] ld b, a @@ -7162,7 +7160,7 @@ _LoadHPBar: ; 3eda6 ret ; 3edad -LoadHPExpBarGFX: ; unreferenced +Unreferenced_LoadHPExpBarGFX: ld de, EnemyHPBarBorderGFX ld hl, vTiles2 tile $6c lb bc, BANK(EnemyHPBarBorderGFX), 4 @@ -8104,7 +8102,7 @@ TextJump_ComeBack: ; 3f35b db "@" ; 3f360 -HandleSafariAngerEatingStatus: ; unreferenced +Unreferenced_HandleSafariAngerEatingStatus: ld hl, wSafariMonEating ld a, [hl] and a @@ -8371,8 +8369,7 @@ StartBattle: ; 3f4c1 ret ; 3f4d9 -_DoBattle: ; 3f4d9 -; unreferenced +Unreferenced_DoBattle: ; 3f4d9 call DoBattle ret ; 3f4dd -- cgit v1.2.3 From d435bd8911981674b45622c6534ef7e3e7fe55c5 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 11:50:08 -0500 Subject: Reword Magikarp length comments --- engine/battle/core.asm | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 08021fc8b..58f42f8b1 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6376,9 +6376,9 @@ LoadEnemyMon: ; 3e8eb ; but the value is in feet and inches (one byte each). ; The first filter is supposed to make very large Magikarp even rarer, -; by targeting those 1600 mm or larger. +; by targeting those 1600 mm (= 5'3") or larger. ; After the conversion to feet, it is unable to target any, -; as the largest possible Magikarp is 5'3'', which reads as 1283. +; since the largest possible Magikarp is 5'3", and $0503 = 1283 mm. ld a, [TempEnemyMonSpecies] cp MAGIKARP jr nz, .Happiness @@ -6388,42 +6388,43 @@ LoadEnemyMon: ; 3e8eb ld bc, PlayerID callfar CalcMagikarpLength -; No reason to keep going if length > 1536 (i.e. if length / 256 != 6) +; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6) ld a, [wMagikarpLength] - cp HIGH(1536) ; this compares to 6'0'', should be cp 5 + cp HIGH(1536) ; should be "cp 5", since 1536 mm = 5'0", but HIGH(1536) = 6 jr nz, .CheckMagikarpArea ; 5% chance of skipping both size checks call Random cp 5 percent jr c, .CheckMagikarpArea -; Try again if length > 1615 +; Try again if length >= 1616 mm ld a, [wMagikarpLength + 1] - cp LOW(1616) ; this compares to 6'80'', should be cp 3 + cp LOW(1616) ; should be "cp 3", since 1616 mm = 5'3", but LOW(1616) = 80 jr nc, .GenerateDVs ; 20% chance of skipping this check call Random cp 20 percent - 1 jr c, .CheckMagikarpArea -; Try again if length > 1599 +; Try again if length >= 1600 mm ld a, [wMagikarpLength + 1] - cp LOW(1600) ; this compares to 6'64'', should be cp 2 + cp LOW(1600) ; should be "cp 2", since 1600 mm = 5'2", but LOW(1600) = 64 jr nc, .GenerateDVs .CheckMagikarpArea: -; The z checks are supposed to be nz -; Instead, all maps in GROUP_LAKE_OF_RAGE (mahogany area) -; and routes 20 and 44 are treated as Lake of Rage +; The "jr z" checks are supposed to be "jr nz". + +; Instead, all maps in GROUP_LAKE_OF_RAGE (Mahogany area) +; and Routes 20 and 44 are treated as Lake of Rage. ; This also means Lake of Rage Magikarp can be smaller than ones -; caught elsewhere rather than the other way around +; caught elsewhere rather than the other way around. -; Intended behavior enforces a minimum size at Lake of Rage -; The real behavior prevents size flooring in the Lake of Rage area +; Intended behavior enforces a minimum size at Lake of Rage. +; The real behavior prevents a minimum size in the Lake of Rage area. -; Moreover, due to the check not being translated to feet, all Magikarp -; smaller than 4'0'' may be caught by the filter, a lot more than intended +; Moreover, due to the check not being translated to feet+inches, all Magikarp +; smaller than 4'0" may be caught by the filter, a lot more than intended. ld a, [MapGroup] cp GROUP_LAKE_OF_RAGE jr z, .Happiness @@ -6434,9 +6435,9 @@ LoadEnemyMon: ; 3e8eb call Random cp 40 percent - 2 jr c, .Happiness -; Floor at length 1024 +; Try again if length < 1024 mm ld a, [wMagikarpLength] - cp HIGH(1024) ; compares to 4'0'', cp 3 would be closer to intended value + cp HIGH(1024) ; should be "cp 3", since 1024 mm = 3'4", but HIGH(1024) = 4 jr c, .GenerateDVs ; try again ; Finally done with DVs -- cgit v1.2.3 From be2aeedcf0f25409b1ca74155718eb51e0cfb751 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 2 Jan 2018 11:53:06 -0500 Subject: More clarification --- engine/battle/core.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 58f42f8b1..9c22331a0 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6388,7 +6388,7 @@ LoadEnemyMon: ; 3e8eb ld bc, PlayerID callfar CalcMagikarpLength -; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6) +; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6 feet) ld a, [wMagikarpLength] cp HIGH(1536) ; should be "cp 5", since 1536 mm = 5'0", but HIGH(1536) = 6 jr nz, .CheckMagikarpArea @@ -6397,7 +6397,7 @@ LoadEnemyMon: ; 3e8eb call Random cp 5 percent jr c, .CheckMagikarpArea -; Try again if length >= 1616 mm +; Try again if length >= 1616 mm (i.e. if LOW(length) >= 3 inches) ld a, [wMagikarpLength + 1] cp LOW(1616) ; should be "cp 3", since 1616 mm = 5'3", but LOW(1616) = 80 jr nc, .GenerateDVs @@ -6406,7 +6406,7 @@ LoadEnemyMon: ; 3e8eb call Random cp 20 percent - 1 jr c, .CheckMagikarpArea -; Try again if length >= 1600 mm +; Try again if length >= 1600 mm (i.e. if LOW(length) >= 2 inches) ld a, [wMagikarpLength + 1] cp LOW(1600) ; should be "cp 2", since 1600 mm = 5'2", but LOW(1600) = 64 jr nc, .GenerateDVs @@ -6435,7 +6435,7 @@ LoadEnemyMon: ; 3e8eb call Random cp 40 percent - 2 jr c, .Happiness -; Try again if length < 1024 mm +; Try again if length < 1024 mm (i.e. if HIGH(length) < 3 feet) ld a, [wMagikarpLength] cp HIGH(1024) ; should be "cp 3", since 1024 mm = 3'4", but HIGH(1024) = 4 jr c, .GenerateDVs ; try again -- cgit v1.2.3 From d7970f749ac23786728926109be430ab732f19e6 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 18:49:25 +0100 Subject: Consistent predef function names --- engine/battle/ai/items.asm | 4 +- engine/battle/ai/move.asm | 2 +- engine/battle/ai/scoring.asm | 2 +- engine/battle/ai/switch.asm | 16 ++-- engine/battle/anim_hp_bar.asm | 10 +- engine/battle/battle_transition.asm | 2 +- engine/battle/core.asm | 146 +++++++++++++++--------------- engine/battle/effect_commands.asm | 42 ++++----- engine/battle/effect_commands/attract.asm | 4 +- engine/battle/misc.asm | 2 +- engine/battle/read_trainer_party.asm | 8 +- engine/battle/returntobattle_useball.asm | 4 +- engine/battle/start_battle.asm | 2 +- 13 files changed, 122 insertions(+), 122 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 09595077a..b9f3fa93c 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -545,7 +545,7 @@ AI_Items: ; 39196 AIUpdateHUD: ; 38387 call UpdateEnemyMonInParty - farcall UpdateEnemyHUD + farcall Predef_UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ld hl, wEnemyItemState @@ -664,7 +664,7 @@ EnemyPotionFinish: ; 38436 xor a ld [wWhichHPBar], a call AIUsedItemSound - predef AnimateHPBar + predef Predef_AnimateHPBar jp AIUpdateHUD diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index 11586c0da..d91ac437d 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -92,7 +92,7 @@ AIChooseMove: ; 440ce push bc ld d, BANK(TrainerClassAttributes) - predef FlagPredef + predef Predef_Flag ld d, c pop bc diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index 44194d6f7..d7dfdb630 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -1488,7 +1488,7 @@ AI_Smart_Encore: ; 38c3b push hl ld a, [wEnemyMoveStruct + MOVE_TYPE] ld hl, EnemyMonType1 - predef CheckTypeMatchup + predef Predef_CheckTypeMatchup pop hl ld a, [wd265] diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm index c2f83fa1f..cb278676e 100755 --- a/engine/battle/ai/switch.asm +++ b/engine/battle/ai/switch.asm @@ -28,7 +28,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e inc hl call GetMoveByte ld hl, EnemyMonType - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr nc, .super_effective @@ -73,7 +73,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e ld a, [BattleMonType1] ld b, a ld hl, EnemyMonType1 - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok @@ -82,7 +82,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e ld a, [BattleMonType2] cp b jr z, .ok2 - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok2 @@ -123,7 +123,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e inc hl call GetMoveByte ld hl, BattleMonType1 - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] ; immune @@ -390,7 +390,7 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a inc hl call GetMoveByte ld hl, BaseType - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] and a jr nz, .next @@ -481,7 +481,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 inc hl call GetMoveByte ld hl, BattleMonType1 - call CheckTypeMatchup + call Predef_CheckTypeMatchup ; if immune or not very effective: continue ld a, [wTypeMatchup] @@ -585,7 +585,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20 .skip_move ld a, [BattleMonType1] ld hl, BaseType - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 jr nc, .dont_choose_mon @@ -593,7 +593,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20 .check_type ld hl, BaseType - call CheckTypeMatchup + call Predef_CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 jr nc, .dont_choose_mon diff --git a/engine/battle/anim_hp_bar.asm b/engine/battle/anim_hp_bar.asm index 71276d27e..d67a46a70 100755 --- a/engine/battle/anim_hp_bar.asm +++ b/engine/battle/anim_hp_bar.asm @@ -67,7 +67,7 @@ _AnimateHPBar: ; d627 ld a, [hli] ld b, a pop hl - call ComputeHPBarPixels + call Predef_ComputeHPBarPixels ld a, e ld [wCurHPBarPixels], a @@ -79,7 +79,7 @@ _AnimateHPBar: ; d627 ld e, a ld a, [wCurHPAnimMaxHP + 1] ld d, a - call ComputeHPBarPixels + call Predef_ComputeHPBarPixels ld a, e ld [wNewHPBarPixels], a @@ -183,11 +183,11 @@ LongAnim_UpdateVariables: ; d6f5 ld c, a ld a, [hli] ld b, a - ; This routine is buggy. The result from ComputeHPBarPixels is stored + ; This routine is buggy. The result from Predef_ComputeHPBarPixels is stored ; in e. However, the pop de opcode deletes this result before it is even ; used. The game then proceeds as though it never deleted that output. ; To fix, uncomment the line below. - call ComputeHPBarPixels + call Predef_ComputeHPBarPixels ; ld a, e pop bc pop de @@ -227,7 +227,7 @@ LongHPBarAnim_UpdateTiles: ; d749 ld e, a ld a, [wCurHPAnimMaxHP + 1] ld d, a - call ComputeHPBarPixels + call Predef_ComputeHPBarPixels ld c, e ld d, HP_BAR_LENGTH ld a, [wWhichHPBar] diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 2b3f5510e..ba4f9e227 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -1,4 +1,4 @@ -DoBattleTransition: ; 8c20f +Predef_DoBattleTransition: ; 8c20f call .InitGFX ld a, [rBGP] ld [wBGP], a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index c82ae93c5..9b00ba161 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -47,7 +47,7 @@ DoBattle: ; 3c000 .player_2 call LoadTileMapToTempTileMap - call CheckPlayerPartyForFitPkmn + call Predef_CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -1285,7 +1285,7 @@ HandleWrap: ; 3c874 xor a ld [wNumHits], a ld [FXAnimID + 1], a - predef PlayBattleAnim + predef Predef_PlayBattleAnim call SwitchTurnCore .skip_anim @@ -2047,7 +2047,7 @@ UpdateHPBar: ; 3cd3c .ok push bc ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar pop bc ret ; 3cd55 @@ -2061,7 +2061,7 @@ HandleEnemyMonFaint: ; 3cd55 xor a ld [wWhichMonFaintedFirst], a call UpdateBattleStateAndExperienceAfterEnemyFaint - call CheckPlayerPartyForFitPkmn + call Predef_CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2069,7 +2069,7 @@ HandleEnemyMonFaint: ; 3cd55 ld hl, BattleMonHP ld a, [hli] or [hl] - call nz, UpdatePlayerHUD + call nz, Predef_UpdatePlayerHUD ld a, $1 ld [hBGMapMode], a @@ -2193,7 +2193,7 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 call PlayerMonFaintHappinessMod .player_mon_did_not_faint - call CheckPlayerPartyForFitPkmn + call Predef_CheckPlayerPartyForFitPkmn ld a, d and a ret z @@ -2713,7 +2713,7 @@ HandlePlayerMonFaint: ; 3d14e ld a, $1 ld [wWhichMonFaintedFirst], a call PlayerMonFaintHappinessMod - call CheckPlayerPartyForFitPkmn + call Predef_CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2759,7 +2759,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef FlagPredef + predef Predef_Flag ld hl, EnemySubStatus3 res SUBSTATUS_IN_LOOP, [hl] xor a @@ -3356,10 +3356,10 @@ AddBattleParticipant: ; 3d581 ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG push bc - predef FlagPredef + predef Predef_Flag pop bc ld hl, wBattleParticipantsIncludingFainted - predef_jump FlagPredef + predef_jump Predef_Flag ; 3d599 FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 @@ -3577,7 +3577,7 @@ LoadEnemyPkmnToSwitchTo: ; 3d6ca and a jr nz, .skip_unown ld hl, EnemyMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld a, [UnownLetter] ld [wFirstUnownSeen], a .skip_unown @@ -3687,8 +3687,8 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call GetBaseData ld a, OTPARTYMON ld [MonType], a - predef CopyPkmnToTempMon - call GetEnemyMonFrontpic + predef Predef_CopyPkmnToTempMon + call Predef_GetEnemyMonFrontpic xor a ld [wNumHits], a @@ -3713,7 +3713,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 hlcoord 12, 0 ld d, $0 ld e, ANIM_MON_SLOW - predef AnimateFrontpic + predef Predef_AnimateFrontpic jr .skip_cry .cry_no_anim @@ -3723,7 +3723,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call PlayStereoCry .skip_cry - call UpdateEnemyHUD + call Predef_UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ret @@ -3764,7 +3764,7 @@ ResetEnemyStatLevels: ; 3d867 ret ; 3d873 -CheckPlayerPartyForFitPkmn: ; 3d873 +Predef_CheckPlayerPartyForFitPkmn: ; 3d873 ; Has the player any Pkmn in his Party that can fight? ld a, [PartyCount] ld e, a @@ -4167,7 +4167,7 @@ SwitchPlayerMon: ; 3db32 SendOutPlayerMon: ; 3db5f ld hl, BattleMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter hlcoord 1, 5 ld b, 7 ld c, 8 @@ -4175,7 +4175,7 @@ SendOutPlayerMon: ; 3db5f call WaitBGMap xor a ld [hBGMapMode], a - call GetBattleMonBackpic + call Predef_GetBattleMonBackpic xor a ld [hGraphicStartTile], a ld [wBattleMenuCursorBuffer], a @@ -4215,7 +4215,7 @@ SendOutPlayerMon: ; 3db5f call PlayStereoCry .statused - call UpdatePlayerHUD + call Predef_UpdatePlayerHUD ld a, $1 ld [hBGMapMode], a ret @@ -4261,13 +4261,13 @@ BreakAttraction: ; 3dc18 SpikesDamage: ; 3dc23 ld hl, PlayerScreens ld de, BattleMonType - ld bc, UpdatePlayerHUD + ld bc, Predef_UpdatePlayerHUD ld a, [hBattleTurn] and a jr z, .ok ld hl, EnemyScreens ld de, EnemyMonType - ld bc, UpdateEnemyHUD + ld bc, Predef_UpdateEnemyHUD .ok bit SCREENS_SPIKES, [hl] @@ -4349,7 +4349,7 @@ PursuitSwitch: ; 3dc5b ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef FlagPredef + predef Predef_Flag call PlayerMonFaintedAnimation ld hl, BattleText_PkmnFainted jr .done_fainted @@ -4498,7 +4498,7 @@ HandleHPHealingItem: ; 3dd2f .got_hp_bar_coords ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar UseOpponentItem: call RefreshBattleHuds callfar GetOpponentItem @@ -4521,7 +4521,7 @@ ItemRecoveryAnim: ; 3ddc8 xor a ld [wNumHits], a ld [FXAnimID + 1], a - predef PlayBattleAnim + predef Predef_PlayBattleAnim call SwitchTurnCore pop bc pop de @@ -4751,7 +4751,7 @@ UpdateBattleHUDs: ; 3df2c ret ; 3df48 -UpdatePlayerHUD:: ; 3df48 +Predef_UpdatePlayerHUD:: ; 3df48 push hl push de push bc @@ -4784,7 +4784,7 @@ DrawPlayerHUD: ; 3df58 ld b, 1 xor a ; PARTYMON ld [MonType], a - predef DrawPlayerHP + predef Predef_DrawPlayerHP ; Exp bar push de @@ -4797,7 +4797,7 @@ DrawPlayerHUD: ; 3df58 hlcoord 10, 11 ld a, [TempMonLevel] ld b, a - call FillInExpBar + call Predef_FillInExpBar pop de ret ; 3df98 @@ -4866,7 +4866,7 @@ PrintPlayerHUD: ; 3dfbf ld a, TEMPMON ld [MonType], a - callfar GetGender + callfar Predef_GetGender ld a, " " jr c, .got_gender_char ld a, "♂" @@ -4880,7 +4880,7 @@ PrintPlayerHUD: ; 3dfbf push af ; back up gender push hl ld de, BattleMonStatus - predef PlaceNonFaintStatus + predef Predef_PlaceNonFaintStatus pop hl pop bc ret nz @@ -4895,7 +4895,7 @@ PrintPlayerHUD: ; 3dfbf jp PrintLevel ; 3e036 -UpdateEnemyHUD:: ; 3e036 +Predef_UpdateEnemyHUD:: ; 3e036 push hl push de push bc @@ -4944,7 +4944,7 @@ DrawEnemyHUD: ; 3e043 ld a, TEMPMON ld [MonType], a - callfar GetGender + callfar Predef_GetGender ld a, " " jr c, .got_gender ld a, "♂" @@ -4959,7 +4959,7 @@ DrawEnemyHUD: ; 3e043 push af push hl ld de, EnemyMonStatus - predef PlaceNonFaintStatus + predef Predef_PlaceNonFaintStatus pop hl pop bc jr nz, .skip_level @@ -5184,8 +5184,8 @@ BattleMenu_Pack: ; 3e1c7 call ClearPalettes call DelayFrame call _LoadBattleFontsHPBar - call GetBattleMonBackpic - call GetEnemyMonFrontpic + call Predef_GetBattleMonBackpic + call Predef_GetEnemyMonFrontpic call ExitMenu call WaitBGMap call FinishBattleAnim @@ -5217,10 +5217,10 @@ BattleMenu_Pack: ; 3e1c7 ld a, [BattleType] cp BATTLETYPE_TUTORIAL jr z, .tutorial2 - call GetBattleMonBackpic + call Predef_GetBattleMonBackpic .tutorial2 - call GetEnemyMonFrontpic + call Predef_GetEnemyMonFrontpic ld a, $1 ld [wMenuCursorY], a call ExitMenu @@ -5574,7 +5574,7 @@ MoveSelectionScreen: ; 3e4bc .got_start_coord ld a, SCREEN_WIDTH ld [Buffer1], a - predef ListMoves + predef Predef_ListMoves ld b, 5 ld a, [wMoveSelectionMenuType] @@ -5907,7 +5907,7 @@ MoveInfoBox: ; 3e6c8 ld a, [wPlayerMoveStruct + MOVE_ANIM] ld b, a hlcoord 2, 10 - predef PrintMoveType + predef Predef_PrintMoveType .done ret @@ -6363,7 +6363,7 @@ LoadEnemyMon: ; 3e8eb ; Get letter based on DVs ld hl, EnemyMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ; Can't use any letters that haven't been unlocked ; If combined with forced shiny battletype, causes an infinite loop call CheckUnownLetter @@ -6451,7 +6451,7 @@ LoadEnemyMon: ; 3e8eb ld de, EnemyMonMaxHP ld b, FALSE ld hl, EnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; LinkBattleRNs + 7 ; ? - predef CalcPkmnStats + predef Predef_CalcPkmnStats ; If we're in a trainer battle, ; get the rest of the parameters from the party struct @@ -6566,7 +6566,7 @@ LoadEnemyMon: ; 3e8eb ; Make sure the predef knows this isn't a partymon ld [wEvolutionOldSpecies], a ; Fill moves based on level - predef FillMoves + predef Predef_FillMoves .PP: ; Trainer battle? @@ -6577,7 +6577,7 @@ LoadEnemyMon: ; 3e8eb ; Fill wild PP ld hl, EnemyMonMoves ld de, EnemyMonPP - predef FillPP + predef Predef_FillPP jr .Finish .TrainerPP: @@ -6630,7 +6630,7 @@ LoadEnemyMon: ; 3e8eb ld c, a ld b, SET_FLAG ld hl, PokedexSeen - predef FlagPredef + predef Predef_Flag ld hl, EnemyMonStats ld de, EnemyStats @@ -6787,7 +6787,7 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8 ld a, [OtherTrainerClass] ld [TrainerClass], a ld de, vTiles2 - callfar GetTrainerPic + callfar Predef_GetTrainerPic hlcoord 19, 0 ld c, 0 @@ -7264,7 +7264,7 @@ Call_PlayBattleAnim: ; 3ee17 ld a, d ld [FXAnimID + 1], a call WaitBGMap - predef_jump PlayBattleAnim + predef_jump Predef_PlayBattleAnim ; 3ee27 FinishBattleAnim: ; 3ee27 @@ -7312,7 +7312,7 @@ GiveExperiencePoints: ; 3ee3b ld c, a ld b, CHECK_FLAG ld d, $0 - predef FlagPredef + predef Predef_Flag ld a, c and a pop bc @@ -7490,7 +7490,7 @@ GiveExperiencePoints: ; 3ee3b .not_max_exp xor a ; PARTYMON ld [MonType], a - predef CopyPkmnToTempMon + predef Predef_CopyPkmnToTempMon callfar CalcLevel pop bc ld hl, MON_LEVEL @@ -7527,7 +7527,7 @@ GiveExperiencePoints: ; 3ee3b add hl, bc push bc ld b, TRUE - predef CalcPkmnStats + predef Predef_CalcPkmnStats pop bc pop de ld hl, MON_MAXHP + 1 @@ -7580,7 +7580,7 @@ GiveExperiencePoints: ; 3ee3b call ApplyStatLevelMultiplierOnAllStats callfar ApplyStatusEffectOnPlayerStats callfar BadgeStatBoosts - callfar UpdatePlayerHUD + callfar Predef_UpdatePlayerHUD call EmptyBattleTextBox call LoadTileMapToTempTileMap ld a, $1 @@ -7603,14 +7603,14 @@ GiveExperiencePoints: ; 3ee3b .skip_animation2 xor a ; PARTYMON ld [MonType], a - predef CopyPkmnToTempMon + predef Predef_CopyPkmnToTempMon hlcoord 9, 0 ld b, $a ld c, $9 call TextBox hlcoord 11, 1 ld bc, 4 - predef PrintTempMonStats + predef Predef_PrintTempMonStats ld c, $1e call DelayFrames call WaitPressAorB_BlinkCursor @@ -7630,7 +7630,7 @@ GiveExperiencePoints: ; 3ee3b ld a, b ld [CurPartyLevel], a push bc - predef LearnLevelMoves + predef Predef_LearnLevelMoves pop bc ld a, b cp c @@ -7641,7 +7641,7 @@ GiveExperiencePoints: ; 3ee3b ld a, [CurPartyMon] ld c, a ld b, SET_FLAG - predef FlagPredef + predef Predef_Flag pop af ld [CurPartyLevel], a @@ -7763,7 +7763,7 @@ AnimateExpBar: ; 3f136 ld [wd002], a xor a ; PARTYMON ld [MonType], a - predef CopyPkmnToTempMon + predef Predef_CopyPkmnToTempMon ld a, [TempMonLevel] ld b, a ld e, a @@ -8134,7 +8134,7 @@ Unreferenced_HandleSafariAngerEatingStatus: jp StdBattleTextBox ; 3f390 -FillInExpBar: ; 3f390 +Predef_FillInExpBar: ; 3f390 push hl call CalcExpBar pop hl @@ -8276,7 +8276,7 @@ PlaceExpBar: ; 3f41c ret ; 3f43d -GetBattleMonBackpic: ; 3f43d +Predef_GetBattleMonBackpic: ; 3f43d ld a, [PlayerSubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub @@ -8292,9 +8292,9 @@ DropPlayerSub: ; 3f447 ld a, [BattleMonSpecies] ld [CurPartySpecies], a ld hl, BattleMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld de, vTiles2 tile $31 - predef GetMonBackpic + predef Predef_GetMonBackpic pop af ld [CurPartySpecies], a ret @@ -8312,7 +8312,7 @@ GetBattleMonBackpic_DoAnim: ; 3f46f ret ; 3f47c -GetEnemyMonFrontpic: ; 3f47c +Predef_GetEnemyMonFrontpic: ; 3f47c ld a, [EnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub @@ -8331,9 +8331,9 @@ DropEnemySub: ; 3f486 ld [CurPartySpecies], a call GetBaseData ld hl, EnemyMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld de, vTiles2 - predef GetAnimatedFrontpicPredef + predef Predef_GetAnimatedFrontpic pop af ld [CurPartySpecies], a ret @@ -8350,7 +8350,7 @@ GetEnemyMonFrontpic_DoAnim: ; 3f4b4 ret ; 3f4c1 -StartBattle: ; 3f4c1 +Predef_StartBattle: ; 3f4c1 ; This check prevents you from entering a battle without any Pokemon. ; Those using walk-through-walls to bypass getting a Pokemon experience ; the effects of this check. @@ -8409,7 +8409,7 @@ BattleIntro: ; 3f4dd call ClearSprites ld a, [wBattleMode] cp WILD_BATTLE - call z, UpdateEnemyHUD + call z, Predef_UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ret @@ -8474,14 +8474,14 @@ InitEnemyTrainer: ; 3f594 .ok ld de, vTiles2 - callfar GetTrainerPic + callfar Predef_GetTrainerPic xor a ld [hGraphicStartTile], a dec a ld [wEnemyItemState], a hlcoord 12, 0 lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic ld a, -1 ld [CurOTMon], a ld a, TRAINER_BATTLE @@ -8527,7 +8527,7 @@ InitEnemyWildmon: ; 3f607 ld bc, NUM_MOVES call CopyBytes ld hl, EnemyMonDVs - predef GetUnownLetter + predef Predef_GetUnownLetter ld a, [CurPartySpecies] cp UNOWN jr nz, .skip_unown @@ -8538,13 +8538,13 @@ InitEnemyWildmon: ; 3f607 ld [wFirstUnownSeen], a .skip_unown ld de, vTiles2 - predef GetAnimatedFrontpicPredef + predef Predef_GetAnimatedFrontpic xor a ld [TrainerClass], a ld [hGraphicStartTile], a hlcoord 12, 0 lb bc, 7, 7 - predef PlaceGraphic + predef Predef_PlaceGraphic ret ; 3f662 @@ -8623,7 +8623,7 @@ ExitBattle: ; 3f69e call CheckPayDay xor a ld [wForceEvolution], a - predef EvolveAfterBattle + predef Predef_EvolveAfterBattle farcall GivePokerusAndConvertBerries ret ; 3f6d0 @@ -9297,7 +9297,7 @@ InitBattleDisplay: ; 3fb6c ld [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 - predef PlaceGraphic + predef Predef_PlaceGraphic xor a ld [hWY], a ld [rWY], a @@ -9370,7 +9370,7 @@ GetTrainerBackpic: ; 3fbff .Decompress: ld de, vTiles2 tile $31 ld c, $31 - predef DecompressPredef + predef Predef_Decompress ret ; 3fc30 @@ -9392,7 +9392,7 @@ CopyBackpic: ; 3fc30 ld [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 - predef PlaceGraphic + predef Predef_PlaceGraphic ret ; 3fc5b @@ -9472,7 +9472,7 @@ BattleStartMessage: ; 3fc8b hlcoord 12, 0 ld d, $0 ld e, ANIM_MON_NORMAL - predef AnimateFrontpic + predef Predef_AnimateFrontpic jr .skip_cry ; cry is played during the animation .cry_no_anim diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index f86f90479..d0a126b98 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -182,7 +182,7 @@ CheckPlayerTurn: call StdBattleTextBox call CantMove call UpdateBattleMonInParty - ld hl, UpdatePlayerHUD + ld hl, Predef_UpdatePlayerHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -433,7 +433,7 @@ CheckEnemyTurn: ; 3421f call StdBattleTextBox call CantMove call UpdateEnemyMonInParty - ld hl, UpdateEnemyHUD + ld hl, Predef_UpdateEnemyHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -670,7 +670,7 @@ HitConfusion: ; 343a5 and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND call z, PlayFXAnimID - ld hl, UpdatePlayerHUD + ld hl, Predef_UpdatePlayerHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -1539,12 +1539,12 @@ BattleCheckTypeMatchup: ; 347c8 ld hl, EnemyMonType1 ld a, [hBattleTurn] and a - jr z, CheckTypeMatchup + jr z, Predef_CheckTypeMatchup ld hl, BattleMonType1 -CheckTypeMatchup: ; 347d3 +Predef_CheckTypeMatchup: ; 347d3 ; There is an incorrect assumption about this function made in the AI related code: when -; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the -; offensive type in a will make this function do the right thing. Since a is overwritten, +; the AI calls Predef_CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing +; the offensive type in a will make this function do the right thing. Since a is overwritten, ; this assumption is incorrect. A simple fix would be to load the move type for the ; current move into a in BattleCheckTypeMatchup, before falling through, which is ; consistent with how the rest of the code assumes this code works like. @@ -2636,7 +2636,7 @@ BattleCommand_CheckDestinyBond: ; 351c0 ld [Buffer6], a ld h, b ld l, c - predef AnimateHPBar + predef Predef_AnimateHPBar call RefreshBattleHuds call BattleCommand_SwitchTurn @@ -4049,7 +4049,7 @@ BattleCommand_PainSplit: ; 35926 ld a, $1 ld [wWhichHPBar], a hlcoord 10, 9 - predef AnimateHPBar + predef Predef_AnimateHPBar ld hl, EnemyMonHP ld a, [hli] ld [Buffer4], a @@ -4064,7 +4064,7 @@ BattleCommand_PainSplit: ; 35926 ld [wWhichHPBar], a call ResetDamage hlcoord 2, 2 - predef AnimateHPBar + predef Predef_AnimateHPBar farcall _UpdateBattleHUDs ld hl, SharedPainText @@ -4206,7 +4206,7 @@ BattleCommand_Conversion2: ; 359e6 ld a, [hl] ld [wNamedObjectIndexBuffer], a - predef GetTypeName + predef Predef_GetTypeName ld hl, TransformedTypeText jp StdBattleTextBox @@ -4744,7 +4744,7 @@ PlayFXAnimID: ; 35d08 ld c, 3 call DelayFrames - callfar PlayBattleAnim + callfar Predef_PlayBattleAnim ret @@ -4806,7 +4806,7 @@ EnemyHurtItself: ; 35d1c hlcoord 2, 2 xor a ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar .did_no_damage jp RefreshBattleHuds @@ -4866,7 +4866,7 @@ PlayerHurtItself: ; 35d7e hlcoord 10, 9 ld a, $1 ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar .did_no_damage jp RefreshBattleHuds @@ -5334,7 +5334,7 @@ SapHealth: ; 36011 xor a .hp_bar ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar call RefreshBattleHuds jp UpdateBattleMonInParty @@ -6296,11 +6296,11 @@ BattleCommand_Curl: ; 365a7 BattleCommand_RaiseSubNoAnim: ; 365af - ld hl, GetBattleMonBackpic + ld hl, Predef_GetBattleMonBackpic ld a, [hBattleTurn] and a jr z, .PlayerTurn - ld hl, GetEnemyMonFrontpic + ld hl, Predef_GetEnemyMonFrontpic .PlayerTurn: xor a ld [hBGMapMode], a @@ -7581,7 +7581,7 @@ BattleCommand_Recoil: ; 36cb2 xor a .animate_hp_bar ld [wWhichHPBar], a - predef AnimateHPBar + predef Predef_AnimateHPBar call RefreshBattleHuds ld hl, RecoilText jp StdBattleTextBox @@ -8282,7 +8282,7 @@ BattleCommand_Conversion: ; 3707f inc de ld [de], a ld [wNamedObjectIndexBuffer], a - farcall GetTypeName + farcall Predef_GetTypeName call AnimateCurrentMove ld hl, TransformedTypeText jp StdBattleTextBox @@ -9911,7 +9911,7 @@ PlayUserBattleAnim: ; 37e47 push hl push de push bc - callfar PlayBattleAnim + callfar Predef_PlayBattleAnim pop bc pop de pop hl @@ -9933,7 +9933,7 @@ PlayOpponentBattleAnim: ; 37e54 push bc call BattleCommand_SwitchTurn - callfar PlayBattleAnim + callfar Predef_PlayBattleAnim call BattleCommand_SwitchTurn pop bc diff --git a/engine/battle/effect_commands/attract.asm b/engine/battle/effect_commands/attract.asm index 0a6d7c975..fc73d234c 100755 --- a/engine/battle/effect_commands/attract.asm +++ b/engine/battle/effect_commands/attract.asm @@ -35,7 +35,7 @@ CheckOppositeGender: ; 377f5 xor a ld [MonType], a - farcall GetGender + farcall Predef_GetGender jr c, .genderless_samegender ld b, 1 @@ -58,7 +58,7 @@ CheckOppositeGender: ; 377f5 ld [TempMonDVs + 1], a ld a, 3 ld [MonType], a - farcall GetGender + farcall Predef_GetGender pop bc jr c, .genderless_samegender diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index c78e9fd84..46aad0c00 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -33,7 +33,7 @@ AppearUser: ; fbd77 (3e:7d77) ld a, $31 .okay ld [hGraphicStartTile], a - predef PlaceGraphic + predef Predef_PlaceGraphic FinishAppearDisappearUser: ; fbd91 (3e:7d91) ld a, $1 ld [hBGMapMode], a diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index a09c6dd08..4f3dc8e55 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -103,7 +103,7 @@ TrainerType1: ; 397eb ld a, OTPARTYMON ld [MonType], a push hl - predef TryAddMonToParty + predef Predef_TryAddMonToParty pop hl jr .loop ; 39806 @@ -124,7 +124,7 @@ TrainerType2: ; 39806 ld [MonType], a push hl - predef TryAddMonToParty + predef Predef_TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Moves @@ -200,7 +200,7 @@ TrainerType3: ; 39871 ld a, OTPARTYMON ld [MonType], a push hl - predef TryAddMonToParty + predef Predef_TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Item @@ -231,7 +231,7 @@ TrainerType4: ; 3989d ld [MonType], a push hl - predef TryAddMonToParty + predef Predef_TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Item diff --git a/engine/battle/returntobattle_useball.asm b/engine/battle/returntobattle_useball.asm index e6e33f900..4254d24f4 100644 --- a/engine/battle/returntobattle_useball.asm +++ b/engine/battle/returntobattle_useball.asm @@ -4,13 +4,13 @@ _ReturnToBattle_UseBall: ; 2715c ld a, [BattleType] cp BATTLETYPE_TUTORIAL jr z, .gettutorialbackpic - farcall GetBattleMonBackpic + farcall Predef_GetBattleMonBackpic jr .continue .gettutorialbackpic farcall GetTrainerBackpic .continue - farcall GetEnemyMonFrontpic + farcall Predef_GetEnemyMonFrontpic farcall _LoadBattleFontsHPBar call GetMemSGBLayout call CloseWindow diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index 18ca2df8d..7121f5385 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -33,7 +33,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f add hl, de ld a, [hl] ld [BattleMonLevel], a - predef DoBattleTransition + predef Predef_DoBattleTransition farcall _LoadBattleFontsHPBar ld a, 1 ld [hBGMapMode], a -- cgit v1.2.3 From b4e087167f3263342bbe01b5256f42fcf2d726af Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 19:38:56 +0100 Subject: More unreferenced labels and unused text --- engine/battle/core.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 9b00ba161..50e94c6d8 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -8091,7 +8091,7 @@ TextJump_GoodComeBack: ; 3f352 db "@" ; 3f357 -UnusedFunction_TextJump_ComeBack: ; 3f357 +Unreferenced_TextJump_ComeBack: ; 3f357 ; this function doesn't seem to be used ld hl, TextJump_ComeBack ret -- cgit v1.2.3 From aa9a0a900ddeaa79a05f1b93458a8b19ae170d69 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 2 Jan 2018 20:00:14 +0100 Subject: No more mobile EQUS ret (replace with Stubbed_ + ret) --- engine/battle/core.asm | 23 ++++++++++++----------- engine/battle/effect_commands.asm | 4 ++-- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 50e94c6d8..b5ca19562 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -160,7 +160,7 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5 BattleTurn: ; 3c12f .loop - call MobileFn_3c1bf + call Stubbed_Function3c1bf call CheckContestBattleOver jp c, .quit @@ -231,7 +231,8 @@ BattleTurn: ; 3c12f ret ; 3c1bf -MobileFn_3c1bf: mobile +Stubbed_Function3c1bf: + ret ld a, $5 call GetSRAMBank ld hl, $a89b ; s5_a89b @@ -2588,7 +2589,7 @@ AddBattleMoneyToAccount: ; 3d0be push bc ld b, h ld c, l - farcall TrainerRankings_AddToBattlePayouts + farcall StubbedTrainerRankings_AddToBattlePayouts pop bc pop hl .loop @@ -8375,7 +8376,7 @@ Unreferenced_DoBattle: ; 3f4d9 ; 3f4dd BattleIntro: ; 3f4dd - farcall TrainerRankings_Battles ; mobile + farcall StubbedTrainerRankings_Battles ; mobile call LoadTrainerOrWildMonPic xor a ld [TempBattleMonSpecies], a @@ -8460,7 +8461,7 @@ BackUpBGMap2: ; 3f568 InitEnemyTrainer: ; 3f594 ld [TrainerClass], a - farcall TrainerRankings_TrainerBattles + farcall StubbedTrainerRankings_TrainerBattles xor a ld [TempEnemyMonSpecies], a callfar GetTrainerAttributes @@ -8516,7 +8517,7 @@ InitEnemyTrainer: ; 3f594 InitEnemyWildmon: ; 3f607 ld a, WILD_BATTLE ld [wBattleMode], a - farcall TrainerRankings_WildBattles + farcall StubbedTrainerRankings_WildBattles call LoadEnemyMon ld hl, EnemyMonMoves ld de, wWildMonMoves @@ -8698,7 +8699,7 @@ CheckPayDay: ; 3f71d ; 3f759 ShowLinkBattleParticipantsAfterEnd: ; 3f759 - farcall TrainerRankings_LinkBattles + farcall StubbedTrainerRankings_LinkBattles farcall BackupMobileEventIndex ld a, [CurOTMon] ld hl, OTPartyMon1Status @@ -8728,17 +8729,17 @@ DisplayLinkBattleResult: ; 3f77c cp $1 jr c, .victory jr z, .loss - farcall TrainerRankings_ColosseumDraws + farcall StubbedTrainerRankings_ColosseumDraws ld de, .Draw jr .store_result .victory - farcall TrainerRankings_ColosseumWins + farcall StubbedTrainerRankings_ColosseumWins ld de, .Win jr .store_result .loss - farcall TrainerRankings_ColosseumLosses + farcall StubbedTrainerRankings_ColosseumLosses ld de, .Lose jr .store_result @@ -9486,7 +9487,7 @@ BattleStartMessage: ; 3fc8b cp BATTLETYPE_FISH jr nz, .NotFishing - farcall TrainerRankings_HookedEncounters + farcall StubbedTrainerRankings_HookedEncounters ld hl, HookedPokemonAttackedText jr .PlaceBattleStartText diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index d0a126b98..c5a82f1bf 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -8078,7 +8078,7 @@ BattleCommand_LeechSeed: ; 36f9d BattleCommand_Splash: ; 36fe1 call AnimateCurrentMove - farcall TrainerRankings_Splash + farcall StubbedTrainerRankings_Splash jp PrintNothingHappened ; 36fed @@ -8605,7 +8605,7 @@ CheckSubstituteOpp: ; 37378 BattleCommand_Selfdestruct: ; 37380 - farcall TrainerRankings_Selfdestruct + farcall StubbedTrainerRankings_Selfdestruct ld a, BATTLEANIM_PLAYER_DAMAGE ld [wNumHits], a ld c, 3 -- cgit v1.2.3 From 0caea0f8202bf4cedb967a844a96cee04386b8df Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Tue, 2 Jan 2018 16:46:40 -0500 Subject: Use BANK for all hardcoded banks with BANK in comments. --- engine/battle/battle_transition.asm | 6 +++--- engine/battle/core.asm | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 85ba44072..2b9ebe091 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -298,7 +298,7 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab) StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8) farcall Function5602 - ld a, $5 ; BANK(LYOverrides) + ld a, BANK(LYOverrides) ld [rSVBK], a call StartTrainerBattle_NextScene @@ -356,7 +356,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408) StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d) farcall Function5602 - ld a, $5 ; BANK(LYOverrides) + ld a, BANK(LYOverrides) ld [rSVBK], a call StartTrainerBattle_NextScene xor a @@ -498,7 +498,7 @@ ENDM StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578) farcall Function5602 - ld a, $5 ; BANK(LYOverrides) + ld a, BANK(LYOverrides) ld [rSVBK], a call StartTrainerBattle_NextScene ld a, $10 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 08021fc8b..48be08bf0 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -8440,7 +8440,7 @@ InitEnemy: ; 3f55e BackUpBGMap2: ; 3f568 ld a, [rSVBK] push af - ld a, $6 ; BANK(wDecompressScratch) + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, wDecompressScratch ld bc, $40 tiles ; vBGMap3 - vBGMap2 -- cgit v1.2.3 From 9d0ba6bfd3b2f10fae9969a784aa7b2b573e8411 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Wed, 3 Jan 2018 19:12:45 -0500 Subject: Use BANK for hardcoded WRAM banks (except where bankswitches appear unnecessary). --- engine/battle/battle_transition.asm | 10 +++++----- engine/battle/core.asm | 4 ++-- engine/battle/sliding_intro.asm | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 2b9ebe091..73f7eaef4 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -23,7 +23,7 @@ Predef_StartBattle: ; 8c20f .done ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(wBGPals1) ld [rSVBK], a ld hl, wBGPals1 @@ -44,7 +44,7 @@ Predef_StartBattle: ; 8c20f ld [hLYOverrideEnd], a ld [hSCY], a - ld a, $1 + ld a, 1 ; unnecessary bankswitch? ld [rSVBK], a pop af ld [hVBlank], a @@ -116,7 +116,7 @@ LoadTrainerBattlePokeballTiles: ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a push hl ld hl, wDecompressScratch @@ -647,7 +647,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) .daytime ld a, [rSVBK] push af - ld a, $5 ; WRAM5 = palettes + ld a, BANK(wBGPals1) ld [rSVBK], a call .copypals push hl @@ -729,7 +729,7 @@ PokeBallTransition: WipeLYOverrides: ; 8c6d8 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(LYOverrides) ld [rSVBK], a ld hl, LYOverrides diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 48be08bf0..bac39e76f 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -9320,7 +9320,7 @@ InitBattleDisplay: ; 3fb6c .BlankBGMap: ; 3fbd6 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, wDecompressScratch @@ -9381,7 +9381,7 @@ GetTrainerBackpic: ; 3fbff CopyBackpic: ; 3fc30 ld a, [rSVBK] push af - ld a, $6 + ld a, BANK(wDecompressScratch) ld [rSVBK], a ld hl, vTiles0 ld de, vTiles2 tile $31 diff --git a/engine/battle/sliding_intro.asm b/engine/battle/sliding_intro.asm index ed78add8e..2cd242c84 100755 --- a/engine/battle/sliding_intro.asm +++ b/engine/battle/sliding_intro.asm @@ -1,7 +1,7 @@ BattleIntroSlidingPics: ; 4e980 ld a, [rSVBK] push af - ld a, $5 + ld a, BANK(LYOverrides) ld [rSVBK], a call .subfunction1 ld a, rSCX - $ff00 -- cgit v1.2.3 From fb422e8d9c78c56db27d974baa04c7a16bf5df41 Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Thu, 4 Jan 2018 14:53:50 -0500 Subject: Use BANK for hardcoded WRAM banks preceding FarCopyWRAM/GetFarWRAMByte calls. --- engine/battle/checkbattlescene.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/checkbattlescene.asm b/engine/battle/checkbattlescene.asm index b63f00907..5253c3c47 100644 --- a/engine/battle/checkbattlescene.asm +++ b/engine/battle/checkbattlescene.asm @@ -1,7 +1,7 @@ CheckBattleScene: ; 4ea44 ; Return carry if battle scene is turned off. - ld a, 0 + ld a, BANK(wLinkMode) ld hl, wLinkMode call GetFarWRAMByte cp LINK_MOBILE @@ -33,7 +33,7 @@ CheckBattleScene: ; 4ea44 ret .from_wram - ld a, $5 + ld a, BANK(w5_dc00) ld hl, w5_dc00 call GetFarWRAMByte bit 0, a -- cgit v1.2.3 From e9e8bf6eb14020d4a88a7cd4bca8539a2b45803e Mon Sep 17 00:00:00 2001 From: xCrystal Date: Fri, 5 Jan 2018 11:05:01 +0100 Subject: Predef_Flag -> Predef_FlagAction --- engine/battle/ai/move.asm | 2 +- engine/battle/core.asm | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index d91ac437d..ead0fd5fa 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -92,7 +92,7 @@ AIChooseMove: ; 440ce push bc ld d, BANK(TrainerClassAttributes) - predef Predef_Flag + predef Predef_FlagAction ld d, c pop bc diff --git a/engine/battle/core.asm b/engine/battle/core.asm index b5ca19562..ff415bc75 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2760,7 +2760,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_Flag + predef Predef_FlagAction ld hl, EnemySubStatus3 res SUBSTATUS_IN_LOOP, [hl] xor a @@ -3357,10 +3357,10 @@ AddBattleParticipant: ; 3d581 ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG push bc - predef Predef_Flag + predef Predef_FlagAction pop bc ld hl, wBattleParticipantsIncludingFainted - predef_jump Predef_Flag + predef_jump Predef_FlagAction ; 3d599 FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 @@ -4350,7 +4350,7 @@ PursuitSwitch: ; 3dc5b ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_Flag + predef Predef_FlagAction call PlayerMonFaintedAnimation ld hl, BattleText_PkmnFainted jr .done_fainted @@ -6631,7 +6631,7 @@ LoadEnemyMon: ; 3e8eb ld c, a ld b, SET_FLAG ld hl, PokedexSeen - predef Predef_Flag + predef Predef_FlagAction ld hl, EnemyMonStats ld de, EnemyStats @@ -7313,7 +7313,7 @@ GiveExperiencePoints: ; 3ee3b ld c, a ld b, CHECK_FLAG ld d, $0 - predef Predef_Flag + predef Predef_FlagAction ld a, c and a pop bc @@ -7642,7 +7642,7 @@ GiveExperiencePoints: ; 3ee3b ld a, [CurPartyMon] ld c, a ld b, SET_FLAG - predef Predef_Flag + predef Predef_FlagAction pop af ld [CurPartyLevel], a -- cgit v1.2.3 From 2c789b64b1bfa9ec33d805d06ad3a7141e3871f1 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Sun, 7 Jan 2018 11:53:20 +0100 Subject: Predef_FlagAction -> Predef_SmallFarFlagAction --- engine/battle/ai/move.asm | 2 +- engine/battle/core.asm | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index ead0fd5fa..b4550383a 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -92,7 +92,7 @@ AIChooseMove: ; 440ce push bc ld d, BANK(TrainerClassAttributes) - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld d, c pop bc diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ff415bc75..7702a0681 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2760,7 +2760,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld hl, EnemySubStatus3 res SUBSTATUS_IN_LOOP, [hl] xor a @@ -3357,10 +3357,10 @@ AddBattleParticipant: ; 3d581 ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG push bc - predef Predef_FlagAction + predef Predef_SmallFarFlagAction pop bc ld hl, wBattleParticipantsIncludingFainted - predef_jump Predef_FlagAction + predef_jump Predef_SmallFarFlagAction ; 3d599 FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 @@ -4350,7 +4350,7 @@ PursuitSwitch: ; 3dc5b ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction call PlayerMonFaintedAnimation ld hl, BattleText_PkmnFainted jr .done_fainted @@ -6631,7 +6631,7 @@ LoadEnemyMon: ; 3e8eb ld c, a ld b, SET_FLAG ld hl, PokedexSeen - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld hl, EnemyMonStats ld de, EnemyStats @@ -7313,7 +7313,7 @@ GiveExperiencePoints: ; 3ee3b ld c, a ld b, CHECK_FLAG ld d, $0 - predef Predef_FlagAction + predef Predef_SmallFarFlagAction ld a, c and a pop bc @@ -7642,7 +7642,7 @@ GiveExperiencePoints: ; 3ee3b ld a, [CurPartyMon] ld c, a ld b, SET_FLAG - predef Predef_FlagAction + predef Predef_SmallFarFlagAction pop af ld [CurPartyLevel], a -- cgit v1.2.3 From d6f20ae74619fa4b3071867016fa7ae7253df98f Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Mon, 8 Jan 2018 17:13:37 -0500 Subject: Use BANK for hardcoded SRAM banks (except for vestigial refs to JP's banks 4-7) --- engine/battle/checkbattlescene.asm | 2 +- engine/battle/core.asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/checkbattlescene.asm b/engine/battle/checkbattlescene.asm index 5253c3c47..24d06b8c9 100644 --- a/engine/battle/checkbattlescene.asm +++ b/engine/battle/checkbattlescene.asm @@ -19,7 +19,7 @@ CheckBattleScene: ; 4ea44 and a jr nz, .from_wram - ld a, $4 + ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld a, [$a60c] ld c, a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index bac39e76f..7649eba84 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -232,7 +232,7 @@ BattleTurn: ; 3c12f ; 3c1bf MobileFn_3c1bf: mobile - ld a, $5 + ld a, 5 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank ld hl, $a89b ; s5_a89b inc [hl] -- cgit v1.2.3 From 94f32db7bc4a5e4e4d8837d3110d0876146783af Mon Sep 17 00:00:00 2001 From: Adelaide Walter Date: Mon, 8 Jan 2018 22:48:58 -0500 Subject: Document hardcoded SRAM addresses. --- engine/battle/checkbattlescene.asm | 2 +- engine/battle/core.asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/checkbattlescene.asm b/engine/battle/checkbattlescene.asm index 24d06b8c9..a33cc62e3 100644 --- a/engine/battle/checkbattlescene.asm +++ b/engine/battle/checkbattlescene.asm @@ -21,7 +21,7 @@ CheckBattleScene: ; 4ea44 ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank - ld a, [$a60c] + ld a, [$a60c] ; address of MBC30 bank ld c, a call CloseSRAM diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 7649eba84..6d4401946 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -234,7 +234,7 @@ BattleTurn: ; 3c12f MobileFn_3c1bf: mobile ld a, 5 ; MBC30 bank used by JP Crystal; inaccessible by MBC3 call GetSRAMBank - ld hl, $a89b ; s5_a89b + ld hl, $a89b ; address of MBC30 bank inc [hl] jr nz, .finish dec hl -- cgit v1.2.3 From 5a73a62d9bdaa42aa3b94064a0ddba63a8e34ad2 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 15:12:49 -0500 Subject: =?UTF-8?q?Move=20battle=20engine=20data=20into=20data/=20IsJohtoG?= =?UTF-8?q?ymLeader=20=E2=86=92=20IsGymLeader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/battle/core.asm | 105 +++++++---------------------------------- engine/battle/start_battle.asm | 6 ++- 2 files changed, 20 insertions(+), 91 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 9c22331a0..c609e0bba 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -865,15 +865,7 @@ GetMovePriority: ; 3c5c5 ret ; 3c5df -MoveEffectPriorities: ; 3c5df - db EFFECT_PROTECT, 3 - db EFFECT_ENDURE, 3 - db EFFECT_PRIORITY_HIT, 2 - db EFFECT_FORCE_SWITCH, 0 - db EFFECT_COUNTER, 0 - db EFFECT_MIRROR_COAT, 0 - db -1 -; 3c5ec +INCLUDE "data/moves/effects_priorities.asm" GetMoveEffect: ; 3c5ec ld a, b @@ -2640,7 +2632,7 @@ PlayVictoryMusic: ; 3d0ea .trainer_victory ld de, MUSIC_GYM_VICTORY - call IsJohtoGymLeader + call IsGymLeader jr c, .play_music ld de, MUSIC_TRAINER_VICTORY @@ -2652,58 +2644,22 @@ PlayVictoryMusic: ; 3d0ea ret ; 3d123 -; These functions check if the current opponent is a gym leader or one of a -; few other special trainers. - -; Note: KantoGymLeaders is a subset of JohtoGymLeaders. If you wish to -; differentiate between the two, call IsKantoGymLeader first. - -; The Lance and Red entries are unused for music checks; those trainers are -; accounted for elsewhere. - IsKantoGymLeader: ; 0x3d123 ld hl, KantoGymLeaders jr IsGymLeaderCommon -IsJohtoGymLeader: ; 0x3d128 - ld hl, JohtoGymLeaders +IsGymLeader: ; 0x3d128 + ld hl, GymLeaders IsGymLeaderCommon: push de ld a, [OtherTrainerClass] - ld de, $0001 + ld de, $1 call IsInArray pop de ret ; 0x3d137 -JohtoGymLeaders: - db FALKNER - db WHITNEY - db BUGSY - db MORTY - db PRYCE - db JASMINE - db CHUCK - db CLAIR - db WILL - db BRUNO - db KAREN - db KOGA -; fallthrough -; these two entries are unused - db CHAMPION - db RED -; fallthrough -KantoGymLeaders: - db BROCK - db MISTY - db LT_SURGE - db ERIKA - db JANINE - db SABRINA - db BLAINE - db BLUE - db -1 +INCLUDE "data/trainers/leaders.asm" HandlePlayerMonFaint: ; 3d14e call FaintYourPokemon @@ -4586,12 +4542,12 @@ UseHeldStatusHealingItem: ; 3dde9 ; 3de44 .Statuses: ; 3de44 - db HELD_HEAL_POISON, 1 << PSN - db HELD_HEAL_FREEZE, 1 << FRZ - db HELD_HEAL_BURN, 1 << BRN - db HELD_HEAL_SLEEP, SLP + db HELD_HEAL_POISON, 1 << PSN + db HELD_HEAL_FREEZE, 1 << FRZ + db HELD_HEAL_BURN, 1 << BRN + db HELD_HEAL_SLEEP, SLP db HELD_HEAL_PARALYZE, 1 << PAR - db HELD_HEAL_STATUS, ALL_STATUS + db HELD_HEAL_STATUS, ALL_STATUS db $ff ; 3de51 @@ -6652,13 +6608,13 @@ CheckSleepingTreeMon: ; 3eb38 jr nz, .NotSleeping ; Get list for the time of day - ld hl, .Morn + ld hl, AsleepTreeMonsMorn ld a, [TimeOfDay] cp DAY_F jr c, .Check - ld hl, .Day + ld hl, AsleepTreeMonsDay jr z, .Check - ld hl, .Nite + ld hl, AsleepTreeMonsNite .Check: ld a, [TempEnemyMonSpecies] @@ -6671,36 +6627,7 @@ CheckSleepingTreeMon: ; 3eb38 and a ret -.Nite: - db CATERPIE - db METAPOD - db BUTTERFREE - db WEEDLE - db KAKUNA - db BEEDRILL - db SPEAROW - db EKANS - db EXEGGCUTE - db LEDYBA - db AIPOM - db -1 ; end - -.Day: - db VENONAT - db HOOTHOOT - db NOCTOWL - db SPINARAK - db HERACROSS - db -1 ; end - -.Morn: - db VENONAT - db HOOTHOOT - db NOCTOWL - db SPINARAK - db HERACROSS - db -1 ; end -; 3eb75 +INCLUDE "data/wild/treemons_asleep.asm" CheckUnownLetter: ; 3eb75 ; Return carry if the Unown letter hasn't been unlocked yet @@ -8491,7 +8418,7 @@ InitEnemyTrainer: ; 3f594 ld a, TRAINER_BATTLE ld [wBattleMode], a - call IsJohtoGymLeader + call IsGymLeader jr nc, .done xor a ld [CurPartyMon], a diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index 7f0bff96b..253169a27 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -93,7 +93,7 @@ PlayBattleMusic: ; 2ee6c cp RED jr z, .done - ; really, they should have included admins and scientists here too... + ; They should have included EXECUTIVEM, EXECUTIVEF, and SCIENTIST too... ld de, MUSIC_ROCKET_BATTLE cp GRUNTM jr z, .done @@ -104,8 +104,10 @@ PlayBattleMusic: ; 2ee6c farcall IsKantoGymLeader jr c, .done + ; IsGymLeader also counts CHAMPION, RED, and the Kanto gym leaders + ; but they have been taken care of before this ld de, MUSIC_JOHTO_GYM_LEADER_BATTLE - farcall IsJohtoGymLeader + farcall IsGymLeader jr c, .done ld de, MUSIC_RIVAL_BATTLE -- cgit v1.2.3 From a849c3557b8ee3dd2b464ccdc646aebd33d7b2a7 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 15:39:48 -0500 Subject: More comments Fix some constants --- engine/battle/core.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index c609e0bba..8c9eecbcf 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -857,7 +857,7 @@ GetMovePriority: ; 3c5c5 cp -1 jr nz, .loop - ld a, 1 + ld a, BASE_PRIORITY ret .done @@ -4808,7 +4808,7 @@ PrintPlayerHUD: ; 3dfbf ld [de], a ld hl, BattleMonLevel ld de, TempMonLevel - ld bc, $0011 + ld bc, $11 call CopyBytes ld a, [CurBattleMon] ld hl, PartyMon1Species -- cgit v1.2.3 From 11556196ba546f5c45b97fffc2c263a79eb639b9 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 16:39:36 -0500 Subject: Consistent sine wave code formatting --- engine/battle/battle_transition.asm | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 85ba44072..af7bb688f 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -640,7 +640,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) .cgb ld hl, .daypals ld a, [TimeOfDayPal] - and (1 << 2) - 1 + and $3 cp 3 jr nz, .daytime ld hl, .nightpals @@ -754,22 +754,23 @@ WipeLYOverrides: ; 8c6d8 StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7) - and (1 << 6) - 1 - cp 1 << 5 - jr nc, .okay - call .DoSineWave +; a = d * sin(a * pi/32) + and %111111 + cp %100000 + jr nc, .negative + call .ApplySineWave ld a, h ret -.okay - and (1 << 5) - 1 - call .DoSineWave +.negative + and %011111 + call .ApplySineWave ld a, h - xor -1 ; cpl + xor $ff inc a ret -.DoSineWave: ; 8c70c (23:470c) +.ApplySineWave: ; 8c70c (23:470c) ld e, a ld a, d ld d, 0 @@ -780,15 +781,15 @@ StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7) inc hl ld d, [hl] ld hl, 0 -.loop +.multiply srl a - jr nc, .skip + jr nc, .even add hl, de -.skip +.even sla e rl d and a - jr nz, .loop + jr nz, .multiply ret ; 8c728 (23:4728) -- cgit v1.2.3 From a8cf8979d9acf66d1bdf4ea115ab6a0faa8f9d34 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 9 Jan 2018 17:20:47 -0500 Subject: Do a little cleanup towards issue #465 --- engine/battle/hidden_power.asm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/hidden_power.asm b/engine/battle/hidden_power.asm index c75a67ab3..a1d3957e4 100644 --- a/engine/battle/hidden_power.asm +++ b/engine/battle/hidden_power.asm @@ -16,12 +16,12 @@ HiddenPowerDamage: ; fbced ; Attack ld a, [hl] swap a - and 8 + and %1000 ; Defense ld b, a ld a, [hli] - and 8 + and %1000 srl a or b @@ -29,7 +29,7 @@ HiddenPowerDamage: ; fbced ld b, a ld a, [hl] swap a - and 8 + and %1000 srl a srl a or b @@ -37,7 +37,7 @@ HiddenPowerDamage: ; fbced ; Special ld b, a ld a, [hl] - and 8 + and %1000 srl a srl a srl a @@ -52,7 +52,7 @@ HiddenPowerDamage: ; fbced ; Add Special & 3 ld b, a ld a, [hld] - and 3 + and %0011 add b ; Divide by 2 and add 30 + 1 @@ -67,12 +67,12 @@ HiddenPowerDamage: ; fbced ; Def & 3 ld a, [hl] - and 3 + and %0011 ld b, a ; + (Atk & 3) << 2 ld a, [hl] - and 3 << 4 + and %0011 << 4 swap a add a add a -- cgit v1.2.3 From ee4ec65fc17a802425b606eeef59e92a9a6c9b81 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 02:30:17 -0500 Subject: map_objects.pal is easier to find in gfx/overworld/ than gfx/sprites/ --- engine/battle/battle_transition.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/battle') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index af7bb688f..383674652 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -589,7 +589,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) dec b jr nz, .loop - call .loadpokeballgfx ; ld a, [OtherTrainerClass] \ ld de, PokeBallTransition \ ret + call .loadpokeballgfx hlcoord 2, 1 ld b, SCREEN_WIDTH - 4 -- cgit v1.2.3 From 417937cffc2a7c3cfac49f3b00caf1a856d0a925 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 13:47:57 -0500 Subject: Resolve #461 --- engine/battle/core.asm | 24 ++++++++++++------------ engine/battle/sliding_intro.asm | 4 ++-- engine/battle/trainer_huds.asm | 18 +++++++++--------- 3 files changed, 23 insertions(+), 23 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 8c9eecbcf..ca0c73643 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -9329,27 +9329,27 @@ CopyBackpic: ; 3fc30 ; 3fc5b .LoadTrainerBackpicAsOAM: ; 3fc5b - ld hl, Sprites + ld hl, Sprite01 xor a ld [hMapObjectIndexBuffer], a - ld b, $6 - ld e, 21 * 8 + ld b, 6 + ld e, (SCREEN_WIDTH + 1) * TILE_WIDTH .outer_loop - ld c, $3 - ld d, 8 * 8 + ld c, 3 + ld d, 8 * TILE_WIDTH .inner_loop - ld [hl], d + ld [hl], d ; y inc hl - ld [hl], e + ld [hl], e ; x inc hl ld a, [hMapObjectIndexBuffer] - ld [hli], a + ld [hli], a ; tile id inc a ld [hMapObjectIndexBuffer], a - ld a, $1 - ld [hli], a + ld a, PAL_BATTLE_OB_PLAYER + ld [hli], a ; attributes ld a, d - add $8 + add 1 * TILE_WIDTH ld d, a dec c jr nz, .inner_loop @@ -9357,7 +9357,7 @@ CopyBackpic: ; 3fc30 add $3 ld [hMapObjectIndexBuffer], a ld a, e - add $8 + add 1 * TILE_WIDTH ld e, a dec b jr nz, .outer_loop diff --git a/engine/battle/sliding_intro.asm b/engine/battle/sliding_intro.asm index ed78add8e..120b0acc6 100755 --- a/engine/battle/sliding_intro.asm +++ b/engine/battle/sliding_intro.asm @@ -60,9 +60,9 @@ BattleIntroSlidingPics: ; 4e980 ; 4e9d6 .subfunction3 ; 4e9d6 - ld hl, Sprites + 1 ; x pixel + ld hl, Sprite01XCoord ld c, $12 ; 18 - ld de, $4 + ld de, SPRITEOAMSTRUCT_LENGTH .loop3 dec [hl] dec [hl] diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm index b236fc56b..179cc806d 100755 --- a/engine/battle/trainer_huds.asm +++ b/engine/battle/trainer_huds.asm @@ -28,7 +28,7 @@ ShowPlayerMonsRemaining: ; 2c01c ld [hl], a ld a, 8 ld [wPlaceBallsDirection], a - ld hl, Sprites + ld hl, Sprite01 jp LoadTrainerHudOAM ; 2c03a @@ -44,7 +44,7 @@ ShowOTTrainerMonsRemaining: ; 2c03a ld [hl], 4 * 8 ld a, -8 ld [wPlaceBallsDirection], a - ld hl, Sprites + PARTY_LENGTH * 4 + ld hl, Sprite07 jp LoadTrainerHudOAM ; 2c059 @@ -193,7 +193,7 @@ LinkBattle_TrainerHuds: ; 2c10d ld [hl], 8 * 8 ld a, $8 ld [wPlaceBallsDirection], a - ld hl, Sprites + ld hl, Sprite01 call LoadTrainerHudOAM ld hl, OTPartyMon1HP @@ -203,7 +203,7 @@ LinkBattle_TrainerHuds: ; 2c10d ld a, 10 * 8 ld [hli], a ld [hl], 13 * 8 - ld hl, Sprites + PARTY_LENGTH * 4 + ld hl, Sprite07 jp LoadTrainerHudOAM ; 2c143 @@ -212,13 +212,13 @@ LoadTrainerHudOAM: ; 2c143 ld c, PARTY_LENGTH .loop ld a, [wPlaceBallsY] - ld [hli], a + ld [hli], a ; y ld a, [wPlaceBallsX] - ld [hli], a + ld [hli], a ; x ld a, [de] - ld [hli], a - ld a, $3 - ld [hli], a + ld [hli], a ; tile id + ld a, PAL_BATTLE_OB_YELLOW + ld [hli], a ; attributes ld a, [wPlaceBallsX] ld b, a ld a, [wPlaceBallsDirection] -- cgit v1.2.3 From c8575823a0e3694cba7c63e7ef468c55bb301804 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 17:30:27 -0500 Subject: Battle data goes in data/battle/ TreeMons, like fish groups, have constants --- engine/battle/effect_commands.asm | 132 +++++++++++--------------------------- 1 file changed, 37 insertions(+), 95 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index f86f90479..f9a8ba63e 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -64,7 +64,7 @@ DoMove: ; 3402c inc hl ld [de], a inc de - cp $ff + cp -1 jr nz, .GetMoveEffect ; Start at the first command. @@ -138,7 +138,7 @@ BattleCommand_CheckTurn: ; 34084 ld [AlreadyFailed], a ld [wSomeoneIsRampaging], a - ld a, 10 ; 1.0 + ld a, EFFECTIVE ld [TypeModifier], a ld a, [hBattleTurn] @@ -282,7 +282,7 @@ CheckPlayerTurn: ; 50% chance of hitting itself call BattleRandom - cp $80 + cp 50 percent + 1 jr nc, .not_confused ; clear confusion-dependent substatus @@ -311,7 +311,7 @@ CheckPlayerTurn: ; 50% chance of infatuation call BattleRandom - cp $80 + cp 50 percent + 1 jr c, .not_infatuated ld hl, InfatuationText @@ -345,7 +345,7 @@ CheckPlayerTurn: ; 25% chance to be fully paralyzed call BattleRandom - cp $3f + cp 25 percent ret nc ld hl, FullyParalyzedText @@ -457,6 +457,8 @@ CheckEnemyTurn: ; 3421f ld hl, EnemyMonStatus bit FRZ, [hl] jr z, .not_frozen + + ; Flame Wheel and Sacred Fire thaw the user. ld a, [CurEnemyMove] cp FLAME_WHEEL jr z, .not_frozen @@ -611,7 +613,7 @@ CheckEnemyTurn: ; 3421f ; 25% chance to be fully paralyzed call BattleRandom - cp $3f + cp 25 percent ret nc ld hl, FullyParalyzedText @@ -989,6 +991,7 @@ IgnoreSleepOnly: ; 3451f ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar + ; Snore and Sleep Talk bypass sleep. cp SNORE jr z, .CheckSleep cp SLEEP_TALK @@ -1172,7 +1175,7 @@ BattleCommand_DoTurn: ; 34555 db EFFECT_ROLLOUT db EFFECT_BIDE db EFFECT_RAMPAGE - db $ff + db -1 ; 3460b CheckMimicUsed: ; 3460b @@ -1266,7 +1269,7 @@ BattleCommand_Critical: ; 34631 ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld de, 1 - ld hl, .Criticals + ld hl, CriticalHitMoves push bc call IsInArray pop bc @@ -1288,7 +1291,7 @@ BattleCommand_Critical: ; 34631 inc c .Tally: - ld hl, .Chances + ld hl, CriticalHitChances ld b, 0 add hl, bc call BattleRandom @@ -1298,12 +1301,7 @@ BattleCommand_Critical: ; 34631 ld [CriticalHit], a ret -.Criticals: - db KARATE_CHOP, RAZOR_WIND, RAZOR_LEAF, CRABHAMMER, SLASH, AEROBLAST, CROSS_CHOP, $ff -.Chances: - ; 6.25% 12.1% 24.6% 33.2% 49.6% 49.6% 49.6% - db $11, $20, $40, $55, $80, $80, $80 - ; 0 1 2 3 4 5 6 +INCLUDE "data/battle/critical_hits.asm" ; 346b2 @@ -1433,11 +1431,11 @@ BattleCommand_Stab: ; 346d2 .TypesLoop: ld a, [hli] - cp $ff + cp -1 jr z, .end ; foresight - cp $fe + cp -2 jr nz, .SkipForesightCheck ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar @@ -1562,9 +1560,9 @@ CheckTypeMatchup: ; 347d3 ld hl, TypeMatchups .TypesLoop: ld a, [hli] - cp $ff + cp -1 jr z, .End - cp $fe + cp -2 jr nz, .Next ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar @@ -1640,7 +1638,7 @@ BattleCommand_ResetTypeMatchup: ; 34833 INCLUDE "engine/battle/ai/switch.asm" -INCLUDE "data/type_matchups.asm" +INCLUDE "data/battle/type_matchups.asm" BattleCommand_DamageVariation: ; 34cfd ; damagevariation @@ -1675,7 +1673,7 @@ BattleCommand_DamageVariation: ; 34cfd .loop call BattleRandom rrca - cp $d9 ; 85% + cp 85 percent + 1 jr c, .loop ld [hMultiplier], a @@ -1756,7 +1754,7 @@ BattleCommand_CheckHit: ; 34d32 .skip_brightpowder ld a, b - cp $ff + cp -1 jr z, .Hit call BattleRandom @@ -1954,7 +1952,7 @@ BattleCommand_CheckHit: ; 34d32 .skip_foresight_check ; subtract evasion from 14 - ld a, 14 + ld a, MAX_STAT_LEVEL + 1 sub c ld c, a ; store the base move accuracy for math ops @@ -1969,7 +1967,7 @@ BattleCommand_CheckHit: ; 34d32 .accuracy_loop ; look up the multiplier from the table push bc - ld hl, .AccProb + ld hl, AccuracyLevelMultipliers dec b sla b ld c, b @@ -2013,21 +2011,7 @@ BattleCommand_CheckHit: ; 34d32 ld [hl], a ret -.AccProb: - db 33, 100 ; 33% -6 - db 36, 100 ; 36% -5 - db 43, 100 ; 43% -4 - db 50, 100 ; 50% -3 - db 60, 100 ; 60% -2 - db 75, 100 ; 75% -1 - db 1, 1 ; 100% 0 - db 133, 100 ; 133% +1 - db 166, 100 ; 166% +2 - db 2, 1 ; 200% +3 - db 233, 100 ; 233% +4 - db 133, 50 ; 266% +5 - db 3, 1 ; 300% +6 - +INCLUDE "data/battle/accuracy_multipliers.asm" ; 34ecc @@ -2199,7 +2183,7 @@ BattleCommand_HitTargetNoSub: ; 34f60 xor 1 ld [wKickCounter], a ld a, [de] - cp $1 + cp 1 push af ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar @@ -2438,7 +2422,7 @@ GetFailureResultText: ; 350e4 ld hl, AttackMissedText ld de, AttackMissed2Text ld a, [CriticalHit] - cp $ff + cp -1 jr nz, .got_text ld hl, UnaffectedText .got_text @@ -3519,7 +3503,7 @@ BattleCommand_DamageCalc: ; 35612 .NextItem: ld a, [hli] - cp $ff + cp -1 jr z, .DoneItem ; Item effect @@ -3657,26 +3641,7 @@ BattleCommand_DamageCalc: ; 35612 ; 35703 -TypeBoostItems: ; 35703 - db HELD_NORMAL_BOOST, NORMAL ; Pink/Polkadot Bow - db HELD_FIGHTING_BOOST, FIGHTING ; Blackbelt - db HELD_FLYING_BOOST, FLYING ; Sharp Beak - db HELD_POISON_BOOST, POISON ; Poison Barb - db HELD_GROUND_BOOST, GROUND ; Soft Sand - db HELD_ROCK_BOOST, ROCK ; Hard Stone - db HELD_BUG_BOOST, BUG ; Silverpowder - db HELD_GHOST_BOOST, GHOST ; Spell Tag - db HELD_FIRE_BOOST, FIRE ; Charcoal - db HELD_WATER_BOOST, WATER ; Mystic Water - db HELD_GRASS_BOOST, GRASS ; Miracle Seed - db HELD_ELECTRIC_BOOST, ELECTRIC ; Magnet - db HELD_PSYCHIC_BOOST, PSYCHIC ; Twistedspoon - db HELD_ICE_BOOST, ICE ; Nevermeltice - db HELD_DRAGON_BOOST, DRAGON ; Dragon Scale - db HELD_DARK_BOOST, DARK ; Blackglasses - db HELD_STEEL_BOOST, STEEL ; Metal Coat - db $ff -; 35726 +INCLUDE "data/battle/type_boost_items.asm" BattleCommand_ConstantDamage: ; 35726 @@ -4671,7 +4636,7 @@ BattleCommand_FalseSwipe: ; 35c94 ld [de], a .okay ld a, [CriticalHit] - cp $2 + cp 2 jr nz, .carry xor a ld [CriticalHit], a @@ -5049,7 +5014,7 @@ BattleCommand_SleepTarget: ; 35e5c jr nz, .dont_fail call BattleRandom - cp $40 ; 25% + cp 25 percent + 1 ; 25% chance AI fails ret c .dont_fail @@ -5149,7 +5114,7 @@ BattleCommand_Poison: ; 35f2c jr nz, .mimic_random call BattleRandom - cp $40 ; 25% chance AI fails + cp 25 percent + 1 ; 25% chance AI fails jr c, .failed .mimic_random @@ -5827,7 +5792,7 @@ BattleCommand_StatDown: ; 362e3 inc b .ComputerMiss: -; Computer opponents have a 1/4 chance of failing. +; Computer opponents have a 25% chance of failing. ld a, [hBattleTurn] and a jr z, .DidntMiss @@ -5852,7 +5817,7 @@ BattleCommand_StatDown: ; 362e3 jr z, .DidntMiss call BattleRandom - cp $40 + cp 25 percent + 1 ; 25% chance AI fails jr c, .Failed .DidntMiss: @@ -6104,7 +6069,7 @@ BattleCommand_StatDownFailText: ; 3646a GetStatName: ; 3648f - ld hl, .names + ld hl, StatNames ld c, "@" .CheckName: dec b @@ -6120,33 +6085,10 @@ GetStatName: ; 3648f ld bc, StringBuffer3 - StringBuffer2 jp CopyBytes -.names - db "ATTACK@" - db "DEFENSE@" - db "SPEED@" - db "SPCL.ATK@" - db "SPCL.DEF@" - db "ACCURACY@" - db "EVASION@" - db "ABILITY@" -; 364e6 - - -StatLevelMultipliers: ; 364e6 - db 25, 100 ; 0.25x - db 28, 100 ; 0.28x - db 33, 100 ; 0.33x - db 40, 100 ; 0.40x - db 50, 100 ; 0.50x - db 66, 100 ; 0.66x - db 1, 1 ; 1.00x - db 15, 10 ; 1.50x - db 2, 1 ; 2.00x - db 25, 10 ; 2.50x - db 3, 1 ; 3.00x - db 35, 10 ; 3.50x - db 4, 1 ; 4.00x -; 36500 +INCLUDE "data/battle/stat_names.asm" + + +INCLUDE "data/battle/stat_multipliers.asm" BattleCommand_AllStatsUp: ; 36500 -- cgit v1.2.3 From 0a3b251dcb710a8319d6633122d92a983bcefd1c Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Wed, 10 Jan 2018 22:53:42 -0500 Subject: Arrays end with -1, not $ff --- engine/battle/ai/items.asm | 2 +- engine/battle/ai/scoring.asm | 24 +++---- engine/battle/core.asm | 4 +- engine/battle/effect_commands/present.asm | 4 +- engine/battle/misc.asm | 54 +++++++-------- engine/battle/used_move_text.asm | 105 +----------------------------- 6 files changed, 48 insertions(+), 145 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 09595077a..d0867fb33 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -291,7 +291,7 @@ AI_Items: ; 39196 dbw X_DEFEND, .XDefend dbw X_SPEED, .XSpeed dbw X_SPECIAL, .XSpecial - db $ff + db -1 ; end ; 381be .FullHeal: ; 381be diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index 44194d6f7..73284435a 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -68,7 +68,7 @@ AI_Basic: ; 38591 db EFFECT_TOXIC db EFFECT_POISON db EFFECT_PARALYZE - db $ff + db -1 ; end ; 385e0 @@ -400,7 +400,7 @@ AI_Smart: ; 386be dbw EFFECT_SOLARBEAM, AI_Smart_Solarbeam dbw EFFECT_THUNDER, AI_Smart_Thunder dbw EFFECT_FLY, AI_Smart_Fly - db $ff + db -1 ; end ; 387e3 @@ -1553,7 +1553,7 @@ AI_Smart_Encore: ; 38c3b db AEROBLAST db COTTON_SPORE db POWDER_SNOW - db $ff + db -1 ; end ; 38ca4 @@ -2214,7 +2214,7 @@ AI_Smart_Sandstorm: ; 38f7a db ROCK db GROUND db STEEL - db $ff + db -1 ; end ; 38fac @@ -2533,7 +2533,7 @@ RainDanceMoves: ; 390e7 db CRABHAMMER db OCTAZOOKA db WHIRLPOOL - db $ff + db -1 ; end ; 390f3 @@ -2622,7 +2622,7 @@ SunnyDayMoves: ; 39134 db SACRED_FIRE db MORNING_SUN db SYNTHESIS - db $ff + db -1 ; end ; 3913d @@ -3125,7 +3125,7 @@ UsefulMoves: ; 39301 db FIRE_BLAST db SOFTBOILED db SUPER_FANG - db $ff + db -1 ; end ; 39315 @@ -3209,7 +3209,7 @@ AI_Opportunist: ; 39315 db CONVERSION db SUBSTITUTE db FLAME_WHEEL - db $ff + db -1 ; end ; 39369 @@ -3324,7 +3324,7 @@ AI_Aggressive: ; 39369 db EFFECT_RAMPAGE db EFFECT_MULTI_HIT db EFFECT_DOUBLE_HIT - db $ff + db -1 ; end ; 393e7 @@ -3350,7 +3350,7 @@ AIDamageCalc: ; 393e7 db EFFECT_STATIC_DAMAGE db EFFECT_LEVEL_DAMAGE db EFFECT_PSYWAVE - db $ff + db -1 ; end ; 39418 @@ -3406,7 +3406,7 @@ AI_Cautious: ; 39418 db CONVERSION db SUBSTITUTE db SPIKES - db $ff + db -1 ; end ; 39453 @@ -3544,7 +3544,7 @@ endr .RiskyMoves: db EFFECT_SELFDESTRUCT db EFFECT_OHKO - db $ff + db -1 ; end ; 39502 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ca0c73643..5b5b3562e 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -4548,7 +4548,7 @@ UseHeldStatusHealingItem: ; 3dde9 db HELD_HEAL_SLEEP, SLP db HELD_HEAL_PARALYZE, 1 << PAR db HELD_HEAL_STATUS, ALL_STATUS - db $ff + db -1 ; end ; 3de51 UseConfusionHealingItem: ; 3de51 @@ -4672,7 +4672,7 @@ HandleStatBoostingHeldItems: ; 3de97 dbw HELD_SP_DEFENSE_UP, BattleCommand_SpecialDefenseUp dbw HELD_ACCURACY_UP, BattleCommand_AccuracyUp dbw HELD_EVASION_UP, BattleCommand_EvasionUp - db $ff + db -1 ; end ; 3df12 GetPartymonItem: ; 3df12 diff --git a/engine/battle/effect_commands/present.asm b/engine/battle/effect_commands/present.asm index 819294f8c..2b358e8b9 100755 --- a/engine/battle/effect_commands/present.asm +++ b/engine/battle/effect_commands/present.asm @@ -31,7 +31,7 @@ BattleCommand_Present: ; 37874 ld c, 0 .next ld a, [hli] - cp $ff + cp -1 jr z, .heal_effect ; 378a4 $11 cp b jr nc, .got_power ; 378a7 $4 @@ -89,5 +89,5 @@ BattleCommand_Present: ; 37874 db 40 percent, 40 db 70 percent + 1, 80 db 80 percent, 120 - db $ff + db -1 ; end ; 3790e diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index c78e9fd84..a41d31d9a 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -146,15 +146,15 @@ DoWeatherModifiers: ; fbda4 ret .WeatherTypeModifiers: - db WEATHER_RAIN, WATER, 15 - db WEATHER_RAIN, FIRE, 05 - db WEATHER_SUN, FIRE, 15 - db WEATHER_SUN, WATER, 05 - db $ff + db WEATHER_RAIN, WATER, MORE_EFFECTIVE + db WEATHER_RAIN, FIRE, NOT_VERY_EFFECTIVE + db WEATHER_SUN, FIRE, MORE_EFFECTIVE + db WEATHER_SUN, WATER, NOT_VERY_EFFECTIVE + db -1 ; end .WeatherMoveModifiers: - db WEATHER_RAIN, EFFECT_SOLARBEAM, 05 - db $ff + db WEATHER_RAIN, EFFECT_SOLARBEAM, NOT_VERY_EFFECTIVE + db -1 ; end ; fbe24 @@ -183,7 +183,7 @@ DoBadgeTypeBoosts: ; fbe24 .CheckBadge: ld a, [hl] - cp $ff + cp -1 jr z, .done srl b @@ -236,22 +236,24 @@ DoBadgeTypeBoosts: ; fbe24 ret .BadgeTypes: - db FLYING ; zephyrbadge - db BUG ; hivebadge - db NORMAL ; plainbadge - db GHOST ; fogbadge - db STEEL ; mineralbadge - db FIGHTING ; stormbadge - db ICE ; glacierbadge - db DRAGON ; risingbadge - - db ROCK ; boulderbadge - db WATER ; cascadebadge - db ELECTRIC ; thunderbadge - db GRASS ; rainbowbadge - db POISON ; soulbadge - db PSYCHIC ; marshbadge - db FIRE ; volcanobadge - db GROUND ; earthbadge - db $ff +; entries correspond to wJohtoBadges constants + db FLYING ; ZEPHYRBADGE + db BUG ; HIVEBADGE + db NORMAL ; PLAINBADGE + db GHOST ; FOGBADGE + db STEEL ; MINERALBADGE + db FIGHTING ; STORMBADGE + db ICE ; GLACIERBADGE + db DRAGON ; RISINGBADGE + ; fallthrough +; entries correspond to wKantoBadges constants + db ROCK ; BOULDERBADGE + db WATER ; CASCADEBADGE + db ELECTRIC ; THUNDERBADGE + db GRASS ; RAINBOWBADGE + db POISON ; SOULBADGE + db PSYCHIC ; MARSHBADGE + db FIRE ; VOLCANOBADGE + db GROUND ; EARTHBADGE + db -1 ; end ; fbe91 diff --git a/engine/battle/used_move_text.asm b/engine/battle/used_move_text.asm index ce9e51359..1b5aa564c 100755 --- a/engine/battle/used_move_text.asm +++ b/engine/battle/used_move_text.asm @@ -157,12 +157,12 @@ GetMoveGrammar: ; 105e5c .loop ld a, [hli] ; end of table? - cp $ff + cp -1 jr z, .end ; match? cp c jr z, .end -; advance grammar type at $00 +; advance grammar type at 0 and a jr nz, .loop ; next grammar type @@ -179,106 +179,7 @@ GetMoveGrammar: ; 105e5c ret ; 105e7a -MoveGrammar: ; 105e7a -; made redundant in localization -; each move is given an identifier for what usedmovetext to use (0-4): - -; 0 - db SWORDS_DANCE - db GROWTH - db STRENGTH - db HARDEN - db MINIMIZE - db SMOKESCREEN - db WITHDRAW - db DEFENSE_CURL - db EGG_BOMB - db SMOG - db BONE_CLUB - db FLASH - db SPLASH - db ACID_ARMOR - db BONEMERANG - db REST - db SHARPEN - db SUBSTITUTE - db MIND_READER - db SNORE - db PROTECT - db SPIKES - db ENDURE - db ROLLOUT - db SWAGGER - db SLEEP_TALK - db HIDDEN_POWER - db PSYCH_UP - db EXTREMESPEED - db 0 ; end set - -; 1 - db RECOVER - db TELEPORT - db BIDE - db SELFDESTRUCT - db AMNESIA - db FLAIL - db 0 ; end set - -; 2 - db MEDITATE - db AGILITY - db MIMIC - db DOUBLE_TEAM - db BARRAGE - db TRANSFORM - db STRUGGLE - db SCARY_FACE - db 0 ; end set - -; 3 - db POUND - db SCRATCH - db VICEGRIP - db WING_ATTACK - db FLY - db BIND - db SLAM - db HORN_ATTACK - db WRAP - db THRASH - db TAIL_WHIP - db LEER - db BITE - db GROWL - db ROAR - db SING - db PECK - db ABSORB - db STRING_SHOT - db EARTHQUAKE - db FISSURE - db DIG - db TOXIC - db SCREECH - db METRONOME - db LICK - db CLAMP - db CONSTRICT - db POISON_GAS - db BUBBLE - db SLASH - db SPIDER_WEB - db NIGHTMARE - db CURSE - db FORESIGHT - db CHARM - db ATTRACT - db ROCK_SMASH - db 0 ; end set - -; all other moves = 4 - db $ff ; end -; 105ed0 +INCLUDE "data/moves/grammar.asm" UpdateUsedMoves: ; 105ed0 -- cgit v1.2.3 From 94d6a327218fc56753238b424df208245092d96c Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 12:00:01 -0500 Subject: Use maskbits some more --- engine/battle/ai/move.asm | 4 ++-- engine/battle/battle_transition.asm | 4 ++-- engine/battle/core.asm | 21 +++++++++--------- engine/battle/effect_commands.asm | 43 ++++++++++++++++++++----------------- 4 files changed, 37 insertions(+), 35 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index 11586c0da..72ed6983b 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -56,7 +56,7 @@ AIChooseMove: ; 440ce inc hl ld a, [de] inc de - and $3f + and PP_MASK jr nz, .CheckMovePP ld [hl], 80 jr .CheckMovePP @@ -186,7 +186,7 @@ AIChooseMove: ; 440ce .ChooseMove: ld hl, Buffer1 call Random - and 3 + maskbits NUM_MOVES +- 1 ld c, a ld b, 0 add hl, bc diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 383674652..4c05112ac 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -640,8 +640,8 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) .cgb ld hl, .daypals ld a, [TimeOfDayPal] - and $3 - cp 3 + maskbits NUM_DAYTIMES +- 1 + cp DARKNESS_F jr nz, .daytime ld hl, .nightpals .daytime diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5b5b3562e..35d2098bc 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -730,7 +730,7 @@ HandleEncore: ; 3c4df ld b, 0 add hl, bc ld a, [hl] - and $3f + and PP_MASK ret nz .end_player_encore @@ -754,7 +754,7 @@ HandleEncore: ; 3c4df ld b, 0 add hl, bc ld a, [hl] - and $3f + and PP_MASK ret nz .end_enemy_encore @@ -1401,7 +1401,7 @@ HandleMysteryberry: ; 3c93c and a jr z, .quit ld a, [de] - and $3f + and PP_MASK jr z, .restore inc hl inc de @@ -5650,7 +5650,7 @@ MoveSelectionScreen: ; 3e4bc ld b, 0 add hl, bc ld a, [hl] - and $3f + and PP_MASK jr z, .no_pp_left ld a, [PlayerDisableCount] swap a @@ -5849,7 +5849,7 @@ MoveInfoBox: ; 3e6c8 ld hl, BattleMonPP add hl, bc ld a, [hl] - and $3f + and PP_MASK ld [StringBuffer1], a call .PrintPP @@ -5912,7 +5912,7 @@ CheckPlayerHasUsableMoves: ; 3e786 or [hl] inc hl or [hl] - and $3f + and PP_MASK ret nz jr .force_struggle @@ -5934,8 +5934,7 @@ CheckPlayerHasUsableMoves: ; 3e786 .done ; Bug: this will result in a move with PP Up confusing the game. - ; Replace with "and $3f" to fix. - and a + and a ; should be "and PP_MASK" ret nz .force_struggle @@ -6014,7 +6013,7 @@ ParseEnemyAction: ; 3e7c1 cp [hl] jr z, .disabled ld a, [de] - and $3f + and PP_MASK jr nz, .enough_pp .disabled @@ -6032,7 +6031,7 @@ ParseEnemyAction: ; 3e7c1 .loop2 ld hl, EnemyMonMoves call BattleRandom - and 3 ; TODO factor in NUM_MOVES + maskbits NUM_MOVES +- 1 ld c, a ld b, 0 add hl, bc @@ -6049,7 +6048,7 @@ ParseEnemyAction: ; 3e7c1 add hl, bc ld b, a ld a, [hl] - and $3f + and PP_MASK jr z, .loop2 ld a, c ld [CurEnemyMoveNum], a diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index f9a8ba63e..68184ce30 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -846,19 +846,20 @@ BattleCommand_CheckObedience: ; 343db .DoNothing: + ; 4 random choices call BattleRandom - and 3 + and %11 ld hl, LoafingAroundText - and a + and a ; 0 jr z, .Print ld hl, WontObeyText - dec a + dec a ; 1 jr z, .Print ld hl, TurnedAwayText - dec a + dec a ; 2 jr z, .Print ld hl, IgnoredOrdersText @@ -888,7 +889,7 @@ BattleCommand_CheckObedience: ; 343db .GetTotalPP: ld a, [hli] - and $3f ; exclude pp up + and PP_MASK add b ld b, a @@ -911,7 +912,7 @@ BattleCommand_CheckObedience: ; 343db ; Can't use another move if only one move has PP. ld a, [hl] - and $3f + and PP_MASK cp b jr z, .DoNothing @@ -931,7 +932,7 @@ BattleCommand_CheckObedience: ; 343db .RandomMove: call BattleRandom - and 3 ; TODO NUM_MOVES + maskbits NUM_MOVES +- 1 cp b jr nc, .RandomMove @@ -947,7 +948,7 @@ BattleCommand_CheckObedience: ; 343db ld d, 0 add hl, de ld a, [hl] - and $3f + and PP_MASK jr z, .RandomMove @@ -1118,7 +1119,7 @@ BattleCommand_DoTurn: ; 34555 ld b, 0 add hl, bc ld a, [hl] - and $3f + and PP_MASK jr z, .out_of_pp dec [hl] ld b, 0 @@ -3906,7 +3907,7 @@ BattleCommand_Encore: ; 35864 ld bc, BattleMonPP - BattleMonMoves - 1 add hl, bc ld a, [hl] - and $3f + and PP_MASK jp z, .failed ld a, [AttackMissed] and a @@ -4386,7 +4387,7 @@ BattleCommand_SleepTalk: ; 35b33 .sample_move push hl call BattleRandom - and 3 ; TODO factor in NUM_MOVES + maskbits NUM_MOVES +- 1 ld c, a ld b, 0 add hl, bc @@ -4550,17 +4551,18 @@ BattleCommand_Spite: ; 35c0f add hl, bc pop bc ld a, [hl] - and $3f + and PP_MASK jr z, .failed push bc call GetMoveName + ; lose 2-5 PP call BattleRandom - and 3 + and %11 inc a inc a ld b, a ld a, [hl] - and $3f + and PP_MASK cp b jr nc, .deplete_pp ld b, a @@ -6208,13 +6210,12 @@ BattleCommand_TriStatusChance: ; 3658f call BattleCommand_EffectChance -; 1/3 chance of each status .loop + ; 1/3 chance of each status call BattleRandom swap a - and 3 + and %11 jr z, .loop -; jump dec a ld hl, .ptrs rst JumpTable @@ -7392,7 +7393,8 @@ BattleCommand_TrapTarget: ; 36c2d bit SUBSTATUS_SUBSTITUTE, a ret nz call BattleRandom - and 3 + ; trapped for 2-5 turns + and %11 inc a inc a inc a @@ -7590,8 +7592,9 @@ BattleCommand_FinishConfusingTarget: ; 36d70 .got_confuse_count set SUBSTATUS_CONFUSED, [hl] + ; confused for 2-5 turns call BattleRandom - and 3 + and %11 inc a inc a ld [bc], a @@ -8201,7 +8204,7 @@ BattleCommand_Conversion: ; 3707f .done .loop3 call BattleRandom - and 3 ; TODO factor in NUM_MOVES + maskbits NUM_MOVES +- 1 ld c, a ld b, 0 ld hl, StringBuffer1 -- cgit v1.2.3 From f1e1b26138daabc15b83f5a8ce7f6e513749f5a8 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 12 Jan 2018 14:54:00 -0500 Subject: More gfx/**/*.pal files --- engine/battle/battle_transition.asm | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 4c05112ac..16c9df2c1 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -691,17 +691,12 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) ; 8c6a1 (23:46a1) .daypals ; 8c6a1 - RGB 31, 18, 29 - RGB 31, 11, 15 - RGB 31, 05, 05 - RGB 07, 07, 07 +INCLUDE "gfx/overworld/trainer_battle_day.pal" ; 8c6a9 .nightpals ; 8c6a9 - RGB 31, 18, 29 - RGB 31, 05, 05 - RGB 31, 05, 05 - RGB 31, 05, 05 +INCLUDE "gfx/overworld/trainer_battle_nite.pal" +; 8c6b1 .loadpokeballgfx ld a, [OtherTrainerClass] -- cgit v1.2.3 From 2ab60fa8a49dfe9e20ebb620471ba4c2ca64a4aa Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 13 Jan 2018 16:38:14 -0500 Subject: menu_coords macro for (x1, y1, x2, y2) order (see issue #440) --- engine/battle/menu.asm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm index 07d3e6081..e44d92f83 100755 --- a/engine/battle/menu.asm +++ b/engine/battle/menu.asm @@ -34,8 +34,7 @@ Function24f19: ; 24f19 BattleMenuDataHeader: ; 24f2c db $40 ; flags - db 12, 08 ; start coords - db 17, 19 ; end coords + menu_coords 8, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24f34 db 1 ; default option ; 24f34 @@ -57,8 +56,7 @@ Strings24f3d: ; 0x24f3d MenuDataHeader_0x24f4e: ; 24f4e db $40 ; flags - db 12, 00 ; start coords - db 17, 19 ; end coords + menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24f56 db 1 ; default option ; 24f56 @@ -88,8 +86,7 @@ Function24f7c: ; 24f7c MenuDataHeader_0x24f89: ; 24f89 db $40 ; flags - db 12, 02 ; start coords - db 17, 19 ; end coords + menu_coords 2, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw MenuData_0x24f91 db 1 ; default option ; 24f91 -- cgit v1.2.3 From 11d67567d2c0182864a755a7bebcff0f29e877d6 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sun, 14 Jan 2018 11:59:56 +0100 Subject: Use constants for menu flags Added a bunch of constants for the bitflags of each kind of menu. Some are slightly vague or too long, but I'm not sure how to else name them. --- engine/battle/menu.asm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm index 07d3e6081..ccca4402a 100755 --- a/engine/battle/menu.asm +++ b/engine/battle/menu.asm @@ -33,7 +33,7 @@ Function24f19: ; 24f19 ; 24f2c BattleMenuDataHeader: ; 24f2c - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 12, 08 ; start coords db 17, 19 ; end coords dw MenuData_0x24f34 @@ -41,7 +41,7 @@ BattleMenuDataHeader: ; 24f2c ; 24f34 MenuData_0x24f34: ; 0x24f34 - db $81 ; flags + db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags dn 2, 2 ; rows, columns db 6 ; spacing dba Strings24f3d @@ -56,7 +56,7 @@ Strings24f3d: ; 0x24f3d ; 24f4e MenuDataHeader_0x24f4e: ; 24f4e - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 12, 00 ; start coords db 17, 19 ; end coords dw MenuData_0x24f56 @@ -64,7 +64,7 @@ MenuDataHeader_0x24f4e: ; 24f4e ; 24f56 MenuData_0x24f56: ; 24f56 - db $81 ; flags + db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags dn 2, 2 ; rows, columns db 11 ; spacing dba Strings24f5f @@ -87,7 +87,7 @@ Function24f7c: ; 24f7c ; 24f89 MenuDataHeader_0x24f89: ; 24f89 - db $40 ; flags + db MENU_BACKUP_TILES ; flags db 12, 02 ; start coords db 17, 19 ; end coords dw MenuData_0x24f91 @@ -95,7 +95,7 @@ MenuDataHeader_0x24f89: ; 24f89 ; 24f91 MenuData_0x24f91: ; 24f91 - db $81 ; flags + db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags dn 2, 2 ; rows, columns db 12 ; spacing dba Strings24f9a -- cgit v1.2.3 From eb3102200f66e3aa1688e4e52429fcac4b0272fa Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 14 Jan 2018 19:26:55 -0500 Subject: More Battle Tower map script constants, fewer raw hex values --- engine/battle/core.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 35d2098bc..a604bc37a 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -2452,7 +2452,7 @@ WinTrainerBattle: ; 3cfa4 ld c, 40 call DelayFrames call EmptyBattleTextBox - ld c, $3 + ld c, BATTLETOWERTEXT_LOSS_TEXT farcall BattleTowerText call WaitPressAorB_BlinkCursor ld hl, wPayDayMoney @@ -3022,7 +3022,7 @@ LostBattle: ; 3d38e call DelayFrames call EmptyBattleTextBox - ld c, 2 + ld c, BATTLETOWERTEXT_WIN_TEXT farcall BattleTowerText call WaitPressAorB_BlinkCursor call ClearTileMap -- cgit v1.2.3 From 80480821142d7a7b16dd2b1a98a213e7b389af0f Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 14:30:10 -0500 Subject: Remove Predef_ prefix from routines listed in PredefPointers --- engine/battle/ai/items.asm | 4 +- engine/battle/ai/move.asm | 2 +- engine/battle/ai/scoring.asm | 2 +- engine/battle/ai/switch.asm | 16 ++-- engine/battle/anim_hp_bar.asm | 10 +- engine/battle/battle_transition.asm | 2 +- engine/battle/core.asm | 148 +++++++++++++++--------------- engine/battle/effect_commands.asm | 40 ++++---- engine/battle/effect_commands/attract.asm | 4 +- engine/battle/misc.asm | 2 +- engine/battle/read_trainer_party.asm | 8 +- engine/battle/returntobattle_useball.asm | 4 +- engine/battle/start_battle.asm | 2 +- 13 files changed, 122 insertions(+), 122 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm index 5bdc070ec..d0867fb33 100644 --- a/engine/battle/ai/items.asm +++ b/engine/battle/ai/items.asm @@ -545,7 +545,7 @@ AI_Items: ; 39196 AIUpdateHUD: ; 38387 call UpdateEnemyMonInParty - farcall Predef_UpdateEnemyHUD + farcall UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ld hl, wEnemyItemState @@ -664,7 +664,7 @@ EnemyPotionFinish: ; 38436 xor a ld [wWhichHPBar], a call AIUsedItemSound - predef Predef_AnimateHPBar + predef AnimateHPBar jp AIUpdateHUD diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index d04fb9930..27a8ad5a5 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -92,7 +92,7 @@ AIChooseMove: ; 440ce push bc ld d, BANK(TrainerClassAttributes) - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld d, c pop bc diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm index c1d175c38..73284435a 100644 --- a/engine/battle/ai/scoring.asm +++ b/engine/battle/ai/scoring.asm @@ -1488,7 +1488,7 @@ AI_Smart_Encore: ; 38c3b push hl ld a, [wEnemyMoveStruct + MOVE_TYPE] ld hl, EnemyMonType1 - predef Predef_CheckTypeMatchup + predef CheckTypeMatchup pop hl ld a, [wd265] diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm index cb278676e..c2f83fa1f 100755 --- a/engine/battle/ai/switch.asm +++ b/engine/battle/ai/switch.asm @@ -28,7 +28,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e inc hl call GetMoveByte ld hl, EnemyMonType - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr nc, .super_effective @@ -73,7 +73,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e ld a, [BattleMonType1] ld b, a ld hl, EnemyMonType1 - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok @@ -82,7 +82,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e ld a, [BattleMonType2] cp b jr z, .ok2 - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 ; 1.0 + 0.1 jr c, .ok2 @@ -123,7 +123,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e inc hl call GetMoveByte ld hl, BattleMonType1 - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] ; immune @@ -390,7 +390,7 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a inc hl call GetMoveByte ld hl, BaseType - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] and a jr nz, .next @@ -481,7 +481,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7 inc hl call GetMoveByte ld hl, BattleMonType1 - call Predef_CheckTypeMatchup + call CheckTypeMatchup ; if immune or not very effective: continue ld a, [wTypeMatchup] @@ -585,7 +585,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20 .skip_move ld a, [BattleMonType1] ld hl, BaseType - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 jr nc, .dont_choose_mon @@ -593,7 +593,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20 .check_type ld hl, BaseType - call Predef_CheckTypeMatchup + call CheckTypeMatchup ld a, [wTypeMatchup] cp 10 + 1 jr nc, .dont_choose_mon diff --git a/engine/battle/anim_hp_bar.asm b/engine/battle/anim_hp_bar.asm index d67a46a70..71276d27e 100755 --- a/engine/battle/anim_hp_bar.asm +++ b/engine/battle/anim_hp_bar.asm @@ -67,7 +67,7 @@ _AnimateHPBar: ; d627 ld a, [hli] ld b, a pop hl - call Predef_ComputeHPBarPixels + call ComputeHPBarPixels ld a, e ld [wCurHPBarPixels], a @@ -79,7 +79,7 @@ _AnimateHPBar: ; d627 ld e, a ld a, [wCurHPAnimMaxHP + 1] ld d, a - call Predef_ComputeHPBarPixels + call ComputeHPBarPixels ld a, e ld [wNewHPBarPixels], a @@ -183,11 +183,11 @@ LongAnim_UpdateVariables: ; d6f5 ld c, a ld a, [hli] ld b, a - ; This routine is buggy. The result from Predef_ComputeHPBarPixels is stored + ; This routine is buggy. The result from ComputeHPBarPixels is stored ; in e. However, the pop de opcode deletes this result before it is even ; used. The game then proceeds as though it never deleted that output. ; To fix, uncomment the line below. - call Predef_ComputeHPBarPixels + call ComputeHPBarPixels ; ld a, e pop bc pop de @@ -227,7 +227,7 @@ LongHPBarAnim_UpdateTiles: ; d749 ld e, a ld a, [wCurHPAnimMaxHP + 1] ld d, a - call Predef_ComputeHPBarPixels + call ComputeHPBarPixels ld c, e ld d, HP_BAR_LENGTH ld a, [wWhichHPBar] diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index f035867b5..1409ddc37 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -1,4 +1,4 @@ -Predef_DoBattleTransition: ; 8c20f +DoBattleTransition: ; 8c20f call .InitGFX ld a, [rBGP] ld [wBGP], a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index cf9c821b7..5d79f5fd5 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -47,7 +47,7 @@ DoBattle: ; 3c000 .player_2 call LoadTileMapToTempTileMap - call Predef_CheckPlayerPartyForFitPkmn + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -1278,7 +1278,7 @@ HandleWrap: ; 3c874 xor a ld [wNumHits], a ld [FXAnimID + 1], a - predef Predef_PlayBattleAnim + predef PlayBattleAnim call SwitchTurnCore .skip_anim @@ -2040,7 +2040,7 @@ UpdateHPBar: ; 3cd3c .ok push bc ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar pop bc ret ; 3cd55 @@ -2054,7 +2054,7 @@ HandleEnemyMonFaint: ; 3cd55 xor a ld [wWhichMonFaintedFirst], a call UpdateBattleStateAndExperienceAfterEnemyFaint - call Predef_CheckPlayerPartyForFitPkmn + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2062,7 +2062,7 @@ HandleEnemyMonFaint: ; 3cd55 ld hl, BattleMonHP ld a, [hli] or [hl] - call nz, Predef_UpdatePlayerHUD + call nz, UpdatePlayerHUD ld a, $1 ld [hBGMapMode], a @@ -2186,7 +2186,7 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01 call PlayerMonFaintHappinessMod .player_mon_did_not_faint - call Predef_CheckPlayerPartyForFitPkmn + call CheckPlayerPartyForFitPkmn ld a, d and a ret z @@ -2670,7 +2670,7 @@ HandlePlayerMonFaint: ; 3d14e ld a, $1 ld [wWhichMonFaintedFirst], a call PlayerMonFaintHappinessMod - call Predef_CheckPlayerPartyForFitPkmn + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2716,7 +2716,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld hl, EnemySubStatus3 res SUBSTATUS_IN_LOOP, [hl] xor a @@ -3313,10 +3313,10 @@ AddBattleParticipant: ; 3d581 ld hl, wBattleParticipantsNotFainted ld b, SET_FLAG push bc - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction pop bc ld hl, wBattleParticipantsIncludingFainted - predef_jump Predef_SmallFarFlagAction + predef_jump SmallFarFlagAction ; 3d599 FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 @@ -3534,7 +3534,7 @@ LoadEnemyPkmnToSwitchTo: ; 3d6ca and a jr nz, .skip_unown ld hl, EnemyMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld a, [UnownLetter] ld [wFirstUnownSeen], a .skip_unown @@ -3644,8 +3644,8 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call GetBaseData ld a, OTPARTYMON ld [MonType], a - predef Predef_CopyPkmnToTempMon - call Predef_GetEnemyMonFrontpic + predef CopyPkmnToTempMon + call GetEnemyMonFrontpic xor a ld [wNumHits], a @@ -3670,7 +3670,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 hlcoord 12, 0 ld d, $0 ld e, ANIM_MON_SLOW - predef Predef_AnimateFrontpic + predef AnimateFrontpic jr .skip_cry .cry_no_anim @@ -3680,7 +3680,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call PlayStereoCry .skip_cry - call Predef_UpdateEnemyHUD + call UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ret @@ -3721,7 +3721,7 @@ ResetEnemyStatLevels: ; 3d867 ret ; 3d873 -Predef_CheckPlayerPartyForFitPkmn: ; 3d873 +CheckPlayerPartyForFitPkmn: ; 3d873 ; Has the player any Pkmn in his Party that can fight? ld a, [PartyCount] ld e, a @@ -4124,7 +4124,7 @@ SwitchPlayerMon: ; 3db32 SendOutPlayerMon: ; 3db5f ld hl, BattleMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter hlcoord 1, 5 ld b, 7 ld c, 8 @@ -4132,7 +4132,7 @@ SendOutPlayerMon: ; 3db5f call WaitBGMap xor a ld [hBGMapMode], a - call Predef_GetBattleMonBackpic + call GetBattleMonBackpic xor a ld [hGraphicStartTile], a ld [wBattleMenuCursorBuffer], a @@ -4172,7 +4172,7 @@ SendOutPlayerMon: ; 3db5f call PlayStereoCry .statused - call Predef_UpdatePlayerHUD + call UpdatePlayerHUD ld a, $1 ld [hBGMapMode], a ret @@ -4218,13 +4218,13 @@ BreakAttraction: ; 3dc18 SpikesDamage: ; 3dc23 ld hl, PlayerScreens ld de, BattleMonType - ld bc, Predef_UpdatePlayerHUD + ld bc, UpdatePlayerHUD ld a, [hBattleTurn] and a jr z, .ok ld hl, EnemyScreens ld de, EnemyMonType - ld bc, Predef_UpdateEnemyHUD + ld bc, UpdateEnemyHUD .ok bit SCREENS_SPIKES, [hl] @@ -4306,7 +4306,7 @@ PursuitSwitch: ; 3dc5b ld c, a ld hl, wBattleParticipantsNotFainted ld b, RESET_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction call PlayerMonFaintedAnimation ld hl, BattleText_PkmnFainted jr .done_fainted @@ -4455,7 +4455,7 @@ HandleHPHealingItem: ; 3dd2f .got_hp_bar_coords ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar UseOpponentItem: call RefreshBattleHuds callfar GetOpponentItem @@ -4478,7 +4478,7 @@ ItemRecoveryAnim: ; 3ddc8 xor a ld [wNumHits], a ld [FXAnimID + 1], a - predef Predef_PlayBattleAnim + predef PlayBattleAnim call SwitchTurnCore pop bc pop de @@ -4708,7 +4708,7 @@ UpdateBattleHUDs: ; 3df2c ret ; 3df48 -Predef_UpdatePlayerHUD:: ; 3df48 +UpdatePlayerHUD:: ; 3df48 push hl push de push bc @@ -4741,7 +4741,7 @@ DrawPlayerHUD: ; 3df58 ld b, 1 xor a ; PARTYMON ld [MonType], a - predef Predef_DrawPlayerHP + predef DrawPlayerHP ; Exp bar push de @@ -4754,7 +4754,7 @@ DrawPlayerHUD: ; 3df58 hlcoord 10, 11 ld a, [TempMonLevel] ld b, a - call Predef_FillInExpBar + call FillInExpBar pop de ret ; 3df98 @@ -4823,7 +4823,7 @@ PrintPlayerHUD: ; 3dfbf ld a, TEMPMON ld [MonType], a - callfar Predef_GetGender + callfar GetGender ld a, " " jr c, .got_gender_char ld a, "♂" @@ -4837,7 +4837,7 @@ PrintPlayerHUD: ; 3dfbf push af ; back up gender push hl ld de, BattleMonStatus - predef Predef_PlaceNonFaintStatus + predef PlaceNonFaintStatus pop hl pop bc ret nz @@ -4852,7 +4852,7 @@ PrintPlayerHUD: ; 3dfbf jp PrintLevel ; 3e036 -Predef_UpdateEnemyHUD:: ; 3e036 +UpdateEnemyHUD:: ; 3e036 push hl push de push bc @@ -4901,7 +4901,7 @@ DrawEnemyHUD: ; 3e043 ld a, TEMPMON ld [MonType], a - callfar Predef_GetGender + callfar GetGender ld a, " " jr c, .got_gender ld a, "♂" @@ -4916,7 +4916,7 @@ DrawEnemyHUD: ; 3e043 push af push hl ld de, EnemyMonStatus - predef Predef_PlaceNonFaintStatus + predef PlaceNonFaintStatus pop hl pop bc jr nz, .skip_level @@ -5141,8 +5141,8 @@ BattleMenu_Pack: ; 3e1c7 call ClearPalettes call DelayFrame call _LoadBattleFontsHPBar - call Predef_GetBattleMonBackpic - call Predef_GetEnemyMonFrontpic + call GetBattleMonBackpic + call GetEnemyMonFrontpic call ExitMenu call WaitBGMap call FinishBattleAnim @@ -5174,10 +5174,10 @@ BattleMenu_Pack: ; 3e1c7 ld a, [BattleType] cp BATTLETYPE_TUTORIAL jr z, .tutorial2 - call Predef_GetBattleMonBackpic + call GetBattleMonBackpic .tutorial2 - call Predef_GetEnemyMonFrontpic + call GetEnemyMonFrontpic ld a, $1 ld [wMenuCursorY], a call ExitMenu @@ -5531,7 +5531,7 @@ MoveSelectionScreen: ; 3e4bc .got_start_coord ld a, SCREEN_WIDTH ld [Buffer1], a - predef Predef_ListMoves + predef ListMoves ld b, 5 ld a, [wMoveSelectionMenuType] @@ -5864,7 +5864,7 @@ MoveInfoBox: ; 3e6c8 ld a, [wPlayerMoveStruct + MOVE_ANIM] ld b, a hlcoord 2, 10 - predef Predef_PrintMoveType + predef PrintMoveType .done ret @@ -6319,7 +6319,7 @@ LoadEnemyMon: ; 3e8eb ; Get letter based on DVs ld hl, EnemyMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ; Can't use any letters that haven't been unlocked ; If combined with forced shiny battletype, causes an infinite loop call CheckUnownLetter @@ -6408,7 +6408,7 @@ LoadEnemyMon: ; 3e8eb ld de, EnemyMonMaxHP ld b, FALSE ld hl, EnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; LinkBattleRNs + 7 ; ? - predef Predef_CalcPkmnStats + predef CalcPkmnStats ; If we're in a trainer battle, ; get the rest of the parameters from the party struct @@ -6523,7 +6523,7 @@ LoadEnemyMon: ; 3e8eb ; Make sure the predef knows this isn't a partymon ld [wEvolutionOldSpecies], a ; Fill moves based on level - predef Predef_FillMoves + predef FillMoves .PP: ; Trainer battle? @@ -6534,7 +6534,7 @@ LoadEnemyMon: ; 3e8eb ; Fill wild PP ld hl, EnemyMonMoves ld de, EnemyMonPP - predef Predef_FillPP + predef FillPP jr .Finish .TrainerPP: @@ -6587,7 +6587,7 @@ LoadEnemyMon: ; 3e8eb ld c, a ld b, SET_FLAG ld hl, PokedexSeen - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld hl, EnemyMonStats ld de, EnemyStats @@ -6715,7 +6715,7 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8 ld a, [OtherTrainerClass] ld [TrainerClass], a ld de, vTiles2 - callfar Predef_GetTrainerPic + callfar GetTrainerPic hlcoord 19, 0 ld c, 0 @@ -7192,7 +7192,7 @@ Call_PlayBattleAnim: ; 3ee17 ld a, d ld [FXAnimID + 1], a call WaitBGMap - predef_jump Predef_PlayBattleAnim + predef_jump PlayBattleAnim ; 3ee27 FinishBattleAnim: ; 3ee27 @@ -7240,7 +7240,7 @@ GiveExperiencePoints: ; 3ee3b ld c, a ld b, CHECK_FLAG ld d, $0 - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction ld a, c and a pop bc @@ -7418,7 +7418,7 @@ GiveExperiencePoints: ; 3ee3b .not_max_exp xor a ; PARTYMON ld [MonType], a - predef Predef_CopyPkmnToTempMon + predef CopyPkmnToTempMon callfar CalcLevel pop bc ld hl, MON_LEVEL @@ -7455,7 +7455,7 @@ GiveExperiencePoints: ; 3ee3b add hl, bc push bc ld b, TRUE - predef Predef_CalcPkmnStats + predef CalcPkmnStats pop bc pop de ld hl, MON_MAXHP + 1 @@ -7508,7 +7508,7 @@ GiveExperiencePoints: ; 3ee3b call ApplyStatLevelMultiplierOnAllStats callfar ApplyStatusEffectOnPlayerStats callfar BadgeStatBoosts - callfar Predef_UpdatePlayerHUD + callfar UpdatePlayerHUD call EmptyBattleTextBox call LoadTileMapToTempTileMap ld a, $1 @@ -7531,14 +7531,14 @@ GiveExperiencePoints: ; 3ee3b .skip_animation2 xor a ; PARTYMON ld [MonType], a - predef Predef_CopyPkmnToTempMon + predef CopyPkmnToTempMon hlcoord 9, 0 ld b, $a ld c, $9 call TextBox hlcoord 11, 1 ld bc, 4 - predef Predef_PrintTempMonStats + predef PrintTempMonStats ld c, $1e call DelayFrames call WaitPressAorB_BlinkCursor @@ -7558,7 +7558,7 @@ GiveExperiencePoints: ; 3ee3b ld a, b ld [CurPartyLevel], a push bc - predef Predef_LearnLevelMoves + predef LearnLevelMoves pop bc ld a, b cp c @@ -7569,7 +7569,7 @@ GiveExperiencePoints: ; 3ee3b ld a, [CurPartyMon] ld c, a ld b, SET_FLAG - predef Predef_SmallFarFlagAction + predef SmallFarFlagAction pop af ld [CurPartyLevel], a @@ -7691,7 +7691,7 @@ AnimateExpBar: ; 3f136 ld [wd002], a xor a ; PARTYMON ld [MonType], a - predef Predef_CopyPkmnToTempMon + predef CopyPkmnToTempMon ld a, [TempMonLevel] ld b, a ld e, a @@ -8062,7 +8062,7 @@ Unreferenced_HandleSafariAngerEatingStatus: jp StdBattleTextBox ; 3f390 -Predef_FillInExpBar: ; 3f390 +FillInExpBar: ; 3f390 push hl call CalcExpBar pop hl @@ -8204,7 +8204,7 @@ PlaceExpBar: ; 3f41c ret ; 3f43d -Predef_GetBattleMonBackpic: ; 3f43d +GetBattleMonBackpic: ; 3f43d ld a, [PlayerSubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub @@ -8220,9 +8220,9 @@ DropPlayerSub: ; 3f447 ld a, [BattleMonSpecies] ld [CurPartySpecies], a ld hl, BattleMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld de, vTiles2 tile $31 - predef Predef_GetMonBackpic + predef GetMonBackpic pop af ld [CurPartySpecies], a ret @@ -8240,7 +8240,7 @@ GetBattleMonBackpic_DoAnim: ; 3f46f ret ; 3f47c -Predef_GetEnemyMonFrontpic: ; 3f47c +GetEnemyMonFrontpic: ; 3f47c ld a, [EnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a ld hl, BattleAnimCmd_RaiseSub @@ -8259,9 +8259,9 @@ DropEnemySub: ; 3f486 ld [CurPartySpecies], a call GetBaseData ld hl, EnemyMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld de, vTiles2 - predef Predef_GetAnimatedFrontpic + predef GetAnimatedFrontpic pop af ld [CurPartySpecies], a ret @@ -8278,7 +8278,7 @@ GetEnemyMonFrontpic_DoAnim: ; 3f4b4 ret ; 3f4c1 -Predef_StartBattle: ; 3f4c1 +StartBattle: ; 3f4c1 ; This check prevents you from entering a battle without any Pokemon. ; Those using walk-through-walls to bypass getting a Pokemon experience ; the effects of this check. @@ -8337,7 +8337,7 @@ BattleIntro: ; 3f4dd call ClearSprites ld a, [wBattleMode] cp WILD_BATTLE - call z, Predef_UpdateEnemyHUD + call z, UpdateEnemyHUD ld a, $1 ld [hBGMapMode], a ret @@ -8402,14 +8402,14 @@ InitEnemyTrainer: ; 3f594 .ok ld de, vTiles2 - callfar Predef_GetTrainerPic + callfar GetTrainerPic xor a ld [hGraphicStartTile], a dec a ld [wEnemyItemState], a hlcoord 12, 0 lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic ld a, -1 ld [CurOTMon], a ld a, TRAINER_BATTLE @@ -8455,7 +8455,7 @@ InitEnemyWildmon: ; 3f607 ld bc, NUM_MOVES call CopyBytes ld hl, EnemyMonDVs - predef Predef_GetUnownLetter + predef GetUnownLetter ld a, [CurPartySpecies] cp UNOWN jr nz, .skip_unown @@ -8466,13 +8466,13 @@ InitEnemyWildmon: ; 3f607 ld [wFirstUnownSeen], a .skip_unown ld de, vTiles2 - predef Predef_GetAnimatedFrontpic + predef GetAnimatedFrontpic xor a ld [TrainerClass], a ld [hGraphicStartTile], a hlcoord 12, 0 lb bc, 7, 7 - predef Predef_PlaceGraphic + predef PlaceGraphic ret ; 3f662 @@ -8551,7 +8551,7 @@ ExitBattle: ; 3f69e call CheckPayDay xor a ld [wForceEvolution], a - predef Predef_EvolveAfterBattle + predef EvolveAfterBattle farcall GivePokerusAndConvertBerries ret ; 3f6d0 @@ -9225,7 +9225,7 @@ InitBattleDisplay: ; 3fb6c ld [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 - predef Predef_PlaceGraphic + predef PlaceGraphic xor a ld [hWY], a ld [rWY], a @@ -9297,8 +9297,8 @@ GetTrainerBackpic: ; 3fbff .Decompress: ld de, vTiles2 tile $31 - ld c, $31 - predef Predef_Decompress + ld c, 7 * 7 + predef DecompressGet2bpp ret ; 3fc30 @@ -9320,7 +9320,7 @@ CopyBackpic: ; 3fc30 ld [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 - predef Predef_PlaceGraphic + predef PlaceGraphic ret ; 3fc5b @@ -9400,7 +9400,7 @@ BattleStartMessage: ; 3fc8b hlcoord 12, 0 ld d, $0 ld e, ANIM_MON_NORMAL - predef Predef_AnimateFrontpic + predef AnimateFrontpic jr .skip_cry ; cry is played during the animation .cry_no_anim diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index c46ded638..801ce211e 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -182,7 +182,7 @@ CheckPlayerTurn: call StdBattleTextBox call CantMove call UpdateBattleMonInParty - ld hl, Predef_UpdatePlayerHUD + ld hl, UpdatePlayerHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -433,7 +433,7 @@ CheckEnemyTurn: ; 3421f call StdBattleTextBox call CantMove call UpdateEnemyMonInParty - ld hl, Predef_UpdateEnemyHUD + ld hl, UpdateEnemyHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -672,7 +672,7 @@ HitConfusion: ; 343a5 and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND call z, PlayFXAnimID - ld hl, Predef_UpdatePlayerHUD + ld hl, UpdatePlayerHUD call CallBattleCore ld a, $1 ld [hBGMapMode], a @@ -1538,11 +1538,11 @@ BattleCheckTypeMatchup: ; 347c8 ld hl, EnemyMonType1 ld a, [hBattleTurn] and a - jr z, Predef_CheckTypeMatchup + jr z, CheckTypeMatchup ld hl, BattleMonType1 -Predef_CheckTypeMatchup: ; 347d3 +CheckTypeMatchup: ; 347d3 ; There is an incorrect assumption about this function made in the AI related code: when -; the AI calls Predef_CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing +; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing ; the offensive type in a will make this function do the right thing. Since a is overwritten, ; this assumption is incorrect. A simple fix would be to load the move type for the ; current move into a in BattleCheckTypeMatchup, before falling through, which is @@ -2621,7 +2621,7 @@ BattleCommand_CheckDestinyBond: ; 351c0 ld [Buffer6], a ld h, b ld l, c - predef Predef_AnimateHPBar + predef AnimateHPBar call RefreshBattleHuds call BattleCommand_SwitchTurn @@ -4015,7 +4015,7 @@ BattleCommand_PainSplit: ; 35926 ld a, $1 ld [wWhichHPBar], a hlcoord 10, 9 - predef Predef_AnimateHPBar + predef AnimateHPBar ld hl, EnemyMonHP ld a, [hli] ld [Buffer4], a @@ -4030,7 +4030,7 @@ BattleCommand_PainSplit: ; 35926 ld [wWhichHPBar], a call ResetDamage hlcoord 2, 2 - predef Predef_AnimateHPBar + predef AnimateHPBar farcall _UpdateBattleHUDs ld hl, SharedPainText @@ -4172,7 +4172,7 @@ BattleCommand_Conversion2: ; 359e6 ld a, [hl] ld [wNamedObjectIndexBuffer], a - predef Predef_GetTypeName + predef GetTypeName ld hl, TransformedTypeText jp StdBattleTextBox @@ -4711,7 +4711,7 @@ PlayFXAnimID: ; 35d08 ld c, 3 call DelayFrames - callfar Predef_PlayBattleAnim + callfar PlayBattleAnim ret @@ -4773,7 +4773,7 @@ EnemyHurtItself: ; 35d1c hlcoord 2, 2 xor a ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar .did_no_damage jp RefreshBattleHuds @@ -4833,7 +4833,7 @@ PlayerHurtItself: ; 35d7e hlcoord 10, 9 ld a, $1 ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar .did_no_damage jp RefreshBattleHuds @@ -5301,7 +5301,7 @@ SapHealth: ; 36011 xor a .hp_bar ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar call RefreshBattleHuds jp UpdateBattleMonInParty @@ -6239,11 +6239,11 @@ BattleCommand_Curl: ; 365a7 BattleCommand_RaiseSubNoAnim: ; 365af - ld hl, Predef_GetBattleMonBackpic + ld hl, GetBattleMonBackpic ld a, [hBattleTurn] and a jr z, .PlayerTurn - ld hl, Predef_GetEnemyMonFrontpic + ld hl, GetEnemyMonFrontpic .PlayerTurn: xor a ld [hBGMapMode], a @@ -7525,7 +7525,7 @@ BattleCommand_Recoil: ; 36cb2 xor a .animate_hp_bar ld [wWhichHPBar], a - predef Predef_AnimateHPBar + predef AnimateHPBar call RefreshBattleHuds ld hl, RecoilText jp StdBattleTextBox @@ -8227,7 +8227,7 @@ BattleCommand_Conversion: ; 3707f inc de ld [de], a ld [wNamedObjectIndexBuffer], a - farcall Predef_GetTypeName + farcall GetTypeName call AnimateCurrentMove ld hl, TransformedTypeText jp StdBattleTextBox @@ -9856,7 +9856,7 @@ PlayUserBattleAnim: ; 37e47 push hl push de push bc - callfar Predef_PlayBattleAnim + callfar PlayBattleAnim pop bc pop de pop hl @@ -9878,7 +9878,7 @@ PlayOpponentBattleAnim: ; 37e54 push bc call BattleCommand_SwitchTurn - callfar Predef_PlayBattleAnim + callfar PlayBattleAnim call BattleCommand_SwitchTurn pop bc diff --git a/engine/battle/effect_commands/attract.asm b/engine/battle/effect_commands/attract.asm index fc73d234c..0a6d7c975 100755 --- a/engine/battle/effect_commands/attract.asm +++ b/engine/battle/effect_commands/attract.asm @@ -35,7 +35,7 @@ CheckOppositeGender: ; 377f5 xor a ld [MonType], a - farcall Predef_GetGender + farcall GetGender jr c, .genderless_samegender ld b, 1 @@ -58,7 +58,7 @@ CheckOppositeGender: ; 377f5 ld [TempMonDVs + 1], a ld a, 3 ld [MonType], a - farcall Predef_GetGender + farcall GetGender pop bc jr c, .genderless_samegender diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index 40c472e50..a41d31d9a 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -33,7 +33,7 @@ AppearUser: ; fbd77 (3e:7d77) ld a, $31 .okay ld [hGraphicStartTile], a - predef Predef_PlaceGraphic + predef PlaceGraphic FinishAppearDisappearUser: ; fbd91 (3e:7d91) ld a, $1 ld [hBGMapMode], a diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 4f3dc8e55..a09c6dd08 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -103,7 +103,7 @@ TrainerType1: ; 397eb ld a, OTPARTYMON ld [MonType], a push hl - predef Predef_TryAddMonToParty + predef TryAddMonToParty pop hl jr .loop ; 39806 @@ -124,7 +124,7 @@ TrainerType2: ; 39806 ld [MonType], a push hl - predef Predef_TryAddMonToParty + predef TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Moves @@ -200,7 +200,7 @@ TrainerType3: ; 39871 ld a, OTPARTYMON ld [MonType], a push hl - predef Predef_TryAddMonToParty + predef TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Item @@ -231,7 +231,7 @@ TrainerType4: ; 3989d ld [MonType], a push hl - predef Predef_TryAddMonToParty + predef TryAddMonToParty ld a, [OTPartyCount] dec a ld hl, OTPartyMon1Item diff --git a/engine/battle/returntobattle_useball.asm b/engine/battle/returntobattle_useball.asm index 4254d24f4..e6e33f900 100644 --- a/engine/battle/returntobattle_useball.asm +++ b/engine/battle/returntobattle_useball.asm @@ -4,13 +4,13 @@ _ReturnToBattle_UseBall: ; 2715c ld a, [BattleType] cp BATTLETYPE_TUTORIAL jr z, .gettutorialbackpic - farcall Predef_GetBattleMonBackpic + farcall GetBattleMonBackpic jr .continue .gettutorialbackpic farcall GetTrainerBackpic .continue - farcall Predef_GetEnemyMonFrontpic + farcall GetEnemyMonFrontpic farcall _LoadBattleFontsHPBar call GetMemSGBLayout call CloseWindow diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index b97eda1b3..e1377eec0 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -33,7 +33,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f add hl, de ld a, [hl] ld [BattleMonLevel], a - predef Predef_DoBattleTransition + predef DoBattleTransition farcall _LoadBattleFontsHPBar ld a, 1 ld [hBGMapMode], a -- cgit v1.2.3 From 7b3de85a06e81d14ac0c73e8f9e1ab8e4a474beb Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Tue, 16 Jan 2018 17:27:50 -0500 Subject: Avoid "+- 1" at every maskbits --- engine/battle/ai/move.asm | 2 +- engine/battle/battle_transition.asm | 2 +- engine/battle/core.asm | 2 +- engine/battle/effect_commands.asm | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm index 27a8ad5a5..7ccb20972 100755 --- a/engine/battle/ai/move.asm +++ b/engine/battle/ai/move.asm @@ -186,7 +186,7 @@ AIChooseMove: ; 440ce .ChooseMove: ld hl, Buffer1 call Random - maskbits NUM_MOVES +- 1 + maskbits NUM_MOVES ld c, a ld b, 0 add hl, bc diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 1409ddc37..452339e81 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -640,7 +640,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc) .cgb ld hl, .daypals ld a, [TimeOfDayPal] - maskbits NUM_DAYTIMES +- 1 + maskbits NUM_DAYTIMES cp DARKNESS_F jr nz, .daytime ld hl, .nightpals diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5d79f5fd5..e1c5f331f 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6031,7 +6031,7 @@ ParseEnemyAction: ; 3e7c1 .loop2 ld hl, EnemyMonMoves call BattleRandom - maskbits NUM_MOVES +- 1 + maskbits NUM_MOVES ld c, a ld b, 0 add hl, bc diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 801ce211e..c1bc3752a 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -932,7 +932,7 @@ BattleCommand_CheckObedience: ; 343db .RandomMove: call BattleRandom - maskbits NUM_MOVES +- 1 + maskbits NUM_MOVES cp b jr nc, .RandomMove @@ -4387,7 +4387,7 @@ BattleCommand_SleepTalk: ; 35b33 .sample_move push hl call BattleRandom - maskbits NUM_MOVES +- 1 + maskbits NUM_MOVES ld c, a ld b, 0 add hl, bc @@ -8204,7 +8204,7 @@ BattleCommand_Conversion: ; 3707f .done .loop3 call BattleRandom - maskbits NUM_MOVES +- 1 + maskbits NUM_MOVES ld c, a ld b, 0 ld hl, StringBuffer1 -- cgit v1.2.3 From f556ab9a4cce5e5164799c2f66eff41c986c508e Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 18 Jan 2018 12:03:58 -0500 Subject: Comment on RIVAL1 item --- engine/battle/core.asm | 1 + 1 file changed, 1 insertion(+) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index e1c5f331f..189ebf195 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -8394,6 +8394,7 @@ InitEnemyTrainer: ; 3f594 callfar GetTrainerAttributes callfar ReadTrainerParty + ; RIVAL1's first mon has no held item ld a, [TrainerClass] cp RIVAL1 jr nz, .ok -- cgit v1.2.3 From 0c6338836d714f464bfcaa0c8c5b8c76e6f4958d Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 14:49:43 -0500 Subject: Resolve #471 (although link code still needs more cleanup, like its WRAM labels) --- engine/battle/core.asm | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 189ebf195..9ec9cc63e 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -26,7 +26,7 @@ DoBattle: ; 3c000 and a jr z, .not_linked - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $2 jr z, .player_2 @@ -97,7 +97,7 @@ DoBattle: ; 3c000 ld a, [wLinkMode] and a jr z, .not_linked_2 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $2 jr nz, .not_linked_2 xor a @@ -251,7 +251,7 @@ Stubbed_Function3c1bf: ; 3c1d6 HandleBetweenTurnEffects: ; 3c1d6 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .CheckEnemyFirst call CheckFaint_PlayerThenEnemy @@ -350,7 +350,7 @@ CheckFaint_EnemyThenPlayer: ; 3c25c ; 3c27c HandleBerserkGene: ; 3c27c - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .reverse @@ -458,7 +458,7 @@ DetermineMoveOrder: ; 3c314 ld a, [wPlayerAction] cp $2 jr nz, .switch - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $2 jr z, .player_2 @@ -515,7 +515,7 @@ DetermineMoveOrder: ; 3c314 jp .enemy_first .both_have_quick_claw - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $2 jr z, .player_2b call BattleRandom @@ -545,7 +545,7 @@ DetermineMoveOrder: ; 3c314 jp .enemy_first .speed_tie - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $2 jr z, .player_2c call BattleRandom @@ -709,7 +709,7 @@ ParsePlayerAction: ; 3c434 ; 3c4df HandleEncore: ; 3c4df - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player_1 call .do_player @@ -1161,7 +1161,7 @@ ResidualDamage: ; 3c716 ; 3c801 HandlePerishSong: ; 3c801 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .EnemyFirst call SetPlayerTurn @@ -1230,7 +1230,7 @@ HandlePerishSong: ; 3c801 ; 3c874 HandleWrap: ; 3c874 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .EnemyFirst call SetPlayerTurn @@ -1302,7 +1302,7 @@ SwitchTurnCore: ; 3c8e4 ; 3c8eb HandleLeftovers: ; 3c8eb - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .DoEnemyFirst call SetPlayerTurn @@ -1352,7 +1352,7 @@ HandleLeftovers: ; 3c8eb ; 3c93c HandleMysteryberry: ; 3c93c - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .DoEnemyFirst call SetPlayerTurn @@ -1491,7 +1491,7 @@ HandleMysteryberry: ; 3c93c ; 3ca26 HandleFutureSight: ; 3ca26 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .enemy_first call SetPlayerTurn @@ -1550,7 +1550,7 @@ HandleFutureSight: ; 3ca26 ; 3ca8f HanleDefrost: ; 3ca8f - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .enemy_first call .do_player_turn @@ -1610,7 +1610,7 @@ HanleDefrost: ; 3ca8f ; 3cafb HandleSafeguard: ; 3cafb - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player1 call .CheckPlayer @@ -1647,7 +1647,7 @@ HandleSafeguard: ; 3cafb jp StdBattleTextBox HandleScreens: ; 3cb36 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp 1 jr z, .Both call .CheckPlayer @@ -1731,7 +1731,7 @@ HandleWeather: ; 3cb9e cp WEATHER_SANDSTORM ret nz - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp 1 jr z, .enemy_first @@ -2115,7 +2115,7 @@ HandleEnemyMonFaint: ; 3cd55 ; 3cdca DoubleSwitch: ; 3cdca - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player_1 call ClearSprites @@ -4350,7 +4350,7 @@ RecallPlayerMon: ; 3dce6 ; 3dcf9 HandleHealingItems: ; 3dcf9 - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player_1 call SetPlayerTurn @@ -4595,7 +4595,7 @@ UseConfusionHealingItem: ; 3de51 HandleStatBoostingHeldItems: ; 3de97 ; The effects handled here are not used in-game. - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player_1 call .DoPlayer @@ -5374,7 +5374,7 @@ PlayerSwitch: ; 3e3ad ret .dont_run - ld a, [hLinkPlayerNumber] + ld a, [hSerialConnectionStatus] cp $1 jr z, .player_1 call BattleMonEntrance -- cgit v1.2.3 From b199f6cfbff81cec3e62351ae4aaa6edce0270d5 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 19:31:45 -0500 Subject: Use hSerialConnectionStatus constants elsewhere --- engine/battle/core.asm | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 9ec9cc63e..e8abea583 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -27,7 +27,7 @@ DoBattle: ; 3c000 jr z, .not_linked ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr z, .player_2 .not_linked @@ -98,7 +98,7 @@ DoBattle: ; 3c000 and a jr z, .not_linked_2 ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr nz, .not_linked_2 xor a ld [wEnemySwitchMonIndex], a @@ -252,7 +252,7 @@ Stubbed_Function3c1bf: HandleBetweenTurnEffects: ; 3c1d6 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .CheckEnemyFirst call CheckFaint_PlayerThenEnemy ret c @@ -351,7 +351,7 @@ CheckFaint_EnemyThenPlayer: ; 3c25c HandleBerserkGene: ; 3c27c ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .reverse call .player @@ -459,7 +459,7 @@ DetermineMoveOrder: ; 3c314 cp $2 jr nz, .switch ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr z, .player_2 call BattleRandom @@ -516,7 +516,7 @@ DetermineMoveOrder: ; 3c314 .both_have_quick_claw ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr z, .player_2b call BattleRandom cp c @@ -546,7 +546,7 @@ DetermineMoveOrder: ; 3c314 .speed_tie ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr z, .player_2c call BattleRandom cp 1 + (50 percent) @@ -710,7 +710,7 @@ ParsePlayerAction: ; 3c434 HandleEncore: ; 3c4df ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call .do_player jr .do_enemy @@ -1162,7 +1162,7 @@ ResidualDamage: ; 3c716 HandlePerishSong: ; 3c801 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .EnemyFirst call SetPlayerTurn call .do_it @@ -1231,7 +1231,7 @@ HandlePerishSong: ; 3c801 HandleWrap: ; 3c874 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .EnemyFirst call SetPlayerTurn call .do_it @@ -1303,7 +1303,7 @@ SwitchTurnCore: ; 3c8e4 HandleLeftovers: ; 3c8eb ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .DoEnemyFirst call SetPlayerTurn call .do_it @@ -1353,7 +1353,7 @@ HandleLeftovers: ; 3c8eb HandleMysteryberry: ; 3c93c ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .DoEnemyFirst call SetPlayerTurn call .do_it @@ -1492,7 +1492,7 @@ HandleMysteryberry: ; 3c93c HandleFutureSight: ; 3ca26 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .enemy_first call SetPlayerTurn call .do_it @@ -1551,7 +1551,7 @@ HandleFutureSight: ; 3ca26 HanleDefrost: ; 3ca8f ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .enemy_first call .do_player_turn jr .do_enemy_turn @@ -1611,7 +1611,7 @@ HanleDefrost: ; 3ca8f HandleSafeguard: ; 3cafb ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player1 call .CheckPlayer jr .CheckEnemy @@ -1648,7 +1648,7 @@ HandleSafeguard: ; 3cafb HandleScreens: ; 3cb36 ld a, [hSerialConnectionStatus] - cp 1 + cp USING_EXTERNAL_CLOCK jr z, .Both call .CheckPlayer jr .CheckEnemy @@ -1732,7 +1732,7 @@ HandleWeather: ; 3cb9e ret nz ld a, [hSerialConnectionStatus] - cp 1 + cp USING_EXTERNAL_CLOCK jr z, .enemy_first .player_first @@ -2116,7 +2116,7 @@ HandleEnemyMonFaint: ; 3cd55 DoubleSwitch: ; 3cdca ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call ClearSprites hlcoord 1, 0 @@ -4351,7 +4351,7 @@ RecallPlayerMon: ; 3dce6 HandleHealingItems: ; 3dcf9 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call SetPlayerTurn call HandleHPHealingItem @@ -4596,7 +4596,7 @@ UseConfusionHealingItem: ; 3de51 HandleStatBoostingHeldItems: ; 3de97 ; The effects handled here are not used in-game. ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call .DoPlayer jp .DoEnemy @@ -5375,7 +5375,7 @@ PlayerSwitch: ; 3e3ad .dont_run ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call BattleMonEntrance call EnemyMonEntrance -- cgit v1.2.3 From b071dd364f715165d6eec99ebbd1e4aed4b84bde Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 21:49:16 -0500 Subject: =?UTF-8?q?Japanese=20characters=20in=20Japanese=20text=20(e.g.=20?= =?UTF-8?q?"=E3=82=A9"=20not=20","=20for=20$f4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/battle/menu.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/battle') diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm index dd3d4ef07..c97cd7854 100755 --- a/engine/battle/menu.asm +++ b/engine/battle/menu.asm @@ -70,7 +70,7 @@ MenuData_0x24f56: ; 24f56 ; 24f5f Strings24f5f: ; 24f5f - db "サファりボール× @" ; "SAFARI BALL× @" + db "サファりボール×  @" ; "SAFARI BALL× @" db "エサをなげる@" ; "THROW BAIT" db "いしをなげる@" ; "THROW ROCK" db "にげる@" ; "RUN" -- cgit v1.2.3 From 05382d3e3c03616d6edf21833e89a8264a8cd10a Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 20 Jan 2018 12:25:55 -0500 Subject: PARTY_LENGTH; MON_NAME; sgb_border.bin --- engine/battle/core.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/core.asm b/engine/battle/core.asm index e8abea583..1a58b3df5 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -3989,7 +3989,7 @@ InitBattleMon: ; 3da0d ld a, [CurBattleMon] call SkipNames ld de, BattleMonNick - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld hl, BattleMonAttack ld de, PlayerStats @@ -4074,7 +4074,7 @@ InitEnemyMon: ; 3dabd ld a, [CurPartyMon] call SkipNames ld de, EnemyMonNick - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ld hl, EnemyMonAttack ld de, EnemyStats @@ -6578,7 +6578,7 @@ LoadEnemyMon: ; 3e8eb ; Update enemy nick ld hl, StringBuffer1 ld de, EnemyMonNick - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes ; Saw this mon @@ -7766,7 +7766,7 @@ AnimateExpBar: ; 3f136 call PrintPlayerHUD ld hl, BattleMonNick ld de, StringBuffer1 - ld bc, PKMN_NAME_LENGTH + ld bc, MON_NAME_LENGTH call CopyBytes call TerminateExpBarSound ld de, SFX_HIT_END_OF_EXP_BAR -- cgit v1.2.3 From 732bb36c8661afdaca765604c75437089930738c Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 20 Jan 2018 14:10:31 -0500 Subject: Scale addresses with PARTY_LENGTH --- engine/battle/trainer_huds.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/battle') diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm index 179cc806d..317e72214 100755 --- a/engine/battle/trainer_huds.asm +++ b/engine/battle/trainer_huds.asm @@ -44,7 +44,7 @@ ShowOTTrainerMonsRemaining: ; 2c03a ld [hl], 4 * 8 ld a, -8 ld [wPlaceBallsDirection], a - ld hl, Sprite07 + ld hl, Sprite01 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH jp LoadTrainerHudOAM ; 2c059 @@ -203,7 +203,7 @@ LinkBattle_TrainerHuds: ; 2c10d ld a, 10 * 8 ld [hli], a ld [hl], 13 * 8 - ld hl, Sprite07 + ld hl, Sprite01 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH jp LoadTrainerHudOAM ; 2c143 -- cgit v1.2.3