Merge pull request #45 from DizzyEggg/decomp_battle4
Decompile Battle 4
This commit is contained in:
+396
-133
@@ -1,8 +1,28 @@
|
||||
#ifndef GUARD_BATTLE_H
|
||||
#define GUARD_BATTLE_H
|
||||
|
||||
/*
|
||||
Banks are a name given to what could be called a 'battlerId' or 'monControllerId'.
|
||||
Each bank has a value consisting of two bits.
|
||||
0x1 bit is responsible for the side, 0 = player's side, 1 = opponent's side.
|
||||
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 BATTLE_BANKS_COUNT 4
|
||||
|
||||
#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 BIT_SIDE 0x1
|
||||
#define BIT_MON 0x2
|
||||
|
||||
#define GET_BANK_SIDE(bank)((GetBankIdentity(bank) & BIT_SIDE))
|
||||
|
||||
#define BATTLE_TYPE_DOUBLE 0x0001
|
||||
#define BATTLE_TYPE_LINK 0x0002
|
||||
#define BATTLE_TYPE_WILD 0x0004
|
||||
@@ -40,9 +60,6 @@
|
||||
|
||||
#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 SIDE_PLAYER 0x0
|
||||
#define SIDE_OPPONENT 0x1
|
||||
|
||||
#define BATTLE_WON 0x1
|
||||
#define BATTLE_LOST 0x2
|
||||
#define BATTLE_DREW 0x3
|
||||
@@ -66,11 +83,12 @@
|
||||
#define STATUS2_CONFUSION 0x00000007
|
||||
#define STATUS2_FLINCHED 0x00000008
|
||||
#define STATUS2_UPROAR 0x00000070
|
||||
#define STATUS2_BIDE 0x00000300 //two bits 0x100 0x200
|
||||
#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
|
||||
#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
|
||||
@@ -86,7 +104,7 @@
|
||||
|
||||
#define STATUS3_LEECHSEED_BANK 0x3
|
||||
#define STATUS3_LEECHSEED 0x4
|
||||
#define STATUS3_ALWAYS_HITS 0x18 //two bits
|
||||
#define STATUS3_ALWAYS_HITS 0x18 // two bits
|
||||
#define STATUS3_PERISH_SONG 0x20
|
||||
#define STATUS3_ON_AIR 0x40
|
||||
#define STATUS3_UNDERGROUND 0x80
|
||||
@@ -94,7 +112,7 @@
|
||||
#define STATUS3_ROOTED 0x400
|
||||
#define STATUS3_CHARGED_UP 0x200
|
||||
#define STATUS3_YAWN 0x1800 //two bits
|
||||
#define STATUS3_IMPRISIONED 0x2000
|
||||
#define STATUS3_IMPRISONED_OTHERS 0x2000
|
||||
#define STATUS3_GRUDGE 0x4000
|
||||
#define STATUS3_CANT_SCORE_A_CRIT 0x8000
|
||||
#define STATUS3_MUDSPORT 0x10000
|
||||
@@ -154,7 +172,7 @@
|
||||
#define ABILITYEFFECT_CHECK_BANK_SIDE 0xD
|
||||
#define ABILITYEFFECT_FIELD_SPORT 0xE
|
||||
#define ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK 0xF
|
||||
#define ABILITYEFFECT_COUNT_OTHER_SIZE 0x10
|
||||
#define ABILITYEFFECT_COUNT_OTHER_SIDE 0x10
|
||||
#define ABILITYEFFECT_COUNT_BANK_SIDE 0x11
|
||||
#define ABILITYEFFECT_COUNT_ON_FIELD 0x12
|
||||
#define ABILITYEFFECT_CHECK_ON_FIELD 0x13
|
||||
@@ -187,27 +205,97 @@
|
||||
#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 REQUEST_ALL_BATTLE 0x0
|
||||
#define REQUEST_SPECIES_BATTLE 0x1
|
||||
#define REQUEST_HELDITEM_BATTLE 0x2
|
||||
#define REQUEST_MOVES_PP_BATTLE 0x3
|
||||
#define REQUEST_PPMOVE1_BATTLE 0x9
|
||||
#define REQUEST_PPMOVE2_BATTLE 0xA
|
||||
#define REQUEST_PPMOVE3_BATTLE 0xB
|
||||
#define REQUEST_PPMOVE4_BATTLE 0xC
|
||||
#define REQUEST_STATUS_BATTLE 0x28
|
||||
#define REQUEST_HP_BATTLE 0x2A
|
||||
#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
|
||||
|
||||
// array entries for battle communication
|
||||
#define MULTIUSE_STATE 0x0
|
||||
#define CURSOR_POSITION 0x1
|
||||
#define TASK_ID 0x1 // task Id and cursor position share the same field
|
||||
#define MOVE_EFFECT_BYTE 0x3
|
||||
#define MULTISTRING_CHOOSER 0x5
|
||||
#define MSG_DISPLAY 0x7
|
||||
|
||||
// functions
|
||||
#define MOVE_TARGET_SELECTED 0x0
|
||||
#define MOVE_TARGET_DEPENDS 0x1
|
||||
#define MOVE_TARGET_USER 0x2
|
||||
#define MOVE_TARGET_RANDOM 0x4
|
||||
#define MOVE_TARGET_x10 0x10
|
||||
#define MOVE_TARGET_BOTH 0x8
|
||||
#define MOVE_TARGET_FOES_AND_ALLY 0x20
|
||||
#define MOVE_TARGET_OPPONENTS_FIELD 0x40
|
||||
|
||||
extern u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg);
|
||||
extern u8 GetBankSide(u8 bank);
|
||||
#define TYPE_MUL_NO_EFFECT 0
|
||||
#define TYPE_MUL_NOT_EFFECTIVE 5
|
||||
#define TYPE_MUL_NORMAL 10
|
||||
#define TYPE_MUL_SUPER_EFFECTIVE 20
|
||||
|
||||
#define BS_GET_TARGET 0
|
||||
#define BS_GET_ATTACKER 1
|
||||
#define BS_GET_EFFECT_BANK 2
|
||||
#define BS_ATTACKER_WITH_PARTNER 4 // for atk98_status_icon_update
|
||||
#define BS_GET_ATTACKER_SIDE 8 // for atk1E_jumpifability
|
||||
#define BS_GET_NOT_ATTACKER_SIDE 9 // for atk1E_jumpifability
|
||||
#define BS_GET_SCRIPTING_BANK 10
|
||||
#define BS_GET_OPPONENT1 12
|
||||
#define BS_GET_PLAYER2 13
|
||||
#define BS_GET_OPPONENT2 14
|
||||
|
||||
// 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 species;
|
||||
u8 lvl;
|
||||
u16 evsValue;
|
||||
};
|
||||
|
||||
struct TrainerMonItemDefaultMoves
|
||||
{
|
||||
u16 species;
|
||||
u8 lvl;
|
||||
u16 evsValue;
|
||||
u16 heldItem;
|
||||
};
|
||||
|
||||
struct TrainerMonNoItemCustomMoves
|
||||
{
|
||||
u16 species;
|
||||
u8 lvl;
|
||||
u16 evsValue;
|
||||
u16 moves[4];
|
||||
};
|
||||
|
||||
struct TrainerMonItemCustomMoves
|
||||
{
|
||||
u16 species;
|
||||
u8 lvl;
|
||||
u16 evsValue;
|
||||
u16 heldItem;
|
||||
u16 moves[4];
|
||||
};
|
||||
|
||||
union TrainerMonPtr
|
||||
{
|
||||
struct TrainerMonNoItemDefaultMoves* NoItemDefaultMoves;
|
||||
struct TrainerMonNoItemCustomMoves* NoItemCustomMoves;
|
||||
struct TrainerMonItemDefaultMoves* ItemDefaultMoves;
|
||||
struct TrainerMonItemCustomMoves* ItemCustomMoves;
|
||||
};
|
||||
|
||||
struct Trainer
|
||||
{
|
||||
@@ -220,9 +308,12 @@ struct Trainer
|
||||
/*0x18*/ bool8 doubleBattle;
|
||||
/*0x1C*/ u32 aiFlags;
|
||||
/*0x20*/ u8 partySize;
|
||||
/*0x24*/ void *party;
|
||||
/*0x24*/ 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))
|
||||
@@ -262,7 +353,8 @@ struct DisableStruct
|
||||
/*0x16*/ u8 isFirstTurn;
|
||||
/*0x17*/ u8 unk17;
|
||||
/*0x18*/ u8 truantCounter : 1;
|
||||
/*0x18*/ u8 unk18_a : 3;
|
||||
/*0x18*/ u8 truantUnknownBit : 1;
|
||||
/*0x18*/ u8 unk18_a_2 : 2;
|
||||
/*0x18*/ u8 unk18_b : 4;
|
||||
/*0x19*/ u8 rechargeCounter;
|
||||
/*0x1A*/ u8 unk1A[2];
|
||||
@@ -312,11 +404,11 @@ extern struct ProtectStruct gProtectStructs[BATTLE_BANKS_COUNT];
|
||||
|
||||
struct SpecialStatus
|
||||
{
|
||||
u8 statLowered : 1;
|
||||
u8 lightningRodRedirected : 1;
|
||||
u8 restoredBankSprite: 1;
|
||||
u8 intimidatedPoke : 1;
|
||||
u8 traced : 1;
|
||||
u8 statLowered : 1; // 0x1
|
||||
u8 lightningRodRedirected : 1; // 0x2
|
||||
u8 restoredBankSprite: 1; // 0x4
|
||||
u8 intimidatedPoke : 1; // 0x8
|
||||
u8 traced : 1; // 0x10
|
||||
u8 flag20 : 1;
|
||||
u8 flag40 : 1;
|
||||
u8 focusBanded : 1;
|
||||
@@ -359,7 +451,7 @@ struct WishFutureKnock
|
||||
u8 wishCounter[BATTLE_BANKS_COUNT];
|
||||
u8 wishUserID[BATTLE_BANKS_COUNT];
|
||||
u8 weatherDuration;
|
||||
u16 knockedOffPokes;
|
||||
u8 knockedOffPokes[2];
|
||||
};
|
||||
|
||||
extern struct WishFutureKnock gWishFutureKnock;
|
||||
@@ -405,13 +497,23 @@ struct BattleCallbacksStack
|
||||
u8 size;
|
||||
};
|
||||
|
||||
struct StatsArray
|
||||
{
|
||||
u16 hp;
|
||||
u16 atk;
|
||||
u16 def;
|
||||
u16 spd;
|
||||
u16 spAtk;
|
||||
u16 spDef;
|
||||
};
|
||||
|
||||
struct BattleResources
|
||||
{
|
||||
struct SecretBaseRecord* secretBase;
|
||||
struct UnknownFlags *flags;
|
||||
struct BattleScriptsStack* battleScriptsStack;
|
||||
struct BattleCallbacksStack* battleCallbackStack;
|
||||
void* statsBeforeLvlUp;
|
||||
struct StatsArray* statsBeforeLvlUp;
|
||||
struct AI_ThinkingStruct *ai;
|
||||
struct BattleHistory *battleHistory;
|
||||
struct BattleScriptsStack *AI_ScriptsStack;
|
||||
@@ -421,16 +523,20 @@ 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
|
||||
u8 opponentFaintCounter; // 0x1
|
||||
u8 unk2; // 0x2
|
||||
u8 playerSwitchesCounter; // 0x2
|
||||
u8 unk3; // 0x3
|
||||
u8 unk4; // 0x4
|
||||
u8 unk5_0:1; // 0x5
|
||||
u8 unk5_1:1; // 0x5
|
||||
u8 caughtMonBall:4; // 0x5
|
||||
u8 unk5_6:1; // 0x5
|
||||
u8 unk5_7:1; // 0x5
|
||||
u16 poke1Species; // 0x6
|
||||
u8 pokeString1[10]; // 0x8
|
||||
u8 unk12;
|
||||
@@ -442,10 +548,10 @@ struct BattleResults
|
||||
u16 lastUsedMove; // 0x22
|
||||
u16 opponentMove; // 0x24
|
||||
u16 opponentSpecies; // 0x26
|
||||
u16 caughtPoke; // 0x28
|
||||
u8 caughtNick[10]; // 0x2A
|
||||
u16 caughtMonSpecies; // 0x28
|
||||
u8 caughtMonNick[10]; // 0x2A
|
||||
u8 filler34[2];
|
||||
u8 unk36[10]; // usedBalls?
|
||||
u8 catchAttempts[10]; // 0x36
|
||||
};
|
||||
|
||||
extern struct BattleResults gBattleResults;
|
||||
@@ -463,46 +569,7 @@ struct BattleStruct
|
||||
u8 wildVictorySong;
|
||||
u8 dynamicMoveType;
|
||||
u8 wrappedBy[4];
|
||||
u8 field_18;
|
||||
u8 field_19;
|
||||
u8 field_1A;
|
||||
u8 field_1B;
|
||||
u8 field_1C;
|
||||
u8 field_1D;
|
||||
u8 field_1E;
|
||||
u8 field_1F;
|
||||
u8 field_20;
|
||||
u8 field_21;
|
||||
u8 field_22;
|
||||
u8 field_23;
|
||||
u8 field_24;
|
||||
u8 field_25;
|
||||
u8 field_26;
|
||||
u8 field_27;
|
||||
u8 field_28;
|
||||
u8 field_29;
|
||||
u8 field_2A;
|
||||
u8 field_2B;
|
||||
u8 field_2C;
|
||||
u8 field_2D;
|
||||
u8 field_2E;
|
||||
u8 field_2F;
|
||||
u8 field_30;
|
||||
u8 field_31;
|
||||
u8 field_32;
|
||||
u8 field_33;
|
||||
u8 field_34;
|
||||
u8 field_35;
|
||||
u8 field_36;
|
||||
u8 field_37;
|
||||
u8 field_38;
|
||||
u8 field_39;
|
||||
u8 field_3A;
|
||||
u8 field_3B;
|
||||
u8 field_3C;
|
||||
u8 field_3D;
|
||||
u8 field_3E;
|
||||
u8 field_3F;
|
||||
u16 assistPossibleMoves[5 * 4]; // 5 mons, each of them knowing 4 moves
|
||||
u8 field_40;
|
||||
u8 field_41;
|
||||
u8 field_42;
|
||||
@@ -519,43 +586,15 @@ struct BattleStruct
|
||||
u8 field_4D;
|
||||
u8 field_4E;
|
||||
u8 field_4F;
|
||||
u8 field_50;
|
||||
u8 field_51;
|
||||
u16 expValue;
|
||||
u8 field_52;
|
||||
u8 field_53;
|
||||
u8 field_54;
|
||||
u8 field_55;
|
||||
u8 field_56;
|
||||
u8 field_57;
|
||||
u8 field_58;
|
||||
u8 field_59;
|
||||
u8 field_5A;
|
||||
u8 field_5B;
|
||||
u8 sentInPokes;
|
||||
u8 field_54[4];
|
||||
u8 field_58[4];
|
||||
u8 field_5C[4];
|
||||
u8 field_60;
|
||||
u8 field_61;
|
||||
u8 field_62;
|
||||
u8 field_63;
|
||||
u8 field_64;
|
||||
u8 field_65;
|
||||
u8 field_66;
|
||||
u8 field_67;
|
||||
u8 field_68;
|
||||
u8 field_69;
|
||||
u8 field_6A;
|
||||
u8 field_6B;
|
||||
u8 field_60[4][3];
|
||||
u8 field_6C;
|
||||
u8 field_6D;
|
||||
u8 field_6E;
|
||||
u8 field_6F;
|
||||
u8 field_70;
|
||||
u8 field_71;
|
||||
u8 field_72;
|
||||
u8 field_73;
|
||||
u8 field_74;
|
||||
u8 field_75;
|
||||
u8 field_76;
|
||||
u8 field_77;
|
||||
u8 caughtMonNick[11];
|
||||
u8 field_78;
|
||||
u8 field_79;
|
||||
u8 field_7A;
|
||||
@@ -585,14 +624,7 @@ struct BattleStruct
|
||||
u8 field_95;
|
||||
u8 field_96;
|
||||
u8 field_97;
|
||||
u8 field_98;
|
||||
u8 field_99;
|
||||
u8 field_9A;
|
||||
u8 field_9B;
|
||||
u8 field_9C;
|
||||
u8 field_9D;
|
||||
u8 field_9E;
|
||||
u8 field_9F;
|
||||
u8 mirrorMoves[8]; // ask gamefreak why they declared it that way
|
||||
u8 field_A0;
|
||||
u8 field_A1;
|
||||
u8 field_A2;
|
||||
@@ -610,21 +642,29 @@ struct BattleStruct
|
||||
u8 field_B5;
|
||||
u8 field_B6;
|
||||
u8 field_B7;
|
||||
u16 usedHeldItems[4];
|
||||
u16 usedHeldItems[BATTLE_BANKS_COUNT];
|
||||
u8 field_C0[8];
|
||||
u16 choicedMove[4];
|
||||
u8 field_D0[8];
|
||||
u16 choicedMove[BATTLE_BANKS_COUNT];
|
||||
u16 changedItems[BATTLE_BANKS_COUNT];
|
||||
u8 intimidateBank;
|
||||
u8 fillerD9[0xDA-0xD9];
|
||||
u8 field_DA;
|
||||
u8 turnSideTracker;
|
||||
u8 fillerDC[0xDF-0xDC];
|
||||
u8 field_DF;
|
||||
u8 fillerE0[0x1A0-0xE0];
|
||||
u8 mirrorMoveArrays[32];
|
||||
u16 castformPalette[4][16];
|
||||
u8 field_180[32];
|
||||
u8 field_1A0;
|
||||
u8 field_1A1;
|
||||
u8 filler1A2;
|
||||
u8 atkCancellerTracker;
|
||||
u8 field_1A4[240];
|
||||
u8 field_294[4];
|
||||
u8 field_298[8];
|
||||
u8 field_2A0;
|
||||
u8 field_2A1;
|
||||
u8 field_2A2;
|
||||
};
|
||||
|
||||
extern struct BattleStruct* gBattleStruct;
|
||||
@@ -636,19 +676,153 @@ extern struct BattleStruct* gBattleStruct;
|
||||
var2[offsetof(struct structName, offsetField)] = value; \
|
||||
}
|
||||
|
||||
#define GET_MOVE_TYPE(move, typeArg) \
|
||||
{ \
|
||||
if (gBattleStruct->dynamicMoveType) \
|
||||
typeArg = gBattleStruct->dynamicMoveType & 0x3F; \
|
||||
else \
|
||||
typeArg = gBattleMoves[move].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
|
||||
|
||||
// battle animations ids
|
||||
|
||||
#define B_ANIM_CASTFORM_CHANGE 0x0
|
||||
#define B_ANIM_STATS_CHANGE 0x1
|
||||
#define B_ANIM_SUBSTITUTE_FADE 0x2
|
||||
#define B_ANIM_SUBSTITUTE_APPEAR 0x3
|
||||
#define B_ANIM_x4 0x4
|
||||
#define B_ANIM_ITEM_KNOCKOFF 0x5
|
||||
#define B_ANIM_TURN_TRAP 0x6
|
||||
#define B_ANIM_ITEM_EFFECT 0x7
|
||||
#define B_ANIM_SMOKEBALL_ESCAPE 0x8
|
||||
#define B_ANIM_HANGED_ON 0x9
|
||||
#define B_ANIM_RAIN_CONTINUES 0xA
|
||||
#define B_ANIM_SUN_CONTINUES 0xB
|
||||
#define B_ANIM_SANDSTORM_CONTINUES 0xC
|
||||
#define B_ANIM_HAIL_CONTINUES 0xD
|
||||
#define B_ANIM_LEECH_SEED_DRAIN 0xE
|
||||
#define B_ANIM_MON_HIT 0xF
|
||||
#define B_ANIM_ITEM_STEAL 0x10
|
||||
#define B_ANIM_SNATCH_MOVE 0x11
|
||||
#define B_ANIM_FUTURE_SIGHT_HIT 0x12
|
||||
#define B_ANIM_x13 0x13
|
||||
#define B_ANIM_x14 0x14
|
||||
#define B_ANIM_INGRAIN_HEAL 0x15
|
||||
#define B_ANIM_WISH_HEAL 0x16
|
||||
#define B_ANIM_x17 0x17
|
||||
#define B_ANIM_x18 0x18
|
||||
#define B_ANIM_x19 0x19
|
||||
#define B_ANIM_x1A 0x1A
|
||||
#define B_ANIM_x1B 0x1B
|
||||
#define B_ANIM_x1C 0x1C
|
||||
#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 ATK4F_DONT_CHECK_STATUSES 0x80
|
||||
|
||||
#define VARIOUS_CANCEL_MULTI_TURN_MOVES 0
|
||||
#define VARIOUS_SET_MAGIC_COAT_TARGET 1
|
||||
#define VARIOUS_GET_MOVE_TARGET 3
|
||||
#define VARIOUS_RESET_INTIMIDATE_TRACE_BITS 5
|
||||
#define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6
|
||||
#define VARIOUS_WAIT_CRY 18
|
||||
#define VARIOUS_RETURN_OPPONENT_MON1 19
|
||||
#define VARIOUS_RETURN_OPPONENT_MON2 20
|
||||
#define VARIOUS_SET_TELEPORT_OUTCOME 25
|
||||
#define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26
|
||||
|
||||
#define ATK80_DMG_CHANGE_SIGN 0
|
||||
#define ATK80_DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP 1
|
||||
#define ATK80_DMG_DOUBLED 2
|
||||
|
||||
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
|
||||
#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40
|
||||
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit
|
||||
|
||||
#define STAT_CHANGE_BS_PTR 0x1
|
||||
#define STAT_CHANGE_NOT_PROTECT_AFFECTED 0x20
|
||||
|
||||
#define STAT_CHANGE_WORKED 0
|
||||
#define STAT_CHANGE_DIDNT_WORK 1
|
||||
|
||||
#define SET_STAT_BUFF_ID(n)((n & 0xF))
|
||||
#define SET_STAT_BUFF_VALUE(n)(((s8)(((s8)(n) << 4)) & 0xF0))
|
||||
|
||||
struct BattleScripting
|
||||
{
|
||||
u8 field_0;
|
||||
u8 field_1;
|
||||
u8 field_2;
|
||||
u8 field_3;
|
||||
u32 bideDmg;
|
||||
u8 field_8;
|
||||
u8 field_9;
|
||||
u8 field_A;
|
||||
u8 field_B;
|
||||
u8 field_C;
|
||||
u8 field_D;
|
||||
s32 painSplitHp;
|
||||
s32 bideDmg;
|
||||
u8 multihitString[6];
|
||||
u8 dmgMultiplier;
|
||||
u8 field_F;
|
||||
u8 animArg1;
|
||||
@@ -659,13 +833,102 @@ struct BattleScripting
|
||||
u8 field_15;
|
||||
u8 field_16;
|
||||
u8 bank;
|
||||
u8 field_18;
|
||||
u8 field_19;
|
||||
u8 animTurn;
|
||||
u8 animTargetsHit;
|
||||
u8 statChanger;
|
||||
u8 field_1B;
|
||||
u8 atk23_state;
|
||||
u8 field_1D;
|
||||
u8 atk6C_state;
|
||||
u8 learnMoveState;
|
||||
u8 field_20;
|
||||
};
|
||||
|
||||
extern struct BattleScripting gBattleScripting;
|
||||
|
||||
// functions
|
||||
|
||||
// battle_2
|
||||
void CancelMultiTurnMoves(u8 bank);
|
||||
void PressurePPLose(u8 bankAtk, u8 bankDef, u16 move);
|
||||
void PrepareStringBattle(u16 stringId, u8 bank);
|
||||
u8 GetBattleBank(u8 caseId);
|
||||
void UndoEffectsAfterFainting(void);
|
||||
bool8 HasMoveFailed(u8 bank);
|
||||
void SwitchInClearStructs(void);
|
||||
void sub_803BDA0(u8 bank);
|
||||
void sub_803FA70(u8 bank);
|
||||
void BattleMainCB2(void);
|
||||
void VBlankCB_Battle(void);
|
||||
void ResetSentPokesToOpponentValue(void);
|
||||
bool8 CanRunFromBattle(u8 bank);
|
||||
bool8 IsRunningFromBattleImpossible(void);
|
||||
void PressurePPLoseOnUsingPerishSong(u8 bankAtk);
|
||||
void PressurePPLoseOnUsingImprision(u8 bankAtk);
|
||||
|
||||
// battle_3
|
||||
#define MOVE_LIMITATION_ZEROMOVE (1 << 0)
|
||||
#define MOVE_LIMITATION_PP (1 << 1)
|
||||
#define MOVE_LIMITATION_DISABLED (1 << 2)
|
||||
#define MOVE_LIMITATION_TORMENTED (1 << 3)
|
||||
#define MOVE_LIMITATION_TAUNT (1 << 4)
|
||||
#define MOVE_LIMITATION_IMPRISION (1 << 5)
|
||||
|
||||
void BattleScriptPush(const u8* bsPtr);
|
||||
void BattleScriptPushCursor(void);
|
||||
void BattleScriptPop(void);
|
||||
u8 sub_803FB4C(void); // msg, can't select a move
|
||||
u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check);
|
||||
bool8 AreAllMovesUnusable(void);
|
||||
u8 GetImprisonedMovesCount(u8 bank, u16 move);
|
||||
u8 UpdateTurnCounters(void);
|
||||
u8 TurnBasedEffects(void);
|
||||
bool8 sub_8041364(void);
|
||||
bool8 sub_8041728(void);
|
||||
void b_clear_atk_up_if_hit_flag_unless_enraged(void);
|
||||
u8 AtkCanceller_UnableToUseMove(void);
|
||||
bool8 sub_80423F4(u8 bank, u8 r1, u8 r2);
|
||||
u8 CastformDataTypeChange(u8 bank);
|
||||
u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg);
|
||||
void BattleScriptExecute(const u8* BS_ptr);
|
||||
void BattleScriptPushCursorAndCallback(const u8* BS_ptr);
|
||||
u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn);
|
||||
void sub_8045868(u8 bank);
|
||||
void sub_80458B4(void);
|
||||
u8 GetMoveTarget(u16 move, u8 useMoveTarget);
|
||||
u8 IsPokeDisobedient(void);
|
||||
|
||||
// battle_script_commands
|
||||
void AI_CalcDmg(u8 bankAtk, u8 bankDef);
|
||||
u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef);
|
||||
u8 AI_TypeCalc(u16 move, u16 species, u8 ability);
|
||||
u8 BankGetTurnOrder(u8 bank);
|
||||
void SetMoveEffect(bool8 primary, u8 certain);
|
||||
void BattleDestroyCursorAt(u8 cursorPosition);
|
||||
void BattleCreateCursorAt(u8 cursorPosition);
|
||||
void BufferMoveToLearnIntoBattleTextBuff2(void);
|
||||
void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags);
|
||||
bool8 UproarWakeUpCheck(u8 bank);
|
||||
|
||||
extern void (* const gBattleScriptingCommandsTable[])(void);
|
||||
extern const u8 gUnknown_0831C494[];
|
||||
|
||||
// battle_5
|
||||
void AdjustFriendshipOnBattleFaint(u8 bank);
|
||||
void sub_80571DC(u8 bank, u8 arg1);
|
||||
u32 sub_805725C(u8 bank);
|
||||
|
||||
// battle 7
|
||||
void BattleMusicStop(void);
|
||||
void sub_805E990(struct Pokemon* mon, u8 bank);
|
||||
|
||||
// rom_80A5C6C
|
||||
u8 GetBankSide(u8 bank);
|
||||
u8 GetBankIdentity(u8 bank);
|
||||
u8 GetBankByIdentity(u8 bank);
|
||||
|
||||
// Move this somewhere else
|
||||
|
||||
#include "sprite.h"
|
||||
|
||||
struct BattleSpritesGfx
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef GUARD_BATTLE_AI_H
|
||||
#define GUARD_BATTLE_AI_H
|
||||
#ifndef GUARD_BATTLE_AI_SCRIPT_COMMANDS_H
|
||||
#define GUARD_BATTLE_AI_SCRIPT_COMMANDS_H
|
||||
|
||||
void BattleAI_HandleItemUseBeforeAISetup(u8 defaultScoreMoves);
|
||||
void BattleAI_SetupAIData(u8 defaultScoreMoves);
|
||||
@@ -10,4 +10,4 @@ void ClearBankAbilityHistory(u8 bank);
|
||||
void RecordItemEffectBattle(u8 bank, u8 itemEffect);
|
||||
void ClearBankItemEffectHistory(u8 bank);
|
||||
|
||||
#endif // GUARD_BATTLE_AI_H
|
||||
#endif // GUARD_BATTLE_AI_SCRIPT_COMMANDS_H
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef GUARD_BATTLE_CONTROLLERS_H
|
||||
#define GUARD_BATTLE_CONTROLLERS_H
|
||||
|
||||
struct HpAndStatus
|
||||
{
|
||||
u16 hp;
|
||||
u32 status;
|
||||
};
|
||||
|
||||
struct MovePpInfo
|
||||
{
|
||||
u16 move[4];
|
||||
u8 pp[4];
|
||||
u8 ppBonuses;
|
||||
};
|
||||
|
||||
#define REQUEST_ALL_BATTLE 0x0
|
||||
#define REQUEST_SPECIES_BATTLE 0x1
|
||||
#define REQUEST_HELDITEM_BATTLE 0x2
|
||||
#define REQUEST_MOVES_PP_BATTLE 0x3
|
||||
#define REQUEST_PPMOVE1_BATTLE 0x9
|
||||
#define REQUEST_PPMOVE2_BATTLE 0xA
|
||||
#define REQUEST_PPMOVE3_BATTLE 0xB
|
||||
#define REQUEST_PPMOVE4_BATTLE 0xC
|
||||
#define REQUEST_STATUS_BATTLE 0x28
|
||||
#define REQUEST_HP_BATTLE 0x2A
|
||||
|
||||
// rom3.s, emitters
|
||||
void EmitSetMonData(u8 bufferId, u8 request, u8 c, u8 bytes, void *data);
|
||||
void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct* disableStructPtr, u8 multihit);
|
||||
void EmitHealthBarUpdate(u8 bufferId, u16 hpValue);
|
||||
void EmitEffectivenessSound(u8 bufferId, u16 songId);
|
||||
void EmitPlaySound(u8 bufferId, u16 songId, u8 arg2);
|
||||
void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringId);
|
||||
void EmitFaintAnimation(u8 bufferId);
|
||||
void Emit_x2A(u8 bufferId);
|
||||
void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints);
|
||||
void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
|
||||
void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
|
||||
void EmitReturnPokeToBall(u8 bufferId, u8 arg1);
|
||||
void EmitGetMonData(u8 bufferId, u8 arg1, u8 arg2);
|
||||
void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit);
|
||||
void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, const u8* arg4);
|
||||
void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, u8 arg2);
|
||||
void EmitTrainerSlide(u8 bufferId);
|
||||
void EmitTrainerSlideBack(u8 bufferId);
|
||||
void EmitFaintingCry(u8 bufferId);
|
||||
void Emit_x37(u8 bufferId, u8 arg1);
|
||||
void EmitHitAnimation(u8 bufferId);
|
||||
void EmitCmd48(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2);
|
||||
void EmitCmd49(u8 bufferId);
|
||||
void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status);
|
||||
void EmitCmd13(u8 bufferId);
|
||||
void EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2);
|
||||
|
||||
#define RESET_ACTION_MOVE_SELECTION 0
|
||||
#define RESET_ACTION_SELECTION 1
|
||||
#define RESET_MOVE_SELECTION 2
|
||||
|
||||
void EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
|
||||
|
||||
#define BALL_NO_SHAKES 0
|
||||
#define BALL_1_SHAKE 1
|
||||
#define BALL_2_SHAKES 2
|
||||
#define BALL_3_SHAKES_FAIL 3
|
||||
#define BALL_3_SHAKES_SUCCESS 4
|
||||
#define BALL_TRAINER_BLOCK 5
|
||||
|
||||
void EmitBallThrow(u8 bufferId, u8 caseId);
|
||||
|
||||
void MarkBufferBankForExecution(u8 bank);
|
||||
|
||||
#endif // GUARD_BATTLE_CONTROLLERS_H
|
||||
+190
-2
@@ -1,6 +1,191 @@
|
||||
#ifndef GUARD_BATTLE_MESSAGE_H
|
||||
#define GUARD_BATTLE_MESSAGE_H
|
||||
|
||||
// for 0xFD
|
||||
|
||||
#define B_TXT_BUFF1 00
|
||||
#define B_TXT_BUFF2 01
|
||||
#define B_TXT_COPY_VAR_1 02
|
||||
#define B_TXT_COPY_VAR_2 03
|
||||
#define B_TXT_COPY_VAR_3 04
|
||||
#define B_TXT_PLAYER_MON1_NAME 05
|
||||
#define B_TXT_OPPONENT_MON1_NAME 06
|
||||
#define B_TXT_PLAYER_MON2_NAME 07
|
||||
#define B_TXT_OPPONENT_MON2_NAME 08
|
||||
#define B_TXT_LINK_PLAYER_MON1_NAME 09
|
||||
#define B_TXT_LINK_OPPONENT_MON1_NAME 0A
|
||||
#define B_TXT_LINK_PLAYER_MON2_NAME 0B
|
||||
#define B_TXT_LINK_OPPONENT_MON2_NAME 0C
|
||||
#define B_TXT_ATK_NAME_WITH_PREFIX_MON1 0D
|
||||
#define B_TXT_ATK_NAME 0E
|
||||
#define B_TXT_ATK_NAME_WITH_PREFIX 0F
|
||||
#define B_TXT_DEF_NAME_WITH_PREFIX 10
|
||||
#define B_TXT_EFF_NAME_WITH_PREFIX 11 // EFF = short for gEffectBank
|
||||
#define B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX 12
|
||||
#define B_TXT_ACTIVE_NAME_WITH_PREFIX 13
|
||||
#define B_TXT_CURRENT_MOVE 14
|
||||
#define B_TXT_LAST_MOVE 15
|
||||
#define B_TXT_LAST_ITEM 16
|
||||
#define B_TXT_LAST_ABILITY 17
|
||||
#define B_TXT_ATK_ABILITY 18
|
||||
#define B_TXT_DEF_ABILITY 19
|
||||
#define B_TXT_SCR_ACTIVE_ABILITY 1A
|
||||
#define B_TXT_EFF_ABILITY 1B
|
||||
#define B_TXT_TRAINER1_CLASS 1C
|
||||
#define B_TXT_TRAINER1_NAME 1D
|
||||
#define B_TXT_1E 1E // trainer name for a link player
|
||||
#define B_TXT_1F 1F // trainer name for a link player
|
||||
#define B_TXT_20 20 // trainer name for a link player
|
||||
#define B_TXT_21 21 // trainer name for a link player
|
||||
#define B_TXT_22 22 // trainer name for a link player
|
||||
#define B_TXT_PLAYER_NAME 23
|
||||
#define B_TXT_TRAINER1_LOSE_TEXT 24
|
||||
#define B_TXT_TRAINER1_WIN_TEXT 25
|
||||
#define B_TXT_26 26
|
||||
#define B_TXT_PC_CREATOR_NAME 27
|
||||
#define B_TXT_ATK_PREFIX1 28
|
||||
#define B_TXT_DEF_PREFIX1 29
|
||||
#define B_TXT_ATK_PREFIX2 2A
|
||||
#define B_TXT_DEF_PREFIX2 2B
|
||||
#define B_TXT_ATK_PREFIX3 2C
|
||||
#define B_TXT_DEF_PREFIX3 2D
|
||||
#define B_TXT_TRAINER2_CLASS 2E
|
||||
#define B_TXT_TRAINER2_NAME 2F
|
||||
#define B_TXT_TRAINER2_LOSE_TEXT 30
|
||||
#define B_TXT_TRAINER2_WIN_TEXT 31
|
||||
#define B_TXT_PARTNER_CLASS 32
|
||||
#define B_TXT_PARTNER_NAME 33
|
||||
#define B_TXT_BUFF3 34
|
||||
|
||||
// for B_TXT_BUFF1, B_TXT_BUFF2 and B_TXT_BUFF3
|
||||
|
||||
#define B_BUFF_STRING 0
|
||||
#define B_BUFF_NUMBER 1
|
||||
#define B_BUFF_MOVE 2
|
||||
#define B_BUFF_TYPE 3
|
||||
#define B_BUFF_MON_NICK_WITH_PREFIX 4
|
||||
#define B_BUFF_STAT 5
|
||||
#define B_BUFF_SPECIES 6
|
||||
#define B_BUFF_MON_NICK 7
|
||||
#define B_BUFF_NEGATIVE_FLAVOUR 8
|
||||
#define B_BUFF_ABILITY 9
|
||||
#define B_BUFF_ITEM 10
|
||||
|
||||
#define B_BUFF_PLACEHOLDER_BEGIN 0xFD
|
||||
#define B_BUFF_EOS 0xFF
|
||||
|
||||
#define PREPARE_STAT_BUFFER(textVar, statId) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_STAT; \
|
||||
textVar[2] = statId; \
|
||||
textVar[3] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_ABILITY_BUFFER(textVar, abilityId) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_ABILITY; \
|
||||
textVar[2] = abilityId; \
|
||||
textVar[3] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_TYPE_BUFFER(textVar, typeId) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_TYPE; \
|
||||
textVar[2] = typeId; \
|
||||
textVar[3] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_BYTE_NUMBER_BUFFER(textVar, maxDigits, number) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_NUMBER; \
|
||||
textVar[2] = 1; \
|
||||
textVar[3] = maxDigits; \
|
||||
textVar[4] = (number); \
|
||||
textVar[5] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_HWORD_NUMBER_BUFFER(textVar, maxDigits, number) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_NUMBER; \
|
||||
textVar[2] = 2; \
|
||||
textVar[3] = maxDigits; \
|
||||
textVar[4] = (number); \
|
||||
textVar[5] = (number & 0x0000FF00) >> 8; \
|
||||
textVar[6] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_WORD_NUMBER_BUFFER(textVar, maxDigits, number) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_NUMBER; \
|
||||
textVar[2] = 4; \
|
||||
textVar[3] = maxDigits; \
|
||||
textVar[4] = (number); \
|
||||
textVar[5] = (number & 0x0000FF00) >> 8; \
|
||||
textVar[6] = (number & 0x00FF0000) >> 16; \
|
||||
textVar[7] = (number & 0xFF000000) >> 24; \
|
||||
textVar[8] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_STRING_BUFFER(textVar, stringId) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_STRING; \
|
||||
textVar[2] = stringId; \
|
||||
textVar[3] = (stringId & 0xFF00) >> 8; \
|
||||
textVar[4] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_MOVE_BUFFER(textVar, move) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_MOVE; \
|
||||
textVar[2] = move; \
|
||||
textVar[3] = (move & 0xFF00) >> 8; \
|
||||
textVar[4] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_ITEM_BUFFER(textVar, item) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_ITEM; \
|
||||
textVar[2] = item; \
|
||||
textVar[3] = (item & 0xFF00) >> 8; \
|
||||
textVar[4] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_SPECIES_BUFFER(textVar, species) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_SPECIES; \
|
||||
textVar[2] = species; \
|
||||
textVar[3] = (species & 0xFF00) >> 8; \
|
||||
textVar[4] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_MON_NICK_WITH_PREFIX_BUFFER(textVar, bank, partyId) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_MON_NICK_WITH_PREFIX; \
|
||||
textVar[2] = bank; \
|
||||
textVar[3] = partyId; \
|
||||
textVar[4] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
#define PREPARE_MON_NICK_BUFFER(textVar, bank, partyId) \
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_MON_NICK; \
|
||||
textVar[2] = bank; \
|
||||
textVar[3] = partyId; \
|
||||
textVar[4] = B_BUFF_EOS; \
|
||||
}
|
||||
|
||||
struct StringInfoBattle
|
||||
{
|
||||
u16 currentMove;
|
||||
@@ -17,12 +202,15 @@ struct StringInfoBattle
|
||||
};
|
||||
|
||||
void BufferStringBattle(u16 stringID);
|
||||
u32 StrCpyDecodeToDisplayedStringBattle(const u8* src);
|
||||
u32 StrCpyDecodeBattle(const u8* src, u8* dst);
|
||||
u32 BattleStringExpandPlaceholdersToDisplayedString(const u8* src);
|
||||
u32 BattleStringExpandPlaceholders(const u8* src, u8* dst);
|
||||
void sub_814F9EC(const u8* text, u8 arg1);
|
||||
|
||||
extern u8 gBattleTextBuff1[];
|
||||
extern u8 gBattleTextBuff2[];
|
||||
extern u8 gBattleTextBuff3[];
|
||||
extern u8 gDisplayedStringBattle[];
|
||||
|
||||
extern const u8* const gRefereeStringsTable[];
|
||||
|
||||
#endif // GUARD_BATTLE_MESSAGE_H
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef GUARD_CALCULATE_BASE_DAMAGE_H
|
||||
#define GUARD_CALCULATE_BASE_DAMAGE_H
|
||||
|
||||
s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 bankAtk, u8 bankDef);
|
||||
|
||||
#endif // GUARD_CALCULATE_BASE_DAMAGE_H
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef GUARD_MAIL_H
|
||||
#define GUARD_MAIL_H
|
||||
|
||||
#include "items.h"
|
||||
|
||||
#define IS_ITEM_MAIL(itemId)((itemId == ITEM_ORANGE_MAIL \
|
||||
|| itemId == ITEM_HARBOR_MAIL \
|
||||
|| itemId == ITEM_GLITTER_MAIL \
|
||||
|| itemId == ITEM_MECH_MAIL \
|
||||
|| itemId == ITEM_WOOD_MAIL \
|
||||
|| itemId == ITEM_WAVE_MAIL \
|
||||
|| itemId == ITEM_BEAD_MAIL \
|
||||
|| itemId == ITEM_SHADOW_MAIL \
|
||||
|| itemId == ITEM_TROPIC_MAIL \
|
||||
|| itemId == ITEM_DREAM_MAIL \
|
||||
|| itemId == ITEM_FAB_MAIL \
|
||||
|| itemId == ITEM_RETRO_MAIL))
|
||||
|
||||
#endif // GUARD_MAIL_H
|
||||
+3
-1
@@ -360,4 +360,6 @@ enum
|
||||
MOVE_PSYCHO_BOOST,
|
||||
};
|
||||
|
||||
#endif // GUARD_MOVES_H
|
||||
#define LAST_MOVE_INDEX MOVE_PSYCHO_BOOST
|
||||
|
||||
#endif // GUARD_MOVES_H
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef GUARD_NAMING_SCREEN_H
|
||||
#define GUARD_NAMING_SCREEN_H
|
||||
|
||||
#define NAMING_SCREEN_PLAYER 0
|
||||
#define NAMING_SCREEN_BOX 1
|
||||
#define NAMING_SCREEN_CAUGHT_MON 2
|
||||
#define NAMING_SCREEN_3 3
|
||||
#define NAMING_SCREEN_WANDA 4
|
||||
|
||||
void DoNamingScreen(u8 caseId, u8* dst, u16 monSpecies, u8 monGender, u32 monPersonality, void (*callback)(void));
|
||||
|
||||
#endif // GUARD_NAMING_SCREEN_H
|
||||
@@ -6,6 +6,7 @@ const u8 *GetPokemonCategory(u16);
|
||||
u16 GetPokedexHeightWeight(u16 dexNum, u8 data);
|
||||
u16 GetNationalPokedexCount(u8);
|
||||
u16 GetHoennPokedexCount(u8);
|
||||
u8 CreateDexDisplayMonDataTask(u16 dexNum, u32 trainerId, u32 personality);
|
||||
|
||||
enum
|
||||
{
|
||||
|
||||
+14
-1
@@ -126,6 +126,8 @@
|
||||
#define TYPE_DRAGON 0x10
|
||||
#define TYPE_DARK 0x11
|
||||
|
||||
#define NUMBER_OF_MON_TYPES 0x12
|
||||
|
||||
#define PARTY_SIZE 6
|
||||
#define MAX_TOTAL_EVS 510
|
||||
#define NUM_STATS 6
|
||||
@@ -333,6 +335,8 @@ struct UnknownPokemonStruct
|
||||
u8 friendship;
|
||||
};
|
||||
|
||||
#define BATTLE_STATS_NO 8
|
||||
|
||||
struct BattlePokemon
|
||||
{
|
||||
/*0x00*/ u16 species;
|
||||
@@ -350,7 +354,7 @@ struct BattlePokemon
|
||||
/*0x17*/ u32 spDefenseIV:5;
|
||||
/*0x17*/ u32 isEgg:1;
|
||||
/*0x17*/ u32 altAbility:1;
|
||||
/*0x18*/ s8 statStages[8];
|
||||
/*0x18*/ s8 statStages[BATTLE_STATS_NO];
|
||||
/*0x20*/ u8 ability;
|
||||
/*0x21*/ u8 type1;
|
||||
/*0x22*/ u8 type2;
|
||||
@@ -443,6 +447,7 @@ struct BattleMove
|
||||
#define FLAG_PROTECT_AFFECTED 0x2
|
||||
#define FLAG_MAGICCOAT_AFFECTED 0x4
|
||||
#define FLAG_SNATCH_AFFECTED 0x8
|
||||
#define FLAG_MIRROR_MOVE_AFFECTED 0x10
|
||||
#define FLAG_KINGSROCK_AFFECTED 0x20
|
||||
|
||||
struct SpindaSpot
|
||||
@@ -520,6 +525,7 @@ extern struct PokemonStorage* gPokemonStoragePtr;
|
||||
extern const u32 gExperienceTables[][MAX_MON_LEVEL + 1];
|
||||
extern const u16 *const gLevelUpLearnsets[];
|
||||
|
||||
u8 CountAliveMonsInBattle(u8 caseId);
|
||||
#define BATTLE_ALIVE_EXCEPT_ACTIVE 0
|
||||
#define BATTLE_ALIVE_ATK_SIDE 1
|
||||
#define BATTLE_ALIVE_DEF_SIDE 2
|
||||
@@ -620,6 +626,13 @@ bool8 IsPokeSpriteNotFlipped(u16 species);
|
||||
bool8 IsMonShiny(struct Pokemon *mon);
|
||||
bool8 IsShinyOtIdPersonality(u32 otId, u32 personality);
|
||||
|
||||
void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies);
|
||||
bool8 IsTradedMon(struct Pokemon *mon);
|
||||
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
|
||||
s32 sub_806D864(u16 a1);
|
||||
bool16 sub_806D82C(u8 id);
|
||||
u16 MonTryLearningNewMove(struct Pokemon* mon, bool8);
|
||||
|
||||
#include "sprite.h"
|
||||
|
||||
void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3);
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef GUARD_POKEMON_ICON_H
|
||||
#define GUARD_POKEMON_ICON_H
|
||||
|
||||
const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo);
|
||||
const u16 *GetValidMonIconPalettePtr(u16 speciesId);
|
||||
|
||||
#endif // GUARD_POKEMON_ICON_H
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef GUARD_POKEMON_ITEM_EFFECTS
|
||||
#define GUARD_POKEMON_ITEM_EFFECTS
|
||||
|
||||
#include "pokemon.h"
|
||||
|
||||
bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 itemId, u8 partyId, u8 monMoveIndex, u8 a5);
|
||||
|
||||
#endif // GUARD_POKEMON_ITEM_EFFECTS
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef GUARD_POKEMON_STORAGE_SYSTEM_H
|
||||
#define GUARD_POKEMON_STORAGE_SYSTEM_H
|
||||
|
||||
u8* GetBoxNamePtr(u8 boxNumber);
|
||||
|
||||
#endif // GUARD_POKEMON_STORAGE_SYSTEM_H
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef GUARD_RECORDED_BATTLE_H
|
||||
#define GUARD_RECORDED_BATTLE_H
|
||||
|
||||
void RecordedBattle_SetBankAction(u8 bank, u8 action);
|
||||
|
||||
#endif // GUARD_RECORDED_BATTLE_H
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef GUARD_RESHOW_BATTLE_SCREEN_H
|
||||
#define GUARD_RESHOW_BATTLE_SCREEN_H
|
||||
|
||||
void ReshowBattleScreenAfterMenu(void);
|
||||
|
||||
#endif // GUARD_RESHOW_BATTLE_SCREEN_H
|
||||
+26
-16
@@ -65,36 +65,46 @@
|
||||
#define CHAR_x 0xEC
|
||||
#define CHAR_y 0xED
|
||||
#define CHAR_z 0xEE
|
||||
#define CHAR_SPECIAL_F9 0xF9
|
||||
#define CHAR_COLON 0xF0
|
||||
#define CHAR_PROMPT_SCROLL 0xFA // waits for button press and scrolls dialog
|
||||
#define CHAR_PROMPT_CLEAR 0xFB // waits for button press and clears dialog
|
||||
#define EXT_CTRL_CODE_BEGIN 0xFC // extended control code
|
||||
#define PLACEHOLDER_BEGIN 0xFD // string placeholder
|
||||
#define CHAR_NEWLINE 0xFE
|
||||
#define EOS 0xFF // end of string
|
||||
#define EOS 0xFF // end of string
|
||||
|
||||
#define TEXT_COLOR_TRANSPARENT 0x0
|
||||
#define TEXT_COLOR_WHITE 0x1
|
||||
#define TEXT_COLOR_DARK_GREY 0x2
|
||||
|
||||
// battle placeholders are located in battle_message.h
|
||||
|
||||
#define EXT_CTRL_CODE_JPN 0x15
|
||||
#define EXT_CTRL_CODE_ENG 0x16
|
||||
|
||||
#define NUM_TEXT_PRINTERS 32
|
||||
|
||||
struct TextSubPrinter // TODO: Better name
|
||||
{
|
||||
u8* current_text_offset;
|
||||
u8 windowId;
|
||||
u8 fontId;
|
||||
u8 x;
|
||||
u8 y;
|
||||
u8 currentX; // 0x8
|
||||
u8 currentY;
|
||||
u8 letterSpacing;
|
||||
u8 lineSpacing;
|
||||
u8 fontColor_l:4; // 0xC
|
||||
u8 fontColor_h:4;
|
||||
u8 bgColor:4;
|
||||
u8 shadowColor:4;
|
||||
};
|
||||
|
||||
struct TextPrinter
|
||||
{
|
||||
struct TextSubPrinter { // TODO: Better name
|
||||
u8* current_text_offset;
|
||||
u8 windowId;
|
||||
u8 fontId;
|
||||
u8 x;
|
||||
u8 y;
|
||||
u8 currentX; // 0x8
|
||||
u8 currentY;
|
||||
u8 letterSpacing;
|
||||
u8 lineSpacing;
|
||||
u8 fontColor_l:4; // 0xC
|
||||
u8 fontColor_h:4;
|
||||
u8 bgColor:4;
|
||||
u8 shadowColor:4;
|
||||
} subPrinter;
|
||||
struct TextSubPrinter subPrinter;
|
||||
|
||||
void (*callback)(struct TextSubPrinter *, u16); // 0x10
|
||||
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ void PutWindowRectTilemap(u8 windowId, u8 x, u8 y, u8 width, u8 height);
|
||||
void BlitBitmapToWindow(u8 windowId, u8 *pixels, u16 x, u16 y, u16 width, u16 height);
|
||||
void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight);
|
||||
void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height);
|
||||
void CopyToWindowPixelBuffer(u8 windowId, u8 *src, u16 size, u16 tileOffset);
|
||||
void CopyToWindowPixelBuffer(u8 windowId, const u8 *src, u16 size, u16 tileOffset);
|
||||
void FillWindowPixelBuffer(u8 windowId, u8 fillValue);
|
||||
void ScrollWindow(u8 windowId, u8 direction, u8 distance, u8 fillValue);
|
||||
void CallWindowFunction(u8 windowId, void ( *func)(u8, u8, u8, u8, u8, u8));
|
||||
|
||||
Reference in New Issue
Block a user