Normalize union room UnkStruct arrays; remove STAT_STAGE_ defines
This commit is contained in:
@@ -170,16 +170,6 @@
|
||||
#define STAT_ACC 6 // only in battles
|
||||
#define STAT_EVASION 7 // only in battles
|
||||
|
||||
// TODO: Why do we need these as separate defines?
|
||||
#define STAT_STAGE_HP 0
|
||||
#define STAT_STAGE_ATK 1
|
||||
#define STAT_STAGE_DEF 2
|
||||
#define STAT_STAGE_SPEED 3
|
||||
#define STAT_STAGE_SPATK 4
|
||||
#define STAT_STAGE_SPDEF 5
|
||||
#define STAT_STAGE_ACC 6
|
||||
#define STAT_STAGE_EVASION 7
|
||||
|
||||
#define NUM_STATS 6
|
||||
#define NUM_BATTLE_STATS 8
|
||||
|
||||
|
||||
+17
-16
@@ -28,26 +28,27 @@ struct UnkStruct_x20
|
||||
u8 field_1F;
|
||||
};
|
||||
|
||||
// These arrays are dynamically allocated but must be
|
||||
// represented as structs to match.
|
||||
// Don't ask me why.
|
||||
|
||||
// FIXME: Find a way around this.
|
||||
|
||||
struct UnkStruct_Main0
|
||||
{
|
||||
struct UnkStruct_x20 arr[8];
|
||||
struct UnkStruct_x20 arr[0];
|
||||
};
|
||||
|
||||
struct UnkStruct_Main4
|
||||
{
|
||||
struct UnkStruct_x1C arr[5];
|
||||
};
|
||||
|
||||
struct UnkStruct_Main8
|
||||
{
|
||||
struct UnkStruct_x20 arr[5];
|
||||
struct UnkStruct_x1C arr[0];
|
||||
};
|
||||
|
||||
struct UnkStruct_Leader
|
||||
{
|
||||
struct UnkStruct_Main0 *field_0;
|
||||
struct UnkStruct_Main4 *field_4;
|
||||
struct UnkStruct_Main8 *field_8;
|
||||
struct UnkStruct_Main0 * field_0;
|
||||
struct UnkStruct_Main4 * field_4;
|
||||
struct UnkStruct_Main0 * field_8;
|
||||
u8 state;
|
||||
u8 textState;
|
||||
u8 field_E;
|
||||
@@ -67,8 +68,8 @@ struct UnkStruct_Leader
|
||||
|
||||
struct UnkStruct_Group
|
||||
{
|
||||
struct UnkStruct_Main0 *field_0;
|
||||
struct UnkStruct_Main4 *field_4;
|
||||
struct UnkStruct_Main0 * field_0;
|
||||
struct UnkStruct_Main4 * field_4;
|
||||
u8 state;
|
||||
u8 textState;
|
||||
u8 field_A;
|
||||
@@ -95,10 +96,10 @@ struct UnionObj
|
||||
|
||||
struct UnkStruct_URoom
|
||||
{
|
||||
/* 0x000 */ struct UnkStruct_Main0 *field_0;
|
||||
/* 0x004 */ struct UnkStruct_Main4 *field_4;
|
||||
/* 0x008 */ struct UnkStruct_Main0 *field_8;
|
||||
/* 0x00C */ struct UnkStruct_Main4 *field_C;
|
||||
/* 0x000 */ struct UnkStruct_Main0 * field_0;
|
||||
/* 0x004 */ struct UnkStruct_Main4 * field_4;
|
||||
/* 0x008 */ struct UnkStruct_Main0 * field_8;
|
||||
/* 0x00C */ struct UnkStruct_Main4 * field_C;
|
||||
/* 0x010 */ u16 field_10;
|
||||
/* 0x012 */ u16 field_12;
|
||||
/* 0x014 */ u8 state;
|
||||
|
||||
+25
-25
@@ -3982,49 +3982,49 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_STAGE_ATK] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_STAGE_ATK] += itemEffect[cmdIndex] & 0xF;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_STAGE_ATK] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_STAGE_ATK] = 12;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & 0xF;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
// in-battle stat boosting effects?
|
||||
case 1:
|
||||
if ((itemEffect[cmdIndex] & 0xF0)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_STAGE_DEF] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_STAGE_DEF] += (itemEffect[cmdIndex] & 0xF0) >> 4;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_STAGE_DEF] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_STAGE_DEF] = 12;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & 0xF0) >> 4;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_STAGE_SPEED] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_STAGE_SPEED] += itemEffect[cmdIndex] & 0xF;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_STAGE_SPEED] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_STAGE_SPEED] = 12;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & 0xF;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
// more stat boosting effects?
|
||||
case 2:
|
||||
if ((itemEffect[cmdIndex] & 0xF0)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_STAGE_ACC] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_STAGE_ACC] += (itemEffect[cmdIndex] & 0xF0) >> 4;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_STAGE_ACC] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_STAGE_ACC] = 12;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & 0xF0) >> 4;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_STAGE_SPATK] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_STAGE_SPATK] += itemEffect[cmdIndex] & 0xF;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_STAGE_SPATK] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_STAGE_SPATK] = 12;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & 0xF;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
@@ -4496,25 +4496,25 @@ bool8 PokemonItemUseNoEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mo
|
||||
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_FOCUS_ENERGY))
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_STAGE_ATK] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < 12)
|
||||
retVal = FALSE;
|
||||
break;
|
||||
// in-battle stat boosting effects?
|
||||
case 1:
|
||||
if ((itemEffect[cmdIndex] & 0xF0)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_STAGE_DEF] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < 12)
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_STAGE_SPEED] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < 12)
|
||||
retVal = FALSE;
|
||||
break;
|
||||
// more stat boosting effects?
|
||||
case 2:
|
||||
if ((itemEffect[cmdIndex] & 0xF0)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_STAGE_ACC] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < 12)
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_STAGE_SPATK] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < 12)
|
||||
retVal = FALSE;
|
||||
break;
|
||||
case 3:
|
||||
|
||||
+2
-2
@@ -2526,12 +2526,12 @@ static void sub_811868C(const u8 *src)
|
||||
|
||||
static void sub_81186B0(struct UnkStruct_URoom * data)
|
||||
{
|
||||
memcpy(&gDecompressionBuffer[0x3F00], data->field_0, sizeof(*data->field_0));
|
||||
memcpy(&gDecompressionBuffer[0x3F00], data->field_0, 8 * sizeof(struct UnkStruct_x20));
|
||||
}
|
||||
|
||||
static void sub_81186C8(struct UnkStruct_URoom * data)
|
||||
{
|
||||
memcpy(data->field_0, &gDecompressionBuffer[0x3F00], sizeof(*data->field_0));
|
||||
memcpy(data->field_0, &gDecompressionBuffer[0x3F00], 8 * sizeof(struct UnkStruct_x20));
|
||||
}
|
||||
|
||||
static void sub_81186E0(u8 taskId)
|
||||
|
||||
@@ -10,6 +10,7 @@ ALIGNED(4) const u8 gUnknown_84571E0[] = _("The WIRELESS COMMUNICATION\nSYSTEM s
|
||||
ALIGNED(4) const u8 gUnref_845721C[] = _("ともだちからの れんらくを\nまっています");
|
||||
ALIGNED(4) const u8 gUnknown_8457234[] = _("{STR_VAR_1}! Awaiting\ncommunication from another player.");
|
||||
ALIGNED(4) const u8 gUnknown_8457264[] = _("{STR_VAR_1}! Awaiting link!\nPress START when everyone's ready.");
|
||||
|
||||
ALIGNED(4) const u8 gJPText_SingleBattle[] = _("シングルバトルを かいさいする");
|
||||
ALIGNED(4) const u8 gJPText_DoubleBattle[] = _("ダブルバトルを かいさいする");
|
||||
ALIGNED(4) const u8 gJPText_MultiBattle[] = _("マルチバトルを かいさいする");
|
||||
@@ -82,6 +83,7 @@ ALIGNED(4) const u8 gUnknown_84574EC[] = _("{STR_VAR_2} contacted you.\nAdd to t
|
||||
ALIGNED(4) const u8 gUnknown_8457514[] = _("{STR_VAR_1}!\nAre these members OK?");
|
||||
ALIGNED(4) const u8 gUnknown_8457530[] = _("Cancel {STR_VAR_1} MODE\nwith these members?");
|
||||
ALIGNED(4) const u8 gUnknown_8457554[] = _("An “OK” was sent\nto {STR_VAR_1}.");
|
||||
|
||||
ALIGNED(4) const u8 gUnknown_845756C[] = _("The other TRAINER doesn't appear\nto be available now…\p");
|
||||
ALIGNED(4) const u8 gUnknown_84575A4[] = _("You can't transmit with a TRAINER\nwho is too far away.\p");
|
||||
ALIGNED(4) const u8 gUnknown_84575DC[] = _("The other TRAINER(S) is/are not\nready yet.\p");
|
||||
|
||||
Reference in New Issue
Block a user