summaryrefslogtreecommitdiff
path: root/include/battle.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/battle.h')
-rw-r--r--include/battle.h248
1 files changed, 17 insertions, 231 deletions
diff --git a/include/battle.h b/include/battle.h
index 7c1528072..40a2eba04 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -18,14 +18,6 @@
0x2 bit is responsible for the id of sent out pokemon. 0 means it's the first sent out pokemon, 1 it's the second one. (Triple battle didn't exist at the time yet.)
*/
-#define IDENTITY_PLAYER_MON1 0
-#define IDENTITY_OPPONENT_MON1 1
-#define IDENTITY_PLAYER_MON2 2
-#define IDENTITY_OPPONENT_MON2 3
-
-#define SIDE_PLAYER 0x0
-#define SIDE_OPPONENT 0x1
-
#define GET_BATTLER_POSITION(battler)((gBattlerPositions[battler]))
#define GET_BATTLER_SIDE(battler)((GetBattlerPosition(battler) & BIT_SIDE))
#define GET_BATTLER_SIDE2(battler)((GET_BATTLER_POSITION(battler) & BIT_SIDE))
@@ -36,40 +28,6 @@
#define STEVEN_PARTNER_ID 0xC03
#define SECRET_BASE_OPPONENT 0x400
-#define BATTLE_WON 0x1
-#define BATTLE_LOST 0x2
-#define BATTLE_DREW 0x3
-#define BATTLE_RAN 0x4
-#define BATTLE_PLAYER_TELEPORTED 0x5
-#define BATTLE_POKE_FLED 0x6
-#define BATTLE_CAUGHT 0x7
-#define BATTLE_SAFARI_OUT_OF_BALLS 0x8
-#define BATTLE_FORFEITED 0x9
-#define BATTLE_OPPONENT_TELEPORTED 0xA
-
-#define OUTCOME_LINK_BATTLE_RUN 0x80
-
-#define STATUS_NONE 0x0
-#define STATUS_SLEEP 0x7
-#define STATUS_POISON 0x8
-#define STATUS_BURN 0x10
-#define STATUS_FREEZE 0x20
-#define STATUS_PARALYSIS 0x40
-#define STATUS_TOXIC_POISON 0x80
-#define STATUS_TOXIC_COUNTER 0xF00
-
-#define STATUS_PSN_ANY ((STATUS_POISON | STATUS_TOXIC_POISON))
-#define STATUS_ANY ((STATUS_SLEEP | STATUS_POISON | STATUS_BURN | STATUS_FREEZE | STATUS_PARALYSIS | STATUS_TOXIC_POISON))
-
-#define SIDE_STATUS_REFLECT (1 << 0)
-#define SIDE_STATUS_LIGHTSCREEN (1 << 1)
-#define SIDE_STATUS_X4 (1 << 2)
-#define SIDE_STATUS_SPIKES (1 << 4)
-#define SIDE_STATUS_SAFEGUARD (1 << 5)
-#define SIDE_STATUS_FUTUREATTACK (1 << 6)
-#define SIDE_STATUS_MIST (1 << 8)
-#define SIDE_STATUS_SPIKES_DAMAGED (1 << 9)
-
#define B_ACTION_USE_MOVE 0
#define B_ACTION_USE_ITEM 1
#define B_ACTION_SWITCH 2
@@ -79,7 +37,7 @@
#define B_ACTION_SAFARI_POKEBLOCK 6
#define B_ACTION_SAFARI_GO_NEAR 7
#define B_ACTION_SAFARI_RUN 8
-#define B_ACTION_9 9
+#define B_ACTION_OLDMAN_THROW 9
#define B_ACTION_EXEC_SCRIPT 10
#define B_ACTION_TRY_FINISH 11
#define B_ACTION_FINISHED 12
@@ -87,31 +45,9 @@
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
#define B_ACTION_NONE 0xFF
-#define MOVESTATUS_MISSED (1 << 0)
-#define MOVESTATUS_SUPEREFFECTIVE (1 << 1)
-#define MOVESTATUS_NOTVERYEFFECTIVE (1 << 2)
-#define MOVESTATUS_NOTAFFECTED (1 << 3)
-#define MOVESTATUS_ONEHITKO (1 << 4)
-#define MOVESTATUS_FAILED (1 << 5)
-#define MOVESTATUS_ENDURED (1 << 6)
-#define MOVESTATUS_HUNGON (1 << 7)
-
-#define MOVESTATUS_NOEFFECT ((MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED))
-
#define MAX_TRAINER_ITEMS 4
#define MAX_MON_MOVES 4
-#define BATTLE_TERRAIN_GRASS 0
-#define BATTLE_TERRAIN_LONG_GRASS 1
-#define BATTLE_TERRAIN_SAND 2
-#define BATTLE_TERRAIN_UNDERWATER 3
-#define BATTLE_TERRAIN_WATER 4
-#define BATTLE_TERRAIN_POND 5
-#define BATTLE_TERRAIN_ROCK 6
-#define BATTLE_TERRAIN_CAVE 7
-#define BATTLE_TERRAIN_INSIDE 8
-#define BATTLE_TERRAIN_PLAIN 9
-
// array entries for battle communication
#define MULTIUSE_STATE 0x0
#define CURSOR_POSITION 0x1
@@ -133,29 +69,6 @@
#define MOVE_TARGET_FOES_AND_ALLY 0x20
#define MOVE_TARGET_OPPONENTS_FIELD 0x40
-// defines for the u8 array gTypeEffectiveness
-#define TYPE_EFFECT_ATK_TYPE(i)((gTypeEffectiveness[i + 0]))
-#define TYPE_EFFECT_DEF_TYPE(i)((gTypeEffectiveness[i + 1]))
-#define TYPE_EFFECT_MULTIPLIER(i)((gTypeEffectiveness[i + 2]))
-
-// defines for the gTypeEffectiveness multipliers
-#define TYPE_MUL_NO_EFFECT 0
-#define TYPE_MUL_NOT_EFFECTIVE 5
-#define TYPE_MUL_NORMAL 10
-#define TYPE_MUL_SUPER_EFFECTIVE 20
-
-// special type table Ids
-#define TYPE_FORESIGHT 0xFE
-#define TYPE_ENDTABLE 0xFF
-
-// for battle script commands
-#define CMP_EQUAL 0x0
-#define CMP_NOT_EQUAL 0x1
-#define CMP_GREATER_THAN 0x2
-#define CMP_LESS_THAN 0x3
-#define CMP_COMMON_BITS 0x4
-#define CMP_NO_COMMON_BITS 0x5
-
struct TrainerMonNoItemDefaultMoves
{
u16 iv;
@@ -210,13 +123,8 @@ struct Trainer
/*0x24*/ const union TrainerMonPtr party;
};
-#define PARTY_FLAG_CUSTOM_MOVES 0x1
-#define PARTY_FLAG_HAS_ITEM 0x2
-
extern const struct Trainer gTrainers[];
-#define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F))
-
struct ResourceFlags
{
u32 flags[4];
@@ -373,22 +281,6 @@ extern u8 gActiveBattler;
extern u8 gBattlerTarget;
extern u8 gAbsentBattlerFlags;
-// script's table id to bit
-#define AI_SCRIPT_CHECK_BAD_MOVE (1 << 0)
-#define AI_SCRIPT_TRY_TO_FAINT (1 << 1)
-#define AI_SCRIPT_CHECK_VIABILITY (1 << 2)
-#define AI_SCRIPT_SETUP_FIRST_TURN (1 << 3)
-#define AI_SCRIPT_RISKY (1 << 4)
-#define AI_SCRIPT_PREFER_STRONGEST_MOVE (1 << 5)
-#define AI_SCRIPT_PREFER_BATON_PASS (1 << 6)
-#define AI_SCRIPT_DOUBLE_BATTLE (1 << 7)
-#define AI_SCRIPT_HP_AWARE (1 << 8)
-#define AI_SCRIPT_UNKNOWN (1 << 9)
-// 10 - 28 are not used
-#define AI_SCRIPT_ROAMING (1 << 29)
-#define AI_SCRIPT_SAFARI (1 << 30)
-#define AI_SCRIPT_FIRST_BATTLE (1 << 31)
-
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
struct UsedMoves
@@ -437,10 +329,6 @@ struct BattleResources
extern struct BattleResources *gBattleResources;
-#define BATTLESCRIPTS_STACK (gBattleResources->battleScriptsStack)
-#define BATTLE_CALLBACKS_STACK (gBattleResources->battleCallbackStack)
-#define BATTLE_LVLUP_STATS (gBattleResources->statsBeforeLvlUp)
-
struct BattleResults
{
u8 playerFaintCounter; // 0x0
@@ -521,22 +409,20 @@ struct BattleStruct
u8 expGetterBattlerId;
u8 field_90;
u8 field_91;
- u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT];
+ u8 AI_monToSwitchIntoId[2];
+ u8 field_94;
+ u8 field_95;
u8 field_96;
u8 field_97;
u8 lastTakenMove[MAX_BATTLERS_COUNT * 2 * 2]; // ask gamefreak why they declared it that way
u16 hpOnSwitchout[2];
u8 abilityPreventingSwitchout;
u8 hpScale;
- u8 field_AE;
- u8 field_AF;
- u8 field_B0;
- u8 field_B1;
- u8 field_B2;
- u8 field_B3;
+ u16 savedBattleTypeFlags;
+ void (*savedCallback)(void);
u8 synchronizeMoveEffect;
- u8 field_B5;
- u8 field_B6;
+ u8 multiplayerId;
+ u8 overworldWeatherDone;
u8 atkCancellerTracker;
u16 usedHeldItems[MAX_BATTLERS_COUNT];
u8 chosenItem[4]; // why is this an u8?
@@ -556,7 +442,12 @@ struct BattleStruct
u8 wishPerishSongBattlerId;
u8 field_182;
u8 field_183;
- u8 field_184[124]; // currently unknown
+ u8 field_184;
+ u8 field_185;
+ u8 field_186;
+ u8 field_187;
+ struct BattleEnigmaBerry battleEnigmaBerry;
+ u8 field_1A4[0x5C]; // currently unknown
}; // size == 0x200 bytes
extern struct BattleStruct *gBattleStruct;
@@ -579,72 +470,6 @@ extern struct BattleStruct *gBattleStruct;
gBattleMons[battlerId].type2 = type; \
}
-#define MOVE_EFFECT_SLEEP 0x1
-#define MOVE_EFFECT_POISON 0x2
-#define MOVE_EFFECT_BURN 0x3
-#define MOVE_EFFECT_FREEZE 0x4
-#define MOVE_EFFECT_PARALYSIS 0x5
-#define MOVE_EFFECT_TOXIC 0x6
-#define MOVE_EFFECT_CONFUSION 0x7
-#define MOVE_EFFECT_FLINCH 0x8
-#define MOVE_EFFECT_TRI_ATTACK 0x9
-#define MOVE_EFFECT_UPROAR 0xA
-#define MOVE_EFFECT_PAYDAY 0xB
-#define MOVE_EFFECT_CHARGING 0xC
-#define MOVE_EFFECT_WRAP 0xD
-#define MOVE_EFFECT_RECOIL_25 0xE
-#define MOVE_EFFECT_ATK_PLUS_1 0xF
-#define MOVE_EFFECT_DEF_PLUS_1 0x10
-#define MOVE_EFFECT_SPD_PLUS_1 0x11
-#define MOVE_EFFECT_SP_ATK_PLUS_1 0x12
-#define MOVE_EFFECT_SP_DEF_PLUS_1 0x13
-#define MOVE_EFFECT_ACC_PLUS_1 0x14
-#define MOVE_EFFECT_EVS_PLUS_1 0x15
-#define MOVE_EFFECT_ATK_MINUS_1 0x16
-#define MOVE_EFFECT_DEF_MINUS_1 0x17
-#define MOVE_EFFECT_SPD_MINUS_1 0x18
-#define MOVE_EFFECT_SP_ATK_MINUS_1 0x19
-#define MOVE_EFFECT_SP_DEF_MINUS_1 0x1A
-#define MOVE_EFFECT_ACC_MINUS_1 0x1B
-#define MOVE_EFFECT_EVS_MINUS_1 0x1C
-#define MOVE_EFFECT_RECHARGE 0x1D
-#define MOVE_EFFECT_RAGE 0x1E
-#define MOVE_EFFECT_STEAL_ITEM 0x1F
-#define MOVE_EFFECT_PREVENT_ESCAPE 0x20
-#define MOVE_EFFECT_NIGHTMARE 0x21
-#define MOVE_EFFECT_ALL_STATS_UP 0x22
-#define MOVE_EFFECT_RAPIDSPIN 0x23
-#define MOVE_EFFECT_REMOVE_PARALYSIS 0x24
-#define MOVE_EFFECT_ATK_DEF_DOWN 0x25
-#define MOVE_EFFECT_RECOIL_33_PARALYSIS 0x26
-#define MOVE_EFFECT_ATK_PLUS_2 0x27
-#define MOVE_EFFECT_DEF_PLUS_2 0x28
-#define MOVE_EFFECT_SPD_PLUS_2 0x29
-#define MOVE_EFFECT_SP_ATK_PLUS_2 0x2A
-#define MOVE_EFFECT_SP_DEF_PLUS_2 0x2B
-#define MOVE_EFFECT_ACC_PLUS_2 0x2C
-#define MOVE_EFFECT_EVS_PLUS_2 0x2D
-#define MOVE_EFFECT_ATK_MINUS_2 0x2E
-#define MOVE_EFFECT_DEF_MINUS_2 0x2F
-#define MOVE_EFFECT_SPD_MINUS_2 0x30
-#define MOVE_EFFECT_SP_ATK_MINUS_2 0x31
-#define MOVE_EFFECT_SP_DEF_MINUS_2 0x32
-#define MOVE_EFFECT_ACC_MINUS_2 0x33
-#define MOVE_EFFECT_EVS_MINUS_2 0x34
-#define MOVE_EFFECT_THRASH 0x35
-#define MOVE_EFFECT_KNOCK_OFF 0x36
-#define MOVE_EFFECT_NOTHING_37 0x37
-#define MOVE_EFFECT_NOTHING_38 0x38
-#define MOVE_EFFECT_NOTHING_39 0x39
-#define MOVE_EFFECT_NOTHING_3A 0x3A
-#define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x3B
-#define MOVE_EFFECT_NOTHING_3C 0x3C
-#define MOVE_EFFECT_NOTHING_3D 0x3D
-#define MOVE_EFFECT_NOTHING_3E 0x3E
-#define MOVE_EFFECT_NOTHING_3F 0x3F
-#define MOVE_EFFECT_AFFECTS_USER 0x40
-#define MOVE_EFFECT_CERTAIN 0x80
-
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
#define GET_STAT_BUFF_VALUE2(n)((n & 0xF0))
#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40
@@ -654,32 +479,6 @@ extern struct BattleStruct *gBattleStruct;
#define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7))
-// used in many battle files, it seems as though Hisashi Sogabe wrote
-// some sort of macro to replace the use of actually calling memset.
-// Perhaps it was thought calling memset was much slower?
-
-// The compiler wont allow us to locally declare ptr in this macro; some
-// functions that invoke this macro will not match without this egregeous
-// assumption about the variable names, so in order to avoid this assumption,
-// we opt to pass the variables themselves, even though it is likely that
-// Sogabe assumed the variables were named src and dest. Trust me: I tried to
-// avoid assuming variable names, but the ROM just will not match without the
-// assumptions. Therefore, these macros are bad practice, but I'm putting them
-// here anyway.
-#define MEMSET_ALT(data, c, size, var, dest) \
-{ \
- dest = (u8 *)data; \
- for(var = 0; var < (u32)size; var++) \
- dest[var] = c; \
-} \
-
-#define MEMCPY_ALT(data, dest, size, var, src) \
-{ \
- src = (u8 *)data; \
- for(var = 0; var < (u32)size; var++) \
- dest[var] = src[var]; \
-} \
-
struct BattleScripting
{
s32 painSplitHp;
@@ -708,17 +507,6 @@ struct BattleScripting
u8 field_23;
};
-// functions
-
-// battle_1
-void LoadBattleTextboxAndBackground(void);
-void LoadBattleEntryBackground(void);
-void ApplyPlayerChosenFrameToBattleMenu(void);
-bool8 LoadChosenBattleElement(u8 caseId);
-void DrawMainBattleBackground(void);
-void task00_0800F6FC(u8 taskId);
-void sub_800F324(void);
-
enum
{
BACK_PIC_BRENDAN,
@@ -731,11 +519,6 @@ enum
BACK_PIC_STEVEN
};
-// rom_80A5C6C
-u8 GetBattlerSide(u8 bank);
-u8 GetBattlerPosition(u8 bank);
-u8 GetBattlerAtPosition(u8 bank);
-
struct BattleSpriteInfo
{
u16 invisible : 1; // 0x1
@@ -929,5 +712,8 @@ extern u16 gLastPrintedMoves[MAX_BATTLERS_COUNT];
extern u8 gActionsByTurnOrder[MAX_BATTLERS_COUNT];
extern u8 gChosenActionByBattler[MAX_BATTLERS_COUNT];
extern u8 gBattleTerrain;
+extern struct UnknownPokemonStruct4 gUnknown_2022B58[3];
+extern u16 *gUnknown_2022BC0;
+extern u16 gRandomTurnNumber;
#endif // GUARD_BATTLE_H