From 37193ed8794cbb3fb432921a20a6602c9367f221 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 17 Oct 2025 13:44:18 +0200 Subject: [PATCH 1/5] document rename dungeon files --- include/dungeon_8083AB0.h | 11 --- include/dungeon_config.h | 8 +-- include/dungeon_data.h | 10 +-- include/dungeon_exit.h | 11 +++ include/dungeon_strings.h | 4 +- include/dungeon_wild_mon_spawn.h | 6 ++ include/structs/str_dungeon.h | 10 +-- ld_script.ld | 8 +-- src/code_8066D04.c | 2 +- src/dungeon_8071B48.c | 118 ------------------------------- src/dungeon_8083AB0.c | 114 ----------------------------- src/dungeon_config.c | 9 ++- src/dungeon_damage.c | 24 +++---- src/dungeon_data.c | 10 +-- src/dungeon_engine.c | 4 +- src/dungeon_exit.c | 103 +++++++++++++++++++++++++++ src/dungeon_generation.c | 4 +- src/dungeon_kecleon_shop.c | 4 +- src/dungeon_logic.c | 2 +- src/dungeon_main.c | 2 +- src/dungeon_menu_others.c | 4 +- src/dungeon_menu_recruitment.c | 2 +- src/dungeon_misc.c | 18 ++--- src/dungeon_mon_spawn.c | 2 +- src/dungeon_move.c | 6 +- src/dungeon_strings.c | 4 +- src/dungeon_util.c | 2 +- src/dungeon_wild_mon_spawn.c | 113 +++++++++++++++++++++++++++++ src/move_orb_actions_4.c | 2 +- src/pokemon_3.c | 24 +++---- src/pokemon_summary_window.c | 12 ++-- src/run_dungeon.c | 34 ++++----- src/trap.c | 2 +- 33 files changed, 339 insertions(+), 350 deletions(-) delete mode 100644 include/dungeon_8083AB0.h create mode 100644 include/dungeon_exit.h create mode 100644 include/dungeon_wild_mon_spawn.h delete mode 100644 src/dungeon_8071B48.c delete mode 100644 src/dungeon_8083AB0.c create mode 100644 src/dungeon_exit.c create mode 100644 src/dungeon_wild_mon_spawn.c diff --git a/include/dungeon_8083AB0.h b/include/dungeon_8083AB0.h deleted file mode 100644 index 9b73786cc..000000000 --- a/include/dungeon_8083AB0.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef GUARD_DUNGEON_8083AB0_H -#define GUARD_DUNGEON_8083AB0_H - -#include "structs/dungeon_entity.h" - -void sub_8083AB0(s16 dungeonExitReason, Entity *target, Entity *entity); -bool8 IsUnsuccessfulDungeonExit(void); -bool8 sub_8083C50(void); -bool8 sub_8083C88(u8 param_1); - -#endif // GUARD_DUNGEON_8083AB0_H diff --git a/include/dungeon_config.h b/include/dungeon_config.h index 1494fe059..0269129d1 100644 --- a/include/dungeon_config.h +++ b/include/dungeon_config.h @@ -12,10 +12,10 @@ extern const s16 gMonsterHouseMaxItemsTraps; extern const s16 gMonsterHouseMinMons; extern const s16 gMonsterHouseMaxMons; -extern const s16 gUnknown_80F4DA6; -extern const s16 gUnknown_80F4DA8; -extern const s16 gUnknown_80F4DAA; -extern const s16 gUnknown_80F4DAC; +extern const s16 gMaxWildMonsInMonsterHouse; +extern const s16 gMaxWildMonsInRoom; +extern const s16 gWildSpawnIntervalFrames; +extern const s16 gKecleonSpawnIntervalFrames; extern const s16 gCritOddsScopeLensPatsyBand; extern const s16 gCritOddsIqAdvantageMaster; extern const s16 gAIConfusedAttackChance; diff --git a/include/dungeon_data.h b/include/dungeon_data.h index a9b9c744b..2e57d7356 100644 --- a/include/dungeon_data.h +++ b/include/dungeon_data.h @@ -43,11 +43,11 @@ extern const s32 gUnknown_810A3F0[100]; extern const s16 gTypeGummiIQBoost[NUM_TYPES][NUMBER_OF_GUMMIS]; extern const s16 gUnknown_810A808[NUM_TYPES][NUMBER_OF_GUMMIS]; extern const FriendAreaSettings gFriendAreaSettings[NUM_FRIEND_AREAS]; -extern const s16 gUnknown_810AC60; -extern const s16 gUnknown_810AC62; -extern const s16 gUnknown_810AC64; -extern const s16 gUnknown_810AC66; -extern const s16 gUnknown_810AC68; +extern const s16 gPowerBandBoost; +extern const s16 gSpecialBandBoost; +extern const s16 gDefScarfBoost; +extern const s16 gZincBandBoost; +extern const s16 gMunchBeltBoost; extern const u8 gBestResistTypeTable[NUM_TYPES]; extern const bool8 gIsTypePhysicalTable[NUM_TYPES]; extern const s32 gUnknown_810AC90[10]; diff --git a/include/dungeon_exit.h b/include/dungeon_exit.h new file mode 100644 index 000000000..62a472113 --- /dev/null +++ b/include/dungeon_exit.h @@ -0,0 +1,11 @@ +#ifndef GUARD_DUNGEON_EXIT_H +#define GUARD_DUNGEON_EXIT_H + +#include "structs/dungeon_entity.h" + +void SetUpDungeonExitData(s16 dungeonExitReason, Entity *target, Entity *entity); +bool8 IsUnsuccessfulDungeonExit(void); +bool8 sub_8083C50(void); +bool8 sub_8083C88(u8 param_1); + +#endif // GUARD_DUNGEON_EXIT_H diff --git a/include/dungeon_strings.h b/include/dungeon_strings.h index af1bd3f4f..2bb3393fe 100644 --- a/include/dungeon_strings.h +++ b/include/dungeon_strings.h @@ -688,7 +688,7 @@ extern const u8 *const gUnknown_80FE690; extern const u8 *const gUnknown_80FE6B4; extern const u8 *const gUnknown_80FE6D4; extern const u8 *const gText_TheLastOuting; -extern const u8 *const gUnknown_80FE6F4; +extern const u8 *const gText_Someone; extern const u8 *const gUnknown_80FE708; extern const u8 *const gUnknown_80FE70C; extern const u8 *const gUnknown_80FE720; @@ -756,7 +756,7 @@ extern const u8 *const gUnknown_80FED08; extern const u8 *const gUnknown_80FED0C; extern const u8 *const gUnknown_80FED30; extern const u8 *const gUnknown_80FED34; -extern const u8 *const gUnknown_80FED68; +extern const u8 *const gText_Pokemon0Blinked; extern const u8 *const gUnknown_80FED88; extern const u8 *const gUnknown_80FEDA8; extern const u8 *const gUnknown_80FEDC8; diff --git a/include/dungeon_wild_mon_spawn.h b/include/dungeon_wild_mon_spawn.h new file mode 100644 index 000000000..5cd6380ca --- /dev/null +++ b/include/dungeon_wild_mon_spawn.h @@ -0,0 +1,6 @@ +#ifndef GUARD_DUNGEON_WILD_MON_SPAWN_H +#define GUARD_DUNGEON_WILD_MON_SPAWN_H + +void TrySpawnWildMonster(void); + +#endif // GUARD_DUNGEON_WILD_MON_SPAWN_H diff --git a/include/structs/str_dungeon.h b/include/structs/str_dungeon.h index 4cc3e1232..2bb8d6c1d 100644 --- a/include/structs/str_dungeon.h +++ b/include/structs/str_dungeon.h @@ -254,14 +254,14 @@ typedef struct unkDungeon644 /* 0x19 */ u8 unk19; /* 0x1A */ u8 fill1A[2]; /* 0x1C */ s16 fractionalTurn; // Handles turn order when Pokémon have different movement speeds. - /* 0x1E */ s16 unk1E; - /* 0x20 */ s16 unk20; + /* 0x1E */ s16 wildMonSpawnFrames; + /* 0x20 */ s16 enemyDensity; // Taken directly from FloorProperties. Checked only once, if 0 there will be no wild Pokemon in dungeon. /* 0x22 */ s16 windTurns; // Turns remaining before getting swept out of the dungeon. /* 0x24 */ u16 unk24; /* 0x26 */ u16 bossSongIndex; /* 0x28 */ u8 unk28; /* 0x29 */ u8 unk29; - /* 0x2A */ u8 unk2A; + /* 0x2A */ bool8 stoleFromKecleon; /* 0x2B */ u8 unk2B; /* 0x2C */ u8 unk2C; /* 0x2D */ bool8 monsterHouseTriggered; @@ -468,10 +468,10 @@ typedef struct Dungeon /* 0x15E2C */ Entity trapEntites[DUNGEON_MAX_TRAPS]; /* 0x17B2C */ Entity *lightningRodPokemon; /* 0x17B30 */ Entity *snatchPokemon; - /* 0x17B34 */ Entity *unk17B34; + /* 0x17B34 */ Entity *illuminatePokemon; /* 0x17B38 */ u32 unk17B38; /* 0x17B3C */ u32 unk17B3C; - /* 0x17B3C */ u32 unk17B40; + /* 0x17B3C */ u32 illuminateMonSpawnGenID; /* 0x17B44 */ OpenedFile *sprites[MONSTER_MAX]; /* 0x181E4 */ OpenedFile *paletFile; /* 0x181E8 */ UnkDungeonGlobal_unk181E8_sub unk181e8; diff --git a/ld_script.ld b/ld_script.ld index 121391bcf..4e9706867 100755 --- a/ld_script.ld +++ b/ld_script.ld @@ -241,7 +241,7 @@ SECTIONS { src/code_806FDF4.o(.text); src/status_checks.o(.text); src/dungeon_logic.o(.text); - src/dungeon_8071B48.o(.text); + src/dungeon_wild_mon_spawn.o(.text); src/dungeon_leveling.o(.text); src/dungeon_ai_leader.o(.text); src/dungeon_action_execution.o(.text); @@ -273,7 +273,7 @@ SECTIONS { src/trap.o(.text); src/dungeon_serializer.o(.text); src/dungeon_range.o(.text); - src/dungeon_8083AB0.o(.text); + src/dungeon_exit.o(.text); src/dungeon_music.o(.text); src/dungeon_random.o(.text); src/dungeon_cleared_window.o(.text); @@ -626,7 +626,7 @@ SECTIONS { src/code_806FDF4.o(.rodata); src/status_checks.o(.rodata); src/dungeon_logic.o(.rodata); - src/dungeon_8071B48.o(.rodata); + src/dungeon_wild_mon_spawn.o(.rodata); src/dungeon_leveling.o(.rodata); src/dungeon_ai_leader.o(.rodata); src/dungeon_action_execution.o(.rodata); @@ -661,7 +661,7 @@ SECTIONS { src/dungeon_serializer.o(.rodata); data/pksdir_4.o(.rodata); src/dungeon_range.o(.rodata); - src/dungeon_8083AB0.o(.rodata); + src/dungeon_exit.o(.rodata); src/dungeon_music.o(.rodata); src/dungeon_random.o(.rodata); src/dungeon_cleared_window.o(.rodata); diff --git a/src/code_8066D04.c b/src/code_8066D04.c index 94dcafbb4..0af3745b5 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -636,7 +636,7 @@ void sub_8067558(Entity *entity, Entity *targetEntity, s32 a2) } if (info2->monsterBehavior == 1) { - if (gDungeon->unk644.unk2A != 0) { + if (gDungeon->unk644.stoleFromKecleon != 0) { DisplayDungeonMessage(NULL, gUnknown_80FF674, TRUE); } else if (gDungeon->unk644.unk33) { diff --git a/src/dungeon_8071B48.c b/src/dungeon_8071B48.c deleted file mode 100644 index b23e0645b..000000000 --- a/src/dungeon_8071B48.c +++ /dev/null @@ -1,118 +0,0 @@ -#include "global.h" -#include "globaldata.h" -#include "constants/tactic.h" -#include "dungeon_config.h" -#include "dungeon_range.h" -#include "dungeon_message.h" -#include "code_8041AD0.h" -#include "constants/dungeon.h" -#include "dungeon_map_access.h" -#include "dungeon_random.h" -#include "dungeon_util.h" -#include "dungeon_info.h" -#include "pokemon_3.h" -#include "code_805D8C8.h" -#include "dungeon_logic.h" -#include "dungeon_floor_spawns.h" -#include "dungeon_strings.h" -#include "dungeon_misc.h" -#include "dungeon_mon_spawn.h" - -extern void sub_8042920(struct Entity *r0); - -void sub_8071B48(void) -{ - const Tile *tile; - struct Entity *entity2; - struct Entity *entity; - int index; - int index1; - int counter; - struct Entity *entityPtr; - s32 level; - struct Dungeon *dungeon; // feels like a hack - struct MonSpawnInfo local_2c; - - entityPtr = NULL; - dungeon = gDungeon; - if ((dungeon->unk644.unk20 != 0) && - ((dungeon->unk644.dungeonLocation.id != DUNGEON_METEOR_CAVE || (dungeon->unk37FD == 0)))) { - dungeon->unk644.unk1E++; - if (dungeon->unk644.unk2A == 0) { - if ( dungeon->unk644.unk1E < gUnknown_80F4DAA) { - return; - } - } - else { - if ( dungeon->unk644.unk1E < gUnknown_80F4DAC) { - return; - } - } - - if (dungeon->unk644.unk1E > 900) { - entity2 = dungeon->unk17B34; - if ((EntityIsValid(entity2)) && (entity2->spawnGenID == dungeon->unk17B40)) { - SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity2,0); - entityPtr = entity2; - } - } - - dungeon->unk644.unk1E = 0; - dungeon->unk17B34 = NULL; - - counter = 0; - for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++) - { - entity = dungeon->wildPokemon[index]; - if ((EntityIsValid(entity)) && - (tile = GetTile((entity->pos).x, (entity->pos).y), - (tile->terrainFlags & TERRAIN_TYPE_UNBREAKABLE) == 0)) { - counter++; - } - } - if (dungeon->unk644.unk2A == 0) { - if (gDungeon->monsterHouseRoom == CORRIDOR_ROOM) { - if (counter >= gUnknown_80F4DA6) { - return; - } - } - else - { - if (counter >= gUnknown_80F4DA8) { - return; - } - } - - } - if (entityPtr != NULL) { - DisplayDungeonLoggableMessageTrue(0,gUnknown_80FED68); - sub_8042920(entityPtr); - } - if (dungeon->unk644.unk2A != 0) { - index1 = 0x17c; - } - else { - index1 = GetRandomFloorMonsterId(0); - } - - level = GetSpawnedMonsterLevel(index1); - if (level == 0) { - level = 1; - } - if ((sub_806AA0C(index1, 0)) && (sub_8083660(&local_2c.pos))) { - local_2c.species = index1; - local_2c.level = level; - local_2c.unk2 = 0; - if(DungeonRandInt(100) < GetRandomMovementChance(gDungeon->unk644.dungeonLocation.id)) - { - local_2c.unk4 = 1; - } - else - { - local_2c.unk4 = 0; - } - local_2c.unk10 = 0; - SpawnWildMon(&local_2c, FALSE); - } - } -} diff --git a/src/dungeon_8083AB0.c b/src/dungeon_8083AB0.c deleted file mode 100644 index c463fcb77..000000000 --- a/src/dungeon_8083AB0.c +++ /dev/null @@ -1,114 +0,0 @@ -#include "global.h" -#include "globaldata.h" -#include "constants/dungeon_exit.h" -#include "dungeon_8083AB0.h" -#include "dungeon_info.h" -#include "dungeon_util.h" -#include "text_util.h" -#include "dungeon_logic.h" -#include "dungeon_data.h" -#include "dungeon_strings.h" -#include "run_dungeon.h" - -void sub_8083AB0(s16 dungeonExitReason_, Entity *target, Entity *entity) -{ - u8 *defPtr; - u8 *attackPtr; - u8 *spDefPtr; - EntityInfo * entityInfo; - EntityInfo * targetEntityInfo; - u8 *spAttPtr; - u8 buffer [0x14]; - DungeonExitSummary *exitSummary; - u8 *id; - s32 dungeonExitReason = dungeonExitReason_; - - exitSummary = &gDungeon->exitSummary; - targetEntityInfo = NULL; - if ((EntityIsValid(target)) && (GetEntityType(target) == ENTITY_MONSTER)) { - targetEntityInfo = GetEntInfo(target); - } - entityInfo = GetEntInfo(entity); - if (targetEntityInfo != NULL) { - CopyEntityNameForDungeonExitSummary(buffer, targetEntityInfo); - CopyStringtoBuffer(exitSummary->buffer1, buffer); - } - else { - CopyStringtoBuffer(exitSummary->buffer1, gUnknown_80FE6F4); // Someone - } - CopyEntityNameForDungeonExitSummary(buffer,entityInfo); - CopyStringtoBuffer(exitSummary->buffer2, buffer); - exitSummary->exitReason = dungeonExitReason; - exitSummary->heldItem = entityInfo->heldItem; - exitSummary->exp = entityInfo->exp; - exitSummary->level = entityInfo->level; - exitSummary->maxHPStat = entityInfo->maxHPStat; - exitSummary->atk = entityInfo->atk[0]; - exitSummary->spAtk = entityInfo->atk[1]; - exitSummary->def = entityInfo->def[0]; - exitSummary->spDef = entityInfo->def[1]; - exitSummary->dungeonLocation = gDungeon->unk644.dungeonLocation; - attackPtr = &exitSummary->attBoost; - *attackPtr = 0; - spAttPtr = &exitSummary->spAttBoost; - *spAttPtr = 0; - defPtr = &exitSummary->defBoost; - *defPtr = 0; - spDefPtr = &exitSummary->spDefBoost; - *spDefPtr = 0; - if ((entityInfo->heldItem.flags & ITEM_FLAG_EXISTS) && !(entityInfo->heldItem.flags & ITEM_FLAG_STICKY)) { - id = &entityInfo->heldItem.id; - if (*id == ITEM_POWER_BAND) { - *attackPtr += gUnknown_810AC60; - } - if (*id == ITEM_MUNCH_BELT) { - *attackPtr += gUnknown_810AC68; - } - if (*id == ITEM_SPECIAL_BAND) { - *spAttPtr += gUnknown_810AC62; - } - if (*id == ITEM_MUNCH_BELT) { - *spAttPtr += gUnknown_810AC68; - } - if (*id == ITEM_DEF_SCARF) { - *defPtr += gUnknown_810AC64; - } - if (*id == ITEM_ZINC_BAND) { - *spDefPtr += gUnknown_810AC66; - } - } -} - -bool8 IsUnsuccessfulDungeonExit(void) -{ - DungeonExitSummary *exitSummary = &gDungeon->exitSummary; - - if (exitSummary->exitReason < DUNGEON_EXIT_REASON_SUCCESS) - return TRUE; - - return FALSE; -} - -bool8 sub_8083C50(void) -{ - DungeonExitSummary *exitSummary = &gDungeon->exitSummary; - - if (exitSummary->exitReason == DUNGEON_EXIT_CLEARED_DUNGEON - || exitSummary->exitReason == DUNGEON_EXIT_BEFRIENDED_MEW - || exitSummary->exitReason == DUNGEON_EXIT_SUCCEEDED_IN_RESCUE_MISSION) - return TRUE; - - return FALSE; -} - -bool8 sub_8083C88(u8 param_1) -{ - DungeonExitSummary *exitSummary = &gDungeon->exitSummary; - - if ((!HasCheckpoint(gDungeon->unk644.dungeonLocation.id) && (gDungeon->unk644.unk18 != 0 || param_1 != 0)) - || exitSummary->exitReason != DUNGEON_EXIT_CLEARED_DUNGEON) { - return TRUE; - } - - return FALSE; -} diff --git a/src/dungeon_config.c b/src/dungeon_config.c index 99749a6fb..e8ba20d69 100644 --- a/src/dungeon_config.c +++ b/src/dungeon_config.c @@ -20,11 +20,10 @@ const s16 gMonsterHouseMaxItemsTraps = 7; // Items and traps are included together const s16 gMonsterHouseMinMons = 8; const s16 gMonsterHouseMaxMons = 12; -// ? See sub_8071B48 -const s16 gUnknown_80F4DA6 = 10; -const s16 gUnknown_80F4DA8 = 4; -const s16 gUnknown_80F4DAA = 36; -const s16 gUnknown_80F4DAC = 5; +const s16 gMaxWildMonsInMonsterHouse = 10; +const s16 gMaxWildMonsInRoom = 4; +const s16 gWildSpawnIntervalFrames = 36; +const s16 gKecleonSpawnIntervalFrames = 5; const s16 gCritOddsScopeLensPatsyBand = 40; const s16 gCritOddsIqAdvantageMaster = 40; diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index 7c3c597b8..11ae7e7d9 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -1280,30 +1280,30 @@ void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s3 rand = DungeonRandInt(100); if (splitIndex == 0) { if (HasHeldItem(attacker, ITEM_POWER_BAND)) { - atkStat += gUnknown_810AC60; - gDungeon->unk134.unk160 += gUnknown_810AC60; + atkStat += gPowerBandBoost; + gDungeon->unk134.unk160 += gPowerBandBoost; } if (HasHeldItem(attacker, ITEM_MUNCH_BELT)) { - atkStat += gUnknown_810AC68; - gDungeon->unk134.unk160 += gUnknown_810AC68; + atkStat += gMunchBeltBoost; + gDungeon->unk134.unk160 += gMunchBeltBoost; } if (arg_10 && HasHeldItem(target, ITEM_DEF_SCARF)) { - defStat += gUnknown_810AC64; - gDungeon->unk134.unk162 += gUnknown_810AC64; + defStat += gDefScarfBoost; + gDungeon->unk134.unk162 += gDefScarfBoost; } } else { if (arg_10 && HasHeldItem(target, ITEM_ZINC_BAND)) { - defStat += gUnknown_810AC66; - gDungeon->unk134.unk163 += gUnknown_810AC66; + defStat += gZincBandBoost; + gDungeon->unk134.unk163 += gZincBandBoost; } if (HasHeldItem(attacker, ITEM_SPECIAL_BAND)) { - atkStat += gUnknown_810AC62; - gDungeon->unk134.unk161 += gUnknown_810AC62; + atkStat += gSpecialBandBoost; + gDungeon->unk134.unk161 += gSpecialBandBoost; } if (HasHeldItem(attacker, ITEM_MUNCH_BELT)) { - atkStat += gUnknown_810AC68; - gDungeon->unk134.unk161 += gUnknown_810AC68; + atkStat += gMunchBeltBoost; + gDungeon->unk134.unk161 += gMunchBeltBoost; } } diff --git a/src/dungeon_data.c b/src/dungeon_data.c index fdf495714..0cfc277f9 100644 --- a/src/dungeon_data.c +++ b/src/dungeon_data.c @@ -455,11 +455,11 @@ const FriendAreaSettings gFriendAreaSettings[NUM_FRIEND_AREAS] = }, }; -const s16 gUnknown_810AC60 = 12; -const s16 gUnknown_810AC62 = 12; -const s16 gUnknown_810AC64 = 8; -const s16 gUnknown_810AC66 = 8; -const s16 gUnknown_810AC68 = 8; +const s16 gPowerBandBoost = 12; +const s16 gSpecialBandBoost = 12; +const s16 gDefScarfBoost = 8; +const s16 gZincBandBoost = 8; +const s16 gMunchBeltBoost = 8; const u8 gBestResistTypeTable[NUM_TYPES] = { diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c index 77f02d803..624ad5b73 100644 --- a/src/dungeon_engine.c +++ b/src/dungeon_engine.c @@ -19,11 +19,11 @@ #include "dungeon_cutscene.h" #include "menu_input.h" #include "weather.h" +#include "dungeon_wild_mon_spawn.h" extern void sub_807E378(void); extern u8 DisplayActions(u32); extern void sub_805F02C(void); -extern void sub_8071B48(void); static void sub_8044454(void); static bool8 RunLeaderTurn(bool8); @@ -384,7 +384,7 @@ static void TrySpawnMonsterAndActivatePlusMinus(void) s32 index; if (gSpeedTurns[1][gDungeon->unk644.fractionalTurn] != 0) { - sub_8071B48(); + TrySpawnWildMonster(); gDungeon->plusIsActive[0] = FALSE; gDungeon->plusIsActive[1] = FALSE; gDungeon->minusIsActive[0] = FALSE; diff --git a/src/dungeon_exit.c b/src/dungeon_exit.c new file mode 100644 index 000000000..8283fcd7b --- /dev/null +++ b/src/dungeon_exit.c @@ -0,0 +1,103 @@ +#include "global.h" +#include "globaldata.h" +#include "dungeon_exit.h" +#include "constants/dungeon_exit.h" +#include "dungeon_info.h" +#include "dungeon_util.h" +#include "text_util.h" +#include "dungeon_logic.h" +#include "dungeon_data.h" +#include "dungeon_strings.h" +#include "run_dungeon.h" +#include "items.h" + +void SetUpDungeonExitData(s16 dungeonExitReason_, Entity *target, Entity *entity) +{ + EntityInfo * entityInfo; + u8 buffer [0x14]; + s32 dungeonExitReason = dungeonExitReason_; + DungeonExitSummary *exitSummary = &gDungeon->exitSummary; + EntityInfo * targetEntityInfo = NULL; + + if (EntityIsValid(target) && GetEntityType(target) == ENTITY_MONSTER) { + targetEntityInfo = GetEntInfo(target); + } + entityInfo = GetEntInfo(entity); + if (targetEntityInfo != NULL) { + CopyEntityNameForDungeonExitSummary(buffer, targetEntityInfo); + CopyStringtoBuffer(exitSummary->buffer1, buffer); + } + else { + CopyStringtoBuffer(exitSummary->buffer1, gText_Someone); // Someone + } + CopyEntityNameForDungeonExitSummary(buffer,entityInfo); + CopyStringtoBuffer(exitSummary->buffer2, buffer); + exitSummary->exitReason = dungeonExitReason; + exitSummary->heldItem = entityInfo->heldItem; + exitSummary->exp = entityInfo->exp; + exitSummary->level = entityInfo->level; + exitSummary->maxHPStat = entityInfo->maxHPStat; + exitSummary->atk = entityInfo->atk[0]; + exitSummary->spAtk = entityInfo->atk[1]; + exitSummary->def = entityInfo->def[0]; + exitSummary->spDef = entityInfo->def[1]; + exitSummary->dungeonLocation = gDungeon->unk644.dungeonLocation; + exitSummary->attBoost = 0; + exitSummary->spAttBoost = 0; + exitSummary->defBoost = 0; + exitSummary->spDefBoost = 0; + if (ItemExists(&entityInfo->heldItem) && !(entityInfo->heldItem.flags & ITEM_FLAG_STICKY)) { + if (entityInfo->heldItem.id == ITEM_POWER_BAND) { + exitSummary->attBoost += gPowerBandBoost; + } + if (entityInfo->heldItem.id == ITEM_MUNCH_BELT) { + exitSummary->attBoost += gMunchBeltBoost; + } + if (entityInfo->heldItem.id == ITEM_SPECIAL_BAND) { + exitSummary->spAttBoost += gSpecialBandBoost; + } + if (entityInfo->heldItem.id == ITEM_MUNCH_BELT) { + exitSummary->spAttBoost += gMunchBeltBoost; + } + if (entityInfo->heldItem.id == ITEM_DEF_SCARF) { + exitSummary->defBoost += gDefScarfBoost; + } + if (entityInfo->heldItem.id == ITEM_ZINC_BAND) { + exitSummary->spDefBoost += gZincBandBoost; + } + } +} + +bool8 IsUnsuccessfulDungeonExit(void) +{ + DungeonExitSummary *exitSummary = &gDungeon->exitSummary; + + if (exitSummary->exitReason < DUNGEON_EXIT_REASON_SUCCESS) + return TRUE; + + return FALSE; +} + +bool8 sub_8083C50(void) +{ + DungeonExitSummary *exitSummary = &gDungeon->exitSummary; + + if (exitSummary->exitReason == DUNGEON_EXIT_CLEARED_DUNGEON + || exitSummary->exitReason == DUNGEON_EXIT_BEFRIENDED_MEW + || exitSummary->exitReason == DUNGEON_EXIT_SUCCEEDED_IN_RESCUE_MISSION) + return TRUE; + + return FALSE; +} + +bool8 sub_8083C88(u8 param_1) +{ + DungeonExitSummary *exitSummary = &gDungeon->exitSummary; + + if ((!HasCheckpoint(gDungeon->unk644.dungeonLocation.id) && (gDungeon->unk644.unk18 != 0 || param_1 != 0)) + || exitSummary->exitReason != DUNGEON_EXIT_CLEARED_DUNGEON) { + return TRUE; + } + + return FALSE; +} diff --git a/src/dungeon_generation.c b/src/dungeon_generation.c index 80e0a39ff..bc347e912 100644 --- a/src/dungeon_generation.c +++ b/src/dungeon_generation.c @@ -186,7 +186,7 @@ void GenerateFloor(void) ResetFloor(); - gDungeon->unk644.unk20 = abs(floorProps->enemyDensity); + gDungeon->unk644.enemyDensity = abs(floorProps->enemyDensity); gDungeon->unk3A09 = 0; gDungeon->unk3A0A = 0; @@ -4425,7 +4425,7 @@ static void SpawnEnemies(FloorProperties *floorProps, bool8 isEmptyMonsterHouse) s32 enemyDensity = floorProps->enemyDensity; // BUG: Game assumes floorProps->enemyDensity is a signed byte, but in reality it's unsigned. - // Attempting to use a negative density will instead produce a very large positive density up to 255. + // Attempting to use a negative density will instead produce a very large positive density up to 255. // This only matters for unused dungeons, as Deoxys has its own logic despite Meteor Cave having an effective enemy density of 255. if (enemyDensity > 0) { // Positive means value with variance diff --git a/src/dungeon_kecleon_shop.c b/src/dungeon_kecleon_shop.c index 120c865bb..13b4a2607 100644 --- a/src/dungeon_kecleon_shop.c +++ b/src/dungeon_kecleon_shop.c @@ -53,7 +53,7 @@ void sub_807EC28(bool8 arg0) isShopTile = (GetTileAtEntitySafe(leader)->terrainFlags & TERRAIN_TYPE_SHOP) != 0; gDungeon->unk644.unk54 = isShopTile; gDungeon->unk644.unk55 = isShopTile; - if (gDungeon->unk644.unk2A || gDungeon->unk644.unk50 == 0) + if (gDungeon->unk644.stoleFromKecleon || gDungeon->unk644.unk50 == 0) return; if (leaderInfo->invisibleClassStatus.status == STATUS_INVISIBLE) { @@ -313,7 +313,7 @@ static void sub_807F33C(void) { s32 i, x, y; - gDungeon->unk644.unk2A = 1; + gDungeon->unk644.stoleFromKecleon = 1; gDungeon->unk644.unk2B = 1; LogMessageByIdWithPopupCheckUser(GetLeader(), gUnknown_80FE4B8); // Help! Thief! I've been robbed! Help me catch the thief. for (x = 0; x < DUNGEON_MAX_SIZE_X; x++) { diff --git a/src/dungeon_logic.c b/src/dungeon_logic.c index c2ca5b0df..6dd7892c4 100644 --- a/src/dungeon_logic.c +++ b/src/dungeon_logic.c @@ -354,7 +354,7 @@ s32 CalcSpeedStage(Entity *pokemon) speed++; } if ((entityInfo->id == MONSTER_KECLEON) && entityInfo->isNotTeamMember && - gDungeon->unk644.unk2A) { + gDungeon->unk644.stoleFromKecleon) { speed++; } if (speed < 0) { diff --git a/src/dungeon_main.c b/src/dungeon_main.c index 9e71efbba..993515440 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -1052,7 +1052,7 @@ void sub_805F02C(void) else if (PlayerHasItemWithFlag(ITEM_FLAG_IN_SHOP) || sub_807EF48()) { DisplayDungeonLoggableMessageTrue(r7, gUnknown_80F9C08); } - else if (gDungeon->unk644.unk2A) { + else if (gDungeon->unk644.stoleFromKecleon) { DisplayDungeonLoggableMessageTrue(r7, gUnknown_80F9C2C); } else { diff --git a/src/dungeon_menu_others.c b/src/dungeon_menu_others.c index 3f80d1407..488ec37c8 100644 --- a/src/dungeon_menu_others.c +++ b/src/dungeon_menu_others.c @@ -7,7 +7,7 @@ #include "dungeon_action.h" #include "code_8097DD0.h" #include "dungeon_info.h" -#include "dungeon_8083AB0.h" +#include "dungeon_exit.h" #include "dungeon_action.h" #include "dungeon_range.h" #include "dungeon_main.h" @@ -443,7 +443,7 @@ static bool8 AskToGiveUp(void) return TRUE; } SetMonsterActionFields(GetLeaderActionContainer(), ACTION_GIVE_UP); - sub_8083AB0(DUNGEON_EXIT_GAVE_UP_EXPLORATION, NULL, GetLeader()); + SetUpDungeonExitData(DUNGEON_EXIT_GAVE_UP_EXPLORATION, NULL, GetLeader()); gDungeon->unk644.unk10 = 1; return FALSE; } diff --git a/src/dungeon_menu_recruitment.c b/src/dungeon_menu_recruitment.c index eab846fbb..39a1ebcec 100644 --- a/src/dungeon_menu_recruitment.c +++ b/src/dungeon_menu_recruitment.c @@ -296,7 +296,7 @@ static void SetRecruitableMons(struct MonRecruitList *tabsData) spArray[ExtractSpeciesIndex(&gDungeon->monsterSpawns[id])] = byte; } - if (gDungeon->unk644.unk2A) { + if (gDungeon->unk644.stoleFromKecleon) { spArray[MONSTER_KECLEON] = 1; } diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index 15323a903..b592f06e2 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -42,7 +42,7 @@ #include "def_filearchives.h" #include "code_803D110.h" #include "dungeon_strings.h" -#include "dungeon_8083AB0.h" +#include "dungeon_exit.h" #include "dungeon_pos_data.h" #include "dungeon_data.h" #include "dungeon_tilemap.h" @@ -523,7 +523,7 @@ void HandleFaint(Entity *entity, s32 dungeonExitReason_, Entity *param_3) sub_803E708(0x3c,0x49); DisplayMessageLog(); if (gDungeon->unk6 == 0) { - if (gDungeon->unk644.unk2A == 0 + if (gDungeon->unk644.stoleFromKecleon == 0 && dungeonExitReason != DUNGEON_EXIT_DELETED_FOR_EVENT && dungeonExitReason != DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT && dungeonExitReason != DUNGEON_EXIT_BLOWN_OUT_UNSEEN_FORCE @@ -553,7 +553,7 @@ void HandleFaint(Entity *entity, s32 dungeonExitReason_, Entity *param_3) return; } - sub_8083AB0(dungeonExitReason,param_3,entity); + SetUpDungeonExitData(dungeonExitReason,param_3,entity); if (dungeonExitReason == DUNGEON_EXIT_RETURNED_WITH_FALLEN_PARTNER) { EntityInfo *partnerInfo = NULL; for (i = 0; i < MAX_TEAM_MEMBERS; i++) { @@ -843,22 +843,22 @@ void SetMonSummaryInfoFromEntity(struct MonSummaryInfo *param_1, Entity *target) *spDefBoost = 0; if ((info->heldItem.flags & ITEM_FLAG_EXISTS) && ((info->heldItem.flags & ITEM_FLAG_STICKY) == 0)) { if (info->heldItem.id == ITEM_POWER_BAND) { - *atkPtr += gUnknown_810AC60; + *atkPtr += gPowerBandBoost; } if (info->heldItem.id == ITEM_MUNCH_BELT) { - *atkPtr += gUnknown_810AC68; + *atkPtr += gMunchBeltBoost; } if (info->heldItem.id == ITEM_SPECIAL_BAND) { - *spAtkPtr += gUnknown_810AC62; + *spAtkPtr += gSpecialBandBoost; } if (info->heldItem.id == ITEM_MUNCH_BELT) { - *spAtkPtr += gUnknown_810AC68; + *spAtkPtr += gMunchBeltBoost; } if (info->heldItem.id == ITEM_DEF_SCARF) { - *defPtr += gUnknown_810AC64; + *defPtr += gDefScarfBoost; } if (info->heldItem.id == ITEM_ZINC_BAND) { - *spDefBoost += gUnknown_810AC66; + *spDefBoost += gZincBandBoost; } } param_1->tactic = info->tactic; diff --git a/src/dungeon_mon_spawn.c b/src/dungeon_mon_spawn.c index 936025d2d..75390585f 100644 --- a/src/dungeon_mon_spawn.c +++ b/src/dungeon_mon_spawn.c @@ -719,7 +719,7 @@ static void InitEntityFromSpawnInfo(bool8 a0, Entity *entity, struct MonSpawnInf if (!a0) { if (monSpawnInfo->species == MONSTER_KECLEON - && !gDungeon->unk644.unk2A + && !gDungeon->unk644.stoleFromKecleon && gDungeon->unk3A0A && !monSpawnInfo->unk2) { diff --git a/src/dungeon_move.c b/src/dungeon_move.c index bbf9c7c30..04af8c3c1 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -1381,9 +1381,9 @@ static s32 TryHitTarget(Entity *attacker, Entity *target, Move *move, struct Dam bool32 isFalseSwipe = (move->id == MOVE_FALSE_SWIPE); if (AbilityIsActive(target, ABILITY_ILLUMINATE)) { - gDungeon->unk644.unk1E = 999; - gDungeon->unk17B34 = target; - gDungeon->unk17B40 = target->spawnGenID; + gDungeon->unk644.wildMonSpawnFrames = 999; + gDungeon->illuminatePokemon = target; + gDungeon->illuminateMonSpawnGenID = target->spawnGenID; } HandleDealingDamage(attacker, target, dmgStruct, isFalseSwipe, TRUE, dungeonExitReason, TRUE, 0); diff --git a/src/dungeon_strings.c b/src/dungeon_strings.c index ff7c05679..dc8a4c104 100644 --- a/src/dungeon_strings.c +++ b/src/dungeon_strings.c @@ -917,7 +917,7 @@ const u8 *const gUnknown_80FE690 = _("{POKEMON_0} was sent flying!"); const u8 *const gUnknown_80FE6B4 = _("But it didn't go anywhere."); const u8 *const gUnknown_80FE6D4 = _("{POKEMON_0} can't throw items!"); const u8 *const gText_TheLastOuting = _("The Last Outing"); -const u8 *const gUnknown_80FE6F4 = _("Someone"); +const u8 *const gText_Someone = _("Someone"); const u8 *const gUnknown_80FE708 = _("Tile underfoot"); const u8 *const gUnknown_80FE70C = _("Stairs"); const u8 *const gUnknown_80FE720 = _("Rescue Point"); @@ -1003,7 +1003,7 @@ const u8 *const gUnknown_80FED08 = _("But nothing happened!"); const u8 *const gUnknown_80FED0C = _("But nothing happened!"); const u8 *const gUnknown_80FED30 = _("It bounced off the trick tile!"); const u8 *const gUnknown_80FED34 = _("{POKEMON_0} disappeared in the blast!"); -const u8 *const gUnknown_80FED68 = _("{POKEMON_0} blinked."); +const u8 *const gText_Pokemon0Blinked = _("{POKEMON_0} blinked."); const u8 *const gUnknown_80FED88 = _("Overgrow boosted its power!"); const u8 *const gUnknown_80FEDA8 = _("Torrent boosted its power!"); const u8 *const gUnknown_80FEDC8 = _("Swarm boosted its power!"); diff --git a/src/dungeon_util.c b/src/dungeon_util.c index 5e36f5762..dc96a2207 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -615,7 +615,7 @@ void SubstitutePlaceholderStringTags(u8 *buffer, Entity *entity, u32 param_3) GetTrapName(buffer, GetTrapData_1(entity)->id); break; default: - strcpy(buffer, gUnknown_80FE6F4); + strcpy(buffer, gText_Someone); break; } } diff --git a/src/dungeon_wild_mon_spawn.c b/src/dungeon_wild_mon_spawn.c new file mode 100644 index 000000000..e11b3902e --- /dev/null +++ b/src/dungeon_wild_mon_spawn.c @@ -0,0 +1,113 @@ +#include "global.h" +#include "globaldata.h" +#include "dungeon_wild_mon_spawn.h" +#include "constants/tactic.h" +#include "dungeon_config.h" +#include "dungeon_range.h" +#include "dungeon_message.h" +#include "code_8041AD0.h" +#include "constants/dungeon.h" +#include "dungeon_map_access.h" +#include "dungeon_random.h" +#include "dungeon_util.h" +#include "dungeon_info.h" +#include "pokemon_3.h" +#include "code_805D8C8.h" +#include "dungeon_logic.h" +#include "dungeon_floor_spawns.h" +#include "dungeon_strings.h" +#include "dungeon_misc.h" +#include "dungeon_mon_spawn.h" + +extern void sub_8042920(struct Entity *r0); + +void TrySpawnWildMonster(void) +{ + s32 i; + s32 species; + s32 wildMonsCount; + struct Entity *illuminateEntity; + s32 level; + struct Dungeon *dungeon; + struct MonSpawnInfo monSpawnInfo; + + illuminateEntity = NULL; + dungeon = gDungeon; + if (dungeon->unk644.enemyDensity == 0) + return; + if (dungeon->unk644.dungeonLocation.id == DUNGEON_METEOR_CAVE && dungeon->unk37FD != 0) + return; + + dungeon->unk644.wildMonSpawnFrames++; + if (!dungeon->unk644.stoleFromKecleon) { + if (dungeon->unk644.wildMonSpawnFrames < gWildSpawnIntervalFrames) + return; + } + else { + if (dungeon->unk644.wildMonSpawnFrames < gKecleonSpawnIntervalFrames) + return; + } + + if (dungeon->unk644.wildMonSpawnFrames > 900) { + Entity *entity = dungeon->illuminatePokemon; + if (EntityIsValid(entity) && entity->spawnGenID == dungeon->illuminateMonSpawnGenID) { + SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0); + illuminateEntity = entity; + } + } + + dungeon->unk644.wildMonSpawnFrames = 0; + dungeon->illuminatePokemon = NULL; + + wildMonsCount = 0; + for (i = 0; i < DUNGEON_MAX_WILD_POKEMON; i++) { + Entity *entity = dungeon->wildPokemon[i]; + if (EntityIsValid(entity)) { + const Tile *tile = GetTile(entity->pos.x, entity->pos.y); + if (!(tile->terrainFlags & TERRAIN_TYPE_UNBREAKABLE)) { + wildMonsCount++; + } + } + } + + if (!dungeon->unk644.stoleFromKecleon) { + if (gDungeon->monsterHouseRoom == CORRIDOR_ROOM) { + if (wildMonsCount >= gMaxWildMonsInMonsterHouse) + return; + } + else { + if (wildMonsCount >= gMaxWildMonsInRoom) + return; + } + } + if (illuminateEntity != NULL) { + DisplayDungeonLoggableMessageTrue(0,gText_Pokemon0Blinked); + sub_8042920(illuminateEntity); + } + + if (dungeon->unk644.stoleFromKecleon) { + species = MONSTER_KECLEON; + } + else { + species = GetRandomFloorMonsterId(0); + } + + level = GetSpawnedMonsterLevel(species); + if (level == 0) { + level = 1; + } + + if (sub_806AA0C(species, 0) && sub_8083660(&monSpawnInfo.pos)) { + monSpawnInfo.species = species; + monSpawnInfo.level = level; + monSpawnInfo.unk2 = 0; + if (DungeonRandInt(100) < GetRandomMovementChance(gDungeon->unk644.dungeonLocation.id)) { + monSpawnInfo.unk4 = 1; + } + else { + monSpawnInfo.unk4 = 0; + } + monSpawnInfo.unk10 = 0; + SpawnWildMon(&monSpawnInfo, FALSE); + } +} diff --git a/src/move_orb_actions_4.c b/src/move_orb_actions_4.c index 4104a9156..5258d8569 100644 --- a/src/move_orb_actions_4.c +++ b/src/move_orb_actions_4.c @@ -634,7 +634,7 @@ bool8 TrawlOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) bool8 EscapeOrbAction(Entity * pokemon, Entity * target, Move *move, s32 itemId) { SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0); - if (gDungeon->unk644.unk2A != 0) { + if (gDungeon->unk644.stoleFromKecleon != 0) { TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FD4DC); // $m0 can't escape! } else { diff --git a/src/pokemon_3.c b/src/pokemon_3.c index b129787b4..b58abe337 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -273,26 +273,26 @@ UNUSED static void GetMonOffenseStats(Pokemon *mon, struct UnusedOffenseStruct * if (mon->heldItem.id != ITEM_NOTHING) { u16 itemId = mon->heldItem.id; if (itemId == ITEM_POWER_BAND) { - dst->atkBoost += gUnknown_810AC60; - dst->att[0] += gUnknown_810AC60; + dst->atkBoost += gPowerBandBoost; + dst->att[0] += gPowerBandBoost; } if (itemId == ITEM_SPECIAL_BAND) { - dst->spAtkBoost += gUnknown_810AC62; - dst->att[1] += gUnknown_810AC62; + dst->spAtkBoost += gSpecialBandBoost; + dst->att[1] += gSpecialBandBoost; } if (itemId == ITEM_MUNCH_BELT) { - dst->atkBoost += gUnknown_810AC68; - dst->spAtkBoost += gUnknown_810AC68; - dst->att[0] += gUnknown_810AC68; - dst->att[1] += gUnknown_810AC68; + dst->atkBoost += gMunchBeltBoost; + dst->spAtkBoost += gMunchBeltBoost; + dst->att[0] += gMunchBeltBoost; + dst->att[1] += gMunchBeltBoost; } if (itemId == ITEM_DEF_SCARF) { - dst->defBoost += gUnknown_810AC64; - dst->def[0] += gUnknown_810AC64; + dst->defBoost += gDefScarfBoost; + dst->def[0] += gDefScarfBoost; } if (itemId == ITEM_ZINC_BAND) { - dst->spDefBoost += gUnknown_810AC66; - dst->def[1] += gUnknown_810AC66; + dst->spDefBoost += gZincBandBoost; + dst->def[1] += gZincBandBoost; } } } diff --git a/src/pokemon_summary_window.c b/src/pokemon_summary_window.c index cda249aad..ddca7da7e 100644 --- a/src/pokemon_summary_window.c +++ b/src/pokemon_summary_window.c @@ -259,22 +259,22 @@ void SetMonSummaryInfo(struct MonSummaryInfo *dst, struct Pokemon *pokemon, bool if (pokemon->heldItem.id != 0) { if (pokemon->heldItem.id == ITEM_POWER_BAND) { - dst->atkBoost += gUnknown_810AC60; + dst->atkBoost += gPowerBandBoost; } if (pokemon->heldItem.id == ITEM_SPECIAL_BAND) { - dst->spAtkBoost+= gUnknown_810AC62; + dst->spAtkBoost+= gSpecialBandBoost; } if (pokemon->heldItem.id == ITEM_MUNCH_BELT) { - dst->atkBoost += gUnknown_810AC68; + dst->atkBoost += gMunchBeltBoost; } if (pokemon->heldItem.id == ITEM_MUNCH_BELT) { - dst->spAtkBoost+= gUnknown_810AC68; + dst->spAtkBoost+= gMunchBeltBoost; } if (pokemon->heldItem.id == ITEM_DEF_SCARF) { - dst->defBoost += gUnknown_810AC64; + dst->defBoost += gDefScarfBoost; } if (pokemon->heldItem.id == ITEM_ZINC_BAND) { - dst->spDefBoost += gUnknown_810AC66; + dst->spDefBoost += gZincBandBoost; } } dst->tactic = pokemon->tacticIndex; diff --git a/src/run_dungeon.c b/src/run_dungeon.c index 9c9e09348..5381319e3 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -21,7 +21,7 @@ #include "code_8094F88.h" #include "code_8099360.h" #include "cpu.h" -#include "dungeon_8083AB0.h" +#include "dungeon_exit.h" #include "dungeon_info.h" #include "dungeon_entity_movement.h" #include "dungeon_config.h" @@ -297,8 +297,8 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) gDungeon->unk644.unk4C = 0; gDungeon->unk644.unk50 = 0; gDungeon->unk644.fractionalTurn = 0; - gDungeon->unk644.unk1E = 0; - gDungeon->unk644.unk2A = 0; + gDungeon->unk644.wildMonSpawnFrames = 0; + gDungeon->unk644.stoleFromKecleon = 0; gDungeon->unk644.unk2B = 0; gDungeon->unk644.unk2C = 0; gDungeon->unk644.itemHoldersIdentified = 0; @@ -362,8 +362,8 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) gDungeon->unk17B38 = 0; gDungeon->snatchPokemon = NULL; gDungeon->unk17B3C = 0; - gDungeon->unk17B34 = NULL; - gDungeon->unk17B40 = 0; + gDungeon->illuminatePokemon = NULL; + gDungeon->illuminateMonSpawnGenID = 0; if (!r6) { sub_807FA18(); CreateFloorItems(); @@ -519,7 +519,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) leader = GetLeader(); DisplayDungeonMessage(0, gPtrClientFaintedMessage, 1); gDungeon->unk6 = 0; - sub_8083AB0(DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT, leader, leader); + SetUpDungeonExitData(DUNGEON_EXIT_FAILED_TO_PROTECT_CLIENT, leader, leader); } CloseAllSpriteFiles(); sub_8049820(); @@ -546,43 +546,43 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) sub_806C1D8(); if (gDungeon->unk644.unk10 == 1) { - if (gDungeon->unk644.unk2A != 0) { + if (gDungeon->unk644.stoleFromKecleon != 0) { AllItemsToPlainSeed(); } check = TRUE; } else if (gDungeon->unk11 == 1) { - sub_8083AB0(DUNGEON_EXIT_ESCAPED_MIDDLE_OF_EXPLORATION, NULL, GetLeader()); + SetUpDungeonExitData(DUNGEON_EXIT_ESCAPED_MIDDLE_OF_EXPLORATION, NULL, GetLeader()); check = TRUE; } else if (gDungeon->unk11 == 2) { - sub_8083AB0(DUNGEON_EXIT_IMPRESSIVELY_COMPLETED_MISSION, NULL, GetLeader()); - if (gDungeon->unk644.unk2A != 0) { + SetUpDungeonExitData(DUNGEON_EXIT_IMPRESSIVELY_COMPLETED_MISSION, NULL, GetLeader()); + if (gDungeon->unk644.stoleFromKecleon != 0) { IncrementThievingSuccesses(); } check = TRUE; } else if (gDungeon->unk11 == 3) { - sub_8083AB0(DUNGEON_EXIT_BEFRIENDED_MEW, NULL, GetLeader()); - if (gDungeon->unk644.unk2A != 0) { + SetUpDungeonExitData(DUNGEON_EXIT_BEFRIENDED_MEW, NULL, GetLeader()); + if (gDungeon->unk644.stoleFromKecleon != 0) { IncrementThievingSuccesses(); } check = TRUE; } else if (gDungeon->unk11 == 4) { var = DUNGEON_EXIT_CLEARED_DUNGEON; - sub_8083AB0(var, NULL, GetLeader()); + SetUpDungeonExitData(var, NULL, GetLeader()); check = TRUE; } else if (gDungeon->unk644.unk34 == 1 && GetFloorType() == FLOOR_TYPE_RESCUE && gDungeon->unk644.unk10 == 2) { - sub_8083AB0(DUNGEON_EXIT_SUCCEEDED_IN_RESCUE_MISSION, NULL, GetLeader()); - if (gDungeon->unk644.unk2A != 0) { + SetUpDungeonExitData(DUNGEON_EXIT_SUCCEEDED_IN_RESCUE_MISSION, NULL, GetLeader()); + if (gDungeon->unk644.stoleFromKecleon != 0) { IncrementThievingSuccesses(); } check = TRUE; } else { - if (gDungeon->unk644.unk2A != 0) { + if (gDungeon->unk644.stoleFromKecleon != 0) { IncrementThievingSuccesses(); } if (gDungeon->unk644.dungeonLocation.floor + 1 < gDungeon->unk1CEC8) { @@ -600,7 +600,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) } else { var = DUNGEON_EXIT_CLEARED_DUNGEON; - sub_8083AB0(var, NULL, GetLeader()); + SetUpDungeonExitData(var, NULL, GetLeader()); check = TRUE; // This goto is a fakematch I had to create in order to generate matching code. // It has no real effect, because the control flow is the same without it(since check is TRUE). Unfortunately agbcc is blind and goto is needed. diff --git a/src/trap.c b/src/trap.c index 7256a1e00..eff992c11 100644 --- a/src/trap.c +++ b/src/trap.c @@ -793,7 +793,7 @@ void HandlePokemonTrap(Entity *param_1,DungeonPos *pos) local_50.species = MONSTER_KECLEON; for (i = 0; i < 100; i++) { - if (gDungeon->unk644.unk2A != 0) { + if (gDungeon->unk644.stoleFromKecleon != 0) { species = MONSTER_KECLEON; } else { From 912203077fb90958654dcac3b158d3c8b04307ec Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 17 Oct 2025 15:20:41 +0200 Subject: [PATCH 2/5] dungeon mon recruit sprite render --- include/dungeon_mon_recruit.h | 14 + ..._806CD90.h => dungeon_mon_sprite_render.h} | 9 +- include/dungeon_strings.h | 22 +- include/dungeon_wind.h | 6 + include/structs/dungeon_entity.h | 2 +- include/structs/str_dungeon.h | 2 +- ld_script.ld | 8 +- src/blow_away.c | 2 +- src/code_8040094_1.c | 2 +- src/code_8041AD0.c | 2 +- src/code_8066D04.c | 2 +- src/code_806FDF4.c | 471 ------------------ src/drought_orb.c | 2 +- src/dungeon_8067A80.c | 2 +- src/dungeon_ai_attack.c | 2 +- src/dungeon_cutscene.c | 2 +- src/dungeon_cutscene_articuno.c | 4 +- src/dungeon_cutscene_celebi.c | 9 +- src/dungeon_cutscene_deoxys.c | 4 +- src/dungeon_cutscene_empty_summit.c | 2 +- src/dungeon_cutscene_entei.c | 4 +- src/dungeon_cutscene_groudon.c | 4 +- src/dungeon_cutscene_hooh.c | 4 +- src/dungeon_cutscene_jirachi.c | 4 +- src/dungeon_cutscene_kyogre.c | 4 +- src/dungeon_cutscene_latios.c | 4 +- src/dungeon_cutscene_lugia.c | 4 +- src/dungeon_cutscene_magma_cavern.c | 4 +- src/dungeon_cutscene_mankey.c | 4 +- src/dungeon_cutscene_meanies.c | 4 +- src/dungeon_cutscene_medicham.c | 4 +- src/dungeon_cutscene_mewtwo.c | 4 +- src/dungeon_cutscene_moltres.c | 4 +- src/dungeon_cutscene_raikou.c | 4 +- src/dungeon_cutscene_rayquaza.c | 4 +- src/dungeon_cutscene_regis.c | 4 +- src/dungeon_cutscene_skarmory.c | 4 +- src/dungeon_cutscene_smeargle.c | 4 +- src/dungeon_cutscene_suicune.c | 4 +- src/dungeon_cutscene_zapdos.c | 4 +- src/dungeon_damage.c | 7 +- src/dungeon_engine.c | 6 +- src/dungeon_entity_movement.c | 4 +- src/dungeon_kecleon_shop.c | 2 +- src/dungeon_leveling.c | 2 +- src/dungeon_main.c | 2 +- src/dungeon_map_access.c | 2 +- src/dungeon_menu_recruitment.c | 8 +- src/dungeon_menu_team.c | 2 +- src/dungeon_misc.c | 2 +- src/dungeon_mon_recruit.c | 445 +++++++++++++++++ src/dungeon_mon_spawn.c | 2 +- ..._806CD90.c => dungeon_mon_sprite_render.c} | 36 +- src/dungeon_monster_house.c | 2 +- src/dungeon_move.c | 2 +- src/dungeon_move_util.c | 2 +- src/dungeon_projectile_throw.c | 2 +- src/dungeon_serializer.c | 2 +- src/dungeon_strings.c | 22 +- src/dungeon_tilemap.c | 2 +- src/dungeon_turn_effects.c | 2 +- src/dungeon_util.c | 8 +- src/dungeon_wind.c | 102 ++-- src/explosion.c | 2 +- src/expose_trap.c | 2 +- src/hurl_orb.c | 2 +- src/move_orb_actions_1.c | 2 +- src/move_orb_actions_2.c | 2 +- src/move_orb_actions_3.c | 2 +- src/move_orb_actions_4.c | 2 +- src/move_orb_actions_5.c | 2 +- src/move_orb_effects_1.c | 2 +- src/move_orb_effects_2.c | 2 +- src/move_orb_effects_3.c | 2 +- src/move_orb_effects_4.c | 2 +- src/move_orb_effects_5.c | 2 +- src/one_room_orb.c | 2 +- src/pounce_orb.c | 2 +- src/run_dungeon.c | 4 +- src/switcher_orb.c | 2 +- src/trap.c | 2 +- src/trawl_orb.c | 2 +- src/warp_target.c | 2 +- src/weather.c | 2 +- 84 files changed, 649 insertions(+), 710 deletions(-) create mode 100644 include/dungeon_mon_recruit.h rename include/{code_806CD90.h => dungeon_mon_sprite_render.h} (77%) create mode 100644 include/dungeon_wind.h delete mode 100644 src/code_806FDF4.c create mode 100644 src/dungeon_mon_recruit.c rename src/{code_806CD90.c => dungeon_mon_sprite_render.c} (95%) diff --git a/include/dungeon_mon_recruit.h b/include/dungeon_mon_recruit.h new file mode 100644 index 000000000..6d6585cc7 --- /dev/null +++ b/include/dungeon_mon_recruit.h @@ -0,0 +1,14 @@ +#ifndef GUARD_DUNGEON_MON_RECRUIT_H +#define GUARD_DUNGEON_MON_RECRUIT_H + +#include "structs/dungeon_entity.h" +#include "dungeon_misc.h" + +bool8 TryRecruitMonster(Entity *attacker, Entity *target); +bool8 IsMonsterRecruitable(s32 species); +bool8 HandleMonsterJoinSequence(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *param_3); +// These two functions are only used for Celebi's scene for some reason. +bool8 CanEntityBeRecruited(Entity *param_1); +bool8 HandleSpecialEntityJoinSequence(Entity *entity1,Entity *entity2,Entity **entityPtr); + +#endif // GUARD_DUNGEON_MON_RECRUIT_H diff --git a/include/code_806CD90.h b/include/dungeon_mon_sprite_render.h similarity index 77% rename from include/code_806CD90.h rename to include/dungeon_mon_sprite_render.h index 2714cadcf..4174b5dfc 100644 --- a/include/code_806CD90.h +++ b/include/dungeon_mon_sprite_render.h @@ -1,9 +1,9 @@ -#ifndef GUARD_CODE_806CD90_H -#define GUARD_CODE_806CD90_H +#ifndef GUARD_DUNGEON_MON_SPRITE_RENDER_H +#define GUARD_DUNGEON_MON_SPRITE_RENDER_H #include "structs/dungeon_entity.h" -void sub_806C51C(Entity *entity); +void UpdateMonsterSprite(Entity *entity); void sub_806CC10(void); void sub_806CC70(void); void sub_806CCB4(Entity *entity, u8); @@ -16,8 +16,7 @@ void sub_806CE94(Entity *entity, u32 newDir); u8 sub_806CEBC(Entity *entity); void sub_806CEFC(Entity *entity, u32 newDir); void sub_806CF18(Entity *entity); -u8 sub_806CF54(Entity *entity); void DetermineAllMonsterShadow(void); u32 DetermineMonsterShadow(Entity *entity); -#endif // GUARD_CODE_806CD90_H +#endif // GUARD_DUNGEON_MON_SPRITE_RENDER_H diff --git a/include/dungeon_strings.h b/include/dungeon_strings.h index 2bb3393fe..85ef200e1 100644 --- a/include/dungeon_strings.h +++ b/include/dungeon_strings.h @@ -148,10 +148,10 @@ extern const u8 *const gUnknown_80F9BB0; extern const u8 *const gUnknown_80F9BD8; extern const u8 *const gUnknown_80F9C08; extern const u8 *const gUnknown_80F9C2C; -extern const u8 *const gUnknown_80F9C4C; -extern const u8 *const gUnknown_80F9C70; -extern const u8 *const gUnknown_80F9C8C; -extern const u8 *const gUnknown_80F9CBC; +extern const u8 *const gText_SomethingStirring; +extern const u8 *const gText_SomethingApproaching; +extern const u8 *const gText_ItsGettingCloser; +extern const u8 *const gText_ItsRightNearbyGustingHard; extern const u8 *const gUnknown_80F9CC0[]; extern const u8 *const gUnknown_80F9CEC[]; extern const u8 *const gUnknown_80F9D28[]; @@ -170,13 +170,13 @@ extern const u8 *const gUnknown_80F9F2C; extern const u8 *const gUnknown_80F9FA4; extern const u8 *const gUnknown_80F9FE8; extern const u8 *const gUnknown_80F9FEC; -extern const u8 *const gUnknown_80FA004; -extern const u8 *const gUnknown_80FA030; -extern const u8 *const gUnknown_80FA058; -extern const u8 *const gUnknown_80FA090; -extern const u8 *const gUnknown_80FA0C8; -extern const u8 *const gUnknown_80FA0F0; -extern const u8 *const gUnknown_80FA120; +extern const u8 *const gText_Pokemon0WentAway; +extern const u8 *const gText_ThePokemonCouldntJoinTeam; +extern const u8 *const gText_ButItCouldntJoinTheTeam; +extern const u8 *const gText_NewMemberJoinedGiveItNickname; +extern const u8 *const gText_PleaseGiveNicknameNewMember; +extern const u8 *const gText_Pokemon0JoinedToGoOnAdventures; +extern const u8 *const gText_Pokemon0GainedAccessToFriendArea; extern const u8 *const gUnknown_80FA124[]; extern const u8 *const gUnknown_80FA260; extern const u8 *const gUnknown_80FA2B0; diff --git a/include/dungeon_wind.h b/include/dungeon_wind.h new file mode 100644 index 000000000..ac6ada2d4 --- /dev/null +++ b/include/dungeon_wind.h @@ -0,0 +1,6 @@ +#ifndef GUARD_DUNGEON_WIND +#define GUARD_DUNGEON_WIND + +void UpdateWindTurns(void); + +#endif // GUARD_DUNGEON_WIND diff --git a/include/structs/dungeon_entity.h b/include/structs/dungeon_entity.h index 6997d9e0f..5d73c3715 100644 --- a/include/structs/dungeon_entity.h +++ b/include/structs/dungeon_entity.h @@ -337,7 +337,7 @@ typedef struct EntityInfo /* 0x1FA */ s16 mobileTurnTimer; // When a Pokémon can pass through walls in a hallway, this counts up to 200 before the Pokémon turns in a random direction. /* 0x1FC */ u32 expGainedInTurn; // Used to accumulate experience when multiple enemies are defeated in one turn. /* 0x200 */ u32 statusIcons; - u8 unk204; + /* 0x204 */ u8 shadowIndex; } EntityInfo; // size: 0x74 | Used for Pokémon, items, and traps. diff --git a/include/structs/str_dungeon.h b/include/structs/str_dungeon.h index 2bb8d6c1d..62ae80c98 100644 --- a/include/structs/str_dungeon.h +++ b/include/structs/str_dungeon.h @@ -273,7 +273,7 @@ typedef struct unkDungeon644 /* 0x33 */ u8 unk33; /* 0x34 */ u8 unk34; /* 0x35 */ u8 emptyBellyAlert; // which alert message to show when belly gets empty. - /* 0x36 */ u8 unk36; + /* 0x36 */ u8 windPhase; /* 0x37 */ s8 unk37; /* 0x38 */ u32 unk38; /* 0x3C */ u32 unk3C; diff --git a/ld_script.ld b/ld_script.ld index 4e9706867..e0c4a41b9 100755 --- a/ld_script.ld +++ b/ld_script.ld @@ -236,9 +236,9 @@ SECTIONS { src/dungeon_8067A80.o(.text); src/dungeon_misc.o(.text); src/dungeon_mon_spawn.o(.text); - src/code_806CD90.o(.text); + src/dungeon_mon_sprite_render.o(.text); src/dungeon_damage.o(.text); - src/code_806FDF4.o(.text); + src/dungeon_mon_recruit.o(.text); src/status_checks.o(.text); src/dungeon_logic.o(.text); src/dungeon_wild_mon_spawn.o(.text); @@ -621,9 +621,9 @@ SECTIONS { src/dungeon_8067A80.o(.rodata); src/dungeon_misc.o(.rodata); src/dungeon_mon_spawn.o(.rodata); - src/code_806CD90.o(.rodata); + src/dungeon_mon_sprite_render.o(.rodata); src/dungeon_damage.o(.rodata); - src/code_806FDF4.o(.rodata); + src/dungeon_mon_recruit.o(.rodata); src/status_checks.o(.rodata); src/dungeon_logic.o(.rodata); src/dungeon_wild_mon_spawn.o(.rodata); diff --git a/src/blow_away.c b/src/blow_away.c index 24c0356f1..9378698a9 100644 --- a/src/blow_away.c +++ b/src/blow_away.c @@ -7,7 +7,7 @@ #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "structs/str_dungeon.h" #include "dungeon_entity_movement.h" #include "run_dungeon.h" diff --git a/src/code_8040094_1.c b/src/code_8040094_1.c index ae643bc02..09c419ef3 100644 --- a/src/code_8040094_1.c +++ b/src/code_8040094_1.c @@ -21,6 +21,7 @@ #include "weather.h" #include "dungeon_map_access.h" #include "dungeon_strings.h" +#include "dungeon_mon_sprite_render.h" struct UnkStruct_8040094 { @@ -38,7 +39,6 @@ extern void sub_800EEC8(u16 r0); extern void sub_8042DD4(s32 a0, Entity *a1, s32 a2); extern u8 sub_800EA44(s32 species, u16 a2); extern s32 sub_800E790(s32 species, u16 a2); -extern void sub_806CDD4(Entity *entity, u8, u32 direction); extern s32 sub_800E52C(struct UnkStruct_8040094 *a0); extern s32 sub_800EA84(struct UnkStruct_8040094 *a0); extern bool8 sub_800E838(struct UnkStruct_8040094 *a0, s32 a1); diff --git a/src/code_8041AD0.c b/src/code_8041AD0.c index 697a2cf17..97ade57e6 100644 --- a/src/code_8041AD0.c +++ b/src/code_8041AD0.c @@ -13,7 +13,7 @@ #include "dungeon_tilemap.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_config.h" #include "dungeon_logic.h" #include "dungeon_util.h" diff --git a/src/code_8066D04.c b/src/code_8066D04.c index 0af3745b5..662d9647e 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -9,7 +9,7 @@ #include "code_8041AD0.h" #include "dungeon_action.h" #include "code_8066D04.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_jobs.h" #include "run_dungeon.h" #include "dungeon_items.h" diff --git a/src/code_806FDF4.c b/src/code_806FDF4.c deleted file mode 100644 index 8e1ef6289..000000000 --- a/src/code_806FDF4.c +++ /dev/null @@ -1,471 +0,0 @@ -#include "global.h" -#include "globaldata.h" -#include "constants/dungeon_exit.h" -#include "constants/fixed_rooms.h" -#include "constants/type.h" -#include "structs/str_pokemon.h" -#include "dungeon_main.h" -#include "dungeon_misc.h" -#include "music_util.h" -#include "dungeon_message.h" -#include "code_806CD90.h" -#include "code_8097670.h" -#include "dungeon_info.h" -#include "dungeon_items.h" -#include "dungeon_logic.h" -#include "dungeon_random.h" -#include "dungeon_vram.h" -#include "dungeon_util.h" -#include "friend_area.h" -#include "pokemon.h" -#include "pokemon_3.h" -#include "position_util.h" -#include "text_util.h" -#include "math.h" -#include "dungeon_config.h" -#include "dungeon_strings.h" -#include "dungeon_music.h" -#include "dungeon_cutscene.h" -#include "string_format.h" -#include "dungeon_mon_spawn.h" -#include "move_orb_effects_5.h" - -void nullsub_96(Entity *pokemon,Entity *target); -u8 sub_8097900(s16); -void sub_806F910(void); -u8 sub_806F9BC(s16); - -bool8 TryRecruitMonster(Entity *attacker, Entity *target) -{ - s32 i; - s32 rand; - s32 recruitRate; - EntityInfo *attackerInfo = GetEntInfo(attacker); - EntityInfo *targetInfo = GetEntInfo(target); - s32 foundIndex = -1; - s32 size = GetBodySize(targetInfo->apparentID); - - if (gDungeon->fixedRoomNumber != FIXED_ROOM_FROSTY_GROTTO_ARTICUNO - && gDungeon->fixedRoomNumber != FIXED_ROOM_MT_BLAZE_PEAK_MOLTRES - && gDungeon->fixedRoomNumber != FIXED_ROOM_WESTERN_CAVE_MEWTWO - && gDungeon->fixedRoomNumber != FIXED_ROOM_MT_FARAWAY_HO_OH - ) { - if (gDungeon->fixedRoomNumber >= FIXED_ROOM_TEAM_SHIFTY_BOSS - && gDungeon->fixedRoomNumber <= FIXED_ROOM_RESCUE_TEAM_2_BOSS - ) { - if (gDungeon->unk644.unk18 == 0) - return FALSE; - } - else if (gDungeon->fixedRoomNumber == FIXED_ROOM_RESCUE_TEAM_MAZE_BOSS) { - if (gDungeon->unk644.unk15 == 0) - return FALSE; - if (!sub_8097900(MONSTER_DEOXYS_NORMAL)) - return FALSE; - } - else if (!IsRecruitingEnabled(gDungeon->unk644.dungeonLocation.id)) { - return FALSE; - } - } - - if (gDungeon->unk644.unk19 != 0) - return FALSE; - - // Legendaries can only be recruited once. - if ((targetInfo->id == MONSTER_ARTICUNO || - targetInfo->id == MONSTER_ZAPDOS || - targetInfo->id == MONSTER_MOLTRES || - targetInfo->id == MONSTER_ENTEI || - targetInfo->id == MONSTER_RAIKOU || - targetInfo->id == MONSTER_SUICUNE || - targetInfo->id == MONSTER_LATIAS || - targetInfo->id == MONSTER_LATIOS || - targetInfo->id == MONSTER_JIRACHI || - targetInfo->id == MONSTER_RAYQUAZA || - targetInfo->id == MONSTER_DEOXYS_NORMAL || - targetInfo->id == MONSTER_REGIROCK || - targetInfo->id == MONSTER_REGICE || - targetInfo->id == MONSTER_REGISTEEL) - && HasRecruitedMon(targetInfo->id)) - { - return FALSE; - } - - if (!sub_806F9BC(targetInfo->id)) - return FALSE; - if (abs((attacker->pos).x - (target->pos).x) >= 2 || abs((attacker->pos).y - (target->pos).y) >= 2) - return FALSE; - if (targetInfo->joinedAt.id == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) - return FALSE; - if (targetInfo->monsterBehavior == 1) - return FALSE; - if (!CanSeeTarget(target,attacker)) - return FALSE; - - sub_806F910(); - rand = DungeonRandInt(1000); - recruitRate = GetRecruitRate(targetInfo->id); - if (recruitRate == -999) - return FALSE; - - if (HasHeldItem(attacker, ITEM_FRIEND_BOW)) { - recruitRate += gFriendBowRecruitRateUpValue; - } - recruitRate += gRecruitRateByLevel[attackerInfo->level]; - if (rand >= recruitRate) - return FALSE; - - for (i = 0; i <= (6 - size); i++) { - s32 j; - for (j = 0; j < size; j++) { - if (gUnknown_202EE70[i + j] != 0) - break; - } - - if (j == size) { - foundIndex = i; - break; - } - } - if (foundIndex == -1) { - nullsub_96(attacker, target); - return FALSE; - } - - for (i = 0; i < 4; i++) { - if (!DungeonMonExists(&gRecruitedPokemonRef->dungeonTeam[i])) - break; - } - if (i == 4) { - nullsub_96(attacker, target); - return FALSE; - } - - for (i = 0; i < 4; i++) { - if (!EntityIsValid(gDungeon->teamPokemon[i])) - break; - } - if (i == 4) { - nullsub_96(attacker, target); - return FALSE; - } - - return TRUE; -} - -void nullsub_96(Entity *pokemon,Entity *target) -{} - -void sub_806F910(void) -{ - u8 size; - s32 counter; - Entity *entity; - int totalSize; - int index; - s32 sVar6; - - totalSize = 0; - - for(index = 0, sVar6 = 0x40; index < MAX_TEAM_MEMBERS; index++) - { - entity = gDungeon->teamPokemon[index]; - if (EntityIsValid(entity)) { - size = GetBodySize(GetEntInfo(entity)->apparentID); - entity->axObj.unk40_maybeAnimTimer = sVar6; - GetEntInfo(entity)->unk167 = index; - GetEntInfo(entity)->unk168 = size; - for (counter = 0; counter < size; counter++) { - if (totalSize < MAX_TEAM_BODY_SIZE) { - gUnknown_202EE70[totalSize] = 1; - sVar6 += 0x10; - totalSize++; - } - } - sub_806CCB4(entity,sub_806CEBC(entity)); - } - } - for (; totalSize < MAX_TEAM_BODY_SIZE; totalSize++) { - gUnknown_202EE70[totalSize] = 0; - } -} - -bool8 sub_806F9BC(s16 species) -{ - u8 friendArea; - s32 id; - FriendAreaCapacity auStack_18; - - id = species; - if (!gDungeon->unk644.canRecruit) { - return FALSE; - } - else if (!sub_808529C(id)) { - return FALSE; - } - else if (id == MONSTER_MEW && gDungeon->unk644.unk34 == 1) { - return FALSE; - } - else if (id == MONSTER_LATIAS) - { - return FALSE; - } - else if (id == MONSTER_LATIOS) - { - return FALSE; - } - else if (id == MONSTER_DEOXYS_ATTACK) - { - return FALSE; - } - else if (id == MONSTER_DEOXYS_DEFENSE) - { - return FALSE; - } - else if (id == MONSTER_DEOXYS_SPEED) - { - return FALSE; - } - else { - if (GetUnk12(id) == 0) { - friendArea = GetFriendArea(id); - GetFriendAreaCapacity2(friendArea, &auStack_18, FALSE, FALSE); - if (auStack_18.hasFriendArea == FALSE) - return FALSE; - } - return TRUE; - } -} - -bool8 sub_806FA5C(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *param_3) -{ - u8 friendArea; - bool8 flag; - Entity *leader; - DungeonMon *pokeStruct2; - int pokeIndex; - Entity *local_2c; - s32 iVar2; - u32 direction; - - - direction = GetDirectionTowardsPosition(&entity2->pos,&entity1->pos); - flag = FALSE; - friendArea = GetFriendArea(param_3->id); - entity2->unk22 = 0; - sub_807A0CC(entity1, entity2); - sub_806CE68(entity2, direction); - CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[0],param_3->id); - - if (DisplayDungeonYesNoMessage(0,gUnknown_80F9FE8,1) == 0) { - if (param_3->id != MONSTER_JIRACHI) { - LogMessageByIdWithPopupCheckUser(entity1,gUnknown_80FA004); - } - return 0; - } - else - { - for(pokeIndex = 0; pokeIndex < MAX_TEAM_MEMBERS; pokeIndex++) - { - if (!(DungeonMonExists(&gRecruitedPokemonRef->dungeonTeam[pokeIndex]))) - break; - } - - if (pokeIndex == MAX_TEAM_MEMBERS) { - LogMessageByIdWithPopupCheckUser(entity1,gUnknown_80FA030); - return FALSE; - } - else { - if (GetFriendAreaStatus(friendArea) == 0) { - UnlockFriendArea(friendArea); - flag = TRUE; - } - HandleFaint(entity2,DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND,entity1); - pokeStruct2 = &gRecruitedPokemonRef->dungeonTeam[pokeIndex]; - pokeStruct2->flags = POKEMON_FLAG_EXISTS | POKEMON_FLAG_ON_TEAM; - pokeStruct2->isTeamLeader = FALSE; - pokeStruct2->level = param_3->level; - pokeStruct2->IQ = 1; - SetDefaultIQSkills(&pokeStruct2->IQSkills,FALSE); - pokeStruct2->hiddenPower = param_3->hiddenPower; - pokeStruct2->tacticIndex = 0; - pokeStruct2->recruitedPokemonId = -1; - pokeStruct2->unkC = pokeIndex; - pokeStruct2->speciesNum = param_3->id; - (pokeStruct2->dungeonLocation) = gDungeon->unk644.dungeonLocation; - pokeStruct2->unk10 = param_3->HP; - pokeStruct2->unk12 = param_3->HP; - pokeStruct2->belly = param_3->belly; - pokeStruct2->maxBelly = param_3->maxBelly; - - for(iVar2 = 0; iVar2 < 2; iVar2++) - { - pokeStruct2->offense.att[iVar2] = param_3->att[iVar2]; - pokeStruct2->offense.def[iVar2] = param_3->def[iVar2]; - } - - pokeStruct2->currExp = param_3->exp; - pokeStruct2->moves = param_3->moves; - - pokeStruct2->itemSlot = param_3->heldItem; - BoundedCopyStringtoBuffer(pokeStruct2->name,GetMonSpecies(param_3->id),10); - - IncrementAdventureNumJoined(); - - if (SpawnTeamMember(param_3->id,param_3->pos.x,param_3->pos.y,pokeStruct2,&local_2c,0,1) == 0) { - LogMessageByIdWithPopupCheckUser(entity1,gUnknown_80FA058); - pokeStruct2->flags = 0; - } - else { - sub_8083D88(); - sub_803E708(0xa0,0x46); - if (DisplayDungeonYesNoMessage(0,gUnknown_80FA090,1) == 1) { - while (DungeonGiveNameToRecruitedMon(pokeStruct2->name) == 0) { - DisplayDungeonMessage(0,gUnknown_80FA0C8,1); - } - } - sub_808D9DC(gFormatBuffer_Monsters[0],pokeStruct2,0); - LogMessageByIdWithPopupCheckUser(entity1,gUnknown_80FA0F0); - if (flag) { - leader = CutsceneGetLeader(); - SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],leader,0); - sub_8092558(gFormatBuffer_FriendArea,friendArea); - PlaySound(0xce); - DisplayDungeonMessage(0,gUnknown_80FA120,1); - } - if (param_3->id == MONSTER_MEW) { - gDungeon->unk4 = 1; - gDungeon->unk11 = 3; - } - } - return TRUE; - } - } -} - -bool8 sub_806FD18(Entity *param_1) -{ - s32 i, j; - - EntityInfo *info = GetEntInfo(param_1); - s32 validIndex = -1; - s32 size = GetBodySize(info->apparentID); - if (!sub_806F9BC(info->id)) - return FALSE; - - sub_806F910(); - for (i = 0; i <= (6 - size); i++) { - for (j = 0; j < size; j++){ - if (gUnknown_202EE70[i + j] != 0) - break; - } - if (j == size) { - validIndex = i; - break; - } - } - if (validIndex == -1) - return FALSE; - - - for (i = 0; i < 4; i++) { - if (!(DungeonMonExists(&gRecruitedPokemonRef->dungeonTeam[i]))) - break; - } - - if (i == 4) - return FALSE; - - for (i = 0; i < MAX_TEAM_MEMBERS; i++) { - if(!EntityIsValid(gDungeon->teamPokemon[i])) - break; - } - if (i == MAX_TEAM_MEMBERS) - return FALSE; - - return TRUE; -} - -bool8 sub_806FDF4(Entity *entity1,Entity *entity2,Entity **entityPtr) -{ - u8 friendArea; - bool8 flag; - Entity *leader; - DungeonMon *pokeStruct2; - int index; - struct unkStruct_8069D4C local_74; - Entity *local_2c; - u8 *buffer; - s32 index2; - - flag = 0; - *entityPtr = NULL; - - sub_8069D4C(&local_74,entity2); - - for(index = 0; index < MAX_TEAM_MEMBERS; index++) - { - if (!DungeonMonExists(&gRecruitedPokemonRef->dungeonTeam[index])) break; - } - - if (index == MAX_TEAM_MEMBERS) { - return FALSE; - } - else { - friendArea = GetFriendArea(local_74.id); - pokeStruct2 = &gRecruitedPokemonRef->dungeonTeam[index]; - pokeStruct2->flags = POKEMON_FLAG_EXISTS | POKEMON_FLAG_ON_TEAM; - pokeStruct2->isTeamLeader = FALSE; - pokeStruct2->level = local_74.level; - pokeStruct2->IQ = 1; - SetDefaultIQSkills(&pokeStruct2->IQSkills,FALSE); - pokeStruct2->hiddenPower = local_74.hiddenPower; - pokeStruct2->tacticIndex = 0; - pokeStruct2->recruitedPokemonId = -1; - pokeStruct2->unkC = index; - pokeStruct2->speciesNum = local_74.id; - pokeStruct2->dungeonLocation = gDungeon->unk644.dungeonLocation; - pokeStruct2->unk10 = local_74.HP; - pokeStruct2->unk12 = local_74.HP; - pokeStruct2->belly = local_74.belly; - pokeStruct2->maxBelly = local_74.maxBelly; - - for(index2 = 0; index2 < 2; index2++) - { - pokeStruct2->offense.att[index2] = local_74.att[index2]; - pokeStruct2->offense.def[index2] = local_74.def[index2]; - } - - pokeStruct2->currExp = local_74.exp; - pokeStruct2->moves = local_74.moves; - - pokeStruct2->itemSlot = local_74.heldItem; - buffer = pokeStruct2->name; - BoundedCopyStringtoBuffer(buffer,GetMonSpecies(local_74.id), POKEMON_NAME_LENGTH); - if (GetFriendAreaStatus(friendArea) == 0) { - UnlockFriendArea(friendArea); - flag = TRUE; - } - IncrementAdventureNumJoined(); - HandleFaint(entity2,DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND,entity1); - if (SpawnTeamMember(local_74.id,local_74.pos.x,local_74.pos.y,pokeStruct2,&local_2c,0,0) == 0) { - pokeStruct2->flags = 0; - } - else { - if (DisplayDungeonYesNoMessage(0,gUnknown_80FA090,1) == 1) { - while (!DungeonGiveNameToRecruitedMon(buffer)) { - DisplayDungeonMessage(0,gUnknown_80FA0C8,1); - } - } - if (flag) { - leader = CutsceneGetLeader(); - SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],leader,0); - sub_8092558(gFormatBuffer_FriendArea,friendArea); - PlaySound(0xce); - DisplayDungeonMessage(0,gUnknown_80FA120,1); - } - sub_808D9DC(gFormatBuffer_Monsters[3],pokeStruct2,0); - *entityPtr = local_2c; - } - return TRUE; - } -} diff --git a/src/drought_orb.c b/src/drought_orb.c index d7f49bbf6..b2e64218c 100644 --- a/src/drought_orb.c +++ b/src/drought_orb.c @@ -5,7 +5,7 @@ #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "structs/str_dungeon.h" #include "dungeon_ai.h" #include "run_dungeon.h" diff --git a/src/dungeon_8067A80.c b/src/dungeon_8067A80.c index 7947826b3..d9e1907e1 100644 --- a/src/dungeon_8067A80.c +++ b/src/dungeon_8067A80.c @@ -8,7 +8,7 @@ #include "code_8041AD0.h" #include "dungeon_action.h" #include "code_8066D04.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "run_dungeon.h" #include "dungeon_items.h" #include "dungeon_range.h" diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index d63e340fd..3dc426d77 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -3,7 +3,7 @@ #include "dungeon_ai_attack.h" #include "dungeon_move_util.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/direction.h" #include "constants/dungeon_action.h" #include "constants/iq_skill.h" diff --git a/src/dungeon_cutscene.c b/src/dungeon_cutscene.c index aa37b8d97..56534c386 100644 --- a/src/dungeon_cutscene.c +++ b/src/dungeon_cutscene.c @@ -19,7 +19,7 @@ #include "dungeon_map_access.h" #include "dungeon_misc.h" #include "dungeon_vram.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_range.h" #include "random.h" #include "math.h" diff --git a/src/dungeon_cutscene_articuno.c b/src/dungeon_cutscene_articuno.c index 147bbcd0d..b92cc2f16 100644 --- a/src/dungeon_cutscene_articuno.c +++ b/src/dungeon_cutscene_articuno.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -34,8 +34,6 @@ #include "weather.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_celebi.c b/src/dungeon_cutscene_celebi.c index fe27c7e6e..fedf1b789 100644 --- a/src/dungeon_cutscene_celebi.c +++ b/src/dungeon_cutscene_celebi.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -32,10 +32,9 @@ #include "dungeon_boss_dialogue.h" #include "dungeon_tilemap.h" #include "weather.h" +#include "dungeon_mon_recruit.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); @@ -78,7 +77,7 @@ void CelebiJoinDialogue(void) leaderEntity = CutsceneGetLeader(); celebiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_CELEBI); - if ((HasRecruitedMon(MONSTER_CELEBI)) || (!sub_806FD18(celebiEntity))) + if ((HasRecruitedMon(MONSTER_CELEBI)) || (!CanEntityBeRecruited(celebiEntity))) { HandleFaint(celebiEntity,DUNGEON_EXIT_DELETED_FOR_EVENT,0); SpriteLookAroundEffect(leaderEntity); @@ -141,7 +140,7 @@ void CelebiJoinDialogue(void) sub_803E708(0x1c,0x46); DisplayDungeonDialogue(&gCelebiJoinDialogue_4); sub_803E708(10,0x46); - sub_806FDF4(leaderEntity,celebiEntity,&celebiEntity); + HandleSpecialEntityJoinSequence(leaderEntity,celebiEntity,&celebiEntity); DungeonStartNewBGM(MUS_FRIEND_AREA_HEALING_FOREST); DisplayDungeonDialogue(&gCelebiJoinDialogue_5); sub_803E708(10,0x46); diff --git a/src/dungeon_cutscene_deoxys.c b/src/dungeon_cutscene_deoxys.c index 9d9b98acf..51ea1f388 100644 --- a/src/dungeon_cutscene_deoxys.c +++ b/src/dungeon_cutscene_deoxys.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -33,8 +33,6 @@ extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_empty_summit.c b/src/dungeon_cutscene_empty_summit.c index b98df1523..e3b045757 100644 --- a/src/dungeon_cutscene_empty_summit.c +++ b/src/dungeon_cutscene_empty_summit.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" diff --git a/src/dungeon_cutscene_entei.c b/src/dungeon_cutscene_entei.c index fa989ef28..b7f492e4a 100644 --- a/src/dungeon_cutscene_entei.c +++ b/src/dungeon_cutscene_entei.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -32,8 +32,6 @@ #include "dungeon_boss_dialogue.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_groudon.c b/src/dungeon_cutscene_groudon.c index 4417f7c1f..e4b42b145 100644 --- a/src/dungeon_cutscene_groudon.c +++ b/src/dungeon_cutscene_groudon.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -34,8 +34,6 @@ #include "dungeon_leveling.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_hooh.c b/src/dungeon_cutscene_hooh.c index b28a18585..f5fd46432 100644 --- a/src/dungeon_cutscene_hooh.c +++ b/src/dungeon_cutscene_hooh.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -32,8 +32,6 @@ #include "dungeon_boss_dialogue.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_jirachi.c b/src/dungeon_cutscene_jirachi.c index 5e6552470..325b041ae 100644 --- a/src/dungeon_cutscene_jirachi.c +++ b/src/dungeon_cutscene_jirachi.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -35,8 +35,6 @@ #include "dungeon_mon_spawn.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_kyogre.c b/src/dungeon_cutscene_kyogre.c index b6457b815..7650ff57c 100644 --- a/src/dungeon_cutscene_kyogre.c +++ b/src/dungeon_cutscene_kyogre.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -34,8 +34,6 @@ #include "dungeon_map.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_latios.c b/src/dungeon_cutscene_latios.c index 1fbd51e26..5271267dd 100644 --- a/src/dungeon_cutscene_latios.c +++ b/src/dungeon_cutscene_latios.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -33,8 +33,6 @@ extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_lugia.c b/src/dungeon_cutscene_lugia.c index 345fee538..ed2eb0de0 100644 --- a/src/dungeon_cutscene_lugia.c +++ b/src/dungeon_cutscene_lugia.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -33,8 +33,6 @@ extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_magma_cavern.c b/src/dungeon_cutscene_magma_cavern.c index baf8e1fcf..d833d7fbf 100644 --- a/src/dungeon_cutscene_magma_cavern.c +++ b/src/dungeon_cutscene_magma_cavern.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -32,8 +32,6 @@ #include "dungeon_boss_dialogue.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_mankey.c b/src/dungeon_cutscene_mankey.c index b535b7124..f46348e32 100644 --- a/src/dungeon_cutscene_mankey.c +++ b/src/dungeon_cutscene_mankey.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -32,8 +32,6 @@ #include "dungeon_boss_dialogue.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_meanies.c b/src/dungeon_cutscene_meanies.c index 00321a511..fd23e9e2e 100644 --- a/src/dungeon_cutscene_meanies.c +++ b/src/dungeon_cutscene_meanies.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" @@ -31,8 +31,6 @@ #include "dungeon_boss_dialogue.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_medicham.c b/src/dungeon_cutscene_medicham.c index 935419742..9a77a34e4 100644 --- a/src/dungeon_cutscene_medicham.c +++ b/src/dungeon_cutscene_medicham.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -32,8 +32,6 @@ #include "dungeon_boss_dialogue.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_mewtwo.c b/src/dungeon_cutscene_mewtwo.c index 5f7b07ef0..56e19b2dc 100644 --- a/src/dungeon_cutscene_mewtwo.c +++ b/src/dungeon_cutscene_mewtwo.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -32,8 +32,6 @@ #include "dungeon_boss_dialogue.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_moltres.c b/src/dungeon_cutscene_moltres.c index 1c2f5b5e5..86a7d4696 100644 --- a/src/dungeon_cutscene_moltres.c +++ b/src/dungeon_cutscene_moltres.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -34,8 +34,6 @@ #include "dungeon_leveling.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_raikou.c b/src/dungeon_cutscene_raikou.c index 5a534c112..484fee834 100644 --- a/src/dungeon_cutscene_raikou.c +++ b/src/dungeon_cutscene_raikou.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -33,8 +33,6 @@ #include "weather.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_rayquaza.c b/src/dungeon_cutscene_rayquaza.c index d74f34ac9..ccf29d5de 100644 --- a/src/dungeon_cutscene_rayquaza.c +++ b/src/dungeon_cutscene_rayquaza.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -33,8 +33,6 @@ #include "dungeon_leveling.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_regis.c b/src/dungeon_cutscene_regis.c index 83c129ba8..13a765247 100644 --- a/src/dungeon_cutscene_regis.c +++ b/src/dungeon_cutscene_regis.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -33,8 +33,6 @@ #include "dungeon_map.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_skarmory.c b/src/dungeon_cutscene_skarmory.c index 7698b9e80..b2f1a4fbe 100644 --- a/src/dungeon_cutscene_skarmory.c +++ b/src/dungeon_cutscene_skarmory.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -32,8 +32,6 @@ #include "dungeon_boss_dialogue.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_smeargle.c b/src/dungeon_cutscene_smeargle.c index 00040ad5c..55bfbf782 100644 --- a/src/dungeon_cutscene_smeargle.c +++ b/src/dungeon_cutscene_smeargle.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -32,8 +32,6 @@ #include "dungeon_boss_dialogue.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_suicune.c b/src/dungeon_cutscene_suicune.c index 024e373e1..b2aa21aa6 100644 --- a/src/dungeon_cutscene_suicune.c +++ b/src/dungeon_cutscene_suicune.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -32,8 +32,6 @@ #include "dungeon_boss_dialogue.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_cutscene_zapdos.c b/src/dungeon_cutscene_zapdos.c index 5275c0151..0e74286b5 100644 --- a/src/dungeon_cutscene_zapdos.c +++ b/src/dungeon_cutscene_zapdos.c @@ -5,7 +5,7 @@ #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/dungeon_exit.h" @@ -33,8 +33,6 @@ #include "dungeon_leveling.h" extern void sub_8042B0C(Entity *); -extern u8 sub_806FD18(Entity *); -extern void sub_806FDF4(Entity *, Entity *, Entity **); extern void sub_8049884(void); extern void sub_8049B8C(void); extern void sub_8041888(u32); diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index 11ae7e7d9..234dacab7 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -27,7 +27,7 @@ #include "dungeon_leveling.h" #include "weather.h" #include "game_options.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/direction.h" #include "constants/dungeon.h" #include "dungeon_vram.h" @@ -44,6 +44,7 @@ #include "exclusive_pokemon.h" #include "hurl_orb.h" #include "dungeon_mon_spawn.h" +#include "dungeon_mon_recruit.h" #include "move_orb_actions_1.h" #include "move_orb_effects_2.h" #include "move_orb_effects_5.h" @@ -54,13 +55,11 @@ extern void sub_8041D00(Entity *pokemon, Entity *target); extern void sub_8042238(Entity *pokemon, Entity *target); extern void sub_803ED30(s32, Entity *r0, u8, s32); extern bool8 sub_806A458(Entity *); -extern bool8 TryRecruitMonster(Entity *attacker, Entity *target); extern bool8 sub_806A58C(s16 a0); extern void sub_8042148(Entity *pokemon); extern void sub_8042A24(Entity *r0); extern void sub_806A390(Entity *r0); extern void sub_800DBBC(void); -extern bool8 sub_806FA5C(Entity *, Entity *, struct unkStruct_8069D4C *); extern void EntityUpdateStatusSprites(Entity *); extern void PointCameraToMonster(Entity *); extern void sub_8041B74(Entity *pokemon); @@ -737,7 +736,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc sub_8069D4C(&sp, target); if (TryRecruitMonster(attacker, target)) { - if (!sub_806FA5C(attacker, target, &sp)) { + if (!HandleMonsterJoinSequence(attacker, target, &sp)) { HandleFaint(target, DUNGEON_EXIT_LEFT_WITHOUT_BEING_BEFRIENDED, attacker); } else { diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c index 624ad5b73..2ea014d0c 100644 --- a/src/dungeon_engine.c +++ b/src/dungeon_engine.c @@ -20,9 +20,9 @@ #include "menu_input.h" #include "weather.h" #include "dungeon_wild_mon_spawn.h" +#include "dungeon_entity_movement.h" +#include "dungeon_wind.h" -extern void sub_807E378(void); -extern u8 DisplayActions(u32); extern void sub_805F02C(void); static void sub_8044454(void); @@ -53,7 +53,7 @@ void RunFractionalTurn(bool8 param_1) cVar2 = RunLeaderTurn(param_1); if (IsFloorOver()) return; if (cVar2) { - sub_807E378(); + UpdateWindTurns(); if (IsFloorOver()) return; } if (IsFloorOver()) return; diff --git a/src/dungeon_entity_movement.c b/src/dungeon_entity_movement.c index 13acae00c..f309891ba 100644 --- a/src/dungeon_entity_movement.c +++ b/src/dungeon_entity_movement.c @@ -5,7 +5,7 @@ #include "constants/item.h" #include "constants/status.h" #include "constants/type.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_items.h" #include "dungeon_range.h" #include "dungeon_map_access.h" @@ -23,7 +23,7 @@ #include "dungeon_music.h" #include "dungeon_map_access.h" #include "dungeon_vram.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "game_options.h" #include "dungeon_items.h" #include "moves.h" diff --git a/src/dungeon_kecleon_shop.c b/src/dungeon_kecleon_shop.c index 13b4a2607..a73274376 100644 --- a/src/dungeon_kecleon_shop.c +++ b/src/dungeon_kecleon_shop.c @@ -17,7 +17,7 @@ #include "dungeon_map_access.h" #include "position_util.h" #include "dungeon_ai.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "code_805D8C8.h" #include "dungeon_items.h" diff --git a/src/dungeon_leveling.c b/src/dungeon_leveling.c index f87111a9d..6a657def0 100644 --- a/src/dungeon_leveling.c +++ b/src/dungeon_leveling.c @@ -19,7 +19,7 @@ #include "dungeon_logic.h" #include "dungeon_strings.h" #include "dungeon_menu_moves.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "moves.h" #include "structs/dungeon_entity.h" #include "structs/map.h" diff --git a/src/dungeon_main.c b/src/dungeon_main.c index 993515440..6fa93368f 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -19,7 +19,7 @@ #include "dungeon_tilemap.h" #include "dungeon_action.h" #include "code_8066D04.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_action.h" #include "dungeon_ai_movement.h" #include "dungeon_logic.h" diff --git a/src/dungeon_map_access.c b/src/dungeon_map_access.c index 64f96d91c..b14216bc9 100644 --- a/src/dungeon_map_access.c +++ b/src/dungeon_map_access.c @@ -16,7 +16,7 @@ #include "game_options.h" #include "random.h" #include "text_1.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_pos_data.h" #include "dungeon_data.h" diff --git a/src/dungeon_menu_recruitment.c b/src/dungeon_menu_recruitment.c index 39a1ebcec..c0d561c32 100644 --- a/src/dungeon_menu_recruitment.c +++ b/src/dungeon_menu_recruitment.c @@ -20,11 +20,7 @@ #include "text_3.h" #include "dungeon_engine.h" #include "dungeon_cutscene.h" - -extern u16 GetLeaderActionId(void); -extern u8 sub_806F9BC(s32); -extern bool8 sub_806A564(s32 r0); - +#include "dungeon_mon_recruit.h" struct MonRecruitList { @@ -320,7 +316,7 @@ static void SetRecruitableMons(struct MonRecruitList *tabsData) if (i == TAB_POTENTIAL_RECRUITS) { u32 recruitRate, unrecruitableRate; - if (!sub_806F9BC(speciesId)) + if (!IsMonsterRecruitable(speciesId)) continue; if (!IsExclusivePokemonUnlocked(speciesId)) continue; diff --git a/src/dungeon_menu_team.c b/src/dungeon_menu_team.c index f29f541fd..0468c5d5d 100644 --- a/src/dungeon_menu_team.c +++ b/src/dungeon_menu_team.c @@ -13,7 +13,7 @@ #include "dungeon_vram.h" #include "dungeon_tilemap.h" #include "dungeon_action.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "code_8097DD0.h" #include "dungeon_action.h" #include "dungeon_ai_movement.h" diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index b592f06e2..c993f1c79 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -28,7 +28,7 @@ #include "constants/status.h" #include "constants/type.h" #include "constants/weather.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "dungeon_config.h" diff --git a/src/dungeon_mon_recruit.c b/src/dungeon_mon_recruit.c new file mode 100644 index 000000000..f9b0a61dd --- /dev/null +++ b/src/dungeon_mon_recruit.c @@ -0,0 +1,445 @@ +#include "global.h" +#include "globaldata.h" +#include "dungeon_mon_recruit.h" +#include "constants/dungeon_exit.h" +#include "constants/fixed_rooms.h" +#include "constants/type.h" +#include "structs/str_pokemon.h" +#include "dungeon_main.h" +#include "dungeon_misc.h" +#include "music_util.h" +#include "dungeon_message.h" +#include "dungeon_mon_sprite_render.h" +#include "code_8097670.h" +#include "dungeon_info.h" +#include "dungeon_items.h" +#include "dungeon_logic.h" +#include "dungeon_random.h" +#include "dungeon_vram.h" +#include "dungeon_util.h" +#include "friend_area.h" +#include "pokemon.h" +#include "pokemon_3.h" +#include "position_util.h" +#include "text_util.h" +#include "math.h" +#include "dungeon_config.h" +#include "dungeon_strings.h" +#include "dungeon_music.h" +#include "dungeon_cutscene.h" +#include "string_format.h" +#include "dungeon_mon_spawn.h" +#include "move_orb_effects_5.h" + +extern bool8 sub_8097900(s16 pokeIndex); + +static void nullsub_96(Entity *pokemon,Entity *target); +static void sub_806F910(void); + +bool8 TryRecruitMonster(Entity *attacker, Entity *target) +{ + s32 i; + s32 rand; + s32 recruitRate; + EntityInfo *attackerInfo = GetEntInfo(attacker); + EntityInfo *targetInfo = GetEntInfo(target); + s32 foundIndex = -1; + s32 size = GetBodySize(targetInfo->apparentID); + + if (gDungeon->fixedRoomNumber != FIXED_ROOM_FROSTY_GROTTO_ARTICUNO + && gDungeon->fixedRoomNumber != FIXED_ROOM_MT_BLAZE_PEAK_MOLTRES + && gDungeon->fixedRoomNumber != FIXED_ROOM_WESTERN_CAVE_MEWTWO + && gDungeon->fixedRoomNumber != FIXED_ROOM_MT_FARAWAY_HO_OH + ) { + if (gDungeon->fixedRoomNumber >= FIXED_ROOM_TEAM_SHIFTY_BOSS + && gDungeon->fixedRoomNumber <= FIXED_ROOM_RESCUE_TEAM_2_BOSS + ) { + if (gDungeon->unk644.unk18 == 0) + return FALSE; + } + else if (gDungeon->fixedRoomNumber == FIXED_ROOM_RESCUE_TEAM_MAZE_BOSS) { + if (gDungeon->unk644.unk15 == 0) + return FALSE; + if (!sub_8097900(MONSTER_DEOXYS_NORMAL)) + return FALSE; + } + else if (!IsRecruitingEnabled(gDungeon->unk644.dungeonLocation.id)) { + return FALSE; + } + } + + if (gDungeon->unk644.unk19 != 0) + return FALSE; + + // Legendaries can only be recruited once. + if ((targetInfo->id == MONSTER_ARTICUNO || + targetInfo->id == MONSTER_ZAPDOS || + targetInfo->id == MONSTER_MOLTRES || + targetInfo->id == MONSTER_ENTEI || + targetInfo->id == MONSTER_RAIKOU || + targetInfo->id == MONSTER_SUICUNE || + targetInfo->id == MONSTER_LATIAS || + targetInfo->id == MONSTER_LATIOS || + targetInfo->id == MONSTER_JIRACHI || + targetInfo->id == MONSTER_RAYQUAZA || + targetInfo->id == MONSTER_DEOXYS_NORMAL || + targetInfo->id == MONSTER_REGIROCK || + targetInfo->id == MONSTER_REGICE || + targetInfo->id == MONSTER_REGISTEEL) + && HasRecruitedMon(targetInfo->id)) + { + return FALSE; + } + + if (!IsMonsterRecruitable(targetInfo->id)) + return FALSE; + if (abs((attacker->pos).x - (target->pos).x) >= 2 || abs((attacker->pos).y - (target->pos).y) >= 2) + return FALSE; + if (targetInfo->joinedAt.id == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) + return FALSE; + if (targetInfo->monsterBehavior == 1) + return FALSE; + if (!CanSeeTarget(target,attacker)) + return FALSE; + + sub_806F910(); + rand = DungeonRandInt(1000); + recruitRate = GetRecruitRate(targetInfo->id); + if (recruitRate == -999) + return FALSE; + + if (HasHeldItem(attacker, ITEM_FRIEND_BOW)) { + recruitRate += gFriendBowRecruitRateUpValue; + } + recruitRate += gRecruitRateByLevel[attackerInfo->level]; + if (rand >= recruitRate) + return FALSE; + + for (i = 0; i <= (6 - size); i++) { + s32 j; + for (j = 0; j < size; j++) { + if (gUnknown_202EE70[i + j] != 0) + break; + } + + if (j == size) { + foundIndex = i; + break; + } + } + if (foundIndex == -1) { + nullsub_96(attacker, target); + return FALSE; + } + + for (i = 0; i < MAX_TEAM_MEMBERS; i++) { + if (!DungeonMonExists(&gRecruitedPokemonRef->dungeonTeam[i])) + break; + } + if (i == MAX_TEAM_MEMBERS) { + nullsub_96(attacker, target); + return FALSE; + } + + for (i = 0; i < MAX_TEAM_MEMBERS; i++) { + if (!EntityIsValid(gDungeon->teamPokemon[i])) + break; + } + if (i == MAX_TEAM_MEMBERS) { + nullsub_96(attacker, target); + return FALSE; + } + + return TRUE; +} + +static void nullsub_96(Entity *pokemon,Entity *target) +{} + +static void sub_806F910(void) +{ + s32 i, j; + int totalSize; + s32 unkMaybeTimer; + + totalSize = 0; + for (i = 0, unkMaybeTimer = 0x40; i < MAX_TEAM_MEMBERS; i++) { + Entity *entity = gDungeon->teamPokemon[i]; + if (EntityIsValid(entity)) { + s32 size = GetBodySize(GetEntInfo(entity)->apparentID); + entity->axObj.unk40_maybeAnimTimer = unkMaybeTimer; + GetEntInfo(entity)->unk167 = i; + GetEntInfo(entity)->unk168 = size; + for (j = 0; j < size; j++) { + if (totalSize < MAX_TEAM_BODY_SIZE) { + gUnknown_202EE70[totalSize] = 1; + unkMaybeTimer += 0x10; + totalSize++; + } + } + sub_806CCB4(entity,sub_806CEBC(entity)); + } + } + + for (; totalSize < MAX_TEAM_BODY_SIZE; totalSize++) { + gUnknown_202EE70[totalSize] = 0; + } +} + +bool8 IsMonsterRecruitable(s32 species) +{ + s32 id = (s16) species; + if (!gDungeon->unk644.canRecruit) { + return FALSE; + } + else if (!sub_808529C(id)) { + return FALSE; + } + else if (id == MONSTER_MEW && gDungeon->unk644.unk34 == 1) { + return FALSE; + } + else if (id == MONSTER_LATIAS) { + return FALSE; + } + else if (id == MONSTER_LATIOS) { + return FALSE; + } + else if (id == MONSTER_DEOXYS_ATTACK) { + return FALSE; + } + else if (id == MONSTER_DEOXYS_DEFENSE) { + return FALSE; + } + else if (id == MONSTER_DEOXYS_SPEED) { + return FALSE; + } + else { + if (GetUnk12(id) == 0) { + FriendAreaCapacity friendAreaCapacity; + u8 friendArea = GetFriendArea(id); + + GetFriendAreaCapacity2(friendArea, &friendAreaCapacity, FALSE, FALSE); + if (friendAreaCapacity.hasFriendArea == FALSE) + return FALSE; + } + return TRUE; + } +} + +bool8 HandleMonsterJoinSequence(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *param_3) +{ + DungeonMon *dungeonMon; + int pokeIndex; + Entity *local_2c; + s32 i; + + s32 direction = GetDirectionTowardsPosition(&entity2->pos,&entity1->pos); + bool8 unlockedFriendArea = FALSE; + u8 friendArea = GetFriendArea(param_3->id); + + entity2->unk22 = 0; + sub_807A0CC(entity1, entity2); + sub_806CE68(entity2, direction); + CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[0],param_3->id); + + if (DisplayDungeonYesNoMessage(0,gUnknown_80F9FE8,1) == 0) { + if (param_3->id != MONSTER_JIRACHI) { + LogMessageByIdWithPopupCheckUser(entity1,gText_Pokemon0WentAway); + } + return FALSE; + } + + for (pokeIndex = 0; pokeIndex < MAX_TEAM_MEMBERS; pokeIndex++) { + if (!(DungeonMonExists(&gRecruitedPokemonRef->dungeonTeam[pokeIndex]))) + break; + } + + if (pokeIndex == MAX_TEAM_MEMBERS) { + LogMessageByIdWithPopupCheckUser(entity1,gText_ThePokemonCouldntJoinTeam); + return FALSE; + } + + if (GetFriendAreaStatus(friendArea) == 0) { + UnlockFriendArea(friendArea); + unlockedFriendArea = TRUE; + } + HandleFaint(entity2,DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND,entity1); + dungeonMon = &gRecruitedPokemonRef->dungeonTeam[pokeIndex]; + dungeonMon->flags = POKEMON_FLAG_EXISTS | POKEMON_FLAG_ON_TEAM; + dungeonMon->isTeamLeader = FALSE; + dungeonMon->level = param_3->level; + dungeonMon->IQ = 1; + SetDefaultIQSkills(&dungeonMon->IQSkills,FALSE); + dungeonMon->hiddenPower = param_3->hiddenPower; + dungeonMon->tacticIndex = 0; + dungeonMon->recruitedPokemonId = -1; + dungeonMon->unkC = pokeIndex; + dungeonMon->speciesNum = param_3->id; + dungeonMon->dungeonLocation = gDungeon->unk644.dungeonLocation; + dungeonMon->unk10 = param_3->HP; + dungeonMon->unk12 = param_3->HP; + dungeonMon->belly = param_3->belly; + dungeonMon->maxBelly = param_3->maxBelly; + + for (i = 0; i < 2; i++) { + dungeonMon->offense.att[i] = param_3->att[i]; + dungeonMon->offense.def[i] = param_3->def[i]; + } + + dungeonMon->currExp = param_3->exp; + dungeonMon->moves = param_3->moves; + + dungeonMon->itemSlot = param_3->heldItem; + BoundedCopyStringtoBuffer(dungeonMon->name,GetMonSpecies(param_3->id),10); + + IncrementAdventureNumJoined(); + + if (SpawnTeamMember(param_3->id,param_3->pos.x,param_3->pos.y,dungeonMon,&local_2c,0,1) == 0) { + LogMessageByIdWithPopupCheckUser(entity1,gText_ButItCouldntJoinTheTeam); + dungeonMon->flags = 0; + } + else { + sub_8083D88(); + sub_803E708(0xa0,0x46); + if (DisplayDungeonYesNoMessage(0,gText_NewMemberJoinedGiveItNickname,TRUE) == 1) { + while (DungeonGiveNameToRecruitedMon(dungeonMon->name) == 0) { + DisplayDungeonMessage(0,gText_PleaseGiveNicknameNewMember,TRUE); + } + } + sub_808D9DC(gFormatBuffer_Monsters[0],dungeonMon,0); + LogMessageByIdWithPopupCheckUser(entity1,gText_Pokemon0JoinedToGoOnAdventures); + if (unlockedFriendArea) { + Entity *leader = CutsceneGetLeader(); + SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],leader,0); + sub_8092558(gFormatBuffer_FriendArea, friendArea); + PlaySound(0xce); + DisplayDungeonMessage(0,gText_Pokemon0GainedAccessToFriendArea,1); + } + if (param_3->id == MONSTER_MEW) { + gDungeon->unk4 = 1; + gDungeon->unk11 = 3; + } + } + + return TRUE; +} + +bool8 CanEntityBeRecruited(Entity *param_1) +{ + s32 i, j; + + EntityInfo *info = GetEntInfo(param_1); + s32 validIndex = -1; + s32 size = GetBodySize(info->apparentID); + if (!IsMonsterRecruitable(info->id)) + return FALSE; + + sub_806F910(); + for (i = 0; i <= (6 - size); i++) { + for (j = 0; j < size; j++){ + if (gUnknown_202EE70[i + j] != 0) + break; + } + if (j == size) { + validIndex = i; + break; + } + } + if (validIndex == -1) + return FALSE; + + + for (i = 0; i < MAX_TEAM_MEMBERS; i++) { + if (!(DungeonMonExists(&gRecruitedPokemonRef->dungeonTeam[i]))) + break; + } + + if (i == MAX_TEAM_MEMBERS) + return FALSE; + + for (i = 0; i < MAX_TEAM_MEMBERS; i++) { + if(!EntityIsValid(gDungeon->teamPokemon[i])) + break; + } + if (i == MAX_TEAM_MEMBERS) + return FALSE; + + return TRUE; +} + +bool8 HandleSpecialEntityJoinSequence(Entity *entity1,Entity *entity2,Entity **entityPtr) +{ + u8 friendArea; + DungeonMon *dungeonMon; + int index; + struct unkStruct_8069D4C local_74; + Entity *local_2c; + s32 i; + bool8 unlockedFriendArea = FALSE; + + *entityPtr = NULL; + sub_8069D4C(&local_74,entity2); + for (index = 0; index < MAX_TEAM_MEMBERS; index++) { + if (!DungeonMonExists(&gRecruitedPokemonRef->dungeonTeam[index])) + break; + } + + if (index == MAX_TEAM_MEMBERS) { + return FALSE; + } + + friendArea = GetFriendArea(local_74.id); + dungeonMon = &gRecruitedPokemonRef->dungeonTeam[index]; + dungeonMon->flags = POKEMON_FLAG_EXISTS | POKEMON_FLAG_ON_TEAM; + dungeonMon->isTeamLeader = FALSE; + dungeonMon->level = local_74.level; + dungeonMon->IQ = 1; + SetDefaultIQSkills(&dungeonMon->IQSkills,FALSE); + dungeonMon->hiddenPower = local_74.hiddenPower; + dungeonMon->tacticIndex = 0; + dungeonMon->recruitedPokemonId = -1; + dungeonMon->unkC = index; + dungeonMon->speciesNum = local_74.id; + dungeonMon->dungeonLocation = gDungeon->unk644.dungeonLocation; + dungeonMon->unk10 = local_74.HP; + dungeonMon->unk12 = local_74.HP; + dungeonMon->belly = local_74.belly; + dungeonMon->maxBelly = local_74.maxBelly; + + for (i = 0; i < 2; i++) { + dungeonMon->offense.att[i] = local_74.att[i]; + dungeonMon->offense.def[i] = local_74.def[i]; + } + + dungeonMon->currExp = local_74.exp; + dungeonMon->moves = local_74.moves; + dungeonMon->itemSlot = local_74.heldItem; + BoundedCopyStringtoBuffer(dungeonMon->name,GetMonSpecies(local_74.id), POKEMON_NAME_LENGTH); + if (GetFriendAreaStatus(friendArea) == 0) { + UnlockFriendArea(friendArea); + unlockedFriendArea = TRUE; + } + IncrementAdventureNumJoined(); + HandleFaint(entity2,DUNGEON_EXIT_TRANSFORMED_INTO_FRIEND,entity1); + if (SpawnTeamMember(local_74.id,local_74.pos.x,local_74.pos.y,dungeonMon,&local_2c,0,0) == 0) { + dungeonMon->flags = 0; + } + else { + if (DisplayDungeonYesNoMessage(0,gText_NewMemberJoinedGiveItNickname,TRUE) == 1) { + while (!DungeonGiveNameToRecruitedMon(dungeonMon->name)) { + DisplayDungeonMessage(0,gText_PleaseGiveNicknameNewMember,TRUE); + } + } + if (unlockedFriendArea) { + Entity *leader = CutsceneGetLeader(); + SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],leader,0); + sub_8092558(gFormatBuffer_FriendArea, friendArea); + PlaySound(0xce); + DisplayDungeonMessage(0,gText_Pokemon0GainedAccessToFriendArea,1); + } + sub_808D9DC(gFormatBuffer_Monsters[3],dungeonMon,0); + *entityPtr = local_2c; + } + + return TRUE; +} diff --git a/src/dungeon_mon_spawn.c b/src/dungeon_mon_spawn.c index 75390585f..ad1134400 100644 --- a/src/dungeon_mon_spawn.c +++ b/src/dungeon_mon_spawn.c @@ -11,7 +11,7 @@ #include "structs/str_dungeon.h" #include "dungeon_vram.h" #include "code_805D8C8.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_config.h" #include "run_dungeon.h" #include "dungeon_range.h" diff --git a/src/code_806CD90.c b/src/dungeon_mon_sprite_render.c similarity index 95% rename from src/code_806CD90.c rename to src/dungeon_mon_sprite_render.c index f6ebc9f21..689be3528 100644 --- a/src/code_806CD90.c +++ b/src/dungeon_mon_sprite_render.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_mon_sprite_render.h" #include "constants/direction.h" #include "constants/status.h" #include "constants/ability.h" @@ -11,7 +12,6 @@ #include "code_8041AD0.h" #include "code_804267C.h" #include "code_805D8C8.h" -#include "code_806CD90.h" #include "dungeon_config.h" #include "dungeon_items.h" #include "dungeon_map_access.h" @@ -32,18 +32,19 @@ #include "sprite.h" #include "random.h" -const u8 gUnknown_8106EC8[][13] = { +extern void sub_8042EC8(Entity *a0, s32 a1); + +static const u8 gUnknown_8106EC8[][13] = { {0, 1, 7, 7, 7, 5, 6, 7, 7, 7, 7, 7, 7}, {7, 7, 7, 7, 7, 5, 6, 7, 7, 7, 7, 7, 7}, {7, 7, 7, 7, 7, 5, 6, 7, 7, 7, 7, 11, 7}, }; -const u8 gUnknown_8106EEF[] = {0x03, 0x04, 0x05, 0x0}; +static const u8 gUnknown_8106EEF[] = {0x03, 0x04, 0x05, 0x0}; +static u8 GetEntityShadowIndex(Entity *entity); -extern void sub_8042EC8(Entity *a0, s32 a1); - -void sub_806C51C(Entity *entity) +void UpdateMonsterSprite(Entity *entity) { s32 x, y, y2; bool8 var_3C; @@ -53,7 +54,7 @@ void sub_806C51C(Entity *entity) DungeonPos posArray[4]; u32 statusSprites; bool8 r4; - u8 r7; + u8 shadowIndex; unkStruct_2039DB0 spriteMasks; s32 xSprite, ySprite; @@ -240,7 +241,7 @@ void sub_806C51C(Entity *entity) return; r4 = FALSE; - r7 = sub_806CF54(entity); + shadowIndex = GetEntityShadowIndex(entity); spriteMasks.unk0 = 0xF3FF; spriteMasks.unk2 = 0xFFFF; @@ -294,8 +295,8 @@ void sub_806C51C(Entity *entity) xSprite = entInfo->pixelPos.x - gDungeon->unk181e8.cameraPixelPos.x; ySprite = entInfo->pixelPos.y - gDungeon->unk181e8.cameraPixelPos.y; - if (xSprite >= -32 && ySprite >= -32 && xSprite <= 271 && ySprite <= 191 && r7 != 6 && entity->unk22 == 0) { - struct unkStruct_202ED28 *spriteStructPtr = &gUnknown_202ED28[var_34][r7]; + if (xSprite >= -32 && ySprite >= -32 && xSprite <= 271 && ySprite <= 191 && shadowIndex != 6 && entity->unk22 == 0) { + struct unkStruct_202ED28 *spriteStructPtr = &gUnknown_202ED28[var_34][shadowIndex]; if (entInfo->unk156 != 0) { SpriteSetX(&spriteStructPtr->sprite, xSprite + spriteStructPtr->pos.x); SpriteSetY(&spriteStructPtr->sprite, ySprite + spriteStructPtr->pos.y); @@ -307,15 +308,13 @@ void sub_806C51C(Entity *entity) void sub_806CC10(void) { - EntityInfo *entityInfo; - Entity *entity; s32 i; for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { - entity = gDungeon->activePokemon[i]; + Entity *entity = gDungeon->activePokemon[i]; if (EntityIsValid(entity)) { - entityInfo = GetEntInfo(entity); + EntityInfo *entityInfo = GetEntInfo(entity); if (entityInfo->unk166 != 0) { entityInfo->unk166--; @@ -479,18 +478,17 @@ void sub_806CF18(Entity *entity) } } -u8 sub_806CF54(Entity *entity) +static u8 GetEntityShadowIndex(Entity *entity) { - return GetEntInfo(entity)->unk204; + return GetEntInfo(entity)->shadowIndex; } void DetermineAllMonsterShadow(void) { - Entity *entity; s32 i; for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { - entity = gDungeon->activePokemon[i]; + Entity *entity = gDungeon->activePokemon[i]; if (EntityIsValid(entity)) DetermineMonsterShadow(entity); @@ -514,6 +512,6 @@ u32 DetermineMonsterShadow(Entity *entity) else if (terrainType == TERRAIN_TYPE_SECONDARY && gDungeonWaterType[gDungeon->tileset] != DUNGEON_WATER_TYPE_LAVA) shadowSize = gUnknown_8106EEF[shadowSize]; - entityInfo->unk204 = shadowSize; + entityInfo->shadowIndex = shadowSize; return shadowSize; } diff --git a/src/dungeon_monster_house.c b/src/dungeon_monster_house.c index dfa38870d..00466dc82 100644 --- a/src/dungeon_monster_house.c +++ b/src/dungeon_monster_house.c @@ -5,7 +5,7 @@ #include "dungeon_map_access.h" #include "dungeon_message.h" #include "code_805D8C8.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/item.h" diff --git a/src/dungeon_move.c b/src/dungeon_move.c index 04af8c3c1..6be25926a 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -12,7 +12,7 @@ #include "dungeon_vram.h" #include "dungeon_tilemap.h" #include "code_8041AD0.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "dungeon_logic.h" #include "dungeon_config.h" diff --git a/src/dungeon_move_util.c b/src/dungeon_move_util.c index 2e47b5247..f20ab83be 100644 --- a/src/dungeon_move_util.c +++ b/src/dungeon_move_util.c @@ -12,7 +12,7 @@ #include "dungeon_vram.h" #include "dungeon_tilemap.h" #include "code_8041AD0.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "dungeon_logic.h" #include "dungeon_config.h" diff --git a/src/dungeon_projectile_throw.c b/src/dungeon_projectile_throw.c index 00e9615ee..c39a2acb4 100644 --- a/src/dungeon_projectile_throw.c +++ b/src/dungeon_projectile_throw.c @@ -10,7 +10,7 @@ #include "dungeon_config.h" #include "dungeon_pos_data.h" #include "dungeon_tilemap.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_message.h" #include "move_util.h" #include "move_orb_effects_5.h" diff --git a/src/dungeon_serializer.c b/src/dungeon_serializer.c index c32ba242b..ec7530bd5 100644 --- a/src/dungeon_serializer.c +++ b/src/dungeon_serializer.c @@ -2,7 +2,7 @@ #include "globaldata.h" #include "structs/str_dungeon.h" #include "code_805D8C8.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_items.h" #include "dungeon_map.h" #include "dungeon_map_access.h" diff --git a/src/dungeon_strings.c b/src/dungeon_strings.c index dc8a4c104..61572e186 100644 --- a/src/dungeon_strings.c +++ b/src/dungeon_strings.c @@ -307,10 +307,10 @@ const u8 *const gUnknown_80F9BB0 = _("{POKEMON_0} became the leader!"); const u8 *const gUnknown_80F9BD8 = _("The leader couldn't be switched!"); const u8 *const gUnknown_80F9C08 = _("You haven't paid for the merchandise yet!"); const u8 *const gUnknown_80F9C2C = _("A thief can't switch leaders!"); -const u8 *const gUnknown_80F9C4C = _("...Something's stirring."); -const u8 *const gUnknown_80F9C70 = _("...Something's approaching."); -const u8 *const gUnknown_80F9C8C = _("It's getting closer!"); -const u8 *const gUnknown_80F9CBC = _("It's right nearby! It's gusting hard!"); +const u8 *const gText_SomethingStirring = _("...Something's stirring."); +const u8 *const gText_SomethingApproaching = _("...Something's approaching."); +const u8 *const gText_ItsGettingCloser = _("It's getting closer!"); +const u8 *const gText_ItsRightNearbyGustingHard = _("It's right nearby! It's gusting hard!"); const u8 *const gUnknown_80F9CC0[] = { [0] = _("{POKEMON_1} was defeated!"), [1] = _("{POKEMON_1} fainted!"), @@ -357,13 +357,13 @@ const u8 *const gUnknown_80F9F2C = _("{POKEMON_0} didn't learn the new move."); const u8 *const gUnknown_80F9FA4 = _("This Pokémon learned a new move,\nso it must forget an old one. Moves can\nbe relearned at the Gulpin Link Shop."); const u8 *const gUnknown_80F9FE8 = _("Yes! {POKEMON_0} wants to join the team!\nAccept {POKEMON_0} as a team member?"); const u8 *const gUnknown_80F9FEC = _(""); -const u8 *const gUnknown_80FA004 = _("{POKEMON_0} went away..."); -const u8 *const gUnknown_80FA030 = _("The Pokémon couldn't join the team..."); -const u8 *const gUnknown_80FA058 = _("But it couldn't join the team."); -const u8 *const gUnknown_80FA090 = _("A new member joined the team!\nGive it a nickname?"); -const u8 *const gUnknown_80FA0C8 = _("Please give your new team member\na proper nickname!"); -const u8 *const gUnknown_80FA0F0 = _("{POKEMON_0} joined $t to\ngo on adventures!"); -const u8 *const gUnknown_80FA120 = _("{POKEMON_0} gained access to\nthe Friend Area {FRIEND_AREA}."); +const u8 *const gText_Pokemon0WentAway = _("{POKEMON_0} went away..."); +const u8 *const gText_ThePokemonCouldntJoinTeam = _("The Pokémon couldn't join the team..."); +const u8 *const gText_ButItCouldntJoinTheTeam = _("But it couldn't join the team."); +const u8 *const gText_NewMemberJoinedGiveItNickname = _("A new member joined the team!\nGive it a nickname?"); +const u8 *const gText_PleaseGiveNicknameNewMember = _("Please give your new team member\na proper nickname!"); +const u8 *const gText_Pokemon0JoinedToGoOnAdventures = _("{POKEMON_0} joined $t to\ngo on adventures!"); +const u8 *const gText_Pokemon0GainedAccessToFriendArea = _("{POKEMON_0} gained access to\nthe Friend Area {FRIEND_AREA}."); const u8 *const gUnknown_80FA124[] = { [0] = _("{POKEMON_0} was slowed!"), [1] = _("{POKEMON_0} returned to normal speed!"), diff --git a/src/dungeon_tilemap.c b/src/dungeon_tilemap.c index 86e993ce7..d29dde189 100644 --- a/src/dungeon_tilemap.c +++ b/src/dungeon_tilemap.c @@ -11,7 +11,7 @@ #include "effect_data.h" #include "code_801602C.h" #include "dungeon_vram.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_info.h" #include "dungeon_items.h" #include "dungeon_map.h" diff --git a/src/dungeon_turn_effects.c b/src/dungeon_turn_effects.c index db3ff3c09..ac0766330 100644 --- a/src/dungeon_turn_effects.c +++ b/src/dungeon_turn_effects.c @@ -11,7 +11,7 @@ #include "dungeon_music.h" #include "dungeon_map_access.h" #include "dungeon_vram.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "game_options.h" #include "dungeon_items.h" #include "moves.h" diff --git a/src/dungeon_util.c b/src/dungeon_util.c index dc96a2207..de2d2dd67 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -5,7 +5,7 @@ #include "structs/str_traps.h" #include "structs/map.h" #include "code_8041AD0.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_items.h" #include "dungeon_map_access.h" #include "dungeon_tilemap.h" @@ -144,7 +144,7 @@ void sub_804522C(void) { if(entity == gDungeon->unk181e8.cameraTarget) { - sub_806C51C(entity); + UpdateMonsterSprite(entity); } else { @@ -162,7 +162,7 @@ void sub_804522C(void) entity2 = gDungeon->teamPokemon[index]; if(EntityIsValid(entity2)) { - sub_806C51C(entity2); + UpdateMonsterSprite(entity2); } } for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++) @@ -170,7 +170,7 @@ void sub_804522C(void) entity2 = gDungeon->wildPokemon[index]; if(EntityIsValid(entity2)) { - sub_806C51C(entity2); + UpdateMonsterSprite(entity2); } } diff --git a/src/dungeon_wind.c b/src/dungeon_wind.c index 902b7eae9..a5badc2c1 100644 --- a/src/dungeon_wind.c +++ b/src/dungeon_wind.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_wind.h" #include "dungeon_misc.h" #include "code_804267C.h" #include "dungeon_message.h" @@ -19,69 +20,66 @@ #include "moves.h" #include "structs/str_dungeon.h" #include "dungeon_engine.h" +#include "dungeon_entity_movement.h" -extern u8 DisplayActions(Entity *); - -void sub_807E378(void) +void UpdateWindTurns(void) { - u16 uVar2; - Entity *leader; + Entity *leader = GetLeader(); - leader = GetLeader(); - if (EntityIsValid(leader)) { + if (!EntityIsValid(leader)) + return; - uVar2 = gDungeon->unk644.windTurns; - if ((gDungeon->unk644.windTurns < 1) || - (gDungeon->unk644.windTurns--, ((uVar2 - 1) << 0x10) < 1)) { - gDungeon->unk644.unk36 = 3; + if (gDungeon->unk644.windTurns <= 0 || --gDungeon->unk644.windTurns < 1) { + gDungeon->unk644.windPhase = 3; } - if (gDungeon->unk644.unk36 == 0) { - if (gDungeon->unk644.windTurns < 0xfa) { - sub_805E804(); - TryPointCameraToMonster(leader,1); - DisplayActions(leader); - if (IsFloorOver() == 0) { - LogMessageByIdWithPopupCheckUser(leader,gUnknown_80F9C4C); - sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],0); - gDungeon->unk644.unk36 = 1; + if (gDungeon->unk644.windPhase == 0) { + if (gDungeon->unk644.windTurns < 0xfa) { + sub_805E804(); + TryPointCameraToMonster(leader,1); + DisplayActions(leader); + if (!IsFloorOver()) { + LogMessageByIdWithPopupCheckUser(leader,gText_SomethingStirring); + sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],0); + gDungeon->unk644.windPhase = 1; + } } - } } - else if (gDungeon->unk644.unk36 == 1) { - if (gDungeon->unk644.windTurns < 0x96) { - sub_805E804(); - TryPointCameraToMonster(leader,1); - DisplayActions(leader); - if (IsFloorOver() == 0) { - LogMessageByIdWithPopupCheckUser(leader,gUnknown_80F9C70); - sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],1); - gDungeon->unk644.unk36 = 2; + else if (gDungeon->unk644.windPhase == 1) { + if (gDungeon->unk644.windTurns < 0x96) { + sub_805E804(); + TryPointCameraToMonster(leader,1); + DisplayActions(leader); + if (!IsFloorOver()) { + LogMessageByIdWithPopupCheckUser(leader,gText_SomethingApproaching); + sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],1); + gDungeon->unk644.windPhase = 2; + } } - } } - else if (gDungeon->unk644.unk36 == 2) { - if (gDungeon->unk644.windTurns < 0x32) { - sub_805E804(); - TryPointCameraToMonster(leader,1); - DisplayActions(leader); - if (IsFloorOver() == 0) { - LogMessageByIdWithPopupCheckUser(leader,gUnknown_80F9C8C); - sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],2); - gDungeon->unk644.unk36 = 3; + else if (gDungeon->unk644.windPhase == 2) { + if (gDungeon->unk644.windTurns < 0x32) { + sub_805E804(); + TryPointCameraToMonster(leader,1); + DisplayActions(leader); + if (!IsFloorOver()) { + LogMessageByIdWithPopupCheckUser(leader,gText_ItsGettingCloser); + sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],2); + gDungeon->unk644.windPhase = 3; + } } - } } - else if (gDungeon->unk644.windTurns < 1) { - sub_805E804(); - TryPointCameraToMonster(leader,1); - DisplayActions(leader); - if (IsFloorOver() == 0) { - LogMessageByIdWithPopupCheckUser(leader,gUnknown_80F9CBC); - sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],3); - gDungeon->unk644.unk36 = 4; - HandleFaint(leader,DUNGEON_EXIT_BLOWN_OUT_UNSEEN_FORCE,leader); - } + else { + if (gDungeon->unk644.windTurns < 1) { + sub_805E804(); + TryPointCameraToMonster(leader,1); + DisplayActions(leader); + if (!IsFloorOver()) { + LogMessageByIdWithPopupCheckUser(leader,gText_ItsRightNearbyGustingHard); + sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],3); + gDungeon->unk644.windPhase = 4; + HandleFaint(leader,DUNGEON_EXIT_BLOWN_OUT_UNSEEN_FORCE,leader); + } + } } - } } diff --git a/src/explosion.c b/src/explosion.c index c09eeceb2..11dea4f4b 100644 --- a/src/explosion.c +++ b/src/explosion.c @@ -6,7 +6,7 @@ #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "structs/str_dungeon.h" #include "dungeon_ai.h" #include "run_dungeon.h" diff --git a/src/expose_trap.c b/src/expose_trap.c index f0f218956..11d109495 100644 --- a/src/expose_trap.c +++ b/src/expose_trap.c @@ -5,7 +5,7 @@ #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "structs/str_dungeon.h" #include "dungeon_ai.h" #include "run_dungeon.h" diff --git a/src/hurl_orb.c b/src/hurl_orb.c index 07cc32e51..bffa24aed 100644 --- a/src/hurl_orb.c +++ b/src/hurl_orb.c @@ -5,7 +5,7 @@ #include "code_8041AD0.h" #include "code_804267C.h" #include "code_805D8C8.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/ability.h" #include "constants/dungeon_exit.h" #include "constants/monster.h" diff --git a/src/move_orb_actions_1.c b/src/move_orb_actions_1.c index e508e1aec..872e358f0 100644 --- a/src/move_orb_actions_1.c +++ b/src/move_orb_actions_1.c @@ -5,7 +5,7 @@ #include "dungeon_move_util.h" #include "dungeon_vram.h" #include "dungeon_tilemap.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/dungeon_exit.h" diff --git a/src/move_orb_actions_2.c b/src/move_orb_actions_2.c index 8e816fb6c..3e16b214d 100644 --- a/src/move_orb_actions_2.c +++ b/src/move_orb_actions_2.c @@ -5,7 +5,7 @@ #include "dungeon_move_util.h" #include "dungeon_vram.h" #include "dungeon_tilemap.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/dungeon_exit.h" diff --git a/src/move_orb_actions_3.c b/src/move_orb_actions_3.c index 85ae35a1e..fb430e705 100644 --- a/src/move_orb_actions_3.c +++ b/src/move_orb_actions_3.c @@ -3,7 +3,7 @@ #include "dungeon_vram.h" #include "move_orb_actions_3.h" #include "dungeon_tilemap.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/dungeon_exit.h" diff --git a/src/move_orb_actions_4.c b/src/move_orb_actions_4.c index 5258d8569..472750e64 100644 --- a/src/move_orb_actions_4.c +++ b/src/move_orb_actions_4.c @@ -8,7 +8,7 @@ #include "dungeon_move_util.h" #include "dungeon_message.h" #include "dungeon_move.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/dungeon_exit.h" diff --git a/src/move_orb_actions_5.c b/src/move_orb_actions_5.c index fb223e987..06652b4b2 100644 --- a/src/move_orb_actions_5.c +++ b/src/move_orb_actions_5.c @@ -11,7 +11,7 @@ #include "dungeon_strings.h" #include "dungeon_util.h" #include "dungeon_misc.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_pos_data.h" #include "dungeon_floor_spawns.h" #include "hurl_orb.h" diff --git a/src/move_orb_effects_1.c b/src/move_orb_effects_1.c index 2f2e2df47..bdd5c34ed 100644 --- a/src/move_orb_effects_1.c +++ b/src/move_orb_effects_1.c @@ -2,7 +2,7 @@ #include "globaldata.h" #include "move_orb_effects_1.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/direction.h" diff --git a/src/move_orb_effects_2.c b/src/move_orb_effects_2.c index 73edcc00a..e87d97ca0 100644 --- a/src/move_orb_effects_2.c +++ b/src/move_orb_effects_2.c @@ -2,7 +2,7 @@ #include "globaldata.h" #include "move_orb_effects_2.h" #include "dungeon_vram.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/status.h" diff --git a/src/move_orb_effects_3.c b/src/move_orb_effects_3.c index 04eb1de71..207981ae0 100644 --- a/src/move_orb_effects_3.c +++ b/src/move_orb_effects_3.c @@ -5,7 +5,7 @@ #include "dungeon_map_access.h" #include "dungeon_message.h" #include "code_805D8C8.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/item.h" diff --git a/src/move_orb_effects_4.c b/src/move_orb_effects_4.c index 02280459c..1e067bef1 100644 --- a/src/move_orb_effects_4.c +++ b/src/move_orb_effects_4.c @@ -5,7 +5,7 @@ #include "dungeon_map_access.h" #include "dungeon_message.h" #include "code_805D8C8.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/item.h" diff --git a/src/move_orb_effects_5.c b/src/move_orb_effects_5.c index d92dc909d..cd0869d2e 100644 --- a/src/move_orb_effects_5.c +++ b/src/move_orb_effects_5.c @@ -5,7 +5,7 @@ #include "dungeon_map_access.h" #include "dungeon_message.h" #include "code_805D8C8.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/dungeon_exit.h" diff --git a/src/one_room_orb.c b/src/one_room_orb.c index 1724aee56..4727a1dc1 100644 --- a/src/one_room_orb.c +++ b/src/one_room_orb.c @@ -5,7 +5,7 @@ #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "structs/str_dungeon.h" #include "dungeon_entity_movement.h" #include "run_dungeon.h" diff --git a/src/pounce_orb.c b/src/pounce_orb.c index 74e180569..699a93430 100644 --- a/src/pounce_orb.c +++ b/src/pounce_orb.c @@ -5,7 +5,7 @@ #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "structs/str_dungeon.h" #include "dungeon_entity_movement.h" #include "run_dungeon.h" diff --git a/src/run_dungeon.c b/src/run_dungeon.c index 5381319e3..e7c759678 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -144,7 +144,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) gDungeon->unk644.unk34 = setupPtr->info.sub0.unkB; gDungeon->unk644.dungeonSeed = setupPtr->info.dungeonSeed; gDungeon->unk644.windTurns = GetTurnLimit(setupPtr->info.sub0.unk0.id); - gDungeon->unk644.unk36 = 0; + gDungeon->unk644.windPhase = 0; gDungeon->unk644.unk37 = GetRescuesAllowed(setupPtr->info.sub0.unk0.id); } gDungeon->unk644.unk54 = 0; @@ -344,7 +344,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) if (!r6) { GenerateFloor(); gDungeon->unk644.windTurns = GetTurnLimit(gDungeon->unk644.dungeonLocation.id); - gDungeon->unk644.unk36 = 0; + gDungeon->unk644.windPhase = 0; } sub_804AAD4(); sub_8049B8C(); diff --git a/src/switcher_orb.c b/src/switcher_orb.c index 87fc10f49..7fc40f890 100644 --- a/src/switcher_orb.c +++ b/src/switcher_orb.c @@ -5,7 +5,7 @@ #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "structs/str_dungeon.h" #include "dungeon_entity_movement.h" #include "run_dungeon.h" diff --git a/src/trap.c b/src/trap.c index eff992c11..4654ec023 100644 --- a/src/trap.c +++ b/src/trap.c @@ -5,7 +5,7 @@ #include "code_8041AD0.h" #include "dungeon_message.h" #include "dungeon_random.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "constants/dungeon_exit.h" #include "constants/residual_damage.h" #include "constants/trap.h" diff --git a/src/trawl_orb.c b/src/trawl_orb.c index df6cb89b0..8d83b72a1 100644 --- a/src/trawl_orb.c +++ b/src/trawl_orb.c @@ -5,7 +5,7 @@ #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "structs/str_dungeon.h" #include "dungeon_ai.h" #include "run_dungeon.h" diff --git a/src/warp_target.c b/src/warp_target.c index 29b4c6068..4088299a6 100644 --- a/src/warp_target.c +++ b/src/warp_target.c @@ -5,7 +5,7 @@ #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "structs/str_dungeon.h" #include "dungeon_entity_movement.h" #include "run_dungeon.h" diff --git a/src/weather.c b/src/weather.c index b9d045d5a..36f509525 100644 --- a/src/weather.c +++ b/src/weather.c @@ -20,7 +20,7 @@ #include "dungeon_map_access.h" #include "position_util.h" #include "dungeon_ai.h" -#include "code_806CD90.h" +#include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "code_805D8C8.h" #include "dungeon_items.h" From d3fb261c88378833c7cfe81a77a95b4a52247f1f Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 17 Oct 2025 16:42:53 +0200 Subject: [PATCH 3/5] clean up externs in code 8041AD0 --- include/code_8041AD0.h | 11 -- include/code_804267C.h | 13 -- include/dungeon_8041AD0.h | 167 ++++++++++++++++++ include/dungeon_recruit_release_menu.h | 8 + ld_script.ld | 8 +- src/blow_away.c | 3 +- src/code_8040094_1.c | 4 +- src/code_8066D04.c | 4 +- src/drought_orb.c | 2 +- src/{code_8041AD0.c => dungeon_8041AD0.c} | 99 +++++------ src/dungeon_action_execution.c | 4 +- src/dungeon_cutscene_articuno.c | 5 +- src/dungeon_cutscene_celebi.c | 5 +- src/dungeon_cutscene_deoxys.c | 5 +- src/dungeon_cutscene_empty_summit.c | 3 +- src/dungeon_cutscene_entei.c | 5 +- src/dungeon_cutscene_groudon.c | 5 +- src/dungeon_cutscene_hooh.c | 5 +- src/dungeon_cutscene_jirachi.c | 6 +- src/dungeon_cutscene_kyogre.c | 5 +- src/dungeon_cutscene_latios.c | 5 +- src/dungeon_cutscene_lugia.c | 5 +- src/dungeon_cutscene_magma_cavern.c | 5 +- src/dungeon_cutscene_mankey.c | 5 +- src/dungeon_cutscene_meanies.c | 5 +- src/dungeon_cutscene_medicham.c | 5 +- src/dungeon_cutscene_mewtwo.c | 5 +- src/dungeon_cutscene_moltres.c | 5 +- src/dungeon_cutscene_raikou.c | 5 +- src/dungeon_cutscene_rayquaza.c | 5 +- src/dungeon_cutscene_regis.c | 5 +- src/dungeon_cutscene_skarmory.c | 5 +- src/dungeon_cutscene_smeargle.c | 5 +- src/dungeon_cutscene_suicune.c | 5 +- src/dungeon_cutscene_zapdos.c | 5 +- src/dungeon_damage.c | 19 +- src/dungeon_entity_movement.c | 2 +- src/dungeon_generation.c | 1 - src/dungeon_generation_fixed.c | 3 +- src/dungeon_item_action.c | 6 +- src/dungeon_items.c | 6 +- src/dungeon_jobs.c | 4 +- src/dungeon_kecleon_shop.c | 1 - src/dungeon_leveling.c | 2 +- src/dungeon_logic.c | 4 +- src/dungeon_main.c | 3 +- src/dungeon_map_access.c | 3 +- src/dungeon_menu_items.c | 4 +- src/dungeon_misc.c | 14 +- src/dungeon_mon_spawn.c | 9 +- src/dungeon_mon_sprite_render.c | 5 +- src/dungeon_monster_house.c | 3 +- src/dungeon_move.c | 10 +- src/dungeon_move_util.c | 5 +- ...67A80.c => dungeon_recruit_release_menu.c} | 95 +++++----- src/dungeon_tilemap.c | 3 +- src/dungeon_turn_effects.c | 5 +- src/dungeon_util.c | 2 +- src/dungeon_wild_mon_spawn.c | 4 +- src/dungeon_wind.c | 2 +- src/explosion.c | 5 +- src/expose_trap.c | 2 +- src/hurl_orb.c | 3 +- src/move_orb_actions_5.c | 4 +- src/move_orb_effects_1.c | 35 +--- src/move_orb_effects_2.c | 60 +------ src/move_orb_effects_3.c | 4 +- src/move_orb_effects_4.c | 17 +- src/move_orb_effects_5.c | 33 +--- src/one_room_orb.c | 2 +- src/pounce_orb.c | 2 +- src/run_dungeon.c | 5 +- src/switcher_orb.c | 4 +- src/trap.c | 4 +- src/trawl_orb.c | 2 +- src/warp_target.c | 2 +- src/weather.c | 5 +- sym_ewram.txt | 2 +- 78 files changed, 343 insertions(+), 505 deletions(-) delete mode 100644 include/code_8041AD0.h delete mode 100644 include/code_804267C.h create mode 100644 include/dungeon_8041AD0.h create mode 100644 include/dungeon_recruit_release_menu.h rename src/{code_8041AD0.c => dungeon_8041AD0.c} (95%) rename src/{dungeon_8067A80.c => dungeon_recruit_release_menu.c} (88%) diff --git a/include/code_8041AD0.h b/include/code_8041AD0.h deleted file mode 100644 index 0cf28f73a..000000000 --- a/include/code_8041AD0.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef GUARD_CODE_8041AD0_H -#define GUARD_CODE_8041AD0_H - -#include "structs/dungeon_entity.h" -#include "structs/str_damage.h" - -u32 EntityGetStatusSprites(Entity *entity); -void sub_80420E8(Entity *pokemon, DamageStruct *dmgStruct); -void sub_80421C0(Entity *pokemon, u16); - -#endif // GUARD_CODE_8041AD0_H \ No newline at end of file diff --git a/include/code_804267C.h b/include/code_804267C.h deleted file mode 100644 index 0c4557cf8..000000000 --- a/include/code_804267C.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef GUARD_CODE_804267C_H -#define GUARD_CODE_804267C_H - -#include "structs/dungeon_entity.h" - -void PlayStairsSound(void); -void sub_80426C8(u32 a0, u32 a1); -void sub_8042730(Entity *a0, void *unused); -bool8 sub_8042768(Entity* pokemon); -void sub_80427AC(void); -void sub_8042818(u8 a0, bool8 a1); - -#endif diff --git a/include/dungeon_8041AD0.h b/include/dungeon_8041AD0.h new file mode 100644 index 000000000..7a7bf5455 --- /dev/null +++ b/include/dungeon_8041AD0.h @@ -0,0 +1,167 @@ +#ifndef GUARD_DUNGEON_8041AD0_H +#define GUARD_DUNGEON_8041AD0_H + +#include "structs/dungeon_entity.h" +#include "structs/str_damage.h" + +s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3); +void sub_804178C(u8 param_1); +u32 EntityGetStatusSprites(Entity *entity); +void sub_8041888(u8 param_1); +void EntityUpdateStatusSprites(Entity *entity); +void sub_8041AD0(Entity *pokemon); +void sub_8041AE0(Entity *pokemon); +void sub_8041AF4(Entity *pokemon); +void nullsub_57(Entity *pokemon); +void sub_8041B18(Entity *pokemon); +void nullsub_58(Entity *pokemon); +void nullsub_59(Entity *pokemon); +void sub_8041B34(Entity *pokemon); +void nullsub_60(Entity *pokemon); +void sub_8041B48(Entity *pokemon); +void nullsub_61(Entity *pokemon); +void sub_8041B5C(Entity *pokemon); +void nullsub_62(Entity *pokemon); +void sub_8041B74(Entity *pokemon); +void nullsub_63(Entity *pokemon); +void nullsub_64(Entity *pokemon); +void sub_8041B90(Entity *pokemon); +void nullsub_65(Entity *pokemon); +void nullsub_66(Entity *pokemon); +void sub_8041BA8(Entity *pokemon); +void nullsub_67(Entity *pokemon); +void sub_8041BBC(Entity *pokemon); +void nullsub_68(Entity *pokemon); +void sub_8041BD0(Entity *pokemon, u8 r1); +void sub_8041BE8(Entity *pokemon); +void sub_8041BF8(Entity *pokemon); +void sub_8041C08(Entity *pokemon); +void sub_8041C1C(Entity *pokemon); +void nullsub_69(Entity *pokemon, Entity *target); +void sub_8041C34(Entity *pokemon); +void nullsub_70(Entity *pokemon); +void nullsub_71(Entity *pokemon); +void sub_8041C4C(Entity *pokemon, u32 r1); +void sub_8041C58(Entity *pokemon); +void sub_8041C6C(Entity *pokemon); +void sub_8041C7C(Entity *pokemon); +void nullsub_72(Entity *pokemon); +void nullsub_73(Entity *pokemon); +void sub_8041C94(Entity *pokemon); +void sub_8041CA8(Entity *pokemon); +void sub_8041CB8(Entity *pokemon); +void sub_8041CCC(Entity *pokemon); +void sub_8041CDC(Entity *pokemon); +void sub_8041CEC(Entity *pokemon); +void nullsub_74(Entity *pokemon); +void sub_8041D00(Entity *pokemon, Entity *target); +void nullsub_75(Entity *pokemon); +void nullsub_76(Entity *pokemon); +void nullsub_77(Entity *pokemon); +void nullsub_78(Entity *pokemon); +void nullsub_79(Entity *pokemon); +void nullsub_80(Entity *pokemon); +void sub_8041D38(Entity * pokemon); +void sub_8041D48(Entity * pokemon); +void nullsub_81(Entity *pokemon); +void sub_8041D5C(Entity *pokemon); +void sub_8041D84(Entity *pokemon); +void nullsub_82(Entity *pokemon); +void nullsub_83(Entity *pokemon); +void sub_8041D9C(Entity *pokemon); +void sub_8041DB0(Entity *pokemon); +void nullsub_84(Entity *pokemon); +void nullsub_85(Entity *pokemon); +void nullsub_86(Entity *pokemon); +void nullsub_87(Entity *pokemon); +void nullsub_88(Entity *pokemon); +void sub_8041DD8(Entity *pokemon, s32 r1); +void nullsub_89(Entity *pokemon); +void sub_8041E0C(Entity *pokemon); +void sub_8041E1C(Entity *pokemon); +void sub_8041E3C(Entity *pokemon); +void sub_8041E4C(Entity *pokemon); +void sub_8041E60(Entity *pokemon); +void sub_8041E74(Entity *pokemon); +void sub_8041E84(Entity *pokemon); +void sub_8041E94(Entity *pokemon); +void sub_8041EA4(Entity *pokemon); +void sub_8041EB4(Entity *pokemon); +void sub_8041EC8(Entity *pokemon); +void sub_8041ED8(Entity *pokemon); +void sub_8041EE8(Entity *pokemon); +void sub_8041EF8(Entity *pokemon); +void sub_8041F08(Entity *pokemon); +void nullsub_90(Entity *pokemon); +void sub_8041F28(Entity *pokemon, u32 r1); +void sub_8041F4C(Entity *pokemon, u32 r1); +void sub_8041F70(Entity *pokemon, u32 r1); +void sub_8041F94(Entity *pokemon, u32 r1); +void sub_8041FB4(Entity *pokemon, u32 r1); +void sub_8041FD8(Entity *pokemon, u32 r1); +void sub_8041FFC(Entity *pokemon, u32 r1); +void sub_804201C(Entity *pokemon, u32 r1); +void sub_8042040(Entity *pokemon, u32 r1); +void sub_8042060(Entity *pokemon, u32 r1); +void sub_8042080(Entity *pokemon, u32 r1); +void sub_80420A0(Entity *pokemon); +void nullsub_91(Entity *pokemon); +void sub_80420B8(Entity *pokemon); +void sub_80420C8(Entity *pokemon); +void nullsub_92(Entity *pokemon); +void sub_80420E8(Entity *pokemon, struct DamageStruct *dmgStruct); +void sub_8042148(Entity *pokemon); +void nullsub_93(DungeonPos *pos); +void sub_804216C(Entity *pokemon, Entity *target, u32 r2); +void sub_804218C(Entity *pokemon, Entity *target); +void sub_804219C(PixelPos *pos); +void sub_80421AC(Entity *pokemon, Entity * target); +void sub_80421C0(Entity *pokemon, u16 r1); +void sub_80421EC(DungeonPos *pos, u16 r1); +void sub_8042208(Entity *pokemon, u8 r1); +void sub_8042238(Entity *pokemon, Entity *target); +void sub_804225C(Entity *entity, DungeonPos *pos, u8 trapId); +void sub_8042390(Entity *entity, Item *item); +void sub_804245C(Entity *entity, Item *item); +s32 sub_8042520(Entity *a0); +void PlayStairsSound(void); +void sub_80426C8(u32 a0, u32 a1); +void sub_8042730(Entity *a0, Entity *unused); +bool8 sub_8042768(Entity* pokemon); +void sub_80427AC(void); +void sub_8042818(u8 a0, bool8 a1); +void sub_80428A0(Entity *r0); +void sub_80428B0(Entity *r0); +void sub_80428C4(Entity *r0); +void sub_80428D8(Entity *r0); +void sub_80428EC(Entity *r0); +void sub_8042900(Entity *r0); +void ShowVisualFlags(Entity *r0); +void sub_8042920(Entity *r0); +void sub_8042930(Entity *r0); +void sub_8042940(Entity *r0); +void sub_8042950(Entity *r0); +void sub_8042968(Entity *r0); +void sub_8042978(Entity *r0); +void sub_804298C(Entity *r0); +void sub_80429A0(Entity *r0); +void sub_80429B4(Entity *r0); +void sub_80429C8(Entity *r0); +void sub_80429D8(Entity *r0); +void sub_80429E8(Entity *r0); +void sub_80429FC(DungeonPos *r0); +void sub_8042A14(DungeonPos *r0); +void sub_8042A24(Entity *r0); +void sub_8042A34(DungeonPos *r0); +void sub_8042A44(Entity *r0); +void sub_8042A54(DungeonPos *r0); +void sub_8042A64(DungeonPos *r0); +void sub_8042A74(Entity *r0); +void sub_8042B0C(Entity *entity); +void sub_8042B20(Entity *entity); +void sub_8042DD4(s32 a0, Entity *a1, s32 a2); +void sub_8042E5C(void); +void sub_8042E98(void); +void sub_8042EC8(Entity *a0, s32 a1); + +#endif // GUARD_DUNGEON_8041AD0_H diff --git a/include/dungeon_recruit_release_menu.h b/include/dungeon_recruit_release_menu.h new file mode 100644 index 000000000..079c00feb --- /dev/null +++ b/include/dungeon_recruit_release_menu.h @@ -0,0 +1,8 @@ +#ifndef GUARD_DUNGEON_RECRUIT_RELEASE_MENU_H +#define GUARD_DUNGEON_RECRUIT_RELEASE_MENU_H + +#include "structs/str_pokemon.h" + +void ShowRecruitReleaseMenu(u8 a0, s32 a1, s32 a2, Pokemon **a3); + +#endif // GUARD_DUNGEON_RECRUIT_RELEASE_MENU_H diff --git a/ld_script.ld b/ld_script.ld index e0c4a41b9..be10097fb 100755 --- a/ld_script.ld +++ b/ld_script.ld @@ -201,7 +201,7 @@ SECTIONS { src/dungeon_tilemap.o(.text); src/dungeon_map.o(.text); src/code_8040094_1.o(.text); - src/code_8041AD0.o(.text); + src/dungeon_8041AD0.o(.text); src/run_dungeon.o(.text); src/dungeon_engine.o(.text); src/dungeon_action.o(.text); @@ -233,7 +233,7 @@ SECTIONS { src/dungeon_menu_others.o(.text); src/dungeon_menu_recruitment.o(.text); src/code_8066D04.o(.text); - src/dungeon_8067A80.o(.text); + src/dungeon_recruit_release_menu.o(.text); src/dungeon_misc.o(.text); src/dungeon_mon_spawn.o(.text); src/dungeon_mon_sprite_render.o(.text); @@ -583,7 +583,7 @@ SECTIONS { src/dungeon_map.o(.rodata); src/code_8040094_1.o(.rodata); data/pksdir_0.o(.rodata); - src/code_8041AD0.o(.rodata); + src/dungeon_8041AD0.o(.rodata); src/run_dungeon.o(.rodata); src/dungeon_engine.o(.rodata); src/dungeon_action.o(.rodata); @@ -618,7 +618,7 @@ SECTIONS { src/dungeon_menu_others.o(.rodata); src/dungeon_menu_recruitment.o(.rodata); src/code_8066D04.o(.rodata); - src/dungeon_8067A80.o(.rodata); + src/dungeon_recruit_release_menu.o(.rodata); src/dungeon_misc.o(.rodata); src/dungeon_mon_spawn.o(.rodata); src/dungeon_mon_sprite_render.o(.rodata); diff --git a/src/blow_away.c b/src/blow_away.c index 9378698a9..3889f3e87 100644 --- a/src/blow_away.c +++ b/src/blow_away.c @@ -20,7 +20,7 @@ #include "move_orb_effects_1.h" #include "moves.h" #include "move_util.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "weather.h" #include "dungeon_config.h" #include "dungeon_misc.h" @@ -35,7 +35,6 @@ #include "expose_trap.h" extern void sub_804EB30(); -extern void sub_80421AC(Entity * pokemon, Entity * target); extern void sub_807BB78(Entity *pokemon); void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction) diff --git a/src/code_8040094_1.c b/src/code_8040094_1.c index 09c419ef3..24f9a03f4 100644 --- a/src/code_8040094_1.c +++ b/src/code_8040094_1.c @@ -10,7 +10,6 @@ #include "effect_data.h" #include "effect_sub_1.h" #include "dungeon_vram.h" -#include "code_804267C.h" #include "dungeon_info.h" #include "dungeon_message.h" #include "dungeon_move.h" @@ -22,6 +21,7 @@ #include "dungeon_map_access.h" #include "dungeon_strings.h" #include "dungeon_mon_sprite_render.h" +#include "dungeon_8041AD0.h" struct UnkStruct_8040094 { @@ -36,7 +36,6 @@ struct UnkStruct_8040094 extern u8 sub_800EC94(s32 param_1); extern s32 sub_800E710(s32 species, u16 moveId); extern void sub_800EEC8(u16 r0); -extern void sub_8042DD4(s32 a0, Entity *a1, s32 a2); extern u8 sub_800EA44(s32 species, u16 a2); extern s32 sub_800E790(s32 species, u16 a2); extern s32 sub_800E52C(struct UnkStruct_8040094 *a0); @@ -51,7 +50,6 @@ extern bool8 sub_800E7D0(struct UnkStruct_8040094 *a0); extern bool8 EffectiveMoveHasSineWobble(s32 moveId); extern bool8 MoveMatchesBideClassStatus(Entity *pokemon, Move *move); extern bool8 IsSleeping(Entity *pokemon); -extern void sub_80421C0(Entity *pokemon, u16); extern const s32 gUnknown_8106A8C[]; diff --git a/src/code_8066D04.c b/src/code_8066D04.c index 662d9647e..b26c4797e 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -6,7 +6,7 @@ #include "constants/move_id.h" #include "dungeon_vram.h" #include "dungeon_tilemap.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "dungeon_action.h" #include "code_8066D04.h" #include "dungeon_mon_sprite_render.h" @@ -46,8 +46,6 @@ #include "warp_target.h" #include "move_orb_effects_5.h" -extern void sub_8042208(Entity *pokemon, u8 r1); - Entity *sub_806773C(Entity *entity); void sub_8067558(Entity *entity, Entity *targetEntity, s32 a2); void sub_8067794(Entity *entity, Entity *targetEntity, s32 a2); diff --git a/src/drought_orb.c b/src/drought_orb.c index b2e64218c..fa6a9202f 100644 --- a/src/drought_orb.c +++ b/src/drought_orb.c @@ -18,7 +18,7 @@ #include "move_orb_effects_1.h" #include "moves.h" #include "move_util.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "weather.h" #include "dungeon_config.h" #include "dungeon_misc.h" diff --git a/src/code_8041AD0.c b/src/dungeon_8041AD0.c similarity index 95% rename from src/code_8041AD0.c rename to src/dungeon_8041AD0.c index 97ade57e6..fa893285d 100644 --- a/src/code_8041AD0.c +++ b/src/dungeon_8041AD0.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_8041AD0.h" #include "constants/direction.h" #include "constants/status.h" #include "constants/type.h" @@ -11,8 +12,6 @@ #include "effect_sub_1.h" #include "dungeon_vram.h" #include "dungeon_tilemap.h" -#include "code_8041AD0.h" -#include "code_804267C.h" #include "dungeon_mon_sprite_render.h" #include "dungeon_config.h" #include "dungeon_logic.h" @@ -36,25 +35,13 @@ // Unknown dungeon file. File split is correct. - -void EntityUpdateStatusSprites(Entity *entity); - - extern void sub_800DBBC(void); -extern void sub_8042E98(void); extern void sub_800EF28(u8); -extern void sub_80429A0(Entity *); -void sub_8042B34(s32 a0, s32 a1, s32 a2); -extern bool8 sub_8042CC0(void); -extern void sub_8042D7C(void); extern void sub_800F15C(s32); extern void sub_800EF40(u8 r0, u8 r1); extern s32 sub_800E6D8(s32); extern void sub_800EB24(s32 param_1, DungeonPos *param_2, DungeonPos *param_3, s32 param_4, s32 param_5); -s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3); -void sub_804178C(u8 param_1); - struct UnkStruct_80F6624 { s16 unk0; @@ -190,6 +177,9 @@ static const u32 sStatusSpriteMasks_MuzzledStatus[] = { static s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5); static u32 sub_8041764(unkStruct_80416E0 *param_1, bool8 param_2); +static void sub_8042B34(s32 a0, s32 a1, s32 a2); +static bool8 sub_8042CC0(void); +static void sub_8042D7C(void); static s32 sub_804151C(Entity *entity, s32 r1, u8 r2) { @@ -461,7 +451,7 @@ void sub_8041AF4(Entity *pokemon) sub_80421C0(pokemon, 407); } -void nullsub_57(void) +void nullsub_57(Entity *pokemon) { } @@ -470,11 +460,11 @@ void sub_8041B18(Entity *pokemon) sub_804151C(pokemon, 321, 1); } -void nullsub_58(void) +void nullsub_58(Entity *pokemon) { } -void nullsub_59(void) +void nullsub_59(Entity *pokemon) { } @@ -483,7 +473,7 @@ void sub_8041B34(Entity *pokemon) sub_804151C(pokemon, 7, 1); } -void nullsub_60(void) +void nullsub_60(Entity *pokemon) { } @@ -492,7 +482,7 @@ void sub_8041B48(Entity *pokemon) sub_804151C(pokemon, 4, 0); } -void nullsub_61(void) +void nullsub_61(Entity *pokemon) { } @@ -510,11 +500,11 @@ void sub_8041B74(Entity *pokemon) sub_804151C(pokemon, 369, 0); } -void nullsub_63(void) +void nullsub_63(Entity *pokemon) { } -void nullsub_64(void) +void nullsub_64(Entity *pokemon) { } @@ -523,11 +513,11 @@ void sub_8041B90(Entity *pokemon) sub_804151C(pokemon, 428, 0); } -void nullsub_65(void) +void nullsub_65(Entity *pokemon) { } -void nullsub_66(void) +void nullsub_66(Entity *pokemon) { } @@ -536,7 +526,7 @@ void sub_8041BA8(Entity *pokemon) sub_804151C(pokemon, 4, 1); } -void nullsub_67(void) +void nullsub_67(Entity *pokemon) { } @@ -545,7 +535,7 @@ void sub_8041BBC(Entity *pokemon) sub_804151C(pokemon, 424, 1); } -void nullsub_68(void) +void nullsub_68(Entity *pokemon) { } @@ -578,7 +568,7 @@ void sub_8041C1C(Entity *pokemon) sub_804151C(pokemon, 423, 1); } -void nullsub_69(void) +void nullsub_69(Entity *pokemon, Entity *target) { } @@ -587,11 +577,11 @@ void sub_8041C34(Entity *pokemon) sub_804151C(pokemon, 0x4C, 1); } -void nullsub_70(void) +void nullsub_70(Entity *pokemon) { } -void nullsub_71(void) +void nullsub_71(Entity *pokemon) { } @@ -615,11 +605,11 @@ void sub_8041C7C(Entity *pokemon) sub_804151C(pokemon, 0x9D << 1, 1); } -void nullsub_72(void) +void nullsub_72(Entity *pokemon) { } -void nullsub_73(void) +void nullsub_73(Entity *pokemon) { } @@ -653,7 +643,7 @@ void sub_8041CEC(Entity *pokemon) sub_80421C0(pokemon, 0x19d); } -void nullsub_74(void) +void nullsub_74(Entity *pokemon) { } @@ -697,7 +687,7 @@ void sub_8041D48(Entity * pokemon) sub_80421C0(pokemon, 0x191); } -void nullsub_81(void) +void nullsub_81(Entity *pokemon) { } @@ -714,11 +704,11 @@ void sub_8041D84(Entity *pokemon) sub_80421C0(pokemon, 0x19f); } -void nullsub_82(void) +void nullsub_82(Entity *pokemon) { } -void nullsub_83(void) +void nullsub_83(Entity *pokemon) { } @@ -732,42 +722,41 @@ void sub_8041DB0(Entity *pokemon) sub_804151C(pokemon, 0x30, 1); } -void nullsub_84(void) +void nullsub_84(Entity *pokemon) { } -void nullsub_85(void) +void nullsub_85(Entity *pokemon) { } -void nullsub_204(void) +UNUSED static void nullsub_204(void) { } -void nullsub_86(void) +void nullsub_86(Entity *pokemon) { } -void nullsub_87(void) +void nullsub_87(Entity *pokemon) { } -void nullsub_88(void) +void nullsub_88(Entity *pokemon) { } -void sub_8041DD8(Entity *pokemon, s16 r1) +void sub_8041DD8(Entity *pokemon, s32 r1) { - u32 temp; - temp = r1; + s32 temp = (s16) r1; - if(MonsterIsType(pokemon, TYPE_GHOST) != 0) + if (MonsterIsType(pokemon, TYPE_GHOST)) sub_804151C(pokemon, temp, 1); else sub_804151C(pokemon, TYPE_GHOST, 1); } -void nullsub_89(void) +void nullsub_89(Entity *pokemon) { } @@ -847,7 +836,7 @@ void sub_8041F08(Entity *pokemon) sub_8041550(pokemon, 0x15, 1, 3, 2, 0); } -void nullsub_90(void) +void nullsub_90(Entity *pokemon) { } @@ -983,16 +972,16 @@ void sub_8042080(Entity *pokemon, u32 r1) } } -void sub_80420A0(Entity *pokemon, u32 r1) +void sub_80420A0(Entity *pokemon) { sub_804151C(pokemon, 0x143, 1); } -void nullsub_91(void) +void nullsub_91(Entity *pokemon) { } -void sub_80420B8(Entity *pokemon, u32 r1) +void sub_80420B8(Entity *pokemon) { sub_804151C(pokemon, 0x19, 1); } @@ -1038,7 +1027,7 @@ void sub_8042148(Entity *pokemon) sub_804151C(pokemon, 0x9F << 1, 1); } -void nullsub_93() +void nullsub_93(DungeonPos *pos) { } @@ -1299,7 +1288,7 @@ void sub_80426C8(u32 a0, u32 a1) sub_8052210(1); } -void sub_8042730(Entity *a0, void *unused) +void sub_8042730(Entity *a0, Entity *unused) { s32 i; @@ -1513,7 +1502,7 @@ void sub_8042A74(Entity *r0) sub_804151C(r0, 0x18, 1); } -void sub_8042A84(s16 param_1, Entity *entity, u32 param_3) +static void sub_8042A84(s16 param_1, Entity *entity, u32 param_3) { s32 iVar3; s32 r6; @@ -1549,7 +1538,7 @@ void sub_8042B20(Entity *entity) static const unkStruct_2039DB0 gUnknown_80F683C = DEFAULT_UNK_2039DB0_MASKS; -void sub_8042B34(s32 a0, s32 a1, s32 a2) +static void sub_8042B34(s32 a0, s32 a1, s32 a2) { unkStruct_80416E0 spStruct; s32 i; @@ -1593,7 +1582,7 @@ void sub_8042B34(s32 a0, s32 a1, s32 a2) } } -bool8 sub_8042CC0(void) +static bool8 sub_8042CC0(void) { s32 i; bool8 ret = FALSE; @@ -1623,7 +1612,7 @@ bool8 sub_8042CC0(void) return ret; } -void sub_8042D7C(void) +static void sub_8042D7C(void) { s32 i; diff --git a/src/dungeon_action_execution.c b/src/dungeon_action_execution.c index 4af3c08ac..783f5d583 100644 --- a/src/dungeon_action_execution.c +++ b/src/dungeon_action_execution.c @@ -4,8 +4,7 @@ #include "dungeon_ai_leader.h" #include "dungeon_move_util.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "code_8066D04.h" #include "dungeon_message.h" #include "constants/dungeon_action.h" @@ -42,7 +41,6 @@ #include "dungeon_entity_movement.h" void sub_8075BA4(Entity *param_1, u8 param_2); -void sub_804178C(u8 param_1); void nullsub_95(Entity *); extern void sub_80671A0(Entity *); extern void sub_8067110(Entity *); diff --git a/src/dungeon_cutscene_articuno.c b/src/dungeon_cutscene_articuno.c index b92cc2f16..15457e540 100644 --- a/src/dungeon_cutscene_articuno.c +++ b/src/dungeon_cutscene_articuno.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -33,10 +32,8 @@ #include "dungeon_leveling.h" #include "weather.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void sub_8088484(Entity *param_1); diff --git a/src/dungeon_cutscene_celebi.c b/src/dungeon_cutscene_celebi.c index fedf1b789..e42c9fb75 100644 --- a/src/dungeon_cutscene_celebi.c +++ b/src/dungeon_cutscene_celebi.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -34,10 +33,8 @@ #include "weather.h" #include "dungeon_mon_recruit.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void sub_808C8E0(Entity *entity); diff --git a/src/dungeon_cutscene_deoxys.c b/src/dungeon_cutscene_deoxys.c index 51ea1f388..0c4f9aec0 100644 --- a/src/dungeon_cutscene_deoxys.c +++ b/src/dungeon_cutscene_deoxys.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -32,10 +31,8 @@ #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void DeoxysScreenFlash(void); diff --git a/src/dungeon_cutscene_empty_summit.c b/src/dungeon_cutscene_empty_summit.c index e3b045757..608fe33b2 100644 --- a/src/dungeon_cutscene_empty_summit.c +++ b/src/dungeon_cutscene_empty_summit.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" diff --git a/src/dungeon_cutscene_entei.c b/src/dungeon_cutscene_entei.c index b7f492e4a..7319d4832 100644 --- a/src/dungeon_cutscene_entei.c +++ b/src/dungeon_cutscene_entei.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -31,10 +30,8 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void EnteiScreenFlash(void); diff --git a/src/dungeon_cutscene_groudon.c b/src/dungeon_cutscene_groudon.c index e4b42b145..d9dbaad8c 100644 --- a/src/dungeon_cutscene_groudon.c +++ b/src/dungeon_cutscene_groudon.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -33,10 +32,8 @@ #include "dungeon_tilemap.h" #include "dungeon_leveling.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void SceneGroudonMovement(Entity * groudonEntity); diff --git a/src/dungeon_cutscene_hooh.c b/src/dungeon_cutscene_hooh.c index f5fd46432..1a590bf58 100644 --- a/src/dungeon_cutscene_hooh.c +++ b/src/dungeon_cutscene_hooh.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -31,10 +30,8 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void HoOhDropInEffect(Entity * param_1); diff --git a/src/dungeon_cutscene_jirachi.c b/src/dungeon_cutscene_jirachi.c index 325b041ae..9c3d5635a 100644 --- a/src/dungeon_cutscene_jirachi.c +++ b/src/dungeon_cutscene_jirachi.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -33,11 +32,10 @@ #include "dungeon_floor_spawns.h" #include "dungeon_map.h" #include "dungeon_mon_spawn.h" +#include "dungeon_8041AD0.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void sub_808B50C(void); diff --git a/src/dungeon_cutscene_kyogre.c b/src/dungeon_cutscene_kyogre.c index 7650ff57c..6c7a1803e 100644 --- a/src/dungeon_cutscene_kyogre.c +++ b/src/dungeon_cutscene_kyogre.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -33,10 +32,8 @@ #include "dungeon_tilemap.h" #include "dungeon_map.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void nullsub_99(void); diff --git a/src/dungeon_cutscene_latios.c b/src/dungeon_cutscene_latios.c index 5271267dd..efd61c979 100644 --- a/src/dungeon_cutscene_latios.c +++ b/src/dungeon_cutscene_latios.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -32,10 +31,8 @@ #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void LatiosScreenFlash(void); diff --git a/src/dungeon_cutscene_lugia.c b/src/dungeon_cutscene_lugia.c index ed2eb0de0..cdf7e36d7 100644 --- a/src/dungeon_cutscene_lugia.c +++ b/src/dungeon_cutscene_lugia.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -32,10 +31,8 @@ #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void LugiaScreenFlash(void); diff --git a/src/dungeon_cutscene_magma_cavern.c b/src/dungeon_cutscene_magma_cavern.c index d833d7fbf..abb7ec563 100644 --- a/src/dungeon_cutscene_magma_cavern.c +++ b/src/dungeon_cutscene_magma_cavern.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -31,10 +30,8 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void sub_80891F0(void); diff --git a/src/dungeon_cutscene_mankey.c b/src/dungeon_cutscene_mankey.c index f46348e32..066949a58 100644 --- a/src/dungeon_cutscene_mankey.c +++ b/src/dungeon_cutscene_mankey.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -31,10 +30,8 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void sub_80898F8(Entity *r0); diff --git a/src/dungeon_cutscene_meanies.c b/src/dungeon_cutscene_meanies.c index fd23e9e2e..16423a3ea 100644 --- a/src/dungeon_cutscene_meanies.c +++ b/src/dungeon_cutscene_meanies.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -30,10 +29,8 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void sub_8087144(void); diff --git a/src/dungeon_cutscene_medicham.c b/src/dungeon_cutscene_medicham.c index 9a77a34e4..2949d3b9c 100644 --- a/src/dungeon_cutscene_medicham.c +++ b/src/dungeon_cutscene_medicham.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -31,10 +30,8 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); void sub_808C9C4(void) diff --git a/src/dungeon_cutscene_mewtwo.c b/src/dungeon_cutscene_mewtwo.c index 56e19b2dc..833f0d33c 100644 --- a/src/dungeon_cutscene_mewtwo.c +++ b/src/dungeon_cutscene_mewtwo.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -31,10 +30,8 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void MewtwoDropInEffect(Entity *mewtwoEntity); diff --git a/src/dungeon_cutscene_moltres.c b/src/dungeon_cutscene_moltres.c index 86a7d4696..8e8133c24 100644 --- a/src/dungeon_cutscene_moltres.c +++ b/src/dungeon_cutscene_moltres.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -33,10 +32,8 @@ #include "dungeon_tilemap.h" #include "dungeon_leveling.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void MoltresDropInEffect(Entity * moltresEntity); diff --git a/src/dungeon_cutscene_raikou.c b/src/dungeon_cutscene_raikou.c index 484fee834..95b30d259 100644 --- a/src/dungeon_cutscene_raikou.c +++ b/src/dungeon_cutscene_raikou.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -32,10 +31,8 @@ #include "dungeon_boss_dialogue.h" #include "weather.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void RaikouScreenFlash(void); diff --git a/src/dungeon_cutscene_rayquaza.c b/src/dungeon_cutscene_rayquaza.c index ccf29d5de..7d98bbd52 100644 --- a/src/dungeon_cutscene_rayquaza.c +++ b/src/dungeon_cutscene_rayquaza.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -32,10 +31,8 @@ #include "dungeon_boss_dialogue.h" #include "dungeon_leveling.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void RayquazaDropInEffect(Entity *rayquazaEntity); diff --git a/src/dungeon_cutscene_regis.c b/src/dungeon_cutscene_regis.c index 13a765247..1aff0cf65 100644 --- a/src/dungeon_cutscene_regis.c +++ b/src/dungeon_cutscene_regis.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -32,10 +31,8 @@ #include "dungeon_boss_dialogue.h" #include "dungeon_map.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void sub_808B1CC(u8 itemID); diff --git a/src/dungeon_cutscene_skarmory.c b/src/dungeon_cutscene_skarmory.c index b2f1a4fbe..3cf446119 100644 --- a/src/dungeon_cutscene_skarmory.c +++ b/src/dungeon_cutscene_skarmory.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -31,10 +30,8 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void SkarmoryEntry(Entity * skarmoryEntity); diff --git a/src/dungeon_cutscene_smeargle.c b/src/dungeon_cutscene_smeargle.c index 55bfbf782..707f74367 100644 --- a/src/dungeon_cutscene_smeargle.c +++ b/src/dungeon_cutscene_smeargle.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -31,10 +30,8 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); void DummyFightDialogue(void) diff --git a/src/dungeon_cutscene_suicune.c b/src/dungeon_cutscene_suicune.c index b2aa21aa6..1931c8c97 100644 --- a/src/dungeon_cutscene_suicune.c +++ b/src/dungeon_cutscene_suicune.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -31,10 +30,8 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); static void sub_808A528(Entity * param_1); diff --git a/src/dungeon_cutscene_zapdos.c b/src/dungeon_cutscene_zapdos.c index 0e74286b5..9f4d87768 100644 --- a/src/dungeon_cutscene_zapdos.c +++ b/src/dungeon_cutscene_zapdos.c @@ -3,8 +3,7 @@ #include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "constants/bg_music.h" #include "constants/direction.h" @@ -32,10 +31,8 @@ #include "dungeon_boss_dialogue.h" #include "dungeon_leveling.h" -extern void sub_8042B0C(Entity *); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void sub_8041888(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); struct Zapdos1 diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index 234dacab7..ec95af870 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -31,8 +31,7 @@ #include "constants/direction.h" #include "constants/dungeon.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "code_805D8C8.h" #include "dungeon_map_access.h" #include "dungeon_data.h" @@ -49,28 +48,12 @@ #include "move_orb_effects_2.h" #include "move_orb_effects_5.h" -extern void sub_8041B18(Entity *pokemon); -extern void sub_8041B90(Entity *pokemon); -extern void sub_8041D00(Entity *pokemon, Entity *target); -extern void sub_8042238(Entity *pokemon, Entity *target); extern void sub_803ED30(s32, Entity *r0, u8, s32); extern bool8 sub_806A458(Entity *); extern bool8 sub_806A58C(s16 a0); -extern void sub_8042148(Entity *pokemon); -extern void sub_8042A24(Entity *r0); extern void sub_806A390(Entity *r0); extern void sub_800DBBC(void); -extern void EntityUpdateStatusSprites(Entity *); extern void PointCameraToMonster(Entity *); -extern void sub_8041B74(Entity *pokemon); -extern void sub_8041B5C(Entity *pokemon); -extern void sub_8042940(Entity *r0); -extern void sub_80428B0(Entity *r0); -extern void sub_80428C4(Entity *r0); -extern void sub_80428D8(Entity *); -extern void sub_8042978(Entity *); -extern void sub_804298C(Entity *); -extern void sub_80428EC(Entity *); static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *r5, bool32 isFalseSwipe, bool32 giveExp, s16 dungeonExitReason_, s32 arg8); static bool8 sub_806E100(s48_16 *param_1, Entity *pokemon, Entity *target, u8 type, DamageStruct *dmgStruct); diff --git a/src/dungeon_entity_movement.c b/src/dungeon_entity_movement.c index f309891ba..cda0ccb77 100644 --- a/src/dungeon_entity_movement.c +++ b/src/dungeon_entity_movement.c @@ -52,6 +52,7 @@ #include "dungeon_action_execution.h" #include "dungeon_tilemap.h" #include "run_dungeon.h" +#include "dungeon_8041AD0.h" static EWRAM_DATA s32 sSpeedMultiplier = 0; @@ -59,7 +60,6 @@ static void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr); static void nullsub_97(Entity *entity); static void TryInteractWithTile(Entity *entity); -extern void sub_8041888(u32); extern void sub_8073D14(Entity *entity); static inline void SetSpeedMultiplier(void) diff --git a/src/dungeon_generation.c b/src/dungeon_generation.c index bc347e912..750e3dc01 100644 --- a/src/dungeon_generation.c +++ b/src/dungeon_generation.c @@ -24,7 +24,6 @@ extern s32 sub_803DA20(s16 species); extern void sub_8049840(void); -extern void sub_80429FC(DungeonPos *r0); extern void sub_80498A8(s32, s32); extern void sub_8049B8C(void); diff --git a/src/dungeon_generation_fixed.c b/src/dungeon_generation_fixed.c index acb4a85f5..a555e1b99 100644 --- a/src/dungeon_generation_fixed.c +++ b/src/dungeon_generation_fixed.c @@ -14,8 +14,7 @@ #include "constants/trap.h" #include "constants/item.h" #include "dungeon_mon_spawn.h" - -extern void sub_80429FC(DungeonPos *r0); +#include "dungeon_8041AD0.h" static bool8 sub_805210C(u8 itemId); diff --git a/src/dungeon_item_action.c b/src/dungeon_item_action.c index e8f8d7d55..f26f05c61 100644 --- a/src/dungeon_item_action.c +++ b/src/dungeon_item_action.c @@ -1,7 +1,7 @@ #include "global.h" #include "globaldata.h" #include "dungeon_item_action.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "dungeon_message.h" #include "dungeon_random.h" #include "constants/dungeon_action.h" @@ -41,10 +41,6 @@ #include "move_orb_effects_2.h" #include "move_orb_effects_5.h" -extern void sub_804245C(Entity *, Item *); -extern s32 sub_8042520(Entity *); -extern void sub_8042390(Entity *, Item *); - static void StunSeedItemAction(Entity *, Entity *); static void MaxElixirAction(Entity *, Entity *); static void ProteinItemAction(Entity *, Entity *); diff --git a/src/dungeon_items.c b/src/dungeon_items.c index 4121ba661..ce4094bba 100644 --- a/src/dungeon_items.c +++ b/src/dungeon_items.c @@ -1,7 +1,7 @@ #include "global.h" #include "globaldata.h" #include "dungeon_items.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "dungeon_range.h" #include "dungeon_random.h" #include "dungeon_util.h" @@ -28,10 +28,6 @@ #include "dungeon_vram.h" #include "sprite.h" -extern void sub_80416E0(PixelPos *r0, u32, bool8); -extern void sub_804178C(u32); -extern void sub_804219C(PixelPos *pos); - static void MusicBoxCreation(void); static u8 sub_8046D70(void); diff --git a/src/dungeon_jobs.c b/src/dungeon_jobs.c index 5ee8e153e..d3c0054ca 100644 --- a/src/dungeon_jobs.c +++ b/src/dungeon_jobs.c @@ -9,6 +9,7 @@ #include "dungeon_range.h" #include "string_format.h" #include "code_80958E8.h" +#include "dungeon_8041AD0.h" #include "mailbox.h" #include "items.h" #include "pokemon.h" @@ -16,9 +17,6 @@ #include "constants/dungeon.h" #include "constants/dungeon_exit.h" -extern void sub_8042A34(DungeonPos *r0); -extern void sub_804178C(u32); - void sub_80842F0(void) { s32 i; diff --git a/src/dungeon_kecleon_shop.c b/src/dungeon_kecleon_shop.c index a73274376..18556a4e3 100644 --- a/src/dungeon_kecleon_shop.c +++ b/src/dungeon_kecleon_shop.c @@ -2,7 +2,6 @@ #include "globaldata.h" #include "dungeon_kecleon_shop.h" #include "weather.h" -#include "code_804267C.h" #include "dungeon_vram.h" #include "dungeon_info.h" #include "dungeon_config.h" diff --git a/src/dungeon_leveling.c b/src/dungeon_leveling.c index 6a657def0..359cda84f 100644 --- a/src/dungeon_leveling.c +++ b/src/dungeon_leveling.c @@ -5,7 +5,7 @@ #include "dungeon_config.h" #include "dungeon_range.h" #include "dungeon_message.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "constants/dungeon.h" #include "dungeon_map_access.h" #include "dungeon_misc.h" diff --git a/src/dungeon_logic.c b/src/dungeon_logic.c index 6dd7892c4..a5dfd342e 100644 --- a/src/dungeon_logic.c +++ b/src/dungeon_logic.c @@ -30,12 +30,10 @@ #include "dungeon_config.h" #include "dungeon_pos_data.h" #include "dungeon_data.h" +#include "dungeon_8041AD0.h" // This file deals with things like controlling movement, walkable tiles, ai targeting, status checks and pokemon attributes. -extern void sub_80429B4(Entity *r0); -extern void ShowVisualFlags(Entity *r0); - EWRAM_DATA u8 gWalkableTileToCrossableTerrain[8] = {0}; u8 GetCrossableTerrain(s16 species) diff --git a/src/dungeon_main.c b/src/dungeon_main.c index 6fa93368f..2c545c364 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -60,6 +60,7 @@ #include "dungeon_item_action.h" #include "dungeon_strings.h" #include "dungeon_entity_movement.h" +#include "dungeon_8041AD0.h" extern void HandleUnsetItemAction(Entity *,bool8); extern void TryTriggerTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); @@ -75,8 +76,6 @@ bool8 sub_8070F80(Entity * pokemon, s32 direction); void sub_806752C(ActionContainer *a0); void sub_8067768(ActionContainer *a0); extern bool8 sub_8071A8C(Entity *pokemon); -extern void sub_8041AD0(Entity *pokemon); -extern void sub_8041AE0(Entity *pokemon); static EWRAM_DATA bool8 sInDiagonalMode = 0; static EWRAM_DATA bool8 sInRotateMode = 0; diff --git a/src/dungeon_map_access.c b/src/dungeon_map_access.c index b14216bc9..fea8faaee 100644 --- a/src/dungeon_map_access.c +++ b/src/dungeon_map_access.c @@ -19,8 +19,7 @@ #include "dungeon_mon_sprite_render.h" #include "dungeon_pos_data.h" #include "dungeon_data.h" - -extern void sub_8042A14(DungeonPos *); +#include "dungeon_8041AD0.h" EWRAM_DATA OpenedFile *gDungeonPaletteFile = {0}; EWRAM_DATA unkStruct_202EE8C gUnknown_202EE8C[32] = {0}; diff --git a/src/dungeon_menu_items.c b/src/dungeon_menu_items.c index eeb8d22c5..34640c978 100644 --- a/src/dungeon_menu_items.c +++ b/src/dungeon_menu_items.c @@ -29,9 +29,7 @@ #include "code_801B3C0.h" #include "dungeon_engine.h" #include "dungeon_strings.h" - -extern void sub_8041AD0(Entity *pokemon); -extern void sub_8041AE0(Entity *pokemon); +#include "dungeon_8041AD0.h" static EWRAM_DATA ActionParameter sUnknownActionUnk4 = {0}; static EWRAM_DATA s32 sUnknown_202F240 = 0; diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index c993f1c79..90742c275 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -53,30 +53,22 @@ #include "dungeon_monster_house.h" #include "move_orb_effects_2.h" #include "move_orb_effects_5.h" +#include "dungeon_recruit_release_menu.h" +#include "dungeon_8041AD0.h" static void EnsureCastformLoaded(void); static void EnsureDeoxysLoaded(void); extern bool8 sub_806A58C(s16 r0); -extern void sub_8067A80(u8 a0, s32 a1, s32 a2, Pokemon **a3); extern bool8 sub_8070F80(Entity * pokemon, s32 direction); extern s32 sub_806A4DC(EntityInfo *info); -extern void sub_8042900(Entity *r0); -extern void sub_8042968(Entity *r0); -extern void sub_8041BBC(Entity *r0); -extern void sub_804178C(u32); -extern void sub_8042B20(Entity *entity); -extern void sub_8042B0C(Entity *entity); extern s16 sub_803D970(u32); extern bool8 sub_80860A8(u8 id); extern u8 sub_803D73C(s32 a0); extern void DeletePokemonDungeonSprite(s32 id); -extern void sub_80429E8(Entity *r0); extern s32 sub_803DA20(s32 param_1); -extern void sub_8042EC8(Entity *a0, s32 a1); extern Entity *sub_804550C(s16 a); extern Entity *sub_80453AC(s16 id); -extern void EntityUpdateStatusSprites(Entity *); extern u8 gUnknown_202F32C; @@ -394,7 +386,7 @@ void sub_8068BDC(bool8 a0) WriteFriendAreaName(gFormatBuffer_Items[0], friendAreaId, FALSE); DisplayDungeonMessage(NULL, gUnknown_80FE1A4, TRUE); // The Friend Area is full, a friend must be released. while (1) { - sub_8067A80(friendAreaId, j - areaCapacity.maxPokemon, j, monPointers); + ShowRecruitReleaseMenu(friendAreaId, j - areaCapacity.maxPokemon, j, monPointers); for (id = 0; id < j; id++) { Pokemon *monPtr = monPointers[id]; if (PokemonExists(monPtr) && (monPtr->flags & POKEMON_FLAG_x8000)) { diff --git a/src/dungeon_mon_spawn.c b/src/dungeon_mon_spawn.c index ad1134400..2308e5e07 100644 --- a/src/dungeon_mon_spawn.c +++ b/src/dungeon_mon_spawn.c @@ -36,19 +36,12 @@ #include "dungeon_tilemap.h" #include "dungeon_engine.h" #include "dungeon_leveling.h" +#include "dungeon_8041AD0.h" -extern void sub_8042900(Entity *r0); -extern void sub_8042968(Entity *r0); -void sub_8041BBC(Entity *r0); -extern void sub_804178C(u32); -extern void sub_8042B20(Entity *entity); -extern void sub_8042B0C(Entity *entity); extern bool8 sub_80860A8(u8 id); extern u8 gUnknown_202F32C; -extern void sub_80429E8(Entity *r0); extern Entity *sub_804550C(s16 a); extern Entity *sub_80453AC(s16 id); -extern void EntityUpdateStatusSprites(Entity *); static s32 CalcSpeciesHPAtLevel(s32 species, s32 level); static s32 CalcSpeciesAtkAtLevel(s32 species, s32 level, s32 categoryIndex); diff --git a/src/dungeon_mon_sprite_render.c b/src/dungeon_mon_sprite_render.c index 689be3528..9a182e0e3 100644 --- a/src/dungeon_mon_sprite_render.c +++ b/src/dungeon_mon_sprite_render.c @@ -9,8 +9,7 @@ #include "constants/iq_skill.h" #include "structs/str_dungeon.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "code_805D8C8.h" #include "dungeon_config.h" #include "dungeon_items.h" @@ -32,8 +31,6 @@ #include "sprite.h" #include "random.h" -extern void sub_8042EC8(Entity *a0, s32 a1); - static const u8 gUnknown_8106EC8[][13] = { {0, 1, 7, 7, 7, 5, 6, 7, 7, 7, 7, 7, 7}, {7, 7, 7, 7, 7, 5, 6, 7, 7, 7, 7, 7, 7}, diff --git a/src/dungeon_monster_house.c b/src/dungeon_monster_house.c index 00466dc82..c9958bc75 100644 --- a/src/dungeon_monster_house.c +++ b/src/dungeon_monster_house.c @@ -29,8 +29,7 @@ #include "dungeon_misc.h" #include "dungeon_mon_spawn.h" #include "move_orb_effects_5.h" - -extern void sub_804178C(u32); +#include "dungeon_8041AD0.h" void TryWakeSleepingWildPokemon(void) { diff --git a/src/dungeon_move.c b/src/dungeon_move.c index 6be25926a..e1cb56fc0 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -11,7 +11,7 @@ #include "effect_data.h" #include "dungeon_vram.h" #include "dungeon_tilemap.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "dungeon_logic.h" @@ -44,22 +44,14 @@ #include "dungeon_engine.h" #include "warp_target.h" -extern void sub_80429C8(Entity *r0); extern s16 GetDungeonExitReasonFromMoveOrItem(Move *move, s32 itemID); -extern void sub_8042238(Entity *pokemon, Entity *target); extern void sub_806A1E8(Entity *pokemon); -extern void sub_804178C(u32); -extern void sub_80428A0(Entity *r0); extern bool8 sub_8040BB0(Entity *entity, Move *move, bool8); extern void sub_8040DA0(Entity *entity, Move *move); extern u16 GetEffectiveMoveId(u16 moveId, u8 weather, u8 hasSpecialEffect); extern void sub_800EF10(u16 r0); extern void sub_800E3AC(s32 a0, DungeonPos *pos, s32 a2); extern void sub_8041168(Entity *entity, Entity *entity2, Move *,DungeonPos *); -extern void sub_8042930(Entity *r0); -extern void sub_8041B48(Entity *pokemon); -extern void sub_8041BA8(Entity *pokemon); -extern void sub_8042950(Entity *r0); static s32 TryHitTarget(Entity *attacker, Entity *target, Move *move, struct DamageStruct *dmgStruct, s16 unk_); diff --git a/src/dungeon_move_util.c b/src/dungeon_move_util.c index f20ab83be..36d9f37eb 100644 --- a/src/dungeon_move_util.c +++ b/src/dungeon_move_util.c @@ -11,7 +11,7 @@ #include "effect_sub_1.h" #include "dungeon_vram.h" #include "dungeon_tilemap.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "dungeon_random.h" #include "dungeon_logic.h" @@ -44,10 +44,7 @@ #include "dungeon_damage.h" #include "dungeon_leveling.h" -extern void sub_80429C8(Entity *r0); extern void sub_806A1E8(Entity *pokemon); -extern void sub_804178C(u32); -extern void sub_80428A0(Entity *r0); extern bool8 sub_8040BB0(Entity *entity, Move *move, bool8); extern void sub_8040DA0(Entity *entity, Move *move); extern u16 GetEffectiveMoveId(u16 moveId, u8 weather, u8 hasSpecialEffect); diff --git a/src/dungeon_8067A80.c b/src/dungeon_recruit_release_menu.c similarity index 88% rename from src/dungeon_8067A80.c rename to src/dungeon_recruit_release_menu.c index d9e1907e1..ff7e93141 100644 --- a/src/dungeon_8067A80.c +++ b/src/dungeon_recruit_release_menu.c @@ -5,7 +5,7 @@ #include "constants/move_id.h" #include "dungeon_vram.h" #include "dungeon_tilemap.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "dungeon_action.h" #include "code_8066D04.h" #include "dungeon_mon_sprite_render.h" @@ -37,23 +37,22 @@ #include "dungeon_submenu.h" #include "dungeon_engine.h" -extern void sub_80684C4(void); -extern void sub_8068344(void); -void sub_8068310(s32 n, Pokemon **monPtrs); -void sub_8067F00(u8 a0, Pokemon **a1, s32 a2, s32 a3, s32 a4); -void sub_806806C(Pokemon *a0); - - -static EWRAM_DATA WindowHeader gUnknown_202F308 = {0}; +static EWRAM_DATA WindowHeader sReleaseMenuWinHeader = {0}; static EWRAM_DATA s32 gUnknown_202F30C = 0; static EWRAM_DATA s32 gUnknown_202F310 = 0; +static void sub_8067F00(u8 a0, Pokemon **a1, s32 a2_, s32 a3, s32 a4); +static void ShowPokemonSummary(Pokemon *a0); +static void sub_8068310(s32 n, Pokemon **monPtrs); +static void ShowUpArrowSprite(void); +static void ShowDownArrowSprite(void); + // It's likely a struct only used in Blue version. Touchpad maybe? static const u8 sTouchScreenArrowPressData[] = { 0x01, 0, 0x38, 0, 0, 0, 0x18, 0, 0x18, 0, 0, 0, 0x02, 0, 0x38, 0, 0x68, 0, 0x18, 0, 0x18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static const WindowTemplates gUnknown_8106DC8 = { +static const WindowTemplates sReleaseMenuWindowTemplates = { .id = { [0] = { @@ -64,7 +63,7 @@ static const WindowTemplates gUnknown_8106DC8 = { .height = 0x0E, .unk10 = 0x12, .unk12 = 0x02, - .header = &gUnknown_202F308 + .header = &sReleaseMenuWinHeader }, [1] = { @@ -82,11 +81,11 @@ static const WindowTemplates gUnknown_8106DC8 = { } }; -void sub_8067A80(u8 a0, s32 a1, s32 a2, Pokemon **a3) +void ShowRecruitReleaseMenu(u8 a0, s32 a1, s32 a2, Pokemon **a3) { s32 i; s32 r10; - WindowTemplates spTxtStruct = gUnknown_8106DC8; + WindowTemplates winTemplates = sReleaseMenuWindowTemplates; gUnknown_202F30C = 0; r10 = 0; @@ -101,14 +100,14 @@ void sub_8067A80(u8 a0, s32 a1, s32 a2, Pokemon **a3) while (1) { s32 r7 = 0, r5 = 0; - gUnknown_202F308.count = 1; - gUnknown_202F308.currId = 0; - gUnknown_202F308.width = 0xE; - gUnknown_202F308.f3 = 0; + sReleaseMenuWinHeader.count = 1; + sReleaseMenuWinHeader.currId = 0; + sReleaseMenuWinHeader.width = 0xE; + sReleaseMenuWinHeader.f3 = 0; ASM_MATCH_TRICK(r7); - DungeonShowWindows(&spTxtStruct, 1); + DungeonShowWindows(&winTemplates, 1); sub_8067F00(a0, a3, gUnknown_202F30C, a2, a1); gDungeonMenu.currPageEntries = min(a2, 8); gDungeonMenu.menuIndex = r10; @@ -131,11 +130,11 @@ void sub_8067A80(u8 a0, s32 a1, s32 a2, Pokemon **a3) r7 = 0; if (a2 - gUnknown_202F30C > 8) { r5 = 1; - sub_80684C4(); + ShowDownArrowSprite(); } if (gUnknown_202F30C != 0) { r7 = 1; - sub_8068344(); + ShowUpArrowSprite(); } touchScreenArrow = GetTouchScreenArrowPress(0, sTouchScreenArrowPressData); @@ -243,7 +242,7 @@ void sub_8067A80(u8 a0, s32 a1, s32 a2, Pokemon **a3) } else if (r7 == 3) { r10 = gDungeonMenu.menuIndex; - sub_806806C(a3[gUnknown_202F30C + r10]); + ShowPokemonSummary(a3[gUnknown_202F30C + r10]); continue; } else { @@ -270,7 +269,7 @@ void sub_8067A80(u8 a0, s32 a1, s32 a2, Pokemon **a3) } sub_8045064(); - CreateDungeonMenuSubWindow(&spTxtStruct.id[0], 0x15); + CreateDungeonMenuSubWindow(&winTemplates.id[0], 0x15); while (1) { AddMenuCursorSprite(&gDungeonMenu); @@ -312,7 +311,7 @@ void sub_8067A80(u8 a0, s32 a1, s32 a2, Pokemon **a3) sub_8068310(a2, a3); } else { - sub_806806C(a3[arrId]); + ShowPokemonSummary(a3[arrId]); } } continue; @@ -321,7 +320,7 @@ void sub_8067A80(u8 a0, s32 a1, s32 a2, Pokemon **a3) } } -void sub_8067F00(u8 a0, Pokemon **a1, s32 a2_, s32 a3, s32 a4) +static void sub_8067F00(u8 a0, Pokemon **a1, s32 a2_, s32 a3, s32 a4) { s32 i, y; s32 a2; @@ -375,24 +374,24 @@ void sub_8067F00(u8 a0, Pokemon **a1, s32 a2_, s32 a3, s32 a4) sub_80073E0(1); } -void sub_806806C(Pokemon *a0) +static void ShowPokemonSummary(Pokemon *a0) { struct MonSummaryInfo unkStruct; struct UnkInfoTabStruct var_C8; - WindowTemplates spTxtStruct = {0}; + WindowTemplates winTemplates = {0}; s32 r7; - spTxtStruct.id[0].type = WINDOW_TYPE_WITH_HEADER; - spTxtStruct.id[0].pos.x = 2; - spTxtStruct.id[0].pos.y = 2; - spTxtStruct.id[0].width = 0x12; - spTxtStruct.id[0].height = 0xE; - spTxtStruct.id[0].unk10 = 0x12; - spTxtStruct.id[0].unk12 = 2; - spTxtStruct.id[0].header = &gUnknown_202F308; - spTxtStruct.id[1].type = WINDOW_TYPE_NORMAL; - spTxtStruct.id[2].type = WINDOW_TYPE_NORMAL; - spTxtStruct.id[3].type = WINDOW_TYPE_NORMAL; + winTemplates.id[0].type = WINDOW_TYPE_WITH_HEADER; + winTemplates.id[0].pos.x = 2; + winTemplates.id[0].pos.y = 2; + winTemplates.id[0].width = 0x12; + winTemplates.id[0].height = 0xE; + winTemplates.id[0].unk10 = 0x12; + winTemplates.id[0].unk12 = 2; + winTemplates.id[0].header = &sReleaseMenuWinHeader; + winTemplates.id[1].type = WINDOW_TYPE_NORMAL; + winTemplates.id[2].type = WINDOW_TYPE_NORMAL; + winTemplates.id[3].type = WINDOW_TYPE_NORMAL; r7 = 0; unkStruct.unk40 = 0; @@ -403,10 +402,10 @@ void sub_806806C(Pokemon *a0) bool32 loopBreak = FALSE; s32 spF8[4] = {2, 3, 4, 5}; - gUnknown_202F308.count = 4; - gUnknown_202F308.currId = r7; - gUnknown_202F308.width = 10; - gUnknown_202F308.f3 = 0; + sReleaseMenuWinHeader.count = 4; + sReleaseMenuWinHeader.currId = r7; + sReleaseMenuWinHeader.width = 10; + sReleaseMenuWinHeader.f3 = 0; gDungeonMenu.currPage = r7; gDungeonMenu.pagesCount = 4; @@ -419,7 +418,7 @@ void sub_806806C(Pokemon *a0) gDungeonMenu.windowId = 0; ResetTouchScreenMenuInput(&gDungeonMenu.touchScreen); - DungeonShowWindows(&spTxtStruct, 1); + DungeonShowWindows(&winTemplates, 1); SetMonSummaryInfo(&unkStruct, a0, gDungeon->unk644.unk16); ShowPokemonSummaryWindow(spF8[r7], r7, &unkStruct, &var_C8, 0); @@ -432,10 +431,10 @@ void sub_806806C(Pokemon *a0) AddMenuCursorSprite(&gDungeonMenu); if (spF8[r7] == 4) { if (var_C8.unk0[8] != 0) { - sub_80684C4(); + ShowDownArrowSprite(); } if (unkStruct.unk40 != 0) { - sub_8068344(); + ShowUpArrowSprite(); } } @@ -506,7 +505,7 @@ void sub_806806C(Pokemon *a0) sub_803EAF0(0, NULL); } -void sub_8068310(s32 n, Pokemon **monPtrs) +static void sub_8068310(s32 n, Pokemon **monPtrs) { s32 i; s32 counter = 0; @@ -519,7 +518,8 @@ void sub_8068310(s32 n, Pokemon **monPtrs) gUnknown_202F310 = counter; } -void sub_8068344(void) +// Identical to the functions in dungeon_menu_team.c +static void ShowUpArrowSprite(void) { if ((gDungeonFramesCounter & 8) != 0) { Window *window = &gWindows[0]; @@ -542,8 +542,7 @@ void sub_8068344(void) } } -// The same as sub_80623B0 -void sub_80684C4(void) +static void ShowDownArrowSprite(void) { if ((gDungeonFramesCounter & 8) != 0) { Window *window = &gWindows[0]; diff --git a/src/dungeon_tilemap.c b/src/dungeon_tilemap.c index d29dde189..b547d42fd 100644 --- a/src/dungeon_tilemap.c +++ b/src/dungeon_tilemap.c @@ -32,8 +32,7 @@ #include "dungeon_strings.h" #include "run_dungeon.h" #include "effect_main.h" - -extern void sub_8041888(u8 param_1); +#include "dungeon_8041AD0.h" static void sub_803F38C(void); static void sub_803F7BC(void); diff --git a/src/dungeon_turn_effects.c b/src/dungeon_turn_effects.c index ac0766330..05aa73222 100644 --- a/src/dungeon_turn_effects.c +++ b/src/dungeon_turn_effects.c @@ -40,12 +40,11 @@ #include "move_orb_effects_1.h" #include "warp_target.h" #include "move_orb_effects_5.h" +#include "dungeon_8041AD0.h" +#include "dungeon_entity_movement.h" extern void sub_805229C(void); -extern void sub_80420B8(Entity *pokemon); -extern void sub_8041C4C(Entity *pokemon, u32 r1); extern void sub_805E804(void); -extern bool8 DisplayActions(Entity *a0); void ApplyEndOfTurnEffects(Entity *entity) { diff --git a/src/dungeon_util.c b/src/dungeon_util.c index de2d2dd67..b58b6bb3d 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -4,7 +4,7 @@ #include "structs/str_dungeon.h" #include "structs/str_traps.h" #include "structs/map.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "dungeon_mon_sprite_render.h" #include "dungeon_items.h" #include "dungeon_map_access.h" diff --git a/src/dungeon_wild_mon_spawn.c b/src/dungeon_wild_mon_spawn.c index e11b3902e..05e7dd674 100644 --- a/src/dungeon_wild_mon_spawn.c +++ b/src/dungeon_wild_mon_spawn.c @@ -5,7 +5,7 @@ #include "dungeon_config.h" #include "dungeon_range.h" #include "dungeon_message.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "constants/dungeon.h" #include "dungeon_map_access.h" #include "dungeon_random.h" @@ -19,8 +19,6 @@ #include "dungeon_misc.h" #include "dungeon_mon_spawn.h" -extern void sub_8042920(struct Entity *r0); - void TrySpawnWildMonster(void) { s32 i; diff --git a/src/dungeon_wind.c b/src/dungeon_wind.c index a5badc2c1..9f1aa6802 100644 --- a/src/dungeon_wind.c +++ b/src/dungeon_wind.c @@ -2,7 +2,6 @@ #include "globaldata.h" #include "dungeon_wind.h" #include "dungeon_misc.h" -#include "code_804267C.h" #include "dungeon_message.h" #include "constants/ability.h" #include "constants/dungeon_exit.h" @@ -21,6 +20,7 @@ #include "structs/str_dungeon.h" #include "dungeon_engine.h" #include "dungeon_entity_movement.h" +#include "dungeon_8041AD0.h" void UpdateWindTurns(void) { diff --git a/src/explosion.c b/src/explosion.c index 11dea4f4b..57b745eb8 100644 --- a/src/explosion.c +++ b/src/explosion.c @@ -19,7 +19,7 @@ #include "move_orb_effects_1.h" #include "moves.h" #include "move_util.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "weather.h" #include "dungeon_config.h" #include "dungeon_misc.h" @@ -28,9 +28,6 @@ #include "dungeon_engine.h" #include "dungeon_damage.h" -extern void sub_804216C(Entity *pokemon, Entity *target, u32 r2); -extern void sub_804218C(Entity *pokemon, Entity *target); - static EWRAM_INIT u32 gUnknown_203B444[3] = {0x28, 0x28, 0x50}; static const DungeonPos gUnknown_81070E8[] = { diff --git a/src/expose_trap.c b/src/expose_trap.c index 11d109495..ce6a3952d 100644 --- a/src/expose_trap.c +++ b/src/expose_trap.c @@ -18,7 +18,7 @@ #include "move_orb_effects_1.h" #include "moves.h" #include "move_util.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "weather.h" #include "dungeon_config.h" #include "dungeon_misc.h" diff --git a/src/hurl_orb.c b/src/hurl_orb.c index bffa24aed..7447ce24f 100644 --- a/src/hurl_orb.c +++ b/src/hurl_orb.c @@ -2,8 +2,7 @@ #include "globaldata.h" #include "hurl_orb.h" #include "dungeon_vram.h" -#include "code_8041AD0.h" -#include "code_804267C.h" +#include "dungeon_8041AD0.h" #include "code_805D8C8.h" #include "dungeon_mon_sprite_render.h" #include "constants/ability.h" diff --git a/src/move_orb_actions_5.c b/src/move_orb_actions_5.c index 06652b4b2..dc7b98fdb 100644 --- a/src/move_orb_actions_5.c +++ b/src/move_orb_actions_5.c @@ -17,9 +17,7 @@ #include "hurl_orb.h" #include "trap.h" #include "move_orb_effects_2.h" - -extern void sub_8042A54(DungeonPos *); -extern void sub_8042A64(DungeonPos *); +#include "dungeon_8041AD0.h" bool8 FillInOrbAction(Entity *pokemon,Entity *target, Move *move, s32 itemId) { diff --git a/src/move_orb_effects_1.c b/src/move_orb_effects_1.c index bdd5c34ed..35c20f035 100644 --- a/src/move_orb_effects_1.c +++ b/src/move_orb_effects_1.c @@ -32,40 +32,7 @@ #include "dungeon_vram.h" #include "dungeon_pos_data.h" #include "dungeon_data.h" - -extern void sub_80420A0(Entity *); -extern void sub_8041C58(Entity *r0); -extern void sub_8041F28(Entity *, s32); -extern void sub_8041F4C(Entity *, s32); -extern void sub_8041F70(Entity *, s32); -extern void sub_8041F94(Entity *, s32); -extern void sub_8041C08(Entity *); -extern void sub_8076CB4(s32); -extern void sub_8041F08(Entity *); -extern void sub_8041C7C(Entity *); -extern void sub_8041C6C(Entity *); -extern void sub_8041C34(Entity *); -extern void sub_8041EF8(Entity *); -extern void sub_8041EE8(Entity *); -extern void sub_8041EC8(Entity *); -extern void sub_8041ED8(Entity *); -extern void EntityUpdateStatusSprites(Entity *); -extern void sub_8041AF4(Entity *); -extern void nullsub_91(Entity *); -extern void nullsub_90(Entity *); -extern void nullsub_72(Entity *); -extern void nullsub_71(Entity *); -extern void nullsub_70(Entity *); -extern void nullsub_69(Entity *, Entity *); -extern void sub_8041CB8(Entity *r0); -extern void sub_8041C1C(Entity *r0); -extern void sub_8042060(Entity *, s32); -extern void sub_8041FB4(Entity *r0, u32 r1); -extern void sub_8041FD8(Entity *r0, u32 r1); -extern void sub_804201C(Entity *r0, u32 r1); -extern void sub_8041FFC(Entity *r0, u32 r1); -extern void sub_8041CCC(Entity *); -extern void sub_8042040(Entity *, s32); +#include "dungeon_8041AD0.h" u8 sub_8075BF4(Entity * pokemon, s32 sleepClassStatusTurns) { diff --git a/src/move_orb_effects_2.c b/src/move_orb_effects_2.c index e87d97ca0..15cb8849f 100644 --- a/src/move_orb_effects_2.c +++ b/src/move_orb_effects_2.c @@ -30,65 +30,7 @@ #include "move_orb_actions_1.h" #include "move_orb_effects_5.h" #include "run_dungeon.h" - -extern void sub_8041D84(Entity *); -extern void sub_804178C(u32); -extern void sub_8041D5C(Entity *); -extern void sub_8041D48(Entity *); -extern void sub_8041D38(Entity * pokemon); -extern void sub_8041CDC(Entity *pokemon); -extern void sub_8041CEC(Entity *pokemon); -extern void nullsub_73(Entity *); -extern void nullsub_74(Entity *); -extern void nullsub_75(Entity *); -extern void nullsub_76(Entity *); -extern void nullsub_77(Entity *); -extern void nullsub_78(Entity *); -extern void nullsub_79(Entity *); -extern void nullsub_80(Entity *); -extern void nullsub_81(Entity *); -extern void nullsub_82(Entity *); -extern void nullsub_83(Entity *); -extern void nullsub_84(Entity *); -extern void nullsub_85(Entity *); -extern void EntityUpdateStatusSprites(Entity *); -extern void sub_8042A74(Entity *r0); -extern void sub_80420C8(Entity *r0); -extern void nullsub_68(Entity *); -extern void nullsub_67(Entity *); -extern void nullsub_66(Entity *); -extern void nullsub_65(Entity *); -extern void nullsub_64(Entity *); -extern void nullsub_63(Entity *); -extern void nullsub_62(Entity *); -extern void nullsub_61(Entity *); -extern void nullsub_60(Entity *); -extern void nullsub_59(Entity *); -extern void nullsub_58(Entity *); -extern void nullsub_57(Entity *); -extern void sub_8041B34(Entity *); -void sub_8041BD0(Entity *r0, u8 r1); -void sub_8041EB4(Entity *); -void sub_8041EA4(Entity *); -extern void sub_8041E84(Entity *); -extern void sub_8041E94(Entity *); -extern void sub_8041E74(Entity *); -extern void sub_8041E60(Entity *); -extern void sub_8041E4C(Entity *); -extern void sub_8041E3C(Entity *); -extern void sub_8041E1C(Entity *); -extern void nullsub_89(Entity *); -extern void nullsub_88(Entity *); -extern void nullsub_87(Entity *); -extern void nullsub_86(Entity *); -extern void sub_8041E0C(Entity *); -extern void sub_8041DD8(Entity *r0, s32 r1); // NOTE: is s16 in another file -extern void sub_8041D9C(Entity *); -extern void sub_8041DB0(Entity *pokemon); -extern void sub_8041CA8(Entity *); -extern void sub_8041C94(Entity *); -extern void sub_8041BF8(Entity *); -extern void sub_8041BE8(Entity *); +#include "dungeon_8041AD0.h" void ConfuseStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage) { diff --git a/src/move_orb_effects_3.c b/src/move_orb_effects_3.c index 207981ae0..b6cc71822 100644 --- a/src/move_orb_effects_3.c +++ b/src/move_orb_effects_3.c @@ -26,9 +26,7 @@ #include "dungeon_config.h" #include "dungeon_strings.h" #include "dungeon_pos_data.h" - -extern void sub_8041BD0(Entity *r0, u8 r1); -extern void EntityUpdateStatusSprites(Entity *); +#include "dungeon_8041AD0.h" void SetChargeStatusTarget(Entity *pokemon, Entity *target, u8 newStatus, Move *move, const u8 *message) { diff --git a/src/move_orb_effects_4.c b/src/move_orb_effects_4.c index 1e067bef1..8fa1da254 100644 --- a/src/move_orb_effects_4.c +++ b/src/move_orb_effects_4.c @@ -26,22 +26,7 @@ #include "dungeon_config.h" #include "dungeon_strings.h" #include "dungeon_misc.h" - -extern void EntityUpdateStatusSprites(Entity *); -extern void nullsub_68(Entity *); -extern void nullsub_67(Entity *); -extern void nullsub_66(Entity *); -extern void nullsub_65(Entity *); -extern void nullsub_64(Entity *); -extern void nullsub_63(Entity *); -extern void nullsub_62(Entity *); -extern void nullsub_61(Entity *); -extern void nullsub_60(Entity *); -extern void nullsub_59(Entity *); -extern void nullsub_58(Entity *); -extern void nullsub_57(Entity *); -extern void sub_8041B34(Entity *pokemon); -extern void sub_80420C8(Entity *pokemon); +#include "dungeon_8041AD0.h" void CounterStatusTarget(Entity * pokemon, Entity * target, u8 newStatus) { diff --git a/src/move_orb_effects_5.c b/src/move_orb_effects_5.c index cd0869d2e..6a4942275 100644 --- a/src/move_orb_effects_5.c +++ b/src/move_orb_effects_5.c @@ -34,38 +34,7 @@ #include "dungeon_kecleon_shop.h" #include "dungeon_map.h" #include "move_orb_effects_2.h" - -extern void EntityUpdateStatusSprites(Entity *); -extern void sub_8042A74(Entity *r0); -extern void sub_80420C8(Entity *r0); -extern void nullsub_68(Entity *); -extern void nullsub_67(Entity *); -extern void nullsub_66(Entity *); -extern void nullsub_65(Entity *); -extern void nullsub_64(Entity *); -extern void nullsub_63(Entity *); -extern void nullsub_62(Entity *); -extern void nullsub_61(Entity *); -extern void nullsub_60(Entity *); -extern void nullsub_59(Entity *); -extern void nullsub_58(Entity *); -extern void nullsub_57(Entity *); -extern void sub_8041B34(Entity *); -void sub_8041BD0(Entity *r0, u8 r1); -void sub_8041EB4(Entity *); -void sub_8041EA4(Entity *); -extern void sub_8041E84(Entity *); -extern void sub_8041E94(Entity *); -extern void sub_8041E74(Entity *); -extern void sub_8041E60(Entity *); -extern void sub_8041E4C(Entity *); -extern void sub_8041E3C(Entity *); -extern void sub_8041E1C(Entity *); -extern void nullsub_89(Entity *); -extern void nullsub_88(Entity *); -extern void nullsub_87(Entity *); -extern void nullsub_86(Entity *); -extern void sub_8041E0C(Entity *); +#include "dungeon_8041AD0.h" void sub_8079F20(Entity * pokemon, Entity * target, u8 param_3, u8 param_4) { diff --git a/src/one_room_orb.c b/src/one_room_orb.c index 4727a1dc1..9a62ac0a4 100644 --- a/src/one_room_orb.c +++ b/src/one_room_orb.c @@ -18,7 +18,7 @@ #include "move_orb_effects_1.h" #include "moves.h" #include "move_util.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "weather.h" #include "dungeon_config.h" #include "dungeon_misc.h" diff --git a/src/pounce_orb.c b/src/pounce_orb.c index 699a93430..5f94399aa 100644 --- a/src/pounce_orb.c +++ b/src/pounce_orb.c @@ -18,7 +18,7 @@ #include "move_orb_effects_1.h" #include "moves.h" #include "move_util.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "weather.h" #include "dungeon_config.h" #include "dungeon_misc.h" diff --git a/src/run_dungeon.c b/src/run_dungeon.c index e7c759678..298789329 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -59,13 +59,13 @@ #include "dungeon_cutscene.h" #include "dungeon_mon_spawn.h" #include "dungeon_action_execution.h" +#include "dungeon_8041AD0.h" EWRAM_INIT struct UnkStruct_203B414 *gUnknown_203B414 = NULL; EWRAM_INIT Dungeon *gDungeon = NULL; static EWRAM_INIT u8 *gSerializedData_203B41C = NULL; extern void sub_8068BDC(u8 r0); -extern void sub_8041888(u8 param_1); extern void sub_803D4AC(void); extern void sub_804513C(void); extern void sub_8068F28(void); @@ -78,7 +78,6 @@ extern void sub_807E5AC(void); extern void nullsub_16(void); extern void sub_80521D0(void); extern void sub_8068A84(Pokemon *pokemon); -extern void sub_80427AC(void); extern void sub_806AA70(void); extern void ReevaluateSnatchMonster(void); extern void sub_8051E3C(void); @@ -86,10 +85,8 @@ extern void sub_807FA18(void); extern void sub_806A974(void); extern void DetermineAllMonsterShadow(void); extern void sub_8068F80(void); -extern void sub_8042E98(void); extern bool8 TryForcedLoss(bool8); extern void sub_806A914(bool8 a0, bool8 a1, bool8 showRunAwayEffect); -extern void sub_8042B0C(Entity *); extern u8 gUnknown_202F1A8; diff --git a/src/switcher_orb.c b/src/switcher_orb.c index 7fc40f890..7ac375ef6 100644 --- a/src/switcher_orb.c +++ b/src/switcher_orb.c @@ -18,7 +18,7 @@ #include "move_orb_effects_1.h" #include "moves.h" #include "move_util.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "weather.h" #include "dungeon_config.h" #include "dungeon_misc.h" @@ -26,8 +26,6 @@ #include "dungeon_strings.h" #include "dungeon_kecleon_shop.h" -extern void nullsub_93(DungeonPos *); - void HandleSwitcherOrb(Entity *pokemon, Entity *target, bool8 unused) { DungeonPos pokemonPos; diff --git a/src/trap.c b/src/trap.c index 4654ec023..549588545 100644 --- a/src/trap.c +++ b/src/trap.c @@ -2,7 +2,7 @@ #include "globaldata.h" #include "trap.h" #include "dungeon_tilemap.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "dungeon_message.h" #include "dungeon_random.h" #include "dungeon_mon_sprite_render.h" @@ -39,8 +39,6 @@ #include "move_orb_effects_2.h" #include "move_orb_effects_4.h" -void sub_80421EC(DungeonPos *, u32); -void sub_804225C(Entity *, DungeonPos *, u8); void sub_806A1E8(Entity *pokemon); Entity *sub_8045684(u8, DungeonPos *, u8); diff --git a/src/trawl_orb.c b/src/trawl_orb.c index 8d83b72a1..a17ca95fe 100644 --- a/src/trawl_orb.c +++ b/src/trawl_orb.c @@ -18,7 +18,7 @@ #include "move_orb_effects_1.h" #include "moves.h" #include "move_util.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "weather.h" #include "dungeon_config.h" #include "dungeon_misc.h" diff --git a/src/warp_target.c b/src/warp_target.c index 4088299a6..886f26874 100644 --- a/src/warp_target.c +++ b/src/warp_target.c @@ -18,7 +18,7 @@ #include "move_orb_effects_1.h" #include "moves.h" #include "move_util.h" -#include "code_8041AD0.h" +#include "dungeon_8041AD0.h" #include "weather.h" #include "dungeon_config.h" #include "dungeon_tilemap.h" diff --git a/src/weather.c b/src/weather.c index 36f509525..53831065e 100644 --- a/src/weather.c +++ b/src/weather.c @@ -5,7 +5,6 @@ #include "constants/move_id.h" #include "constants/weather.h" #include "structs/str_dungeon.h" -#include "code_804267C.h" #include "dungeon_vram.h" #include "dungeon_info.h" #include "dungeon_config.h" @@ -33,9 +32,7 @@ #include "dungeon_misc.h" #include "sprite.h" #include "dungeon_strings.h" - -extern void sub_804178C(u32); -extern void sub_80429D8(Entity *r0); +#include "dungeon_8041AD0.h" extern OpenedFile *gUnknown_202ECA0; diff --git a/sym_ewram.txt b/sym_ewram.txt index aa8801909..8ea49be54 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -50,7 +50,7 @@ .include "src/dungeon_menu_others.o" .include "src/dungeon_menu_recruitment.o" .include "src/code_8066D04.o" - .include "src/dungeon_8067A80.o" + .include "src/dungeon_recruit_release_menu.o" .include "src/dungeon_logic.o" .include "src/dungeon_leveling.o" .include "src/dungeon_action_execution.o" From 5b5ad607a3a36ca00dccfcc8d72fe218adde664d Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 17 Oct 2025 19:50:19 +0200 Subject: [PATCH 4/5] Update src/dungeon_mon_recruit.c Co-authored-by: Seth Barberee --- src/dungeon_mon_recruit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dungeon_mon_recruit.c b/src/dungeon_mon_recruit.c index f9b0a61dd..85d64da18 100644 --- a/src/dungeon_mon_recruit.c +++ b/src/dungeon_mon_recruit.c @@ -115,7 +115,7 @@ bool8 TryRecruitMonster(Entity *attacker, Entity *target) if (rand >= recruitRate) return FALSE; - for (i = 0; i <= (6 - size); i++) { + for (i = 0; i <= (MAX_TEAM_BODY_SIZE - size); i++) { s32 j; for (j = 0; j < size; j++) { if (gUnknown_202EE70[i + j] != 0) From 31052cd0779c0dd5c640274c14a2c7fefea001d3 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 17 Oct 2025 19:50:32 +0200 Subject: [PATCH 5/5] Update src/dungeon_mon_recruit.c Co-authored-by: Seth Barberee --- src/dungeon_mon_recruit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dungeon_mon_recruit.c b/src/dungeon_mon_recruit.c index 85d64da18..459c938c8 100644 --- a/src/dungeon_mon_recruit.c +++ b/src/dungeon_mon_recruit.c @@ -335,7 +335,7 @@ bool8 CanEntityBeRecruited(Entity *param_1) return FALSE; sub_806F910(); - for (i = 0; i <= (6 - size); i++) { + for (i = 0; i <= (MAX_TEAM_BODY_SIZE - size); i++) { for (j = 0; j < size; j++){ if (gUnknown_202EE70[i + j] != 0) break;