diff --git a/include/dungeon_engine.h b/include/dungeon_engine.h index d3d90a252..50b8f181d 100644 --- a/include/dungeon_engine.h +++ b/include/dungeon_engine.h @@ -6,6 +6,8 @@ extern const s16 gSpeedTurns[NUM_SPEED_COUNTERS][25]; void RunFractionalTurn(bool8 param_1); +void sub_80444F4(Entity *pokemon); bool8 IsFloorOver(void); +bool8 sub_8044B84(void); #endif diff --git a/include/dungeon_map_access.h b/include/dungeon_map_access.h index fffa44244..a98a24079 100644 --- a/include/dungeon_map_access.h +++ b/include/dungeon_map_access.h @@ -28,8 +28,6 @@ void sub_804AAD4(void); #define DUNGEON_WATER_TYPE_LAVA 1 #define DUNGEON_WATER_TYPE_WATER 2 -extern const u8 gDungeonWaterType[76]; - bool8 sub_804AD34(DungeonPos *pos); void sub_804AE84(DungeonPos *pos); bool8 IsTileGround(Tile *tile); diff --git a/src/blow_away.c b/src/blow_away.c index 1342a319d..3ae8bf6a5 100644 --- a/src/blow_away.c +++ b/src/blow_away.c @@ -28,10 +28,10 @@ #include "dungeon_pos_data.h" #include "dungeon_damage.h" #include "dungeon_kecleon_shop.h" +#include "dungeon_engine.h" void sub_804EB30(); bool8 ExposeTrap(s32 x, s32 y); -u8 IsFloorOver(void); void sub_80421AC(Entity * pokemon, Entity * target); void sub_807BB78(Entity *pokemon); extern void UpdateCamera(u32); diff --git a/src/code_8066D04.c b/src/code_8066D04.c index 702d540d0..0c7b0bda0 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -55,8 +55,6 @@ extern void sub_8044DF0(Entity *, u32, u32); Entity *sub_806773C(Entity *entity); void sub_8067558(Entity *entity, Entity *targetEntity, s32 a2); void sub_8067794(Entity *entity, Entity *targetEntity, s32 a2); -extern void sub_80845E0(Entity *entity); -extern void sub_8084448(Entity *entity); void HandlePickUpPlayerAction(Entity *entity) { diff --git a/src/code_806CD90.c b/src/code_806CD90.c index cb61efb31..797f13a57 100644 --- a/src/code_806CD90.c +++ b/src/code_806CD90.c @@ -20,6 +20,7 @@ #include "dungeon_random.h" #include "dungeon_misc.h" #include "dungeon_util.h" +#include "dungeon_data.h" #include "dungeon_pokemon_sprites.h" #include "exclusive_pokemon.h" #include "move_effects_target.h" diff --git a/src/code_8073CF0.c b/src/code_8073CF0.c index a752b5f43..7df4c055f 100644 --- a/src/code_8073CF0.c +++ b/src/code_8073CF0.c @@ -35,7 +35,6 @@ extern void sub_805229C(void); extern void sub_807E8F0(Entity *); -extern void sub_80444F4(Entity *pokemon); extern void WarpTarget(Entity *pokemon, Entity *r1, u32 r2, DungeonPos *r3); extern void sub_80420B8(Entity *pokemon); extern void sub_8041C4C(Entity *pokemon, u32 r1); diff --git a/src/code_8075708.c b/src/code_8075708.c index 34bef9edd..3bc4f4c23 100644 --- a/src/code_8075708.c +++ b/src/code_8075708.c @@ -49,7 +49,6 @@ extern void sub_8073D14(Entity *); extern void sub_8075708(Entity *entity); extern void sub_805229C(void); extern void sub_807E8F0(Entity *); -extern void sub_80444F4(Entity *pokemon); extern void WarpTarget(Entity *pokemon, Entity *r1, u32 r2, DungeonPos *r3); extern void sub_80420B8(Entity *pokemon); extern void sub_8041C4C(Entity *pokemon, u32 r1); diff --git a/src/code_8097670.c b/src/code_8097670.c index 960bf0c3d..af5325646 100644 --- a/src/code_8097670.c +++ b/src/code_8097670.c @@ -5,14 +5,12 @@ #include "pokemon_3.h" #include "friend_area.h" #include "moves.h" +#include "strings.h" static EWRAM_DATA struct unkStruct_203B494 sUnknown_2039778 = {0}; EWRAM_INIT struct unkStruct_203B494 *gUnknown_203B494 = { NULL }; // NDS=20EB98C -// data_810AE24.s -extern const u8 *gAdventureLogText[]; - extern void WriteDungeonLocationBits(DataSerializer*, DungeonLocation*); extern void ReadDungeonLocationBits(DataSerializer*, DungeonLocation*); void ReadGameOptionsBits(DataSerializer *param_1); diff --git a/src/code_8097F40.c b/src/code_8097F40.c index 320ab3314..19de5ff95 100644 --- a/src/code_8097F40.c +++ b/src/code_8097F40.c @@ -1,5 +1,6 @@ #include "global.h" #include "dungeon_map_access.h" +#include "dungeon_data.h" bool8 IsWaterDungeon(u32 r0) { diff --git a/src/dungeon_8072CF4.c b/src/dungeon_8072CF4.c index 48632ce1c..ce4b6604c 100644 --- a/src/dungeon_8072CF4.c +++ b/src/dungeon_8072CF4.c @@ -31,18 +31,12 @@ #include "dungeon_misc.h" #include "dungeon_pos_data.h" #include "dungeon_engine.h" +#include "dungeon_strings.h" extern u8 gUnknown_202F221; extern u8 gUnknown_202F222; extern u8 gUnknown_203B434; -extern u8 *gUnknown_80FA5B4[]; -extern u8 *gUnknown_80FCF50[]; -extern u8 *gUnknown_80FCF38[]; -extern u8 *gUnknown_80FD2CC[]; -extern u8 *gUnknown_80FE478[]; -extern u8 *gUnknown_80FE6D4[]; - void sub_8075BA4(Entity *param_1, u8 param_2); void sub_804178C(u8 param_1); void nullsub_95(Entity *); @@ -77,7 +71,6 @@ bool8 sub_804AE08(DungeonPos *pos); void HandlePickUpAIAction(Entity *pokemon); void HandleThrowItemAIAction(Entity *pokemon); void HandleEatAIAction(Entity *pokemon); -bool8 sub_8044B84(void); extern void sub_8074094(Entity *); extern void EnemyEvolution(Entity *); u32 sub_8075818(Entity *entity); @@ -206,7 +199,7 @@ bool8 sub_8072CF4(Entity *entity) break; case ACTION_STAIRS: if ((gDungeon->unk644.dungeonLocation.id == DUNGEON_METEOR_CAVE) && (!gDungeon->deoxysDefeat)) { - LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FA5B4); // It's impossible to go down the stairs now! + LogMessageByIdWithPopupCheckUser(entity,gUnknown_80FA5B4); // It's impossible to go down the stairs now! } else { @@ -265,7 +258,7 @@ bool8 sub_8072CF4(Entity *entity) break; } SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0); - LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE6D4); + LogMessageByIdWithPopupCheckUser(entity,gUnknown_80FE6D4); break; case ACTION_TALK_FIELD: HandleTalkFieldAction(entity); @@ -293,7 +286,7 @@ bool8 sub_8072CF4(Entity *entity) break; case ACTION_SECOND_THOUGHTS: SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0); - LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE478); + LogMessageByIdWithPopupCheckUser(entity,gUnknown_80FE478); break; default: info->action.action = ACTION_PASS_TURN; @@ -321,7 +314,7 @@ bool8 sub_8072CF4(Entity *entity) } } if (bVar4) { - LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FD2CC); + LogMessageByIdWithPopupCheckUser(entity,gUnknown_80FD2CC); } } sub_807360C(); @@ -409,7 +402,7 @@ void sub_80732F0(void) } } SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0); - LogMessageByIdWithPopupCheckUser(entity, *gUnknown_80FCF38); // {ARG_POKEMON_0} uttered its sleep talk! + LogMessageByIdWithPopupCheckUser(entity, gUnknown_80FCF38); // {ARG_POKEMON_0} uttered its sleep talk! info->action.direction = sl & DIRECTION_MASK; TryUseChosenMove(entity, 0, ITEM_NOTHING, 1, FALSE, &moveStack); flag = TRUE; @@ -475,7 +468,7 @@ void sub_807348C(void) } } SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0); - LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FCF50); + LogMessageByIdWithPopupCheckUser(pokemon,gUnknown_80FCF50); info->action.direction = r8 & DIRECTION_MASK; TryUseChosenMove(pokemon,0,ITEM_NOTHING,1,FALSE,&chosenMove); info->unk165 |= 0xff; diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c index dac39cfcb..d3fda6eca 100644 --- a/src/dungeon_engine.c +++ b/src/dungeon_engine.c @@ -14,11 +14,7 @@ #include "dungeon_logic.h" #include "menu_input.h" -extern void TrySpawnMonsterAndActivatePlusMinus(void); extern void sub_807E378(void); -extern void sub_8044574(void); -extern void sub_8044820(void); -extern void sub_8044AB4(void); extern u8 DisplayActions(u32); extern void TickStatusAndHealthRegen(Entity *); extern void sub_8086AC0(void); @@ -32,6 +28,10 @@ extern void sub_807EAA0(u32, u32); static void sub_8044454(void); static bool8 RunLeaderTurn(bool8); +static void sub_8044574(void); +static void sub_8044820(void); +static void TrySpawnMonsterAndActivatePlusMinus(void); +static void sub_8044AB4(void); EWRAM_DATA DungeonPos gUnknown_202EE0C = {0}; EWRAM_DATA MenuInputStruct gDungeonMenu = {0}; @@ -197,7 +197,7 @@ struct Struct_8044574 struct Struct_8044574 *next; }; -void sub_8044574(void) +static void sub_8044574(void) { s32 i, id; struct Struct_8044574 sp0[4]; @@ -317,7 +317,7 @@ void sub_8044574(void) } } -void sub_8044820(void) +static void sub_8044820(void) { s32 movSpeed; EntityInfo *entityInfo; @@ -377,7 +377,7 @@ void sub_8044820(void) } } -void TrySpawnMonsterAndActivatePlusMinus(void) +static void TrySpawnMonsterAndActivatePlusMinus(void) { EntityInfo * entityInfo; Entity *entity; @@ -424,7 +424,7 @@ void TrySpawnMonsterAndActivatePlusMinus(void) } } -void sub_8044AB4(void) +static void sub_8044AB4(void) { s32 index; diff --git a/src/dungeon_generation.c b/src/dungeon_generation.c index 006f615e2..642a83611 100644 --- a/src/dungeon_generation.c +++ b/src/dungeon_generation.c @@ -17,6 +17,7 @@ #include "dungeon_config.h" #include "dungeon_generation_fixed.h" #include "dungeon_pos_data.h" +#include "dungeon_data.h" extern s32 sub_803DA20(s16 species); extern void sub_8049840(void); diff --git a/src/dungeon_logic.c b/src/dungeon_logic.c index 7a012e6f4..eaf249eda 100644 --- a/src/dungeon_logic.c +++ b/src/dungeon_logic.c @@ -29,6 +29,7 @@ #include "pokemon.h" #include "dungeon_config.h" #include "dungeon_pos_data.h" +#include "dungeon_data.h" // This file deals with things like controlling movement, walkable tiles, ai targeting, status checks and pokemon attributes. diff --git a/src/dungeon_main.c b/src/dungeon_main.c index dfb3efb56..8b9244a36 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -56,6 +56,7 @@ #include "weather.h" #include "dungeon_pos_data.h" #include "dungeon_kecleon_shop.h" +#include "dungeon_engine.h" extern void HandleUnsetItemAction(Entity *,bool8); extern bool8 sub_8048A68(Entity *param_1,Item *item); @@ -79,7 +80,6 @@ static void TryCreateModeArrows(Entity *leader); bool8 sub_8094C48(void); void sub_803E724(s32 a0); void HandleTalkFieldAction(Entity *); -bool8 IsFloorOver(void); bool8 IsNotAttacking(Entity *param_1, bool8 param_2); s32 GetTeamMemberEntityIndex(Entity *pokemon); bool8 sub_8070F80(Entity * pokemon, s32 direction); diff --git a/src/dungeon_map_access.c b/src/dungeon_map_access.c index 1c174ad35..0e6ea063b 100644 --- a/src/dungeon_map_access.c +++ b/src/dungeon_map_access.c @@ -18,6 +18,7 @@ #include "text_1.h" #include "code_806CD90.h" #include "dungeon_pos_data.h" +#include "dungeon_data.h" extern void sub_8042A14(DungeonPos *); diff --git a/src/dungeon_menu_team.c b/src/dungeon_menu_team.c index e8ccdbac9..7a0c49249 100644 --- a/src/dungeon_menu_team.c +++ b/src/dungeon_menu_team.c @@ -29,6 +29,7 @@ #include "dungeon_random.h" #include "dungeon_submenu.h" #include "dungeon_util.h" +#include "dungeon_strings.h" #include "input.h" #include "items.h" #include "menu_input.h" @@ -69,7 +70,6 @@ bool8 sub_8094C48(void); bool8 sub_805EC4C(Entity *a0, u8 a1); void sub_803E724(s32 a0); void HandleTalkFieldAction(Entity *); -bool8 IsFloorOver(void); bool8 IsNotAttacking(Entity *param_1, bool8 param_2); void ShowMainMenu(bool8 fromBPress, bool8 a1); bool8 sub_805EF60(Entity *a0, EntityInfo *a1); @@ -115,16 +115,6 @@ extern MenuInputStruct gDungeonMenu; extern s32 gDungeonFramesCounter; extern u8 gUnknown_202EE39; -extern const u8 *gUnknown_80FE940; -extern const u8 *const gUnknown_80FE954; -extern const u8 gUnknown_8106BEC[]; -extern const u8 gUnknown_8106BF4[]; -extern const u8 *const gUnknown_80FE95C; -extern const u8 *const gUnknown_80FE960; -extern const u8 *const gUnknown_80FE964; -extern const u8 *const gUnknown_80FE978; -extern const u8 *const gWhichTextPtr2; - EWRAM_DATA s32 gTeamMenuChosenId = 0; static UNUSED EWRAM_DATA u8 sUnused[4] = {0}; EWRAM_DATA static SpriteOAM sOAMStatusDescriptionArrow = {0}; diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index e7a5efb4e..51394f4da 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -44,6 +44,7 @@ #include "dungeon_strings.h" #include "dungeon_8083AB0.h" #include "dungeon_pos_data.h" +#include "dungeon_data.h" static void EnsureCastformLoaded(void); static void EnsureDeoxysLoaded(void); @@ -85,12 +86,6 @@ extern void sub_806B678(void); extern void EntityUpdateStatusSprites(Entity *); extern Entity *sub_80696A8(Entity *a0); -extern const s16 gUnknown_810AC60; // 0xC -extern const s16 gUnknown_810AC62; // 0xC -extern const s16 gUnknown_810AC68; // 0x8 -extern const s16 gUnknown_810AC64; // 0x8 -extern const s16 gUnknown_810AC66; // 0x8 - extern Entity *gLeaderPointer; extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE]; extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE]; diff --git a/src/dungeon_util.c b/src/dungeon_util.c index f1eafb69d..7d1dedbd5 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -25,8 +25,8 @@ #include "string_format.h" #include "items.h" #include "trap.h" - -extern const u8 *gUnknown_80FE6F4[]; +#include "dungeon_data.h" +#include "dungeon_strings.h" extern void sub_8045ACC(void); extern s32 GetMonsterApparentID(Entity *pokemon, s32 id); @@ -618,7 +618,7 @@ void SubstitutePlaceholderStringTags(u8 *buffer, Entity *entity, u32 param_3) GetTrapName(buffer, GetTrapData_1(entity)->id); break; default: - strcpy(buffer, *gUnknown_80FE6F4); + strcpy(buffer, gUnknown_80FE6F4); break; } } diff --git a/src/dungeon_wind.c b/src/dungeon_wind.c index f56d0f621..e8c136376 100644 --- a/src/dungeon_wind.c +++ b/src/dungeon_wind.c @@ -12,14 +12,14 @@ #include "dungeon_util.h" #include "dungeon_config.h" #include "dungeon_strings.h" +#include "dungeon_main.h" +#include "dungeon_misc.h" #include "move_util.h" #include "moves.h" #include "structs/str_dungeon.h" #include "dungeon_engine.h" extern u8 DisplayActions(Entity *); -extern void sub_805E804(void); -void TryPointCameraToMonster(Entity *pokemon, u8 param_2); void sub_807E378(void) { diff --git a/src/move_orb_effects_1.c b/src/move_orb_effects_1.c index e00dd2edc..c63349e23 100644 --- a/src/move_orb_effects_1.c +++ b/src/move_orb_effects_1.c @@ -34,6 +34,7 @@ #include "status.h" #include "dungeon_vram.h" #include "dungeon_pos_data.h" +#include "dungeon_data.h" extern void sub_80420A0(Entity *); extern void sub_8041C58(Entity *r0); diff --git a/src/pokemon.c b/src/pokemon.c index e50245abd..a3183bad8 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "pokemon.h" #include "constants/colors.h" #include "constants/monster.h" #include "constants/tactic.h" @@ -12,18 +13,19 @@ #include "file_system.h" #include "friend_area.h" #include "moves.h" -#include "pokemon.h" #include "pokemon_3.h" #include "sprite.h" #include "text_util.h" +#include "dungeon_data.h" +#include "strings.h" -static EWRAM_DATA MonsterDataEntry *gMonsterParameters = {NULL}; // B=02135090 -static EWRAM_DATA OpenedFile *gMonsterParametersFile = {NULL}; -static EWRAM_DATA SpriteOAM gShadowSprites[3] = {0}; -static EWRAM_DATA RecruitedMon gRecruitedPokemon = {0}; // B=02135560 -static EWRAM_DATA u16 gLevelCurrentPokeId = {0}; +static EWRAM_DATA MonsterDataEntry *sMonsterParameters = {NULL}; // B=02135090 +static EWRAM_DATA OpenedFile *sMonsterParametersFile = {NULL}; +static EWRAM_DATA SpriteOAM sShadowSprites[3] = {0}; +static EWRAM_DATA RecruitedMon sRecruitedPokemon = {0}; // B=02135560 +static EWRAM_DATA s16 sLevelCurrentPokeId = {0}; UNUSED static EWRAM_DATA u16 unused_data[3] = {0}; -static EWRAM_DATA LevelData gLevelCurrentData[0x64] = {0}; +static EWRAM_DATA LevelData sLevelCurrentData[0x64] = {0}; // TODO: Add MAX_LEVEL define EWRAM_INIT RecruitedMon *gRecruitedPokemonRef = {NULL}; // B=020EAF94 @@ -33,28 +35,20 @@ struct unkStruct_8107654 s32 unk4; }; -extern s16 gFrenzyPlantIQReq; // 0x14d -extern s16 gHydroCannonIQReq; // 0x14d -extern s16 gBlastBurnIQReq; // 0x14d -extern s16 gVoltTackleIQReq; // 0x14d -extern char* gFormattedStatusNames[]; - -extern void DungeonMonToPokemon(Pokemon*, DungeonMon*); - // arm9.bin::0205C34C void LoadMonsterParameters(void) { - gRecruitedPokemonRef = &gRecruitedPokemon; - gMonsterParametersFile = OpenFileAndGetFileDataPtr("monspara", &gSystemFileArchive); - gMonsterParameters = (MonsterDataEntry *)gMonsterParametersFile->data; - gLevelCurrentPokeId = 0; + gRecruitedPokemonRef = &sRecruitedPokemon; + sMonsterParametersFile = OpenFileAndGetFileDataPtr("monspara", &gSystemFileArchive); + sMonsterParameters = (MonsterDataEntry *)sMonsterParametersFile->data; + sLevelCurrentPokeId = 0; // More in blue } // arm9.bin::0205C340 RecruitedMon *GetRecruitedPokemon(void) { - return &gRecruitedPokemon; + return &sRecruitedPokemon; } // arm9.bin::0205C2A4 @@ -120,7 +114,7 @@ void sub_808CE74(s16 _species, bool32 _isLeader, u8* name) pokemon.name[j] = name[j]; } } - friendArea = gMonsterParameters[species].friendArea; + friendArea = sMonsterParameters[species].friendArea; for (i = 0; i < NUM_MONSTERS; i++) { if (!PokemonExists(&gRecruitedPokemonRef->pokemon[i])) { u8 speciesFriendArea = sub_80923D4(i); @@ -241,7 +235,7 @@ Pokemon *TryAddPokemonToRecruited(Pokemon *pokemon) { s32 i; s32 species = pokemon->speciesNum; - u32 friendArea = gMonsterParameters[species].friendArea; + u32 friendArea = sMonsterParameters[species].friendArea; if (!gFriendAreas[friendArea]) return NULL; @@ -263,7 +257,7 @@ Pokemon *sub_808D278(s32 species) { s32 i; s16 species_s16 = (s16)species; - u32 friendArea = gMonsterParameters[species_s16].friendArea; + u32 friendArea = sMonsterParameters[species_s16].friendArea; if (!gFriendAreas[friendArea]) return NULL; @@ -621,20 +615,20 @@ bool8 ComparePokemonNames(s16 a1, s16 a2) void CopyMonsterNameToBuffer(u8 * buffer, s32 index) { s16 index_s16 = index; - strncpy(buffer, gMonsterParameters[index_s16].species, 0x14); + strncpy(buffer, sMonsterParameters[index_s16].species, 0x14); } // arm9.bin::0205B274 void CopyYellowMonsterNametoBuffer(u8 *buffer, s16 index) { s32 new_index = index; - sprintfStatic(buffer, _("{color YELLOW_RAW}%s{reset}"), gMonsterParameters[new_index].species); + sprintfStatic(buffer, _("{color YELLOW_RAW}%s{reset}"), sMonsterParameters[new_index].species); } void CopyCyanMonsterNametoBuffer(u8 *buffer, s32 index_) { s32 index = (s16) index_; - sprintfStatic(buffer, _("{color CYAN_RAW}%s{reset}"), gMonsterParameters[index].species); + sprintfStatic(buffer, _("{color CYAN_RAW}%s{reset}"), sMonsterParameters[index].species); } void sub_808D930(u8 *buffer, s32 index) @@ -646,13 +640,13 @@ void sub_808D930(u8 *buffer, s32 index) sprintfStatic(buffer,"%s%c",GetMonSpecies(MONSTER_UNOWN),unownLetters[GetUnownIndex(index_s16)]); } else { - sprintfStatic(buffer,"%s", gMonsterParameters[index_s16].species); + sprintfStatic(buffer,"%s", sMonsterParameters[index_s16].species); } } char * GetMonSpecies(s16 index) { - return gMonsterParameters[index].species; + return sMonsterParameters[index].species; } void PrintColoredPokeNameToBuffer(u8 *buffer, Pokemon *pokemon, s32 colorNum) @@ -723,132 +717,132 @@ bool8 sub_808DA44(s32 _species, u32 a2_) u8 *GetCategoryString(s16 index) { - return gMonsterParameters[index].category; + return sMonsterParameters[index].category; } u8 GetBodySize(s32 index) { s16 index_s16 = index; - return gMonsterParameters[index_s16].bodySize; + return sMonsterParameters[index_s16].bodySize; } u8 GetShadowSize(s16 index) { - return gMonsterParameters[index].shadowSize; + return sMonsterParameters[index].shadowSize; } s32 GetMovementSpeed(s16 index) { - return gMonsterParameters[index].movementSpeed; + return sMonsterParameters[index].movementSpeed; } u8 GetMovementType(s16 index) { - return gMonsterParameters[index].movementType; + return sMonsterParameters[index].movementType; } u8 GetRegenSpeed(s16 index) { - return ((u8)(gMonsterParameters[index].regenSpeed) << 25) >> 24; + return ((u8)(sMonsterParameters[index].regenSpeed) << 25) >> 24; } bool8 GetCanMoveFlag(s16 index) { - return gMonsterParameters[index].canMove; + return sMonsterParameters[index].canMove; } u8 GetChanceAsleep(s16 index) { - return gMonsterParameters[index].chanceAsleep; + return sMonsterParameters[index].chanceAsleep; } u32 GetWeight(s16 index) { - return gMonsterParameters[index].weight; + return sMonsterParameters[index].weight; } u32 GetSize(s16 index) { - return gMonsterParameters[index].size; + return sMonsterParameters[index].size; } u8 GetFriendArea(s32 index) { s16 index_s32 = index; - return gMonsterParameters[index_s32].friendArea; + return sMonsterParameters[index_s32].friendArea; } s32 GetBaseHP(s32 index) { s16 index_s32 = index; - return gMonsterParameters[index_s32].baseHP; + return sMonsterParameters[index_s32].baseHP; } bool8 MonsterIDCanThrowItems(s16 index) { - return gMonsterParameters[index].canThrowItems; + return sMonsterParameters[index].canThrowItems; } u8 GetUnk12(s16 index) { - return gMonsterParameters[index].unk12; + return sMonsterParameters[index].unk12; } s32 GetPokemonEvolveFrom(s32 index) { s16 index_s16 = index; - return gMonsterParameters[index_s16].preEvolution.evolveFrom; + return sMonsterParameters[index_s16].preEvolution.evolveFrom; } s32 GetBaseOffensiveStat(s32 index, u32 r1) { s16 index_s16 = index; - return gMonsterParameters[index_s16].baseAtkSpAtk[r1]; + return sMonsterParameters[index_s16].baseAtkSpAtk[r1]; } s32 GetBaseDefensiveStat(s32 index, u32 r1) { s16 index_s16 = index; - return gMonsterParameters[index_s16].baseDefSpDef[r1]; + return sMonsterParameters[index_s16].baseDefSpDef[r1]; } // arm9.bin::0205AE2C u8 GetPokemonType(s32 index, u32 typeIndex) { s16 newIndex = index; - return gMonsterParameters[newIndex].types[typeIndex]; + return sMonsterParameters[newIndex].types[typeIndex]; } u8 GetPokemonAbility(s16 index, u32 abilityIndex) { - return gMonsterParameters[index].abilities[abilityIndex]; + return sMonsterParameters[index].abilities[abilityIndex]; } s16 GetDexInternalNo(s32 index, u32 r1) { s16 index_s16 = index; - return gMonsterParameters[index_s16].dexInternal[r1]; + return sMonsterParameters[index_s16].dexInternal[r1]; } s16 GetRecruitRate(s16 index) { - return gMonsterParameters[index].recruitRate; + return sMonsterParameters[index].recruitRate; } s16 GetAlphabetParentNo(s16 index, s32 r1) { - return gMonsterParameters[index].alphabetParent[r1]; + return sMonsterParameters[index].alphabetParent[r1]; } s16 GetInternalNo(s16 index) { - return gMonsterParameters[index].dexInternal[1]; + return sMonsterParameters[index].dexInternal[1]; } s32 CalculateEXPGain(s16 index, s32 level) { - s32 expYield = gMonsterParameters[index].expYield; + s32 expYield = sMonsterParameters[index].expYield; return expYield + (expYield * (level - 1)) / 10; } @@ -856,8 +850,8 @@ s16 GetPokemonEvolveConditions(s16 index, unkEvolve *r1) { PreEvolution temp2; EvolutionRequirements temp1; - temp1 = gMonsterParameters[index].evolutionRequirements; - temp2 = gMonsterParameters[index].preEvolution; + temp1 = sMonsterParameters[index].evolutionRequirements; + temp2 = sMonsterParameters[index].preEvolution; r1->preEvolution = temp2; r1->evolutionRequirements = temp1; // The return value is not used anywhere, but necessary for the function to match. @@ -873,7 +867,7 @@ u8 GetPokemonOverworldPalette(s16 index, bool32 recolorShopKecleon) } else { - return gMonsterParameters[id].overworldPalette; + return sMonsterParameters[id].overworldPalette; } } @@ -882,7 +876,7 @@ OpenedFile *OpenPokemonDialogueSpriteFile(s16 index) // Looks like this loads the dialogue sprite for the pokemon char buffer[0xC]; - if(gMonsterParameters[index].dialogueSprites == 0) + if(sMonsterParameters[index].dialogueSprites == 0) { return NULL; } @@ -897,7 +891,7 @@ OpenedFile *GetDialogueSpriteDataPtr(s32 index) char buffer[0xC]; s16 id = SpeciesId(index); - if(gMonsterParameters[id].dialogueSprites == 0) + if(sMonsterParameters[id].dialogueSprites == 0) { return NULL; } @@ -908,7 +902,7 @@ OpenedFile *GetDialogueSpriteDataPtr(s32 index) bool8 IsPokemonDialogueSpriteAvail(s16 index, s32 spriteId) { // checking to see if dialogue sprite is available?? - return (gMonsterParameters[index].dialogueSprites >> spriteId) & 1; + return (sMonsterParameters[index].dialogueSprites >> spriteId) & 1; } void RecruitedPokemonToDungeonMon(DungeonMon *dst, u32 recruitedPokemonId) @@ -1012,21 +1006,21 @@ void GetLvlUpEntry(LevelData* a1, s32 _id, s32 level) u8 buffer[12]; s32 id = SpeciesId(_id); - if ((s16)gLevelCurrentPokeId != id) + if (sLevelCurrentPokeId != id) { OpenedFile *file; - gLevelCurrentPokeId = id; + sLevelCurrentPokeId = id; sprintf(buffer, "lvmp%03d", id); file = OpenFileAndGetFileDataPtr(buffer, &gSystemFileArchive); - DecompressATFile(gLevelCurrentData, 0, file); + DecompressATFile(sLevelCurrentData, 0, file); CloseFile(file); } level -= 1; if ( level < 0 ) level = 0; - *a1 = gLevelCurrentData[level]; + *a1 = sLevelCurrentData[level]; } const u8* DecompressMoveID(const u8* src, u16* moveID) @@ -1326,7 +1320,7 @@ void InitShadowSprites(s32 param_1, s32 param_2) CloseFile(file); for (spriteIndex = 0; spriteIndex < 3; spriteIndex++) { - SpriteOAM *sprite = &gShadowSprites[spriteIndex]; + SpriteOAM *sprite = &sShadowSprites[spriteIndex]; SpriteSetAffine1(sprite, 0); SpriteSetAffine2(sprite, 0); @@ -1357,10 +1351,10 @@ bool8 AddShadowSprite(s16 species, s16* a2, s16* a3) x += gUnknown_81076C4[shadowSize]; y -= 4; - SpriteSetX(&gShadowSprites[shadowSize], x); - SpriteSetY(&gShadowSprites[shadowSize], y); + SpriteSetX(&sShadowSprites[shadowSize], x); + SpriteSetY(&sShadowSprites[shadowSize], y); - AddSprite(&gShadowSprites[shadowSize], 0, NULL, NULL); + AddSprite(&sShadowSprites[shadowSize], 0, NULL, NULL); } return TRUE; diff --git a/src/position_util.c b/src/position_util.c index 159fc9aa7..fc87d3b9e 100644 --- a/src/position_util.c +++ b/src/position_util.c @@ -3,7 +3,7 @@ #include "constants/direction.h" -const s32 gFacingDirMapping[3][3] = { +static const s32 sFacingDirMapping[3][3] = { {DIRECTION_NORTHWEST, DIRECTION_NORTH, DIRECTION_NORTHEAST}, {DIRECTION_WEST, DIRECTION_SOUTH, DIRECTION_EAST}, {DIRECTION_SOUTHWEST, DIRECTION_SOUTH, DIRECTION_SOUTHEAST} @@ -39,7 +39,7 @@ s32 GetDirectionTowardsPosition(DungeonPos *originPos, DungeonPos *targetPos) { yDiff = -1; } - direction = gFacingDirMapping[yDiff + 1][xDiff + 1]; + direction = sFacingDirMapping[yDiff + 1][xDiff + 1]; } return direction; } diff --git a/src/run_dungeon.c b/src/run_dungeon.c index d7348549f..6ae3ed66b 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -49,6 +49,8 @@ #include "text_1.h" #include "text_3.h" #include "weather.h" +#include "dungeon_data.h" +#include "dungeon_jobs.h" EWRAM_INIT struct UnkStruct_203B414 *gUnknown_203B414 = NULL; EWRAM_INIT Dungeon *gDungeon = NULL; @@ -67,7 +69,6 @@ extern void sub_8068F28(void); extern void sub_806C1D8(void); extern void IncrementThievingSuccesses(void); extern void ShowDungeonClearedWindow(void); -extern void sub_8084424(void); extern void sub_8086130(void); extern void sub_80847D4(void); extern void sub_8043D60(void); @@ -91,7 +92,6 @@ extern void sub_807E7FC(u8); extern void sub_8068A84(Pokemon *pokemon); extern void sub_807EAA0(u32, u32); extern void SetFloorItemMonsterSpawns(void); -extern void sub_80842F0(void); extern void sub_80427AC(void); extern void sub_806AA70(void); extern void sub_806AD3C(void); diff --git a/src/warp_target.c b/src/warp_target.c index bf03d403c..2e545203e 100644 --- a/src/warp_target.c +++ b/src/warp_target.c @@ -29,9 +29,6 @@ extern u32 gDungeonFramesCounter; -bool8 ExposeTrap(s32 x, s32 y); -void UpdateMinimap(); -u8 IsFloorOver(void); void sub_80421AC(Entity * pokemon, Entity * target); void sub_807BB78(Entity *pokemon); extern void UpdateCamera(u32);