summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiangzhengwenjz <jiangzhengwenjzw@qq.com>2019-10-26 00:33:42 +0800
committerjiangzhengwenjz <jiangzhengwenjzw@qq.com>2019-10-26 01:31:50 +0800
commit1230a5c48a465d42ae7035ca9c1a6e2152c54d1a (patch)
tree8fc6f5b6bb323f408a4f0c117f89fd66b7161440
parent2f87855072fb4fdca6ce22d60bfb1b7fdc000134 (diff)
clean up
-rw-r--r--data/event_scripts.s16
-rw-r--r--data/specials.inc4
-rw-r--r--include/battle.h211
-rw-r--r--include/battle_bg.h2
-rw-r--r--include/battle_script_commands.h7
-rw-r--r--include/battle_setup.h4
-rw-r--r--include/data.h1
-rw-r--r--include/quest_log.h3
-rw-r--r--include/quest_log_battle.h9
-rw-r--r--src/battle_ai_script_commands.c2
-rw-r--r--src/battle_main.c2
-rw-r--r--src/battle_setup.c26
-rw-r--r--src/battle_transition.c2
-rw-r--r--src/battle_util2.c1
-rw-r--r--src/pokemon.c2
-rw-r--r--src/quest_log_battle.c29
16 files changed, 59 insertions, 262 deletions
diff --git a/data/event_scripts.s b/data/event_scripts.s
index 8762619db..e6d967221 100644
--- a/data/event_scripts.s
+++ b/data/event_scripts.s
@@ -842,7 +842,7 @@ EventScript_1A4EAF:: @ 81A4EAF
gUnknown_81A4EB4:: @ 81A4EB4
lock
- special SetUpTrainerEncounterMusic
+ special PlayTrainerEncounterMusic
special ScrSpecial_EndTrainerApproach
waitstate
goto EventScript_1A4FC7
@@ -852,10 +852,10 @@ EventScript_TryDoNormalTrainerBattle:: @ 81A4EC1
faceplayer
applymovement VAR_LAST_TALKED, Movement_1A4FC5
waitmovement 0
- specialvar VAR_RESULT, GetTrainerFlag
+ specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought
compare_var_to_value VAR_RESULT, 0
goto_if ne, EventScript_1A4EE8
- special SetUpTrainerEncounterMusic
+ special PlayTrainerEncounterMusic
special SetUpTrainerMovement
goto EventScript_1A4FC7
@@ -866,13 +866,13 @@ EventScript_TryDoDoubleTrainerBattle:: @ 81A4EE9
lock
faceplayer
call EventScript_1A4FBA
- specialvar VAR_RESULT, GetTrainerFlag
+ specialvar VAR_RESULT, ScrSpecial_HasTrainerBeenFought
compare_var_to_value VAR_RESULT, 0
goto_if ne, EventScript_1A4F20
special CheckForAlivePartyMons
compare_var_to_value VAR_RESULT, 0
goto_if ne, EventScript_1A4F19
- special SetUpTrainerEncounterMusic
+ special PlayTrainerEncounterMusic
special SetUpTrainerMovement
goto EventScript_1A4FC7
@@ -889,7 +889,7 @@ EventScript_1A4F20:: @ 81A4F20
EventScript_DoTrainerBattle:: @ 81A4F21
applymovement VAR_LAST_TALKED, Movement_1A4FC5
waitmovement 0
- special SetUpTrainerEncounterMusic
+ special PlayTrainerEncounterMusic
special sub_8110AB4
compare_var_to_value VAR_RESULT, 2
goto_if eq, EventScript_1A501A
@@ -901,7 +901,7 @@ EventScript_TryDoRematchBattle:: @ 81A4F3E
specialvar VAR_RESULT, ScrSpecial_GetTrainerEyeRematchFlag
compare_var_to_value VAR_RESULT, 0
goto_if eq, EventScript_1A4F72
- special SetUpTrainerEncounterMusic
+ special PlayTrainerEncounterMusic
special SetUpTrainerMovement
special ScrSpecial_ShowTrainerIntroSpeech
waitmessage
@@ -924,7 +924,7 @@ EventScript_TryDoDoubleRematchBattle:: @ 81A4F73
special CheckForAlivePartyMons
compare_var_to_value VAR_RESULT, 0
goto_if ne, EventScript_1A4FB1
- special SetUpTrainerEncounterMusic
+ special PlayTrainerEncounterMusic
special SetUpTrainerMovement
special ScrSpecial_ShowTrainerIntroSpeech
waitmessage
diff --git a/data/specials.inc b/data/specials.inc
index 8ef7a0671..44d906656 100644
--- a/data/specials.inc
+++ b/data/specials.inc
@@ -62,9 +62,9 @@ gSpecials:: @ 815FD60
def_special ScrSpecial_GetTrainerBattleMode
def_special ScrSpecial_ShowTrainerIntroSpeech
def_special ScrSpecial_ShowTrainerNonBattlingSpeech
- def_special GetTrainerFlag
+ def_special ScrSpecial_HasTrainerBeenFought
def_special ScrSpecial_EndTrainerApproach
- def_special SetUpTrainerEncounterMusic
+ def_special PlayTrainerEncounterMusic
def_special ShouldTryRematchBattle
def_special ScrSpecial_GetTrainerEyeRematchFlag
def_special ScrSpecial_StartTrainerEyeRematch
diff --git a/include/battle.h b/include/battle.h
index 9545bacff..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
@@ -87,17 +45,6 @@
#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
@@ -122,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;
@@ -199,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];
@@ -362,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
@@ -426,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
@@ -519,7 +418,7 @@ struct BattleStruct
u16 hpOnSwitchout[2];
u8 abilityPreventingSwitchout;
u8 hpScale;
- u16 savedBattleTypeFlags; // ???
+ u16 savedBattleTypeFlags;
void (*savedCallback)(void);
u8 synchronizeMoveEffect;
u8 multiplayerId;
@@ -571,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
@@ -646,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;
@@ -700,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,
@@ -723,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
diff --git a/include/battle_bg.h b/include/battle_bg.h
index a467f34c8..29571b410 100644
--- a/include/battle_bg.h
+++ b/include/battle_bg.h
@@ -9,5 +9,7 @@ void sub_800F34C(void);
void DrawBattleEntryBackground(void);
void sub_800F6FC(u8 taskId);
void LoadBattleMenuWindowGfx(void);
+void LoadBattleTextboxAndBackground(void);
+void sub_800F324(void);
#endif // GUARD_BATTLE_BG_H
diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h
index 3f2699064..983d9fce6 100644
--- a/include/battle_script_commands.h
+++ b/include/battle_script_commands.h
@@ -7,13 +7,6 @@
#define NO_ACC_CALC_CHECK_LOCK_ON 0xFFFF
#define ACC_CURR_MOVE 0
-#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
-
#define ATK48_STAT_NEGATIVE 0x1
#define ATK48_STAT_BY_TWO 0x2
#define ATK48_BIT_x4 0x4
diff --git a/include/battle_setup.h b/include/battle_setup.h
index 8a362a82e..809806e9b 100644
--- a/include/battle_setup.h
+++ b/include/battle_setup.h
@@ -20,7 +20,7 @@ bool32 GetTrainerFlagFromScriptPointer(const u8 *data);
void SetUpTrainerMovement(void);
u8 ScrSpecial_GetTrainerBattleMode(void);
u16 sub_80803D8(void);
-u16 GetTrainerFlag(void);
+u16 ScrSpecial_HasTrainerBeenFought(void);
void SetBattledTrainerFlag(void);
bool8 HasTrainerBeenFought(u16 trainerId);
void SetTrainerFlag(u16 trainerId);
@@ -31,7 +31,7 @@ void ScrSpecial_ShowTrainerIntroSpeech(void);
const u8 *BattleSetup_GetScriptAddrAfterBattle(void);
const u8 *BattleSetup_GetTrainerPostBattleScript(void);
void ScrSpecial_ShowTrainerNonBattlingSpeech(void);
-void SetUpTrainerEncounterMusic(void);
+void PlayTrainerEncounterMusic(void);
const u8 *GetTrainerALoseText(void);
const u8 *GetTrainerWonSpeech(void);
diff --git a/include/data.h b/include/data.h
index 9726b95e5..9ea1f7c96 100644
--- a/include/data.h
+++ b/include/data.h
@@ -5,6 +5,7 @@
#include "constants/species.h"
#define SPECIES_SHINY_TAG 500
+#define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F))
struct MonCoords
{
diff --git a/include/quest_log.h b/include/quest_log.h
index a5352db1f..adab57526 100644
--- a/include/quest_log.h
+++ b/include/quest_log.h
@@ -2,6 +2,7 @@
#define GUARD_QUEST_LOG_H
#include "global.h"
+#include "quest_log_battle.h"
struct UnkStruct_3005E90
{
@@ -41,8 +42,6 @@ void sub_8112450(void);
void sub_8112364(void);
u8 sub_8112CAC(void);
void sub_81138F8(void);
-void sub_812C224(void);
-void sub_812BFDC(void);
void sub_811231C(void);
void sub_81139BC(void);
void *QuestLogGetFlagOrVarPtr(bool8 isFlag, u16 idx);
diff --git a/include/quest_log_battle.h b/include/quest_log_battle.h
new file mode 100644
index 000000000..45d656e14
--- /dev/null
+++ b/include/quest_log_battle.h
@@ -0,0 +1,9 @@
+#ifndef GUARD_QUEST_LOG_BATTLE_H
+#define GUARD_QUEST_LOG_BATTLE_H
+
+#include "global.h"
+
+void sub_812BFDC(void);
+void sub_812C224(void);
+
+#endif // GUARD_QUEST_LOG_BATTLE_H
diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c
index c57825b4f..e66fdb2af 100644
--- a/src/battle_ai_script_commands.c
+++ b/src/battle_ai_script_commands.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "battle.h"
-#include "battle_main.h"
+#include "battle_anim.h"
#include "util.h"
#include "item.h"
#include "random.h"
diff --git a/src/battle_main.c b/src/battle_main.c
index bb7e300ba..9a8b5475e 100644
--- a/src/battle_main.c
+++ b/src/battle_main.c
@@ -1107,7 +1107,7 @@ static void CB2_PreInitMultiBattle(void)
s32 i;
u8 playerMultiplierId;
u8 r4 = 0xF;
- u16 *savedBattleTypeFlags; // ???
+ u16 *savedBattleTypeFlags;
void (**savedCallback)(void);
playerMultiplierId = GetMultiplayerId();
diff --git a/src/battle_setup.c b/src/battle_setup.c
index b43f43ce2..e4b8914e5 100644
--- a/src/battle_setup.c
+++ b/src/battle_setup.c
@@ -850,7 +850,7 @@ u16 sub_80803D8(void)
return gUnknown_20386CC;
}
-u16 GetTrainerFlag(void)
+u16 ScrSpecial_HasTrainerBeenFought(void)
{
return FlagGet(GetTrainerAFlag());
}
@@ -993,7 +993,7 @@ void ScrSpecial_ShowTrainerNonBattlingSpeech(void)
ShowFieldMessage(GetTrainerCantBattleSpeech());
}
-void SetUpTrainerEncounterMusic(void)
+void PlayTrainerEncounterMusic(void)
{
u16 music;
@@ -1003,19 +1003,19 @@ void SetUpTrainerEncounterMusic(void)
{
switch (GetTrainerEncounterMusicId(gTrainerBattleOpponent_A))
{
- case 1: // TODO: replace these with enums
- case 2:
- case 9:
+ case TRAINER_ENCOUNTER_MUSIC_FEMALE:
+ case TRAINER_ENCOUNTER_MUSIC_GIRL:
+ case TRAINER_ENCOUNTER_MUSIC_TWINS:
music = MUS_SHOUJO;
break;
- case 0:
- case 4:
- case 5:
- case 8:
- case 10:
- case 11:
- case 12:
- case 13:
+ case TRAINER_ENCOUNTER_MUSIC_MALE:
+ case TRAINER_ENCOUNTER_MUSIC_INTENSE:
+ case TRAINER_ENCOUNTER_MUSIC_COOL:
+ case TRAINER_ENCOUNTER_MUSIC_SWIMMER:
+ case TRAINER_ENCOUNTER_MUSIC_ELITE_FOUR:
+ case TRAINER_ENCOUNTER_MUSIC_HIKER:
+ case TRAINER_ENCOUNTER_MUSIC_INTERVIEWER:
+ case TRAINER_ENCOUNTER_MUSIC_RICH:
music = MUS_SHOUNEN;
break;
default:
diff --git a/src/battle_transition.c b/src/battle_transition.c
index 9570afdf7..1dbfe3aed 100644
--- a/src/battle_transition.c
+++ b/src/battle_transition.c
@@ -3175,7 +3175,7 @@ static bool8 BT_Phase2WhiteFadeInStripes_Stop(struct Task *task)
DmaStop(0);
SetVBlankCallback(NULL);
SetHBlankCallback(NULL);
- sTransitionStructPtr->win0H = 240;
+ sTransitionStructPtr->win0H = WIN_RANGE(0, 240);
sTransitionStructPtr->bldY = 0;
sTransitionStructPtr->bldCnt = BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG1 | BLDCNT_TGT1_BG2 | BLDCNT_TGT1_BG3 | BLDCNT_TGT1_OBJ | BLDCNT_TGT1_BD | BLDCNT_EFFECT_DARKEN;
sTransitionStructPtr->winIn = WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WININ_WIN0_CLR;
diff --git a/src/battle_util2.c b/src/battle_util2.c
index d940d8508..a3a748767 100644
--- a/src/battle_util2.c
+++ b/src/battle_util2.c
@@ -1,6 +1,7 @@
#include "global.h"
#include "bg.h"
#include "battle.h"
+#include "battle_anim.h"
#include "pokemon.h"
#include "malloc.h"
#include "trainer_tower.h"
diff --git a/src/pokemon.c b/src/pokemon.c
index aaa2b635a..17f28c7a6 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -8,7 +8,7 @@
#include "data.h"
#include "string_util.h"
#include "battle.h"
-#include "battle_main.h"
+#include "battle_anim.h"
#include "item.h"
#include "event_data.h"
#include "util.h"
diff --git a/src/quest_log_battle.c b/src/quest_log_battle.c
index a9f7c83f8..efe866dea 100644
--- a/src/quest_log_battle.c
+++ b/src/quest_log_battle.c
@@ -2,6 +2,7 @@
#include "constants/species.h"
#include "malloc.h"
#include "battle.h"
+#include "battle_anim.h"
#include "link.h"
#include "overworld.h"
#include "quest_log.h"
@@ -22,7 +23,7 @@ struct QuestLogStruct_WildBattleRecord
u8 v4;
};
-void sub_812C334(s32 *, s32 *);
+static void sub_812C334(s32 *, s32 *);
void sub_812BFDC(void)
{
@@ -38,18 +39,18 @@ void sub_812BFDC(void)
{
switch (gTrainers[gTrainerBattleOpponent_A].trainerClass)
{
- case 0x54:
- questLogMessageType = 30;
- break;
- case 0x5a:
- questLogMessageType = 33;
- break;
- case 0x57:
- questLogMessageType = 32;
- break;
- default:
- questLogMessageType = 34;
- break;
+ case 0x54:
+ questLogMessageType = 30;
+ break;
+ case 0x5a:
+ questLogMessageType = 33;
+ break;
+ case 0x57:
+ questLogMessageType = 32;
+ break;
+ default:
+ questLogMessageType = 34;
+ break;
}
questLogTrainerBattleRecord->v0 = gTrainerBattleOpponent_A;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
@@ -149,7 +150,7 @@ void sub_812C224(void)
}
}
-void sub_812C334(s32 * a0, s32 * a1)
+static void sub_812C334(s32 * a0, s32 * a1)
{
s32 r5;
s32 _optimized_out = 0;