mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-14 15:43:43 +01:00
atk 48 is really troublesome
This commit is contained in:
parent
d5afb0c6e9
commit
fc57c6c817
@ -784,6 +784,11 @@ extern struct BattleStruct* gBattleStruct;
|
|||||||
#define B_ANIM_x1C 0x1C
|
#define B_ANIM_x1C 0x1C
|
||||||
#define B_ANIM_x1D 0x1D
|
#define B_ANIM_x1D 0x1D
|
||||||
|
|
||||||
|
#define ATK48_STAT_NEGATIVE 0x1
|
||||||
|
#define ATK48_STAT_BY_TWO 0x2
|
||||||
|
#define ATK48_BIT_x4 0x4
|
||||||
|
#define ATK48_LOWER_FAIL_CHECK 0x8
|
||||||
|
|
||||||
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
|
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
|
||||||
#define GET_STAT_BUFF_VALUE(n)((n & 0xF0) >> 4) // 0x10, 0x20, 0x40
|
#define GET_STAT_BUFF_VALUE(n)((n & 0xF0) >> 4) // 0x10, 0x20, 0x40
|
||||||
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit
|
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit
|
||||||
|
@ -4271,24 +4271,23 @@ void atk47_setgraphicalstatchangevalues(void)
|
|||||||
|
|
||||||
void atk48_playstatchangeanimation(void)
|
void atk48_playstatchangeanimation(void)
|
||||||
{
|
{
|
||||||
s32 currStat = 0;
|
u32 currStat = 0;
|
||||||
s16 statAnimId = 0;
|
s16 statAnimId = 0;
|
||||||
s32 checkingStatAnimId = 0;
|
s16 checkingStatAnimId = 0;
|
||||||
s32 changeableStats = 0;
|
s32 changeableStats = 0;
|
||||||
u32 statsToCheck = 0;
|
u32 statsToCheck = 0;
|
||||||
|
|
||||||
gActiveBank = GetBattleBank(BSScriptRead8(gBattlescriptCurrInstr + 1));
|
gActiveBank = GetBattleBank(gBattlescriptCurrInstr[1]);
|
||||||
statsToCheck = BSScriptRead8(gBattlescriptCurrInstr + 2);
|
statsToCheck = gBattlescriptCurrInstr[2];
|
||||||
|
|
||||||
if (gBattlescriptCurrInstr[3] & 1) // goes down
|
if (gBattlescriptCurrInstr[3] & ATK48_STAT_NEGATIVE) // goes down
|
||||||
{
|
{
|
||||||
for (checkingStatAnimId = (gBattlescriptCurrInstr[3] & 0x2) ? 0x2D : 0x15;
|
checkingStatAnimId = (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO) ? 0x2D : 0x15;
|
||||||
statsToCheck != 0;
|
while (statsToCheck != 0)
|
||||||
statsToCheck >>= 1, checkingStatAnimId += 1, currStat++)
|
|
||||||
{
|
{
|
||||||
if (!(statsToCheck & 1))
|
if (statsToCheck & 1)
|
||||||
continue;
|
{
|
||||||
if (!(gBattlescriptCurrInstr[3] & 8))
|
if (!(gBattlescriptCurrInstr[3] & ATK48_LOWER_FAIL_CHECK))
|
||||||
{
|
{
|
||||||
if (gBattleMons[gActiveBank].statStages[currStat] > 0)
|
if (gBattleMons[gActiveBank].statStages[currStat] > 0)
|
||||||
{
|
{
|
||||||
@ -4309,10 +4308,12 @@ void atk48_playstatchangeanimation(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
statsToCheck >>= 1, checkingStatAnimId++, currStat++;
|
||||||
|
}
|
||||||
|
|
||||||
if (changeableStats > 1) // more than one stat, so the color is gray
|
if (changeableStats > 1) // more than one stat, so the color is gray
|
||||||
{
|
{
|
||||||
if (gBattlescriptCurrInstr[3] & 2)
|
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
|
||||||
statAnimId = 0x3A;
|
statAnimId = 0x3A;
|
||||||
else
|
else
|
||||||
statAnimId = 0x39;
|
statAnimId = 0x39;
|
||||||
@ -4320,27 +4321,27 @@ void atk48_playstatchangeanimation(void)
|
|||||||
}
|
}
|
||||||
else // goes up
|
else // goes up
|
||||||
{
|
{
|
||||||
for (checkingStatAnimId = (gBattlescriptCurrInstr[3] & 0x2) ? 0x26 : 0xE;
|
checkingStatAnimId = (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO) ? 0x26 : 0xE;
|
||||||
statsToCheck != 0;
|
while (statsToCheck != 0)
|
||||||
statsToCheck >>= 1, checkingStatAnimId += 1, currStat++)
|
|
||||||
{
|
{
|
||||||
if (statsToCheck & 1 && gBattleMons[gActiveBank].statStages[currStat] < 0xC)
|
if (statsToCheck & 1 && gBattleMons[gActiveBank].statStages[currStat] < 0xC)
|
||||||
{
|
{
|
||||||
statAnimId = checkingStatAnimId;
|
statAnimId = checkingStatAnimId;
|
||||||
changeableStats++;
|
changeableStats++;
|
||||||
}
|
}
|
||||||
|
statsToCheck >>= 1, checkingStatAnimId += 1, currStat++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changeableStats > 1) // more than one stat, so the color is gray
|
if (changeableStats > 1) // more than one stat, so the color is gray
|
||||||
{
|
{
|
||||||
if (gBattlescriptCurrInstr[3] & 2)
|
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
|
||||||
statAnimId = 0x38;
|
statAnimId = 0x38;
|
||||||
else
|
else
|
||||||
statAnimId = 0x37;
|
statAnimId = 0x37;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gBattlescriptCurrInstr[3] & 4 && changeableStats < 2)
|
if (gBattlescriptCurrInstr[3] & ATK48_BIT_x4 && changeableStats < 2)
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr += 4;
|
gBattlescriptCurrInstr += 4;
|
||||||
}
|
}
|
||||||
@ -4348,7 +4349,7 @@ void atk48_playstatchangeanimation(void)
|
|||||||
{
|
{
|
||||||
EmitBattleAnimation(0, B_ANIM_STATS_CHANGE, statAnimId);
|
EmitBattleAnimation(0, B_ANIM_STATS_CHANGE, statAnimId);
|
||||||
MarkBufferBankForExecution(gActiveBank);
|
MarkBufferBankForExecution(gActiveBank);
|
||||||
if (gBattlescriptCurrInstr[3] & 4 && changeableStats > 1)
|
if (gBattlescriptCurrInstr[3] & ATK48_BIT_x4 && changeableStats > 1)
|
||||||
gBattleScripting.field_1B = 1;
|
gBattleScripting.field_1B = 1;
|
||||||
gBattlescriptCurrInstr += 4;
|
gBattlescriptCurrInstr += 4;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user