decompile battle_ai_script_commands.c
This commit is contained in:
+61
-104
@@ -2,6 +2,7 @@
|
||||
#define GUARD_BATTLE_H
|
||||
|
||||
// should they be included here or included individually by every file?
|
||||
#include "constants/battle.h"
|
||||
#include "battle_util.h"
|
||||
#include "battle_script_commands.h"
|
||||
#include "battle_2.h"
|
||||
@@ -26,9 +27,6 @@
|
||||
#define SIDE_PLAYER 0x0
|
||||
#define SIDE_OPPONENT 0x1
|
||||
|
||||
#define BIT_SIDE 0x1
|
||||
#define BIT_MON 0x2
|
||||
|
||||
#define GET_BANK_IDENTITY(bank)((gBanksByIdentity[bank]))
|
||||
#define GET_BANK_SIDE(bank)((GetBankIdentity(bank) & BIT_SIDE))
|
||||
#define GET_BANK_SIDE2(bank)((GET_BANK_IDENTITY(bank) & BIT_SIDE))
|
||||
@@ -72,9 +70,6 @@
|
||||
#define STEVEN_PARTNER_ID 0xC03
|
||||
#define SECRET_BASE_OPPONENT 0x400
|
||||
|
||||
#define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_x100000 | BATTLE_TYPE_PYRAMID)
|
||||
#define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_x100000)
|
||||
|
||||
#define BATTLE_WON 0x1
|
||||
#define BATTLE_LOST 0x2
|
||||
#define BATTLE_DREW 0x3
|
||||
@@ -100,76 +95,6 @@
|
||||
#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 STATUS2_CONFUSION 0x00000007
|
||||
#define STATUS2_FLINCHED 0x00000008
|
||||
#define STATUS2_UPROAR 0x00000070
|
||||
#define STATUS2_BIDE 0x00000300 // two bits 0x100, 0x200
|
||||
#define STATUS2_LOCK_CONFUSE 0x00000C00
|
||||
#define STATUS2_MULTIPLETURNS 0x00001000
|
||||
#define STATUS2_WRAPPED 0x0000E000
|
||||
#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every bank
|
||||
#define STATUS2_INFATUATED_WITH(bank)((gBitTable[bank] << 16))
|
||||
#define STATUS2_FOCUS_ENERGY 0x00100000
|
||||
#define STATUS2_TRANSFORMED 0x00200000
|
||||
#define STATUS2_RECHARGE 0x00400000
|
||||
#define STATUS2_RAGE 0x00800000
|
||||
#define STATUS2_SUBSTITUTE 0x01000000
|
||||
#define STATUS2_DESTINY_BOND 0x02000000
|
||||
#define STATUS2_ESCAPE_PREVENTION 0x04000000
|
||||
#define STATUS2_NIGHTMARE 0x08000000
|
||||
#define STATUS2_CURSED 0x10000000
|
||||
#define STATUS2_FORESIGHT 0x20000000
|
||||
#define STATUS2_DEFENSE_CURL 0x40000000
|
||||
#define STATUS2_TORMENT 0x80000000
|
||||
|
||||
#define STATUS3_LEECHSEED_BANK 0x3
|
||||
#define STATUS3_LEECHSEED 0x4
|
||||
#define STATUS3_ALWAYS_HITS 0x18 // two bits
|
||||
#define STATUS3_PERISH_SONG 0x20
|
||||
#define STATUS3_ON_AIR 0x40
|
||||
#define STATUS3_UNDERGROUND 0x80
|
||||
#define STATUS3_MINIMIZED 0x100
|
||||
#define STATUS3_ROOTED 0x400
|
||||
#define STATUS3_CHARGED_UP 0x200
|
||||
#define STATUS3_YAWN 0x1800 // two bits
|
||||
#define STATUS3_IMPRISONED_OTHERS 0x2000
|
||||
#define STATUS3_GRUDGE 0x4000
|
||||
#define STATUS3_CANT_SCORE_A_CRIT 0x8000
|
||||
#define STATUS3_MUDSPORT 0x10000
|
||||
#define STATUS3_WATERSPORT 0x20000
|
||||
#define STATUS3_UNDERWATER 0x40000
|
||||
#define STATUS3_INTIMIDATE_POKES 0x80000
|
||||
#define STATUS3_TRACE 0x100000
|
||||
|
||||
#define STATUS3_SEMI_INVULNERABLE ((STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER))
|
||||
|
||||
#define HITMARKER_x10 0x00000010
|
||||
#define HITMARKER_x20 0x00000020
|
||||
#define HITMARKER_DESTINYBOND 0x00000040
|
||||
#define HITMARKER_NO_ANIMATIONS 0x00000080
|
||||
#define HITMARKER_IGNORE_SUBSTITUTE 0x00000100
|
||||
#define HITMARKER_NO_ATTACKSTRING 0x00000200
|
||||
#define HITMARKER_ATTACKSTRING_PRINTED 0x00000400
|
||||
#define HITMARKER_NO_PPDEDUCT 0x00000800
|
||||
#define HITMARKER_PURSUIT_TRAP 0x00001000
|
||||
#define HITMARKER_IGNORE_SAFEGUARD 0x00002000
|
||||
#define HITMARKER_SYNCHRONISE_EFFECT 0x00004000
|
||||
#define HITMARKER_RUN 0x00008000
|
||||
#define HITMARKER_IGNORE_ON_AIR 0x00010000
|
||||
#define HITMARKER_IGNORE_UNDERGROUND 0x00020000
|
||||
#define HITMARKER_IGNORE_UNDERWATER 0x00040000
|
||||
#define HITMARKER_UNABLE_TO_USE_MOVE 0x00080000
|
||||
#define HITMARKER_x100000 0x00100000
|
||||
#define HITMARKER_x200000 0x00200000
|
||||
#define HITMARKER_x400000 0x00400000
|
||||
#define HITMARKER_x800000 0x00800000
|
||||
#define HITMARKER_GRUDGE 0x01000000
|
||||
#define HITMARKER_OBEYS 0x02000000
|
||||
#define HITMARKER_x4000000 0x04000000
|
||||
#define HITMARKER_x8000000 0x08000000
|
||||
#define HITMARKER_FAINTED(bank) ((gBitTable[bank] << 0x1C))
|
||||
#define HITMARKER_UNK(bank) ((0x10000000 << bank))
|
||||
|
||||
#define SIDE_STATUS_REFLECT (1 << 0)
|
||||
#define SIDE_STATUS_LIGHTSCREEN (1 << 1)
|
||||
#define SIDE_STATUS_X4 (1 << 2)
|
||||
@@ -209,20 +134,6 @@
|
||||
#define MAX_TRAINER_ITEMS 4
|
||||
#define MAX_MON_MOVES 4
|
||||
|
||||
#define WEATHER_RAIN_TEMPORARY (1 << 0)
|
||||
#define WEATHER_RAIN_DOWNPOUR (1 << 1)
|
||||
#define WEATHER_RAIN_PERMANENT (1 << 2)
|
||||
#define WEATHER_RAIN_ANY ((WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT))
|
||||
#define WEATHER_SANDSTORM_TEMPORARY (1 << 3)
|
||||
#define WEATHER_SANDSTORM_PERMANENT (1 << 4)
|
||||
#define WEATHER_SANDSTORM_ANY ((WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT))
|
||||
#define WEATHER_SUN_TEMPORARY (1 << 5)
|
||||
#define WEATHER_SUN_PERMANENT (1 << 6)
|
||||
#define WEATHER_SUN_ANY ((WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT))
|
||||
#define WEATHER_HAIL (1 << 7)
|
||||
#define WEATHER_HAIL_ANY ((WEATHER_HAIL))
|
||||
#define WEATHER_ANY ((WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY))
|
||||
|
||||
#define BATTLE_TERRAIN_GRASS 0
|
||||
#define BATTLE_TERRAIN_LONG_GRASS 1
|
||||
#define BATTLE_TERRAIN_SAND 2
|
||||
@@ -507,19 +418,39 @@ struct AI_ThinkingStruct
|
||||
u8 simulatedRNG[4];
|
||||
};
|
||||
|
||||
struct UsedMoves
|
||||
{
|
||||
u16 moves[BATTLE_BANKS_COUNT];
|
||||
u16 unknown[BATTLE_BANKS_COUNT];
|
||||
};
|
||||
extern u8 gActiveBattler;
|
||||
extern u8 gBattlerTarget;
|
||||
extern u8 gAbsentBattlerFlags;
|
||||
|
||||
// TODO: move these to constants/battle.h
|
||||
#define MAX_BATTLERS_COUNT 4
|
||||
#define BIT_FLANK 2
|
||||
|
||||
// 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 BattleHistory
|
||||
{
|
||||
struct UsedMoves usedMoves[BATTLE_BANKS_COUNT];
|
||||
u8 abilities[BATTLE_BANKS_COUNT];
|
||||
u8 itemEffects[BATTLE_BANKS_COUNT];
|
||||
u16 trainerItems[BATTLE_BANKS_COUNT];
|
||||
u8 itemsNo;
|
||||
/*0x00*/ u16 usedMoves[2][8]; // 0xFFFF means move not used (confuse self hit, etc)
|
||||
/*0x20*/ u8 abilities[MAX_BATTLERS_COUNT / 2];
|
||||
/*0x22*/ u8 itemEffects[MAX_BATTLERS_COUNT / 2];
|
||||
/*0x24*/ u16 trainerItems[MAX_BATTLERS_COUNT];
|
||||
/*0x2C*/ u8 itemsNo;
|
||||
};
|
||||
|
||||
struct BattleScriptsStack
|
||||
@@ -631,10 +562,10 @@ struct BattleStruct
|
||||
u8 runTries;
|
||||
u8 caughtMonNick[11];
|
||||
u8 field_78;
|
||||
u8 field_79;
|
||||
u8 field_7A;
|
||||
u8 field_7B;
|
||||
u8 field_7C;
|
||||
u8 safariGoNearCounter;
|
||||
u8 safariPkblThrowCounter;
|
||||
u8 safariEscapeFactor;
|
||||
u8 safariCatchFactor;
|
||||
u8 field_7D;
|
||||
u8 field_7E;
|
||||
u8 formToChangeInto;
|
||||
@@ -835,6 +766,32 @@ 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;
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
#ifndef GUARD_CONSTANTS_BATTLE_H
|
||||
#define GUARD_CONSTANTS_BATTLE_H
|
||||
|
||||
/*
|
||||
* A battler may be in one of four positions on the field. The first bit determines
|
||||
* what side the battler is on, either the player's side or the opponent's side.
|
||||
* The second bit determines what flank the battler is on, either the left or right.
|
||||
* Note that the opponent's flanks are drawn corresponding to their perspective, so
|
||||
* their right mon appears on the left, and their left mon appears on the right.
|
||||
* The battler ID is usually the same as the position, except in the case of link battles.
|
||||
*
|
||||
* + ------------------------- +
|
||||
* | Opponent's side |
|
||||
* | Right Left |
|
||||
* | 3 1 |
|
||||
* | |
|
||||
* | Player's side |
|
||||
* | Left Right |
|
||||
* | 0 2 |
|
||||
* ----------------------------+
|
||||
* | |
|
||||
* | |
|
||||
* +---------------------------+
|
||||
*/
|
||||
|
||||
#define MAX_BATTLERS_COUNT 4
|
||||
|
||||
#define B_POSITION_PLAYER_LEFT 0
|
||||
#define B_POSITION_OPPONENT_LEFT 1
|
||||
#define B_POSITION_PLAYER_RIGHT 2
|
||||
#define B_POSITION_OPPONENT_RIGHT 3
|
||||
|
||||
// These macros can be used with either battler ID or positions to get the partner or the opposite mon
|
||||
#define BATTLE_OPPOSITE(id) ((id) ^ 1)
|
||||
#define BATTLE_PARTNER(id) ((id) ^ 2)
|
||||
|
||||
#define B_SIDE_PLAYER 0
|
||||
#define B_SIDE_OPPONENT 1
|
||||
|
||||
#define B_FLANK_LEFT 0
|
||||
#define B_FLANK_RIGHT 1
|
||||
|
||||
#define BIT_SIDE 1
|
||||
#define BIT_FLANK 2
|
||||
|
||||
// Battle Type Flags
|
||||
#define BATTLE_TYPE_DOUBLE 0x0001
|
||||
#define BATTLE_TYPE_LINK 0x0002
|
||||
#define BATTLE_TYPE_IS_MASTER 0x0004 // In not-link battles, it's always set.
|
||||
#define BATTLE_TYPE_TRAINER 0x0008
|
||||
#define BATTLE_TYPE_FIRST_BATTLE 0x0010
|
||||
#define BATTLE_TYPE_20 0x0020
|
||||
#define BATTLE_TYPE_MULTI 0x0040
|
||||
#define BATTLE_TYPE_SAFARI 0x0080
|
||||
#define BATTLE_TYPE_BATTLE_TOWER 0x0100
|
||||
#define BATTLE_TYPE_WALLY_TUTORIAL 0x0200
|
||||
#define BATTLE_TYPE_ROAMER 0x0400
|
||||
#define BATTLE_TYPE_EREADER_TRAINER 0x0800
|
||||
#define BATTLE_TYPE_KYOGRE_GROUDON 0x1000
|
||||
#define BATTLE_TYPE_LEGENDARY 0x2000
|
||||
#define BATTLE_TYPE_REGI 0x4000
|
||||
#define BATTLE_TYPE_TWO_OPPONENTS 0x8000
|
||||
#define BATTLE_TYPE_DOME 0x10000
|
||||
#define BATTLE_TYPE_PALACE 0x20000
|
||||
#define BATTLE_TYPE_ARENA 0x40000
|
||||
#define BATTLE_TYPE_FACTORY 0x80000
|
||||
#define BATTLE_TYPE_PIKE 0x100000
|
||||
#define BATTLE_TYPE_PYRAMID 0x200000
|
||||
#define BATTLE_TYPE_INGAME_PARTNER 0x400000
|
||||
#define BATTLE_TYPE_x800000 0x800000
|
||||
#define BATTLE_TYPE_RECORDED 0x1000000
|
||||
#define BATTLE_TYPE_x2000000 0x2000000
|
||||
#define BATTLE_TYPE_TRAINER_HILL 0x4000000
|
||||
#define BATTLE_TYPE_SECRET_BASE 0x8000000
|
||||
#define BATTLE_TYPE_GROUDON 0x10000000
|
||||
#define BATTLE_TYPE_KYOGRE 0x20000000
|
||||
#define BATTLE_TYPE_RAYQUAZA 0x40000000
|
||||
#define BATTLE_TYPE_x80000000 0x80000000
|
||||
#define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)
|
||||
#define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE)
|
||||
|
||||
// Battle Outcome defines
|
||||
#define B_OUTCOME_WON 0x1
|
||||
#define B_OUTCOME_LOST 0x2
|
||||
#define B_OUTCOME_DREW 0x3
|
||||
#define B_OUTCOME_RAN 0x4
|
||||
#define B_OUTCOME_PLAYER_TELEPORTED 0x5
|
||||
#define B_OUTCOME_MON_FLED 0x6
|
||||
#define B_OUTCOME_CAUGHT 0x7
|
||||
#define B_OUTCOME_NO_SAFARI_BALLS 0x8
|
||||
#define B_OUTCOME_FORFEITED 0x9
|
||||
#define B_OUTCOME_MON_TELEPORTED 0xA
|
||||
#define B_OUTCOME_LINK_BATTLE_RAN 0x80
|
||||
|
||||
// Non-volatile status conditions
|
||||
// These persist remain outside of battle and after switching out
|
||||
#define STATUS1_NONE 0x0
|
||||
#define STATUS1_SLEEP 0x7
|
||||
#define STATUS1_POISON 0x8
|
||||
#define STATUS1_BURN 0x10
|
||||
#define STATUS1_FREEZE 0x20
|
||||
#define STATUS1_PARALYSIS 0x40
|
||||
#define STATUS1_TOXIC_POISON 0x80
|
||||
#define STATUS1_TOXIC_COUNTER 0xF00
|
||||
#define STATUS1_PSN_ANY (STATUS1_POISON | STATUS1_TOXIC_POISON)
|
||||
#define STATUS1_ANY (STATUS1_SLEEP | STATUS1_POISON | STATUS1_BURN | STATUS1_FREEZE | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON)
|
||||
|
||||
// Volatile status ailments
|
||||
// These are removed after exiting the battle or switching out
|
||||
#define STATUS2_CONFUSION 0x00000007
|
||||
#define STATUS2_FLINCHED 0x00000008
|
||||
#define STATUS2_UPROAR 0x00000070
|
||||
#define STATUS2_BIDE 0x00000300 // two bits 0x100, 0x200
|
||||
#define STATUS2_LOCK_CONFUSE 0x00000C00
|
||||
#define STATUS2_MULTIPLETURNS 0x00001000
|
||||
#define STATUS2_WRAPPED 0x0000E000
|
||||
#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every battler
|
||||
#define STATUS2_INFATUATED_WITH(battler) (gBitTable[battler] << 16)
|
||||
#define STATUS2_FOCUS_ENERGY 0x00100000
|
||||
#define STATUS2_TRANSFORMED 0x00200000
|
||||
#define STATUS2_RECHARGE 0x00400000
|
||||
#define STATUS2_RAGE 0x00800000
|
||||
#define STATUS2_SUBSTITUTE 0x01000000
|
||||
#define STATUS2_DESTINY_BOND 0x02000000
|
||||
#define STATUS2_ESCAPE_PREVENTION 0x04000000
|
||||
#define STATUS2_NIGHTMARE 0x08000000
|
||||
#define STATUS2_CURSED 0x10000000
|
||||
#define STATUS2_FORESIGHT 0x20000000
|
||||
#define STATUS2_DEFENSE_CURL 0x40000000
|
||||
#define STATUS2_TORMENT 0x80000000
|
||||
|
||||
// Seems like per-battler statuses. Not quite sure how to categorize these
|
||||
#define STATUS3_LEECHSEED_BATTLER 0x3
|
||||
#define STATUS3_LEECHSEED 0x4
|
||||
#define STATUS3_ALWAYS_HITS 0x18 // two bits
|
||||
#define STATUS3_PERISH_SONG 0x20
|
||||
#define STATUS3_ON_AIR 0x40
|
||||
#define STATUS3_UNDERGROUND 0x80
|
||||
#define STATUS3_MINIMIZED 0x100
|
||||
#define STATUS3_ROOTED 0x400
|
||||
#define STATUS3_CHARGED_UP 0x200
|
||||
#define STATUS3_YAWN 0x1800 // two bits
|
||||
#define STATUS3_IMPRISONED_OTHERS 0x2000
|
||||
#define STATUS3_GRUDGE 0x4000
|
||||
#define STATUS3_CANT_SCORE_A_CRIT 0x8000
|
||||
#define STATUS3_MUDSPORT 0x10000
|
||||
#define STATUS3_WATERSPORT 0x20000
|
||||
#define STATUS3_UNDERWATER 0x40000
|
||||
#define STATUS3_INTIMIDATE_POKES 0x80000
|
||||
#define STATUS3_TRACE 0x100000
|
||||
#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER)
|
||||
|
||||
// Not really sure what a "hitmarker" is.
|
||||
#define HITMARKER_x10 0x00000010
|
||||
#define HITMARKER_x20 0x00000020
|
||||
#define HITMARKER_DESTINYBOND 0x00000040
|
||||
#define HITMARKER_NO_ANIMATIONS 0x00000080
|
||||
#define HITMARKER_IGNORE_SUBSTITUTE 0x00000100
|
||||
#define HITMARKER_NO_ATTACKSTRING 0x00000200
|
||||
#define HITMARKER_ATTACKSTRING_PRINTED 0x00000400
|
||||
#define HITMARKER_NO_PPDEDUCT 0x00000800
|
||||
#define HITMARKER_SWAP_ATTACKER_TARGET 0x00001000
|
||||
#define HITMARKER_IGNORE_SAFEGUARD 0x00002000
|
||||
#define HITMARKER_SYNCHRONISE_EFFECT 0x00004000
|
||||
#define HITMARKER_RUN 0x00008000
|
||||
#define HITMARKER_IGNORE_ON_AIR 0x00010000
|
||||
#define HITMARKER_IGNORE_UNDERGROUND 0x00020000
|
||||
#define HITMARKER_IGNORE_UNDERWATER 0x00040000
|
||||
#define HITMARKER_UNABLE_TO_USE_MOVE 0x00080000
|
||||
#define HITMARKER_x100000 0x00100000
|
||||
#define HITMARKER_x200000 0x00200000
|
||||
#define HITMARKER_x400000 0x00400000
|
||||
#define HITMARKER_x800000 0x00800000
|
||||
#define HITMARKER_GRUDGE 0x01000000
|
||||
#define HITMARKER_OBEYS 0x02000000
|
||||
#define HITMARKER_x4000000 0x04000000
|
||||
#define HITMARKER_x8000000 0x08000000
|
||||
#define HITMARKER_FAINTED(battler) (gBitTable[battler] << 0x1C)
|
||||
#define HITMARKER_UNK(battler) (0x10000000 << battler)
|
||||
|
||||
// Per-side statuses that affect an entire party
|
||||
#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)
|
||||
|
||||
// Flags describing move's result
|
||||
#define MOVE_RESULT_MISSED (1 << 0)
|
||||
#define MOVE_RESULT_SUPER_EFFECTIVE (1 << 1)
|
||||
#define MOVE_RESULT_NOT_VERY_EFFECTIVE (1 << 2)
|
||||
#define MOVE_RESULT_DOESNT_AFFECT_FOE (1 << 3)
|
||||
#define MOVE_RESULT_ONE_HIT_KO (1 << 4)
|
||||
#define MOVE_RESULT_FAILED (1 << 5)
|
||||
#define MOVE_RESULT_FOE_ENDURED (1 << 6)
|
||||
#define MOVE_RESULT_FOE_HUNG_ON (1 << 7)
|
||||
#define MOVE_RESULT_NO_EFFECT (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED)
|
||||
|
||||
// Battle Weather flags
|
||||
#define WEATHER_RAIN_TEMPORARY (1 << 0)
|
||||
#define WEATHER_RAIN_DOWNPOUR (1 << 1) // unused
|
||||
#define WEATHER_RAIN_PERMANENT (1 << 2)
|
||||
#define WEATHER_RAIN_ANY (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT)
|
||||
#define WEATHER_SANDSTORM_TEMPORARY (1 << 3)
|
||||
#define WEATHER_SANDSTORM_PERMANENT (1 << 4)
|
||||
#define WEATHER_SANDSTORM_ANY (WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT)
|
||||
#define WEATHER_SUN_TEMPORARY (1 << 5)
|
||||
#define WEATHER_SUN_PERMANENT (1 << 6)
|
||||
#define WEATHER_SUN_ANY (WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT)
|
||||
#define WEATHER_HAIL (1 << 7)
|
||||
#define WEATHER_HAIL_ANY (WEATHER_HAIL)
|
||||
#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY)
|
||||
|
||||
// Move Effects
|
||||
#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 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
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_H
|
||||
@@ -0,0 +1,52 @@
|
||||
#ifndef GUARD_CONSTANTS_BATTLE_AI_H
|
||||
#define GUARD_CONSTANTS_BATTLE_AI_H
|
||||
|
||||
// battlers
|
||||
#define AI_TARGET 0
|
||||
#define AI_USER 1
|
||||
#define AI_TARGET_PARTNER 2
|
||||
#define AI_USER_PARTNER 3
|
||||
|
||||
// get_type command
|
||||
#define AI_TYPE1_TARGET 0
|
||||
#define AI_TYPE1_USER 1
|
||||
#define AI_TYPE2_TARGET 2
|
||||
#define AI_TYPE2_USER 3
|
||||
#define AI_TYPE_MOVE 4
|
||||
|
||||
// type effectiveness
|
||||
#define AI_EFFECTIVENESS_x4 160
|
||||
#define AI_EFFECTIVENESS_x2 80
|
||||
#define AI_EFFECTIVENESS_x1 40
|
||||
#define AI_EFFECTIVENESS_x0_5 20
|
||||
#define AI_EFFECTIVENESS_x0_25 10
|
||||
#define AI_EFFECTIVENESS_x0 0
|
||||
|
||||
// ai weather
|
||||
#define AI_WEATHER_SUN 0
|
||||
#define AI_WEATHER_RAIN 1
|
||||
#define AI_WEATHER_SANDSTORM 2
|
||||
#define AI_WEATHER_HAIL 3
|
||||
|
||||
// get_how_powerful_move_is
|
||||
#define MOVE_POWER_DISCOURAGED 0
|
||||
#define MOVE_NOT_MOST_POWERFUL 1
|
||||
#define MOVE_MOST_POWERFUL 2
|
||||
|
||||
// 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)
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_AI_H
|
||||
@@ -68,4 +68,6 @@
|
||||
|
||||
#define WIN_RANGE(a, b) (((a) << 8) | (b))
|
||||
|
||||
#define NAKED __attribute__((naked))
|
||||
|
||||
#endif // GUARD_GBA_DEFINES
|
||||
|
||||
@@ -31,6 +31,24 @@ char* strcpy(char *dst0, const char *src0);
|
||||
#define POKEMON_NAME_LENGTH 10
|
||||
#define OT_NAME_LENGTH 7
|
||||
|
||||
// There are many quirks in the source code which have overarching behavioral differences from
|
||||
// a number of other files. For example, diploma.c seems to declare rodata before each use while
|
||||
// other files declare out of order and must be at the beginning. There are also a number of
|
||||
// macros which differ from one file to the next due to the method of obtaining the result, such
|
||||
// as these below. Because of this, there is a theory (Two Team Theory) that states that these
|
||||
// programming projects had more than 1 "programming team" which utilized different macros for
|
||||
// each of the files that were worked on.
|
||||
#define T1_READ_8(ptr) ((ptr)[0])
|
||||
#define T1_READ_16(ptr) ((ptr)[0] | ((ptr)[1] << 8))
|
||||
#define T1_READ_32(ptr) ((ptr)[0] | ((ptr)[1] << 8) | ((ptr)[2] << 16) | ((ptr)[3] << 24))
|
||||
#define T1_READ_PTR(ptr) (u8*) T1_READ_32(ptr)
|
||||
|
||||
// T2_READ_8 is a duplicate to remain consistent with each group.
|
||||
#define T2_READ_8(ptr) ((ptr)[0])
|
||||
#define T2_READ_16(ptr) ((ptr)[0] + ((ptr)[1] << 8))
|
||||
#define T2_READ_32(ptr) ((ptr)[0] + ((ptr)[1] << 8) + ((ptr)[2] << 16) + ((ptr)[3] << 24))
|
||||
#define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr)
|
||||
|
||||
extern u8 gStringVar1[];
|
||||
extern u8 gStringVar2[];
|
||||
extern u8 gStringVar3[];
|
||||
|
||||
Reference in New Issue
Block a user