Remove EWRAM gHpDealt (not needed anymore) (#5925)

This commit is contained in:
Alex 2025-01-02 23:37:58 +01:00 committed by GitHub
parent 94fba81a90
commit ec1876b826
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 14 deletions

View file

@ -1113,7 +1113,6 @@ extern u8 gChosenMovePos;
extern u16 gCurrentMove; extern u16 gCurrentMove;
extern u16 gChosenMove; extern u16 gChosenMove;
extern u16 gCalledMove; extern u16 gCalledMove;
extern s32 gHpDealt;
extern s32 gBideDmg[MAX_BATTLERS_COUNT]; extern s32 gBideDmg[MAX_BATTLERS_COUNT];
extern u16 gLastUsedItem; extern u16 gLastUsedItem;
extern u16 gLastUsedAbility; extern u16 gLastUsedAbility;

View file

@ -163,7 +163,6 @@ EWRAM_DATA u8 gChosenMovePos = 0;
EWRAM_DATA u16 gCurrentMove = 0; EWRAM_DATA u16 gCurrentMove = 0;
EWRAM_DATA u16 gChosenMove = 0; EWRAM_DATA u16 gChosenMove = 0;
EWRAM_DATA u16 gCalledMove = 0; EWRAM_DATA u16 gCalledMove = 0;
EWRAM_DATA s32 gHpDealt = 0;
EWRAM_DATA s32 gBideDmg[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA s32 gBideDmg[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u16 gLastUsedItem = 0; EWRAM_DATA u16 gLastUsedItem = 0;
EWRAM_DATA u16 gLastUsedAbility = 0; EWRAM_DATA u16 gLastUsedAbility = 0;
@ -3384,7 +3383,7 @@ const u8* FaintClearSetData(u32 battler)
gBattleStruct->lastTakenMoveFrom[battler][1] = 0; gBattleStruct->lastTakenMoveFrom[battler][1] = 0;
gBattleStruct->lastTakenMoveFrom[battler][2] = 0; gBattleStruct->lastTakenMoveFrom[battler][2] = 0;
gBattleStruct->lastTakenMoveFrom[battler][3] = 0; gBattleStruct->lastTakenMoveFrom[battler][3] = 0;
if (gBattleStruct->pursuitTarget & (1u << battler)) if (gBattleStruct->pursuitTarget & (1u << battler))
{ {
gBattleStruct->pursuitTarget = 0; gBattleStruct->pursuitTarget = 0;

View file

@ -2583,13 +2583,12 @@ static void Cmd_datahpupdate(void)
if (gSpecialStatuses[battler].shellBellDmg == 0) if (gSpecialStatuses[battler].shellBellDmg == 0)
gSpecialStatuses[battler].shellBellDmg = gBattleStruct->moveDamage[battler]; gSpecialStatuses[battler].shellBellDmg = gBattleStruct->moveDamage[battler];
gDisableStructs[battler].substituteHP -= gBattleStruct->moveDamage[battler]; gDisableStructs[battler].substituteHP -= gBattleStruct->moveDamage[battler];
gHpDealt = gBattleStruct->moveDamage[battler];
} }
else else
{ {
if (gSpecialStatuses[battler].shellBellDmg == 0) if (gSpecialStatuses[battler].shellBellDmg == 0)
gSpecialStatuses[battler].shellBellDmg = gDisableStructs[battler].substituteHP; gSpecialStatuses[battler].shellBellDmg = gDisableStructs[battler].substituteHP;
gHpDealt = gDisableStructs[battler].substituteHP; gBattleStruct->moveDamage[battler] = gDisableStructs[battler].substituteHP;
gDisableStructs[battler].substituteHP = 0; gDisableStructs[battler].substituteHP = 0;
} }
// check substitute fading // check substitute fading
@ -2647,17 +2646,16 @@ static void Cmd_datahpupdate(void)
if (gBattleMons[battler].hp > gBattleStruct->moveDamage[battler]) if (gBattleMons[battler].hp > gBattleStruct->moveDamage[battler])
{ {
gBattleMons[battler].hp -= gBattleStruct->moveDamage[battler]; gBattleMons[battler].hp -= gBattleStruct->moveDamage[battler];
gHpDealt = gBattleStruct->moveDamage[battler];
} }
else else
{ {
gHpDealt = gBattleMons[battler].hp; gBattleStruct->moveDamage[battler] = gBattleMons[battler].hp;
gBattleMons[battler].hp = 0; gBattleMons[battler].hp = 0;
} }
// Record damage for Shell Bell // Record damage for Shell Bell
if (gSpecialStatuses[battler].shellBellDmg == 0 && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) if (gSpecialStatuses[battler].shellBellDmg == 0 && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE))
gSpecialStatuses[battler].shellBellDmg = gHpDealt; gSpecialStatuses[battler].shellBellDmg = gBattleStruct->moveDamage[battler];
u32 effect = GetMoveEffect(gCurrentMove); u32 effect = GetMoveEffect(gCurrentMove);
@ -2666,8 +2664,8 @@ static void Cmd_datahpupdate(void)
// to help determine if a fire move should defrost the target. // to help determine if a fire move should defrost the target.
if (IsBattleMovePhysical(gCurrentMove) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE) && effect != EFFECT_PAIN_SPLIT) if (IsBattleMovePhysical(gCurrentMove) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE) && effect != EFFECT_PAIN_SPLIT)
{ {
gProtectStructs[battler].physicalDmg = gHpDealt; gProtectStructs[battler].physicalDmg = gBattleStruct->moveDamage[battler];
gSpecialStatuses[battler].physicalDmg = gHpDealt; gSpecialStatuses[battler].physicalDmg = gBattleStruct->moveDamage[battler];
if (cmd->battler == BS_TARGET) if (cmd->battler == BS_TARGET)
{ {
gProtectStructs[battler].physicalBattlerId = gBattlerAttacker; gProtectStructs[battler].physicalBattlerId = gBattlerAttacker;
@ -2682,8 +2680,8 @@ static void Cmd_datahpupdate(void)
else if (!IsBattleMovePhysical(gCurrentMove) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE) && effect != EFFECT_PAIN_SPLIT) else if (!IsBattleMovePhysical(gCurrentMove) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE) && effect != EFFECT_PAIN_SPLIT)
{ {
// Record special damage/attacker for Mirror Coat // Record special damage/attacker for Mirror Coat
gProtectStructs[battler].specialDmg = gHpDealt; gProtectStructs[battler].specialDmg = gBattleStruct->moveDamage[battler];
gSpecialStatuses[battler].specialDmg = gHpDealt; gSpecialStatuses[battler].specialDmg = gBattleStruct->moveDamage[battler];
if (cmd->battler == BS_TARGET) if (cmd->battler == BS_TARGET)
{ {
gProtectStructs[battler].specialBattlerId = gBattlerAttacker; gProtectStructs[battler].specialBattlerId = gBattlerAttacker;
@ -5951,7 +5949,7 @@ static void Cmd_moveend(void)
switch (gBattleScripting.moveendState) switch (gBattleScripting.moveendState)
{ {
case MOVEEND_SUM_DAMAGE: // Sum and store damage dealt for multi strike recoil case MOVEEND_SUM_DAMAGE: // Sum and store damage dealt for multi strike recoil
gBattleScripting.savedDmg += gHpDealt; gBattleScripting.savedDmg += gBattleStruct->moveDamage[gBattlerTarget];
gBattleScripting.moveendState++; gBattleScripting.moveendState++;
break; break;
case MOVEEND_PROTECT_LIKE_EFFECT: case MOVEEND_PROTECT_LIKE_EFFECT:
@ -11944,7 +11942,7 @@ static void Cmd_setdrainedhp(void)
{ {
CMD_ARGS(); CMD_ARGS();
gBattleStruct->moveDamage[gBattlerAttacker] = (gHpDealt * GetMoveAbsorbPercentage(gCurrentMove) / 100); gBattleStruct->moveDamage[gBattlerAttacker] = (gBattleStruct->moveDamage[gBattlerTarget] * GetMoveAbsorbPercentage(gCurrentMove) / 100);
if (gBattleStruct->moveDamage[gBattlerAttacker] == 0) if (gBattleStruct->moveDamage[gBattlerAttacker] == 0)
gBattleStruct->moveDamage[gBattlerAttacker] = 1; gBattleStruct->moveDamage[gBattlerAttacker] = 1;