diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/battle.h | 14 | ||||
-rw-r--r-- | include/ewram.h | 14 |
2 files changed, 13 insertions, 15 deletions
diff --git a/include/battle.h b/include/battle.h index ca772adc3..d9080f1fc 100644 --- a/include/battle.h +++ b/include/battle.h @@ -375,13 +375,21 @@ struct BattleStruct /* 0x2000000 */ /*0x160C1*/ u8 hpScale; /*0x160C2*/ u16 unk160C2; /*0x160C4*/ MainCallback unk160C4; + + // Buffers used by the AI are indexed using (battler / 2) + // i.e. the flank bit, because at no point in game is the + // player's partner in a multi battle controlled by the AI. + // This is changed in Emerald to support the Tabitha fight + // in the Space Center. /*0x160C8*/ u8 AI_monToSwitchIntoId[2]; /*0x160CA*/ u8 synchroniseEffect; /*0x160CB*/ u8 multiplayerId; /*0x160CC*/ u16 usedHeldItems[MAX_BATTLERS_COUNT]; - /*0x160D4*/ u8 unk160D4[MAX_BATTLERS_COUNT]; - /*0x160D8*/ u8 unk160D8[2]; - /*0x160DA*/ u8 unk160DA[2]; + // Space is reserved for two u16s, one for each opponent in + // doubles. However, only the lower byte of each is ever used. + /*0x160D4*/ u16 AI_usedItemId[2]; + /*0x160D8*/ u8 AI_usedItemType[2]; + /*0x160DA*/ u8 AI_usedItemEffect[2]; /*0x160DC*/ u8 unk160DC; /*0x160DD*/ u8 intimidateBank; /*0x160DE*/ u8 unk160DE; diff --git a/include/ewram.h b/include/ewram.h index d5e1f8ba9..ab4a1cb1e 100644 --- a/include/ewram.h +++ b/include/ewram.h @@ -89,20 +89,10 @@ extern u8 gSharedMem[]; // Battle Struct // For matching purposes, the struct is placed at 0x02000000 and // there's a ton of filler. +// This macro ensures that any changes to the battle struct +// definition will not horribly break things in battle. #define BSTRUCT_OFF(member) (offsetof(struct BattleStruct, member) + ((u8 *)gBattleStruct - gSharedMem)) -#define ewram16060(battler) (gSharedMem[BSTRUCT_OFF(unk16060) + battler]) -#define BATTLE_PARTY_ID(battler) (gSharedMem[BSTRUCT_OFF(unk16064) + battler]) -#define ewram16068arr(i) (gSharedMem[BSTRUCT_OFF(monToSwitchIntoId) + i]) -#define ewram1606Carr(i, a) (gSharedMem[BSTRUCT_OFF(unk1606C) + i + a * 3]) -#define ewram16094arr(battler) (gSharedMem[BSTRUCT_OFF(unk16094) + battler]) -#define eHpOnSwitchout(battler) (gSharedMem[BSTRUCT_OFF(HP_OnSwitchout) + battler * 2]) -#define ewram160C8arr(battler) (gSharedMem[BSTRUCT_OFF(AI_monToSwitchIntoId) + (battler / 2)]) -#define USED_HELD_ITEMS(battler) (*(u16 *)&gSharedMem[BSTRUCT_OFF(usedHeldItems) + 2 * (battler)]) -#define ewram160D4(battler) (gSharedMem[BSTRUCT_OFF(unk160D4) + (battler / 2) * 2]) -#define ewram160D8(battler) (gSharedMem[BSTRUCT_OFF(unk160D8) + (battler / 2)]) -#define ewram160DA(battler) (gSharedMem[BSTRUCT_OFF(unk160DA) + (battler >> 1)]) -#define ewram160E0(i) (gSharedMem[BSTRUCT_OFF(unk160E0) + i]) #define ewram16400 (gSharedMem + 0x16400) // gBattleResources |