summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/battle.h15
-rw-r--r--include/battle_ai.h1
-rw-r--r--include/battle_message.h137
-rw-r--r--include/constants/battle_constants.h37
-rwxr-xr-xinclude/ewram.h5
-rw-r--r--include/pokemon.h12
-rw-r--r--include/roamer.h2
-rw-r--r--include/tv.h1
8 files changed, 204 insertions, 6 deletions
diff --git a/include/battle.h b/include/battle.h
index dd35cc303..4bcdfa6a9 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -227,10 +227,8 @@ struct BattleStruct /* 0x2000000 */
/*0x160D5*/ u8 unk160D5;
/*0x160D6*/ u8 unk160D6;
/*0x160D7*/ u8 unk160D7;
- /*0x160D8*/ u8 unk160D8;
- /*0x160D9*/ u8 unk160D9;
- /*0x160DA*/ u8 unk160DA;
- /*0x160DB*/ u8 unk160DB;
+ /*0x160D8*/ u8 unk160D8[2];
+ /*0x160DA*/ u8 unk160DA[2];
/*0x160DC*/ u8 unk160DC;
/*0x160DD*/ u8 intimidateBank;
/*0x160DE*/ u8 unk160DE;
@@ -606,7 +604,7 @@ void InitBattle(void);
void sub_800EC9C(void);
void sub_800F104(void);
void sub_800F298(void);
-void sub_800F808(void);
+void BattleMainCB2(void);
void sub_800F838(struct Sprite *);
u8 CreateNPCTrainerParty(struct Pokemon *, u16);
void sub_800FCFC(void);
@@ -638,6 +636,9 @@ void sub_8011970(void);
void sub_80119B4(void);
void BattleBeginFirstTurn(void);
void BattleTurnPassed(void);
+void RunBattleScriptCommands_PopCallbacksStack(void);
+void RunBattleScriptCommands(void);
+bool8 TryRunFromBattle(u8 bank);
// asm/battle_2.o
void sub_8012324(void);
@@ -654,14 +655,16 @@ u8 CheckMoveLimitations(u8 bank, u8 unusableMoves, u8 check);
u8 UpdateTurnCounters(void);
u8 TurnBasedEffects(void);
u8 sub_80170DC();
-u8 sub_80173A4();
+u8 HandleFaintedMonActions();
u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 move);
u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn);
void b_clear_atk_up_if_hit_flag_unless_enraged(void);
+u8 GetMoveTarget(u16 move, u8 useMoveTarget);
// asm/battle_4.o
void AI_CalcDmg(u8, u8);
u8 TypeCalc(u16 move, u8 bank_atk, u8 bank_def);
+u8 BankGetTurnOrder(u8 bank);
// asm/battle_5.o
void nullsub_91(void);
diff --git a/include/battle_ai.h b/include/battle_ai.h
index 60ca5d000..c22ca8633 100644
--- a/include/battle_ai.h
+++ b/include/battle_ai.h
@@ -24,5 +24,6 @@ void sub_810745C(void);
void AIStackPushVar(u8 *);
u8 AIStackPop(void);
void BattleAI_HandleItemUseBeforeAISetup(void);
+void RecordAbilityBattle(u8 a, u8 b);
#endif
diff --git a/include/battle_message.h b/include/battle_message.h
index 3e37a1ccd..9c27994ee 100644
--- a/include/battle_message.h
+++ b/include/battle_message.h
@@ -16,6 +16,143 @@ struct StringInfoBattle
u8 textBuffs[3][0x10];
};
+// 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_FLAVOR 8
+#define B_BUFF_ABILITY 9
+#define B_BUFF_ITEM 10
+
+#define B_BUFF_PLACEHOLDER_BEGIN 0xFD
+#define B_BUFF_EOS 0xFF
+
+#define PREPARE_FLAVOR_BUFFER(textVar, flavorId) \
+{ \
+ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
+ textVar[1] = B_BUFF_NEGATIVE_FLAVOR; \
+ textVar[2] = flavorId; \
+ textVar[3] = B_BUFF_EOS; \
+}
+
+#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; \
+}
+
void BufferStringBattle(u16 stringID);
u32 StrCpyDecodeToDisplayedStringBattle(const u8* src);
u32 StrCpyDecodeBattle(const u8* src, u8* dst);
diff --git a/include/constants/battle_constants.h b/include/constants/battle_constants.h
index 892b3e7f6..2b973b4d9 100644
--- a/include/constants/battle_constants.h
+++ b/include/constants/battle_constants.h
@@ -1,6 +1,13 @@
#ifndef GUARD_CONSTANTS_BATTLE_CONSTANTS_H
#define GUARD_CONSTANTS_BATTLE_CONSTANTS_H
+// Bank sides
+#define SIDE_PLAYER 0x0
+#define SIDE_OPPONENT 0x1
+
+#define BIT_SIDE 0x1
+#define BIT_MON 0x2
+
#define STATUS_SLEEP 0x7
#define STATUS_POISON 0x8
#define STATUS_BURN 0x10
@@ -76,6 +83,7 @@
#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))
@@ -216,6 +224,27 @@
#define WEATHER_SUN_ANY ((WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT))
#define WEATHER_HAIL (1 << 7)
+#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
+
+// 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 SPRITES_INIT_STATE1 0x1 // shares the Id as well
+#define SPRITES_INIT_STATE2 0x2
+#define MOVE_EFFECT_BYTE 0x3
+#define ACTIONS_CONFIRMED_COUNT 0x4
+#define MULTISTRING_CHOOSER 0x5
+#define MSG_DISPLAY 0x7
+#define BATTLE_COMMUNICATION_ENTRIES_COUNT 0x8
+
// status animation table
#define B_ANIM_STATUS_PSN 0x0
#define B_ANIM_STATUS_CONFUSION 0x1
@@ -262,4 +291,12 @@
#define B_ANIM_SUBSTITUTE_TO_MON 0x5
#define B_ANIM_MON_TO_SUBSTITUTE 0x6
+// AI switch items
+#define AI_ITEM_FULL_RESTORE 1
+#define AI_ITEM_HEAL_HP 2
+#define AI_ITEM_CURE_CONDITION 3
+#define AI_ITEM_X_STAT 4
+#define AI_ITEM_GUARD_SPECS 5
+#define AI_ITEM_NOT_RECOGNIZABLE 6
+
#endif // GUARD_CONSTANTS_BATTLE_CONSTANTS_H
diff --git a/include/ewram.h b/include/ewram.h
index d5e53393b..17ca3508a 100755
--- a/include/ewram.h
+++ b/include/ewram.h
@@ -134,6 +134,8 @@ extern u8 gSharedMem[];
#define ewram1608Carr(bank) (gSharedMem[0x1608C + bank])
#define EWRAM_1609D (gSharedMem[0x1609D])
#define ewram160A1 (gSharedMem[0x160A1])
+#define ewram160A4 (gSharedMem[0x160A4])
+#define ewram160A5 (gSharedMem[0x160A5])
#define ewram160A6 (gSharedMem[0x160A6])
#define ewram160A8 (gSharedMem[0x160A8])
#define ewram160A9 (gSharedMem[0x160A9])
@@ -156,9 +158,12 @@ extern u8 gSharedMem[];
#define USED_HELD_ITEM(bank) ((((u16*)(&gSharedMem[0x160CC + bank * 2]))))
#define USED_HELD_ITEMS(bank) (*(u16 *)&gSharedMem[0x160CC + 2 * (bank)])
#define ewram160D4(bank) (gSharedMem[0x160D4 + (bank / 2) * 2])
+#define ewram160D8(bank) (gSharedMem[0x160D8 + (bank / 2)])
+#define ewram160DA(bank) (gSharedMem[0x160DA + (bank / 2)])
#define ewram160DD (gSharedMem[0x160DD])
#define ewram160E0(i) (gSharedMem[0x160E0 + i])
#define ewram160E6 (gSharedMem[0x160E6])
+#define ewram160E7 (gSharedMem[0x160E7])
#define CHOICED_MOVE(bank) (((u16*)(&gSharedMem[0x160E8 + bank * 2])))
#define ewram160E8 ((u8 *)(gSharedMem + 0x160E8))
#define ewram160E8arr(i) (gSharedMem[0x160E8 + i])
diff --git a/include/pokemon.h b/include/pokemon.h
index b6c6e0030..71b35e65c 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -363,6 +363,16 @@ enum
STAT_STAGE_EVASION, // 7
};
+enum
+{
+ STAT_HP, // 0
+ STAT_ATK, // 1
+ STAT_DEF, // 2
+ STAT_SPD, // 3
+ STAT_SPATK, // 4
+ STAT_SPDEF, // 5
+};
+
struct BaseStats
{
/*0x00*/ u8 baseHP;
@@ -613,6 +623,8 @@ bool8 IsPokeSpriteNotFlipped(u16);
u8 GetLevelUpMovesBySpecies(u16, u16 *);
u8 TryIncrementMonLevel(struct Pokemon *);
bool8 IsShiny(struct Pokemon *mon);
+void RandomlyGivePartyPokerus(struct Pokemon *party);
+void PartySpreadPokerus(struct Pokemon *party);
struct Sprite *sub_80F7920(u16, u16, const u16 *);
diff --git a/include/roamer.h b/include/roamer.h
index 9d5f3c4ed..86908bd00 100644
--- a/include/roamer.h
+++ b/include/roamer.h
@@ -7,5 +7,7 @@ void UpdateLocationHistoryForRoamer(void);
void RoamerMoveToOtherLocationSet(void);
void RoamerMove();
u8 TryStartRoamerEncounter(void);
+void UpdateRoamerHPStatus(struct Pokemon *mon);
+void SetRoamerInactive(void);
#endif
diff --git a/include/tv.h b/include/tv.h
index 91b871f71..2edccb365 100644
--- a/include/tv.h
+++ b/include/tv.h
@@ -107,5 +107,6 @@ void UpdateTVShowsPerDay(u16);
void sub_80C045C();
void sub_80BF088(u8, s32);
void sub_80BFD20(void);
+void PutPokemonTodayCaughtOnAir(void);
#endif // GUARD_TV_H