From 5ac6cc48609f34f8d0d75093ecf6d9d056c0a92b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 7 Feb 2018 22:53:40 +0100 Subject: [PATCH] move battle vars to c file --- asm/party_menu.s | 4 +- asm/pokemon_item_effect.s | 4 +- include/battle.h | 40 ++-- include/battle_anim.h | 22 +- include/battle_gfx_sfx_util.h | 36 +-- include/battle_main.h | 10 +- include/constants/battle_ai.h | 4 +- include/constants/battle_anim.h | 2 +- src/battle_controller_player.c | 6 +- src/battle_controller_player_partner.c | 2 +- src/battle_controller_recorded_player.c | 2 +- src/battle_controller_safari.c | 4 +- src/battle_controller_wally.c | 4 +- src/battle_main.c | 123 ++++++++-- src/battle_script_commands.c | 226 +++++++++---------- src/battle_util.c | 114 +++++----- src/item_use.c | 4 +- src/pokemon_3.c | 14 +- src/reshow_battle_screen.c | 4 +- sym_ewram.txt | 283 +----------------------- 20 files changed, 360 insertions(+), 548 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index a70baf3df..991ad3623 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -16302,7 +16302,7 @@ _081B8BA8: movs r0, 0x1 strb r0, [r1] ldr r1, =gBattlerPartyIndexes - ldr r0, =gBankInMenu + ldr r0, =gBattlerInMenuId ldrb r0, [r0] lsls r0, 1 adds r0, r1 @@ -16334,7 +16334,7 @@ _081B8BFC: b _081B8C42 .pool _081B8C20: - ldr r0, =gBankInMenu + ldr r0, =gBattlerInMenuId ldrb r0, [r0] ldr r1, =gBattlerPartyIndexes lsls r0, 1 diff --git a/asm/pokemon_item_effect.s b/asm/pokemon_item_effect.s index be7d3be49..877a721b4 100644 --- a/asm/pokemon_item_effect.s +++ b/asm/pokemon_item_effect.s @@ -77,7 +77,7 @@ ExecuteTableBasedItemEffect: @ 806BD28 cmp r0, 0 beq _0806BDA8 ldr r2, =gEnigmaBerries - ldr r0, =gBankInMenu + ldr r0, =gBattlerInMenuId ldrb r1, [r0] lsls r0, r1, 3 subs r0, r1 @@ -101,7 +101,7 @@ _0806BDBC: _0806BDC4: str r0, [sp, 0x34] ldr r1, =gStringBattler - ldr r0, =gBankInMenu + ldr r0, =gBattlerInMenuId ldrb r2, [r0] strb r2, [r1] ldr r0, =gMain diff --git a/include/battle.h b/include/battle.h index 81c1d341d..85f21a4ff 100644 --- a/include/battle.h +++ b/include/battle.h @@ -476,8 +476,8 @@ struct ProtectStruct /* field_4 */ u32 physicalDmg; /* field_8 */ u32 specialDmg; - /* field_C */ u8 physicalBank; - /* field_D */ u8 specialBank; + /* field_C */ u8 physicalBattlerId; + /* field_D */ u8 specialBattlerId; /* field_E */ u16 fieldE; }; @@ -494,11 +494,11 @@ struct SpecialStatus u8 flag40 : 1; u8 focusBanded : 1; u8 field1[3]; - s32 moveturnLostHP; - s32 moveturnLostHP_physical; - s32 moveturnLostHP_special; - u8 moveturnPhysicalBank; - u8 moveturnSpecialBank; + s32 dmg; + s32 physicalDmg; + s32 specialDmg; + u8 physicalBattlerId; + u8 specialBattlerId; u8 field12; u8 field13; }; @@ -508,13 +508,13 @@ extern struct SpecialStatus gSpecialStatuses[MAX_BATTLERS_COUNT]; struct SideTimer { /*0x00*/ u8 reflectTimer; - /*0x01*/ u8 reflectBank; + /*0x01*/ u8 reflectBattlerId; /*0x02*/ u8 lightscreenTimer; - /*0x03*/ u8 lightscreenBank; + /*0x03*/ u8 lightscreenBattlerId; /*0x04*/ u8 mistTimer; - /*0x05*/ u8 mistBank; + /*0x05*/ u8 mistBattlerId; /*0x06*/ u8 safeguardTimer; - /*0x07*/ u8 safeguardBank; + /*0x07*/ u8 safeguardBattlerId; /*0x08*/ u8 followmeTimer; /*0x09*/ u8 followmeTarget; /*0x0A*/ u8 spikesAmount; @@ -530,7 +530,7 @@ struct WishFutureKnock s32 futureSightDmg[MAX_BATTLERS_COUNT]; u16 futureSightMove[MAX_BATTLERS_COUNT]; u8 wishCounter[MAX_BATTLERS_COUNT]; - u8 wishUserID[MAX_BATTLERS_COUNT]; + u8 wishMonId[MAX_BATTLERS_COUNT]; u8 weatherDuration; u8 knockedOffPokes[2]; }; @@ -625,7 +625,7 @@ struct BattleResults u16 playerMon2Species; // 0x26 u16 caughtMonSpecies; // 0x28 u8 caughtMonNick[10]; // 0x2A - u8 filler34[2]; + u8 filler34[2]; // 0x34 u8 catchAttempts[11]; // 0x36 }; @@ -634,12 +634,12 @@ extern struct BattleResults gBattleResults; struct BattleStruct { u8 turnEffectsTracker; - u8 turnEffectsBank; + u8 turnEffectsBattlerId; u8 filler2; - u8 turncountersTracker; + u8 turnCountersTracker; u8 wrappedMove[8]; // ask gamefreak why they declared it that way u8 moveTarget[4]; - u8 expGetterId; + u8 expGetterMonId; u8 field_11; u8 wildVictorySong; u8 dynamicMoveType; @@ -653,13 +653,13 @@ struct BattleStruct u8 field_45; u8 field_46; u8 field_47; - u8 focusPunchBank; + u8 focusPunchBattlerId; u8 field_49; u8 moneyMultiplier; u8 savedTurnActionNumber; u8 switchInAbilitiesCounter; u8 faintedActionsState; - u8 faintedActionsBank; + u8 faintedActionsBattlerId; u8 field_4F; u16 expValue; u8 field_52; @@ -687,7 +687,7 @@ struct BattleStruct u8 field_8C; u8 field_8D; u8 stringMoveType; - u8 expGetterBank; + u8 expGetterBattlerId; u8 field_90; u8 field_91; u8 field_92; @@ -732,7 +732,7 @@ struct BattleStruct u8 field_183; struct BattleEnigmaBerry battleEnigmaBerry; u8 wishPerishSongState; - u8 wishPerishSongBank; + u8 wishPerishSongBattlerId; bool8 overworldWeatherDone; u8 atkCancellerTracker; u8 field_1A4[96]; diff --git a/include/battle_anim.h b/include/battle_anim.h index cc864b024..aa62db46d 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -56,8 +56,8 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo void DestroyAnimSprite(struct Sprite *sprite); void DestroyAnimVisualTask(u8 taskId); void DestroyAnimSoundTask(u8 taskId); -bool8 IsBattlerSpriteVisible(u8 bank); -void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible); +bool8 IsBattlerSpriteVisible(u8 battlerId); +void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible); bool8 IsContest(void); s8 BattleAnimAdjustPanning(s8 pan); s8 BattleAnimAdjustPanning2(s8 pan); @@ -76,7 +76,7 @@ void sub_80A6F3C(struct Sprite *sprite); void sub_80A8278(void); void sub_80A6B30(struct UnknownAnimStruct2*); void sub_80A6B90(struct UnknownAnimStruct2*, u32 arg1); -u8 sub_80A82E4(u8 bank); +u8 sub_80A82E4(u8 battlerId); bool8 AnimateBallThrow(struct Sprite *sprite); enum @@ -85,26 +85,26 @@ enum BANK_Y_POS, }; -u8 GetBattlerSpriteCoord(u8 bank, u8 attributeId); +u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId); -bool8 IsBattlerSpritePresent(u8 bank); +bool8 IsBattlerSpritePresent(u8 battlerId); void sub_80A6C68(u8 arg0); -u8 GetAnimBattlerSpriteId(u8 wantedBank); +u8 GetAnimBattlerSpriteId(u8 wantedBattler); bool8 IsDoubleBattle(void); u8 sub_80A6D94(void); u8 sub_80A8364(u8); void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*)); void oamt_add_pos2_onto_pos1(struct Sprite *sprite); -u8 GetBattlerSpriteDefault_Y(u8 bank); -u8 sub_80A82E4(u8 bank); -u8 GetSubstituteSpriteDefault_Y(u8 bank); +u8 GetBattlerSpriteDefault_Y(u8 battlerId); +u8 sub_80A82E4(u8 battlerId); +u8 GetSubstituteSpriteDefault_Y(u8 battlerId); // battle_anim_80A9C70.s -void LaunchStatusAnimation(u8 bank, u8 statusAnimId); +void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId); // battle_anim_8170478.s u8 ItemIdToBallId(u16 itemId); u8 LaunchBallStarsTask(u8 x, u8 y, u8 kindOfStars, u8 arg3, u8 ballId); -u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 bank, u32 arg2, u8 ballId); +u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 arg2, u8 ballId); #endif // GUARD_BATTLE_ANIM_H diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h index 75bc3e003..e1c6325b6 100644 --- a/include/battle_gfx_sfx_util.h +++ b/include/battle_gfx_sfx_util.h @@ -8,41 +8,41 @@ void sub_805D714(struct Sprite *sprite); void sub_805D770(struct Sprite *sprite, bool8 arg1); void sub_805D7AC(struct Sprite *sprite); void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status); -bool8 TryHandleLaunchBattleTableAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId, u16 argument); -void InitAndLaunchSpecialAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId); +bool8 TryHandleLaunchBattleTableAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId, u16 argument); +void InitAndLaunchSpecialAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId); bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn); -bool8 mplay_80342A4(u8 bank); -void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank); -void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank); +bool8 mplay_80342A4(u8 battlerId); +void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId); +void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId); void nullsub_23(void); void nullsub_24(u16 species); -void DecompressTrainerFrontPic(u16 frontPicId, u8 bank); -void DecompressTrainerBackPic(u16 backPicId, u8 bank); +void DecompressTrainerFrontPic(u16 frontPicId, u8 battlerId); +void DecompressTrainerBackPic(u16 backPicId, u8 battlerId); void nullsub_25(u8 arg0); void FreeTrainerFrontPicPalette(u16 frontPicId); void sub_805DFFC(void); bool8 BattleLoadAllHealthBoxesGfx(u8 state); void LoadBattleBarGfx(u8 arg0); -bool8 BattleInitAllSprites(u8 *state1, u8 *bank); +bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId); void ClearSpritesHealthboxAnimData(void); void CopyAllBattleSpritesInvisibilities(void); -void CopyBattleSpriteInvisibility(u8 bank); -void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform); -void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite); -void LoadBattleMonGfxAndAnimate(u8 bank, bool8 loadMonSprite, u8 spriteId); -void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move); -void ClearBehindSubstituteBit(u8 bank); -void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank); +void CopyBattleSpriteInvisibility(u8 battlerId); +void HandleSpeciesGfxDataChange(u8 attacker, u8 target, bool8 notTransform); +void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite); +void LoadBattleMonGfxAndAnimate(u8 battlerId, bool8 loadMonSprite, u8 spriteId); +void TrySetBehindSubstituteSpriteBit(u8 battlerId, u16 move); +void ClearBehindSubstituteBit(u8 battlerId); +void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId); void BattleStopLowHpSound(void); u8 GetMonHPBarLevel(struct Pokemon *mon); void sub_805EAE8(void); void sub_805EB9C(u8 affineMode); void LoadAndCreateEnemyShadowSprites(void); void SpriteCB_SetInvisible(struct Sprite *sprite); -void SetBattlerShadowSpriteCallback(u8 bank, u16 species); -void HideBattlerShadowSprite(u8 bank); +void SetBattlerShadowSpriteCallback(u8 battlerId, u16 species); +void HideBattlerShadowSprite(u8 battlerId); void sub_805EF14(void); -void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute); +void ClearTemporarySpeciesSpriteData(u8 battlerId, bool8 dontClearSubstitute); void AllocateMonSpritesGfx(void); void FreeMonSpritesGfx(void); bool32 ShouldPlayNormalPokeCry(struct Pokemon *mon); diff --git a/include/battle_main.h b/include/battle_main.h index 54b5e7da6..d7a522f17 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -21,8 +21,8 @@ void sub_8039B58(struct Sprite *sprite); void sub_8039BB4(struct Sprite *sprite); void sub_80105DC(struct Sprite *sprite); void sub_8039C00(struct Sprite *sprite); -void dp11b_obj_instanciate(u8 bank, u8 b, s8 c, s8 d); -void dp11b_obj_free(u8 bank, bool8 b); +void dp11b_obj_instanciate(u8 battlerId, u8 b, s8 c, s8 d); +void dp11b_obj_free(u8 battlerId, bool8 b); void sub_8039E44(struct Sprite *sprite); void sub_8039E60(struct Sprite *sprite); void sub_8039E84(struct Sprite *sprite); @@ -35,12 +35,12 @@ void sub_803B3AC(void); // unused void sub_803B598(void); // unused void BattleTurnPassed(void); u8 IsRunningFromBattleImpossible(void); -void sub_803BDA0(u8 bank); +void sub_803BDA0(u8 battlerId); void SwapTurnOrder(u8 id1, u8 id2); -u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreChosenMoves); +u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves); void RunBattleScriptCommands_PopCallbacksStack(void); void RunBattleScriptCommands(void); -bool8 TryRunFromBattle(u8 bank); +bool8 TryRunFromBattle(u8 battlerId); extern const u8 gStatusConditionString_PoisonJpn[8]; extern const u8 gStatusConditionString_SleepJpn[8]; diff --git a/include/constants/battle_ai.h b/include/constants/battle_ai.h index 9d89d75f0..92eac11fa 100644 --- a/include/constants/battle_ai.h +++ b/include/constants/battle_ai.h @@ -1,7 +1,7 @@ #ifndef GUARD_BATTLE_AI_H #define GUARD_BATTLE_AI_H -// banks enum +// battlers #define AI_TARGET 0 #define AI_USER 1 #define AI_TARGET_PARTNER 2 @@ -22,7 +22,7 @@ #define AI_EFFECTIVENESS_x0_25 10 #define AI_EFFECTIVENESS_x0 0 -// ai weather enum +// ai weather #define AI_WEATHER_SUN 0 #define AI_WEATHER_RAIN 1 #define AI_WEATHER_SANDSTORM 2 diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index de2fbebb1..270ac55e0 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -1,7 +1,7 @@ #ifndef GUARD_CONSTANTS_BATTLE_ANIM_H #define GUARD_CONSTANTS_BATTLE_ANIM_H -// banks enum used in scripts +// battlers #define ANIM_ATTACKER 0 #define ANIM_TARGET 1 #define ANIM_ATK_PARTNER 2 diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 08af2e902..e62985b3b 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -58,7 +58,7 @@ extern u8 gNumberOfMovesToChoose; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; extern s32 gUnknown_0203CD70; -extern u8 gBankInMenu; +extern u8 gBattlerInMenuId; extern u32 gBattlePalaceMoveSelectionRngValue; extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT]; extern u8 gUnknown_020244B4[]; @@ -2677,7 +2677,7 @@ static void PlayerHandleChooseItem(void) BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); gBattlerControllerFuncs[gActiveBattler] = OpenBagAndChooseItem; - gBankInMenu = gActiveBattler; + gBattlerInMenuId = gActiveBattler; for (i = 0; i < 3; i++) gUnknown_0203CF00[i] = gBattleBufferA[gActiveBattler][1 + i]; @@ -2704,7 +2704,7 @@ static void PlayerHandleChoosePokemon(void) *(&gBattleStruct->field_B0) = gBattleBufferA[gActiveBattler][3]; BeginNormalPaletteFade(-1, 0, 0, 16, 0); gBattlerControllerFuncs[gActiveBattler] = sub_80597CC; - gBankInMenu = gActiveBattler; + gBattlerInMenuId = gActiveBattler; } } diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index b2b6baa0a..ac17a4938 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -41,7 +41,7 @@ extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; -extern u8 gBankInMenu; +extern u8 gBattlerInMenuId; extern u16 gUnknown_020243FC; extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 953f989e9..dca2a7022 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -42,7 +42,7 @@ extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; -extern u8 gBankInMenu; +extern u8 gBattlerInMenuId; extern u16 gUnknown_020243FC; extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 608d59418..6264d8324 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -40,7 +40,7 @@ extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; -extern u8 gBankInMenu; +extern u8 gBattlerInMenuId; extern u16 gUnknown_020243FC; extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; @@ -500,7 +500,7 @@ static void SafariHandleChooseItem(void) BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); gBattlerControllerFuncs[gActiveBattler] = SafariOpenPokeblockCase; - gBankInMenu = gActiveBattler; + gBattlerInMenuId = gActiveBattler; } static void SafariHandleChoosePokemon(void) diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index dd01e5996..f85c6792a 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -54,7 +54,7 @@ extern u8 gNumberOfMovesToChoose; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; extern s32 gUnknown_0203CD70; -extern u8 gBankInMenu; +extern u8 gBattlerInMenuId; extern u32 gBattlePalaceMoveSelectionRngValue; extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT]; extern u8 gUnknown_020244B4[]; @@ -1282,7 +1282,7 @@ static void WallyHandleChooseItem(void) { BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); gBattlerControllerFuncs[gActiveBattler] = OpenBagAfterPaletteFade; - gBankInMenu = gActiveBattler; + gBattlerInMenuId = gActiveBattler; } static void WallyHandleChoosePokemon(void) diff --git a/src/battle_main.c b/src/battle_main.c index 3704ff3b4..25d959ff3 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -81,8 +81,6 @@ extern struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT]; extern void (*gPreBattleCallback1)(void); extern void (*gBattleMainFunc)(void); extern void (*gCB2_AfterEvolution)(void); -extern struct UnknownPokemonStruct2 gUnknown_02022FF8[3]; // what is it used for? -extern struct UnknownPokemonStruct2* gUnknown_02023058; // what is it used for? extern struct MusicPlayerInfo gMPlayInfo_SE1; extern struct MusicPlayerInfo gMPlayInfo_SE2; extern u8 gDecompressionBuffer[]; @@ -92,7 +90,6 @@ extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; extern u8 gStringBattler; -extern u32 gUnknown_02022F88; extern u32 gHitMarker; extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; @@ -261,6 +258,102 @@ static void HandleAction_Action11(void); static void HandleAction_NothingIsFainted(void); static void HandleAction_ActionFinished(void); +// EWRAM vars +EWRAM_DATA u32 gUnknown_02022F88[25] = {0}; +EWRAM_DATA u32 gBattleTypeFlags = 0; +EWRAM_DATA u8 gBattleTerrain = 0; +EWRAM_DATA u32 gUnknown_02022FF4 = 0; +EWRAM_DATA struct UnknownPokemonStruct2 gUnknown_02022FF8[3] = {0}; // what is it used for? +EWRAM_DATA struct UnknownPokemonStruct2* gUnknown_02023058 = NULL; // what is it used for? +EWRAM_DATA u8 *gUnknown_0202305C = NULL; +EWRAM_DATA u8 *gUnknown_02023060 = NULL; +EWRAM_DATA u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200] = {0}; +EWRAM_DATA u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200] = {0}; +EWRAM_DATA u8 gActiveBattler = 0; +EWRAM_DATA u32 gBattleControllerExecFlags = 0; +EWRAM_DATA u8 gBattlersCount = 0; +EWRAM_DATA u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gBattlerPositions[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gActionsByTurnOrder[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gBattleTurnOrder[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gCurrentTurnActionNumber = 0; +EWRAM_DATA u8 gCurrentActionFuncId = 0; +EWRAM_DATA struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gCurrMovePos = 0; +EWRAM_DATA u8 gUnknown_020241E9 = 0; +EWRAM_DATA u16 gCurrentMove = 0; +EWRAM_DATA u16 gChosenMove = 0; +EWRAM_DATA u16 gRandomMove = 0; +EWRAM_DATA s32 gBattleMoveDamage = 0; +EWRAM_DATA s32 gHpDealt = 0; +EWRAM_DATA s32 gTakenDmg[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u16 gLastUsedItem = 0; +EWRAM_DATA u8 gLastUsedAbility = 0; +EWRAM_DATA u8 gBattlerAttacker = 0; +EWRAM_DATA u8 gBattlerTarget = 0; +EWRAM_DATA u8 gBank1 = 0; +EWRAM_DATA u8 gEffectBank = 0; +EWRAM_DATA u8 gStringBattler = 0; +EWRAM_DATA u8 gAbsentBattlerFlags = 0; +EWRAM_DATA u8 gCritMultiplier = 0; +EWRAM_DATA u8 gMultiHitCounter = 0; +EWRAM_DATA const u8 *gBattlescriptCurrInstr = NULL; +EWRAM_DATA u32 gUnusedBattleMainVar = 0; +EWRAM_DATA u8 gChosenActionByBattler[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA const u8 *gSelectionBattleScripts[MAX_BATTLERS_COUNT] = {NULL}; +EWRAM_DATA const u8 *gPalaceSelectionBattleScripts[MAX_BATTLERS_COUNT] = {NULL}; +EWRAM_DATA u16 gLastPrintedMoves[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u16 gLastMoves[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u16 gLastLandedMoves[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u16 gLastHitByType[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u16 gLastResultingMoves[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u16 gLockedMoves[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gLastHitBy[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gMoveResultFlags = 0; +EWRAM_DATA u32 gHitMarker = 0; +EWRAM_DATA u8 gUnknown_02024284[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gUnknown_0202428C = 0; +EWRAM_DATA u16 gSideStatuses[2] = {0}; +EWRAM_DATA struct SideTimer gSideTimers[2] = {0}; +EWRAM_DATA u32 gStatuses3[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u16 gPauseCounterBattle = 0; +EWRAM_DATA u16 gPaydayMoney = 0; +EWRAM_DATA u16 gRandomTurnNumber = 0; +EWRAM_DATA u8 gBattleCommunication[BATTLE_COMMUNICATION_ENTRIES_COUNT] = {0}; +EWRAM_DATA u8 gBattleOutcome = 0; +EWRAM_DATA struct ProtectStruct gProtectStructs[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA struct SpecialStatus gSpecialStatuses[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u16 gBattleWeather = 0; +EWRAM_DATA struct WishFutureKnock gWishFutureKnock = {0}; +EWRAM_DATA u16 gUnknown_020243FC = 0; +EWRAM_DATA u8 gSentPokesToOpponent[2] = {0}; +EWRAM_DATA u16 gDynamicBasePower = 0; +EWRAM_DATA u16 gExpShareExp = 0; +EWRAM_DATA struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA struct BattleScripting gBattleScripting = {0}; +EWRAM_DATA struct BattleStruct *gBattleStruct = NULL; +EWRAM_DATA u8 *gLinkBattleSendBuffer = NULL; +EWRAM_DATA u8 *gLinkBattleRecvBuffer = NULL; +EWRAM_DATA struct BattleResources *gBattleResources = NULL; +EWRAM_DATA u8 gActionSelectionCursor[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gUnknown_020244B4[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gBattlerInMenuId = 0; +EWRAM_DATA bool8 gDoingBattleAnim = FALSE; +EWRAM_DATA u32 gTransformedPersonalities[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA u8 gPlayerDpadHoldFrames = 0; +EWRAM_DATA struct BattleSpriteData *gBattleSpritesDataPtr = NULL; +EWRAM_DATA struct MonSpritesGfx *gMonSpritesGfxPtr = NULL; +EWRAM_DATA u8 *gUnknown_020244D8 = NULL; +EWRAM_DATA u8 *gUnknown_020244DC = NULL; +EWRAM_DATA u16 gBattleMovePower = 0; +EWRAM_DATA u16 gMoveToLearn = 0; +EWRAM_DATA u8 gBattleMonForms[MAX_BATTLERS_COUNT] = {0}; + // rom const data static void (* const sTurnActionsFuncsTable[])(void) = { @@ -2437,7 +2530,7 @@ static void sub_80398D0(struct Sprite *sprite) { sprite->invisible = FALSE; sprite->callback = SpriteCallbackDummy_2; - gUnknown_02022F88 = 0; + gUnknown_02022F88[0] = 0; } } } @@ -3656,12 +3749,12 @@ static void TryDoEventsBeforeFirstTurn(void) gBattleMons[i].status2 &= ~(STATUS2_FLINCHED); *(&gBattleStruct->turnEffectsTracker) = 0; - *(&gBattleStruct->turnEffectsBank) = 0; + *(&gBattleStruct->turnEffectsBattlerId) = 0; *(&gBattleStruct->wishPerishSongState) = 0; - *(&gBattleStruct->wishPerishSongBank) = 0; + *(&gBattleStruct->wishPerishSongBattlerId) = 0; gBattleScripting.atk49_state = 0; gBattleStruct->faintedActionsState = 0; - gBattleStruct->turncountersTracker = 0; + gBattleStruct->turnCountersTracker = 0; gMoveResultFlags = 0; gRandomTurnNumber = Random(); @@ -3689,10 +3782,10 @@ static void HandleEndTurn_ContinueBattle(void) CancelMultiTurnMoves(i); } gBattleStruct->turnEffectsTracker = 0; - gBattleStruct->turnEffectsBank = 0; + gBattleStruct->turnEffectsBattlerId = 0; gBattleStruct->wishPerishSongState = 0; - gBattleStruct->wishPerishSongBank = 0; - gBattleStruct->turncountersTracker = 0; + gBattleStruct->wishPerishSongBattlerId = 0; + gBattleStruct->turnCountersTracker = 0; gMoveResultFlags = 0; } } @@ -4556,7 +4649,7 @@ static void SetActionsAndBanksTurnOrder(void) } } gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts; - gBattleStruct->focusPunchBank = 0; + gBattleStruct->focusPunchBattlerId = 0; return; } else @@ -4598,7 +4691,7 @@ static void SetActionsAndBanksTurnOrder(void) } } gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts; - gBattleStruct->focusPunchBank = 0; + gBattleStruct->focusPunchBattlerId = 0; } static void TurnValuesCleanUp(bool8 var0) @@ -4654,10 +4747,10 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) { if (!(gHitMarker & HITMARKER_RUN)) { - while (gBattleStruct->focusPunchBank < gBattlersCount) + while (gBattleStruct->focusPunchBattlerId < gBattlersCount) { - gActiveBattler = gBattlerAttacker = gBattleStruct->focusPunchBank; - gBattleStruct->focusPunchBank++; + gActiveBattler = gBattlerAttacker = gBattleStruct->focusPunchBattlerId; + gBattleStruct->focusPunchBattlerId++; if (gChosenMoveByBattler[gActiveBattler] == MOVE_FOCUS_PUNCH && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) && !(gDisableStructs[gBattlerAttacker].truantCounter) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c6314082c..f4926ba20 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -79,7 +79,7 @@ extern u16 gLastUsedItem; extern u16 gBattleMovePower; extern s32 gHpDealt; extern s32 gTakenDmg[MAX_BATTLERS_COUNT]; -extern u8 gTakenDmgBanks[MAX_BATTLERS_COUNT]; +extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT]; extern u8 gSentPokesToOpponent[2]; extern u8 gBank1; extern u16 gExpShareExp; @@ -88,7 +88,7 @@ extern void (*gBattleMainFunc)(void); extern u8 gPlayerPartyCount; extern u16 gMoveToLearn; extern u16 gRandomMove; -extern u8 gBankInMenu; +extern u8 gBattlerInMenuId; extern u8 gChosenActionByBattler[MAX_BATTLERS_COUNT]; extern u8 gCurrentTurnActionNumber; extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; @@ -157,8 +157,8 @@ extern const u8 gText_BattleYesNoChoice[]; #define DEFENDER_IS_PROTECTED ((gProtectStructs[gBattlerTarget].protected) && (gBattleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED)) -#define TARGET_TURN_DAMAGED (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical != 0 \ - || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special != 0) +#define TARGET_TURN_DAMAGED (gSpecialStatuses[gBattlerTarget].physicalDmg != 0 \ + || gSpecialStatuses[gBattlerTarget].specialDmg != 0) // this file's functions static bool8 IsTwoTurnsMove(u16 move); @@ -1969,15 +1969,15 @@ static void atk0C_datahpupdate(void) { if (gDisableStructs[gActiveBattler].substituteHP >= gBattleMoveDamage) { - if (gSpecialStatuses[gActiveBattler].moveturnLostHP == 0) - gSpecialStatuses[gActiveBattler].moveturnLostHP = gBattleMoveDamage; + if (gSpecialStatuses[gActiveBattler].dmg == 0) + gSpecialStatuses[gActiveBattler].dmg = gBattleMoveDamage; gDisableStructs[gActiveBattler].substituteHP -= gBattleMoveDamage; gHpDealt = gBattleMoveDamage; } else { - if (gSpecialStatuses[gActiveBattler].moveturnLostHP == 0) - gSpecialStatuses[gActiveBattler].moveturnLostHP = gDisableStructs[gActiveBattler].substituteHP; + if (gSpecialStatuses[gActiveBattler].dmg == 0) + gSpecialStatuses[gActiveBattler].dmg = gDisableStructs[gActiveBattler].substituteHP; gHpDealt = gDisableStructs[gActiveBattler].substituteHP; gDisableStructs[gActiveBattler].substituteHP = 0; } @@ -2010,9 +2010,9 @@ static void atk0C_datahpupdate(void) { gTakenDmg[gActiveBattler] += gBattleMoveDamage; if (gBattlescriptCurrInstr[1] == BS_GET_TARGET) - gTakenDmgBanks[gActiveBattler] = gBattlerAttacker; + gTakenDmgByBattler[gActiveBattler] = gBattlerAttacker; else - gTakenDmgBanks[gActiveBattler] = gBattlerTarget; + gTakenDmgByBattler[gActiveBattler] = gBattlerTarget; } if (gBattleMons[gActiveBattler].hp > gBattleMoveDamage) @@ -2026,37 +2026,37 @@ static void atk0C_datahpupdate(void) gBattleMons[gActiveBattler].hp = 0; } - if (!gSpecialStatuses[gActiveBattler].moveturnLostHP && !(gHitMarker & HITMARKER_x100000)) - gSpecialStatuses[gActiveBattler].moveturnLostHP = gHpDealt; + if (!gSpecialStatuses[gActiveBattler].dmg && !(gHitMarker & HITMARKER_x100000)) + gSpecialStatuses[gActiveBattler].dmg = gHpDealt; if (moveType <= 8 && !(gHitMarker & HITMARKER_x100000) && gCurrentMove != MOVE_PAIN_SPLIT) { gProtectStructs[gActiveBattler].physicalDmg = gHpDealt; - gSpecialStatuses[gActiveBattler].moveturnLostHP_physical = gHpDealt; + gSpecialStatuses[gActiveBattler].physicalDmg = gHpDealt; if (gBattlescriptCurrInstr[1] == BS_GET_TARGET) { - gProtectStructs[gActiveBattler].physicalBank = gBattlerAttacker; - gSpecialStatuses[gActiveBattler].moveturnPhysicalBank = gBattlerAttacker; + gProtectStructs[gActiveBattler].physicalBattlerId = gBattlerAttacker; + gSpecialStatuses[gActiveBattler].physicalBattlerId = gBattlerAttacker; } else { - gProtectStructs[gActiveBattler].physicalBank = gBattlerTarget; - gSpecialStatuses[gActiveBattler].moveturnPhysicalBank = gBattlerTarget; + gProtectStructs[gActiveBattler].physicalBattlerId = gBattlerTarget; + gSpecialStatuses[gActiveBattler].physicalBattlerId = gBattlerTarget; } } else if (moveType > 8 && !(gHitMarker & HITMARKER_x100000)) { gProtectStructs[gActiveBattler].specialDmg = gHpDealt; - gSpecialStatuses[gActiveBattler].moveturnLostHP_special = gHpDealt; + gSpecialStatuses[gActiveBattler].specialDmg = gHpDealt; if (gBattlescriptCurrInstr[1] == BS_GET_TARGET) { - gProtectStructs[gActiveBattler].specialBank = gBattlerAttacker; - gSpecialStatuses[gActiveBattler].moveturnSpecialBank = gBattlerAttacker; + gProtectStructs[gActiveBattler].specialBattlerId = gBattlerAttacker; + gSpecialStatuses[gActiveBattler].specialBattlerId = gBattlerAttacker; } else { - gProtectStructs[gActiveBattler].specialBank = gBattlerTarget; - gSpecialStatuses[gActiveBattler].moveturnSpecialBank = gBattlerTarget; + gProtectStructs[gActiveBattler].specialBattlerId = gBattlerTarget; + gSpecialStatuses[gActiveBattler].specialBattlerId = gBattlerTarget; } } } @@ -2068,8 +2068,8 @@ static void atk0C_datahpupdate(void) else { gActiveBattler = GetBattleBank(gBattlescriptCurrInstr[1]); - if (gSpecialStatuses[gActiveBattler].moveturnLostHP == 0) - gSpecialStatuses[gActiveBattler].moveturnLostHP = 0xFFFF; + if (gSpecialStatuses[gActiveBattler].dmg == 0) + gSpecialStatuses[gActiveBattler].dmg = 0xFFFF; } gBattlescriptCurrInstr += 2; } @@ -3424,14 +3424,14 @@ static void atk23_getexp(void) } gBattleScripting.atk23_state++; - gBattleStruct->expGetterId = 0; + gBattleStruct->expGetterMonId = 0; gBattleStruct->sentInPokes = sentIn; } // fall through case 2: // set exp value to the poke in expgetter_id and print message if (gBattleControllerExecFlags == 0) { - item = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HELD_ITEM); + item = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HELD_ITEM); if (item == ITEM_ENIGMA_BERRY) holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; @@ -3444,7 +3444,7 @@ static void atk23_getexp(void) gBattleScripting.atk23_state = 5; gBattleMoveDamage = 0; // used for exp } - else if (GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL) == MAX_MON_LEVEL) + else if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) == MAX_MON_LEVEL) { *(&gBattleStruct->sentInPokes) >>= 1; gBattleScripting.atk23_state = 5; @@ -3460,7 +3460,7 @@ static void atk23_getexp(void) gBattleStruct->wildVictorySong++; } - if (GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP)) + if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP)) { if (gBattleStruct->sentInPokes & 1) gBattleMoveDamage = *exp; @@ -3474,10 +3474,10 @@ static void atk23_getexp(void) if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; - if (IsTradedMon(&gPlayerParty[gBattleStruct->expGetterId])) + if (IsTradedMon(&gPlayerParty[gBattleStruct->expGetterMonId])) { // check if the pokemon doesn't belong to the player - if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gBattleStruct->expGetterId >= 3) + if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gBattleStruct->expGetterMonId >= 3) { i = 0x149; } @@ -3495,28 +3495,28 @@ static void atk23_getexp(void) // get exp getter bank if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - if (!(gBattlerPartyIndexes[2] != gBattleStruct->expGetterId) && !(gAbsentBattlerFlags & gBitTable[2])) - gBattleStruct->expGetterBank = 2; + if (!(gBattlerPartyIndexes[2] != gBattleStruct->expGetterMonId) && !(gAbsentBattlerFlags & gBitTable[2])) + gBattleStruct->expGetterBattlerId = 2; else { if (!(gAbsentBattlerFlags & gBitTable[0])) - gBattleStruct->expGetterBank = 0; + gBattleStruct->expGetterBattlerId = 0; else - gBattleStruct->expGetterBank = 2; + gBattleStruct->expGetterBattlerId = 2; } } else - gBattleStruct->expGetterBank = 0; + gBattleStruct->expGetterBattlerId = 0; - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleStruct->expGetterBank, gBattleStruct->expGetterId) + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattleStruct->expGetterBattlerId, gBattleStruct->expGetterMonId) // buffer 'gained' or 'gained a boosted' PREPARE_STRING_BUFFER(gBattleTextBuff2, i) PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 5, gBattleMoveDamage) - PrepareStringBattle(STRINGID_PKMNGAINEDEXP, gBattleStruct->expGetterBank); - MonGainEVs(&gPlayerParty[gBattleStruct->expGetterId], gBattleMons[gBank1].species); + PrepareStringBattle(STRINGID_PKMNGAINEDEXP, gBattleStruct->expGetterBattlerId); + MonGainEVs(&gPlayerParty[gBattleStruct->expGetterMonId], gBattleMons[gBank1].species); } gBattleStruct->sentInPokes >>= 1; gBattleScripting.atk23_state++; @@ -3526,18 +3526,18 @@ static void atk23_getexp(void) case 3: // Set stats and give exp if (gBattleControllerExecFlags == 0) { - gBattleBufferB[gBattleStruct->expGetterBank][0] = 0; - if (GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP) && GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL) != MAX_MON_LEVEL) + gBattleBufferB[gBattleStruct->expGetterBattlerId][0] = 0; + if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP) && GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) != MAX_MON_LEVEL) { - gBattleResources->statsBeforeLvlUp->hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_MAX_HP); - gBattleResources->statsBeforeLvlUp->atk = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_ATK); - gBattleResources->statsBeforeLvlUp->def = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_DEF); - gBattleResources->statsBeforeLvlUp->spd = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPEED); - gBattleResources->statsBeforeLvlUp->spAtk = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPATK); - gBattleResources->statsBeforeLvlUp->spDef = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPDEF); + gBattleResources->statsBeforeLvlUp->hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP); + gBattleResources->statsBeforeLvlUp->atk = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK); + gBattleResources->statsBeforeLvlUp->def = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF); + gBattleResources->statsBeforeLvlUp->spd = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED); + gBattleResources->statsBeforeLvlUp->spAtk = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK); + gBattleResources->statsBeforeLvlUp->spDef = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPDEF); - gActiveBattler = gBattleStruct->expGetterBank; - BtlController_EmitExpUpdate(0, gBattleStruct->expGetterId, gBattleMoveDamage); + gActiveBattler = gBattleStruct->expGetterBattlerId; + BtlController_EmitExpUpdate(0, gBattleStruct->expGetterMonId, gBattleMoveDamage); MarkBattlerForControllerExec(gActiveBattler); } gBattleScripting.atk23_state++; @@ -3546,50 +3546,50 @@ static void atk23_getexp(void) case 4: // lvl up if necessary if (gBattleControllerExecFlags == 0) { - gActiveBattler = gBattleStruct->expGetterBank; + gActiveBattler = gBattleStruct->expGetterBattlerId; if (gBattleBufferB[gActiveBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBattler][1] == RET_VALUE_LEVELLED_UP) { - if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterId) + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId) HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattleStruct->expGetterId) + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattleStruct->expGetterMonId) - PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL)) + PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff2, 3, GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL)) BattleScriptPushCursor(); - gLeveledUpInBattle |= gBitTable[gBattleStruct->expGetterId]; + gLeveledUpInBattle |= gBitTable[gBattleStruct->expGetterMonId]; gBattlescriptCurrInstr = BattleScript_LevelUp; gBattleMoveDamage = (gBattleBufferB[gActiveBattler][2] | (gBattleBufferB[gActiveBattler][3] << 8)); - AdjustFriendship(&gPlayerParty[gBattleStruct->expGetterId], 0); + AdjustFriendship(&gPlayerParty[gBattleStruct->expGetterMonId], 0); // update battle mon structure after level up - if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId && gBattleMons[0].hp) + if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId && gBattleMons[0].hp) { - gBattleMons[0].level = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL); - gBattleMons[0].hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP); - gBattleMons[0].maxHP = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_MAX_HP); - gBattleMons[0].attack = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_ATK); - gBattleMons[0].defense = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_DEF); + gBattleMons[0].level = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL); + gBattleMons[0].hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP); + gBattleMons[0].maxHP = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP); + gBattleMons[0].attack = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK); + gBattleMons[0].defense = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF); // Why is this duplicated? - gBattleMons[0].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPEED); - gBattleMons[0].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPEED); + gBattleMons[0].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED); + gBattleMons[0].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED); - gBattleMons[0].spAttack = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPATK); - gBattleMons[0].spDefense = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPDEF); + gBattleMons[0].spAttack = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK); + gBattleMons[0].spDefense = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPDEF); } // What is else if? - if (gBattlerPartyIndexes[2] == gBattleStruct->expGetterId && gBattleMons[2].hp && (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) + if (gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId && gBattleMons[2].hp && (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { - gBattleMons[2].level = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL); - gBattleMons[2].hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_HP); - gBattleMons[2].maxHP = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_MAX_HP); - gBattleMons[2].attack = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_ATK); - gBattleMons[2].defense = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_DEF); + gBattleMons[2].level = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL); + gBattleMons[2].hp = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP); + gBattleMons[2].maxHP = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MAX_HP); + gBattleMons[2].attack = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_ATK); + gBattleMons[2].defense = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_DEF); // Duplicated again, but this time there's no Sp Defense - gBattleMons[2].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPEED); - gBattleMons[2].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPEED); + gBattleMons[2].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED); + gBattleMons[2].speed = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPEED); - gBattleMons[2].spAttack = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPATK); + gBattleMons[2].spAttack = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPATK); } gBattleScripting.atk23_state = 5; } @@ -3605,8 +3605,8 @@ static void atk23_getexp(void) gBattleScripting.atk23_state = 3; else { - gBattleStruct->expGetterId++; - if (gBattleStruct->expGetterId <= 5) + gBattleStruct->expGetterMonId++; + if (gBattleStruct->expGetterMonId <= 5) gBattleScripting.atk23_state = 2; // loop again else gBattleScripting.atk23_state = 6; // we're done @@ -4894,7 +4894,7 @@ static void atk49_moveend(void) case 1: // defrosting check if (gBattleMons[gBattlerTarget].status1 & STATUS1_FREEZE && gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget - && gSpecialStatuses[gBattlerTarget].moveturnLostHP_special + && gSpecialStatuses[gBattlerTarget].specialDmg && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && moveType == TYPE_FIRE) { gBattleMons[gBattlerTarget].status1 &= ~(STATUS1_FREEZE); @@ -5991,9 +5991,9 @@ static void atk59_handlelearnnewmove(void) const u8 *jumpPtr1 = BSScriptReadPtr(gBattlescriptCurrInstr + 1); const u8 *jumpPtr2 = BSScriptReadPtr(gBattlescriptCurrInstr + 5); - u16 ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterId], gBattlescriptCurrInstr[9]); + u16 ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], gBattlescriptCurrInstr[9]); while (ret == 0xFFFE) - ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterId], 0); + ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], 0); if (ret == 0) { @@ -6007,7 +6007,7 @@ static void atk59_handlelearnnewmove(void) { gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterId + if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId && !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) { GiveMoveToBattleMon(&gBattleMons[gActiveBattler], ret); @@ -6015,7 +6015,7 @@ static void atk59_handlelearnnewmove(void) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); - if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterId + if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId && !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED)) { GiveMoveToBattleMon(&gBattleMons[gActiveBattler], ret); @@ -6078,7 +6078,7 @@ static void atk5A_yesnoboxlearnmove(void) if (!gPaletteFade.active) { FreeAllWindowBuffers(); - sub_81BFA38(gPlayerParty, gBattleStruct->expGetterId, gPlayerPartyCount - 1, ReshowBattleScreenAfterMenu, gMoveToLearn); + sub_81BFA38(gPlayerParty, gBattleStruct->expGetterMonId, gPlayerPartyCount - 1, ReshowBattleScreenAfterMenu, gMoveToLearn); gBattleScripting.learnMoveState++; } break; @@ -6098,7 +6098,7 @@ static void atk5A_yesnoboxlearnmove(void) } else { - u16 moveId = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_MOVE1 + movePosition); + u16 moveId = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_MOVE1 + movePosition); if (IsHMMove2(moveId)) { PrepareStringBattle(STRINGID_HMMOVESCANTBEFORGOTTEN, gActiveBattler); @@ -6110,10 +6110,10 @@ static void atk5A_yesnoboxlearnmove(void) PREPARE_MOVE_BUFFER(gBattleTextBuff2, moveId) - RemoveMonPPBonus(&gPlayerParty[gBattleStruct->expGetterId], movePosition); - SetMonMoveSlot(&gPlayerParty[gBattleStruct->expGetterId], gMoveToLearn, movePosition); + RemoveMonPPBonus(&gPlayerParty[gBattleStruct->expGetterMonId], movePosition); + SetMonMoveSlot(&gPlayerParty[gBattleStruct->expGetterMonId], gMoveToLearn, movePosition); - if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId + if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId && !(gBattleMons[0].status2 & STATUS2_TRANSFORMED) && !(gDisableStructs[0].unk18_b & gBitTable[movePosition])) { @@ -6121,7 +6121,7 @@ static void atk5A_yesnoboxlearnmove(void) SetBattleMonMoveSlot(&gBattleMons[0], gMoveToLearn, movePosition); } if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE - && gBattlerPartyIndexes[2] == gBattleStruct->expGetterId + && gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId && !(gBattleMons[2].status2 & STATUS2_TRANSFORMED) && !(gDisableStructs[2].unk18_b & gBitTable[movePosition])) { @@ -6659,7 +6659,7 @@ static void sub_804F100(void) { struct StatsArray currentStats; - sub_81D388C(&gPlayerParty[gBattleStruct->expGetterId], ¤tStats); + sub_81D388C(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); sub_81D3640(0xD, gBattleResources->statsBeforeLvlUp, ¤tStats, 0xE, 0xD, 0xF); } @@ -6667,7 +6667,7 @@ static void sub_804F144(void) { struct StatsArray currentStats; - sub_81D388C(&gPlayerParty[gBattleStruct->expGetterId], ¤tStats); + sub_81D388C(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); sub_81D3784(0xD, ¤tStats, 0xE, 0xD, 0xF); } @@ -6710,9 +6710,9 @@ static void PutLevelAndGenderOnLvlUpBox(void) u8 *txtPtr; u32 var; - monLevel = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_LEVEL); - monGender = GetMonGender(&gPlayerParty[gBattleStruct->expGetterId]); - GetMonNickname(&gPlayerParty[gBattleStruct->expGetterId], gStringVar4); + monLevel = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL); + monGender = GetMonGender(&gPlayerParty[gBattleStruct->expGetterMonId]); + GetMonNickname(&gPlayerParty[gBattleStruct->expGetterMonId], gStringVar4); subPrinter.current_text_offset = gStringVar4; subPrinter.windowId = 14; @@ -6788,8 +6788,8 @@ static void PutMonIconOnLvlUpBox(void) struct SpriteSheet iconSheet; struct SpritePalette iconPalSheet; - u16 species = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_SPECIES); - u32 personality = GetMonData(&gPlayerParty[gBattleStruct->expGetterId], MON_DATA_PERSONALITY); + u16 species = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPECIES); + u32 personality = GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_PERSONALITY); const u8* iconPtr = GetMonIconPtr(species, personality, 1); iconSheet.data = iconPtr; @@ -6829,9 +6829,9 @@ static void SpriteCB_MonIconOnLvlUpBox(struct Sprite* sprite) static bool32 IsMonGettingExpSentOut(void) { - if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId) + if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId) return TRUE; - if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && gBattlerPartyIndexes[2] == gBattleStruct->expGetterId) + if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId) return TRUE; return FALSE; @@ -6939,7 +6939,7 @@ static void atk74_hpthresholds2(void) static void atk75_useitemonopponent(void) { - gBankInMenu = gBattlerAttacker; + gBattlerInMenuId = gBattlerAttacker; ExecuteTableBasedItemEffect(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]], gLastUsedItem, gBattlerPartyIndexes[gBattlerAttacker], 0, 1); gBattlescriptCurrInstr += 1; @@ -6982,11 +6982,11 @@ static void atk76_various(void) gSpecialStatuses[gActiveBattler].traced = 0; break; case VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP: - if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId || gBattlerPartyIndexes[2] == gBattleStruct->expGetterId) + if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId || gBattlerPartyIndexes[2] == gBattleStruct->expGetterMonId) { u16 *choicedMove; - if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterId) + if (gBattlerPartyIndexes[0] == gBattleStruct->expGetterMonId) gActiveBattler = 0; else gActiveBattler = 2; @@ -7327,7 +7327,7 @@ static void atk7E_setreflect(void) { gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_REFLECT; gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBank = gBattlerAttacker; + gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].reflectBattlerId = gBattlerAttacker; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) gBattleCommunication[MULTISTRING_CHOOSER] = 2; @@ -8061,7 +8061,7 @@ static void atk92_setlightscreen(void) { gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_LIGHTSCREEN; gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenBank = gBattlerAttacker; + gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].lightscreenBattlerId = gBattlerAttacker; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && CountAliveMonsInBattle(BATTLE_ALIVE_ATK_SIDE) == 2) gBattleCommunication[MULTISTRING_CHOOSER] = 4; @@ -8324,7 +8324,7 @@ static void atk99_setmist(void) else { gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistBank = gBattlerAttacker; + gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].mistBattlerId = gBattlerAttacker; gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_MIST; gBattleCommunication[MULTISTRING_CHOOSER] = 0; } @@ -8520,18 +8520,18 @@ static void atkA0_psywavedamageeffect(void) static void atkA1_counterdamagecalculator(void) { u8 sideAttacker = GetBattlerSide(gBattlerAttacker); - u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].physicalBank); + u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].physicalBattlerId); if (gProtectStructs[gBattlerAttacker].physicalDmg && sideAttacker != sideTarget - && gBattleMons[gProtectStructs[gBattlerAttacker].physicalBank].hp) + && gBattleMons[gProtectStructs[gBattlerAttacker].physicalBattlerId].hp) { gBattleMoveDamage = gProtectStructs[gBattlerAttacker].physicalDmg * 2; if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp) gBattlerTarget = gSideTimers[sideTarget].followmeTarget; else - gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBank; + gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBattlerId; gBattlescriptCurrInstr += 5; } @@ -8545,16 +8545,16 @@ static void atkA1_counterdamagecalculator(void) static void atkA2_mirrorcoatdamagecalculator(void) // a copy of atkA1 with the physical -> special field changes { u8 sideAttacker = GetBattlerSide(gBattlerAttacker); - u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].specialBank); + u8 sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].specialBattlerId); - if (gProtectStructs[gBattlerAttacker].specialDmg && sideAttacker != sideTarget && gBattleMons[gProtectStructs[gBattlerAttacker].specialBank].hp) + if (gProtectStructs[gBattlerAttacker].specialDmg && sideAttacker != sideTarget && gBattleMons[gProtectStructs[gBattlerAttacker].specialBattlerId].hp) { gBattleMoveDamage = gProtectStructs[gBattlerAttacker].specialDmg * 2; if (gSideTimers[sideTarget].followmeTimer && gBattleMons[gSideTimers[sideTarget].followmeTarget].hp) gBattlerTarget = gSideTimers[sideTarget].followmeTarget; else - gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBank; + gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBattlerId; gBattlescriptCurrInstr += 5; } @@ -8636,7 +8636,7 @@ static void atkA5_painsplitdmgcalc(void) storeLoc[3] = (painSplitHp & 0xFF000000) >> 24; gBattleMoveDamage = gBattleMons[gBattlerAttacker].hp - hpDiff; - gSpecialStatuses[gBattlerTarget].moveturnLostHP = 0xFFFF; + gSpecialStatuses[gBattlerTarget].dmg = 0xFFFF; gBattlescriptCurrInstr += 5; } @@ -9224,7 +9224,7 @@ static void atkB8_setsafeguard(void) { gSideStatuses[GET_BATTLER_SIDE(gBattlerAttacker)] |= SIDE_STATUS_SAFEGUARD; gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardTimer = 5; - gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardBank = gBattlerAttacker; + gSideTimers[GET_BATTLER_SIDE(gBattlerAttacker)].safeguardBattlerId = gBattlerAttacker; gBattleCommunication[MULTISTRING_CHOOSER] = 5; } @@ -9995,7 +9995,7 @@ static void atkD4_trywish(void) if (gWishFutureKnock.wishCounter[gBattlerAttacker] == 0) { gWishFutureKnock.wishCounter[gBattlerAttacker] = 2; - gWishFutureKnock.wishUserID[gBattlerAttacker] = gBattlerPartyIndexes[gBattlerAttacker]; + gWishFutureKnock.wishMonId[gBattlerAttacker] = gBattlerPartyIndexes[gBattlerAttacker]; gBattlescriptCurrInstr += 6; } else @@ -10004,7 +10004,7 @@ static void atkD4_trywish(void) } break; case 1: // heal effect - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattlerTarget, gWishFutureKnock.wishUserID[gBattlerTarget]) + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattlerTarget, gWishFutureKnock.wishMonId[gBattlerTarget]) gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2; if (gBattleMoveDamage == 0) @@ -10036,9 +10036,9 @@ static void atkD5_trysetroots(void) // ingrain static void atkD6_doubledamagedealtifdamaged(void) { if ((gProtectStructs[gBattlerAttacker].physicalDmg - && gProtectStructs[gBattlerAttacker].physicalBank == gBattlerTarget) + && gProtectStructs[gBattlerAttacker].physicalBattlerId == gBattlerTarget) || (gProtectStructs[gBattlerAttacker].specialDmg - && gProtectStructs[gBattlerAttacker].specialBank == gBattlerTarget)) + && gProtectStructs[gBattlerAttacker].specialBattlerId == gBattlerTarget)) { gBattleScripting.dmgMultiplier = 2; } diff --git a/src/battle_util.c b/src/battle_util.c index bbb4bf41d..145169f34 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -53,7 +53,7 @@ extern u8 gBank1; extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT]; extern u8 gMoveResultFlags; extern s32 gTakenDmg[MAX_BATTLERS_COUNT]; -extern u8 gTakenDmgBanks[MAX_BATTLERS_COUNT]; +extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT]; extern u8 gLastUsedAbility; extern u8 gCurrentActionFuncId; extern u32 gBattleControllerExecFlags; @@ -547,7 +547,7 @@ u8 UpdateTurnCounters(void) { u8 sideBank; - switch (gBattleStruct->turncountersTracker) + switch (gBattleStruct->turnCountersTracker) { case 0: for (i = 0; i < gBattlersCount; i++) @@ -566,7 +566,7 @@ u8 UpdateTurnCounters(void) // It's stupid, but won't match without it { - u8* var = &gBattleStruct->turncountersTracker; + u8* var = &gBattleStruct->turnCountersTracker; (*var)++; gBattleStruct->turnSideTracker = 0; } @@ -575,7 +575,7 @@ u8 UpdateTurnCounters(void) while (gBattleStruct->turnSideTracker < 2) { sideBank = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].reflectBank; + gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].reflectBattlerId; if (gSideStatuses[sideBank] & SIDE_STATUS_REFLECT) { if (--gSideTimers[sideBank].reflectTimer == 0) @@ -592,7 +592,7 @@ u8 UpdateTurnCounters(void) } if (!effect) { - gBattleStruct->turncountersTracker++; + gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; } break; @@ -600,7 +600,7 @@ u8 UpdateTurnCounters(void) while (gBattleStruct->turnSideTracker < 2) { sideBank = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].lightscreenBank; + gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].lightscreenBattlerId; if (gSideStatuses[sideBank] & SIDE_STATUS_LIGHTSCREEN) { if (--gSideTimers[sideBank].lightscreenTimer == 0) @@ -618,7 +618,7 @@ u8 UpdateTurnCounters(void) } if (!effect) { - gBattleStruct->turncountersTracker++; + gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; } break; @@ -626,7 +626,7 @@ u8 UpdateTurnCounters(void) while (gBattleStruct->turnSideTracker < 2) { sideBank = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].mistBank; + gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].mistBattlerId; if (gSideTimers[sideBank].mistTimer != 0 && --gSideTimers[sideBank].mistTimer == 0) { @@ -642,7 +642,7 @@ u8 UpdateTurnCounters(void) } if (!effect) { - gBattleStruct->turncountersTracker++; + gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; } break; @@ -650,7 +650,7 @@ u8 UpdateTurnCounters(void) while (gBattleStruct->turnSideTracker < 2) { sideBank = gBattleStruct->turnSideTracker; - gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].safeguardBank; + gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].safeguardBattlerId; if (gSideStatuses[sideBank] & SIDE_STATUS_SAFEGUARD) { if (--gSideTimers[sideBank].safeguardTimer == 0) @@ -666,7 +666,7 @@ u8 UpdateTurnCounters(void) } if (!effect) { - gBattleStruct->turncountersTracker++; + gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; } break; @@ -688,7 +688,7 @@ u8 UpdateTurnCounters(void) } if (!effect) { - gBattleStruct->turncountersTracker++; + gBattleStruct->turnCountersTracker++; } break; case 6: @@ -719,7 +719,7 @@ u8 UpdateTurnCounters(void) BattleScriptExecute(BattleScript_RainContinuesOrEnds); effect++; } - gBattleStruct->turncountersTracker++; + gBattleStruct->turnCountersTracker++; break; case 7: if (gBattleWeather & WEATHER_SANDSTORM_ANY) @@ -739,7 +739,7 @@ u8 UpdateTurnCounters(void) BattleScriptExecute(gBattlescriptCurrInstr); effect++; } - gBattleStruct->turncountersTracker++; + gBattleStruct->turnCountersTracker++; break; case 8: if (gBattleWeather & WEATHER_SUN_ANY) @@ -757,7 +757,7 @@ u8 UpdateTurnCounters(void) BattleScriptExecute(gBattlescriptCurrInstr); effect++; } - gBattleStruct->turncountersTracker++; + gBattleStruct->turnCountersTracker++; break; case 9: if (gBattleWeather & WEATHER_HAIL) @@ -777,7 +777,7 @@ u8 UpdateTurnCounters(void) BattleScriptExecute(gBattlescriptCurrInstr); effect++; } - gBattleStruct->turncountersTracker++; + gBattleStruct->turnCountersTracker++; break; case 10: effect++; @@ -794,12 +794,12 @@ u8 TurnBasedEffects(void) u8 effect = 0; gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20); - while (gBattleStruct->turnEffectsBank < gBattlersCount && gBattleStruct->turnEffectsTracker <= TURNBASED_MAX_CASE) + while (gBattleStruct->turnEffectsBattlerId < gBattlersCount && gBattleStruct->turnEffectsTracker <= TURNBASED_MAX_CASE) { - gActiveBattler = gBattlerAttacker = gBattleTurnOrder[gBattleStruct->turnEffectsBank]; + gActiveBattler = gBattlerAttacker = gBattleTurnOrder[gBattleStruct->turnEffectsBattlerId]; if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) { - gBattleStruct->turnEffectsBank++; + gBattleStruct->turnEffectsBattlerId++; } else { @@ -1099,7 +1099,7 @@ u8 TurnBasedEffects(void) break; case 19: // done gBattleStruct->turnEffectsTracker = 0; - gBattleStruct->turnEffectsBank++; + gBattleStruct->turnEffectsBattlerId++; break; } if (effect != 0) @@ -1117,16 +1117,16 @@ bool8 HandleWishPerishSongOnTurnEnd(void) switch (gBattleStruct->wishPerishSongState) { case 0: - while (gBattleStruct->wishPerishSongBank < gBattlersCount) + while (gBattleStruct->wishPerishSongBattlerId < gBattlersCount) { - gActiveBattler = gBattleStruct->wishPerishSongBank; + gActiveBattler = gBattleStruct->wishPerishSongBattlerId; if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) { - gBattleStruct->wishPerishSongBank++; + gBattleStruct->wishPerishSongBattlerId++; continue; } - gBattleStruct->wishPerishSongBank++; + gBattleStruct->wishPerishSongBattlerId++; if (gWishFutureKnock.futureSightCounter[gActiveBattler] != 0 && --gWishFutureKnock.futureSightCounter[gActiveBattler] == 0 && gBattleMons[gActiveBattler].hp != 0) @@ -1141,7 +1141,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void) gBattlerTarget = gActiveBattler; gBattlerAttacker = gWishFutureKnock.futureSightAttacker[gActiveBattler]; gBattleMoveDamage = gWishFutureKnock.futureSightDmg[gActiveBattler]; - gSpecialStatuses[gBattlerTarget].moveturnLostHP = 0xFFFF; + gSpecialStatuses[gBattlerTarget].dmg = 0xFFFF; BattleScriptExecute(BattleScript_MonTookFutureAttack); if (gWishFutureKnock.futureSightCounter[gActiveBattler] == 0 @@ -1156,19 +1156,19 @@ bool8 HandleWishPerishSongOnTurnEnd(void) { u8 *state = &gBattleStruct->wishPerishSongState; *state = 1; - gBattleStruct->wishPerishSongBank = 0; + gBattleStruct->wishPerishSongBattlerId = 0; } // fall through case 1: - while (gBattleStruct->wishPerishSongBank < gBattlersCount) + while (gBattleStruct->wishPerishSongBattlerId < gBattlersCount) { - gActiveBattler = gBattlerAttacker = gBattleTurnOrder[gBattleStruct->wishPerishSongBank]; + gActiveBattler = gBattlerAttacker = gBattleTurnOrder[gBattleStruct->wishPerishSongBattlerId]; if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) { - gBattleStruct->wishPerishSongBank++; + gBattleStruct->wishPerishSongBattlerId++; continue; } - gBattleStruct->wishPerishSongBank++; + gBattleStruct->wishPerishSongBattlerId++; if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG) { PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gActiveBattler].perishSongTimer1); @@ -1191,7 +1191,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void) { u8 *state = &gBattleStruct->wishPerishSongState; *state = 2; - gBattleStruct->wishPerishSongBank = 0; + gBattleStruct->wishPerishSongBattlerId = 0; } // fall through case 2: @@ -1229,7 +1229,7 @@ bool8 HandleFaintedMonActions(void) switch (gBattleStruct->faintedActionsState) { case 0: - gBattleStruct->faintedActionsBank = 0; + gBattleStruct->faintedActionsBattlerId = 0; gBattleStruct->faintedActionsState++; for (i = 0; i < gBattlersCount; i++) { @@ -1240,45 +1240,45 @@ bool8 HandleFaintedMonActions(void) case 1: do { - gBank1 = gBattlerTarget = gBattleStruct->faintedActionsBank; - if (gBattleMons[gBattleStruct->faintedActionsBank].hp == 0 - && !(gBattleStruct->field_DF & gBitTable[gBattlerPartyIndexes[gBattleStruct->faintedActionsBank]]) - && !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBank])) + gBank1 = gBattlerTarget = gBattleStruct->faintedActionsBattlerId; + if (gBattleMons[gBattleStruct->faintedActionsBattlerId].hp == 0 + && !(gBattleStruct->field_DF & gBitTable[gBattlerPartyIndexes[gBattleStruct->faintedActionsBattlerId]]) + && !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBattlerId])) { BattleScriptExecute(BattleScript_GiveExp); gBattleStruct->faintedActionsState = 2; return TRUE; } - } while (++gBattleStruct->faintedActionsBank != gBattlersCount); + } while (++gBattleStruct->faintedActionsBattlerId != gBattlersCount); gBattleStruct->faintedActionsState = 3; break; case 2: sub_803F9EC(gBank1); - if (++gBattleStruct->faintedActionsBank == gBattlersCount) + if (++gBattleStruct->faintedActionsBattlerId == gBattlersCount) gBattleStruct->faintedActionsState = 3; else gBattleStruct->faintedActionsState = 1; break; case 3: - gBattleStruct->faintedActionsBank = 0; + gBattleStruct->faintedActionsBattlerId = 0; gBattleStruct->faintedActionsState++; // fall through case 4: do { - gBank1 = gBattlerTarget = gBattleStruct->faintedActionsBank; - if (gBattleMons[gBattleStruct->faintedActionsBank].hp == 0 - && !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBank])) + gBank1 = gBattlerTarget = gBattleStruct->faintedActionsBattlerId; + if (gBattleMons[gBattleStruct->faintedActionsBattlerId].hp == 0 + && !(gAbsentBattlerFlags & gBitTable[gBattleStruct->faintedActionsBattlerId])) { BattleScriptExecute(BattleScript_HandleFaintedMon); gBattleStruct->faintedActionsState = 5; return TRUE; } - } while (++gBattleStruct->faintedActionsBank != gBattlersCount); + } while (++gBattleStruct->faintedActionsBattlerId != gBattlersCount); gBattleStruct->faintedActionsState = 6; break; case 5: - if (++gBattleStruct->faintedActionsBank == gBattlersCount) + if (++gBattleStruct->faintedActionsBattlerId == gBattlersCount) gBattleStruct->faintedActionsState = 6; else gBattleStruct->faintedActionsState = 4; @@ -1535,7 +1535,7 @@ u8 AtkCanceller_UnableToUseMove(void) { gCurrentMove = MOVE_BIDE; *bideDmg = gTakenDmg[gBattlerAttacker] * 2; - gBattlerTarget = gTakenDmgBanks[gBattlerAttacker]; + gBattlerTarget = gTakenDmgByBattler[gBattlerAttacker]; if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) gBattlerTarget = GetMoveTarget(MOVE_BIDE, 1); gBattlescriptCurrInstr = BattleScript_BideAttack; @@ -2063,7 +2063,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && move != MOVE_STRUGGLE && gBattleMoves[move].power != 0 - && (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special) + && (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg) && gBattleMons[battler].type1 != moveType && gBattleMons[battler].type2 != moveType && gBattleMons[battler].hp != 0) @@ -2080,7 +2080,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special) + && (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg) && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) { gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16; @@ -2095,7 +2095,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special) + && (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg) && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && (Random() % 10) == 0) { @@ -2118,7 +2118,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special) + && (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg) && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && (Random() % 3) == 0) { @@ -2133,7 +2133,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special) + && (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg) && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && (Random() % 3) == 0) { @@ -2149,7 +2149,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) - && (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special) + && (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg) && (Random() % 3) == 0) { gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN; @@ -2164,7 +2164,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) - && (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special) + && (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg) && gBattleMons[gBattlerTarget].hp != 0 && (Random() % 3) == 0 && gBattleMons[gBattlerAttacker].ability != ABILITY_OBLIVIOUS @@ -3174,7 +3174,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) { case HOLD_EFFECT_FLINCH: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && (gSpecialStatuses[gBattlerTarget].moveturnLostHP_physical || gSpecialStatuses[gBattlerTarget].moveturnLostHP_special) + && (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg) && (Random() % 100) < atkQuality && gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED && gBattleMons[gBattlerTarget].hp) @@ -3187,8 +3187,8 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) break; case HOLD_EFFECT_SHELL_BELL: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && gSpecialStatuses[gBattlerTarget].moveturnLostHP != 0 - && gSpecialStatuses[gBattlerTarget].moveturnLostHP != 0xFFFF + && gSpecialStatuses[gBattlerTarget].dmg != 0 + && gSpecialStatuses[gBattlerTarget].dmg != 0xFFFF && gBattlerAttacker != gBattlerTarget && gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP && gBattleMons[gBattlerAttacker].hp != 0) @@ -3196,10 +3196,10 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) gLastUsedItem = atkItem; gStringBattler = gBattlerAttacker; gBattleScripting.battler = gBattlerAttacker; - gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].moveturnLostHP / atkQuality) * -1; + gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].dmg / atkQuality) * -1; if (gBattleMoveDamage == 0) gBattleMoveDamage = -1; - gSpecialStatuses[gBattlerTarget].moveturnLostHP = 0; + gSpecialStatuses[gBattlerTarget].dmg = 0; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret; effect++; diff --git a/src/item_use.c b/src/item_use.c index 6f585ed8b..bf9109dc8 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -88,7 +88,7 @@ extern void sub_80B7CC8(void); extern void flagmods_08054D70(void); extern u8* sub_806CF78(u16); extern bool8 ExecuteTableBasedItemEffect_(struct Pokemon*, u16, u8, u8); -extern u8 gBankInMenu; +extern u8 gBattlerInMenuId; extern u16 gBattlerPartyIndexes[]; extern void sub_81B89F0(void); extern u8 GetItemEffectType(u16); @@ -984,7 +984,7 @@ void sub_80FE440(u8 taskId) void ItemUseInBattle_StatIncrease(u8 taskId) { - u16 partyId = gBattlerPartyIndexes[gBankInMenu]; + u16 partyId = gBattlerPartyIndexes[gBattlerInMenuId]; if (ExecuteTableBasedItemEffect_(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE) { diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 6442679a6..48185c304 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -26,7 +26,7 @@ extern struct BattlePokemon gBattleMons[4]; extern struct BattleEnigmaBerry gEnigmaBerries[4]; extern u8 gActiveBattler; -extern u8 gBankInMenu; +extern u8 gBattlerInMenuId; extern u8 gBattlerTarget; extern u8 gBattlerAttacker; extern u8 gStringBattler; @@ -210,7 +210,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) void sub_806CF24(s32 stat) { - gBattlerTarget = gBankInMenu; + gBattlerTarget = gBattlerInMenuId; StringCopy(gBattleTextBuff1, gStatNamesTable[gUnknown_08329EC8[stat]]); StringCopy(gBattleTextBuff2, gText_StatRose); BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnsStatChanged2); @@ -224,7 +224,7 @@ u8 *sub_806CF78(u16 itemId) if (itemId == ITEM_ENIGMA_BERRY) { if (gMain.inBattle) - itemEffect = gEnigmaBerries[gBankInMenu].itemEffect; + itemEffect = gEnigmaBerries[gBattlerInMenuId].itemEffect; else itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect; } @@ -233,7 +233,7 @@ u8 *sub_806CF78(u16 itemId) itemEffect = gItemEffectTable[itemId - 13]; } - gStringBattler = gBankInMenu; + gStringBattler = gBattlerInMenuId; for (i = 0; i < 3; i++) { @@ -247,7 +247,7 @@ u8 *sub_806CF78(u16 itemId) } else { - gBattlerAttacker = gBankInMenu; + gBattlerAttacker = gBattlerInMenuId; BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnGettingPumped); } } @@ -255,7 +255,7 @@ u8 *sub_806CF78(u16 itemId) if (itemEffect[3] & 0x80) { - gBattlerAttacker = gBankInMenu; + gBattlerAttacker = gBattlerInMenuId; BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnShroudedInMist); } @@ -1371,7 +1371,7 @@ void sub_806E994(void) else gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->field_49]; - PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBankInMenu, pokemon_order_func(gBattlerPartyIndexes[gBankInMenu])) + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBattlerInMenuId, pokemon_order_func(gBattlerPartyIndexes[gBattlerInMenuId])) BattleStringExpandPlaceholders(gText_PkmnsXPreventsSwitching, gStringVar4); } diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 925b65de5..71b544fdc 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -23,7 +23,7 @@ extern u16 gBattle_BG3_X; extern u16 gBattle_BG3_Y; extern u8 gReservedSpritePaletteCount; extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; -extern u8 gBankInMenu; +extern u8 gBattlerInMenuId; extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; extern u8 gBattlersCount; extern u32 gBattleTypeFlags; @@ -175,7 +175,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void) SetBattlerShadowSpriteCallback(opponentBank, species); } - ActionSelectionCreateCursorAt(gActionSelectionCursor[gBankInMenu], 0); + ActionSelectionCreateCursorAt(gActionSelectionCursor[gBattlerInMenuId], 0); if (gLinkVSyncDisabled != 0 && gReceivedRemoteLinkPlayers != 0) { diff --git a/sym_ewram.txt b/sym_ewram.txt index 90b0cfcbc..ff9b92e46 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -239,288 +239,7 @@ gBattle_WIN1V: @ 2022E2A .space 0x2 .include "src/battle_message.o" - -gUnknown_02022F88: @ 2022F88 - .space 0x64 - -gBattleTypeFlags: @ 2022FEC - .space 0x4 - -gBattleTerrain: @ 2022FF0 - .space 0x4 - -gUnknown_02022FF4: @ 2022FF4 - .space 0x4 - -gUnknown_02022FF8: @ 2022FF8 - .space 0x60 - -gUnknown_02023058: @ 2023058 - .space 0x4 - -gUnknown_0202305C: @ 202305C - .space 0x4 - -gUnknown_02023060: @ 2023060 - .space 0x4 - -gBattleBufferA: @ 2023064 - .space 0x800 - -gBattleBufferB: @ 2023864 - .space 0x800 - -gActiveBattler: @ 2024064 - .space 0x4 - -gBattleControllerExecFlags: @ 2024068 - .space 0x4 - -gBattlersCount: @ 202406C - .space 0x2 - -gBattlerPartyIndexes: @ 202406E - .space 0x8 - -gBattlerPositions: @ 2024076 - .space 0x4 - -gActionsByTurnOrder: @ 202407A - .space 0x4 - -gBattleTurnOrder: @ 202407E - .space 0x4 - -gCurrentTurnActionNumber: @ 2024082 - .space 0x1 - -gCurrentActionFuncId: @ 2024083 - .space 0x1 - -gBattleMons: @ 2024084 - .space 0x160 - -gBattlerSpriteIds: @ 20241E4 - .space 0x4 - -gCurrMovePos: @ 20241E8 - .space 0x1 - -gUnknown_020241E9: @ 20241E9 - .space 0x1 - -gCurrentMove: @ 20241EA - .space 0x2 - -gChosenMove: @ 20241EC - .space 0x2 - -gRandomMove: @ 20241EE - .space 0x2 - -gBattleMoveDamage: @ 20241F0 - .space 0x4 - -gHpDealt: @ 20241F4 - .space 0x4 - -gTakenDmg: @ 20241F8 - .space 0x10 - -gLastUsedItem: @ 2024208 - .space 0x2 - -gLastUsedAbility: @ 202420A - .space 0x1 - -gBattlerAttacker: @ 202420B - .space 0x1 - -gBattlerTarget: @ 202420C - .space 0x1 - -gBank1: @ 202420D - .space 0x1 - -gEffectBank: @ 202420E - .space 0x1 - -gStringBattler: @ 202420F - .space 0x1 - -gAbsentBattlerFlags: @ 2024210 - .space 0x1 - -gCritMultiplier: @ 2024211 - .space 0x1 - -gMultiHitCounter: @ 2024212 - .space 0x2 - -gBattlescriptCurrInstr: @ 2024214 - .space 0x8 - -gChosenActionByBattler: @ 202421C - .space 0x4 - -gSelectionBattleScripts: @ 2024220 - .space 0x10 - -gPalaceSelectionBattleScripts: @ 2024230 - .space 0x10 - -gLastPrintedMoves: @ 2024240 - .space 0x8 - -gLastMoves: @ 2024248 - .space 0x8 - -gLastLandedMoves: @ 2024250 - .space 0x8 - -gLastHitByType: @ 2024258 - .space 0x8 - -gLastResultingMoves: @ 2024260 - .space 0x8 - -gLockedMoves: @ 2024268 - .space 0x8 - -gLastHitBy: @ 2024270 - .space 0x4 - -gChosenMoveByBattler: @ 2024274 - .space 0x8 - -gMoveResultFlags: @ 202427C - .space 0x4 - -gHitMarker: @ 2024280 - .space 0x4 - -gUnknown_02024284: @ 2024284 - .space 0x4 - -gTakenDmgBanks: @ 2024288 - .space 0x4 - -gUnknown_0202428C: @ 202428C - .space 0x2 - -gSideStatuses: @ 202428E - .space 0x6 - -gSideTimers: @ 2024294 - .space 0x18 - -gStatuses3: @ 20242AC - .space 0x10 - -gDisableStructs: @ 20242BC - .space 0x70 - -gPauseCounterBattle: @ 202432C - .space 0x2 - -gPaydayMoney: @ 202432E - .space 0x2 - -gRandomTurnNumber: @ 2024330 - .space 0x2 - -gBattleCommunication: @ 2024332 - .space 0x1 - -gUnknown_02024333: @ 2024333 - .space 0x7 - -gBattleOutcome: @ 202433A - .space 0x2 - -gProtectStructs: @ 202433C - .space 0x40 - -gSpecialStatuses: @ 202437C - .space 0x50 - -gBattleWeather: @ 20243CC - .space 0x4 - -gWishFutureKnock: @ 20243D0 - .space 0x2C - -gUnknown_020243FC: @ 20243FC - .space 0x2 - -gSentPokesToOpponent: @ 20243FE - .space 0x2 - -gDynamicBasePower: @ 2024400 - .space 0x2 - -gExpShareExp: @ 2024402 - .space 0x2 - -gEnigmaBerries: @ 2024404 - .space 0x70 - -gBattleScripting: @ 2024474 - .space 0x28 - -gBattleStruct: @ 202449C - .space 0x4 - -gLinkBattleSendBuffer: @ 20244A0 - .space 0x4 - -gLinkBattleRecvBuffer: @ 20244A4 - .space 0x4 - -gBattleResources: @ 20244A8 - .space 0x4 - -gActionSelectionCursor: @ 20244AC - .space 0x4 - -gMoveSelectionCursor: @ 20244B0 - .space 0x4 - -gUnknown_020244B4: @ 20244B4 - .space 0x4 - -gBankInMenu: @ 20244B8 - .space 0x1 - -gDoingBattleAnim: @ 20244B9 - .space 0x3 - -gTransformedPersonalities: @ 20244BC - .space 0x10 - -gPlayerDpadHoldFrames: @ 20244CC - .space 0x4 - -gBattleSpritesDataPtr: @ 20244D0 - .space 0x4 - -gMonSpritesGfxPtr: @ 20244D4 - .space 0x4 - -gUnknown_020244D8: @ 20244D8 - .space 0x4 - -gUnknown_020244DC: @ 20244DC - .space 0x4 - -gBattleMovePower: @ 20244E0 - .space 0x2 - -gMoveToLearn: @ 20244E2 - .space 0x2 - -gBattleMonForms: @ 20244E4 - .space 0x4 + .include "src/battle_main.o" sLearningMoveTableID: @ 20244E8 .space 0x1