From 4abc2eea8aee0efc714df8519533c55fbabae5f1 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 19 Dec 2017 17:33:07 +0100 Subject: [PATCH] ram vars to C files --- common_syms/trainer_see.txt | 5 +++++ include/trainer_see.h | 5 +++++ src/battle_setup.c | 5 +---- src/trainer_see.c | 16 ++++++++++------ sym_common.txt | 16 +--------------- sym_ewram.txt | 7 +------ 6 files changed, 23 insertions(+), 31 deletions(-) create mode 100644 common_syms/trainer_see.txt diff --git a/common_syms/trainer_see.txt b/common_syms/trainer_see.txt new file mode 100644 index 000000000..2d0514325 --- /dev/null +++ b/common_syms/trainer_see.txt @@ -0,0 +1,5 @@ +gUnknown_03006080 +gUnknown_03006084 +gApproachingTrainers +gNoOfApproachingTrainers +gUnknown_030060AC diff --git a/include/trainer_see.h b/include/trainer_see.h index b1a48e962..847380782 100644 --- a/include/trainer_see.h +++ b/include/trainer_see.h @@ -9,7 +9,12 @@ struct ApproachingTrainer u8 taskId; }; +extern u16 gUnknown_03006080; +extern u8 gUnknown_03006084[4]; extern struct ApproachingTrainer gApproachingTrainers[2]; +extern u8 gNoOfApproachingTrainers; +extern u8 gUnknown_030060AC; +extern u8 gApproachingTrainerId; bool8 CheckForTrainersWantingBattle(void); void sub_80B4578(struct MapObject *var); diff --git a/src/battle_setup.c b/src/battle_setup.c index 3d4f5afcc..be23a28c9 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -88,9 +88,6 @@ extern u32 GetGameStat(u8 statId); extern u32 gBattleTypeFlags; extern u8 gBattleOutcome; extern void (*gFieldCallback)(void); -extern u8 gApproachingTrainerId; -extern u8 gNoOfApproachingTrainers; -extern u16 gUnknown_03006080; // this file's functions static void DoBattlePikeWildBattle(void); @@ -113,7 +110,7 @@ static void HandleRematchVarsOnBattleEnd(void); static const u8 *GetIntroSpeechOfApproachingTrainer(void); static const u8 *GetTrainerCantBattleSpeech(void); -// ewram data +// ewram vars EWRAM_DATA static u16 sTrainerBattleMode = 0; EWRAM_DATA u16 gTrainerBattleOpponent_A = 0; EWRAM_DATA u16 gTrainerBattleOpponent_B = 0; diff --git a/src/trainer_see.c b/src/trainer_see.c index b8dbda0c1..53bc5cbbb 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -14,12 +14,6 @@ #include "event_data.h" #include "script_movement.h" -extern u8 gApproachingTrainerId; -extern u8 gNoOfApproachingTrainers; -extern u8 gUnknown_030060AC; -extern u16 gUnknown_03006080; -extern u8 gUnknown_03006084[]; - extern bool8 InBattlePyramid(void); extern bool32 InTrainerHill(void); extern bool8 GetBattlePyramidTrainerFlag(u8 mapObjectId); @@ -55,6 +49,16 @@ static bool8 sub_80B44AC(u8 taskId, struct Task *task, struct MapObject *trainer static void SpriteCB_TrainerIcons(struct Sprite *sprite); +// IWRAM common +u16 gUnknown_03006080; +u8 gUnknown_03006084[4]; +struct ApproachingTrainer gApproachingTrainers[2]; +u8 gNoOfApproachingTrainers; +u8 gUnknown_030060AC; + +// EWRAM +EWRAM_DATA u8 gApproachingTrainerId = 0; + // const rom data static const u8 sEmotion_ExclamationMarkGfx[] = INCBIN_U8("graphics/misc/emotion_exclamation.4bpp"); static const u8 sEmotion_QuestionMarkGfx[] = INCBIN_U8("graphics/misc/emotion_question.4bpp"); diff --git a/sym_common.txt b/sym_common.txt index 646db3bb7..be96f4c30 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -295,21 +295,7 @@ gUnknown_03005DF4: @ 3005DF4 .include "sound.o" .include "task.o" - -gUnknown_03006080: @ 3006080 - .space 0x4 - -gUnknown_03006084: @ 3006084 - .space 0xC - -gApproachingTrainers: @ 3006090 - .space 0x18 - -gNoOfApproachingTrainers: @ 30060A8 - .space 0x4 - -gUnknown_030060AC: @ 30060AC - .space 0x4 + .include "trainer_see.o" gUnknown_030060B0: @ 30060B0 .space 0x4 diff --git a/sym_ewram.txt b/sym_ewram.txt index 31ecf2085..3040a7c69 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -707,12 +707,7 @@ gUnknown_02038BC6: @ 2038BC6 .space 0x2 .include "src/battle_setup.o" - -.align 2 - -gApproachingTrainerId: @ 2038BFC - .space 0x4 - + .include "src/trainer_see.o" .include "src/wild_encounter.o" gFieldEffectArguments: @ 2038C08