diff --git a/include/dungeon_info.h b/include/dungeon_info.h index f08c6aab0..676c9ae77 100644 --- a/include/dungeon_info.h +++ b/include/dungeon_info.h @@ -2,24 +2,34 @@ #define GUARD_DUNGEON_INFO_H #include "structs/str_dungeon_location.h" +#include "data_serializer.h" extern const u16 *const gRandomItemsSets[]; extern const u8 gUnknown_8108EC0[]; -s32 GetDungeonFloorCount(u8 dungeon); -s32 GetDungeonStartingFloor(u8 dungeon); const u8 *GetDungeonName1(u8 dungeon); +const u8 *GetDungeonName2(u8 dungeon); bool8 IsStairDirectionUp(u8 dungeon); +s16 GetTurnLimit(u8 dungeon); +bool8 IsEnterWithoutGameSave(u8 dungeon); +bool8 HasCheckpoint(u8 dungeon); bool8 IsLevelResetDungeon(u8 dungeon); u32 GetMaxItemsAllowed(u8 dungeon); bool8 IsMoneyAllowed(u8 dungeon); s8 GetRescuesAllowed(u8 dungeon); -bool8 HasCheckpoint(u8 dungeon); +u8 IsRecruitingEnabled(u8 dungeon); +bool8 CanLeaderSwitch(u8 dungeon); s16 GetRandomMovementChance(u8 dungeon); +bool8 sub_809017C(DungeonLocation* a1); +void GeneralizeMazeDungeonLoc(DungeonLocation *dst, const DungeonLocation *src); void PrintYellowDungeonNametoBuffer(u8 *buffer, DungeonLocation *dungeonLocation); void PrintDungeonLocationtoBuffer(u8 *buffer, DungeonLocation *dungeonLocation); - -void GeneralizeMazeDungeonLoc(DungeonLocation *dst, const DungeonLocation *src); +void CopyDungeonName1toBuffer(u8 *buffer, DungeonLocation *dungeonLocation); +s32 GetDungeonFloorCount(u8 dungeon); +s32 GetDungeonStartingFloor(u8 dungeon); +void WriteDungeonLocationBits(DataSerializer* r0, DungeonLocation* src); +void ReadDungeonLocationBits(DataSerializer* r0, DungeonLocation* dst); +bool8 DoEnemiesEvolveWhenKOed(u8 dungeon); #define DUNGEON_REQUIREMENTS_PASS 0 #define DUNGEON_REQUIREMENTS_FAIL 1 @@ -29,6 +39,5 @@ u32 BufferDungeonRequirementsText(u8 dungeonIndex, s32 speciesId_, u8 *buffer, b u32 GetDungeonLocMissionDifficulty(DungeonLocation *dungeon); u8 GetRandomItemForValidDungeonLoc(DungeonLocation *dungeon, u32 param_2); bool8 IsNotValidDungeon(u8 dungeon); -u8 IsRecruitingEnabled(u8 dungeon); #endif // GUARD_DUNGEON_INFO_H diff --git a/include/dungeon_item_action.h b/include/dungeon_item_action.h new file mode 100644 index 000000000..5031c0e83 --- /dev/null +++ b/include/dungeon_item_action.h @@ -0,0 +1,13 @@ +#ifndef GUARD_DUNGEON_ITEM_ACTION_H +#define GUARD_DUNGEON_ITEM_ACTION_H + +#include "structs/str_items.h" +#include "structs/dungeon_entity.h" + +void sub_80479B8(char param_1, char param_2, u8 param_3, Entity *pokemon, Entity *target, Item *item); +bool8 sub_8048950(Entity *param_1,Item *item); +bool8 sub_8048A68(Entity *param_1,Item *item); +bool8 sub_8048B9C(Entity *entity, Item *item); +bool8 sub_8048D50(Entity *pokemon, Item *item); + +#endif // GUARD_DUNGEON_ITEM_ACTION_H diff --git a/src/code_8066D04.c b/src/code_8066D04.c index d52e2caa1..f28385d26 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -41,13 +41,12 @@ #include "dungeon_projectile_throw.h" #include "dungeon_engine.h" #include "dungeon_kecleon_shop.h" +#include "dungeon_item_action.h" extern void EnemyEvolution(Entity *); extern void sub_8057588(Entity * pokemon, u8 param_2); extern Item *sub_8044D90(Entity *, s32, u32); -u8 sub_8048D50(); void sub_8042208(Entity *pokemon, u8 r1); -void sub_80479B8(); extern void sub_807AB38(Entity *, u32); extern Entity * sub_8044DA4(Entity *param_1,int param_2); extern void sub_8044DF0(Entity *, u32, u32); diff --git a/src/code_8094F88.c b/src/code_8094F88.c index 80fc7bbfa..50d586628 100644 --- a/src/code_8094F88.c +++ b/src/code_8094F88.c @@ -22,8 +22,6 @@ EWRAM_DATA UNUSED static u32 fill0 = {0}; // 203B484 is size 0x5C and I need to EWRAM_DATA u32 gUnknown_20392E8[0x36] = {0}; EWRAM_DATA unkStruct_203B48C gUnknown_20393C0 = {0}; -extern void WriteDungeonLocationBits(DataSerializer*, DungeonLocation*); -extern void ReadDungeonLocationBits(DataSerializer*, DungeonLocation*); extern void WritePoke1LevelBits(DataSerializer* a1, struct unkPokeSubStruct_C* unkC); extern void ReadPoke1LevelBits(DataSerializer*, struct unkPokeSubStruct_C*); diff --git a/src/code_80958E8.c b/src/code_80958E8.c index df77e7c38..b808d57ad 100644 --- a/src/code_80958E8.c +++ b/src/code_80958E8.c @@ -17,7 +17,6 @@ #include "event_flag.h" #include "rescue_team_info.h" -extern bool8 sub_809017C(DungeonLocation *); extern void sub_803C37C(struct DungeonLocation *, u8, u8 *); extern u8 sub_8097318(s16 param_1); @@ -31,8 +30,6 @@ u8 sub_8095E78(void); bool8 sub_80963B4(void); s32 CalculateMailChecksum(WonderMail *mail); -extern void WriteDungeonLocationBits(DataSerializer*, DungeonLocation*); -extern void ReadDungeonLocationBits(DataSerializer*, DungeonLocation*); extern void sub_803C4F0(WonderMail *); extern void sub_803C3E0(WonderMail *); extern void sub_803C45C(WonderMail *); diff --git a/src/code_8097670.c b/src/code_8097670.c index af5325646..70bc488b4 100644 --- a/src/code_8097670.c +++ b/src/code_8097670.c @@ -6,13 +6,12 @@ #include "friend_area.h" #include "moves.h" #include "strings.h" +#include "dungeon_info.h" static EWRAM_DATA struct unkStruct_203B494 sUnknown_2039778 = {0}; EWRAM_INIT struct unkStruct_203B494 *gUnknown_203B494 = { NULL }; // NDS=20EB98C -extern void WriteDungeonLocationBits(DataSerializer*, DungeonLocation*); -extern void ReadDungeonLocationBits(DataSerializer*, DungeonLocation*); void ReadGameOptionsBits(DataSerializer *param_1); void ReadPlayTimeBits(DataSerializer *r0); void WriteGameOptionsBits(DataSerializer *param_1); diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index 847fbc994..d5ae1e2bd 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -18,6 +18,7 @@ #include "status.h" #include "dungeon_random.h" #include "dungeon_items.h" +#include "dungeon_info.h" #include "dungeon_util.h" #include "dungeon_config.h" #include "dungeon_strings.h" @@ -55,7 +56,6 @@ extern void sub_8042A24(Entity *r0); extern void sub_806A390(Entity *r0); extern void sub_8078084(Entity * pokemon); extern void sub_800DBBC(void); -extern bool8 DoEnemiesEvolveWhenKOed(u8 dungeon); extern bool8 sub_806FA5C(Entity *, Entity *, struct unkStruct_8069D4C *); extern void EntityUpdateStatusSprites(Entity *); extern void PointCameraToMonster(Entity *); diff --git a/src/dungeon_item_action.c b/src/dungeon_item_action.c index 536d2ef5b..48d6a1b38 100644 --- a/src/dungeon_item_action.c +++ b/src/dungeon_item_action.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_item_action.h" #include "code_8041AD0.h" #include "dungeon_message.h" #include "code_8077274_1.h" @@ -32,39 +33,12 @@ #include "dungeon_data.h" #include "dungeon_logic.h" #include "dungeon_damage.h" +#include "dungeon_strings.h" +#include "dungeon_move.h" -extern u8 *gUnknown_80F89F4[]; -extern u8 *gUnknown_80FB580[]; extern u32 gUnknown_8106A4C; extern u32 gUnknown_8106A50; -extern u8 *gUnknown_80FDBB8[]; -extern u8 *gUnknown_80FE458[]; -extern u8 *gItemStickyDoesntWorkText[]; -extern u8 *gUnknown_80FEAE8[]; -extern u8 *gUnknown_80FDBA0[]; -extern u8 *gUnknown_80FE434[]; -extern u8 *gUnknown_80FE40C[]; -extern u8 *gUnknown_80FE454[]; -extern u8 *gPtrSelfHealPreventedHungerMessage[]; -extern u8 *gUnknown_80F9740[]; -extern u8 *gUnknown_80F9760[]; -extern u8 *gUnknown_80FD644[]; -extern u8 *gUnknown_80FD648[]; -extern u8 *gUnknown_80FD6E8[]; -extern u8 *gPtrCantUseInDungeonMessage[]; -extern u8 *gItemStickyDoesntWorkText[]; -extern u8 *gPtrMusicBoxPlayedCrumbledMessage[]; -extern u8 *gPtrWishStoneCrumbledMessage[]; -extern u8 *gPtrIcePartCrumbledMessage[]; -extern u8 *gPtrRockPartCrumbledMessage[]; -extern u8 *gPtrSteelPartCrumbledMessage[]; -extern u8 *gUnknown_80FDCA4[]; -extern u8 *gItemStickyDoesntWorkText[]; -extern u8 *gUnknown_80FECA0[]; -extern u8 *gItemStickyDoesntWorkText[]; -extern u8 *gUnknown_80F9BD8[]; - extern void sub_8078B5C(Entity *, Entity *, u32, u32, u32); extern void sub_8051E7C(Entity *pokemon); extern void sub_8045BF8(u8 *, Item *); @@ -79,49 +53,46 @@ extern void sub_8072008(Entity *pokemon, Entity *r1, u32 r2, u8 r3, u32); extern void LevelDownTarget(Entity *pokemon, Entity *r1, u32 r2); extern s32 sub_8042520(Entity *); Entity *sub_80696FC(Entity *); -extern void DisplayMsgIfNewIqSkillLearned(EntityInfo *, s32); -extern u32 HandleDamagingMove(struct Entity *, struct Entity *, struct Move *, u32, u32); -void StunSeedItemAction(Entity *, Entity *); -void MaxElixirAction(Entity *, Entity *); -void ProteinItemAction(Entity *, Entity *); -void CalciumItemAction(Entity *, Entity *); -void IronItemAction(Entity *, Entity *); -void ZincItemAction(Entity *, Entity *); -void sub_80487CC(Entity *, Entity *, u32, u32); -void GrimyFoodItemAction(Entity *, Entity *); -void HandleGummiItemAction(Entity *, Entity *, u8); -void IcePartItemAction(Entity *, Entity *, u8); -void SteelPartItemAction(Entity *, Entity *, u8); -void RockPartItemAction(Entity *, Entity *, u8); -void MusicBoxItemAction(Entity *, Entity *, u8); -void nullsub_94(Entity *, Entity *, u8); -void KeyItemAction(Entity *, Entity *, u8); -void sub_8078B5C(Entity *, Entity *, u32, u32, u32); -void sub_8048340(Entity *, Entity *, u32); -void HealSeedItemAction(Entity *, Entity *, u8); -void WishStoneItemAction(Entity *, Entity *, u8); -void OranBerryItemAction(Entity *, Entity *); -void ChestoBerryItemAction(Entity *, Entity *); -void JoySeedItemAction(Entity *, Entity *); -void GinsengItemAction(Entity *, Entity *); -void BlastSeedItemAction(Entity *, Entity *, u8); -void SitrusBerryItemAction(Entity *, Entity *); -void WarpSeedItemAction(Entity *, Entity *); -void PlainSeedItemAction(Entity *, Entity *); -void SleepSeedItemAction(Entity *, Entity *); -void TotterSeedItemAction(Entity *, Entity *); -void CheriBerryItemAction(Entity *, Entity *); -void PechaBerryItemAction(Entity *, Entity *); -void QuickSeedItemAction(Entity *, Entity *); -void HungerSeedItemAction(Entity *, Entity *); -void RawstBerryItemAction(Entity *, Entity *); -void LifeSeedItemAction(Entity *, Entity *); -void AllureSeedItemAction(Entity *, Entity *); -void EyedropSeedItemAction(Entity *, Entity *); -void BlinkerSeedItemAction(Entity *, Entity *); -void DoomSeedItemAction(Entity *, Entity *); -void sub_80482FC(Entity *, Entity *, u32, u8); +static void StunSeedItemAction(Entity *, Entity *); +static void MaxElixirAction(Entity *, Entity *); +static void ProteinItemAction(Entity *, Entity *); +static void CalciumItemAction(Entity *, Entity *); +static void IronItemAction(Entity *, Entity *); +static void ZincItemAction(Entity *, Entity *); +static void sub_80487CC(Entity *, Entity *, u32, u32); +static void GrimyFoodItemAction(Entity *, Entity *); +static void HandleGummiItemAction(Entity *, Entity *, u8); +static void IcePartItemAction(Entity *, Entity *, u8); +static void SteelPartItemAction(Entity *, Entity *, u8); +static void RockPartItemAction(Entity *, Entity *, u8); +static void MusicBoxItemAction(Entity *, Entity *, u8); +static void nullsub_94(Entity *, Entity *, u8); +static void KeyItemAction(Entity *, Entity *, u8); +static void sub_8048340(Entity *, Entity *, u32); +static void HealSeedItemAction(Entity *, Entity *, u8); +static void WishStoneItemAction(Entity *, Entity *, u8); +static void OranBerryItemAction(Entity *, Entity *); +static void ChestoBerryItemAction(Entity *, Entity *); +static void JoySeedItemAction(Entity *, Entity *); +static void GinsengItemAction(Entity *, Entity *); +static void BlastSeedItemAction(Entity *, Entity *, u8); +static void SitrusBerryItemAction(Entity *, Entity *); +static void WarpSeedItemAction(Entity *, Entity *); +static void PlainSeedItemAction(Entity *, Entity *); +static void SleepSeedItemAction(Entity *, Entity *); +static void TotterSeedItemAction(Entity *, Entity *); +static void CheriBerryItemAction(Entity *, Entity *); +static void PechaBerryItemAction(Entity *, Entity *); +static void QuickSeedItemAction(Entity *, Entity *); +static void HungerSeedItemAction(Entity *, Entity *); +static void RawstBerryItemAction(Entity *, Entity *); +static void LifeSeedItemAction(Entity *, Entity *); +static void AllureSeedItemAction(Entity *, Entity *); +static void EyedropSeedItemAction(Entity *, Entity *); +static void BlinkerSeedItemAction(Entity *, Entity *); +static void DoomSeedItemAction(Entity *, Entity *); +static void sub_80482FC(Entity *, Entity *, u32, u8); extern void EnemyEvolution(Entity *); extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); @@ -161,7 +132,7 @@ void sub_80479B8(char param_1, char param_2, u8 param_3, Entity *pokemon, Entity PlaySoundEffect(0x14d); sub_8045BF8(gFormatBuffer_Items[0],item); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0); - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FDBB8); // $m0 caught the $i0 + TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FDBB8); // $m0 caught the $i0 info->heldItem = *item; sub_806A6E8(target); return; @@ -174,7 +145,7 @@ void sub_80479B8(char param_1, char param_2, u8 param_3, Entity *pokemon, Entity } if ((item->flags & ITEM_FLAG_STICKY)) { sub_8045BF8(gFormatBuffer_Items[0],item); - TryDisplayDungeonLoggableMessage3(pokemon,target,*gItemStickyDoesntWorkText); + TryDisplayDungeonLoggableMessage3(pokemon,target,gItemStickyDoesntWorkText); if (param_1 != '\0') { sub_806F370(pokemon,target,gUnknown_80F4FAE,1,&uStack_24,0,0x217,0,0,0); EnemyEvolution(pokemon); @@ -197,7 +168,7 @@ _jump: } else { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE458); + TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FE458); goto _080482B4; } } @@ -401,7 +372,7 @@ _jump: } else { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE458); + TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FE458); } break; } @@ -409,127 +380,127 @@ _080482B4: EnemyEvolution(pokemon); } -UNUSED void nullsub_205(void) { } +UNUSED static void nullsub_205(void) { } -void SleepSeedItemAction(Entity *pokemon, Entity *target) +static void SleepSeedItemAction(Entity *pokemon, Entity *target) { SleepStatusTarget(pokemon, target, CalculateStatusTurns(target, gSleepTurnRange, TRUE), TRUE); } -void sub_80482FC(Entity *pokemon, Entity *target, u32 pp, u8 param_4) +static void sub_80482FC(Entity *pokemon, Entity *target, u32 pp, u8 param_4) { Move move; InitPokemonMove(&move, MOVE_PROJECTILE); move.PP = pp; - HandleDamagingMove(pokemon, target, &move, 0x100, param_4); + HandleDamagingMove(pokemon, target, &move, IntToF248_2(1.0), param_4); } -void sub_8048340(Entity *pokemon, Entity *target, u32 r2) +static void sub_8048340(Entity *pokemon, Entity *target, u32 r2) { sub_806F370(pokemon, target, r2, 1, 0, 0, 528, 0, 0, 0); } -void HealSeedItemAction(Entity *pokemon, Entity *target, u8 r2) +static void HealSeedItemAction(Entity *pokemon, Entity *target, u8 r2) { sub_8079F20(pokemon, target, 1, r2); } -void OranBerryItemAction(Entity *pokemon, Entity *target) +static void OranBerryItemAction(Entity *pokemon, Entity *target) { HealTargetHP(pokemon, target, gOranBerryHealValue, gOranBerryMaxHpRiseValue, TRUE); } -void SitrusBerryItemAction(Entity *pokemon, Entity *target) +static void SitrusBerryItemAction(Entity *pokemon, Entity *target) { HealTargetHP(pokemon, target, gSitrusBerryHealValue, gSitrusBerryMaxHpRiseValue, TRUE); } -void MaxElixirAction(Entity *pokemon, Entity *target) +static void MaxElixirAction(Entity *pokemon, Entity *target) { RestorePPTarget(pokemon, target, 999); } -void LifeSeedItemAction(Entity *pokemon, Entity *target) +static void LifeSeedItemAction(Entity *pokemon, Entity *target) { HealTargetHP(pokemon, target, 0, gLifeSeedMaxHpRiseValue, TRUE); } -void BlinkerSeedItemAction(Entity *pokemon, Entity *target) +static void BlinkerSeedItemAction(Entity *pokemon, Entity *target) { BlindTarget(pokemon, target); } -void AllureSeedItemAction(Entity *pokemon, Entity *target) +static void AllureSeedItemAction(Entity *pokemon, Entity *target) { CrossEyeVisionTarget(pokemon, target); } -void QuickSeedItemAction(Entity *pokemon, Entity *target) +static void QuickSeedItemAction(Entity *pokemon, Entity *target) { RaiseMovementSpeedTarget(pokemon, target, 0, TRUE); } -void EyedropSeedItemAction(Entity *pokemon, Entity *target) +static void EyedropSeedItemAction(Entity *pokemon, Entity *target) { RestoreVisionTarget(pokemon, target); } -void CheriBerryItemAction(Entity *pokemon, Entity *target) +static void CheriBerryItemAction(Entity *pokemon, Entity *target) { if(GetEntInfo(target)->burnClassStatus.status == STATUS_PARALYSIS) EndBurnClassStatus(pokemon, target); else // Pointer to "But nothing happened!" - TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80F89F4); + TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80F89F4); } -void PechaBerryItemAction(Entity *pokemon, Entity *target) +static void PechaBerryItemAction(Entity *pokemon, Entity *target) { EntityInfo *entInfo = GetEntInfo(target); if (ENTITY_POISONED(entInfo)) EndBurnClassStatus(pokemon, target); else - TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80F89F4); // Pointer to "But nothing happened!" + TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80F89F4); // Pointer to "But nothing happened!" } -void WarpSeedItemAction(Entity *pokemon, Entity *target) +static void WarpSeedItemAction(Entity *pokemon, Entity *target) { WarpTarget(pokemon, target, 0, NULL); } -void ChestoBerryItemAction(Entity *pokemon, Entity *target) +static void ChestoBerryItemAction(Entity *pokemon, Entity *target) { SleeplessStatusTarget(pokemon, target); } -void TotterSeedItemAction(Entity *pokemon, Entity *target) +static void TotterSeedItemAction(Entity *pokemon, Entity *target) { ConfuseStatusTarget(pokemon, target, TRUE); } -void JoySeedItemAction(Entity *pokemon, Entity *target) +static void JoySeedItemAction(Entity *pokemon, Entity *target) { sub_8072008(pokemon, target, 1, 1, 1); } -void StunSeedItemAction(Entity *pokemon, Entity *target) +static void StunSeedItemAction(Entity *pokemon, Entity *target) { PetrifiedStatusTarget(pokemon, target); } -void PlainSeedItemAction(Entity *pokemon, Entity *target) +static void PlainSeedItemAction(Entity *pokemon, Entity *target) { // Pointer to "But nothing happened!" - TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80F89F4); + TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80F89F4); } -void DoomSeedItemAction(Entity *pokemon, Entity *target) +static void DoomSeedItemAction(Entity *pokemon, Entity *target) { LevelDownTarget(pokemon, target, 1); } -void RawstBerryItemAction(Entity *pokemon, Entity *target) +static void RawstBerryItemAction(Entity *pokemon, Entity *target) { if(GetEntInfo(target)->burnClassStatus.status == STATUS_BURN) EndBurnClassStatus(pokemon, target); @@ -537,11 +508,11 @@ void RawstBerryItemAction(Entity *pokemon, Entity *target) { SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0); // Pointer to "But nothing happened!" - TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FB580); + TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FB580); } } -void HungerSeedItemAction(Entity *pokemon, Entity * target) +static void HungerSeedItemAction(Entity *pokemon, Entity * target) { EntityInfo *entityInfo = GetEntInfo(target); if (GetEntInfo(target)->isTeamLeader) @@ -551,20 +522,20 @@ void HungerSeedItemAction(Entity *pokemon, Entity * target) entityInfo = GetEntInfo(target); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0); if (IQSkillIsEnabled(target, IQ_SELF_CURER)) - TryDisplayDungeonLoggableMessage3(pokemon, target, *gPtrSelfHealPreventedHungerMessage); + TryDisplayDungeonLoggableMessage3(pokemon, target, gPtrSelfHealPreventedHungerMessage); else { if (FixedPointToInt(entityInfo->belly) != 0) { entityInfo->belly = IntToFixedPoint(0); - TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80F9740); + TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80F9740); } else - TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80F9760); + TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80F9760); } } } -void GinsengItemAction(Entity *pokemon, Entity * target) +static void GinsengItemAction(Entity *pokemon, Entity * target) { s32 i; bool8 isMoveBoosted = FALSE; @@ -595,22 +566,22 @@ void GinsengItemAction(Entity *pokemon, Entity * target) } if (isMoveBoosted) { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE454); + TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FE454); if (moveBoost != 1) { sub_803E708(10,0x40); - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE434); + TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FE434); } } else { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE40C); + TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FE40C); } } else { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE40C); + TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FE40C); } } -void BlastSeedItemAction(Entity *pokemon, Entity * target, u8 param_3) +static void BlastSeedItemAction(Entity *pokemon, Entity * target, u8 param_3) { s32 dmg; EntityInfo *entityInfo; @@ -623,7 +594,7 @@ void BlastSeedItemAction(Entity *pokemon, Entity * target, u8 param_3) entityInfo_1 = entityInfo; if (gDungeon->unk644.unk31 != 0) { dmg = gBlastSeedThrownBossDmgValue; - TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FEAE8); // It appears to be weak here... + TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FEAE8); // It appears to be weak here... } else { dmg = gBlastSeedThrownDmgValue; @@ -639,14 +610,14 @@ void BlastSeedItemAction(Entity *pokemon, Entity * target, u8 param_3) entity = sub_80696FC(pokemon); if (entity == NULL) { - TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FDBA0); + TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FDBA0); } else { entityInfo = GetEntInfo(entity); if (gDungeon->unk644.unk31 != 0) { dmg = gBlastSeedEatenBossDmgValue; - TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FEAE8); // It appears to be weak here... + TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80FEAE8); // It appears to be weak here... } else { dmg = gBlastSeedEatenDmgValue; @@ -659,12 +630,12 @@ void BlastSeedItemAction(Entity *pokemon, Entity * target, u8 param_3) } } -void sub_80487CC(Entity *pokemon, Entity * target, u32 param_3, u32 param_4) +static void sub_80487CC(Entity *pokemon, Entity * target, u32 param_3, u32 param_4) { sub_8078B5C(pokemon, target, param_3, param_4, 1); } -void HandleGummiItemAction(Entity *pokemon, Entity *target, u8 gummiIndex) +static void HandleGummiItemAction(Entity *pokemon, Entity *target, u8 gummiIndex) { s32 iVar3; EntityInfo *targetInfo; @@ -692,7 +663,7 @@ void HandleGummiItemAction(Entity *pokemon, Entity *target, u8 gummiIndex) targetInfo->IQ = 999; } if (baseIQ == targetInfo->IQ) { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FD644); + TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FD644); } else { iVar5 = currIQ - baseIQ; @@ -714,27 +685,27 @@ void HandleGummiItemAction(Entity *pokemon, Entity *target, u8 gummiIndex) } } -void ProteinItemAction(Entity *pokemon, Entity *target) +static void ProteinItemAction(Entity *pokemon, Entity *target) { RaiseAtkStatTarget(pokemon, target, 3); } -void CalciumItemAction(Entity *pokemon, Entity *target) +static void CalciumItemAction(Entity *pokemon, Entity *target) { RaiseSpAtkStatTarget(pokemon, target, 3); } -void IronItemAction(Entity *pokemon, Entity *target) +static void IronItemAction(Entity *pokemon, Entity *target) { RaiseDefStatTarget(pokemon, target, 3); } -void ZincItemAction(Entity *pokemon, Entity *target) +static void ZincItemAction(Entity *pokemon, Entity *target) { RaiseSpDefStatTarget(pokemon, target, 3); } -void nullsub_94(Entity *pokemon, Entity *target, u8 r2) +static void nullsub_94(Entity *pokemon, Entity *target, u8 r2) {} bool8 sub_8048950(Entity *param_1,Item *item) @@ -748,11 +719,11 @@ bool8 sub_8048950(Entity *param_1,Item *item) moveID = GetItemMoveID(item->id); if ((item->flags & ITEM_FLAG_STICKY)) { - DisplayDungeonMessage(0,*gItemStickyDoesntWorkText,1); + DisplayDungeonMessage(0,gItemStickyDoesntWorkText,1); return FALSE; } else if (IsHMItem(item->id)) { - DisplayDungeonMessage(0,*gPtrCantUseInDungeonMessage,1); + DisplayDungeonMessage(0,gPtrCantUseInDungeonMessage,1); return FALSE; } else @@ -799,13 +770,13 @@ bool8 sub_8048A68(Entity *param_1,Item *item) DungeonMon *pokemon; if ((item->flags & ITEM_FLAG_STICKY)) { - DisplayDungeonMessage(0,*gItemStickyDoesntWorkText,1); + DisplayDungeonMessage(0,gItemStickyDoesntWorkText,1); return FALSE; } else { if (gDungeon->unk644.unk18 == 0) { - DisplayDungeonMessage(0,*gUnknown_80F9BD8,1); + DisplayDungeonMessage(0,gUnknown_80F9BD8,1); return FALSE; } else @@ -860,7 +831,7 @@ bool8 sub_8048B9C(Entity *entity, Item *item) ActionContainer originalAction; if (ItemSticky(item)) { - DisplayDungeonMessage(0,*gItemStickyDoesntWorkText,1); + DisplayDungeonMessage(0,gItemStickyDoesntWorkText,1); return FALSE; } else @@ -922,7 +893,7 @@ bool8 sub_8048B9C(Entity *entity, Item *item) if (ShowDungeonMovesMenu(entity2,1,0,0,1) != 0) { if (ret) { ASM_MATCH_TRICK(ret); - if (DisplayDungeonYesNoMessage(0,*gUnknown_80FECA0,1) == 1) { + if (DisplayDungeonYesNoMessage(0,gUnknown_80FECA0,1) == 1) { *entityActionPtr = originalAction; sub_8044DF0(entity,0,0x6e); SetMonsterActionFields(entityActionPtr,0x2c); @@ -941,29 +912,27 @@ bool8 sub_8048B9C(Entity *entity, Item *item) return ret; } -bool8 sub_8048D50(Entity * pokemon, Item *item) +bool8 sub_8048D50(Entity *pokemon, Item *item) { - EntityInfo *entityInfo; - - entityInfo = GetEntInfo(pokemon); + EntityInfo *entityInfo = GetEntInfo(pokemon); if ((item->flags & ITEM_FLAG_STICKY) != 0) { sub_8045BF8(gFormatBuffer_Items[0], item); - LogMessageByIdWithPopupCheckUser(pokemon,*gItemStickyDoesntWorkText); + LogMessageByIdWithPopupCheckUser(pokemon,gItemStickyDoesntWorkText); return FALSE; } else { if ((entityInfo->muzzled.muzzled == TRUE) && (IsEdibleItem(item->id))) { SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0); - LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FDCA4); + LogMessageByIdWithPopupCheckUser(pokemon,gUnknown_80FDCA4); return FALSE; } } return TRUE; } -void KeyItemAction(Entity *pokemon, Entity *target, u8 r2) +static void KeyItemAction(Entity *pokemon, Entity *target, u8 r2) { u8 temp; if(r2 != 0) @@ -972,7 +941,7 @@ void KeyItemAction(Entity *pokemon, Entity *target, u8 r2) sub_8051E7C(pokemon); } -void GrimyFoodItemAction(Entity *pokemon, Entity * target) +static void GrimyFoodItemAction(Entity *pokemon, Entity * target) { sub_8078B5C(pokemon, target, 0x1E, 0, 1); switch(DungeonRandInt(5)) @@ -996,29 +965,29 @@ void GrimyFoodItemAction(Entity *pokemon, Entity * target) } } -void IcePartItemAction(Entity *pokemon, Entity *target, u8 r2) +static void IcePartItemAction(Entity *pokemon, Entity *target, u8 r2) { - LogMessageByIdWithPopupCheckUser(pokemon, *gPtrIcePartCrumbledMessage); + LogMessageByIdWithPopupCheckUser(pokemon, gPtrIcePartCrumbledMessage); } -void RockPartItemAction(Entity *pokemon, Entity *target, u8 r2) +static void RockPartItemAction(Entity *pokemon, Entity *target, u8 r2) { - LogMessageByIdWithPopupCheckUser(pokemon, *gPtrRockPartCrumbledMessage); + LogMessageByIdWithPopupCheckUser(pokemon, gPtrRockPartCrumbledMessage); } -void SteelPartItemAction(Entity *pokemon, Entity *target, u8 r2) +static void SteelPartItemAction(Entity *pokemon, Entity *target, u8 r2) { - LogMessageByIdWithPopupCheckUser(pokemon, *gPtrSteelPartCrumbledMessage); + LogMessageByIdWithPopupCheckUser(pokemon, gPtrSteelPartCrumbledMessage); } -void WishStoneItemAction(Entity *pokemon, Entity *target, u8 r2) +static void WishStoneItemAction(Entity *pokemon, Entity *target, u8 r2) { - LogMessageByIdWithPopupCheckUser(pokemon, *gPtrWishStoneCrumbledMessage); + LogMessageByIdWithPopupCheckUser(pokemon, gPtrWishStoneCrumbledMessage); } -void MusicBoxItemAction(Entity *pokemon, Entity *target, u8 r2) +static void MusicBoxItemAction(Entity *pokemon, Entity *target, u8 r2) { sub_80421C0(pokemon, 0xD6); - LogMessageByIdWithPopupCheckUser(pokemon, *gPtrMusicBoxPlayedCrumbledMessage); + LogMessageByIdWithPopupCheckUser(pokemon, gPtrMusicBoxPlayedCrumbledMessage); sub_803E708(0x3C, 0x46); } diff --git a/src/dungeon_main.c b/src/dungeon_main.c index 7bf5ddcca..c8d42ae85 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -57,11 +57,9 @@ #include "dungeon_pos_data.h" #include "dungeon_kecleon_shop.h" #include "dungeon_engine.h" +#include "dungeon_item_action.h" extern void HandleUnsetItemAction(Entity *,bool8); -extern bool8 sub_8048A68(Entity *param_1,Item *item); -extern bool8 sub_8048950(Entity *param_1,Item *item); -extern bool8 sub_8048B9C(Entity *param_1,Item *item); extern Item *sub_8044D90(Entity *, s32, u32); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); diff --git a/src/dungeon_menu_team.c b/src/dungeon_menu_team.c index 4e2734a40..edab393e9 100644 --- a/src/dungeon_menu_team.c +++ b/src/dungeon_menu_team.c @@ -30,6 +30,7 @@ #include "dungeon_submenu.h" #include "dungeon_util.h" #include "dungeon_strings.h" +#include "dungeon_info.h" #include "input.h" #include "items.h" #include "menu_input.h" @@ -44,9 +45,6 @@ #include "text_2.h" #include "weather.h" -extern bool8 sub_8048A68(Entity *param_1,Item *item); -extern bool8 sub_8048950(Entity *param_1,Item *item); -extern bool8 sub_8048B9C(Entity *param_1,Item *item); extern Item *sub_8044D90(Entity *, s32, u32); extern void PlayDungeonCancelSE(void); extern void PlayDungeonConfirmationSE(void); @@ -101,7 +99,6 @@ extern u16 sub_8044DC8(Item *param_1); extern bool8 sub_8046F00(Item *item); extern void sub_8045064(void); extern void sub_8070968(u8 *buffer, EntityInfo *entityInfo, s32 colorNum); -extern bool8 CanLeaderSwitch(u8 dungeon); extern void GetAvailTacticsforLvl(u8 *tacticsBuffer, s32 pokeLevel); extern char* sub_808E4FC(s32 a1); extern char* sub_808E51C(s32 a1); diff --git a/src/dungeon_name_banner.c b/src/dungeon_name_banner.c index 5c046bd24..0c079e3f7 100644 --- a/src/dungeon_name_banner.c +++ b/src/dungeon_name_banner.c @@ -15,7 +15,6 @@ #include "text_3.h" extern bool8 sub_80848EC(void); -extern const u8 *GetDungeonName2(u8 dungeon); EWRAM_DATA OpenedFile *gDungeonNameBannerPalette = NULL; static EWRAM_DATA OpenedFile *gDungeonNameBannerFontFile = NULL; diff --git a/src/dungeon_projectile_throw.c b/src/dungeon_projectile_throw.c index 595b0a07e..e0a98f050 100644 --- a/src/dungeon_projectile_throw.c +++ b/src/dungeon_projectile_throw.c @@ -15,11 +15,11 @@ #include "dungeon_message.h" #include "move_util.h" #include "dungeon_strings.h" +#include "dungeon_item_action.h" #include "structs/dungeon_entity.h" #include "constants/move_id.h" extern bool8 sub_8083568(s32 inX, s32 inY, u8 index); -extern void sub_80479B8(char param_1, char param_2, u8 param_3, Entity *pokemon, Entity *target, Item *item); static bool8 CanProjectileHitTarget(Entity *thrower, Entity *target); diff --git a/src/main_loops.c b/src/main_loops.c index 096dc2214..369a99e7a 100644 --- a/src/main_loops.c +++ b/src/main_loops.c @@ -27,6 +27,7 @@ #include "main_loops.h" #include "main_menu1.h" #include "main_menu2.h" +#include "dungeon_info.h" #include "memory.h" #include "moves.h" #include "music.h" @@ -90,7 +91,6 @@ extern u8 sub_80991E0(DungeonSetupInfo *param_1,short *param_2); extern u32 xxx_script_related_8098468(u32); extern void IncrementNumAdventures(void); extern void sub_8096BD0(void); -extern bool8 IsEnterWithoutGameSave(u8 dungeon); static const unkTalkTable sBaseKindTable[17] = { [0] = { .unk0 = 0, .species = MONSTER_PIKACHU }, diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 360a68bd9..c6a6d5ba8 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -33,9 +33,7 @@ struct UnusedOffenseStruct extern SpriteOAM gShadowSprites[3]; // Shadow sprites of some kind -extern void WriteDungeonLocationBits(DataSerializer*, DungeonLocation*); extern void WritePoke1LevelBits(DataSerializer*, struct unkPokeSubStruct_C*); -void ReadDungeonLocationBits(DataSerializer*, DungeonLocation*); void ReadPoke1LevelBits(DataSerializer*, struct unkPokeSubStruct_C*); extern void WriteHiddenPowerBits(DataSerializer*, HiddenPower*); diff --git a/src/run_dungeon.c b/src/run_dungeon.c index b180040a7..98ecebbf7 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -58,7 +58,6 @@ EWRAM_INIT Dungeon *gDungeon = NULL; static EWRAM_INIT u8 *gSerializedData_203B41C = NULL; extern void sub_8068BDC(u8 r0); -extern s16 GetTurnLimit(u8 dungeon); extern void sub_8041888(u8 param_1); extern void sub_803D4AC(void); extern void sub_804513C(void); diff --git a/src/world_map.c b/src/world_map.c index 6389d92d3..e41c93002 100644 --- a/src/world_map.c +++ b/src/world_map.c @@ -27,7 +27,6 @@ #include "world_map.h" extern void WaitForNextFrameAndAdvanceRNG(void); -extern void CopyDungeonName1toBuffer(u8 *buffer, DungeonLocation *dungeonLocation); static EWRAM_INIT struct WorldMap *sWorldMapPtr = NULL; static EWRAM_INIT WindowTemplates sWorldMapWindows = {