diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 83876e013a..bceb584afe 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -150,7 +150,7 @@ .macro jumpifsideaffecting bank, sidestatus, param2 .byte 0x1f .byte \bank - .2byte \sidestatus + .4byte \sidestatus .4byte \param2 .endm diff --git a/include/battle.h b/include/battle.h index ff19aebbb0..219005692a 100644 --- a/include/battle.h +++ b/include/battle.h @@ -807,7 +807,7 @@ extern u16 gMoveResultFlags; extern u32 gHitMarker; extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT]; extern u8 gUnknown_0202428C; -extern u16 gSideStatuses[2]; +extern u32 gSideStatuses[2]; extern struct SideTimer gSideTimers[2]; extern u32 gStatuses3[MAX_BATTLERS_COUNT]; extern struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT]; diff --git a/src/battle_debug.c b/src/battle_debug.c index 105af0aa5a..c51c0514c9 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -1036,9 +1036,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus, if (changeStatus) { if (statusTrue) - *(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_REFLECT; + *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_REFLECT; else - *(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_REFLECT); + *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_REFLECT); sideTimer->reflectBattlerId = data->battlerId; } return &sideTimer->reflectTimer; @@ -1046,9 +1046,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus, if (changeStatus) { if (statusTrue) - *(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_LIGHTSCREEN; + *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_LIGHTSCREEN; else - *(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_LIGHTSCREEN); + *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_LIGHTSCREEN); sideTimer->lightscreenBattlerId = data->battlerId; } return &sideTimer->lightscreenTimer; @@ -1056,18 +1056,18 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus, if (changeStatus) { if (statusTrue) - *(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_SPIKES; + *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_SPIKES; else - *(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_SPIKES); + *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_SPIKES); } return &sideTimer->spikesAmount; case LIST_SIDE_SAFEGUARD: if (changeStatus) { if (statusTrue) - *(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_SAFEGUARD; + *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_SAFEGUARD; else - *(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_SAFEGUARD); + *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_SAFEGUARD); sideTimer->safeguardBattlerId = data->battlerId; } return &sideTimer->safeguardTimer; @@ -1075,9 +1075,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus, if (changeStatus) { if (statusTrue) - *(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_MIST; + *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_MIST; else - *(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_MIST); + *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_MIST); sideTimer->mistBattlerId = data->battlerId; } return &sideTimer->mistTimer; @@ -1085,9 +1085,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus, if (changeStatus) { if (statusTrue) - *(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_AURORA_VEIL; + *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_AURORA_VEIL; else - *(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_AURORA_VEIL); + *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_AURORA_VEIL); sideTimer->auroraVeilBattlerId = data->battlerId; } return &sideTimer->auroraVeilTimer; @@ -1095,9 +1095,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus, if (changeStatus) { if (statusTrue) - *(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_LUCKY_CHANT; + *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_LUCKY_CHANT; else - *(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_LUCKY_CHANT); + *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_LUCKY_CHANT); sideTimer->luckyChantBattlerId = data->battlerId; } return &sideTimer->luckyChantTimer; @@ -1105,9 +1105,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus, if (changeStatus) { if (statusTrue) - *(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_TAILWIND; + *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_TAILWIND; else - *(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_TAILWIND); + *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_TAILWIND); sideTimer->tailwindBattlerId = data->battlerId; } return &sideTimer->tailwindTimer; diff --git a/src/battle_main.c b/src/battle_main.c index d0ce224313..aece1df424 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -251,7 +251,7 @@ EWRAM_DATA u32 gHitMarker = 0; EWRAM_DATA static u8 sUnusedBattlersArray[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 u32 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}; diff --git a/src/battle_message.c b/src/battle_message.c index 68e67c22c6..6b5cbf1621 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -55,7 +55,7 @@ extern void sub_81A36D0(u8 arg0, u16 trainerId); // battle_frontier_2 extern void sub_81D572C(u8 arg0, u16 trainerId); // pokenav extern void GetFrontierTrainerName(u8 *dst, u16 trainerId); -// this file's functions +// this file’s functions static void ChooseMoveUsedParticle(u8 *textPtr); static void ChooseTypeOfMoveUsedString(u8 *dst); static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst); @@ -590,31 +590,31 @@ static const u8 sText_TargetAbilityRaisedStat[] = _("{B_DEF_NAME_WITH_PREFIX}’ static const u8 sText_AttackerAbilityRaisedStat[] = _("{B_ATK_NAME_WITH_PREFIX}’s {B_ATK_ABILITY}\n raised its {B_BUFF1}!"); // These strings are currently placeholders, to be fixed. -static const u8 sText_AuroraVeilEnds[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nwore off!"); +static const u8 sText_AuroraVeilEnds[] = _("{B_DEF_NAME_WITH_PREFIX}’s {B_DEF_ABILITY}\nwore off!"); static const u8 sText_ElectricTerrainEnds[] = _("{B_ATK_ABILITY} wore off."); static const u8 sText_MistyTerrainEnds[] = _("{B_ATK_ABILITY} wore off."); static const u8 sText_PsychicTerrainEnds[] = _("{B_ATK_ABILITY} wore off."); static const u8 sText_GrassyTerrainEnds[] = _("{B_ATK_ABILITY} wore off."); -static const u8 sText_AngryPointActivates[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY} maxed\nits attack!"); +static const u8 sText_AngryPointActivates[] = _("{B_ATK_NAME_WITH_PREFIX}’s {B_ATK_ABILITY} maxed\nits attack!"); static const u8 sText_PoisonHealHpUp[] = _("The poisoning healed {B_ATK_NAME_WITH_PREFIX}\na little bit!"); static const u8 sText_BadDreamsDmg[] = _("The {B_DEF_NAME_WITH_PREFIX} is tormented\nby {B_DEF_ABILITY}!"); static const u8 sText_MoldBreakerEnters[] = _("The {B_DEF_NAME_WITH_PREFIX} breaks the mold!"); static const u8 sText_TeravoltEnters[] = _("{B_ATK_NAME_WITH_PREFIX} is radiating a bursting aura!"); static const u8 sText_TurboblazeEnters[] = _("{B_ATK_NAME_WITH_PREFIX} is radiating a blazing aura!"); -static const u8 sText_SlowStartEnters[] = _("{B_ATK_NAME_WITH_PREFIX} can't get it going!"); +static const u8 sText_SlowStartEnters[] = _("{B_ATK_NAME_WITH_PREFIX} can’t get it going!"); static const u8 sText_SlowStartEnd[] = _("{B_ATK_NAME_WITH_PREFIX} finally got its act together!"); -static const u8 sText_SolarPowerHpDrop[] = _("The {B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\ntakes its toll!"); +static const u8 sText_SolarPowerHpDrop[] = _("The {B_ATK_NAME_WITH_PREFIX}’s {B_ATK_ABILITY}\ntakes its toll!"); static const u8 sText_AftermathDmg[] = _("The {B_DEF_NAME_WITH_PREFIX}\nsuffers the {B_DEF_ABILITY}!"); static const u8 sText_AnticipationActivates[] = _("The {B_ATK_NAME_WITH_PREFIX} shuddered in {B_ATK_ABILITY}!"); -static const u8 sText_ForewarnActivates[] = _("{B_ATK_ABILITY} alerted the {B_ATK_NAME_WITH_PREFIX} to the\n{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}!"); -static const u8 sText_IceBodyHpGain[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\nhealed it a little bit!"); +static const u8 sText_ForewarnActivates[] = _("{B_ATK_ABILITY} alerted the {B_ATK_NAME_WITH_PREFIX} to the\n{B_DEF_NAME_WITH_PREFIX}’s {B_BUFF1}!"); +static const u8 sText_IceBodyHpGain[] = _("{B_ATK_NAME_WITH_PREFIX}’s {B_ATK_ABILITY}\nhealed it a little bit!"); static const u8 sText_SnowWarningHail[] = _("It started to hail!"); static const u8 sText_FriskActivates[] = _("{B_ATK_NAME_WITH_PREFIX} frisked {B_DEF_NAME_WITH_PREFIX} and\nfound its {B_LAST_ITEM}!"); static const u8 sText_UnnerveEnters[] = _("{B_ATK_NAME_WITH_PREFIX} is too nervous to eat Berries!"); static const u8 sText_HarvestBerry[] = _("{B_ATK_NAME_WITH_PREFIX} harvested its {B_LAST_ITEM}!"); -static const u8 sText_MoxieAtkRise[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY} raised its Attack!"); +static const u8 sText_MoxieAtkRise[] = _("{B_ATK_NAME_WITH_PREFIX}’s {B_ATK_ABILITY} raised its Attack!"); static const u8 sText_MagicBounceActivates[] = _("The {B_DEF_NAME_WITH_PREFIX} bounced the\n{B_ATK_NAME_WITH_PREFIX} back!"); -static const u8 sText_ProteanTypeChange[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY} transformed\nit into the {B_BUFF1} type!"); +static const u8 sText_ProteanTypeChange[] = _("{B_ATK_NAME_WITH_PREFIX}’s {B_ATK_ABILITY} transformed\nit into the {B_BUFF1} type!"); static const u8 sText_SymbiosisItemPass[] = _("{B_ATK_NAME_WITH_PREFIX} passed its {B_LAST_ITEM}\nto {B_SCR_ACTIVE_NAME_WITH_PREFIX} through {B_ATK_ABILITY}!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = @@ -3136,7 +3136,7 @@ static void ChooseMoveUsedParticle(u8* textBuff) if (counter <= 2) StringCopy(textBuff, sText_SpaceIs); // is else if (counter <= 4) - StringCopy(textBuff, sText_ApostropheS); // 's + StringCopy(textBuff, sText_ApostropheS); // ’s } } @@ -3144,7 +3144,7 @@ static void ChooseMoveUsedParticle(u8* textBuff) // into the table of moves at sGrammarMoveUsedTable and varied the line accordingly. // // sText_ExclamationMark was a plain "!", used for any attack not on the list. -// It resulted in the translation "'s !". +// It resulted in the translation "’s !". // // sText_ExclamationMark2 was "? ????!". This resulted in the translation // " used !", which was used for all attacks in English. @@ -3157,7 +3157,7 @@ static void ChooseMoveUsedParticle(u8* textBuff) // " did an !". // // sText_ExclamationMark5 was " ????!" This resulted in a translation of -// "'s attack!". +// "’s attack!". static void ChooseTypeOfMoveUsedString(u8* dst) { s32 counter = 0; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e654ddbb24..3081e6d305 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2942,21 +2942,21 @@ static void atk1E_jumpifability(void) static void atk1F_jumpifsideaffecting(void) { u8 side; - u16 flags; - const u8* jumpPtr; + u32 flags; + const u8 *jumpPtr; if (gBattlescriptCurrInstr[1] == BS_ATTACKER) side = GET_BATTLER_SIDE(gBattlerAttacker); else side = GET_BATTLER_SIDE(gBattlerTarget); - flags = T2_READ_16(gBattlescriptCurrInstr + 2); - jumpPtr = T2_READ_PTR(gBattlescriptCurrInstr + 4); + flags = T2_READ_32(gBattlescriptCurrInstr + 2); + jumpPtr = T2_READ_PTR(gBattlescriptCurrInstr + 6); if (gSideStatuses[side] & flags) gBattlescriptCurrInstr = jumpPtr; else - gBattlescriptCurrInstr += 8; + gBattlescriptCurrInstr += 10; } static void atk20_jumpifstat(void) diff --git a/src/battle_tv.c b/src/battle_tv.c index 2bad9ff4bc..1d70f7ab91 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -1428,11 +1428,9 @@ static void TrySetBattleSeminarShow(void) powerOverride = 0; if (ShouldCalculateDamage(gCurrentMove, &dmgByMove[i], &powerOverride)) { - u8 moveResultFlags; - u16 sideStatus = gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)]; gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, gBattleMoves[gCurrentMove].type, powerOverride, FALSE, FALSE); dmgByMove[i] = gBattleMoveDamage; - if (dmgByMove[i] == 0 && !(moveResultFlags & MOVE_RESULT_NO_EFFECT)) + if (dmgByMove[i] == 0 && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) dmgByMove[i] = 1; } }