Side Status from u16 to u32

This commit is contained in:
DizzyEggg 2018-07-24 20:13:02 +02:00
parent 180047a511
commit 45bc76d94c
7 changed files with 37 additions and 39 deletions

View file

@ -150,7 +150,7 @@
.macro jumpifsideaffecting bank, sidestatus, param2 .macro jumpifsideaffecting bank, sidestatus, param2
.byte 0x1f .byte 0x1f
.byte \bank .byte \bank
.2byte \sidestatus .4byte \sidestatus
.4byte \param2 .4byte \param2
.endm .endm

View file

@ -807,7 +807,7 @@ extern u16 gMoveResultFlags;
extern u32 gHitMarker; extern u32 gHitMarker;
extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT]; extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT];
extern u8 gUnknown_0202428C; extern u8 gUnknown_0202428C;
extern u16 gSideStatuses[2]; extern u32 gSideStatuses[2];
extern struct SideTimer gSideTimers[2]; extern struct SideTimer gSideTimers[2];
extern u32 gStatuses3[MAX_BATTLERS_COUNT]; extern u32 gStatuses3[MAX_BATTLERS_COUNT];
extern struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT]; extern struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT];

View file

@ -1036,9 +1036,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus,
if (changeStatus) if (changeStatus)
{ {
if (statusTrue) if (statusTrue)
*(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_REFLECT; *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_REFLECT;
else else
*(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_REFLECT); *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_REFLECT);
sideTimer->reflectBattlerId = data->battlerId; sideTimer->reflectBattlerId = data->battlerId;
} }
return &sideTimer->reflectTimer; return &sideTimer->reflectTimer;
@ -1046,9 +1046,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus,
if (changeStatus) if (changeStatus)
{ {
if (statusTrue) if (statusTrue)
*(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_LIGHTSCREEN; *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_LIGHTSCREEN;
else else
*(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_LIGHTSCREEN); *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_LIGHTSCREEN);
sideTimer->lightscreenBattlerId = data->battlerId; sideTimer->lightscreenBattlerId = data->battlerId;
} }
return &sideTimer->lightscreenTimer; return &sideTimer->lightscreenTimer;
@ -1056,18 +1056,18 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus,
if (changeStatus) if (changeStatus)
{ {
if (statusTrue) if (statusTrue)
*(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_SPIKES; *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_SPIKES;
else else
*(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_SPIKES); *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_SPIKES);
} }
return &sideTimer->spikesAmount; return &sideTimer->spikesAmount;
case LIST_SIDE_SAFEGUARD: case LIST_SIDE_SAFEGUARD:
if (changeStatus) if (changeStatus)
{ {
if (statusTrue) if (statusTrue)
*(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_SAFEGUARD; *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_SAFEGUARD;
else else
*(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_SAFEGUARD); *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_SAFEGUARD);
sideTimer->safeguardBattlerId = data->battlerId; sideTimer->safeguardBattlerId = data->battlerId;
} }
return &sideTimer->safeguardTimer; return &sideTimer->safeguardTimer;
@ -1075,9 +1075,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus,
if (changeStatus) if (changeStatus)
{ {
if (statusTrue) if (statusTrue)
*(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_MIST; *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_MIST;
else else
*(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_MIST); *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_MIST);
sideTimer->mistBattlerId = data->battlerId; sideTimer->mistBattlerId = data->battlerId;
} }
return &sideTimer->mistTimer; return &sideTimer->mistTimer;
@ -1085,9 +1085,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus,
if (changeStatus) if (changeStatus)
{ {
if (statusTrue) if (statusTrue)
*(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_AURORA_VEIL; *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_AURORA_VEIL;
else else
*(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_AURORA_VEIL); *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_AURORA_VEIL);
sideTimer->auroraVeilBattlerId = data->battlerId; sideTimer->auroraVeilBattlerId = data->battlerId;
} }
return &sideTimer->auroraVeilTimer; return &sideTimer->auroraVeilTimer;
@ -1095,9 +1095,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus,
if (changeStatus) if (changeStatus)
{ {
if (statusTrue) if (statusTrue)
*(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_LUCKY_CHANT; *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_LUCKY_CHANT;
else else
*(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_LUCKY_CHANT); *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_LUCKY_CHANT);
sideTimer->luckyChantBattlerId = data->battlerId; sideTimer->luckyChantBattlerId = data->battlerId;
} }
return &sideTimer->luckyChantTimer; return &sideTimer->luckyChantTimer;
@ -1105,9 +1105,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus,
if (changeStatus) if (changeStatus)
{ {
if (statusTrue) if (statusTrue)
*(u16*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_TAILWIND; *(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_TAILWIND;
else else
*(u16*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_TAILWIND); *(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_TAILWIND);
sideTimer->tailwindBattlerId = data->battlerId; sideTimer->tailwindBattlerId = data->battlerId;
} }
return &sideTimer->tailwindTimer; return &sideTimer->tailwindTimer;

View file

@ -251,7 +251,7 @@ EWRAM_DATA u32 gHitMarker = 0;
EWRAM_DATA static u8 sUnusedBattlersArray[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA static u8 sUnusedBattlersArray[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u8 gUnknown_0202428C = 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 struct SideTimer gSideTimers[2] = {0};
EWRAM_DATA u32 gStatuses3[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u32 gStatuses3[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT] = {0};

View file

@ -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 sub_81D572C(u8 arg0, u16 trainerId); // pokenav
extern void GetFrontierTrainerName(u8 *dst, u16 trainerId); extern void GetFrontierTrainerName(u8 *dst, u16 trainerId);
// this file's functions // this files functions
static void ChooseMoveUsedParticle(u8 *textPtr); static void ChooseMoveUsedParticle(u8 *textPtr);
static void ChooseTypeOfMoveUsedString(u8 *dst); static void ChooseTypeOfMoveUsedString(u8 *dst);
static void ExpandBattleTextBuffPlaceholders(const u8 *src, 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}!"); 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. // 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_ElectricTerrainEnds[] = _("{B_ATK_ABILITY} wore off.");
static const u8 sText_MistyTerrainEnds[] = _("{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_PsychicTerrainEnds[] = _("{B_ATK_ABILITY} wore off.");
static const u8 sText_GrassyTerrainEnds[] = _("{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_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_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_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_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_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} cant get it going!");
static const u8 sText_SlowStartEnd[] = _("{B_ATK_NAME_WITH_PREFIX} finally got its act together!"); 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_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_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_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_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_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_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_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_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_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}!"); 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] = const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
@ -3136,7 +3136,7 @@ static void ChooseMoveUsedParticle(u8* textBuff)
if (counter <= 2) if (counter <= 2)
StringCopy(textBuff, sText_SpaceIs); // is StringCopy(textBuff, sText_SpaceIs); // is
else if (counter <= 4) 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. // 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. // sText_ExclamationMark was a plain "!", used for any attack not on the list.
// It resulted in the translation "<NAME>'s <ATTACK>!". // It resulted in the translation "<NAME>s <ATTACK>!".
// //
// sText_ExclamationMark2 was "? ????!". This resulted in the translation // sText_ExclamationMark2 was "? ????!". This resulted in the translation
// "<NAME> used <ATTACK>!", which was used for all attacks in English. // "<NAME> used <ATTACK>!", which was used for all attacks in English.
@ -3157,7 +3157,7 @@ static void ChooseMoveUsedParticle(u8* textBuff)
// "<NAME> did an <ATTACK>!". // "<NAME> did an <ATTACK>!".
// //
// sText_ExclamationMark5 was " ????!" This resulted in a translation of // sText_ExclamationMark5 was " ????!" This resulted in a translation of
// "<NAME>'s <ATTACK> attack!". // "<NAME>s <ATTACK> attack!".
static void ChooseTypeOfMoveUsedString(u8* dst) static void ChooseTypeOfMoveUsedString(u8* dst)
{ {
s32 counter = 0; s32 counter = 0;

View file

@ -2942,21 +2942,21 @@ static void atk1E_jumpifability(void)
static void atk1F_jumpifsideaffecting(void) static void atk1F_jumpifsideaffecting(void)
{ {
u8 side; u8 side;
u16 flags; u32 flags;
const u8* jumpPtr; const u8 *jumpPtr;
if (gBattlescriptCurrInstr[1] == BS_ATTACKER) if (gBattlescriptCurrInstr[1] == BS_ATTACKER)
side = GET_BATTLER_SIDE(gBattlerAttacker); side = GET_BATTLER_SIDE(gBattlerAttacker);
else else
side = GET_BATTLER_SIDE(gBattlerTarget); side = GET_BATTLER_SIDE(gBattlerTarget);
flags = T2_READ_16(gBattlescriptCurrInstr + 2); flags = T2_READ_32(gBattlescriptCurrInstr + 2);
jumpPtr = T2_READ_PTR(gBattlescriptCurrInstr + 4); jumpPtr = T2_READ_PTR(gBattlescriptCurrInstr + 6);
if (gSideStatuses[side] & flags) if (gSideStatuses[side] & flags)
gBattlescriptCurrInstr = jumpPtr; gBattlescriptCurrInstr = jumpPtr;
else else
gBattlescriptCurrInstr += 8; gBattlescriptCurrInstr += 10;
} }
static void atk20_jumpifstat(void) static void atk20_jumpifstat(void)

View file

@ -1428,11 +1428,9 @@ static void TrySetBattleSeminarShow(void)
powerOverride = 0; powerOverride = 0;
if (ShouldCalculateDamage(gCurrentMove, &dmgByMove[i], &powerOverride)) 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); gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, gBattleMoves[gCurrentMove].type, powerOverride, FALSE, FALSE);
dmgByMove[i] = gBattleMoveDamage; dmgByMove[i] = gBattleMoveDamage;
if (dmgByMove[i] == 0 && !(moveResultFlags & MOVE_RESULT_NO_EFFECT)) if (dmgByMove[i] == 0 && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
dmgByMove[i] = 1; dmgByMove[i] = 1;
} }
} }