diff --git a/include/blow_away.h b/include/blow_away.h new file mode 100644 index 000000000..34ac7c3a8 --- /dev/null +++ b/include/blow_away.h @@ -0,0 +1,10 @@ +#ifndef GUARD_BLOW_AWAY_H +#define GUARD_BLOW_AWAY_H + +#include "structs/str_position.h" +#include "structs/dungeon_entity.h" + +void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction); +void sub_807D068(Entity *pokemon, DungeonPos *pos); + +#endif // GUARD_BLOW_AWAY_H diff --git a/include/code_803D110.h b/include/code_803D110.h index f2a9993ad..18346e13f 100644 --- a/include/code_803D110.h +++ b/include/code_803D110.h @@ -7,6 +7,5 @@ void sub_803E02C(void); void sub_803E13C(void); void sub_803E178(void); void sub_803E214(void); -void sub_803E250(void); #endif // GUARD_CODE_803D110_H diff --git a/include/code_803E724.h b/include/code_803E724.h deleted file mode 100644 index 069ead6bc..000000000 --- a/include/code_803E724.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef GUARD_CODE_803E724_H -#define GUARD_CODE_803E724_H - -#include "structs/str_position.h" - -void sub_803EAF0(u32 kind, u8 *name); -bool8 sub_803F428(DungeonPos *pos); - -#endif // GUARD_CODE_803E724_H \ No newline at end of file diff --git a/include/code_807CD9C.h b/include/code_807CD9C.h deleted file mode 100644 index 380747ec2..000000000 --- a/include/code_807CD9C.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef CODE_807CD9C_H -#define CODE_807CD9C_H - -void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction); -void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos); -void sub_807D3CC(Entity *param_1); - -#endif /* ifndef CODE_807CD9C_H */ diff --git a/include/code_8085E98.h b/include/code_8085E98.h deleted file mode 100644 index e0131f824..000000000 --- a/include/code_8085E98.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef GUARD_CODE_8085E98_H -#define GUARD_CODE_8085E98_H - -void sub_8085E98(void); - -#endif diff --git a/include/code_80861A8.h b/include/code_80861A8.h deleted file mode 100644 index 99ebea5cc..000000000 --- a/include/code_80861A8.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GUARD_CODE_80861A8_H -#define GUARD_CODE_80861A8_H - -#include "structs/dungeon_entity.h" - -void sub_80861A8(Entity *a0); -void sub_80861B8(Entity *a0, u8 r1, s32 direction); -void sub_80861D4(Entity *a0, u8 r1, s32 direction); - -#endif diff --git a/include/code_80869E4.h b/include/code_80869E4.h deleted file mode 100644 index a5d9ebce6..000000000 --- a/include/code_80869E4.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef GUARD_CODE_80869E4_H -#define GUARD_CODE_80869E4_H - -#include "structs/dungeon_entity.h" -#include "dungeon_message.h" - -// size: 0x8 -typedef struct unkStruct_202F3D0 -{ - u8 unk0; - u8 unk1; - u8 unk2; - u8 unk3; - u8 unk4; - u8 unk5; -} unkStruct_202F3D0; - -void SpriteLookAroundEffect(Entity *entity); -void SpriteShockEffect(Entity *entity); - -void sub_8086448(void); -void sub_8086500(void); -void sub_808654C(void); -void sub_8086598(void); -void sub_80865E8(void); -void sub_808663C(void); -void sub_8086690(void); -void sub_80866C4(const struct DungeonDialogueStruct *dialogue); -void sub_8086738(void); -void sub_8086764(void); -void sub_8086794(void); -void sub_80867F4(void); -void sub_808680C(void); -void sub_808682C(void); -void sub_8086838(u8 entity, u8, u8); -void sub_8086848(u8 entity, u8); -void sub_8086854(void); -void sub_80868F4(Entity *entity); -void sub_8086910(Entity *entity); -void sub_808692C(void); -void sub_80869E4(struct Entity *entity, s32 a1, u8 a2, s32 _someDirection); - -#endif // GUARD_CODE_80869E4_H diff --git a/include/constants/dungeon_action.h b/include/constants/dungeon_action.h index f092e1a5e..edd1d28b1 100644 --- a/include/constants/dungeon_action.h +++ b/include/constants/dungeon_action.h @@ -60,18 +60,4 @@ enum DungeonAction NUM_DUNGEON_ACTIONS }; -// size: 0x4 -typedef struct SubMenuAction -{ - u16 actionId; - u8 unk2; - bool8 canBeChosen; -} SubMenuAction; - -extern SubMenuAction gDungeonSubMenu[10]; -extern s32 gDungeonSubMenuItemsCount; - -void AddActionToDungeonSubMenu(u16 actionId, u8 param_2); -void SetActionUnusableInDungeonSubMenu(u16 actionId); - #endif diff --git a/include/drought_orb.h b/include/drought_orb.h new file mode 100644 index 000000000..cd6707710 --- /dev/null +++ b/include/drought_orb.h @@ -0,0 +1,8 @@ +#ifndef GUARD_DROUGHT_ORB_H +#define GUARD_DROUGHT_ORB_H + +#include "structs/dungeon_entity.h" + +void HandleDroughtOrb(Entity *pokemon, Entity *target); + +#endif // GUARD_DROUGHT_ORB_H diff --git a/include/dungeon_action.h b/include/dungeon_action.h index b9f02a3c8..19b2ebb1f 100644 --- a/include/dungeon_action.h +++ b/include/dungeon_action.h @@ -2,10 +2,37 @@ #define GUARD_DUNGEON_ACTION_H #include "structs/dungeon_entity.h" +#include "structs/str_items.h" +// size: 0x4 +typedef struct SubMenuAction +{ + u16 actionId; + u8 unk2; + bool8 canBeChosen; +} SubMenuAction; + +void SetLeaderActionToNothing(bool8 clearActionFields); void SetLeaderActionFields(u16 action); void ClearMonsterActionFields(ActionContainer *actionPointer); void SetMonsterActionFields(ActionContainer *actionPointer, u16 action); void SetActionPassTurnOrWalk(ActionContainer *actionPointer, s16 species); +Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3); +bool8 sub_8044D40(ActionContainer *param_1,s32 index); +Item *sub_8044D90(Entity *entity, s32 index, s32 unused); +Entity *sub_8044DA4(Entity *entity, s32 index); +u16 sub_8044DC8(Item *param_1); +void sub_8044DF0(Entity *entity, s32 index, u32 unused); +void sub_8044E24(Entity *entity,int index,u32 unused); +const u8 *GetDungeonSubMenuItemString(s32 param_1); +bool8 CanSubMenuItemBeChosen(s32 itemId); +void AddActionToDungeonSubMenu(u16 actionId, u8 param_2); +s32 ActionToDungeonSubMenuId(u16 actionId); +void SetActionUnusableInDungeonSubMenu(u16 actionId); +bool8 IsNotAttacking(Entity *param_1, bool8 param_2); +void sub_8045064(void); + +extern SubMenuAction gDungeonSubMenu[10]; +extern s32 gDungeonSubMenuItemsCount; #endif diff --git a/include/dungeon_action_execution.h b/include/dungeon_action_execution.h new file mode 100644 index 000000000..530b579b4 --- /dev/null +++ b/include/dungeon_action_execution.h @@ -0,0 +1,8 @@ +#ifndef GUARD_DUNGEON_ACTION_EXECUTION_H +#define GUARD_DUNGEON_ACTION_EXECUTION_H + +#include "structs/dungeon_entity.h" + +bool8 ExecuteEntityDungeonAction(Entity *entity); + +#endif diff --git a/include/dungeon_ai_leader.h b/include/dungeon_ai_leader.h index 31d468dc2..a66e5804e 100644 --- a/include/dungeon_ai_leader.h +++ b/include/dungeon_ai_leader.h @@ -5,6 +5,5 @@ bool8 TargetLeader(Entity *pokemon); Entity* GetLeaderIfVisible(Entity *pokemon); -bool8 sub_8072CF4(Entity *entity); #endif diff --git a/include/dungeon_cleared_window.h b/include/dungeon_cleared_window.h new file mode 100644 index 000000000..c5648873b --- /dev/null +++ b/include/dungeon_cleared_window.h @@ -0,0 +1,6 @@ +#ifndef GUARD_CLEARED_WINDOW_H +#define GUARD_CLEARED_WINDOW_H + +void ShowDungeonClearedWindow(void); + +#endif // GUARD_CLEARED_WINDOW_H diff --git a/include/dungeon_cutscene.h b/include/dungeon_cutscene.h new file mode 100644 index 000000000..18f14c36c --- /dev/null +++ b/include/dungeon_cutscene.h @@ -0,0 +1,80 @@ +#ifndef GUARD_DUNGEON_CUTSCENE_H +#define GUARD_DUNGEON_CUTSCENE_H + +#include "structs/str_position.h" +#include "structs/dungeon_entity.h" +#include "dungeon_message.h" + +typedef void (*DungeonCallback)(Entity *); +typedef struct struct_8085B80 { + u8 unk0; + Entity *unk4; + s32 unk8; + s16 *unkC; +} struct_8085B80; + +void sub_80847D4(void); +bool8 ShouldShowDungeonBanner(void); +void sub_80848F0(void); +void DisplayPreFightDialogue(void); +void sub_8084E00(Entity *entity, u8 param_2, u8 param_3); +void sub_8085140(void); +bool8 sub_808529C(s32 speciesId_); +void sub_8085374(void); +Entity *CutsceneGetLeader(void); +Entity *CutsceneGetPartner(void); +void sub_80854D4(void); +void sub_80855E4(DungeonCallback func); +void sub_808563C(DungeonCallback func); +Entity *GetEntityFromMonsterBehavior(u8 entityType); +void sub_80856C8(Entity * pokemon, s32 x, s32 y); +void sub_80856E0(Entity * pokemon, s32 direction); +void sub_8085860(s32 x, s32 y); +void ShiftCameraToPosition(PixelPos *posStruct, s32 cameraSteps); +void SetFacingDirection(Entity *pokemon, s32 direction); +void sub_8085930(s32 direction); +bool8 ShouldRunMonsterAI(Entity *pokemon); +void sub_8085B4C(struct_8085B80 a0[], s16 *a1[], Entity *a2[], s32 a3); +bool8 sub_8085B80(struct_8085B80 *a0); +void SetDungeonBGColorRGB(s32 r, s32 g, s32 b, bool8 a3, bool8 a4); +void sub_8085E98(void); +void sub_8085EB0(void); +u32 sub_8085EC8(s16 param_1,u32 param_2,u32 param_3,DungeonPos *param_4, bool32 param_5); +void sub_8085F44(s32 param_1); +void sub_8085F78(void); +bool8 sub_80860A8(u8 id); +void sub_8086130(void); +void sub_80861A8(Entity *a0); +void sub_80861B8(Entity *a0, u8 r1, s32 direction); +void sub_80861D4(Entity *a0, u8 r1, s32 direction); +s32 sub_80861F8(s32 param_1,Entity *param_2,bool32 param_3); +void SpriteShockEffect(Entity *entity); +void sub_8086448(void); +void sub_8086500(void); +void sub_808654C(void); +void sub_8086598(void); +void sub_80865E8(void); +void sub_808663C(void); +void sub_8086690(void); +void sub_80866C4(const struct DungeonDialogueStruct *dialogue); +void sub_8086738(void); +void sub_8086764(void); +void sub_8086794(void); +void sub_80867F4(void); +void sub_808680C(void); +void sub_808682C(void); +void sub_8086838(u8 entity, u8 r1, u8 r2); +void sub_8086848(u8 entity, u8 r1); +void sub_8086854(void); +void sub_80868F4(Entity *entity); +void sub_8086910(Entity *entity); +void sub_808692C(void); +void SpriteLookAroundEffect(Entity *entity); +void sub_80869E4(struct Entity *entity, s32 a1, u8 a2, s32 _someDirection); +void sub_8086A3C(Entity *pokemon); +void sub_8086A54(Entity *pokemon); +void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); +void sub_8086AC0(void); +u8 sub_8086AE4(s16 _index); + +#endif diff --git a/include/dungeon_cutscenes.h b/include/dungeon_cutscenes.h index 8a190c10c..36ca6ef9c 100644 --- a/include/dungeon_cutscenes.h +++ b/include/dungeon_cutscenes.h @@ -1,5 +1,7 @@ -#ifndef GUARD_DUNGEON_CUTSCENE_H -#define GUARD_DUNGEON_CUTSCENE_H +#ifndef GUARD_DUNGEON_CUTSCENES_H +#define GUARD_DUNGEON_CUTSCENES_H + +// TODO: Remove this file #include "structs/dungeon_entity.h" @@ -139,4 +141,4 @@ void sub_808CBB0(void); void sub_808CD44(void); void sub_808CD9C(void); -#endif /* ifndef GUARD_DUNGEON_CUTSCENE_H */ +#endif /* ifndef GUARD_DUNGEON_CUTSCENES_H */ diff --git a/include/dungeon_engine.h b/include/dungeon_engine.h index d3d90a252..cc3efbe1d 100644 --- a/include/dungeon_engine.h +++ b/include/dungeon_engine.h @@ -1,11 +1,18 @@ #ifndef GUARD_DUNGEON_ENGINE_H #define GUARD_DUNGEON_ENGINE_H +#include "structs/str_position.h" #include "structs/dungeon_entity.h" +#include "structs/menu.h" extern const s16 gSpeedTurns[NUM_SPEED_COUNTERS][25]; void RunFractionalTurn(bool8 param_1); +void sub_80444F4(Entity *pokemon); bool8 IsFloorOver(void); +bool8 sub_8044B84(void); + +extern DungeonPos gLeaderPosition; +extern MenuInputStruct gDungeonMenu; #endif diff --git a/include/dungeon_spawns.h b/include/dungeon_floor_spawns.h similarity index 80% rename from include/dungeon_spawns.h rename to include/dungeon_floor_spawns.h index d665bec4d..d8300a588 100644 --- a/include/dungeon_spawns.h +++ b/include/dungeon_floor_spawns.h @@ -1,5 +1,5 @@ -#ifndef GUARD_DUNGEON_SPAWNS_H -#define GUARD_DUNGEON_SPAWNS_H +#ifndef GUARD_DUNGEON_FLOOR_SPAWNS_H +#define GUARD_DUNGEON_FLOOR_SPAWNS_H #include "structs/str_spawn_pokemon_data.h" @@ -14,4 +14,4 @@ bool8 CanMonsterBeSpawnedHere(s16 speciesToFind); s16 GetRandomFloorMonsterId(s32 arrId); s32 GetSpawnedMonsterLevel(s32 species); -#endif // GUARD_DUNGEON_SPAWNS_H +#endif // GUARD_DUNGEON_FLOOR_SPAWNS_H 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/include/dungeon_kecleon_shop.h b/include/dungeon_kecleon_shop.h new file mode 100644 index 000000000..48b6d060b --- /dev/null +++ b/include/dungeon_kecleon_shop.h @@ -0,0 +1,8 @@ +#ifndef GUARD_DUNGEON_KECLEON_SHOP_H +#define GUARD_DUNGEON_KECLEON_SHOP_H + +void sub_807EC28(bool8 arg0); +bool8 sub_807EF48(void); +void sub_807EF84(void); + +#endif // GUARD_DUNGEON_KECLEON_SHOP_H diff --git a/include/dungeon_leader.h b/include/dungeon_leader.h deleted file mode 100644 index abd4dedb0..000000000 --- a/include/dungeon_leader.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef GUARD_DUNGEON_LEADER_H -#define GUARD_DUNGEON_LEADER_H - -#include "structs/dungeon_entity.h" - -Entity* GetLeader(void); -EntityInfo* GetLeaderInfo(void); - -#endif // GUARD_DUNGEON_LEADER_H \ No newline at end of file diff --git a/include/dungeon_leveling.h b/include/dungeon_leveling.h new file mode 100644 index 000000000..5447819bc --- /dev/null +++ b/include/dungeon_leveling.h @@ -0,0 +1,13 @@ +#ifndef GUARD_DUNGEON_LEVELING_H +#define GUARD_DUNGEON_LEVELING_H + +#include "structs/dungeon_entity.h" + +void AddExpPoints(Entity *pokemon, Entity *target, s32 exp); +void EnemyEvolution(Entity *entity); +void LevelUpTarget(Entity *pokemon, Entity *target, s32 level, u8 param_4, u8 param_5); +void LevelDownTarget(Entity *pokemon, Entity *target, u32 level); +bool8 sub_8072938(Entity *target, u16 moveId); +void sub_8072AC8(s16 *param_1, s32 species, s32 param_3); + +#endif diff --git a/include/dungeon_map_access.h b/include/dungeon_map_access.h index fffa44244..f52c3d40b 100644 --- a/include/dungeon_map_access.h +++ b/include/dungeon_map_access.h @@ -5,10 +5,6 @@ const Tile *GetTile(s32 x, s32 y); Tile *GetTileMut(s32 x, s32 y); - -void UpdateTrapsVisibility(void); -void DiscoverMinimap(DungeonPos *pos); - void sub_80495E4(void); void LoadDungeonTilesetAssets(void); void sub_8049820(void); @@ -17,22 +13,24 @@ void sub_8049884(void); void sub_80498A8(s32 x, s32 y); void sub_8049B8C(void); void sub_8049BB0(s32 x, s32 y); +void UpdateTrapsVisibility(void); void sub_804A1F0(s32 a0, s32 a1); void sub_804A49C(s32 a0, s32 a1); void ChangeDungeonCameraPos(DungeonPos *pos, s32 a1, u8 a2, u8 a3); void sub_804AA60(void); void sub_804AAAC(void); void sub_804AAD4(void); +void DiscoverMinimap(DungeonPos *pos); +bool8 PosHasItem(DungeonPos *pos); +Entity *GetMonsterAtPos(DungeonPos *pos); +bool8 sub_804AD34(DungeonPos *pos); +bool8 sub_804AE08(DungeonPos *pos); +void sub_804AE84(DungeonPos *pos); +bool8 IsTileGround(Tile *tile); +bool8 IsWaterTileset(void); #define DUNGEON_WATER_TYPE_NONE 0 #define DUNGEON_WATER_TYPE_LAVA 1 #define DUNGEON_WATER_TYPE_WATER 2 -extern const u8 gDungeonWaterType[76]; - -bool8 sub_804AD34(DungeonPos *pos); -void sub_804AE84(DungeonPos *pos); -bool8 IsTileGround(Tile *tile); -bool8 IsWaterTileset(void); - #endif // GUARD_DUNGEON_MAP_ACCESS_H diff --git a/include/dungeon_menu_team.h b/include/dungeon_menu_team.h index 56b963178..2031ad334 100644 --- a/include/dungeon_menu_team.h +++ b/include/dungeon_menu_team.h @@ -13,4 +13,6 @@ void ShowStatusesDescriptionMenu(s32 count, STATUSTEXTS(statuses)); #define WHICH_MENU_ITEMS 2 Entity *ShowDungeonToWhichMonMenu(s32 *teamId, s32 caseId); +extern s32 gTeamMenuChosenId; + #endif // GUARD_DUNGEON_MENU_TEAM_H diff --git a/include/dungeon_message.h b/include/dungeon_message.h index 67ba61848..54e7b1ab0 100644 --- a/include/dungeon_message.h +++ b/include/dungeon_message.h @@ -27,6 +27,8 @@ struct DungeonDialogueStruct const u8 *str; }; +extern bool8 gUnknown_203B434; + void sub_80521D0(void); void sub_8052210(bool8 a0); diff --git a/include/dungeon_misc.h b/include/dungeon_misc.h index 4b5b018d8..8c6a3eb0d 100644 --- a/include/dungeon_misc.h +++ b/include/dungeon_misc.h @@ -70,8 +70,7 @@ void sub_806A898(Entity *entity, bool8 r7, bool8 showRunAwayEffect); void sub_806A914(bool8 a0, bool8 a1, bool8 showRunAwayEffect); void sub_806A974(void); void sub_806A9B4(Entity *entity, s32 moveIndex); -// s16 memes -//bool8 sub_806AA0C(s16 _species, bool32 _a1); +bool8 sub_806AA0C(s32 _species, bool32 _a1); void sub_806AA70(void); void sub_806AB2C(void); void EndAbilityImmuneStatus(Entity *attacker, Entity *target); diff --git a/include/dungeon_mon_spawn.h b/include/dungeon_mon_spawn.h new file mode 100644 index 000000000..4c0ed2024 --- /dev/null +++ b/include/dungeon_mon_spawn.h @@ -0,0 +1,32 @@ +#ifndef GUARD_DUNGEON_MON_SPAWN_H +#define GUARD_DUNGEON_MON_SPAWN_H + +#include "structs/dungeon_entity.h" +#include "structs/str_pokemon.h" + +struct MonSpawnInfo +{ + s16 species; + u8 unk2; + u32 unk4; + s16 level; + DungeonPos pos; + u8 unk10; +}; + +void sub_806AD3C(void); +void sub_806B168(void); +void sub_806B404(void); +void sub_806B678(void); +void SpawnWildMonsOnFloor(void); +Entity* SpawnWildMon(struct MonSpawnInfo *monSpawnInfo, bool8 a1); +bool8 SpawnTeamMember(s16 _species, s32 x, s32 y, DungeonMon *monPtr, Entity **a4, bool32 _a5, u32 _a6); +void UpdateEntitySpecies(Entity *entity, s32 _species); +void ResetMonEntityData(EntityInfo *entInfo, bool8 setStatsToOne); +void sub_806C1D8(void); +void sub_806C264(s32 teamIndex, EntityInfo *entInfo); +void sub_806C330(s32 _x, s32 _y, s16 _species, u32 _a3); +void sub_806C3C0(void); +void sub_806C42C(void); + +#endif diff --git a/include/dungeon_music.h b/include/dungeon_music.h index 366f9e294..0ea9b9844 100644 --- a/include/dungeon_music.h +++ b/include/dungeon_music.h @@ -1,17 +1,26 @@ #ifndef GUARD_DUNGEON_MUSIC_H #define GUARD_DUNGEON_MUSIC_H -u16 DungeonGetCurrentBGSong(void); +void PlayDungeonCursorSE(bool8 checkMenuEntriesCount); +void PlayDungeonConfirmationSE(void); +void sub_8083D1C(void); +void PlayDungeonCancelSE(void); +void PlayDungeonStartButtonSE(void); +void sub_8083D58(void); +void sub_8083D68(void); +void sub_8083D78(void); +void sub_8083D88(void); +void PlayDungeonFailBGM(void); +void PlayDungeonCompleteBGM(void); +void sub_8083E28(void); +void PlaySoundEffect(u32 songIndex); +void StopSoundEffect(u32 songIndex); +bool8 IsFanfareSEPlaying_2(u16 songIndex); +void DungeonStartNewBGM(u16 songIndex); void DungeonFadeInNewBGM(u16 songIndex, u32 fadeInSpeed); void DungeonFadeOutBGM(u16 speed); -void DungeonStartNewBGM(u16 songIndex); void DungeonStopBGM(void); -bool8 IsFanfareSEPlaying_2(u16 songIndex); -void PlayDungeonCursorSE(bool8 checkMenuEntriesCount); -void PlayDungeonStartButtonSE(void); -void PlaySoundEffect(u32 songIndex); void StopDungeonBGM(void); -void StopSoundEffect(u32 songIndex); void UpdateDungeonMusic(void); #endif // GUARD_DUNGEON_MUSIC_H diff --git a/include/dungeon_name_banner.h b/include/dungeon_name_banner.h index 532ea750d..60a75ebb3 100644 --- a/include/dungeon_name_banner.h +++ b/include/dungeon_name_banner.h @@ -1,6 +1,10 @@ #ifndef GUARD_DUNGEON_NAME_BANNER_H #define GUARD_DUNGEON_NAME_BANNER_H +#include "structs/str_file_system.h" + void ShowDungeonNameBanner_Async(void); +extern OpenedFile *gDungeonNameBannerPalette; + #endif diff --git a/include/dungeon_range.h b/include/dungeon_range.h index 9659a29a2..cf726f30b 100644 --- a/include/dungeon_range.h +++ b/include/dungeon_range.h @@ -2,9 +2,20 @@ #define GUARD_DUNGEON_RANGE_H #include "structs/str_position.h" +#include "structs/dungeon_entity.h" bool8 IsPositionActuallyInSight(DungeonPos *pos1, DungeonPos *pos2); bool8 IsPositionInSight(DungeonPos *pos1, DungeonPos *pos2); +void sub_80833E8(DungeonPos *param_1, s32 *param_2); bool8 IsTargetTwoTilesAway(DungeonPos *pos1, DungeonPos *pos2); +bool8 sub_8083568(s32 inX, s32 inY, u8 index); +Entity* GetLeader(void); +EntityInfo* GetLeaderInfo(void); +bool8 sub_8083660(DungeonPos *posDst); +bool8 sub_808384C(DungeonPos *posDst, const DungeonPos *posSrc); +void sub_80838EC(u8 *a0); +void sub_8083904(struct DungeonPos *posDst, struct Entity *entityArg); + +extern Entity *gLeaderPointer; #endif diff --git a/include/dungeon_tilemap.h b/include/dungeon_tilemap.h new file mode 100644 index 000000000..5495a7f44 --- /dev/null +++ b/include/dungeon_tilemap.h @@ -0,0 +1,19 @@ +#ifndef GUARD_DUNGEON_TILEMAP_H +#define GUARD_DUNGEON_TILEMAP_H + +#include "structs/str_position.h" +#include "structs/dungeon_entity.h" + +void sub_803F27C(bool8 a0); +bool8 sub_803F428(DungeonPos *pos); +void sub_803F4A0(Entity *a0); +void PointCameraToMonster(Entity *a0); +void UpdateCamera(u8 a0); +void sub_803F878(s32 a0, s32 a1); +s32 GetCameraXPos(void); +s32 GetCameraYPos(void); +void sub_803F9CC(void); +void HandleLuminousOrbAction(Entity *pokemon); +void sub_8040094(u8 r0); + +#endif // GUARD_DUNGEON_TILEMAP_H diff --git a/include/dungeon_turn_effects.h b/include/dungeon_turn_effects.h new file mode 100644 index 000000000..157701e88 --- /dev/null +++ b/include/dungeon_turn_effects.h @@ -0,0 +1,9 @@ +#ifndef GUARD_DUNGEON_TURN_EFFECTS_H +#define GUARD_DUNGEON_TURN_EFFECTS_H + +#include "structs/dungeon_entity.h" + +void ApplyEndOfTurnEffects(Entity *entity); +void TickStatusAndHealthRegen(Entity *entity); + +#endif diff --git a/include/dungeon_util.h b/include/dungeon_util.h index 0b5e522c6..0d9c4bb71 100644 --- a/include/dungeon_util.h +++ b/include/dungeon_util.h @@ -5,6 +5,7 @@ #include "structs/dungeon_entity.h" #include "structs/str_position.h" #include "structs/str_traps.h" +#include "structs/str_dungeon.h" #include "structs/map.h" static inline EntityInfo *GetEntInfo(Entity *entity) @@ -35,4 +36,7 @@ bool8 CanTargetPosition(Entity *entity, DungeonPos *pos); void SubstitutePlaceholderStringTags(u8 *buffer, Entity *entity, u32 param_3); void sub_8045ACC(void); +extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE]; +extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE]; + #endif // GUARD_DUNGEON_UTIL_H diff --git a/include/dungeon_util_1.h b/include/dungeon_util_1.h deleted file mode 100644 index 2ace77a58..000000000 --- a/include/dungeon_util_1.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef GUARD_DUNGEON_UTIL_1_H -#define GUARD_DUNGEON_UTIL_1_H - -#include "structs/dungeon_entity.h" - -typedef void (*DungeonCallback)(Entity *); -typedef struct struct_8085B80 { - u8 unk0; - Entity *unk4; - s32 unk8; - s16 *unkC; -} struct_8085B80; - -Entity *xxx_call_GetLeader(void); -Entity *GetPartnerEntity(void); -void sub_80854D4(void); -void sub_80855E4(DungeonCallback func); -void sub_808563C(DungeonCallback func); -Entity *GetEntityFromMonsterBehavior(u8 entityType); -void sub_80856C8(Entity * pokemon, s32 x, s32 y); -void sub_80856E0(Entity * pokemon, s32 direction); -void sub_8085764(void); -void sub_8085860(s32 x, s32 y); -void ShiftCameraToPosition(PixelPos *posStruct, s32 cameraSteps); -void SetFacingDirection(Entity *pokemon, s32 direction); -void sub_8085930(s32 direction); -void sub_80859F0(s32 direction); -bool8 ShouldRunMonsterAI(Entity *entity); -void sub_8085B4C(struct_8085B80 a0[], s16 *a1[], Entity *a2[], s32 a3); -void sub_80857B8(void); - -#endif // GUARD_DUNGEON_UTIL_1_H diff --git a/include/dungeon_vram.h b/include/dungeon_vram.h index 035bae4c0..f1d86d487 100644 --- a/include/dungeon_vram.h +++ b/include/dungeon_vram.h @@ -1,15 +1,50 @@ #ifndef GUARD_DUNGEON_VRAM_H #define GUARD_DUNGEON_VRAM_H -// TODO: copy stuff from dungeon_vram.c to this header - -extern u8 gUnknown_203B40D; - #include "structs/str_text.h" +#include "structs/sprite_oam.h" +#include "structs/str_position.h" +#include "structs/dungeon_entity.h" +void sub_803E250(void); +void DungeonRunFrameActions(u32 a0); void sub_803E668(u32 unused); void sub_803E708(s32 numFrames, u32 a1); +void sub_803E724(s32 r0); +void sub_803E748(void); +void sub_803E7C8(void); +void sub_803E830(void); +void sub_803E874(bool8 r10, s32 r9); +void BgColorCallNullsub4(void); +void sub_803EA10(void); +void sub_803EAF0(u32 kind, u8 *name); void DungeonShowWindows(const WindowTemplates *winTemplates, bool8 a1); -void DungeonRunFrameActions(u32); +void sub_803ED30(s32 a0, Entity *mon, u8 a2, s32 a3); + +struct unkStruct_202ED28 +{ + SpriteOAM sprite; + DungeonPos pos; +}; + +struct UnkStruct_202EDE8 +{ + s16 unk0; + s16 unk2; + Entity *unk4; + s32 unk8; + s32 unkC; + s32 unk10; +}; + +extern struct unkStruct_202ED28 gUnknown_202ED28[][6]; +extern SpriteOAM gUnknown_202EDC0; +extern s32 gDungeonBrightness; +extern s32 gDungeonFramesCounter; +extern s32 gUnknown_202EDD0; +extern struct UnkStruct_202EDE8 gUnknown_202EDE8; + +extern u8 gUnknown_203B40C; +extern u8 gUnknown_203B40D; #endif // GUARD_DUNGEON_VRAM_H diff --git a/include/explosion.h b/include/explosion.h new file mode 100644 index 000000000..b3bdc4447 --- /dev/null +++ b/include/explosion.h @@ -0,0 +1,9 @@ +#ifndef GUARD_EXPLOSION_H +#define GUARD_EXPLOSION_H + +#include "structs/str_position.h" +#include "structs/dungeon_entity.h" + +void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 param_4,u8 moveType,s16 param_6); + +#endif // GUARD_EXPLOSION_H diff --git a/include/expose_trap.h b/include/expose_trap.h new file mode 100644 index 000000000..fb9640170 --- /dev/null +++ b/include/expose_trap.h @@ -0,0 +1,9 @@ +#ifndef GUARD_EXPOSE_TRAP_H +#define GUARD_EXPOSE_TRAP_H + +#include "structs/dungeon_entity.h" + +void sub_807D3CC(Entity *param_1); +bool8 ExposeTrap(s32 x,s32 y); + +#endif // GUARD_EXPOSE_TRAP_H diff --git a/include/game_options.h b/include/game_options.h index e01506673..ecf027a69 100644 --- a/include/game_options.h +++ b/include/game_options.h @@ -1,6 +1,8 @@ #ifndef GUARD_GAME_OPTIONS_H #define GUARD_GAME_OPTIONS_H +#include "data_serializer.h" + enum DungeonSpeed { DUNGEON_SPEED_SLOW, @@ -66,10 +68,16 @@ typedef struct GameOptions extern GameOptions *gGameOptionsRef; -GameOptions *GetGameOptions(void); -bool8 GameOptionsNotChange(GameOptions *newOptions); -void InitializeGameOptions(bool8 initializeGender); void LoadGameOptions(void); +GameOptions *GetGameOptions(void); +void InitializeGameOptions(bool8 initializeGender); +bool8 GameOptionsNotChange(GameOptions *newOptions); +void WriteGameOptionsBits(DataSerializer *param_1); +void ReadGameOptionsBits(DataSerializer *param_1); void SetWindowBGColor(void); +bool8 GameOptions_ShowMiniMap(void); +bool8 GameOptions_IsTransparentMiniMap(void); +void GameOptions_SetTransparentMiniMap(void); +bool8 sub_8094D14(void); #endif // GUARD_GAME_OPTIONS_H diff --git a/include/hurl_orb.h b/include/hurl_orb.h new file mode 100644 index 000000000..f75dfa66f --- /dev/null +++ b/include/hurl_orb.h @@ -0,0 +1,8 @@ +#ifndef GUARD_HURL_ORB_H +#define GUARD_HURL_ORB_H + +#include "structs/dungeon_entity.h" + +void HandleHurlOrb(Entity *target, Entity *attacker); + +#endif // GUARD_HURL_ORB_H diff --git a/include/move_orb_actions_1.h b/include/move_orb_actions_1.h index 2b9548570..4d33225fc 100644 --- a/include/move_orb_actions_1.h +++ b/include/move_orb_actions_1.h @@ -79,5 +79,7 @@ bool8 RapidSpinMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param bool8 SureShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); bool8 CosmicPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); +extern const s32 gStatIndexAtkDef; +extern const s32 gStatIndexSpecial; #endif /* ifndef GUARD_MOVE_ORB_ACTIONS_1_H */ diff --git a/include/one_room_orb.h b/include/one_room_orb.h new file mode 100644 index 000000000..6e361006f --- /dev/null +++ b/include/one_room_orb.h @@ -0,0 +1,8 @@ +#ifndef GUARD_ONE_ROOM_ORB_H +#define GUARD_ONE_ROOM_ORB_H + +#include "structs/dungeon_entity.h" + +void HandleOneRoomOrb(Entity *pokemon, Entity *target); + +#endif // GUARD_ONE_ROOM_ORB_H diff --git a/include/pokemon.h b/include/pokemon.h index e9b8ea12a..92a003c75 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -37,24 +37,44 @@ extern RecruitedMon *gRecruitedPokemonRef; void LoadMonsterParameters(void); RecruitedMon *GetRecruitedPokemon(void); void InitializeRecruitedPokemon(void); - - -u8 GetBodySize(s32 index); -void CopyMonsterNameToBuffer(u8 * buffer, s32 index); -void CopyYellowMonsterNametoBuffer(u8 *buffer, s16 index); -void CopyCyanMonsterNametoBuffer(u8 *buffer, s32 index_); -void PrintColoredPokeNameToBuffer(u8 *buffer, Pokemon *pokemon, s32 colorNum); -void sub_808D930(u8 *buffer, s32 index); -void sub_808D9DC(u8 *buffer, DungeonMon *, s32 colorNum); -void sub_808DA0C(u8 *buffer, DungeonMon *); +void sub_808CE74(s16 _species, bool32 _isLeader, u8* name); +void CreateLevel1Pokemon(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, const DungeonLocation *location, u16 *moves); +void sub_808D0D8(Pokemon *pokemon); +void ConvertStoryMonToPokemon(Pokemon *dst, const struct StoryMonData *src); +Pokemon *TryAddPokemonToRecruited(Pokemon*); +Pokemon *sub_808D278(s32 species); +Pokemon *TryAddLevel1PokemonToRecruited(s32 species, u8 *name, u32 _itemID, const DungeonLocation *location, u16 *moveID); +void sub_808D31C(Pokemon *param_1); +Pokemon *GetPlayerPokemonStruct(void); +Pokemon *sub_808D378(void); +Pokemon *sub_808D3BC(void); +Pokemon *sub_808D3F8(void); +Pokemon *GetRecruitedMonBySpecies(s16 species_, s32 sameSpeciesCounter); +s32 GetFriendSum_808D480(void); +bool8 sub_808D4B0(void); +bool8 sub_808D500(void); +s32 GetUnitSum_808D544(s32 *team); +s32 sub_808D580(s32 *team); +s32 sub_808D654(s32 *ptr); +s32 sub_808D6A4(s32 *ptr); +bool8 sub_808D750(s32 index_); void PeekPokemonItem(s16 index_, BulkItem* item); void GivePokemonItem(s16 index_, BulkItem* item); bool8 IsPokemonRenamed(Pokemon* pokemon); -bool8 CanMonLearnMove(u16 moveID, s16 _species); - -u8 *GetCategoryString(s16 index); -u8 GetShadowSize(s16 index); +bool8 ComparePokemonNames(s16, s16); +void CopyMonsterNameToBuffer(u8 * buffer, s32 index); +void CopyYellowMonsterNametoBuffer(u8 *buffer, s16 index); +void CopyCyanMonsterNametoBuffer(u8 *buffer, s32 index_); +void sub_808D930(u8 *buffer, s32 index); char * GetMonSpecies(s16 index); +void PrintColoredPokeNameToBuffer(u8 *buffer, Pokemon *pokemon, s32 colorNum); +void sub_808D9DC(u8 *buffer, DungeonMon *, s32 colorNum); +void sub_808DA0C(u8 *buffer, DungeonMon *); +void PrintPokeNameToBuffer(u8 *buffer, Pokemon *pokemon); +bool8 sub_808DA44(s32 _species, u32 a2_); +u8 *GetCategoryString(s16 index); +u8 GetBodySize(s32 index); +u8 GetShadowSize(s16 index); s32 GetMovementSpeed(s16 index); u8 GetMovementType(s16 index); u8 GetRegenSpeed(s16 index); @@ -78,43 +98,26 @@ s16 GetInternalNo(s16 index); s32 CalculateEXPGain(s16 index, s32 level); s16 GetPokemonEvolveConditions(s16 index, unkEvolve *r1); u8 GetPokemonOverworldPalette(s16 index, bool32 recolorShopKecleon); -bool8 IsPokemonDialogueSpriteAvail(s16 index, s32 spriteId); OpenedFile *OpenPokemonDialogueSpriteFile(s16 index); OpenedFile *GetDialogueSpriteDataPtr(s32 index); -s32 GetUnownIndex(s16 index); -void GenerateHiddenPower(HiddenPower *); -s32 GetEvolutionSequence(Pokemon *pokemon, EvolveStage *); -s32 sub_808E400(s32 _species, s16* _a2, bool32 _bodySizeCheck, bool32 _shedinjaCheck); -void sub_808E490(Move* a1, s32 species); +bool8 IsPokemonDialogueSpriteAvail(s16 index, s32 spriteId); void RecruitedPokemonToDungeonMon(DungeonMon *dst, u32 recruitedPokemonId); -void PokemonToDungeonMon(DungeonMon *, Pokemon *, s32); +void PokemonToDungeonMon(DungeonMon *dst, Pokemon *src, s32 recruitedPokemonId); void DungeonMonToRecruitedPokemon(s32 id, DungeonMon* src); void DungeonMonToPokemon(Pokemon* dst, DungeonMon* src); -void WritePoke1Bits(DataSerializer *, Pokemon *pokemon); -void ReadPoke1Bits(DataSerializer *, Pokemon *); -s32 sub_808E218(unkStruct_808E218_arg *, Pokemon *pokemon); -void CreateLevel1Pokemon(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, const DungeonLocation *location, u16 *moves); -void sub_808D0D8(Pokemon *pokemon); -Pokemon *TryAddLevel1PokemonToRecruited(s32 species, u8 *name, u32 _itemID, const DungeonLocation *location, u16 *moveID); -Pokemon *GetPlayerPokemonStruct(void); -Pokemon *TryAddPokemonToRecruited(Pokemon*); -Pokemon *sub_808D378(void); -Pokemon *sub_808D3BC(void); -Pokemon *sub_808D3F8(void); -Pokemon *GetRecruitedMonBySpecies(s16 species_, s32 sameSpeciesCounter); -s32 GetFriendSum_808D480(void); -bool8 sub_808D4B0(void); -bool8 sub_808D500(void); -s32 GetUnitSum_808D544(s32 *); -s32 sub_808D580(s32 *); -bool8 ComparePokemonNames(s16, s16); -void PrintPokeNameToBuffer(u8 *buffer, Pokemon *pokemon); +void sub_808DFDC(s32 a1, DungeonMon* a2); void GetLvlUpEntry(LevelData* a1, s32 _id, s32 level); const u8* DecompressMoveID(const u8* a1, u16* moveID); -bool8 sub_808DA44(s32, u32); -void ConvertStoryMonToPokemon(Pokemon *dst, const struct StoryMonData *src); -void sub_808CE74(s16 _species, bool32 _isLeader, u8* name); -Pokemon *sub_808D278(s32 species); +s32 GetMovesLearnedAtLevel(u16* dst, s16 species, s32 level, s32 IQPoints); +bool8 CanMonLearnMove(u16 moveID, s16 _species); +s32 sub_808E218(unkStruct_808E218_arg* a1, Pokemon* pokemon); +s32 GetEvolutionSequence(Pokemon* pokemon, EvolveStage* a2); +s32 sub_808E400(s32 _species, s16* _a2, bool32 _bodySizeCheck, bool32 _shedinjaCheck); +void sub_808E490(Move* a1, s32 species); +char* sub_808E4FC(s32 a1); +char* sub_808E51C(s32 a1); +void InitShadowSprites(s32 param_1, s32 param_2); +bool8 AddShadowSprite(s32 species_, DungeonPos *shadowPos, axdata *axData); static inline bool8 PokemonExists(Pokemon *mon) { diff --git a/include/pokemon_3.h b/include/pokemon_3.h index 1dd583194..af180fafe 100644 --- a/include/pokemon_3.h +++ b/include/pokemon_3.h @@ -4,25 +4,36 @@ #include "pokemon.h" #include "structs/str_spawn_pokemon_data.h" +void GenerateHiddenPower(HiddenPower* a1); bool8 HasRecruitedMon(s32 species_); s16 GetBaseSpecies(s16 index); s16 GetBaseSpeciesNoUnown(s16 index); -bool8 TacticsTargetLeader(u8 tactic); -bool8 HasIQForSkill(s32 pokeIQ, u8 IQSkillIndex); -s32 GetNumAvailableIQSkills(u8 *iqSkillBuffer, s32 pokeIQ); -void CopyTacticsNameToBuffer(char *buffer, u8 tactic); -const u8 *GetIQSkillName(u8 skill); -const u8 *GetIQSkillDescription(u8 skill); -const u8 *GetTacticsDescription(u8 tactic); -void ToggleIQSkill(IqSkillFlags *iq, u32 skillIndex); -void SetIQSkill(IqSkillFlags *iq, u32 skillIndex); -bool8 IsIQSkillSet(IqSkillFlags *iq, u32 IQSkillBit); -void SetDefaultIQSkills(IqSkillFlags *iq, bool8 enableSelfCurer); +s32 GetUnownIndex(s16 index); s16 ExtractSpeciesIndex(SpawnPokemonData *data); void SetSpeciesToExtract(SpawnPokemonData *data, s32 species_); void SetSpeciesLevelToExtract(SpawnPokemonData *data, s32 level, s32 species_); s32 ExtractLevel(SpawnPokemonData *data); - +const u8 *GetIQSkillName(u8 skill); +void CopyTacticsNameToBuffer(char *buffer, u8 tactic); +const u8 *GetIQSkillDescription(u8 skill); +const u8 *GetTacticsDescription(u8 tactic); +bool8 TacticsTargetLeader(u8 tactic); +void GetAvailTacticsforLvl(u8 *tacticsBuffer, s32 pokeLevel); +void GetUnlockedTacticFlags(u8 *tacticsBuffer, s32 pokeLevel); +bool8 HasIQForSkill(s32 pokeIQ, u8 IQSkillIndex); +s32 GetNumAvailableIQSkills(u8 *iqSkillBuffer, s32 pokeIQ); +void ToggleIQSkill(IqSkillFlags *iq, u32 skillIndex); +void SetIQSkill(IqSkillFlags *iq, u32 skillIndex); +void SetDefaultIQSkills(IqSkillFlags *iq, bool8 enableSelfCurer); +bool8 IsIQSkillSet(IqSkillFlags *iq, u32 IQSkillBit); void sub_808ED00(void); +s32 SaveRecruitedPokemon(u8 *a1, s32 a2); +s32 RestoreRecruitedPokemon(u8 *a1, s32 a2); +void WritePoke1Bits(DataSerializer *, Pokemon *pokemon); +void ReadPoke1Bits(DataSerializer *, Pokemon *); +s32 SavePoke2s(u8* buffer, s32 size); +s32 RestorePoke2s(u8* a1, s32 size); +void ReadPoke1LevelBits(DataSerializer* a1, struct unkPokeSubStruct_C* unkC); +void WritePoke1LevelBits(DataSerializer* a1, struct unkPokeSubStruct_C* unkC); #endif // GUARD_POKEMON_3_H diff --git a/include/pounce_orb.h b/include/pounce_orb.h new file mode 100644 index 000000000..fb132aa97 --- /dev/null +++ b/include/pounce_orb.h @@ -0,0 +1,8 @@ +#ifndef GUARD_POUNCE_ORB_H +#define GUARD_POUNCE_ORB_H + +#include "structs/dungeon_entity.h" + +void HandlePounceOrb(Entity *pokemon, Entity *target, u8 r2); + +#endif // GUARD_POUNCE_ORB_H diff --git a/include/structs/str_202ED28.h b/include/structs/str_202ED28.h deleted file mode 100644 index 208a8cf63..000000000 --- a/include/structs/str_202ED28.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef GUARD_STR_202ED28_H -#define GUARD_STR_202ED28_H - -#include "structs/sprite_oam.h" -#include "structs/str_position.h" - -struct unkStruct_202ED28 -{ - SpriteOAM sprite; - DungeonPos pos; -}; - -extern struct unkStruct_202ED28 gUnknown_202ED28[][6]; - -#endif diff --git a/include/structs/str_202EDE8.h b/include/structs/str_202EDE8.h deleted file mode 100644 index c13ade944..000000000 --- a/include/structs/str_202EDE8.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef GUARD_STR_202EDE8_H -#define GUARD_STR_202EDE8_H - -#include "structs/dungeon_entity.h" - -struct UnkStruct_202EDE8 -{ - s16 unk0; - s16 unk2; - Entity *unk4; - s32 unk8; - s32 unkC; - s32 unk10; -}; - -extern struct UnkStruct_202EDE8 gUnknown_202EDE8; - -#endif diff --git a/include/structs/str_806B7F8.h b/include/structs/str_806B7F8.h deleted file mode 100644 index 1add1f99e..000000000 --- a/include/structs/str_806B7F8.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef GUARD_STR_806B7F8_H -#define GUARD_STR_806B7F8_H - -#include "structs/dungeon_entity.h" - -struct unkStruct_806B7F8 -{ - s16 species; - u8 unk2; - u32 unk4; - s16 level; - DungeonPos pos; - u8 unk10; -}; - -Entity* sub_806B7F8(struct unkStruct_806B7F8 *, bool8); - -#endif diff --git a/include/switcher_orb.h b/include/switcher_orb.h new file mode 100644 index 000000000..b01e5893c --- /dev/null +++ b/include/switcher_orb.h @@ -0,0 +1,8 @@ +#ifndef GUARD_SWITCHER_ORB_H +#define GUARD_SWITCHER_ORB_H + +#include "structs/dungeon_entity.h" + +void HandleSwitcherOrb(Entity *pokemon, Entity *target, bool8 unused); + +#endif // GUARD_SWITCHER_ORB_H diff --git a/include/trawl_orb.h b/include/trawl_orb.h new file mode 100644 index 000000000..22ddcb83f --- /dev/null +++ b/include/trawl_orb.h @@ -0,0 +1,8 @@ +#ifndef GUARD_TRAWL_ORB_H +#define GUARD_TRAWL_ORB_H + +#include "structs/dungeon_entity.h" + +void HandleTrawlOrb(Entity *user, Entity *target); + +#endif // GUARD_TRAWL_ORB_H diff --git a/include/warp_target.h b/include/warp_target.h new file mode 100644 index 000000000..8d38964d6 --- /dev/null +++ b/include/warp_target.h @@ -0,0 +1,9 @@ +#ifndef GUARD_WARP_TARGET_H +#define GUARD_WARP_TARGET_H + +#include "structs/str_position.h" +#include "structs/dungeon_entity.h" + +void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos); + +#endif // GUARD_WARP_TARGET_H diff --git a/include/weather.h b/include/weather.h index d7694cc2f..05ae88a38 100644 --- a/include/weather.h +++ b/include/weather.h @@ -5,5 +5,11 @@ u8 GetApparentWeather(Entity *pokemon); void sub_807E5E4(u8 weather); +void sub_807E7FC(bool8 r0); +void sub_807E88C(void); +void sub_807E8F0(Entity *pokemon); +void GetWeatherName(u8 *buffer, u8 weather); +void MudWaterSportEffect(u8 which); +bool8 sub_807EAA0(bool8 arg0, bool8 arg1); #endif diff --git a/ld_script.ld b/ld_script.ld index f8db49247..bca23fe4d 100755 --- a/ld_script.ld +++ b/ld_script.ld @@ -194,7 +194,7 @@ SECTIONS { src/personality_test1.o(.text); src/personality_test2.o(.text); src/code_803D0D8.o(.text); - src/dungeon_spawns.o(.text); + src/dungeon_floor_spawns.o(.text); src/dungeon_name_banner.o(.text); src/code_803DA7C_2.o(.text); src/dungeon_vram.o(.text); @@ -235,18 +235,18 @@ SECTIONS { src/code_8066D04.o(.text); src/dungeon_8067A80.o(.text); src/dungeon_misc.o(.text); - src/code_8069E0C.o(.text); + src/dungeon_mon_spawn.o(.text); src/code_806CD90.o(.text); src/dungeon_damage.o(.text); src/code_806FDF4.o(.text); src/status_checks.o(.text); src/dungeon_logic.o(.text); src/dungeon_8071B48.o(.text); - src/code_80718D8.o(.text); + src/dungeon_leveling.o(.text); src/dungeon_ai_leader.o(.text); - src/dungeon_8072CF4.o(.text); + src/dungeon_action_execution.o(.text); src/dungeon_ai_items.o(.text); - src/code_8073CF0.o(.text); + src/dungeon_turn_effects.o(.text); src/code_8075708.o(.text); src/dungeon_ai.o(.text); src/move_orb_effects_1.o(.text); @@ -278,7 +278,7 @@ SECTIONS { src/dungeon_random.o(.text); src/dungeon_cleared_window.o(.text); src/dungeon_jobs.o(.text); - src/code_80848F0.o(.text); + src/dungeon_cutscene.o(.text); src/dungeon_cutscene_skarmory.o(.text); src/dungeon_cutscene_meanies.o(.text); src/dungeon_cutscene_zapdos.o(.text); @@ -574,7 +574,7 @@ SECTIONS { src/personality_test2.o(.rodata); src/code_803D0D8.o(.rodata); src/dungeon_pos_data.o(.rodata); - src/dungeon_spawns.o(.rodata); + src/dungeon_floor_spawns.o(.rodata); src/dungeon_config.o(.rodata); src/dungeon_name_banner.o(.rodata); src/code_803DA7C_2.o(.rodata); @@ -620,18 +620,18 @@ SECTIONS { src/code_8066D04.o(.rodata); src/dungeon_8067A80.o(.rodata); src/dungeon_misc.o(.rodata); - src/code_8069E0C.o(.rodata); + src/dungeon_mon_spawn.o(.rodata); src/code_806CD90.o(.rodata); src/dungeon_damage.o(.rodata); src/code_806FDF4.o(.rodata); src/status_checks.o(.rodata); src/dungeon_logic.o(.rodata); src/dungeon_8071B48.o(.rodata); - src/code_80718D8.o(.rodata); + src/dungeon_leveling.o(.rodata); src/dungeon_ai_leader.o(.rodata); - src/dungeon_8072CF4.o(.rodata); + src/dungeon_action_execution.o(.rodata); src/dungeon_ai_items.o(.rodata); - src/code_8073CF0.o(.rodata); + src/dungeon_turn_effects.o(.rodata); src/code_8075708.o(.rodata); src/dungeon_ai.o(.rodata); src/move_orb_effects_1.o(.rodata); @@ -666,7 +666,7 @@ SECTIONS { src/dungeon_random.o(.rodata); src/dungeon_cleared_window.o(.rodata); src/dungeon_jobs.o(.rodata); - src/code_80848F0.o(.rodata); + src/dungeon_cutscene.o(.rodata); src/dungeon_cutscene_skarmory.o(.rodata); src/dungeon_cutscene_meanies.o(.rodata); src/dungeon_cutscene_zapdos.o(.rodata); diff --git a/src/blow_away.c b/src/blow_away.c index 240cd91f5..12e46ae8a 100644 --- a/src/blow_away.c +++ b/src/blow_away.c @@ -1,11 +1,11 @@ #include "global.h" #include "globaldata.h" +#include "blow_away.h" #include "constants/ability.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "structs/str_dungeon.h" #include "code_8077274_1.h" #include "dungeon_ai.h" @@ -27,20 +27,14 @@ #include "dungeon_strings.h" #include "dungeon_pos_data.h" #include "dungeon_damage.h" +#include "dungeon_kecleon_shop.h" +#include "dungeon_engine.h" +#include "warp_target.h" -void sub_804EB30(); -bool8 ExposeTrap(s32 x, s32 y); -void sub_807EC28(u32); -u8 IsFloorOver(void); -void sub_80421AC(Entity * pokemon, Entity * target); -void sub_807BB78(Entity *pokemon); -extern void UpdateCamera(u32); -bool8 sub_808384C(DungeonPos *, DungeonPos *); -u8 sub_8083660(DungeonPos *); - -extern u32 gDungeonFramesCounter; - -void sub_807D068(Entity *pokemon, DungeonPos *pos); +extern void sub_804EB30(); +extern bool8 ExposeTrap(s32 x, s32 y); +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 b2272bc11..56484570f 100644 --- a/src/code_8040094_1.c +++ b/src/code_8040094_1.c @@ -20,6 +20,7 @@ #include "sprite.h" #include "weather.h" #include "dungeon_map_access.h" +#include "dungeon_strings.h" struct UnkStruct_8040094 { @@ -42,21 +43,16 @@ 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); extern bool8 sub_800E9A8(s32 a0); -extern void sub_803EA10(void); extern void sub_800EEF8(u16 a0); extern bool8 sub_803F428(DungeonPos *pos); extern void sub_800EEE0(u16 a0); extern s32 sub_800EBC8(struct UnkStruct_8040094 *a0); extern bool8 sub_800E7D0(struct UnkStruct_8040094 *a0); -extern s32 sub_800ED20(u16 param_1); extern u8 sub_800EC84(s32 param_1); extern bool8 MoveMatchesBideClassStatus(Entity *pokemon, Move *move); extern bool8 IsSleeping(Entity *pokemon); extern void sub_80421C0(Entity *pokemon, u16); -extern s32 gDungeonBrightness; - -extern const u8 *const gPtrMagnitudeMessage; extern const s32 gUnknown_8106A8C[]; u16 sub_80412E0(u16 moveId, u8 weather, bool32 a2); diff --git a/src/code_8041AD0.c b/src/code_8041AD0.c index ec4cce6dd..97c2751fd 100644 --- a/src/code_8041AD0.c +++ b/src/code_8041AD0.c @@ -10,7 +10,7 @@ #include "effect_main.h" #include "effect_sub_1.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_8041AD0.h" #include "code_804267C.h" #include "code_806CD90.h" @@ -22,30 +22,25 @@ #include "sprite.h" #include "dungeon_info.h" #include "run_dungeon.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "memory.h" #include "random.h" -#include "dungeon_util_1.h" +#include "dungeon_cutscene.h" #include "effect_data.h" #include "dungeon_pos_data.h" #include "dungeon_damage.h" +#include "dungeon_strings.h" // Unknown dungeon file. File split is correct. -extern const u8 *gPtrFeralFoundItemMessage[]; - -extern void sub_803ED30(u8, Entity *pokemon, u8, u8); -extern void PlaySoundEffect(u32); void EntityUpdateStatusSprites(Entity *entity); -extern s32 gDungeonBrightness; extern void sub_800DBBC(void); -extern void sub_803EA10(void); extern void sub_8042E98(void); extern void sub_800EF28(u8); extern void sub_80429A0(Entity *); @@ -57,10 +52,7 @@ 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); -u32 sub_8041764(unkStruct_80416E0 *param_1, bool8 param_2); s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3); -s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5); -s32 sub_804151C(Entity *entity, s32 r1, u8 r2); void sub_804178C(u8 param_1); struct UnkStruct_80F6624 @@ -196,13 +188,16 @@ static const u32 sStatusSpriteMasks_MuzzledStatus[] = { /*STATUS_MUZZLED not defined*/[1] = STATUS_SPRITE_MUZZLED, }; -s32 sub_804151C(Entity *entity, s32 r1, u8 r2) +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 s32 sub_804151C(Entity *entity, s32 r1, u8 r2) { u8 r3 = sub_800DC9C(r1); return sub_8041550(entity, r1, r2, r3, 2, 0); } -s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5) +static s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5) { s32 i; EntityInfo *entInfo; @@ -263,7 +258,7 @@ s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5) return r4; } -s32 sub_80416A4(DungeonPos *pos_1, u32 param_2, bool8 param_3) +static s32 sub_80416A4(DungeonPos *pos_1, u32 param_2, bool8 param_3) { PixelPos pos; @@ -302,7 +297,7 @@ s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3) return ret; } -u32 sub_8041764(unkStruct_80416E0 *param_1, bool8 param_2) +static u32 sub_8041764(unkStruct_80416E0 *param_1, bool8 param_2) { sub_800EE5C(param_1->unk0); sub_800EF64(); @@ -1344,7 +1339,7 @@ void sub_80427AC(void) sub_80429A0(entity); if (!enInfo->isNotTeamMember) { SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0); - DisplayDungeonLoggableMessageTrue(entity, *gPtrFeralFoundItemMessage); + DisplayDungeonLoggableMessageTrue(entity, gPtrFeralFoundItemMessage); } } } @@ -1559,7 +1554,7 @@ void sub_8042B34(s32 a0, s32 a1, s32 a2) unkStruct_80416E0 spStruct; s32 i; s32 r8 = 0; - Entity *leader = xxx_call_GetLeader(); + Entity *leader = CutsceneGetLeader(); gUnknown_203B414 = MemoryAlloc(sizeof(*gUnknown_203B414), 7); gUnknown_203B414->unk0 = a0; diff --git a/src/code_8066D04.c b/src/code_8066D04.c index ea50bbb82..c04bd8302 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -4,17 +4,16 @@ #include "constants/item.h" #include "constants/move_id.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_8041AD0.h" #include "dungeon_action.h" #include "code_8066D04.h" #include "code_806CD90.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "dungeon_jobs.h" #include "run_dungeon.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_misc.h" @@ -40,23 +39,17 @@ #include "dungeon_pos_data.h" #include "dungeon_projectile_throw.h" #include "dungeon_engine.h" +#include "dungeon_kecleon_shop.h" +#include "dungeon_item_action.h" +#include "dungeon_leveling.h" +#include "warp_target.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_803E708(); -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); Entity *sub_806773C(Entity *entity); void sub_8067558(Entity *entity, Entity *targetEntity, s32 a2); void sub_8067794(Entity *entity, Entity *targetEntity, s32 a2); -extern void sub_807EF84(void); -extern void sub_80845E0(Entity *entity); -extern void sub_8084448(Entity *entity); void HandlePickUpPlayerAction(Entity *entity) { @@ -465,8 +458,6 @@ void sub_8067110(Entity *entity) } } -extern void sub_8083904(DungeonPos *pos, Entity *entity); - void sub_80671A0(Entity *entity) { EntityInfo *info = GetEntInfo(entity); diff --git a/src/code_806CD90.c b/src/code_806CD90.c index cb61efb31..d48488762 100644 --- a/src/code_806CD90.c +++ b/src/code_806CD90.c @@ -20,6 +20,7 @@ #include "dungeon_random.h" #include "dungeon_misc.h" #include "dungeon_util.h" +#include "dungeon_data.h" #include "dungeon_pokemon_sprites.h" #include "exclusive_pokemon.h" #include "move_effects_target.h" @@ -31,7 +32,6 @@ #include "text_util.h" #include "sprite.h" #include "random.h" -#include "structs/str_202ED28.h" const u8 gUnknown_8106EC8[][13] = { {0, 1, 7, 7, 7, 5, 6, 7, 7, 7, 7, 7, 7}, @@ -41,7 +41,6 @@ const u8 gUnknown_8106EC8[][13] = { const u8 gUnknown_8106EEF[] = {0x03, 0x04, 0x05, 0x0}; -extern s32 gDungeonFramesCounter; extern void sub_8042EC8(Entity *a0, s32 a1); diff --git a/src/code_806FDF4.c b/src/code_806FDF4.c index 8590c879e..45879ca06 100644 --- a/src/code_806FDF4.c +++ b/src/code_806FDF4.c @@ -20,17 +20,14 @@ #include "pokemon_3.h" #include "position_util.h" #include "text_util.h" -#include "dungeon_util_1.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" -extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE]; - -u8 sub_806B8CC(); -void sub_8083D88(); -u8 sub_808529C(s32); void nullsub_96(Entity *pokemon,Entity *target); u8 sub_8097900(s16); void sub_806F910(void); @@ -194,7 +191,7 @@ bool8 sub_806F9BC(s16 species) if (!gDungeon->unk644.canRecruit) { return FALSE; } - else if (sub_808529C(id) == 0) { + else if (!sub_808529C(id)) { return FALSE; } else if (id == MONSTER_MEW && gDungeon->unk644.unk34 == 1) { @@ -306,7 +303,7 @@ bool8 sub_806FA5C(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *pa IncrementAdventureNumJoined(); - if (sub_806B8CC(param_3->id,param_3->pos.x,param_3->pos.y,pokeStruct2,&local_2c,0,1) == 0) { + 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; } @@ -321,7 +318,7 @@ bool8 sub_806FA5C(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *pa sub_808D9DC(gFormatBuffer_Monsters[0],pokeStruct2,0); LogMessageByIdWithPopupCheckUser(entity1,gUnknown_80FA0F0); if (flag) { - leader = xxx_call_GetLeader(); + leader = CutsceneGetLeader(); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],leader,0); sub_8092558(gFormatBuffer_FriendArea,friendArea); PlaySound(0xce); @@ -442,7 +439,7 @@ bool8 sub_806FDF4(Entity *entity1,Entity *entity2,Entity **entityPtr) } IncrementAdventureNumJoined(); HandleFaint(entity2,500,entity1); - if (sub_806B8CC(local_74.id,local_74.pos.x,local_74.pos.y,pokeStruct2,&local_2c,0,0) == 0) { + if (SpawnTeamMember(local_74.id,local_74.pos.x,local_74.pos.y,pokeStruct2,&local_2c,0,0) == 0) { pokeStruct2->flags = 0; } else { @@ -452,7 +449,7 @@ bool8 sub_806FDF4(Entity *entity1,Entity *entity2,Entity **entityPtr) } } if (flag) { - leader = xxx_call_GetLeader(); + leader = CutsceneGetLeader(); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],leader,0); sub_8092558(gFormatBuffer_FriendArea,friendArea); PlaySound(0xce); diff --git a/src/code_8075708.c b/src/code_8075708.c index 32e60ce3a..f2a87eb02 100644 --- a/src/code_8075708.c +++ b/src/code_8075708.c @@ -7,7 +7,7 @@ #include "constants/type.h" #include "code_806CD90.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_logic.h" #include "dungeon_util.h" @@ -41,36 +41,31 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_engine.h" +#include "dungeon_kecleon_shop.h" +#include "dungeon_misc.h" +#include "dungeon_pos_data.h" +#include "dungeon_turn_effects.h" +#include "dungeon_leveling.h" +#include "dungeon_cutscene.h" +#include "warp_target.h" extern void sub_8073D14(Entity *); extern void sub_8075708(Entity *entity); extern void sub_805229C(void); -extern void sub_807E8F0(Entity *); -extern void sub_80444F4(Entity *pokemon); -extern void WarpTarget(Entity *pokemon, Entity *r1, u32 r2, DungeonPos *r3); extern void sub_80420B8(Entity *pokemon); extern void sub_8041C4C(Entity *pokemon, u32 r1); extern void sub_805E804(void); -extern void sub_80838EC(u8 *a); extern bool8 TryUseChosenMove(struct Entity *, u32, u32, u32, u32, struct Move *); extern void nullsub_97(Entity *entity); extern void CheckLeaderTile(void); -extern void sub_8086AC0(void); -extern void sub_8085140(void); extern void sub_8075708(Entity *entity); extern void TryForcedLoss(u32); -extern void EnemyEvolution(Entity *); extern void sub_8075900(Entity *pokemon, u8 r1); -extern void sub_806A5B8(Entity *); -extern void sub_807EC28(bool8); extern void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr); -extern void sub_8074094(Entity *entity); extern bool8 sub_803F428(DungeonPos *pos); extern u8 gUnknown_202F32D; -extern const DungeonPos gUnknown_80F4D44[]; - static EWRAM_DATA s32 gUnknown_202F378 = 0; void sub_8074FB0(Entity *entity, s32 a1, DungeonPos *pos) @@ -287,7 +282,7 @@ bool8 DisplayActions(Entity *a0) break; TryForcedLoss(0); - sub_8074094(mon); + ApplyEndOfTurnEffects(mon); if (!EntityIsValid(mon)) continue; if (IsFloorOver()) diff --git a/src/code_8077274_1.c b/src/code_8077274_1.c index 032329298..e85e52770 100644 --- a/src/code_8077274_1.c +++ b/src/code_8077274_1.c @@ -22,13 +22,13 @@ #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" #include "dungeon_map_access.h" -#include "structs/str_806B7F8.h" #include "dungeon_config.h" #include "dungeon_logic.h" #include "dungeon_strings.h" +#include "dungeon_floor_spawns.h" +#include "dungeon_misc.h" +#include "dungeon_mon_spawn.h" -extern bool8 sub_806AA0C(s32, u32); -extern s16 GetRandomFloorMonsterId(u32); extern void sub_804178C(u32); void sub_807AA30(void) @@ -167,7 +167,7 @@ void sub_807AB38(Entity *entity, bool8 forcedMonsterHouse) } else { - struct unkStruct_806B7F8 spawnStruct; + struct MonSpawnInfo spawnStruct; spawnStruct.species = GetRandomFloorMonsterId(1); spawnStruct.level = 0; @@ -177,7 +177,7 @@ void sub_807AB38(Entity *entity, bool8 forcedMonsterHouse) spawnStruct.pos.x = positions[rndId].x; spawnStruct.pos.y = positions[rndId].y; if (sub_806AA0C(spawnStruct.species, 1)) { - Entity *newMonster = sub_806B7F8(&spawnStruct, FALSE); + Entity *newMonster = SpawnWildMon(&spawnStruct, FALSE); if (EntityIsValid(newMonster)) { newMonster->unk1C = IntToF248_2(200); for (j = 0; j < 100; j++) { diff --git a/src/code_8094F88.c b/src/code_8094F88.c index 80fc7bbfa..9d54270b2 100644 --- a/src/code_8094F88.c +++ b/src/code_8094F88.c @@ -10,6 +10,7 @@ #include "random.h" #include "save.h" #include "text_util.h" +#include "pokemon_3.h" EWRAM_INIT unkStruct_203B480 *gUnknown_203B480 = {NULL}; EWRAM_INIT unkStruct_203B484 *gUnknown_203B484 = {NULL}; @@ -22,11 +23,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*); - void sub_80950BC(void) { gUnknown_203B480 = gUnknown_2038C88; 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 960bf0c3d..fb73b9de2 100644 --- a/src/code_8097670.c +++ b/src/code_8097670.c @@ -5,19 +5,15 @@ #include "pokemon_3.h" #include "friend_area.h" #include "moves.h" +#include "strings.h" +#include "dungeon_info.h" +#include "game_options.h" static EWRAM_DATA struct unkStruct_203B494 sUnknown_2039778 = {0}; EWRAM_INIT struct unkStruct_203B494 *gUnknown_203B494 = { NULL }; // NDS=20EB98C -// data_810AE24.s -extern const u8 *gAdventureLogText[]; - -extern void WriteDungeonLocationBits(DataSerializer*, DungeonLocation*); -extern void ReadDungeonLocationBits(DataSerializer*, DungeonLocation*); -void ReadGameOptionsBits(DataSerializer *param_1); void ReadPlayTimeBits(DataSerializer *r0); -void WriteGameOptionsBits(DataSerializer *param_1); void WritePlayTimeBits(DataSerializer *r0); void sub_8097670(void) diff --git a/src/code_8097F40.c b/src/code_8097F40.c index 320ab3314..19de5ff95 100644 --- a/src/code_8097F40.c +++ b/src/code_8097F40.c @@ -1,5 +1,6 @@ #include "global.h" #include "dungeon_map_access.h" +#include "dungeon_data.h" bool8 IsWaterDungeon(u32 r0) { diff --git a/src/drought_orb.c b/src/drought_orb.c index 7b0c817ad..32d678b37 100644 --- a/src/drought_orb.c +++ b/src/drought_orb.c @@ -1,11 +1,11 @@ #include "global.h" #include "globaldata.h" +#include "drought_orb.h" #include "constants/ability.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "structs/str_dungeon.h" #include "code_8077274_1.h" #include "dungeon_ai.h" @@ -26,7 +26,7 @@ #include "dungeon_items.h" #include "dungeon_strings.h" -void HandleDroughtOrbAction(Entity *pokemon, Entity *target) +void HandleDroughtOrb(Entity *pokemon, Entity *target) { s32 x; s32 y; diff --git a/src/dungeon_8067A80.c b/src/dungeon_8067A80.c index 35129c925..3bb810de1 100644 --- a/src/dungeon_8067A80.c +++ b/src/dungeon_8067A80.c @@ -4,16 +4,15 @@ #include "constants/item.h" #include "constants/move_id.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_8041AD0.h" #include "dungeon_action.h" #include "code_8066D04.h" #include "code_806CD90.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "run_dungeon.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_misc.h" @@ -36,23 +35,15 @@ #include "string_format.h" #include "text_1.h" #include "trap.h" +#include "dungeon_submenu.h" +#include "dungeon_engine.h" extern void sub_80684C4(void); -void sub_8045064(void); extern void sub_8068344(void); -bool8 CanSubMenuItemBeChosen(s32 param_1); void sub_8068310(s32 n, Pokemon **monPtrs); void sub_8067F00(u8 a0, Pokemon **a1, s32 a2, s32 a3, s32 a4); -void sub_8083D1C(void); -void PlayDungeonConfirmationSE(void); -void PlayDungeonCancelSE(void); void sub_806806C(Pokemon *a0); -void CreateDungeonMenuSubWindow(WindowTemplates *a0, s32 a1); -extern const s32 gUnknown_8106E80[]; -extern MenuInputStruct gDungeonMenu; -extern u32 gDungeonFramesCounter; -extern s32 gDungeonSubMenuItemsCount; static EWRAM_DATA WindowHeader gUnknown_202F308 = {0}; static EWRAM_DATA s32 gUnknown_202F30C = 0; @@ -280,7 +271,7 @@ void sub_8067A80(u8 a0, s32 a1, s32 a2, Pokemon **a3) } sub_8045064(); - CreateDungeonMenuSubWindow(&spTxtStruct, 0x15); + CreateDungeonMenuSubWindow(&spTxtStruct.id[0], 0x15); while (1) { AddMenuCursorSprite(&gDungeonMenu); diff --git a/src/dungeon_8071B48.c b/src/dungeon_8071B48.c index 672e61ec7..ff3d501cb 100644 --- a/src/dungeon_8071B48.c +++ b/src/dungeon_8071B48.c @@ -2,7 +2,7 @@ #include "globaldata.h" #include "constants/tactic.h" #include "dungeon_config.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_message.h" #include "code_8041AD0.h" #include "code_8077274_1.h" @@ -13,15 +13,13 @@ #include "dungeon_info.h" #include "pokemon_3.h" #include "code_805D8C8.h" -#include "structs/str_806B7F8.h" #include "dungeon_logic.h" -#include "dungeon_spawns.h" - -extern u8 *gUnknown_80FED68[]; +#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); -extern bool8 sub_806AA0C(s32, u32); -extern bool8 sub_8083660(DungeonPos *param_1); void sub_8071B48(void) { @@ -34,7 +32,7 @@ void sub_8071B48(void) struct Entity *entityPtr; s32 level; struct Dungeon *dungeon; // feels like a hack - struct unkStruct_806B7F8 local_2c; + struct MonSpawnInfo local_2c; entityPtr = NULL; dungeon = gDungeon; @@ -88,7 +86,7 @@ void sub_8071B48(void) } if (entityPtr != NULL) { - DisplayDungeonLoggableMessageTrue(0,*gUnknown_80FED68); + DisplayDungeonLoggableMessageTrue(0,gUnknown_80FED68); sub_8042920(entityPtr); } if (dungeon->unk644.unk2A != 0) { @@ -115,7 +113,7 @@ void sub_8071B48(void) local_2c.unk4 = 0; } local_2c.unk10 = 0; - sub_806B7F8(&local_2c, FALSE); + SpawnWildMon(&local_2c, FALSE); } } } diff --git a/src/dungeon_action.c b/src/dungeon_action.c index 71ec6bb16..7012f1f95 100644 --- a/src/dungeon_action.c +++ b/src/dungeon_action.c @@ -6,7 +6,7 @@ #include "dungeon_ai_leader.h" #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_logic.h" #include "dungeon_generation.h" #include "dungeon_util.h" @@ -20,10 +20,7 @@ #include "dungeon_engine.h" #include "run_dungeon.h" -extern void sub_8086AC0(void); extern void DisplayActions(u32); -extern void TryActivateArtificialWeatherAbilities(void); -extern void EnemyEvolution(Entity *); extern void TickStatusAndHealthRegen(Entity *); EWRAM_DATA SubMenuAction gDungeonSubMenu[10] = {0}; diff --git a/src/dungeon_8072CF4.c b/src/dungeon_action_execution.c similarity index 89% rename from src/dungeon_8072CF4.c rename to src/dungeon_action_execution.c index 48632ce1c..caf238507 100644 --- a/src/dungeon_8072CF4.c +++ b/src/dungeon_action_execution.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_action_execution.h" #include "dungeon_ai_leader.h" #include "dungeon_move_util.h" #include "dungeon_vram.h" @@ -8,7 +9,6 @@ #include "code_8066D04.h" #include "dungeon_message.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "constants/dungeon_action.h" #include "constants/dungeon.h" #include "constants/iq_skill.h" @@ -18,7 +18,7 @@ #include "constants/targeting.h" #include "dungeon_logic.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_random.h" #include "dungeon_util.h" #include "move_util.h" @@ -31,36 +31,27 @@ #include "dungeon_misc.h" #include "dungeon_pos_data.h" #include "dungeon_engine.h" - -extern u8 gUnknown_202F221; -extern u8 gUnknown_202F222; -extern u8 gUnknown_203B434; - -extern u8 *gUnknown_80FA5B4[]; -extern u8 *gUnknown_80FCF50[]; -extern u8 *gUnknown_80FCF38[]; -extern u8 *gUnknown_80FD2CC[]; -extern u8 *gUnknown_80FE478[]; -extern u8 *gUnknown_80FE6D4[]; +#include "dungeon_strings.h" +#include "dungeon_action.h" +#include "dungeon_turn_effects.h" +#include "dungeon_leveling.h" +#include "dungeon_cutscene.h" +#include "dungeon_move.h" +#include "dungeon_map_access.h" +#include "warp_target.h" void sub_8075BA4(Entity *param_1, u8 param_2); void sub_804178C(u8 param_1); void nullsub_95(Entity *); -bool8 IsNotAttacking(Entity *, bool8); extern void sub_80671A0(Entity *); extern void sub_8067110(Entity *); void HandleUseMoveAIAction(Entity *target); void sub_8041888(u8 param_1); -void sub_8085140(void); -void sub_807360C(void); void sub_805EFB4(Entity *, u8); void sub_8074FB0(Entity *, u8, DungeonPos *); - void HandlePlaceItemAction(Entity *); void HandlePickUpPlayerAction(Entity *); void sub_8066E14(Entity * ); -void sub_807348C(void); -void sub_80732F0(void); void sub_8066BD4(Entity*); void HandleTalkFieldAction(Entity *); void HandleUseMovePlayerAction(Entity *); @@ -73,22 +64,19 @@ void sub_8066FA4(Entity *); void HandleUnsetItemAction(Entity *,bool8); extern u8 DisplayActions(Entity *); void sub_806A1E8(Entity *pokemon); -bool8 sub_804AE08(DungeonPos *pos); void HandlePickUpAIAction(Entity *pokemon); void HandleThrowItemAIAction(Entity *pokemon); void HandleEatAIAction(Entity *pokemon); -bool8 sub_8044B84(void); -extern void sub_8074094(Entity *); -extern void EnemyEvolution(Entity *); -u32 sub_8075818(Entity *entity); -extern void MarkLastUsedMonMove(Entity *entity, Move *move); -bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, bool32 isLinkedMove, struct Move *move); -extern void sub_80838EC(u8 *a); +u32 sub_8075818(Entity *entity);; EWRAM_DATA u8 gUnknown_202F32C = 0; EWRAM_DATA u8 gUnknown_202F32D = 0; -bool8 sub_8072CF4(Entity *entity) +static void HandleSleepTalk(void); +static void HandleSnore(void); +static void HandleFlashFire(void); + +bool8 ExecuteEntityDungeonAction(Entity *entity) { bool8 bVar4; bool8 bVar5; @@ -100,7 +88,7 @@ bool8 sub_8072CF4(Entity *entity) DungeonPos pos1; sub_804178C(1); - gUnknown_203B434 = 1; + gUnknown_203B434 = TRUE; info = GetEntInfo(entity); info->useHeldItem = FALSE; info->unkF3 = FALSE; @@ -206,7 +194,7 @@ bool8 sub_8072CF4(Entity *entity) break; case ACTION_STAIRS: if ((gDungeon->unk644.dungeonLocation.id == DUNGEON_METEOR_CAVE) && (!gDungeon->deoxysDefeat)) { - LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FA5B4); // It's impossible to go down the stairs now! + LogMessageByIdWithPopupCheckUser(entity,gUnknown_80FA5B4); // It's impossible to go down the stairs now! } else { @@ -265,7 +253,7 @@ bool8 sub_8072CF4(Entity *entity) break; } SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0); - LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE6D4); + LogMessageByIdWithPopupCheckUser(entity,gUnknown_80FE6D4); break; case ACTION_TALK_FIELD: HandleTalkFieldAction(entity); @@ -293,7 +281,7 @@ bool8 sub_8072CF4(Entity *entity) break; case ACTION_SECOND_THOUGHTS: SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0); - LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE478); + LogMessageByIdWithPopupCheckUser(entity,gUnknown_80FE478); break; default: info->action.action = ACTION_PASS_TURN; @@ -321,13 +309,13 @@ bool8 sub_8072CF4(Entity *entity) } } if (bVar4) { - LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FD2CC); + LogMessageByIdWithPopupCheckUser(entity,gUnknown_80FD2CC); } } - sub_807360C(); + HandleFlashFire(); if (!sub_8044B84()) { - sub_807348C(); - sub_80732F0(); + HandleSnore(); + HandleSleepTalk(); if (!EntityIsValid(entity)) { return FALSE; } @@ -344,7 +332,7 @@ bool8 sub_8072CF4(Entity *entity) if (sub_80706A4(entity,&entity->pos) != '\0') { WarpTarget(entity,entity,0,0); } - sub_8074094(entity); + ApplyEndOfTurnEffects(entity); EnemyEvolution(entity); } } @@ -353,7 +341,7 @@ bool8 sub_8072CF4(Entity *entity) return FALSE; } -void sub_80732F0(void) +static void HandleSleepTalk(void) { s32 index; Entity *entity; @@ -409,7 +397,7 @@ void sub_80732F0(void) } } SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0); - LogMessageByIdWithPopupCheckUser(entity, *gUnknown_80FCF38); // {ARG_POKEMON_0} uttered its sleep talk! + LogMessageByIdWithPopupCheckUser(entity, gUnknown_80FCF38); // {ARG_POKEMON_0} uttered its sleep talk! info->action.direction = sl & DIRECTION_MASK; TryUseChosenMove(entity, 0, ITEM_NOTHING, 1, FALSE, &moveStack); flag = TRUE; @@ -433,7 +421,7 @@ _increase: } } -void sub_807348C(void) +static void HandleSnore(void) { int index; s32 moveIndex; @@ -475,7 +463,7 @@ void sub_807348C(void) } } SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0); - LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FCF50); + LogMessageByIdWithPopupCheckUser(pokemon,gUnknown_80FCF50); info->action.direction = r8 & DIRECTION_MASK; TryUseChosenMove(pokemon,0,ITEM_NOTHING,1,FALSE,&chosenMove); info->unk165 |= 0xff; @@ -486,18 +474,14 @@ void sub_807348C(void) } } -void sub_807360C(void) +static void HandleFlashFire(void) { s32 index; - Entity *entity; - for(index = 0; index < DUNGEON_MAX_POKEMON; index++) - { - entity = gDungeon->activePokemon[index]; - if(EntityIsValid(entity)) - { - if(GetEntInfo(entity)->unk152 != 0) - { + for (index = 0; index < DUNGEON_MAX_POKEMON; index++) { + Entity *entity = gDungeon->activePokemon[index]; + if (EntityIsValid(entity)) { + if (GetEntInfo(entity)->unk152 != 0) { GetEntInfo(entity)->unk152 = 0; UpdateFlashFireBoost(entity, entity); } diff --git a/src/dungeon_ai.c b/src/dungeon_ai.c index e522896b8..3751a6195 100644 --- a/src/dungeon_ai.c +++ b/src/dungeon_ai.c @@ -1,7 +1,7 @@ #include "global.h" #include "globaldata.h" #include "dungeon_ai.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_message.h" #include "code_8077274_1.h" #include "dungeon_random.h" @@ -18,19 +18,18 @@ #include "dungeon_ai_items.h" #include "dungeon_ai_movement.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "pokemon.h" #include "status_checks.h" #include "structs/map.h" #include "structs/str_dungeon.h" #include "dungeon_misc.h" - -extern char *gPtrCouldntBeUsedMessage; +#include "dungeon_cutscene.h" +#include "dungeon_strings.h" void RunMonsterAI(Entity *pokemon, u32 unused) { diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index e73015b1e..d69f26602 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -32,29 +32,20 @@ #include "dungeon_pos_data.h" #include "dungeon_engine.h" #include "dungeon_damage.h" +#include "dungeon_kecleon_shop.h" +#include "dungeon_strings.h" #define REGULAR_ATTACK_INDEX 4 -extern const u8 *const gItemStickyDoesntWorkText[]; -extern const u8 *const gPtrMysteriousPowerPreventedUseMessage[]; -extern const u8 *const gUnknown_80FC6A8[]; -extern const u8 *const gUnknown_80FC714[]; -extern const u8 *const gUnknown_80FC718[]; - EWRAM_DATA bool8 gCanAttackInDirection[NUM_DIRECTIONS] = {0}; EWRAM_DATA u8 gPotentialAttackTargetDirections[NUM_DIRECTIONS] = {0}; EWRAM_DATA s32 gPotentialAttackTargetWeights[NUM_DIRECTIONS] = {0}; EWRAM_DATA Entity *gPotentialTargets[NUM_DIRECTIONS] = {0}; extern void sub_806A1B0(Entity *); -extern Item *sub_8044D90(Entity *, s32, u32); -extern bool8 sub_8044D40(ActionContainer *, u32); extern void sub_8045BF8(u8 *, struct Item *); -extern void sub_8044DF0(struct Entity *, u32, u32); extern void EnemyEvolution(struct Entity *); extern void DiscoverMinimap(DungeonPos *); -extern void sub_807EC28(bool8); -extern void sub_806A5B8(struct Entity *entity); void ChooseAIMove(Entity *pokemon) { @@ -967,14 +958,14 @@ void HandleUseOrbAction(Entity *pokemon) if (item->flags & ITEM_FLAG_STICKY) { sub_8045BF8(gFormatBuffer_Items[0], item); - LogMessageByIdWithPopupCheckUser(pokemon, *gItemStickyDoesntWorkText); + LogMessageByIdWithPopupCheckUser(pokemon, gItemStickyDoesntWorkText); return; } act = entityInfo->action; if (IsBossFight()) { - LogMessageByIdWithPopupCheckUser(pokemon, *gPtrMysteriousPowerPreventedUseMessage); + LogMessageByIdWithPopupCheckUser(pokemon, gPtrMysteriousPowerPreventedUseMessage); r4 = TRUE; } else { @@ -994,20 +985,20 @@ void HandleUseOrbAction(Entity *pokemon) if (entityInfo->cringeClassStatus.status == 1) { SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], pokemon, 0); - LogMessageByIdWithPopupCheckUser(pokemon, *gUnknown_80FC714); + LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FC714); r4 = FALSE; r8 = FALSE; } else if (entityInfo->cringeClassStatus.status == 7) { SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], pokemon, 0); - LogMessageByIdWithPopupCheckUser(pokemon, *gUnknown_80FC718); + LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FC718); r4 = FALSE; r8 = FALSE; } else if (entityInfo->burnClassStatus.status == 4) { SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], pokemon, 0); - LogMessageByIdWithPopupCheckUser(pokemon, *gUnknown_80FC6A8); + LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FC6A8); r4 = FALSE; r8 = FALSE; } diff --git a/src/dungeon_ai_leader.c b/src/dungeon_ai_leader.c index 3aa31bb59..db1d3a3df 100644 --- a/src/dungeon_ai_leader.c +++ b/src/dungeon_ai_leader.c @@ -4,7 +4,7 @@ #include "constants/status.h" #include "constants/targeting.h" #include "dungeon_logic.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_util.h" #include "pokemon_3.h" diff --git a/src/dungeon_ai_movement.c b/src/dungeon_ai_movement.c index 31d0ec64d..996117772 100644 --- a/src/dungeon_ai_movement.c +++ b/src/dungeon_ai_movement.c @@ -38,8 +38,6 @@ struct CanMoveInDirectionInfo s32 direction; }; -extern const s32 gFaceDirectionIncrements[]; - void AIMovement(Entity *pokemon, bool8 showRunAwayEffect) { EntityInfo *pokemonInfo = GetEntInfo(pokemon); diff --git a/src/dungeon_cleared_window.c b/src/dungeon_cleared_window.c index 03beb5688..ee77b23f7 100644 --- a/src/dungeon_cleared_window.c +++ b/src/dungeon_cleared_window.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cleared_window.h" #include "dungeon_info.h" #include "dungeon_strings.h" #include "dungeon_vram.h" @@ -7,12 +8,8 @@ #include "text_1.h" #include "run_dungeon.h" #include "dungeon_run_end.h" - -extern void PlayDungeonCompleteBGM(void); -extern void PlayDungeonFailBGM(void); -extern void PlayDungeonConfirmationSE(void); -extern void UpdateDungeonMusic(void); -extern u8 sub_8094D14(void); +#include "dungeon_music.h" +#include "game_options.h" void ShowDungeonClearedWindow(void) { diff --git a/src/code_80848F0.c b/src/dungeon_cutscene.c similarity index 96% rename from src/code_80848F0.c rename to src/dungeon_cutscene.c index a13817e81..450c35341 100644 --- a/src/code_80848F0.c +++ b/src/dungeon_cutscene.c @@ -1,16 +1,15 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "constants/weather.h" #include "constants/dungeon.h" #include "constants/direction.h" #include "constants/dungeon.h" #include "structs/str_dungeon.h" -#include "structs/str_806B7F8.h" #include "structs/sprite_oam.h" #include "dungeon_cutscenes.h" #include "dungeon_music.h" #include "dungeon_logic.h" -#include "dungeon_util_1.h" #include "exclusive_pokemon.h" #include "weather.h" #include "pokemon.h" @@ -19,9 +18,7 @@ #include "dungeon_misc.h" #include "dungeon_vram.h" #include "code_806CD90.h" -#include "code_80861A8.h" -#include "code_8085E98.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "random.h" #include "math.h" #include "code_8004AA0.h" @@ -31,11 +28,13 @@ #include "effect_sub_1.h" #include "sprite.h" #include "effect_data.h" -#include "code_80869E4.h" #include "pokemon_3.h" #include "dungeon_boss_dialogue.h" #include "dungeon_pos_data.h" #include "dungeon_engine.h" +#include "dungeon_tilemap.h" +#include "dungeon_map.h" +#include "dungeon_mon_spawn.h" struct RgbS16 { @@ -45,35 +44,16 @@ struct RgbS16 }; extern OpenedFile *gDungeonPaletteFile; -extern s32 gDungeonBrightness; extern RGB gUnknown_202ECA4[]; -extern const u8 gUnknown_8107358[25]; -extern const DungeonPos gUnknown_80F4598[]; - extern bool8 sub_8004C00(unkStruct_202EE8C *a0, s32 a1, s32 a2, s32 brightness, const RGB *ramp, struct RgbS16 *a5); -extern void UpdateMinimap(void); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F4A0(u32); extern void sub_803F878(s32, s32); -extern void sub_8085F44(s32); extern bool8 sub_800E90C(DungeonPos *); extern void sub_8088EE8(void); extern void sub_8088848(void); extern void sub_808A718(void); extern s32 sub_800E700(s32); -extern void sub_8085F44(s32); extern void sub_8052FB8(const u8 *); -extern void BgColorCallNullsub4(void); -extern void PlaySoundEffect(u32); -extern void sub_8085EB0(void); -extern void sub_803E748(void); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_8086A54(Entity *); -extern void sub_8086A3C(Entity *); -extern void PlaySoundEffect(u32); extern u32 sub_8002A70(u32, s32, u8); extern s8 sub_8002984(s8, u8); @@ -87,7 +67,20 @@ struct unkData_8107234 u8 unk5; }; +// size: 0x8 +typedef struct unkStruct_202F3D0 +{ + u8 unk0; + u8 unk1; + u8 unk2; + u8 unk3; + u8 unk4; + u8 unk5; +} unkStruct_202F3D0; + static void sub_8084854(const struct unkData_8107234 *); +static void sub_8085764(void); +static void sub_80857B8(void); static void sub_80861EC(Entity *); static const struct unkData_8107234 gUnknown_8107234[28] = { @@ -151,7 +144,7 @@ void sub_80847D4(void) sub_8097FF8(); } -void sub_8084854(const struct unkData_8107234 *param_1) +static void sub_8084854(const struct unkData_8107234 *param_1) { if (gDungeon->unk644.unk34 != 0) { gDungeon->unk3A0D = param_1->unk5; @@ -173,9 +166,9 @@ void sub_8084854(const struct unkData_8107234 *param_1) sub_807E5E4(WEATHER_CLEAR); } -u32 sub_80848EC(void) +bool8 ShouldShowDungeonBanner(void) { - return 1; + return TRUE; } void sub_80848F0(void) @@ -674,7 +667,7 @@ void sub_8085140(void) } } -u8 sub_808529C(s32 speciesId_) +bool8 sub_808529C(s32 speciesId_) { s32 r3; s32 speciesId = 0; @@ -778,7 +771,7 @@ void sub_8085374(void) tile = GetTile(pos.x, pos.y); temp = sub_807034C(species, tile); if (temp == 0) { - struct unkStruct_806B7F8 local_30; + struct MonSpawnInfo local_30; local_30.species = species; local_30.level = 1; @@ -786,19 +779,19 @@ void sub_8085374(void) local_30.pos = pos; local_30.unk4 = temp; local_30.unk10 = 0; - sub_806B7F8(&local_30, 1); + SpawnWildMon(&local_30, 1); break; } j++; } } -Entity *xxx_call_GetLeader(void) +Entity *CutsceneGetLeader(void) { return GetLeader(); } -Entity *GetPartnerEntity(void) +Entity *CutsceneGetPartner(void) { s32 counter; Entity *entity; @@ -899,7 +892,7 @@ void sub_80855E4(DungeonCallback func) func(entity); } } - if ((!flag) && (partnerEntity = GetPartnerEntity(), partnerEntity != NULL)) { + if ((!flag) && (partnerEntity = CutsceneGetPartner(), partnerEntity != NULL)) { func(partnerEntity); } } @@ -920,13 +913,12 @@ void sub_808563C(DungeonCallback func) Entity *GetEntityFromMonsterBehavior(u8 entityType) { - Entity * entity; s32 index; - for(index = 0; index < DUNGEON_MAX_POKEMON; index++) - { - entity = gDungeon->activePokemon[index]; - if ((EntityIsValid(entity)) && (GetEntInfo(entity)->monsterBehavior == entityType)) return entity; + for (index = 0; index < DUNGEON_MAX_POKEMON; index++) { + Entity *entity = gDungeon->activePokemon[index]; + if (EntityIsValid(entity) && GetEntInfo(entity)->monsterBehavior == entityType) + return entity; } return NULL; } @@ -962,7 +954,7 @@ void sub_80856E0(Entity * pokemon, s32 direction) DungeonRunFrameActions(0x46); } -void sub_8085764(void) +static void sub_8085764(void) { Entity *entity; s32 index; @@ -978,19 +970,16 @@ void sub_8085764(void) } } -void sub_80857B8(void) +static void sub_80857B8(void) { u8 *direction; - EntityInfo *entityInfo; - Entity *entity; int index; - for(index = 0; index < DUNGEON_MAX_POKEMON; index++) - { - entity = gDungeon->activePokemon[index]; + for (index = 0; index < DUNGEON_MAX_POKEMON; index++) { + Entity *entity = gDungeon->activePokemon[index]; if (EntityIsValid(entity)) { - entityInfo = GetEntInfo(entity); - if ((gDungeon->unk4 == 0) && (gDungeon->unk2 == 0)) { + EntityInfo *entityInfo = GetEntInfo(entity); + if (gDungeon->unk4 == 0 && gDungeon->unk2 == 0) { UpdateEntityPixelPos(entity, 0); entityInfo->unk15C = 0; entityInfo->unkFE = 99; @@ -1087,7 +1076,7 @@ void sub_8085930(s32 direction) } } -void sub_80859F0(s32 direction) +static void sub_80859F0(s32 direction) { s32 index; Entity *entity; @@ -1389,7 +1378,6 @@ void sub_8085F78(void) case 0x2A: sub_808A718(); break; - case 0: case 0x3C: default: @@ -1464,7 +1452,7 @@ void sub_80861D4(Entity *a0, u8 r1, s32 direction) sub_80861EC(a0); } -void sub_80861EC(Entity *a0) +static void sub_80861EC(Entity *a0) { GetEntInfo(a0)->unkFE = 0x63; } @@ -1769,7 +1757,7 @@ void sub_8086690(void) void sub_80866C4(const struct DungeonDialogueStruct *dialogue) { - SpriteLookAroundEffect(xxx_call_GetLeader()); + SpriteLookAroundEffect(CutsceneGetLeader()); sub_803E708(10, 70); DisplayDungeonDialogue(dialogue); sub_803E708(10, 70); diff --git a/src/dungeon_cutscene_articuno.c b/src/dungeon_cutscene_articuno.c index 150d3d555..f9587c676 100644 --- a/src/dungeon_cutscene_articuno.c +++ b/src/dungeon_cutscene_articuno.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -31,35 +29,16 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" +#include "dungeon_leveling.h" +#include "weather.h" extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void sub_8088484(Entity *param_1); static void ArticunoScreenFlash(void); @@ -70,7 +49,7 @@ void sub_8087F54(void) Entity *leaderEntity; Entity *articunoEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_8085374(); @@ -102,7 +81,7 @@ void sub_8087FF8(void) Entity *leaderEntity; Entity *articunoEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO); sub_8085374(); sub_80854D4(); @@ -112,7 +91,7 @@ void sub_8087FF8(void) HandleFaint(articunoEntity,0x21c,0); } else { - sub_8072008(articunoEntity,articunoEntity,gArticunoConfigLevel,0,0); + LevelUpTarget(articunoEntity,articunoEntity,gArticunoConfigLevel,0,0); SetFacingDirection(articunoEntity, DIRECTION_SOUTH); sub_8086A3C(articunoEntity); } @@ -134,8 +113,8 @@ void ArticunoPreFightDialogue(void) Entity *partnerEntity; Entity *articunoEntity; - leaderEntity = xxx_call_GetLeader(); - partnerEntity = GetPartnerEntity(); + leaderEntity = CutsceneGetLeader(); + partnerEntity = CutsceneGetPartner(); articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO); sub_8086448(); SpriteLookAroundEffect(partnerEntity); @@ -211,7 +190,7 @@ void ArticunoReFightDialogue(void) Entity *leaderEntity; Entity *articunoEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO); gDungeon->weather.unkE265 = WEATHER_SNOW; sub_807EAA0(0,1); @@ -233,7 +212,7 @@ void ArticunoPostStoryPreFightDialogue(void) Entity *leaderEntity; Entity *articunoEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO); sub_8086448(); if (sub_8086AE4(MONSTER_ARTICUNO)) { diff --git a/src/dungeon_cutscene_celebi.c b/src/dungeon_cutscene_celebi.c index 3a3085aa2..6a9bda2e7 100644 --- a/src/dungeon_cutscene_celebi.c +++ b/src/dungeon_cutscene_celebi.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -31,35 +29,16 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" +#include "dungeon_tilemap.h" +#include "weather.h" extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void sub_808C8E0(Entity *entity); static void sub_808C9B0(Entity *param_1); @@ -72,7 +51,7 @@ void sub_808C5C0(void) u32 XPos; s32 YPos; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); celebiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_CELEBI); DungeonStartNewBGM(MUS_FRIEND_AREA_HEALING_FOREST); sub_80854D4(); @@ -96,7 +75,7 @@ void CelebiJoinDialogue(void) s32 menuChoice; Entity *celebiEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); celebiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_CELEBI); if ((HasRecruitedMon(MONSTER_CELEBI)) || (!sub_806FD18(celebiEntity))) { diff --git a/src/dungeon_cutscene_deoxys.c b/src/dungeon_cutscene_deoxys.c index 5354575f1..04f3c43d8 100644 --- a/src/dungeon_cutscene_deoxys.c +++ b/src/dungeon_cutscene_deoxys.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -32,36 +30,14 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern s32 gDungeonBrightness; extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void DeoxysScreenFlash(void); static void sub_808C550(void); @@ -73,7 +49,7 @@ void sub_808C3A0(void) { Entity * leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); DungeonStopBGM(); sub_80854D4(); sub_8085930(DIRECTION_NORTH); @@ -101,7 +77,7 @@ void DeoxysPreFightDialogue(void) { Entity * leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8086448(); if (HasRecruitedMon(MONSTER_DEOXYS_NORMAL)) { // There appears to be no one here. diff --git a/src/dungeon_cutscene_empty_summit.c b/src/dungeon_cutscene_empty_summit.c index 449fe07db..b98df1523 100644 --- a/src/dungeon_cutscene_empty_summit.c +++ b/src/dungeon_cutscene_empty_summit.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -32,7 +30,6 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern void sub_8086A3C(Entity *pokemon); void sub_80885A0(void) { @@ -46,7 +43,7 @@ void sub_80885C4(void) { Entity * leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); DungeonFadeOutBGM(0x3c); sub_803E708(0x3c,0x46); DungeonStopBGM(); diff --git a/src/dungeon_cutscene_entei.c b/src/dungeon_cutscene_entei.c index e7a5b43c6..3b242fe95 100644 --- a/src/dungeon_cutscene_entei.c +++ b/src/dungeon_cutscene_entei.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -35,31 +33,10 @@ extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void EnteiScreenFlash(void); @@ -68,7 +45,7 @@ void sub_8089C44(void) Entity * leaderEntity; Entity * EnteiEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); EnteiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ENTEI); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -83,7 +60,7 @@ void sub_8089C90(void) Entity * leaderEntity; Entity * EnteiEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); EnteiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ENTEI); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -111,7 +88,7 @@ void EnteiPreFightDialogue(void) Entity * leaderEntity; Entity * EnteiEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); EnteiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ENTEI); EnteiScreenFlash(); DisplayDungeonDialogue(&gEnteiPreFightDialogue_1); @@ -129,7 +106,7 @@ void EnteiReFightDialogue(void) Entity * leaderEntity; Entity * EnteiEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); EnteiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ENTEI); EnteiScreenFlash(); DisplayDungeonDialogue(&gEnteiReFightDialogue_1); @@ -147,7 +124,7 @@ void EnteiPostStoryPreFightDialogue(void) Entity * leaderEntity; Entity * EnteiEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); EnteiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ENTEI); if (HasRecruitedMon(MONSTER_ENTEI)) { sub_80866C4(&gEnteiPostStoryPreFightDialogue_4); diff --git a/src/dungeon_cutscene_groudon.c b/src/dungeon_cutscene_groudon.c index 98e5e15ca..10a7612ec 100644 --- a/src/dungeon_cutscene_groudon.c +++ b/src/dungeon_cutscene_groudon.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -31,35 +29,16 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" +#include "dungeon_tilemap.h" +#include "dungeon_leveling.h" extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void SceneGroudonMovement(Entity * groudonEntity); static void GroudonScreenFlash(void); @@ -71,7 +50,7 @@ void sub_808862C(void) Entity * alakazamEntity; Entity * groudonEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_1); groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); @@ -98,7 +77,7 @@ void sub_80886C4(void) u32 XPos; s32 YPos; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_1); groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2); PlaySoundEffect(0x3e5); @@ -123,7 +102,7 @@ void sub_808875C(void) Entity * alakazamEntity; Entity * groudonEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_1); groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2); sub_80867F4(); @@ -135,7 +114,7 @@ void sub_808875C(void) HandleFaint(groudonEntity,0x21c,0); } else { - sub_8072008(groudonEntity,groudonEntity,gGroudonConfigLevel,0,0); + LevelUpTarget(groudonEntity,groudonEntity,gGroudonConfigLevel,0,0); SetFacingDirection(groudonEntity, DIRECTION_SOUTH); sub_80861D4(groudonEntity,0xf,DIRECTION_SOUTH); } @@ -164,8 +143,8 @@ void GroudonPreFightDialogue(void) Entity * alakazamEntity; Entity * groudonEntity; - leaderEntity = xxx_call_GetLeader(); - partnerEntity = GetPartnerEntity(); + leaderEntity = CutsceneGetLeader(); + partnerEntity = CutsceneGetPartner(); alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_1); groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2); sub_8086448(); @@ -244,7 +223,7 @@ void GroudonReFightDialogue(void) Entity * leaderEntity; Entity * groudonEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2); sub_8086838(1,1,1); sub_808680C(); @@ -276,7 +255,7 @@ void GroudonPostStoryPreFightDialogue(void) Entity * leaderEntity; Entity * groudonEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2); sub_8086448(); if (sub_8086AE4(MONSTER_GROUDON)) { diff --git a/src/dungeon_cutscene_hooh.c b/src/dungeon_cutscene_hooh.c index f608e1456..6aac60626 100644 --- a/src/dungeon_cutscene_hooh.c +++ b/src/dungeon_cutscene_hooh.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -35,31 +33,10 @@ extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void HoOhDropInEffect(Entity * param_1); static void HoOhScreenFlash(void); @@ -69,7 +46,7 @@ void sub_808A608(void) Entity * leaderEntity; Entity * HoOhEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH); DungeonStartNewBGM(MUS_FRIEND_AREA_RAINBOW_PEAK); sub_80867F4(); @@ -87,7 +64,7 @@ void sub_808A668(void) Entity * leaderEntity; Entity * HoOhEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH); DungeonStartNewBGM(MUS_FRIEND_AREA_RAINBOW_PEAK); sub_80867F4(); @@ -124,7 +101,7 @@ void HoOhPreFightDialogue(void) Entity * HoOhEntity; PixelPos local_14; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH); local_14.x = leaderEntity->pixelPos.x; local_14.y = leaderEntity->pixelPos.y + -0x1000; @@ -163,7 +140,7 @@ void HoOhReFightDialogue(void) Entity * HoOhEntity; PixelPos local_14; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH); local_14.x = leaderEntity->pixelPos.x; diff --git a/src/dungeon_cutscene_jirachi.c b/src/dungeon_cutscene_jirachi.c index 3e4e6f14b..a44f8c870 100644 --- a/src/dungeon_cutscene_jirachi.c +++ b/src/dungeon_cutscene_jirachi.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -31,37 +29,17 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" - -extern s32 gDungeonBrightness; +#include "dungeon_floor_spawns.h" +#include "dungeon_map.h" +#include "dungeon_mon_spawn.h" extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void sub_808B50C(void); static void JirachiWish(void); @@ -80,7 +58,7 @@ void sub_808B2F4(void) Entity * leaderEntity; Entity * jirachiEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI); DungeonStartNewBGM(MUS_FRIEND_AREA_FOREST); CreateJirachiWishWarpTile(); @@ -99,7 +77,7 @@ void sub_808B35C(void) Entity * leaderEntity; Entity * jirachiEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI); DungeonStartNewBGM(MUS_FRIEND_AREA_FOREST); sub_80854D4(); @@ -149,7 +127,7 @@ void JirachiPreFightDialogue(void) Entity * leaderEntity; Entity * jirachiEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI); sub_8086448(); sub_803E708(0x40,70); diff --git a/src/dungeon_cutscene_kyogre.c b/src/dungeon_cutscene_kyogre.c index 28e7afd4f..792317995 100644 --- a/src/dungeon_cutscene_kyogre.c +++ b/src/dungeon_cutscene_kyogre.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -31,37 +29,16 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" - -extern s32 gDungeonBrightness; +#include "dungeon_tilemap.h" +#include "dungeon_map.h" extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void nullsub_99(void); static void KyogreScreenFlash(void); @@ -75,7 +52,7 @@ void sub_808C10C(void) u32 XPos; s32 YPos; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); kyogreEntity = GetEntityFromMonsterBehavior(BEHAVIOR_KYOGRE); DungeonStopBGM(); sub_80854D4(); @@ -108,7 +85,7 @@ void KyogrePreFightDialogue(void) Entity *leaderEntity; Entity *KyogreEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); KyogreEntity = GetEntityFromMonsterBehavior(BEHAVIOR_KYOGRE); DungeonStopBGM(); if (HasRecruitedMon(MONSTER_KYOGRE)) { diff --git a/src/dungeon_cutscene_latios.c b/src/dungeon_cutscene_latios.c index 4e881956e..2241c46e2 100644 --- a/src/dungeon_cutscene_latios.c +++ b/src/dungeon_cutscene_latios.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -32,36 +30,14 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern s32 gDungeonBrightness; extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void LatiosScreenFlash(void); @@ -70,7 +46,7 @@ void sub_808A9E4(void) Entity * leaderEntity; Entity * LatiosEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -86,7 +62,7 @@ void sub_808AA3C(void) Entity * leaderEntity; Entity * LatiosEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -102,7 +78,7 @@ void sub_808AA94(void) Entity * leaderEntity; Entity * LatiosEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -128,7 +104,7 @@ void LatiosPreFightDialogue(void) PixelPos local_18; DungeonPos local_19; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS); local_18.x = LatiosEntity->pixelPos.x; @@ -159,7 +135,7 @@ void LatiosReFightDialogue(void) Entity * leaderEntity; Entity * LatiosEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS); sub_8086448(); sub_808692C(); diff --git a/src/dungeon_cutscene_lugia.c b/src/dungeon_cutscene_lugia.c index 6cc21597a..6a20657aa 100644 --- a/src/dungeon_cutscene_lugia.c +++ b/src/dungeon_cutscene_lugia.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -32,36 +30,14 @@ #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" -extern s32 gDungeonBrightness; extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void LugiaScreenFlash(void); static void LugiaScreenFlash2(void); @@ -72,7 +48,7 @@ void sub_808BDEC(void) Entity * leaderEntity; Entity * lugiaEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); lugiaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LUGIA); DungeonStopBGM(); sub_80854D4(); @@ -102,7 +78,7 @@ void LugiaPreFightDialogue(void) Entity * leaderEntity; Entity * lugiaEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); lugiaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LUGIA); if (HasRecruitedMon(MONSTER_LUGIA)) { sub_8086448(); diff --git a/src/dungeon_cutscene_magma_cavern.c b/src/dungeon_cutscene_magma_cavern.c index 922c59256..1b16419e5 100644 --- a/src/dungeon_cutscene_magma_cavern.c +++ b/src/dungeon_cutscene_magma_cavern.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -35,31 +33,10 @@ extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void sub_80891F0(void); static void sub_8089294(void); @@ -70,7 +47,7 @@ void sub_8088DC0(void) Entity * groudonEntity; Entity * alakazamEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_1); alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_2); sub_80867F4(); @@ -94,7 +71,7 @@ void sub_8088E5C(void) Entity * groudonEntity; Entity * alakazamEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_1); alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_2); sub_80867F4(); @@ -123,8 +100,8 @@ void MagmaCavernMidDialogue(void) s16 IDStack [2]; PixelPos pos; - leaderEntity = xxx_call_GetLeader(); - partnerEntity = GetPartnerEntity(); + leaderEntity = CutsceneGetLeader(); + partnerEntity = CutsceneGetPartner(); groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_1); alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_2); sub_8052D44(IDStack,leaderEntity,partnerEntity); @@ -240,7 +217,7 @@ void sub_8089168(void) { Entity *leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8086448(); sub_803E708(10,0x46); SpriteLookAroundEffect(leaderEntity); diff --git a/src/dungeon_cutscene_mankey.c b/src/dungeon_cutscene_mankey.c index c13a95465..0d6f334ce 100644 --- a/src/dungeon_cutscene_mankey.c +++ b/src/dungeon_cutscene_mankey.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -35,31 +33,10 @@ extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void sub_80898F8(Entity *r0); static void sub_8089908(Entity *r0); @@ -68,7 +45,7 @@ void sub_808970C(void) { Entity *leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); DungeonStartNewBGM(MUS_TINY_WOODS); sub_80854D4(); sub_8085930(DIRECTION_NORTH); @@ -81,7 +58,7 @@ void sub_808974C(void) { Entity *leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); @@ -116,7 +93,7 @@ void sub_80897F0(void) { Entity *leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8086448(); sub_803E708(10,0x46); sub_808563C(SpriteShockEffect); @@ -151,7 +128,7 @@ void sub_8089878(void) { Entity *leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8086448(); sub_803E708(10,0x46); sub_808563C(SpriteShockEffect); diff --git a/src/dungeon_cutscene_meanies.c b/src/dungeon_cutscene_meanies.c index e2a898348..00321a511 100644 --- a/src/dungeon_cutscene_meanies.c +++ b/src/dungeon_cutscene_meanies.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -35,31 +33,10 @@ extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void sub_8087144(void); @@ -67,7 +44,7 @@ void sub_8086E9C(void) { Entity * leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_8085374(); sub_80854D4(); @@ -84,7 +61,7 @@ void sub_8086F00(void) { Entity * leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); @@ -122,7 +99,7 @@ void TeamMeaniesPreFightDialogue(void) { Entity *leaderEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8086448(); sub_803E708(10, 0x46); DisplayDungeonDialogue(gTeamMeaniesPreFightDialogue_1); @@ -149,8 +126,8 @@ void TeamMeaniesReFightDialogue(void) Entity *leaderEntity; Entity *partnerEntity; - leaderEntity = xxx_call_GetLeader(); - partnerEntity = GetPartnerEntity(); + leaderEntity = CutsceneGetLeader(); + partnerEntity = CutsceneGetPartner(); sub_8086448(); DisplayDungeonDialogue(gTeamMeaniesReFightDialogue_1); sub_803E708(10, 0x46); diff --git a/src/dungeon_cutscene_medicham.c b/src/dungeon_cutscene_medicham.c index d3e490535..2eddd47f5 100644 --- a/src/dungeon_cutscene_medicham.c +++ b/src/dungeon_cutscene_medicham.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -35,38 +33,17 @@ extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); void sub_808C9C4(void) { Entity *leaderEntity; Entity *medichamEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); medichamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEDICHAM); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -134,7 +111,7 @@ void sub_808CB5C(void) Entity *leaderEntity; Entity *medichamEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); medichamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEDICHAM); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); diff --git a/src/dungeon_cutscene_mewtwo.c b/src/dungeon_cutscene_mewtwo.c index 8a7c5f8c6..f898f1dbb 100644 --- a/src/dungeon_cutscene_mewtwo.c +++ b/src/dungeon_cutscene_mewtwo.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -35,31 +33,10 @@ extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void MewtwoDropInEffect(Entity *mewtwoEntity); static void MewtwoScreenFlash(void); @@ -69,7 +46,7 @@ void sub_8089914(void) Entity *leaderEntity; Entity *MewtwoEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); MewtwoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEWTWO); DungeonStopBGM(); gDungeon->unk7 = 1; @@ -87,7 +64,7 @@ void sub_8089978(void) Entity *leaderEntity; Entity *MewtwoEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); MewtwoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEWTWO); DungeonStopBGM(); sub_80854D4(); @@ -119,7 +96,7 @@ void MewtwoPreFightDialogue(void) Entity *leaderEntity; Entity *MewtwoEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); MewtwoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEWTWO); sub_8086448(); DisplayDungeonDialogue(&gMewtwoPreFightDialogue_1); @@ -146,7 +123,7 @@ void MewtwoReFightDialogue(void) Entity *leaderEntity; Entity *MewtwoEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); MewtwoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEWTWO); sub_8086448(); if(HasRecruitedMon(MONSTER_MEWTWO)) { diff --git a/src/dungeon_cutscene_moltres.c b/src/dungeon_cutscene_moltres.c index 099060fec..a1d884c7b 100644 --- a/src/dungeon_cutscene_moltres.c +++ b/src/dungeon_cutscene_moltres.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -31,36 +29,16 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" +#include "dungeon_tilemap.h" +#include "dungeon_leveling.h" extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); -extern void sub_8085F44(s32); static void MoltresDropInEffect(Entity * moltresEntity); static void MoltresScreenFlash1(s32 xArg, s32 yArg); @@ -73,7 +51,7 @@ void sub_80877E8(void) Entity * leaderEntity; Entity * moltresEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); moltresEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MOLTRES); DungeonStartNewBGM(MUS_THE_MOUNTAIN_OF_FIRE); sub_8085374(); @@ -94,7 +72,7 @@ void sub_8087848(void) u32 XPos; s32 YPos; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); moltresEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MOLTRES); DungeonStartNewBGM(MUS_THE_MOUNTAIN_OF_FIRE); sub_80854D4(); @@ -104,7 +82,7 @@ void sub_8087848(void) HandleFaint(moltresEntity,0x21c,0); } else { - sub_8072008(moltresEntity,moltresEntity,gMoltresConfigLevel,0,0); + LevelUpTarget(moltresEntity,moltresEntity,gMoltresConfigLevel,0,0); SetFacingDirection(moltresEntity, DIRECTION_SOUTH); sub_8086A3C(moltresEntity); } @@ -129,8 +107,8 @@ void MoltresPreFightDialogue(void) Entity *partnerEntity; Entity *moltresEntity; - leaderEntity = xxx_call_GetLeader(); - partnerEntity = GetPartnerEntity(); + leaderEntity = CutsceneGetLeader(); + partnerEntity = CutsceneGetPartner(); moltresEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MOLTRES); MoltresScreenFlash1(0xc,5); sub_8086500(); @@ -198,8 +176,8 @@ void MoltresReFightDialogue(void) Entity *partnerEntity; Entity *moltresEntity; - leaderEntity = xxx_call_GetLeader(); - partnerEntity = GetPartnerEntity(); + leaderEntity = CutsceneGetLeader(); + partnerEntity = CutsceneGetPartner(); moltresEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MOLTRES); MoltresScreenFlash1(10,5); sub_8086500(); @@ -239,7 +217,7 @@ void MoltresPostStoryPreFightDialogue(void) Entity * leaderEntity; Entity * moltresEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); moltresEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MOLTRES); MoltresScreenFlash1(0xc,5); sub_808654C(); diff --git a/src/dungeon_cutscene_no_one_here.c b/src/dungeon_cutscene_no_one_here.c index 693c6cd95..dafa10f15 100644 --- a/src/dungeon_cutscene_no_one_here.c +++ b/src/dungeon_cutscene_no_one_here.c @@ -1,6 +1,6 @@ #include "global.h" #include "globaldata.h" -#include "code_80869E4.h" +#include "dungeon_cutscene.h" #include "dungeon_boss_dialogue.h" void sub_808CD9C(void) diff --git a/src/dungeon_cutscene_raikou.c b/src/dungeon_cutscene_raikou.c index 98767430f..416b38a16 100644 --- a/src/dungeon_cutscene_raikou.c +++ b/src/dungeon_cutscene_raikou.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -31,35 +29,15 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" +#include "weather.h" extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void RaikouScreenFlash(void); @@ -68,7 +46,7 @@ void sub_8089EFC(void) Entity * leaderEntity; Entity * RaikouEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -83,7 +61,7 @@ void sub_8089F44(void) Entity * leaderEntity; Entity * RaikouEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -98,7 +76,7 @@ void sub_8089F8C(void) Entity * leaderEntity; Entity * RaikouEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -126,7 +104,7 @@ void RaikouPreFightDialogue(void) Entity * leaderEntity; Entity * RaikouEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU); DisplayDungeonDialogue(&gRaikouPreFightDialogue_1); RaikouScreenFlash(); @@ -151,7 +129,7 @@ void RaikouReFightDialogue(void) Entity * leaderEntity; Entity * RaikouEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU); gDungeon->weather.unkE265 = WEATHER_RAIN; sub_807EAA0(0,1); @@ -171,7 +149,7 @@ void RaikouPostStoryPreFightDialogue(void) Entity * leaderEntity; Entity * RaikouEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU); if (HasRecruitedMon(MONSTER_RAIKOU)) { sub_80866C4(&gRaikouPostStoryPreFightDialogue_4); diff --git a/src/dungeon_cutscene_rayquaza.c b/src/dungeon_cutscene_rayquaza.c index b7515b02e..e994be968 100644 --- a/src/dungeon_cutscene_rayquaza.c +++ b/src/dungeon_cutscene_rayquaza.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -31,35 +29,15 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" +#include "dungeon_leveling.h" extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void RayquazaDropInEffect(Entity *rayquazaEntity); static void RayquazaScreenFlash(void); @@ -69,7 +47,7 @@ void sub_80892C8(void) Entity * leaderEntity; Entity * RayquazaEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); RayquazaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAYQUAZA); DungeonStartNewBGM(MUS_RAYQUAZAS_DOMAIN); sub_8085374(); @@ -87,7 +65,7 @@ void sub_8089328(void) Entity * leaderEntity; Entity * rayquazaEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); rayquazaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAYQUAZA); DungeonStartNewBGM(MUS_RAYQUAZAS_DOMAIN); sub_80854D4(); @@ -97,7 +75,7 @@ void sub_8089328(void) HandleFaint(rayquazaEntity,0x21c,0); } else { - sub_8072008(rayquazaEntity,rayquazaEntity,gRayquazaConfigLevel,0,0); + LevelUpTarget(rayquazaEntity,rayquazaEntity,gRayquazaConfigLevel,0,0); sub_8086A3C(rayquazaEntity); } sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3); @@ -118,8 +96,8 @@ void RayquazaPreFightDialogue(void) Entity *partnerEntity; Entity *rayquazaEntity; - leaderEntity = xxx_call_GetLeader(); - partnerEntity = GetPartnerEntity(); + leaderEntity = CutsceneGetLeader(); + partnerEntity = CutsceneGetPartner(); rayquazaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAYQUAZA); sub_8086448(); DisplayDungeonDialogue(&gRayquazaPreFightDialogue_1); @@ -158,7 +136,7 @@ void RayquazaReFightDialogue(void) Entity *leaderEntity; Entity *rayquazaEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); rayquazaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAYQUAZA); sub_8086448(); RayquazaScreenFlash(); @@ -182,7 +160,7 @@ void RayquazaPostStoryPreFightDialogue(void) Entity *leaderEntity; Entity *rayquazaEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); rayquazaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAYQUAZA); sub_8086448(); if (sub_8086AE4(MONSTER_RAYQUAZA)) { diff --git a/src/dungeon_cutscene_regis.c b/src/dungeon_cutscene_regis.c index 632d11a53..077bdf7bc 100644 --- a/src/dungeon_cutscene_regis.c +++ b/src/dungeon_cutscene_regis.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -31,35 +29,15 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" +#include "dungeon_map.h" extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void sub_808B1CC(u8 itemID); static void SetupRegiFacingDirection(Entity *regiEntity); @@ -156,7 +134,7 @@ void sub_808AE54(u8 param_1,u8 param_2,DungeonPos *param_3) Item item; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8052D44(IDStack,leaderEntity,0); if (!sub_8098100(0x22) && (param_2 == 0x2E) && (param_1 == 0x17)) { sub_808B1CC(ITEM_NOTHING); @@ -178,7 +156,7 @@ void sub_808AEC8(u8 param_1,u8 param_2,DungeonPos *param_3) Item item; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8052D44(IDStack,leaderEntity,0); if (!sub_8098100(0x22) && (param_2 == 0x2F) && (param_1 == 0x18)) { sub_808B1CC(ITEM_NOTHING); @@ -200,7 +178,7 @@ void sub_808AF3C(u8 param_1,u8 param_2,DungeonPos *param_3) Item item; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8052D44(IDStack,leaderEntity,0); if (!sub_8098100(0x22) && (param_2 == 0x30) && (param_1 == 0x19)) { sub_808B1CC(ITEM_NOTHING); @@ -220,7 +198,7 @@ void sub_808AFB0(u8 param_1) Entity * leaderEntity; s16 IDStack [2]; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8052D44(IDStack,leaderEntity,0); if (!sub_8098100(0x22) && (param_1 == 0x2E) && (!sub_8098100(0x1d)) && (sub_80860A8(ITEM_ROCK_PART) != 0)) { sub_8097FD0(0x1d); @@ -238,7 +216,7 @@ void sub_808B030(u8 param_1) Entity * leaderEntity; s16 IDStack [2]; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8052D44(IDStack,leaderEntity,0); if (!sub_8098100(0x22) && (param_1 == 0x2F) && (!sub_8098100(0x1d)) && (sub_80860A8(ITEM_ICE_PART) != 0)) { sub_8097FD0(0x1d); @@ -256,7 +234,7 @@ void sub_808B0B0(u8 param_1) Entity * leaderEntity; s16 IDStack [2]; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); sub_8052D44(IDStack,leaderEntity,0); if (!sub_8098100(0x22) && (param_1 == 0x30) && (!sub_8098100(0x1d)) && (sub_80860A8(ITEM_STEEL_PART) != 0)) { sub_8097FD0(0x1d); diff --git a/src/dungeon_cutscene_skarmory.c b/src/dungeon_cutscene_skarmory.c index 097a482da..e3ee7f37c 100644 --- a/src/dungeon_cutscene_skarmory.c +++ b/src/dungeon_cutscene_skarmory.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -35,31 +33,10 @@ extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void SkarmoryEntry(Entity * skarmoryEntity); @@ -69,7 +46,7 @@ void sub_8086B14(void) Entity * diglettEntity; Entity * skarmoryEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); @@ -90,7 +67,7 @@ void sub_8086B94(void) Entity * diglettEntity; Entity * skarmoryEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); @@ -119,8 +96,8 @@ void SkarmoryPreFightDialogue(void) PixelPos pos1; PixelPos pos2; - leaderEntity = xxx_call_GetLeader(); // Player - partnerEntity = GetPartnerEntity(); // Partner + leaderEntity = CutsceneGetLeader(); // Player + partnerEntity = CutsceneGetPartner(); // Partner diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); // Diglett skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); // Skarmory @@ -175,7 +152,7 @@ void SkarmoryReFightDialogue(void) Entity * skarmoryEntity; PixelPos pos; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); pos.x = skarmoryEntity->pixelPos.x; pos.y = skarmoryEntity->pixelPos.y + 0x2000; @@ -196,7 +173,7 @@ void SkarmoryReFightDialogue(void) void sub_8086E40(void) { - SpriteLookAroundEffect(xxx_call_GetLeader()); + SpriteLookAroundEffect(CutsceneGetLeader()); sub_803E708(10,0x46); DisplayDungeonDialogue(&gUnknown_8100D3C); sub_803E708(10,0x46); diff --git a/src/dungeon_cutscene_smeargle.c b/src/dungeon_cutscene_smeargle.c index 87e852662..84a92ea75 100644 --- a/src/dungeon_cutscene_smeargle.c +++ b/src/dungeon_cutscene_smeargle.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -35,31 +33,10 @@ extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); void DummyFightDialogue(void) { @@ -70,7 +47,7 @@ void sub_808CBB0(void) Entity *leaderEntity; Entity *smeargleEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); smeargleEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SMEARGLE); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -140,7 +117,7 @@ void sub_808CD44(void) Entity *leaderEntity; Entity *smeargleEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); smeargleEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SMEARGLE); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); diff --git a/src/dungeon_cutscene_suicune.c b/src/dungeon_cutscene_suicune.c index 66dde9db7..a4653fbe3 100644 --- a/src/dungeon_cutscene_suicune.c +++ b/src/dungeon_cutscene_suicune.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -35,31 +33,10 @@ extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); static void sub_808A528(Entity * param_1); static void SuicuneScreenFlash(void); @@ -69,7 +46,7 @@ void sub_808A264(void) Entity * leaderEntity; Entity * SuicuneEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -86,7 +63,7 @@ void sub_808A2C0(void) Entity * leaderEntity; Entity * SuicuneEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -101,7 +78,7 @@ void sub_808A308(void) Entity * leaderEntity; Entity * SuicuneEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_80854D4(); @@ -129,7 +106,7 @@ void SuicunePreFightDialogue(void) Entity * leaderEntity; Entity * SuicuneEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE); sub_8086448(); DisplayDungeonDialogue(&gSuicunePreFightDialogue_1); @@ -157,7 +134,7 @@ void SuicuneReFightDialogue(void) Entity * leaderEntity; Entity * SuicuneEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE); DisplayDungeonDialogue(&gSuicuneReFightDialogue_1); SuicuneScreenFlash(); @@ -174,7 +151,7 @@ void SuicunePostStoryPreFightDialogue(void) Entity * leaderEntity; Entity * SuicuneEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE); if (HasRecruitedMon(MONSTER_SUICUNE)) { sub_80866C4(&gSuicunePostStoryPreFightDialogue_4); diff --git a/src/dungeon_cutscene_zapdos.c b/src/dungeon_cutscene_zapdos.c index f16b22c74..b9eab71e2 100644 --- a/src/dungeon_cutscene_zapdos.c +++ b/src/dungeon_cutscene_zapdos.c @@ -1,25 +1,23 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_cutscene.h" #include "effect_main.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" -#include "code_80861A8.h" #include "code_806CD90.h" -#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" #include "dungeon_misc.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "exclusive_pokemon.h" #include "friend_area.h" @@ -31,35 +29,15 @@ #include "math.h" #include "dungeon_config.h" #include "dungeon_boss_dialogue.h" +#include "dungeon_leveling.h" extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); extern void sub_806FDF4(Entity *, Entity *, Entity **); -extern s32 GetCameraXPos(void); -extern s32 GetCameraYPos(void); -extern void sub_803F878(u32, s32); -extern void BgColorCallNullsub4(void); -extern void sub_8085EB0(void); extern void sub_8049884(void); extern void sub_8049B8C(void); -extern void UpdateMinimap(void); -extern void sub_8086A54(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_8041888(u32); -extern u32 sub_80861F8(u32, Entity *, u32); -extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); -extern void sub_807EAA0(u32, u32); -extern void sub_8072008(Entity *, Entity *, s16, u32, u32); -extern void sub_8085374(void); -extern u32 GetRandomFloorItem(u32); -extern bool8 sub_8085B80(struct_8085B80 *); -extern void sub_8086A3C(Entity *pokemon); -extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); -extern u8 sub_8086AE4(s16 _index); struct Zapdos1 { @@ -79,7 +57,7 @@ void sub_8087230(void) Entity *leaderEntity; Entity *zapdosEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); sub_8085374(); @@ -98,7 +76,7 @@ void sub_808729C(void) Entity *leaderEntity; Entity *zapdosEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); sub_80854D4(); sub_8085930(4); @@ -107,7 +85,7 @@ void sub_808729C(void) HandleFaint(zapdosEntity,0x21c,0); } else { - sub_8072008(zapdosEntity,zapdosEntity,gZapdosConfigLevel,0,0); + LevelUpTarget(zapdosEntity,zapdosEntity,gZapdosConfigLevel,0,0); SetFacingDirection(zapdosEntity,DIRECTION_SOUTH); sub_8086A3C(zapdosEntity); } @@ -138,8 +116,8 @@ void ZapdosPreFightDialogue(void) Entity *zapdosEntity; // sp 0x68 struct_8085B80 auStack_48; // r8 - leaderEntity = xxx_call_GetLeader(); - partnerEntity = GetPartnerEntity(); + leaderEntity = CutsceneGetLeader(); + partnerEntity = CutsceneGetPartner(); zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); sub_8086448(); sub_803E708(10,0x46); @@ -212,7 +190,7 @@ void ZapdosReFightDialogue(void) Entity *leaderEntity; Entity *zapdosEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); sub_8086448(); sub_803E708(10,0x46); @@ -237,7 +215,7 @@ void ZapdosPostStoryPreFightDialogue(void) Entity * leaderEntity; Entity * zapdosEntity; - leaderEntity = xxx_call_GetLeader(); + leaderEntity = CutsceneGetLeader(); zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); sub_8086448(); if (sub_8086AE4(MONSTER_ZAPDOS)) { diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index 847fbc994..c957b1f58 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -18,10 +18,12 @@ #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" #include "dungeon_misc.h" +#include "dungeon_leveling.h" #include "weather.h" #include "game_options.h" #include "code_8077274_1.h" @@ -33,14 +35,17 @@ #include "code_804267C.h" #include "code_805D8C8.h" #include "dungeon_map_access.h" +#include "dungeon_data.h" #include "move_effects_target.h" #include "pokemon.h" #include "position_util.h" #include "random.h" #include "sprite.h" #include "exclusive_pokemon.h" +#include "hurl_orb.h" +#include "dungeon_mon_spawn.h" +#include "move_orb_actions_1.h" -extern void sub_807F43C(Entity *, Entity *); extern void sub_8041B18(Entity *pokemon); extern void sub_8041B90(Entity *pokemon); extern void sub_8041D00(Entity *pokemon, Entity *target); @@ -49,13 +54,11 @@ extern void sub_803ED30(s32, Entity *r0, u8, s32); extern bool8 sub_806A458(Entity *); extern bool8 sub_806F660(Entity *, Entity *); extern bool8 sub_806A58C(s16 a0); -extern void sub_8071D4C(Entity *pokemon, Entity *target, s32 exp); extern void sub_8042148(Entity *pokemon); 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 *); @@ -68,18 +71,6 @@ extern void sub_80428D8(Entity *); extern void sub_8042978(Entity *); extern void sub_804298C(Entity *); extern void sub_80428EC(Entity *); -extern void ResetMonEntityData(EntityInfo *, u32); - -extern const s32 gUnknown_8106A4C; -extern const u8 *const gUnknown_8100548; -extern const u8 *const gUnknown_80FD46C; -extern const u8 *const gUnknown_810056C; -extern const s16 gUnknown_810AC60; -extern const s16 gUnknown_810AC68; -extern const s16 gUnknown_810AC64; -extern const s16 gUnknown_810AC66; -extern const s16 gUnknown_810AC68; -extern const s16 gUnknown_810AC62; static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *r5, bool32 isFalseSwipe, bool32 giveExp, s16 arg4_, s32 arg8); static bool8 sub_806E100(s48_16 *param_1, Entity *pokemon, Entity *target, u8 type, DamageStruct *dmgStruct); @@ -124,11 +115,11 @@ void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct * && GetEntInfo(target)->reflectClassStatus.status == STATUS_VITAL_THROW) { sub_8042730(target, attacker); - sub_807F43C(target, attacker); + HandleHurlOrb(target, attacker); } if (GetEntInfo(target)->bideClassStatus.status == STATUS_ENRAGED) { - RaiseAttackStageTarget(attacker, target, gUnknown_8106A4C, 1); + RaiseAttackStageTarget(attacker, target, gStatIndexAtkDef, 1); } if (!EntityIsValid(attacker) || !EntityIsValid(target)) @@ -455,7 +446,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc sub_806CE68(target, 8); } if (HasHeldItem(target, ITEM_JOY_RIBBON) && hpChange > 0 && dmgStruct->dmg != 9999) { - sub_8071D4C(attacker, target, hpChange); + AddExpPoints(attacker, target, hpChange); } if (unkTile != NULL) @@ -718,11 +709,11 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc if (targetData->isNotTeamMember) { s32 i; - sub_8071D4C(attacker, attacker, exp); + AddExpPoints(attacker, attacker, exp); for (i = 0; i < MAX_TEAM_MEMBERS; i++) { Entity *teamMember = gDungeon->teamPokemon[i]; if (EntityIsValid(teamMember) && teamMember != attacker) { - sub_8071D4C(attacker, teamMember, exp); + AddExpPoints(attacker, teamMember, exp); } } r10 = TRUE; diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c index dac39cfcb..77f02d803 100644 --- a/src/dungeon_engine.c +++ b/src/dungeon_engine.c @@ -3,37 +3,36 @@ #include "dungeon_engine.h" #include "run_dungeon.h" #include "dungeon_vram.h" +#include "dungeon_main.h" #include "constants/dungeon.h" -#include "dungeon_ai_leader.h" +#include "dungeon_action_execution.h" #include "dungeon_ai.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" +#include "dungeon_misc.h" #include "dungeon_util.h" +#include "dungeon_leveling.h" +#include "dungeon_turn_effects.h" #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" #include "constants/ability.h" #include "dungeon_logic.h" +#include "dungeon_cutscene.h" #include "menu_input.h" +#include "weather.h" -extern void TrySpawnMonsterAndActivatePlusMinus(void); extern void sub_807E378(void); -extern void sub_8044574(void); -extern void sub_8044820(void); -extern void sub_8044AB4(void); extern u8 DisplayActions(u32); -extern void TickStatusAndHealthRegen(Entity *); -extern void sub_8086AC0(void); -extern void EnemyEvolution(Entity *); -extern void TryActivateArtificialWeatherAbilities(void); -extern void DungeonHandlePlayerInput(void); extern void sub_805F02C(void); -extern void sub_8074094(Entity *); extern void sub_8071B48(void); -extern void sub_807EAA0(u32, u32); static void sub_8044454(void); static bool8 RunLeaderTurn(bool8); +static void sub_8044574(void); +static void sub_8044820(void); +static void TrySpawnMonsterAndActivatePlusMinus(void); +static void sub_8044AB4(void); -EWRAM_DATA DungeonPos gUnknown_202EE0C = {0}; +EWRAM_DATA DungeonPos gLeaderPosition = {0}; EWRAM_DATA MenuInputStruct gDungeonMenu = {0}; const s16 gSpeedTurns[NUM_SPEED_COUNTERS][25] = { @@ -110,7 +109,7 @@ static bool8 RunLeaderTurn(bool8 param_1) gDungeon->noActionInProgress = FALSE; if (IsFloorOver()) break; - sub_8072CF4(entity); + ExecuteEntityDungeonAction(entity); sub_8086AC0(); TryForcedLoss(0); if (IsFloorOver()) @@ -158,7 +157,7 @@ static void sub_8044454(void) if (EntityIsValid(entity)) { EnemyEvolution(entity); RunMonsterAI(entity, 0); - sub_8072CF4(entity); + ExecuteEntityDungeonAction(entity); sub_8086AC0(); TryForcedLoss(0); entityInfo->flags = (entityInfo->flags & ~(MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY)) | MOVEMENT_FLAG_UNK_14; @@ -183,7 +182,7 @@ void sub_80444F4(Entity *pokemon) if ((EntityIsValid(entity)) && (pokemon != entity) && (entityInfo = GetEntInfo(entity), (entityInfo->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY))) { if (IsFloorOver()) break; RunMonsterAI(entity, 0); - sub_8072CF4(entity); + ExecuteEntityDungeonAction(entity); sub_8086AC0(); TryForcedLoss(0); } @@ -197,7 +196,7 @@ struct Struct_8044574 struct Struct_8044574 *next; }; -void sub_8044574(void) +static void sub_8044574(void) { s32 i, id; struct Struct_8044574 sp0[4]; @@ -234,7 +233,7 @@ void sub_8044574(void) EnemyEvolution(teamMon); for (j = 0; j < 3; j++) { RunMonsterAI(teamMon, 0); - if (IsFloorOver() || !sub_8072CF4(teamMon)) + if (IsFloorOver() || !ExecuteEntityDungeonAction(teamMon)) break; sub_8086AC0(); TryForcedLoss(0); @@ -291,7 +290,7 @@ void sub_8044574(void) info->recalculateFollow = TRUE; info->aiAllySkip = FALSE; RunMonsterAI(entity,1); - sub_8072CF4(entity); + ExecuteEntityDungeonAction(entity); sub_8086AC0(); TryForcedLoss(0); EntityIsValid(entity); // Does nothing @@ -306,7 +305,7 @@ void sub_8044574(void) if (EntityIsValid(teamMon)) { EntityInfo *teamMonInfo = GetEntInfo(teamMon); if (teamMonInfo->aiAllySkip) { - sub_8074094(teamMon); + ApplyEndOfTurnEffects(teamMon); if (EntityIsValid(teamMon)) { EnemyEvolution(teamMon); teamMonInfo->aiAllySkip = FALSE; @@ -317,7 +316,7 @@ void sub_8044574(void) } } -void sub_8044820(void) +static void sub_8044820(void) { s32 movSpeed; EntityInfo *entityInfo; @@ -350,7 +349,7 @@ void sub_8044820(void) EnemyEvolution(entity); RunMonsterAI(entity, 0); if (IsFloorOver()) break; - sub_8072CF4(entity); + ExecuteEntityDungeonAction(entity); sub_8086AC0(); TryForcedLoss(0); if (IsFloorOver()) break; @@ -367,7 +366,7 @@ void sub_8044820(void) entity2 = gDungeon->wildPokemon[index]; if ((EntityIsValid(entity2)) && (entityInfo2 = GetEntInfo(entity2), entityInfo2->aiAllySkip)) { - sub_8074094(entity2); + ApplyEndOfTurnEffects(entity2); if (EntityIsValid(entity2)) { EnemyEvolution(entity2); entityInfo2->aiAllySkip = FALSE; @@ -377,7 +376,7 @@ void sub_8044820(void) } } -void TrySpawnMonsterAndActivatePlusMinus(void) +static void TrySpawnMonsterAndActivatePlusMinus(void) { EntityInfo * entityInfo; Entity *entity; @@ -424,7 +423,7 @@ void TrySpawnMonsterAndActivatePlusMinus(void) } } -void sub_8044AB4(void) +static void sub_8044AB4(void) { s32 index; diff --git a/src/dungeon_spawns.c b/src/dungeon_floor_spawns.c similarity index 98% rename from src/dungeon_spawns.c rename to src/dungeon_floor_spawns.c index 84f08f9af..4506e5594 100644 --- a/src/dungeon_spawns.c +++ b/src/dungeon_floor_spawns.c @@ -1,10 +1,8 @@ #include "global.h" #include "globaldata.h" -#include "dungeon_spawns.h" +#include "dungeon_floor_spawns.h" #include "constants/dungeon.h" #include "constants/trap.h" -#include "structs/str_202ED28.h" -#include "structs/str_202EDE8.h" #include "bg_palette_buffer.h" #include "graphics_memory.h" #include "code_800D090.h" diff --git a/src/dungeon_generation.c b/src/dungeon_generation.c index 006f615e2..75eb3b7a2 100644 --- a/src/dungeon_generation.c +++ b/src/dungeon_generation.c @@ -17,14 +17,15 @@ #include "dungeon_config.h" #include "dungeon_generation_fixed.h" #include "dungeon_pos_data.h" +#include "dungeon_data.h" +#include "dungeon_mon_spawn.h" +#include "run_dungeon.h" 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); -extern u8 GetFloorType(); -extern void sub_806C330(s32 a0, s32 a1, s16 a2, u8 a3); enum CardinalDirection { diff --git a/src/dungeon_generation_fixed.c b/src/dungeon_generation_fixed.c index ba3c2ec72..13d20610f 100644 --- a/src/dungeon_generation_fixed.c +++ b/src/dungeon_generation_fixed.c @@ -9,11 +9,11 @@ #include "dungeon_util.h" #include "dungeon_items.h" #include "dungeon_message.h" -#include "dungeon_spawns.h" -#include "structs/str_806B7F8.h" +#include "dungeon_floor_spawns.h" #include "constants/monster.h" #include "constants/trap.h" #include "constants/item.h" +#include "dungeon_mon_spawn.h" extern void sub_80429FC(DungeonPos *r0); @@ -42,7 +42,7 @@ static void SpawnItemAtPos(u8 itemId, s32 x, s32 y, s32 quantity, u32 itemFlags) // s16 species memes strike again. Will the fix ever be discovered? static void SpawnSpeciesAtPos(s16 species_, s32 x, s32 y, u32 monsterBehav_, u32 UNUSED unused) { - struct unkStruct_806B7F8 unkStruct; + struct MonSpawnInfo unkStruct; s32 species = SpeciesId(species_); u8 monsterBehav = monsterBehav_; @@ -54,7 +54,7 @@ static void SpawnSpeciesAtPos(s16 species_, s32 x, s32 y, u32 monsterBehav_, u32 unkStruct.unk10 = 0; unkStruct.pos.x = x; unkStruct.pos.y = y; - sub_806B7F8(&unkStruct, TRUE); + SpawnWildMon(&unkStruct, TRUE); } else if (species != MONSTER_NONE) { unkStruct.species = species; @@ -64,7 +64,7 @@ static void SpawnSpeciesAtPos(s16 species_, s32 x, s32 y, u32 monsterBehav_, u32 unkStruct.unk10 = 0; unkStruct.pos.x = x; unkStruct.pos.y = y; - sub_806B7F8(&unkStruct, TRUE); + SpawnWildMon(&unkStruct, TRUE); } } diff --git a/src/dungeon_item_action.c b/src/dungeon_item_action.c index 290e55abb..41cbdf762 100644 --- a/src/dungeon_item_action.c +++ b/src/dungeon_item_action.c @@ -1,9 +1,9 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_item_action.h" #include "code_8041AD0.h" #include "dungeon_message.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "dungeon_random.h" #include "constants/dungeon_action.h" #include "constants/dungeon.h" @@ -28,106 +28,65 @@ #include "dungeon_menu_team.h" #include "dungeon_menu_moves.h" #include "dungeon_misc.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_data.h" #include "dungeon_logic.h" #include "dungeon_damage.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[]; +#include "dungeon_strings.h" +#include "dungeon_move.h" +#include "dungeon_leveling.h" +#include "warp_target.h" +#include "move_orb_actions_1.h" extern void sub_8078B5C(Entity *, Entity *, u32, u32, u32); extern void sub_8051E7C(Entity *pokemon); extern void sub_8045BF8(u8 *, Item *); extern void ActionShowMoveInfo(ActionContainer *); extern void ActionLinkMoves(ActionContainer *); -extern void sub_8044DF0(Entity *, u32, u32); -extern void SetLeaderActionToNothing(bool8); -extern void sub_8044E24(Entity *, u32, u32); extern void sub_804245C(Entity *, Item *); -extern u8 sub_8072938(Entity *, u16); -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); - -extern void EnemyEvolution(Entity *); -extern void SpawnDroppedItemWrapper(Entity *, DungeonPos *, Item *); -extern void sub_806A6E8(Entity *); extern void sub_8042390(Entity *, Item *); +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); + void sub_80479B8(char param_1, char param_2, u8 param_3, Entity *pokemon, Entity *target, Item *item) { EntityInfo *info; @@ -161,7 +120,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 +133,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 +156,7 @@ _jump: } else { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE458); + TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FE458); goto _080482B4; } } @@ -401,7 +360,7 @@ _jump: } else { - TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE458); + TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FE458); } break; } @@ -409,127 +368,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); + LevelUpTarget(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 +496,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 +510,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 +554,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 +582,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 +598,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 +618,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 +651,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 +673,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 +707,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 +758,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 +819,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 +881,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 +900,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 +929,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)) @@ -990,35 +947,35 @@ void GrimyFoodItemAction(Entity *pokemon, Entity * target) ParalyzeStatusTarget(pokemon, target, TRUE); break; case 4: - LowerAttackStageTarget(pokemon, target, gUnknown_8106A4C, 3, 1, TRUE); - LowerAttackStageTarget(pokemon, target, gUnknown_8106A50, 3, 1, TRUE); + LowerAttackStageTarget(pokemon, target, gStatIndexAtkDef, 3, 1, TRUE); + LowerAttackStageTarget(pokemon, target, gStatIndexSpecial, 3, 1, TRUE); break; } } -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_items.c b/src/dungeon_items.c index dfb4bb221..7b72e5d24 100644 --- a/src/dungeon_items.c +++ b/src/dungeon_items.c @@ -2,9 +2,7 @@ #include "globaldata.h" #include "dungeon_items.h" #include "code_8041AD0.h" -#include "code_80861A8.h" -#include "code_80869E4.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_random.h" #include "dungeon_util.h" #include "pokemon.h" @@ -16,6 +14,11 @@ #include "dungeon_map.h" #include "dungeon_strings.h" #include "dungeon_logic.h" +#include "dungeon_data.h" +#include "dungeon_pos_data.h" +#include "dungeon_floor_spawns.h" +#include "dungeon_cutscene.h" +#include "dungeon_boss_dialogue.h" #include "string_format.h" #include "items.h" #include "structs/map.h" @@ -25,21 +28,9 @@ #include "dungeon_vram.h" #include "sprite.h" -extern SpriteOAM gUnknown_202EDC0; - -extern const s32 gUnknown_810A3F0[]; -extern const u8 *gUnknown_810531C[]; -extern const u8 *gUnknown_8105360[]; -extern const u8 *gUnknown_81053A8[]; -extern const u8 *gUnknown_8105434[]; -extern const DungeonPos gUnknown_80F4468[]; - extern void sub_80416E0(PixelPos *r0, u32, bool8); -extern void sub_80855E4(void *); -extern void PlaySoundEffect(u32); extern void sub_804178C(u32); extern void sub_804219C(PixelPos *pos); -extern u32 GetRandomFloorItem(u32); static void MusicBoxCreation(void); static u8 sub_8046D70(void); @@ -806,18 +797,18 @@ static void MusicBoxCreation(void) Entity *leader = GetLeader(); sub_80855E4(sub_80861A8); gDungeon->unk1356C = 1; - DisplayDungeonMessage(0,*gUnknown_810531C,1); + DisplayDungeonMessage(0,gUnknown_810531C,1); sub_803E708(0x3c,0x41); - DisplayDungeonMessage(0,*gUnknown_8105360,1); + DisplayDungeonMessage(0,gUnknown_8105360,1); sub_80869E4(leader,4,10,0); sub_80416E0(&leader->pixelPos,0x10c,FALSE); sub_80421C0(leader,0xd7); sub_803E708(0x3c,0x41); SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],leader,0); - DisplayDungeonMessage(0,*gUnknown_81053A8,1); + DisplayDungeonMessage(0,gUnknown_81053A8,1); sub_803E708(10,0x41); PlaySoundEffect(0xd4); - DisplayDungeonMessage(0,*gUnknown_8105434,1); + DisplayDungeonMessage(0,gUnknown_8105434,1); sub_803E708(10,0x41); sub_804178C(1); gDungeon->unk1356C = 0; diff --git a/src/dungeon_jobs.c b/src/dungeon_jobs.c index 902aec840..e27b01290 100644 --- a/src/dungeon_jobs.c +++ b/src/dungeon_jobs.c @@ -6,7 +6,7 @@ #include "dungeon_message.h" #include "dungeon_misc.h" #include "dungeon_logic.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "string_format.h" #include "code_80958E8.h" #include "mailbox.h" diff --git a/src/dungeon_kecleon_shop.c b/src/dungeon_kecleon_shop.c index 04a8ebb4d..120c865bb 100644 --- a/src/dungeon_kecleon_shop.c +++ b/src/dungeon_kecleon_shop.c @@ -1,11 +1,12 @@ #include "global.h" #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" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_music.h" #include "dungeon_util.h" #include "pokemon.h" @@ -17,7 +18,6 @@ #include "position_util.h" #include "dungeon_ai.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "dungeon_random.h" #include "code_805D8C8.h" #include "dungeon_items.h" @@ -31,11 +31,11 @@ #include "sprite.h" #include "dungeon_strings.h" #include "dungeon_engine.h" +#include "warp_target.h" -bool8 sub_807EF48(void); -void sub_807EFFC(bool8 arg0); -s32 sub_807F19C(bool8 arg0); -void sub_807F33C(void); +static void sub_807EFFC(bool8 arg0); +static s32 sub_807F19C(bool8 arg0); +static void sub_807F33C(void); void sub_807EC28(bool8 arg0) { @@ -201,7 +201,7 @@ void sub_807EF84(void) } } -void sub_807EFFC(bool8 arg0) +static void sub_807EFFC(bool8 arg0) { struct MonDialogueSpriteInfo dialogueInfo; @@ -248,7 +248,7 @@ void sub_807EFFC(bool8 arg0) } } -s32 sub_807F19C(bool8 arg0) +static s32 sub_807F19C(bool8 arg0) { s32 diff; struct MonDialogueSpriteInfo dialogueInfo; @@ -309,7 +309,7 @@ s32 sub_807F19C(bool8 arg0) return 0; } -void sub_807F33C(void) +static void sub_807F33C(void) { s32 i, x, y; diff --git a/src/code_80718D8.c b/src/dungeon_leveling.c similarity index 86% rename from src/code_80718D8.c rename to src/dungeon_leveling.c index 9b8ac87f5..6c6d3092c 100644 --- a/src/code_80718D8.c +++ b/src/dungeon_leveling.c @@ -1,8 +1,9 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_leveling.h" #include "constants/tactic.h" #include "dungeon_config.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_message.h" #include "code_8041AD0.h" #include "code_8077274_1.h" @@ -12,11 +13,10 @@ #include "dungeon_random.h" #include "dungeon_vram.h" #include "dungeon_util.h" -#include "dungeon_spawns.h" +#include "dungeon_floor_spawns.h" #include "dungeon_info.h" #include "pokemon_3.h" #include "code_805D8C8.h" -#include "structs/str_806B7F8.h" #include "dungeon_logic.h" #include "dungeon_strings.h" #include "dungeon_menu_moves.h" @@ -25,25 +25,14 @@ #include "structs/dungeon_entity.h" #include "structs/map.h" #include "structs/str_pokemon.h" -#include "structs/str_806B7F8.h" #include "dungeon_pos_data.h" +#include "dungeon_music.h" +#include "dungeon_mon_spawn.h" -EWRAM_DATA s32 gUnknown_202F31C[2] = {0, 0}; -EWRAM_DATA s32 gUnknown_202F324[2] = {0, 0}; +static EWRAM_DATA s32 sNewAtkStats[2] = {0, 0}; +static EWRAM_DATA s32 sNewDefStats[2] = {0, 0}; -extern void ResetMonEntityData(EntityInfo *, u32); void sub_8042A44(Entity *r0); -void sub_8083D78(void); -void sub_8083D58(void); -void sub_8072778(Entity *, Entity *, u8, u8); -bool8 sub_80725A4(Entity *, Entity *); -void GetUnlockedTacticFlags(u8 *tacticsBuffer, s32 pokeLevel); -void sub_807218C(Entity *); - -extern void sub_8072B78(Entity *pokemon, Entity *target, s16 id); -extern s32 GetMovesLearnedAtLevel(u16* dst, s16 species, s32 level, s32 IQPoints); - -void sub_8072B24(Entity *entity, Move *moves); static const u8 gUnknown_8107010[8] = {0, 1, 1, 2, 1, 1, 0, 0}; static const u8 * const gUnknown_8107018[3] = { @@ -53,14 +42,18 @@ static const u8 * const gUnknown_8107018[3] = { }; static bool8 LevelUp(Entity *, Entity *, u8, u8); +static void sub_807218C(Entity *pokemon); +static bool8 sub_80725A4(Entity *pokemon, Entity *target); +static void sub_8072778(Entity *pokemon, Entity *target, u8 param_2, u8 param_3); +static void sub_8072B24(Entity *entity, Move *moves); +static void sub_8072B78(Entity *pokemon, Entity *target, s16 id); -void sub_8071D4C(Entity *pokemon, Entity *target, s32 exp) +void AddExpPoints(Entity *pokemon, Entity *target, s32 exp) { s32 newExp; s32 expDiff; - EntityInfo *info; - info = GetEntInfo(target); + EntityInfo *info = GetEntInfo(target); if (info->level != 100) { if (!IsExperienceLocked(info->joinedAt.id)) { newExp = info->exp + exp; @@ -180,7 +173,7 @@ void EnemyEvolution(Entity *entity) } } -void sub_8072008(Entity *pokemon, Entity *target, s32 level, u8 param_4, u8 param_5) +void LevelUpTarget(Entity *pokemon, Entity *target, s32 level, u8 param_4, u8 param_5) { bool8 flag; s32 newLevel; @@ -245,7 +238,7 @@ void sub_8072008(Entity *pokemon, Entity *target, s32 level, u8 param_4, u8 para } } -void sub_807218C(Entity *pokemon) +static void sub_807218C(Entity *pokemon) { EntityInfo *info; u8 buffer [400]; @@ -420,33 +413,33 @@ static bool8 LevelUp(Entity *pokemon, Entity *target, u8 param_3, u8 param_4) info->HP = info->maxHPStat; } - gUnknown_202F31C[0] = info->atk[0]; - gUnknown_202F31C[1] = info->atk[1]; - gUnknown_202F324[0] = info->def[0]; - gUnknown_202F324[1] = info->def[1]; + sNewAtkStats[0] = info->atk[0]; + sNewAtkStats[1] = info->atk[1]; + sNewDefStats[0] = info->def[0]; + sNewDefStats[1] = info->def[1]; - gUnknown_202F31C[0] += leveldata.gainAtt[0]; - gUnknown_202F31C[1] += leveldata.gainAtt[1]; - gUnknown_202F324[0] += leveldata.gainDef[0]; - gUnknown_202F324[1] += leveldata.gainDef[1]; + sNewAtkStats[0] += leveldata.gainAtt[0]; + sNewAtkStats[1] += leveldata.gainAtt[1]; + sNewDefStats[0] += leveldata.gainDef[0]; + sNewDefStats[1] += leveldata.gainDef[1]; - if(gUnknown_202F31C[0] > 254) - gUnknown_202F31C[0] = 255; - if(gUnknown_202F31C[1] > 254) - gUnknown_202F31C[1] = 255; - if(gUnknown_202F324[0] > 254) - gUnknown_202F324[0] = 255; - if(gUnknown_202F324[1] > 254) - gUnknown_202F324[1] = 255; + if(sNewAtkStats[0] > 254) + sNewAtkStats[0] = 255; + if(sNewAtkStats[1] > 254) + sNewAtkStats[1] = 255; + if(sNewDefStats[0] > 254) + sNewDefStats[0] = 255; + if(sNewDefStats[1] > 254) + sNewDefStats[1] = 255; LoadIQSkills(target); sub_8079764(target); - info->atk[0] = gUnknown_202F31C[0]; - info->atk[1] = gUnknown_202F31C[1]; - info->def[0] = gUnknown_202F324[0]; - info->def[1] = gUnknown_202F324[1]; + info->atk[0] = sNewAtkStats[0]; + info->atk[1] = sNewAtkStats[1]; + info->def[0] = sNewDefStats[0]; + info->def[1] = sNewDefStats[1]; sub_8072778(pokemon, target, param_3, param_4); } @@ -454,7 +447,7 @@ static bool8 LevelUp(Entity *pokemon, Entity *target, u8 param_3, u8 param_4) return flag; } -bool8 sub_80725A4(Entity *pokemon, Entity *target) +static bool8 sub_80725A4(Entity *pokemon, Entity *target) { EntityInfo *info; LevelData leveldata; @@ -514,33 +507,33 @@ bool8 sub_80725A4(Entity *pokemon, Entity *target) info->HP = info->maxHPStat; } - gUnknown_202F31C[0] = info->atk[0]; - gUnknown_202F31C[1] = info->atk[1]; - gUnknown_202F324[0] = info->def[0]; - gUnknown_202F324[1] = info->def[1]; + sNewAtkStats[0] = info->atk[0]; + sNewAtkStats[1] = info->atk[1]; + sNewDefStats[0] = info->def[0]; + sNewDefStats[1] = info->def[1]; - gUnknown_202F31C[0] -= leveldata.gainAtt[0]; - gUnknown_202F31C[1] -= leveldata.gainAtt[1]; - gUnknown_202F324[0] -= leveldata.gainDef[0]; - gUnknown_202F324[1] -= leveldata.gainDef[1]; + sNewAtkStats[0] -= leveldata.gainAtt[0]; + sNewAtkStats[1] -= leveldata.gainAtt[1]; + sNewDefStats[0] -= leveldata.gainDef[0]; + sNewDefStats[1] -= leveldata.gainDef[1]; - if(gUnknown_202F31C[0] <= 1) - gUnknown_202F31C[0] = 1; - if(gUnknown_202F31C[1] <= 1) - gUnknown_202F31C[1] = 1; - if(gUnknown_202F324[0] <= 1) - gUnknown_202F324[0] = 1; - if(gUnknown_202F324[1] <= 1) - gUnknown_202F324[1] = 1; + if(sNewAtkStats[0] <= 1) + sNewAtkStats[0] = 1; + if(sNewAtkStats[1] <= 1) + sNewAtkStats[1] = 1; + if(sNewDefStats[0] <= 1) + sNewDefStats[0] = 1; + if(sNewDefStats[1] <= 1) + sNewDefStats[1] = 1; LoadIQSkills(target); sub_8079764(target); - info->atk[0] = gUnknown_202F31C[0]; - info->atk[1] = gUnknown_202F31C[1]; - info->def[0] = gUnknown_202F324[0]; - info->def[1] = gUnknown_202F324[1]; + info->atk[0] = sNewAtkStats[0]; + info->atk[1] = sNewAtkStats[1]; + info->def[0] = sNewDefStats[0]; + info->def[1] = sNewDefStats[1]; } } @@ -561,7 +554,7 @@ bool8 sub_80725A4(Entity *pokemon, Entity *target) } } -void sub_8072778(Entity *pokemon, Entity *target, u8 param_2, u8 param_3) +static void sub_8072778(Entity *pokemon, Entity *target, u8 param_2, u8 param_3) { s32 i, j; u16 learnedMoves[16]; @@ -710,16 +703,14 @@ bool8 sub_8072938(Entity *target, u16 moveId) return TRUE; } -void sub_8072AC8(s16 *param_1, s16 species, s32 param_3) +void sub_8072AC8(s16 *param_1, s32 species, s32 param_3) { const u8 *levelUpMoves; s32 arrIndex; s32 counter; u16 moveIDs [2]; - s32 species_s32; s32 index; - - species_s32 = species; + s32 species_s32 = (s16) species; for(index = 0; index < MAX_MON_MOVES; index++) { param_1[index] = MOVE_NOTHING; @@ -746,7 +737,7 @@ void sub_8072AC8(s16 *param_1, s16 species, s32 param_3) } } -void sub_8072B24(Entity *entity, Move *moves) +static void sub_8072B24(Entity *entity, Move *moves) { int index; int count; @@ -773,7 +764,7 @@ static inline void fu(EntityInfo *entityInfo, s16 id) entityInfo->id = id; } -void sub_8072B78(Entity *pokemon, Entity *target, s16 id) +static void sub_8072B78(Entity *pokemon, Entity *target, s16 id) { OpenedFile *file; const Tile *tile; @@ -781,7 +772,7 @@ void sub_8072B78(Entity *pokemon, Entity *target, s16 id) s32 id_s32; EntityInfo *entityInfo; LevelData levelData; - struct unkStruct_806B7F8 local_2c; + struct MonSpawnInfo local_2c; id_s32 = id; entityInfo = GetEntInfo(target); @@ -811,7 +802,7 @@ void sub_8072B78(Entity *pokemon, Entity *target, s16 id) local_2c.pos.y = gAdjacentTileOffsets[index].y + target->pos.y; local_2c.unk4 = 0; local_2c.unk10 = 0; - sub_806B7F8(&local_2c, TRUE); + SpawnWildMon(&local_2c, TRUE); } } } diff --git a/src/dungeon_logic.c b/src/dungeon_logic.c index 7a012e6f4..eaf249eda 100644 --- a/src/dungeon_logic.c +++ b/src/dungeon_logic.c @@ -29,6 +29,7 @@ #include "pokemon.h" #include "dungeon_config.h" #include "dungeon_pos_data.h" +#include "dungeon_data.h" // This file deals with things like controlling movement, walkable tiles, ai targeting, status checks and pokemon attributes. diff --git a/src/dungeon_main.c b/src/dungeon_main.c index 6247e92ba..196b72c77 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -16,7 +16,7 @@ #include "code_801602C.h" #include "code_801B3C0.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_action.h" #include "code_8066D04.h" #include "code_806CD90.h" @@ -24,7 +24,7 @@ #include "dungeon_ai_movement.h" #include "dungeon_logic.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_main.h" #include "dungeon_map.h" #include "dungeon_map_access.h" @@ -55,83 +55,28 @@ #include "trap.h" #include "weather.h" #include "dungeon_pos_data.h" +#include "dungeon_kecleon_shop.h" +#include "dungeon_engine.h" +#include "dungeon_item_action.h" +#include "dungeon_strings.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); -extern void sub_806A6E8(Entity *); extern void TryTriggerTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); -bool8 sub_807EF48(void); void TryPointCameraToMonster(Entity *a0, u8 a1); bool8 sub_80701A4(Entity *a0); void sub_8075680(u32); -void sub_8094C88(void); void ClearUnpaidFlagFromAllItems(void); void sub_806A914(u8 a0, u8 a1, u8 a2); -void SetLeaderActionToNothing(u8 a0); u16 GetLeaderActionId(void); void sub_80978C8(s16 a0); -static void TryCreateModeArrows(Entity *leader); -bool8 sub_8094C48(void); -void sub_803E724(s32 a0); void HandleTalkFieldAction(Entity *); -bool8 IsFloorOver(void); -bool8 IsNotAttacking(Entity *param_1, bool8 param_2); s32 GetTeamMemberEntityIndex(Entity *pokemon); bool8 sub_8070F80(Entity * pokemon, s32 direction); void sub_806752C(ActionContainer *a0); void sub_8067768(ActionContainer *a0); -void ChangeDungeonCameraPos(DungeonPos *pos, s32 a1, u8 a2, u8 a3); extern bool8 sub_8071A8C(Entity *pokemon); -extern void GetWeatherName(u8 *dst, u8 weatherId); -extern bool8 sub_8070F14(Entity * pokemon, s32 direction); -extern Entity *sub_80696A8(Entity *a0); -extern void PointCameraToMonster(Entity *); extern void sub_8041AD0(Entity *pokemon); extern void sub_8041AE0(Entity *pokemon); -extern void sub_807EC28(bool8); -extern const u8 *GetCurrentDungeonName(void); - -extern Entity *gLeaderPointer; - -extern const u8 *gUnknown_80F8A84; -extern const u8 *gUnknown_80F8A6C; -extern const u8 *gUnknown_80F8ADC; -extern const u8 *gUnknown_80F8AB0; -extern const u8 *gUnknown_80F8B0C; -extern const u8 *gUnknown_80FD4B0; -extern const u8 *gUnknown_80F8A4C; -extern const u8 *gUnknown_80F8A28; -extern const u8 *gUnknown_8100208; -extern const u8 *gUnknown_80F9BD8; -extern const u8 *gUnknown_80F9C08; -extern const u8 *gUnknown_80F9C2C; -extern const u8 *gUnknown_80F9BB0; -extern const u8 *gUnknown_80FDE18; -extern const u8 *gUnknown_80F8B24; -extern const u8 *gTeamToolboxAPtr; -extern const u8 *gTeamToolboxBPtr; -extern const u8 *gFieldItemMenuGroundTextPtr; -extern const u8 *gUnknown_80FE940; -extern const u8 *gWhichTextPtr1; -extern const u8 *const gFieldMenuMovesPtr; -extern const u8 *const gFieldMenuItemsPtr; -extern const u8 *const gFieldMenuTeamPtr; -extern const u8 *const gFieldMenuOthersPtr; -extern const u8 *const gFieldMenuGroundPtr; -extern const u8 *const gUnknown_80F9174; -extern const u8 *const gUnknown_80F9190; -extern const u8 *const gUnknown_80F91C8; -extern const u8 *const gUnknown_80F91E0; -extern const u8 *const gUnknown_80F91A8; -extern const u8 *const gUnknown_80FE954; - -extern MenuInputStruct gDungeonMenu; -extern s32 gTeamMenuChosenId; static EWRAM_DATA bool8 sInDiagonalMode = 0; static EWRAM_DATA bool8 sInRotateMode = 0; @@ -141,6 +86,7 @@ static EWRAM_DATA s16 sArrowsFrames = 0; static EWRAM_DATA bool8 sShowThreeArrows1 = 0; static EWRAM_DATA bool8 sShowThreeArrows2 = 0; +static void TryCreateModeArrows(Entity *leader); static void sub_805E738(Entity *a0); static bool8 sub_805E874(void); static bool8 sub_805EC2C(Entity *a0, s32 x, s32 y); @@ -427,8 +373,8 @@ void DungeonHandlePlayerInput(void) s32 prevMapOption = gGameOptionsRef->mapOption; gShowMonsterDotsInDungeonMap = TRUE; gDungeon->unk181e8.inFloorMapMode = TRUE; - if (!sub_8094C48()) { - sub_8094C88(); + if (!GameOptions_ShowMiniMap()) { + GameOptions_SetTransparentMiniMap(); } sub_8052210(1); UpdateMinimap(); diff --git a/src/dungeon_map.c b/src/dungeon_map.c index 8e0791ef8..b712dbdaa 100644 --- a/src/dungeon_map.c +++ b/src/dungeon_map.c @@ -15,18 +15,15 @@ #include "dungeon_map_access.h" #include "dungeon_music.h" #include "dungeon_util.h" +#include "dungeon_vram.h" #include "file_system.h" #include "game_options.h" #include "sprite.h" #include "text_1.h" #include "trap.h" +#include "run_dungeon.h" -extern s32 gUnknown_202EDD0; - -extern u8 GetFloorType(void); -extern bool8 sub_8094C48(void); extern bool8 ShouldMinimapDisplayEntity(Entity *ent); -extern bool8 DoesNotHaveShadedMap(void); struct UnkStruct1 { @@ -236,7 +233,7 @@ void DrawMinimapTile(s32 x, s32 y) } } - if (sub_8094C48() && !gDungeon->unk1356C) { + if (GameOptions_ShowMiniMap() && !gDungeon->unk1356C) { mapGfxType = MAP_GFX_NOTHING; if (!blinded) { Entity *entity = tile->monster; @@ -384,7 +381,7 @@ void DrawMinimapTile(s32 x, s32 y) if (gGameOptionsRef->mapOption == TOP_MAP_AND_TEAM_NO_BOTTOM) { mapGfxType = (s16) (mapGfxType + 128); } - else if (DoesNotHaveShadedMap() == TRUE) { + else if (GameOptions_IsTransparentMiniMap() == TRUE) { mapGfxType = (s16) (mapGfxType + 64); } } diff --git a/src/dungeon_map_access.c b/src/dungeon_map_access.c index 1c174ad35..40744845a 100644 --- a/src/dungeon_map_access.c +++ b/src/dungeon_map_access.c @@ -8,7 +8,7 @@ #include "graphics_memory.h" #include "decompress_at.h" #include "def_filearchives.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map.h" #include "dungeon_logic.h" #include "dungeon_info.h" @@ -18,6 +18,7 @@ #include "text_1.h" #include "code_806CD90.h" #include "dungeon_pos_data.h" +#include "dungeon_data.h" extern void sub_8042A14(DungeonPos *); diff --git a/src/dungeon_menu_items.c b/src/dungeon_menu_items.c index caceb923c..eeb8d22c5 100644 --- a/src/dungeon_menu_items.c +++ b/src/dungeon_menu_items.c @@ -17,49 +17,21 @@ #include "dungeon_ai_movement.h" #include "string_format.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "trap.h" #include "dungeon_map_access.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" +#include "dungeon_misc.h" #include "menu_input.h" #include "text_1.h" #include "dungeon_action.h" #include "code_801B3C0.h" +#include "dungeon_engine.h" +#include "dungeon_strings.h" -extern void PlayDungeonCancelSE(void); -extern void PlayDungeonConfirmationSE(void); -extern void TryPointCameraToMonster(Entity *a0, u8 a1); -extern void SetLeaderActionToNothing(u8 a0); -extern Item *sub_8044D90(Entity *, s32, u32); -extern bool8 sub_8070F14(Entity * pokemon, s32 direction); -bool8 sub_805EC2C(Entity *a0, s32 x, s32 y); -extern Entity *sub_80696A8(Entity *a0); -extern void PointCameraToMonster(Entity *); extern void sub_8041AD0(Entity *pokemon); extern void sub_8041AE0(Entity *pokemon); -extern void sub_807EC28(bool8); -extern u8 *GetDungeonSubMenuItemString(s32 param_1); -extern bool8 CanSubMenuItemBeChosen(s32 param_1); -extern s32 gDungeonSubMenuItemsCount; -extern const u8 gUnknown_8106B50[]; -extern Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3); -extern u16 sub_8044DC8(Item *param_1); -extern bool8 sub_8046F00(Item *item); -extern void sub_8045064(void); -extern bool8 PosHasItem(DungeonPos *pos); - -extern u8 gUnknown_202EE00; -extern Entity *gLeaderPointer; - -extern MenuInputStruct gDungeonMenu; - -extern const u8 *gUnknown_80F8B24; -extern const u8 *gTeamToolboxAPtr; -extern const u8 *gTeamToolboxBPtr; -extern const u8 *gFieldItemMenuGroundTextPtr; -extern const u8 *gUnknown_80FE940; -extern const u8 *gWhichTextPtr1; static EWRAM_DATA ActionParameter sUnknownActionUnk4 = {0}; static EWRAM_DATA s32 sUnknown_202F240 = 0; diff --git a/src/dungeon_menu_moves.c b/src/dungeon_menu_moves.c index ff8635426..3a6a078fa 100644 --- a/src/dungeon_menu_moves.c +++ b/src/dungeon_menu_moves.c @@ -3,10 +3,10 @@ #include "structs/map.h" #include "structs/str_dungeon.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_action.h" -#include "dungeon_action.h" -#include "dungeon_leader.h" +#include "dungeon_misc.h" +#include "dungeon_range.h" #include "dungeon_main.h" #include "dungeon_menu_moves.h" #include "dungeon_menu_team.h" @@ -17,6 +17,8 @@ #include "dungeon_submenu.h" #include "dungeon_strings.h" #include "dungeon_util.h" +#include "dungeon_engine.h" +#include "dungeon_map_access.h" #include "input.h" #include "moves.h" #include "menu_input.h" @@ -28,24 +30,12 @@ #include "text_2.h" #include "text_3.h" -extern void PlayDungeonCancelSE(void); -extern void PlayDungeonConfirmationSE(void); -extern u8 *GetDungeonSubMenuItemString(s32 param_1); -extern bool8 CanSubMenuItemBeChosen(s32 param_1); -extern void sub_8045064(void); extern s32 GetTeamMemberEntityIndex(Entity *pokemon); -extern void ChangeDungeonCameraPos(DungeonPos *pos, s32 a1, u8 a2, u8 a3); -extern void SetLeaderActionToNothing(u8 a0); extern void sub_806752C(ActionContainer *a0); extern void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 a1); extern void sub_8067768(ActionContainer *a0); -extern void TryPointCameraToMonster(Entity *a0, u8 a1); extern bool8 sub_8071A8C(Entity *pokemon); -extern void sub_8083D1C(void); -extern s32 ActionToDungeonSubMenuId(u16 param_1); -extern s32 gDungeonSubMenuItemsCount; -extern MenuInputStruct gDungeonMenu; static void ShowMovesMenuWindows(Entity *entity, EntityInfo *entInfo, bool8 redColorForChargingMoves, WindowTemplates *windows, WindowHeader *header, u8 *arg5, s32 arg6, s32 arg7); static void AddMovesSubMenuOptions(Entity *entity, bool8 addLinkOptions, bool8 addUseMove); diff --git a/src/dungeon_menu_others.c b/src/dungeon_menu_others.c index d1f406d35..04a625944 100644 --- a/src/dungeon_menu_others.c +++ b/src/dungeon_menu_others.c @@ -2,13 +2,13 @@ #include "globaldata.h" #include "code_803D110.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_action.h" #include "code_8097DD0.h" #include "dungeon_info.h" #include "dungeon_8083AB0.h" #include "dungeon_action.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_main.h" #include "dungeon_map.h" #include "dungeon_map_access.h" @@ -19,6 +19,7 @@ #include "dungeon_music.h" #include "dungeon_strings.h" #include "dungeon_submenu.h" +#include "dungeon_engine.h" #include "dungeon_util.h" #include "game_options.h" #include "input.h" @@ -29,14 +30,9 @@ #include "text_3.h" #include "run_dungeon.h" -extern void PlayDungeonCancelSE(void); -extern void PlayDungeonConfirmationSE(void); -extern bool8 CanSubMenuItemBeChosen(s32 param_1); -extern void sub_8045064(void); extern bool8 IsBossFight(void); extern u16 GetLeaderActionId(void); -extern MenuInputStruct gDungeonMenu; static void PrintOthersMenuOptions(void); static void ShowGameOptionsMenu(void); diff --git a/src/dungeon_menu_recruitment.c b/src/dungeon_menu_recruitment.c index d172529ac..eab846fbb 100644 --- a/src/dungeon_menu_recruitment.c +++ b/src/dungeon_menu_recruitment.c @@ -2,12 +2,13 @@ #include "globaldata.h" #include "code_800D090.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_info.h" #include "dungeon_menu_recruitment.h" #include "dungeon_message.h" #include "dungeon_message_log.h" #include "dungeon_music.h" +#include "dungeon_strings.h" #include "exclusive_pokemon.h" #include "input.h" #include "menu_input.h" @@ -17,17 +18,13 @@ #include "text_1.h" #include "text_2.h" #include "text_3.h" +#include "dungeon_engine.h" +#include "dungeon_cutscene.h" -extern void PlayDungeonCancelSE(void); -extern void PlayDungeonConfirmationSE(void); -extern bool8 CanSubMenuItemBeChosen(s32 param_1); extern u16 GetLeaderActionId(void); extern u8 sub_806F9BC(s32); -extern bool8 sub_80860A8(u8 id); extern bool8 sub_806A564(s32 r0); -extern MenuInputStruct gDungeonMenu; -extern s32 gDungeonFramesCounter; struct MonRecruitList { @@ -42,12 +39,6 @@ static bool8 TryScrollDown(struct MonRecruitList *tabData, s32 a1); static void CreateScrollingArrow(bool8 upArrow, s32 y); static void SetRecruitableMons(struct MonRecruitList *tabsData); -extern const u8 *const gUnknown_80FA61C; -extern const u8 *const gUnknown_80FA5F4; -extern const u8 *const gUnknown_80FEA68; -extern const u8 *const gUnknown_80FEA80; -extern const u8 *const gUnknown_80FEA8C; - EWRAM_DATA static s32 sScrollId = 0; EWRAM_DATA static u8 sScrollFlags = 0; EWRAM_DATA static SpriteOAM sScrollingArrowOAM = {0}; diff --git a/src/dungeon_menu_stairs.c b/src/dungeon_menu_stairs.c index 568e141c4..66ad6f5b9 100644 --- a/src/dungeon_menu_stairs.c +++ b/src/dungeon_menu_stairs.c @@ -1,7 +1,7 @@ #include "global.h" #include "globaldata.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_action.h" #include "code_8097DD0.h" #include "dungeon_info.h" @@ -14,26 +14,14 @@ #include "dungeon_music.h" #include "dungeon_submenu.h" #include "dungeon_util.h" +#include "dungeon_strings.h" +#include "dungeon_engine.h" +#include "run_dungeon.h" #include "input.h" #include "menu_input.h" #include "text_1.h" #include "text_3.h" -extern void PlayDungeonCancelSE(void); -extern void PlayDungeonConfirmationSE(void); -extern bool8 CanSubMenuItemBeChosen(s32 param_1); -extern void sub_8045064(void); -extern u8 GetFloorType(void); - -extern MenuInputStruct gDungeonMenu; -extern s32 gDungeonSubMenuItemsCount; - -extern const u8 *const gUnknown_80FE70C; -extern const u8 *const gUnknown_80FE720; -extern const u8 *const gUnknown_80FE724; -extern const u8 *const gUnknown_80F8104[]; -extern const u8 *const gUnknown_80F7F70[]; - static void ShowAndPrintOnStairsMenu(DungeonPos *pos, WindowTemplates *windows, WindowHeader *header); static void AddStairsSubMenuOptions(Entity *mon); static void ShowStairsDescription(DungeonPos *pos); diff --git a/src/dungeon_menu_team.c b/src/dungeon_menu_team.c index 5c660a277..f29f541fd 100644 --- a/src/dungeon_menu_team.c +++ b/src/dungeon_menu_team.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_menu_team.h" #include "constants/tactic.h" #include "structs/map.h" #include "structs/str_dungeon.h" @@ -10,18 +11,17 @@ #include "code_801602C.h" #include "code_801B3C0.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_action.h" #include "code_806CD90.h" #include "code_8097DD0.h" #include "dungeon_action.h" #include "dungeon_ai_movement.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_main.h" #include "dungeon_map_access.h" #include "dungeon_menu_moves.h" -#include "dungeon_menu_team.h" #include "dungeon_message.h" #include "dungeon_misc.h" #include "dungeon_logic.h" @@ -29,6 +29,9 @@ #include "dungeon_random.h" #include "dungeon_submenu.h" #include "dungeon_util.h" +#include "dungeon_strings.h" +#include "dungeon_info.h" +#include "dungeon_engine.h" #include "input.h" #include "items.h" #include "menu_input.h" @@ -43,90 +46,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); -extern void sub_806A6E8(Entity *); -extern void TryTriggerTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); -bool8 sub_807EF48(void); -void TryPointCameraToMonster(Entity *a0, u8 a1); -bool8 sub_805E874(void); -bool8 sub_80701A4(Entity *a0); -void sub_805E738(Entity *a0); -void sub_8040A78(void); -void sub_805E804(void); -void ShowDungeonOthersMenu(void); -void sub_8075680(u32); -void sub_8094C88(void); -void sub_8040A84(void); -void sub_806A914(u8 a0, u8 a1, u8 a2); -void SetLeaderActionToNothing(u8 a0); -u16 GetLeaderActionId(void); -void sub_80978C8(s16 a0); -bool8 sub_8094C48(void); -bool8 sub_805EC4C(Entity *a0, u8 a1); -void sub_803E724(s32 a0); -void HandleTalkFieldAction(Entity *); -bool8 IsFloorOver(void); -bool8 IsNotAttacking(Entity *param_1, bool8 param_2); -void ShowMainMenu(bool8 fromBPress, bool8 a1); -bool8 sub_805EF60(Entity *a0, EntityInfo *a1); -bool8 sub_8070F80(Entity * pokemon, s32 direction); -void PrintOnMainMenu(bool8 printAll); -bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1); -void DungeonShowItemDescription(UNUSED ActionContainer *a0); -bool8 ShowDungeonTeamMenu(Entity *a0); -void ActionShowMoveInfo(ActionContainer *a0); -void ActionToggleMoveUsableForAi(ActionContainer *a0); -void ActionLinkMoves(ActionContainer *a0); -void sub_806752C(ActionContainer *a0); -void ActionSetOrUnsetMove(ActionContainer *a0, bool8 a1); -void ActionDelinkMoves(ActionContainer *a0, bool8 a1); -void sub_8067768(ActionContainer *a0); -void ChangeDungeonCameraPos(DungeonPos *pos, s32 a1, u8 a2, u8 a3); -extern void sub_80643AC(Entity *pokemon); -extern bool8 ShowDungeonMovesMenu(Entity * entity, u8 a1, u8 a2, s32 a3, s32 a4); -extern bool8 sub_8070F14(Entity * pokemon, s32 direction); -bool8 sub_805EC2C(Entity *a0, s32 x, s32 y); -extern Entity *sub_80696A8(Entity *a0); -extern void PointCameraToMonster(Entity *); -extern void sub_8041AD0(Entity *pokemon); -extern void sub_8041AE0(Entity *pokemon); -extern void sub_807EC28(bool8); -extern u8 *GetDungeonSubMenuItemString(s32 param_1); -extern bool8 CanSubMenuItemBeChosen(s32 param_1); -extern s32 gDungeonSubMenuItemsCount; -extern const u8 gUnknown_8106B50[]; -extern Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3); -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); -extern void sub_8045C18(u8 *buffer, Item *item); - -extern u8 gUnknown_202EE00; -extern Entity *gLeaderPointer; -extern MenuInputStruct gDungeonMenu; -extern s32 gDungeonFramesCounter; -extern u8 gUnknown_202EE39; - -extern const u8 *gUnknown_80FE940; -extern const u8 *const gUnknown_80FE954; -extern const u8 gUnknown_8106BEC[]; -extern const u8 gUnknown_8106BF4[]; -extern const u8 *const gUnknown_80FE95C; -extern const u8 *const gUnknown_80FE960; -extern const u8 *const gUnknown_80FE964; -extern const u8 *const gUnknown_80FE978; -extern const u8 *const gWhichTextPtr2; - EWRAM_DATA s32 gTeamMenuChosenId = 0; static UNUSED EWRAM_DATA u8 sUnused[4] = {0}; EWRAM_DATA static SpriteOAM sOAMStatusDescriptionArrow = {0}; diff --git a/src/dungeon_menu_tile.c b/src/dungeon_menu_tile.c index 58b596828..11df04ffc 100644 --- a/src/dungeon_menu_tile.c +++ b/src/dungeon_menu_tile.c @@ -1,11 +1,12 @@ #include "global.h" #include "globaldata.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_action.h" #include "code_8097DD0.h" #include "dungeon_info.h" #include "dungeon_action.h" +#include "dungeon_engine.h" #include "dungeon_map_access.h" #include "dungeon_menu_moves.h" #include "dungeon_menu_team.h" @@ -13,23 +14,13 @@ #include "dungeon_music.h" #include "dungeon_submenu.h" #include "dungeon_util.h" +#include "dungeon_strings.h" #include "input.h" #include "menu_input.h" #include "text_1.h" #include "text_3.h" #include "trap.h" -extern void PlayDungeonCancelSE(void); -extern void PlayDungeonConfirmationSE(void); -extern bool8 CanSubMenuItemBeChosen(s32 param_1); -extern void sub_8045064(void); - -extern MenuInputStruct gDungeonMenu; -extern s32 gDungeonSubMenuItemsCount; - -extern const u8 *const gUnknown_80FE708; -extern const u8 *const gTrapDescriptions[]; - static void ShowAndPrintOnTileMenu(DungeonPos *pos, WindowTemplates *windows, WindowHeader *header); static void AddTileSubMenuOptions(Entity *mon); static void ShowTileDescription(DungeonPos *pos); diff --git a/src/dungeon_message.c b/src/dungeon_message.c index 423632fbe..4934b5fbe 100644 --- a/src/dungeon_message.c +++ b/src/dungeon_message.c @@ -8,13 +8,13 @@ #include "code_800D090.h" #include "effect_main.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_info.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map.h" +#include "dungeon_main.h" #include "dungeon_music.h" #include "dungeon_util.h" -#include "dungeon_util_1.h" #include "exclusive_pokemon.h" #include "file_system.h" #include "input.h" @@ -26,26 +26,16 @@ #include "text_2.h" #include "text_3.h" #include "dungeon_strings.h" +#include "dungeon_cutscene.h" #include "dungeon_portrait_placement.h" -void sub_80526D0(s32 r0); -static bool8 sub_8052DC0(Entity *); -static void DisplayMessageAddToLog(Entity *pokemon, const u8 *str, bool8 r2); - -extern void sub_805E804(void); -extern void sub_8083E28(void); -extern void PlayDungeonCancelSE(void); -extern void PlayDungeonConfirmationSE(void); - -extern u32 gUnknown_202EDD0; -extern u8 gUnknown_203B40C; -extern u8 gUnknown_202EE01; -extern s32 gDungeonFramesCounter; - static EWRAM_DATA Entity *sLastLogMsgEntity = NULL; static UNUSED EWRAM_DATA u8 sUnused = 0; static EWRAM_DATA SpriteOAM sUnknown_202F1F0 = {0}; -EWRAM_INIT u8 gUnknown_203B434 = 1; +EWRAM_INIT bool8 gUnknown_203B434 = TRUE; + +static bool8 sub_8052DC0(Entity *); +static void DisplayMessageAddToLog(Entity *pokemon, const u8 *str, bool8 r2); void sub_80521D0(void) { @@ -55,7 +45,7 @@ void sub_80521D0(void) gDungeon->unk1BDD4.unk1C054[i] = 0; } sLastLogMsgEntity = NULL; - gUnknown_203B434 = 1; + gUnknown_203B434 = TRUE; sub_8052210(FALSE); } @@ -131,8 +121,7 @@ void TryDisplayDungeonLoggableMessage4(Entity *attacker, Entity *target, const u } } -void LogMessageByIdWithPopupCheckUserUnknown(Entity *pokemon, DungeonPos *pos, - const u8 *str) +void LogMessageByIdWithPopupCheckUserUnknown(Entity *pokemon, DungeonPos *pos, const u8 *str) { u8 flag; flag = ShouldDisplayEntity(pokemon) ? TRUE : FALSE; @@ -154,11 +143,11 @@ void DisplayDungeonLoggableMessageTrue(Entity *pokemon, const u8 *str) static void DisplayMessageAddToLog(Entity *pokemon, const u8 *str, bool8 r2) { u8 txt[64]; - u32 r7; + bool8 r7; bool32 r8, r9; if (sLastLogMsgEntity != pokemon) { - r7 = 1; + r7 = TRUE; } else { r7 = gUnknown_203B434; @@ -166,7 +155,7 @@ static void DisplayMessageAddToLog(Entity *pokemon, const u8 *str, bool8 r2) r8 = 1; sLastLogMsgEntity = pokemon; - gUnknown_203B434 = 0; + gUnknown_203B434 = FALSE; r9 = FALSE; while (1) { while (1) { @@ -386,8 +375,8 @@ void DisplayDungeonDialogue(const struct DungeonDialogueStruct *dialogueInfo) MonPortraitMsg monPortrait; s32 leaderId, partnerId, dialogueMonId; s32 chosenMenuIndex; - Entity *leader = xxx_call_GetLeader(); - Entity *partner = GetPartnerEntity(); + Entity *leader = CutsceneGetLeader(); + Entity *partner = CutsceneGetPartner(); MonPortraitMsg *monPortraitPtr = NULL; if (leader != NULL) { diff --git a/src/dungeon_message_log.c b/src/dungeon_message_log.c index 8b35b67fe..d0cc19949 100644 --- a/src/dungeon_message_log.c +++ b/src/dungeon_message_log.c @@ -11,28 +11,20 @@ #include "dungeon_vram.h" #include "dungeon_music.h" #include "sprite.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "run_dungeon.h" #define MESSAGE_LOG_ROW_COUNT 8 // How many log messages are shown -extern void sub_805E804(void); -extern void sub_8083E28(void); -extern u32 GetTouchScreenArrowPress(s32 a0, const void *a1); -extern void PlayDungeonCancelSE(void); -extern void PlayDungeonConfirmationSE(void); - -extern s32 gDungeonFramesCounter; +static EWRAM_DATA s32 sMessageLogCursor = 0; +static EWRAM_DATA u8 sMessageLogFlags = 0; +static EWRAM_DATA SpriteOAM sMessageLogArrowSpriteOAM = {0}; static void PutStringsOnMessageLog(void); static bool8 TryScrollLogDown(s32 a0); static bool8 TryScrollLogUp(s32 a0); static void CreateMessageLogArrow(bool8 upArrow, s32 y); -static EWRAM_DATA s32 sMessageLogCursor = 0; -static EWRAM_DATA u8 sMessageLogFlags = 0; -static EWRAM_DATA SpriteOAM sMessageLogArrowSpriteOAM = {0}; - void ResetMessageLog(void) { s32 i; diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index e7a5efb4e..f50dd31dd 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -4,7 +4,6 @@ #include "dungeon_music.h" #include "structs/str_dungeon.h" #include "dungeon_util.h" -#include "dungeon_util_1.h" #include "file_system.h" #include "pokemon.h" #include "pokemon_3.h" @@ -16,7 +15,7 @@ #include "move_effects_target.h" #include "dungeon_map_access.h" #include "dungeon_map.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_message.h" #include "dungeon_message_log.h" #include "dungeon_logic.h" @@ -44,58 +43,38 @@ #include "dungeon_strings.h" #include "dungeon_8083AB0.h" #include "dungeon_pos_data.h" +#include "dungeon_data.h" +#include "dungeon_tilemap.h" +#include "dungeon_engine.h" +#include "dungeon_cutscene.h" +#include "dungeon_mon_spawn.h" +#include "dungeon_info.h" static void EnsureCastformLoaded(void); static void EnsureDeoxysLoaded(void); -extern bool8 IsLevelResetDungeon(u8 dungeon); -extern void sub_806C264(s32 teamIndex, EntityInfo *entInfo); extern bool8 sub_806A58C(s16 r0); -extern void sub_8084E00(Entity *entity, u8 param_2, u8 param_3); extern void sub_8078084(Entity * pokemon); -extern void sub_808DFDC(s32 a1, DungeonMon* a2); 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 EndAbilityImmuneStatus(Entity *, Entity *); extern void sub_8041BBC(Entity *r0); -extern void TryPointCameraToMonster(Entity *, u8); extern void sub_804178C(u32); -extern void PointCameraToMonster(Entity *); extern void sub_8042B20(Entity *entity); extern void sub_8042B0C(Entity *entity); -extern void sub_8072AC8(u16 *param_1, s32 species, s32 param_3); extern s16 sub_803D970(u32); -extern bool8 sub_8083660(const DungeonPos *param_1); -extern void sub_803F4A0(Entity *a0); 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 s32 gDungeonFramesCounter; extern void sub_8042EC8(Entity *a0, s32 a1); extern Entity *sub_804550C(s16 a); extern Entity *sub_80453AC(s16 id); -extern void UpdateCamera(s32); -extern void UpdateMinimap(void); -extern void sub_806B678(void); extern void EntityUpdateStatusSprites(Entity *); -extern Entity *sub_80696A8(Entity *a0); -extern const s16 gUnknown_810AC60; // 0xC -extern const s16 gUnknown_810AC62; // 0xC -extern const s16 gUnknown_810AC68; // 0x8 -extern const s16 gUnknown_810AC64; // 0x8 -extern const s16 gUnknown_810AC66; // 0x8 - -extern Entity *gLeaderPointer; -extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE]; -extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE]; -extern DungeonPos gPlayerDotMapPosition; -extern DungeonPos gUnknown_202EE0C; extern u8 gUnknown_202F32C; bool8 sub_806A564(s16 r0); @@ -696,8 +675,8 @@ void sub_80694C0(Entity *target,s32 x,s32 y,u8 param_4) } tile->monster = target; if (info->isTeamLeader) { - gUnknown_202EE0C.x = x; - gUnknown_202EE0C.y = y; + gLeaderPosition.x = x; + gLeaderPosition.y = y; gDungeon->unk1 = 0; } DrawMinimapTile(x,y); @@ -1658,11 +1637,11 @@ void sub_806A9B4(Entity *entity, s32 moveIndex) } // s16 again... -bool8 sub_806AA0C(s16 _species, bool32 _a1) +bool8 sub_806AA0C(s32 _species, bool32 _a1) { - s32 species = _species; + s32 species = (s16) _species; bool8 a1 = _a1; - if (!IsExclusivePokemonUnlocked(_species)) + if (!IsExclusivePokemonUnlocked(species)) return FALSE; if (gDungeon->unk37FD && GetBaseSpecies(species) == MONSTER_DEOXYS_NORMAL) diff --git a/src/code_8069E0C.c b/src/dungeon_mon_spawn.c similarity index 83% rename from src/code_8069E0C.c rename to src/dungeon_mon_spawn.c index 7a73ecc8d..72e2df9b5 100644 --- a/src/code_8069E0C.c +++ b/src/dungeon_mon_spawn.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_mon_spawn.h" #include "constants/ability.h" #include "constants/iq_skill.h" #include "constants/move_id.h" @@ -7,7 +8,6 @@ #include "constants/type.h" #include "constants/weather.h" #include "structs/dungeon_entity.h" -#include "structs/str_806B7F8.h" #include "structs/str_dungeon.h" #include "dungeon_vram.h" #include "code_805D8C8.h" @@ -15,7 +15,7 @@ #include "code_8077274_1.h" #include "dungeon_config.h" #include "run_dungeon.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_misc.h" #include "dungeon_logic.h" @@ -32,46 +32,29 @@ #include "pokemon_3.h" #include "position_util.h" #include "weather.h" -#include "dungeon_spawns.h" +#include "dungeon_floor_spawns.h" #include "dungeon_pos_data.h" +#include "dungeon_tilemap.h" +#include "dungeon_engine.h" +#include "dungeon_leveling.h" extern void sub_8042900(Entity *r0); extern void sub_8042968(Entity *r0); -extern void EndAbilityImmuneStatus(Entity *, Entity *); void sub_8041BBC(Entity *r0); -extern void TryPointCameraToMonster(Entity *, u8); extern void sub_804178C(u32); -extern void PointCameraToMonster(Entity *); extern void sub_8042B20(Entity *entity); extern void sub_8042B0C(Entity *entity); -extern void sub_8072AC8(u16 *param_1, s32 species, s32 param_3); -extern bool8 sub_8083660(const DungeonPos *param_1); -extern Entity *gLeaderPointer; -extern DungeonPos gUnknown_202EE0C; -extern void sub_803F4A0(Entity *a0); extern bool8 sub_80860A8(u8 id); extern u8 gUnknown_202F32C; -extern u8 GetRandomFloorItem(s32 a0); extern void sub_80429E8(Entity *r0); extern Entity *sub_804550C(s16 a); extern Entity *sub_80453AC(s16 id); -extern void UpdateCamera(s32); -extern void UpdateMinimap(void); -extern void sub_806B678(void); extern void EntityUpdateStatusSprites(Entity *); -extern Entity *sub_80696A8(Entity *a0); -extern s32 GetMonsterApparentID(Entity *pokemon, s32 _id); -extern void sub_806A898(Entity *entity, bool8 r7, bool8 showRunAwayEffect); -extern bool8 sub_806AA0C(s16 _species, bool32 _a1); -extern void sub_806A6E8(Entity *entity); -s32 sub_806C444(s32 species, s32 level); -s32 sub_806C488(s32 species, s32 level, s32 categoryIndex); -s32 sub_806C4D4(s32 species, s32 level, s32 categoryIndex); -bool8 sub_806B8CC(s16 _species, s32 x, s32 y, DungeonMon *monPtr, Entity **a4, bool32 _a5, u32 _a6); -void sub_806BC68(bool8 a0, Entity *entity, struct unkStruct_806B7F8 *structPtr, DungeonPos *pos); -void ResetMonEntityData(EntityInfo *, bool8 a1); -void sub_806C264(s32 teamIndex, EntityInfo *entInfo); +static s32 CalcSpeciesHPAtLevel(s32 species, s32 level); +static s32 CalcSpeciesAtkAtLevel(s32 species, s32 level, s32 categoryIndex); +static s32 CalcSpeciesDefAtLevel(s32 species, s32 level, s32 categoryIndex); +static void InitEntityFromSpawnInfo(bool8 a0, Entity *entity, struct MonSpawnInfo *monSpawnInfo, DungeonPos *pos); void sub_806AD3C(void) { @@ -88,11 +71,11 @@ void sub_806AD3C(void) if (structPtr->moves[0] == MOVE_NOTHING) { structPtr->moves[0] = MOVE_BLOWBACK; } - structPtr->unkC = sub_806C444(structPtr->species, structPtr->level); + structPtr->unkC = CalcSpeciesHPAtLevel(structPtr->species, structPtr->level); for (j = 0; j < 2; j++) { - structPtr->unkE[j] = sub_806C488(structPtr->species, structPtr->level, j); - structPtr->unk10[j] = sub_806C4D4(structPtr->species, structPtr->level, j); + structPtr->unkE[j] = CalcSpeciesAtkAtLevel(structPtr->species, structPtr->level, j); + structPtr->unk10[j] = CalcSpeciesDefAtLevel(structPtr->species, structPtr->level, j); } } @@ -136,7 +119,7 @@ void sub_806AD3C(void) } } -void sub_806AED8(Moves *moves, s16 *maxHPStat, u8 *atk, u8 *def, s16 _species, s32 level) +static void sub_806AED8(Moves *moves, s16 *maxHPStat, u8 *atk, u8 *def, s16 _species, s32 level) { s32 i; s32 moveCategory; @@ -176,10 +159,10 @@ void sub_806AED8(Moves *moves, s16 *maxHPStat, u8 *atk, u8 *def, s16 _species, s for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { InitPokemonMoveOrNullObject(&moves->moves[moveIndex], spMoves[moveIndex]); } - *maxHPStat = sub_806C444(species, level); + *maxHPStat = CalcSpeciesHPAtLevel(species, level); for (moveCategory = 0; moveCategory < 2; moveCategory++) { - atk[moveCategory] = sub_806C488(species, level, moveCategory); - def[moveCategory] = sub_806C4D4(species, level, moveCategory); + atk[moveCategory] = CalcSpeciesAtkAtLevel(species, level, moveCategory); + def[moveCategory] = CalcSpeciesDefAtLevel(species, level, moveCategory); } @@ -190,10 +173,10 @@ void sub_806AED8(Moves *moves, s16 *maxHPStat, u8 *atk, u8 *def, s16 _species, s structPtr->species = species; structPtr->level = level; sub_8072AC8(structPtr->moves, species, level); - structPtr->unkC = sub_806C444(structPtr->species, structPtr->level); + structPtr->unkC = CalcSpeciesHPAtLevel(structPtr->species, structPtr->level); for (moveCategory = 0; moveCategory < 2; moveCategory++) { - structPtr->unkE[moveCategory] = sub_806C488(structPtr->species, structPtr->level, moveCategory); - structPtr->unk10[moveCategory] = sub_806C4D4(structPtr->species, structPtr->level, moveCategory); + structPtr->unkE[moveCategory] = CalcSpeciesAtkAtLevel(structPtr->species, structPtr->level, moveCategory); + structPtr->unk10[moveCategory] = CalcSpeciesDefAtLevel(structPtr->species, structPtr->level, moveCategory); } for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { InitPokemonMoveOrNullObject(&moves->moves[moveIndex], structPtr->moves[moveIndex]); @@ -248,8 +231,6 @@ UNUSED static s32 sub_806B09C(SpawnPokemonData *unkPtr, bool8 a1) return count; } -extern const DungeonPos gUnknown_80F4598[]; - void sub_806B168(void) { s32 count; @@ -329,7 +310,7 @@ void sub_806B168(void) tile = GetTile(unkPosition.x + gDungeon->playerSpawn.x, unkPosition.y + gDungeon->playerSpawn.y); if (tile->room == playerSpawnRoomId && !sub_807034C(currMonPtr->speciesNum, tile)) { - sub_806B8CC(currMonPtr->speciesNum, unkPosition.x + gDungeon->playerSpawn.x, unkPosition.y + gDungeon->playerSpawn.y, currMonPtr, NULL, TRUE, 0); + SpawnTeamMember(currMonPtr->speciesNum, unkPosition.x + gDungeon->playerSpawn.x, unkPosition.y + gDungeon->playerSpawn.y, currMonPtr, NULL, TRUE, 0); skipSecondLoop = TRUE; break; } @@ -347,7 +328,7 @@ void sub_806B168(void) tile = GetTile(unkPosition.x + gDungeon->playerSpawn.x, unkPosition.y + gDungeon->playerSpawn.y); if (!sub_807034C(currMonPtr->speciesNum, tile)) { - sub_806B8CC(currMonPtr->speciesNum, unkPosition.x + gDungeon->playerSpawn.x, unkPosition.y + gDungeon->playerSpawn.y, currMonPtr, NULL, TRUE, 0); + SpawnTeamMember(currMonPtr->speciesNum, unkPosition.x + gDungeon->playerSpawn.x, unkPosition.y + gDungeon->playerSpawn.y, currMonPtr, NULL, TRUE, 0); break; } j++; @@ -408,7 +389,7 @@ void sub_806B404(void) tile = GetTile(unkPosition.x + pos.x, unkPosition.y + pos.y); if (tile->room == roomId && !sub_807034C(currMonPtr->speciesNum, tile)) { - sub_806B8CC(currMonPtr->speciesNum, unkPosition.x + pos.x, unkPosition.y + pos.y, currMonPtr, NULL, TRUE, 0); + SpawnTeamMember(currMonPtr->speciesNum, unkPosition.x + pos.x, unkPosition.y + pos.y, currMonPtr, NULL, TRUE, 0); skipNextLoop = TRUE; break; } @@ -427,7 +408,7 @@ void sub_806B404(void) tile = GetTile(unkPosition.x + pos.x, unkPosition.y + pos.y); if (!sub_807034C(currMonPtr->speciesNum, tile)) { - sub_806B8CC(currMonPtr->speciesNum, unkPosition.x + pos.x, unkPosition.y + pos.y, currMonPtr, NULL, TRUE, 0); + SpawnTeamMember(currMonPtr->speciesNum, unkPosition.x + pos.x, unkPosition.y + pos.y, currMonPtr, NULL, TRUE, 0); skipNextLoop = TRUE; break; } @@ -441,7 +422,7 @@ void sub_806B404(void) if (sub_8083660(&unkPosition)) { const Tile *tile = GetTile(unkPosition.x, unkPosition.y); if (!sub_807034C(currMonPtr->speciesNum, tile)) { - sub_806B8CC(currMonPtr->speciesNum, unkPosition.x, unkPosition.y, currMonPtr, NULL, TRUE, 0); + SpawnTeamMember(currMonPtr->speciesNum, unkPosition.x, unkPosition.y, currMonPtr, NULL, TRUE, 0); break; } } @@ -460,22 +441,16 @@ void sub_806B678(void) EntityInfo *monInfo = GetEntInfo(mon); if (monInfo->isTeamLeader) { sub_803F4A0(mon); - gUnknown_202EE0C = mon->pos; + gLeaderPosition = mon->pos; break; } } } } -/* s16 species; - u8 unk2; - u32 unk4; - u16 level; - DungeonPos pos; - u8 unk10;*/ -void sub_806B6C4(void) +void SpawnWildMonsOnFloor(void) { - struct unkStruct_806B7F8 spStruct; + struct MonSpawnInfo monSpawnInfo; s32 i, j; s32 x, y; bool8 r8 = (gDungeon->unk644.unk44 != 0); @@ -502,23 +477,23 @@ void sub_806B6C4(void) bool8 r6 = FALSE; if (r8) { - spStruct.species = gDungeon->unk644.unk44; - spStruct.level = 1; - spStruct.unk2 = 1; + monSpawnInfo.species = gDungeon->unk644.unk44; + monSpawnInfo.level = 1; + monSpawnInfo.unk2 = 1; r6 = TRUE; } else { - spStruct.species = GetRandomFloorMonsterId(0); - spStruct.level = 0; - spStruct.unk2 = 0; + monSpawnInfo.species = GetRandomFloorMonsterId(0); + monSpawnInfo.level = 0; + monSpawnInfo.unk2 = 0; } - spStruct.unk4 = 0; - spStruct.unk10 = 0; - spStruct.pos.x = x; - spStruct.pos.y = y; - if (r6 || sub_806AA0C(spStruct.species, TRUE)) { - if (sub_806B7F8(&spStruct, FALSE)) { + monSpawnInfo.unk4 = 0; + monSpawnInfo.unk10 = 0; + monSpawnInfo.pos.x = x; + monSpawnInfo.pos.y = y; + if (r6 || sub_806AA0C(monSpawnInfo.species, TRUE)) { + if (SpawnWildMon(&monSpawnInfo, FALSE)) { r8 = FALSE; } } @@ -531,28 +506,28 @@ void sub_806B6C4(void) } } -Entity* sub_806B7F8(struct unkStruct_806B7F8 *structPtr, bool8 a1) +Entity* SpawnWildMon(struct MonSpawnInfo *monSpawnInfo, bool8 a1) { Entity *entity; EntityInfo *entityInfo; - const Tile *tile = GetTile(structPtr->pos.x, structPtr->pos.y); + const Tile *tile = GetTile(monSpawnInfo->pos.x, monSpawnInfo->pos.y); - if (sub_807034C(structPtr->species, tile)) + if (sub_807034C(monSpawnInfo->species, tile)) return FALSE; - entity = sub_804550C(structPtr->species); + entity = sub_804550C(monSpawnInfo->species); if (entity == NULL) return FALSE; - sub_806BC68(FALSE, entity, structPtr, &gUnknown_202EE0C); + InitEntityFromSpawnInfo(FALSE, entity, monSpawnInfo, &gLeaderPosition); entityInfo = GetEntInfo(entity); entityInfo->isNotTeamMember = TRUE; sub_806AED8(&entityInfo->moves, &entityInfo->maxHPStat, entityInfo->atk, entityInfo->def, entityInfo->id, entityInfo->level); entityInfo->HP = entityInfo->maxHPStat; - entityInfo->moveRandomly = structPtr->unk4; - if (!structPtr->unk2 && !a1 && !structPtr->unk10) { + entityInfo->moveRandomly = monSpawnInfo->unk4; + if (!monSpawnInfo->unk2 && !a1 && !monSpawnInfo->unk10) { s32 rand = DungeonRandInt(100); - if (GetChanceAsleep(structPtr->species) > rand) { + if (GetChanceAsleep(monSpawnInfo->species) > rand) { sub_8075BF4(entity, 0x7F); sub_806CE68(entity, NUM_DIRECTIONS); } @@ -561,11 +536,11 @@ Entity* sub_806B7F8(struct unkStruct_806B7F8 *structPtr, bool8 a1) return entity; } -bool8 sub_806B8CC(s16 _species, s32 x, s32 y, DungeonMon *monPtr, Entity **a4, bool32 _a5, u32 _a6) +bool8 SpawnTeamMember(s16 _species, s32 x, s32 y, DungeonMon *monPtr, Entity **a4, bool32 _a5, u32 _a6) { s32 i; DungeonPos unkPosition; - struct unkStruct_806B7F8 spStruct; + struct MonSpawnInfo monSpawnInfo; // s16 memes s32 species = SpeciesId(_species); bool8 a5 = _a5; @@ -595,17 +570,17 @@ bool8 sub_806B8CC(s16 _species, s32 x, s32 y, DungeonMon *monPtr, Entity **a4, b if (entity == NULL) return FALSE; - spStruct.pos.x = x; - spStruct.pos.y = y; - spStruct.species = species; - spStruct.level = monPtr->level; - spStruct.unk2 = 0; - spStruct.unk4 = 0; - spStruct.unk10 = 0; + monSpawnInfo.pos.x = x; + monSpawnInfo.pos.y = y; + monSpawnInfo.species = species; + monSpawnInfo.level = monPtr->level; + monSpawnInfo.unk2 = 0; + monSpawnInfo.unk4 = 0; + monSpawnInfo.unk10 = 0; unkPosition.x = gAdjacentTileOffsets[gUnknown_202F32C].x + x; unkPosition.y = gAdjacentTileOffsets[gUnknown_202F32C].y + y; - sub_806BC68(TRUE, entity, &spStruct, (isTeamLeader ? &unkPosition : &gUnknown_202EE0C)); + InitEntityFromSpawnInfo(TRUE, entity, &monSpawnInfo, (isTeamLeader ? &unkPosition : &gLeaderPosition)); entityInfo = GetEntInfo(entity); entityInfo->isNotTeamMember = FALSE; @@ -615,8 +590,8 @@ bool8 sub_806B8CC(s16 _species, s32 x, s32 y, DungeonMon *monPtr, Entity **a4, b gLeaderPointer = NULL; if (isTeamLeader) { - gUnknown_202EE0C.x = x; - gUnknown_202EE0C.y = y; + gLeaderPosition.x = x; + gLeaderPosition.y = y; } entityInfo->HP = monPtr->unk10; @@ -674,24 +649,24 @@ bool8 sub_806B8CC(s16 _species, s32 x, s32 y, DungeonMon *monPtr, Entity **a4, b return TRUE; } -void sub_806BB6C(Entity *entity, s32 _species) +void UpdateEntitySpecies(Entity *entity, s32 _species) { s32 species = (s16) _species; s16 speciesMatch; - struct unkStruct_806B7F8 spStruct; + struct MonSpawnInfo monSpawnInfo; EntityInfo *entInfo = GetEntInfo(entity); DeletePokemonDungeonSprite(entInfo->dungeonSpriteId); // s16 memes... - spStruct.species = 0; + monSpawnInfo.species = 0; speciesMatch = species; ASM_MATCH_TRICK(species); - spStruct.species = speciesMatch; + monSpawnInfo.species = speciesMatch; - spStruct.level = 0; - spStruct.unk2 = 0; - spStruct.pos = entity->pos; - spStruct.unk4 = 0; + monSpawnInfo.level = 0; + monSpawnInfo.unk2 = 0; + monSpawnInfo.pos = entity->pos; + monSpawnInfo.unk4 = 0; { s16 apparentSpeciesMatch; s32 apparentSpecies = (s16) (GetMonsterApparentID(NULL, species)); @@ -716,7 +691,7 @@ void sub_806BB6C(Entity *entity, s32 _species) sub_8076CB4(entInfo->unk9C); } - sub_806BC68((entInfo->isNotTeamMember == FALSE), entity, &spStruct, NULL); + InitEntityFromSpawnInfo((entInfo->isNotTeamMember == FALSE), entity, &monSpawnInfo, NULL); sub_806AED8(&entInfo->moves, &entInfo->maxHPStat, entInfo->atk, entInfo->def, entInfo->id, entInfo->level); entInfo->HP = entInfo->maxHPStat; entInfo->shopkeeper = 0; @@ -724,7 +699,7 @@ void sub_806BB6C(Entity *entity, s32 _species) EntityUpdateStatusSprites(entity); } -void sub_806BC68(bool8 a0, Entity *entity, struct unkStruct_806B7F8 *structPtr, DungeonPos *pos) +static void InitEntityFromSpawnInfo(bool8 a0, Entity *entity, struct MonSpawnInfo *monSpawnInfo, DungeonPos *pos) { DungeonPos entityPos; EntityInfo *entInfo; @@ -732,7 +707,7 @@ void sub_806BC68(bool8 a0, Entity *entity, struct unkStruct_806B7F8 *structPtr, gDungeon->unkC = 1; entInfo = GetEntInfo(entity); ResetMonEntityData(entInfo, TRUE); - entInfo->monsterBehavior = structPtr->unk2; + entInfo->monsterBehavior = monSpawnInfo->unk2; entity->isVisible = TRUE; entity->unk22 = 0; entity->prevPos.x = -1; @@ -740,14 +715,14 @@ void sub_806BC68(bool8 a0, Entity *entity, struct unkStruct_806B7F8 *structPtr, entity->pos.x = -2; entity->pos.y = -2; - sub_80694C0(entity, structPtr->pos.x, structPtr->pos.y, 1); + sub_80694C0(entity, monSpawnInfo->pos.x, monSpawnInfo->pos.y, 1); UpdateEntityPixelPos(entity, NULL); if (!a0) { - if (structPtr->species == MONSTER_KECLEON + if (monSpawnInfo->species == MONSTER_KECLEON && !gDungeon->unk644.unk2A && gDungeon->unk3A0A - && !structPtr->unk2) + && !monSpawnInfo->unk2) { entInfo->shopkeeper = 1; } @@ -766,14 +741,14 @@ void sub_806BC68(bool8 a0, Entity *entity, struct unkStruct_806B7F8 *structPtr, entInfo->dungeonSpriteId = gDungeon->unk37F0; gDungeon->unk37F0++; entInfo->unk9C = 0; - if (structPtr->level == 0) { - entInfo->level = GetSpawnedMonsterLevel(structPtr->species); + if (monSpawnInfo->level == 0) { + entInfo->level = GetSpawnedMonsterLevel(monSpawnInfo->species); } else { - entInfo->level = structPtr->level; + entInfo->level = monSpawnInfo->level; } - entInfo->moveRandomly = structPtr->unk4; + entInfo->moveRandomly = monSpawnInfo->unk4; entInfo->IQ = 1; SetDefaultIQSkills(&entInfo->IQSkillMenuFlags, FALSE); GenerateHiddenPower(&entInfo->hiddenPower); @@ -1025,7 +1000,7 @@ void sub_806C330(s32 _x, s32 _y, s16 _species, u32 _a3) void sub_806C3C0(void) { s32 i; - struct unkStruct_806B7F8 spStruct; + struct MonSpawnInfo spStruct; unkDungeon57C *strPtr = &gDungeon->unk57C; for (i = 0; i < strPtr->unk40; i++) { @@ -1037,7 +1012,7 @@ void sub_806C3C0(void) spStruct.unk2 = strPtr->unkArray[i].unk2; spStruct.unk4 = 0; spStruct.unk10 = 0; - sub_806B7F8(&spStruct, TRUE); + SpawnWildMon(&spStruct, TRUE); } } } @@ -1048,7 +1023,7 @@ void sub_806C42C(void) strPtr->unk40 = 0; } -s32 sub_806C444(s32 _species, s32 level) +static s32 CalcSpeciesHPAtLevel(s32 _species, s32 level) { LevelData levelData; s32 i; @@ -1063,7 +1038,7 @@ s32 sub_806C444(s32 _species, s32 level) return hpCount; } -s32 sub_806C488(s32 _species, s32 level, s32 categoryIndex) +static s32 CalcSpeciesAtkAtLevel(s32 _species, s32 level, s32 categoryIndex) { LevelData levelData; s32 i; @@ -1078,7 +1053,7 @@ s32 sub_806C488(s32 _species, s32 level, s32 categoryIndex) return offensiveCount; } -s32 sub_806C4D4(s32 _species, s32 level, s32 categoryIndex) +static s32 CalcSpeciesDefAtLevel(s32 _species, s32 level, s32 categoryIndex) { LevelData levelData; s32 i; diff --git a/src/dungeon_move.c b/src/dungeon_move.c index e72ce0f92..576898bf3 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -10,11 +10,10 @@ #include "effect_main.h" #include "effect_data.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_8041AD0.h" #include "code_806CD90.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "dungeon_random.h" #include "dungeon_logic.h" #include "dungeon_config.h" @@ -44,14 +43,13 @@ #include "text_util.h" #include "dungeon_pos_data.h" #include "dungeon_engine.h" +#include "warp_target.h" extern void sub_80429C8(Entity *r0); extern s16 sub_8057600(Move *move, s32 itemID); -extern void sub_803ED30(s32, Entity *r0, u8, s32); extern void sub_8042238(Entity *pokemon, Entity *target); extern void sub_806A1E8(Entity *pokemon); extern void sub_804178C(u32); -extern void EnemyEvolution(Entity *); extern void sub_80428A0(Entity *r0); extern bool8 sub_8040BB0(Entity *entity, Move *move, bool8); extern void sub_8040DA0(Entity *entity, Move *move); @@ -59,17 +57,11 @@ extern u16 sub_80412E0(u16 moveId, u8 weather, u8 a2); 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 Entity *sub_80696A8(Entity *a0); -extern Entity *GetMonsterAtPos(DungeonPos *pos); -extern s32 sub_800ED20(u16 param_1); extern void sub_8042930(Entity *r0); extern void sub_8041B48(Entity *pokemon); extern void sub_8041BA8(Entity *pokemon); extern void sub_8042950(Entity *r0); -extern const s32 gUnknown_8106A50; -extern const s32 gUnknown_8106A4C; - static s32 TryHitTarget(Entity *attacker, Entity *target, Move *move, struct DamageStruct *dmgStruct, s16 unk_); EWRAM_DATA s32 gUnknown_202F208 = 0; @@ -498,16 +490,16 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, moveHadEffect = PoisonStingMoveAction(attacker, currTarget, move, itemId); break; case MOVE_PSYCHIC: - moveHadEffect = sub_8058C98(attacker, currTarget, move, gUnknown_8106A50, itemId); + moveHadEffect = sub_8058C98(attacker, currTarget, move, gStatIndexSpecial, itemId); break; case MOVE_ACID: - moveHadEffect = sub_8058C98(attacker, currTarget, move, gUnknown_8106A4C, itemId); + moveHadEffect = sub_8058C98(attacker, currTarget, move, gStatIndexAtkDef, itemId); break; case MOVE_METAL_CLAW: - moveHadEffect = MetalClawMoveAction(attacker, currTarget, move, gUnknown_8106A4C, itemId); + moveHadEffect = MetalClawMoveAction(attacker, currTarget, move, gStatIndexAtkDef, itemId); break; case MOVE_STEEL_WING: - moveHadEffect = SteelWingMoveAction(attacker, currTarget, move, gUnknown_8106A4C, itemId); + moveHadEffect = SteelWingMoveAction(attacker, currTarget, move, gStatIndexAtkDef, itemId); break; case MOVE_POISON_TAIL: moveHadEffect = PoisonTailMoveAction(attacker, currTarget, move, itemId); @@ -1348,7 +1340,7 @@ void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, } if (EntityIsValid(attacker) && GetEntInfo(attacker)->unk155 != 0) { GetEntInfo(attacker)->unk155 = 0; - LowerAttackStageTarget(attacker, attacker, gUnknown_8106A50, 2, 0, FALSE); + LowerAttackStageTarget(attacker, attacker, gStatIndexSpecial, 2, 0, FALSE); } } } diff --git a/src/dungeon_move_util.c b/src/dungeon_move_util.c index 172f269d0..2e25a49e1 100644 --- a/src/dungeon_move_util.c +++ b/src/dungeon_move_util.c @@ -10,11 +10,10 @@ #include "effect_data.h" #include "effect_sub_1.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_8041AD0.h" #include "code_806CD90.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "dungeon_random.h" #include "dungeon_logic.h" #include "dungeon_config.h" @@ -42,11 +41,11 @@ #include "dungeon_pos_data.h" #include "dungeon_engine.h" #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 EnemyEvolution(Entity *); extern void sub_80428A0(Entity *r0); extern bool8 sub_8040BB0(Entity *entity, Move *move, bool8); extern void sub_8040DA0(Entity *entity, Move *move); @@ -54,8 +53,6 @@ extern u16 sub_80412E0(u16 moveId, u8 weather, u8 a2); 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 Entity *GetMonsterAtPos(DungeonPos *pos); -extern s32 sub_800ED20(u16 param_1); static u8 ToItemID(u32 itemID); diff --git a/src/dungeon_music.c b/src/dungeon_music.c index 1aeb5f0b7..2f6e088f7 100644 --- a/src/dungeon_music.c +++ b/src/dungeon_music.c @@ -1,14 +1,13 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_music.h" #include "constants/bg_music.h" #include "structs/menu.h" #include "music_util.h" #include "dungeon_info.h" -#include "dungeon_music.h" #include "music.h" #include "run_dungeon.h" - -extern MenuInputStruct gDungeonMenu; +#include "dungeon_engine.h" // Dungeon Music Player adds in this flag to tell // the system to fade in rather than immediately playing @@ -128,7 +127,7 @@ void DungeonStopBGM(void) StopBGMusic(); } -u16 DungeonGetCurrentBGSong(void) +UNUSED static u16 DungeonGetCurrentBGSong(void) { return GetCurrentBGSong(); } diff --git a/src/dungeon_name_banner.c b/src/dungeon_name_banner.c index 691fbe9fa..f6df7d8b9 100644 --- a/src/dungeon_name_banner.c +++ b/src/dungeon_name_banner.c @@ -2,23 +2,19 @@ #include "globaldata.h" #include "dungeon_name_banner.h" #include "constants/dungeon.h" -#include "structs/str_202ED28.h" -#include "structs/str_202EDE8.h" #include "bg_palette_buffer.h" #include "code_800D090.h" #include "dungeon_vram.h" #include "cpu.h" #include "def_filearchives.h" #include "dungeon_info.h" +#include "dungeon_cutscene.h" #include "file_system.h" #include "pokemon.h" #include "pokemon_3.h" #include "text_1.h" #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; static EWRAM_DATA s32 gDungeonNameBannerFont = 0; @@ -62,7 +58,7 @@ void ShowDungeonNameBanner_Async(void) SetBGPaletteBufferColorArray(i + 224, &((struct DungeonNamePaletteFileData *)(gDungeonNameBannerPalette->data))->pal[i]); } CpuClear((void *)(VRAM + 0x140), 0x1C00); - if (sub_80848EC()) { + if (ShouldShowDungeonBanner()) { s32 currFloor = gDungeon->unk644.dungeonLocation.floor + gDungeon->startFloorId; const u8 *dungName = GetDungeonName2(gDungeon->unk644.dungeonLocation.id); s32 r5 = 10; diff --git a/src/dungeon_projectile_throw.c b/src/dungeon_projectile_throw.c index e353012e8..fb8be8ccb 100644 --- a/src/dungeon_projectile_throw.c +++ b/src/dungeon_projectile_throw.c @@ -10,17 +10,16 @@ #include "dungeon_config.h" #include "dungeon_pos_data.h" #include "code_8077274_1.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_806CD90.h" #include "dungeon_message.h" #include "move_util.h" #include "dungeon_strings.h" +#include "dungeon_range.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); struct ProjectileHitEntry diff --git a/src/dungeon_range.c b/src/dungeon_range.c index a8f6033a3..02b49c5ec 100644 --- a/src/dungeon_range.c +++ b/src/dungeon_range.c @@ -1,16 +1,15 @@ #include "global.h" #include "globaldata.h" #include "dungeon_range.h" -#include "dungeon_leader.h" #include "dungeon_random.h" #include "dungeon_logic.h" #include "dungeon_pos_data.h" #include "dungeon_util.h" +#include "dungeon_vram.h" #include "sprite.h" #include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "structs/map.h" -#include "structs/str_202ED28.h" EWRAM_INIT Entity *gLeaderPointer = NULL; diff --git a/src/dungeon_serializer.c b/src/dungeon_serializer.c index a0676b37f..3cf6a4d80 100644 --- a/src/dungeon_serializer.c +++ b/src/dungeon_serializer.c @@ -4,18 +4,15 @@ #include "code_805D8C8.h" #include "code_806CD90.h" #include "dungeon_items.h" +#include "dungeon_map.h" #include "dungeon_map_access.h" #include "dungeon_logic.h" #include "dungeon_serializer.h" +#include "dungeon_range.h" #include "dungeon_util.h" #include "dungeon_pokemon_sprites.h" #include "pokemon.h" -extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE]; -extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE]; - -extern DungeonPos gPlayerDotMapPosition; -extern Entity *gLeaderPointer; // 203B450 #include "data/dungeon_serializer.h" diff --git a/src/dungeon_submenu.c b/src/dungeon_submenu.c index 5a88ec3c4..cda890277 100644 --- a/src/dungeon_submenu.c +++ b/src/dungeon_submenu.c @@ -3,17 +3,14 @@ #include "code_800D090.h" #include "dungeon_submenu.h" #include "dungeon_vram.h" +#include "dungeon_action.h" +#include "dungeon_engine.h" #include "menu_input.h" #include "text_1.h" #include "text_3.h" // The reason this short file(just 1 function) exists is because of the pksdir string which usually signifies the file's beginning. -extern MenuInputStruct gDungeonMenu; -extern s32 gDungeonSubMenuItemsCount; - -extern u8 *GetDungeonSubMenuItemString(s32 param_1); -extern bool8 CanSubMenuItemBeChosen(s32 param_1); void CreateDungeonMenuSubWindow(WindowTemplate *mainWindow, s32 subWindowX) { diff --git a/src/dungeon_tilemap.c b/src/dungeon_tilemap.c index 8b854c56c..75cf06e8a 100644 --- a/src/dungeon_tilemap.c +++ b/src/dungeon_tilemap.c @@ -1,8 +1,8 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_tilemap.h" #include "constants/item.h" #include "constants/status.h" -#include "structs/str_202EDE8.h" #include "bg_control.h" #include "bg_palette_buffer.h" #include "code_8004AA0.h" @@ -11,7 +11,6 @@ #include "effect_data.h" #include "code_801602C.h" #include "dungeon_vram.h" -#include "code_803E724.h" #include "code_806CD90.h" #include "dungeon_info.h" #include "dungeon_items.h" @@ -34,22 +33,14 @@ #include "run_dungeon.h" #include "effect_main.h" -extern s32 gDungeonFramesCounter; - -extern void UpdateMinimap(void); -extern void sub_80400D4(void); extern void sub_8041888(u8 param_1); -extern void sub_803F7BC(void); -extern void UpdateMinimap(); -void sub_803EC94(void); -s32 sub_803EF90(s32 a0, u8 a1); -void UpdateCamera(u8 a0); -void sub_803F7BC(void); -void sub_803F38C(void); -void sub_803FB74(void); -void sub_803FE30(s32 a0, u16 *a1, bool8 a2, bool8 a3); -void sub_803FF18(s32 a0, u16 *a1, bool8 a2); +static void sub_803F38C(void); +static void sub_803F7BC(void); +static void sub_803FB74(void); +static void sub_803FE30(s32 a0, u16 *a1, bool8 a2, bool8 a3); +static void sub_803FF18(s32 a0, u16 *a1, bool8 a2); +static void sub_80400D4(void); static EWRAM_DATA u32 gUnknown_202EDFC = 0; @@ -104,7 +95,7 @@ void sub_803F27C(bool8 a0) } } -void sub_803F38C(void) +static void sub_803F38C(void) { s32 palId; UnkDungeonGlobal_unk181E8_sub *strPtr = &gDungeon->unk181e8; @@ -306,7 +297,7 @@ void UpdateCamera(u8 a0) sub_803F7BC(); } -void sub_803F7BC(void) +static void sub_803F7BC(void) { UnkDungeonGlobal_unk181E8_sub *strPtr = &gDungeon->unk181e8; const Tile *tile = GetTile(strPtr->cameraPos.x, strPtr->cameraPos.y); @@ -414,7 +405,7 @@ void sub_803F9CC(void) IWRAM_DATA static u32 gUnknown_3001018[96] = {0}; -void sub_803FA4C(s32 a0, s32 a1, bool8 a2) +static void sub_803FA4C(s32 a0, s32 a1, bool8 a2) { s32 i; s32 r5; @@ -477,7 +468,7 @@ void sub_803FA4C(s32 a0, s32 a1, bool8 a2) ScheduleMemCopy((void *) VRAM + 0x5980, gUnknown_3001018, sizeof(gUnknown_3001018)); } -void sub_803FB74(void) +static void sub_803FB74(void) { s32 i; u16 *arrPtr; @@ -603,7 +594,7 @@ static const u16 gUnknown_80F64D8[][9] = { [1] = {0xF2C8, 0xF2C7, 0xF2C6, 0xF2C5, 0xF2C4, 0xF2C3, 0xF2C2, 0xF2C1, 0xF2C0}, }; -void sub_803FE30(s32 a0, u16 *a1, bool8 a2, bool8 a3) +static void sub_803FE30(s32 a0, u16 *a1, bool8 a2, bool8 a3) { s32 var = (a2) ? 0 : 55; @@ -658,7 +649,7 @@ static const u16 gUnknown_80F6544[][9] = { [1] = {0xF2C8, 0xF2C7, 0xF2C6, 0xF2C5, 0xF2C4, 0xF2C3, 0xF2C2, 0xF2C1, 0xF2C0}, }; -void sub_803FF18(s32 a0, u16 *a1, bool8 a2) +static void sub_803FF18(s32 a0, u16 *a1, bool8 a2) { s32 arrId = (!a2) ? 1 : 0; s32 var = (a2) ? 0 : 55; @@ -739,7 +730,7 @@ static const s32 gUnknown_80F6568[] = { 0, -1, 1, -1, 1, -1, 1, -2, 1, -2, 2, -2, 2, -2, 2, -3, 3, -3, 3, -3, 4, -4, 4, -4, 4, -5, 4, -5, 4, -5, 4, -5 }; -void sub_80400D4(void) +static void sub_80400D4(void) { s32 temp; temp = gDungeon->unk181e8.unk18200; diff --git a/src/code_8073CF0.c b/src/dungeon_turn_effects.c similarity index 96% rename from src/code_8073CF0.c rename to src/dungeon_turn_effects.c index 93f79a058..489162ccc 100644 --- a/src/code_8073CF0.c +++ b/src/dungeon_turn_effects.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "dungeon_turn_effects.h" #include "dungeon_util.h" #include "items.h" #include "status.h" @@ -32,30 +33,17 @@ #include "dungeon_strings.h" #include "dungeon_engine.h" #include "dungeon_damage.h" +#include "dungeon_range.h" +#include "dungeon_move_util.h" +#include "warp_target.h" extern void sub_805229C(void); -extern void sub_807E8F0(Entity *); -extern void sub_80444F4(Entity *pokemon); -extern void WarpTarget(Entity *pokemon, Entity *r1, u32 r2, DungeonPos *r3); extern void sub_80420B8(Entity *pokemon); extern void sub_8041C4C(Entity *pokemon, u32 r1); extern void sub_805E804(void); -extern void sub_80838EC(u8 *a); -extern bool8 TryUseChosenMove(struct Entity *, u32, u32, u32, u32, struct Move *); -extern void nullsub_97(Entity *entity); -extern void sub_805EE30(void); -extern void sub_8086AC0(void); -extern void sub_8085140(void); -extern void sub_8075708(Entity *entity); -extern void sub_8043ED0(u32); -extern void EnemyEvolution(Entity *); -extern void sub_8075900(Entity *pokemon, u8 r1); -extern void sub_806A5B8(Entity *); -extern void sub_807EC28(bool8); +extern bool8 DisplayActions(Entity *a0); -bool8 DisplayActions(Entity *a0); - -void sub_8074094(Entity *entity) +void ApplyEndOfTurnEffects(Entity *entity) { s32 rand; EntityInfo *entityInfo; diff --git a/src/dungeon_util.c b/src/dungeon_util.c index f1eafb69d..5e36f5762 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -8,7 +8,7 @@ #include "code_806CD90.h" #include "dungeon_items.h" #include "dungeon_map_access.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_range.h" #include "pokemon.h" #include "code_805D8C8.h" @@ -17,20 +17,17 @@ #include "dungeon_logic.h" #include "dungeon_random.h" #include "dungeon_util.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_message.h" #include "dungeon_pokemon_sprites.h" +#include "dungeon_misc.h" #include "dungeon_music.h" #include "dungeon_map.h" #include "string_format.h" #include "items.h" #include "trap.h" - -extern const u8 *gUnknown_80FE6F4[]; - -extern void sub_8045ACC(void); -extern s32 GetMonsterApparentID(Entity *pokemon, s32 id); -extern void sub_8045BF8(u8 *, Item *); +#include "dungeon_data.h" +#include "dungeon_strings.h" EWRAM_DATA u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE] = {0}; EWRAM_DATA u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE] = {0}; @@ -618,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, gUnknown_80FE6F4); break; } } diff --git a/src/dungeon_vram.c b/src/dungeon_vram.c index 1c8103571..e9f2dc67e 100644 --- a/src/dungeon_vram.c +++ b/src/dungeon_vram.c @@ -9,7 +9,7 @@ #include "graphics_memory.h" #include "code_800C9CC.h" #include "music_util.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "dungeon_map.h" #include "dungeon_music.h" #include "game_options.h" @@ -18,8 +18,6 @@ #include "sprite.h" #include "text_1.h" #include "text_2.h" -#include "structs/str_202ED28.h" -#include "structs/str_202EDE8.h" #include "dungeon_map.h" #include "dungeon_map_access.h" #include "dungeon_message.h" @@ -30,6 +28,11 @@ #include "dungeon_pokemon_sprites.h" #include "menu_input.h" #include "code_801602C.h" +#include "dungeon_tilemap.h" +#include "dungeon_name_banner.h" +#include "dungeon_engine.h" +#include "dungeon_cutscene.h" +#include "effect_main.h" // File split is correct. This technical file deals with windows, advancing frames(v-blanks) and vram / pal set-up. @@ -40,36 +43,28 @@ struct DungeonPalFile }; extern struct DungeonPalFile *gDungeonPaletteFile; -extern struct DungeonPalFile *gDungeonNameBannerPalette; extern struct DungeonPalFile *gUnknown_202EC94; extern RGB gUnknown_202ECA4[]; -extern MenuInputStruct gDungeonMenu; extern OpenedFile *gUnknown_202EC9C; -void xxx_draw_string_80524F0(void); -void sub_8085F78(void); -void UpdateCamera(s32); void sub_806CC10(); void sub_804522C(); -void sub_803F9CC(); -void sub_803ECE0(); -void sub_803EDF0(); -void sub_800E90C(); void sub_8042E5C(); static void sub_803E490(u32); -static s32 sub_803EF90(s32 a0, u8 a1); static void sub_803EC94(void); -void sub_803E874(bool8 r10, s32 r9); +static void sub_803ECE0(void); +static void sub_803EDF0(void); +static s32 sub_803EF90(s32 a0, u8 a1); EWRAM_DATA struct unkStruct_202ED28 gUnknown_202ED28[2][6] = {0}; -EWRAM_DATA SpriteOAM gUnknown_202EDB8 = {0}; +static EWRAM_DATA SpriteOAM sUnknown_202EDB8 = {0}; EWRAM_DATA SpriteOAM gUnknown_202EDC0 = {0}; EWRAM_DATA s32 gDungeonBrightness = 0; EWRAM_DATA s32 gDungeonFramesCounter = 0; EWRAM_DATA s32 gUnknown_202EDD0 = 0; -EWRAM_DATA s32 gUnknown_202EDD4 = 0; -EWRAM_DATA s32 gUnknown_202EDD8 = 0; +static EWRAM_DATA s32 sUnknown_202EDD4 = 0; +static EWRAM_DATA s32 sUnknown_202EDD8 = 0; static EWRAM_DATA SpriteOAM gUnknown_202EDDC = {0}; UNUSED static EWRAM_DATA s32 sUnused = 0; EWRAM_DATA struct UnkStruct_202EDE8 gUnknown_202EDE8 = {0}; @@ -99,7 +94,7 @@ void sub_803E250(void) s32 i, j; gUnknown_202EDD0 = 999; - gUnknown_202EDD4 = 0; + sUnknown_202EDD4 = 0; gUnknown_203B40D = 0; gUnknown_202EDE8.unk0 = 0; @@ -120,22 +115,22 @@ void sub_803E250(void) SpriteSetUnk6_1(&gUnknown_202EDC0, 0); SpriteSetUnk6_2(&gUnknown_202EDC0, 0); - SpriteSetY(&gUnknown_202EDB8, 0); - SpriteSetAffine1(&gUnknown_202EDB8, 0); - SpriteSetAffine2(&gUnknown_202EDB8, 0); - SpriteSetObjMode(&gUnknown_202EDB8, 0); - SpriteSetMosaic(&gUnknown_202EDB8, 0); - SpriteSetBpp(&gUnknown_202EDB8, 0); - SpriteSetShape(&gUnknown_202EDB8, 0); - SpriteSetMatrixNum(&gUnknown_202EDB8, 0); - SpriteSetSize(&gUnknown_202EDB8, 0); - SpriteSetX(&gUnknown_202EDB8, 0); - SpriteSetTileNum(&gUnknown_202EDB8, 0); - SpriteSetPriority(&gUnknown_202EDB8, 3); - SpriteSetPalNum(&gUnknown_202EDB8, 5); - SpriteSetUnk6_0(&gUnknown_202EDB8, 0); - SpriteSetUnk6_1(&gUnknown_202EDB8, 0); - SpriteSetUnk6_2(&gUnknown_202EDB8, 0); + SpriteSetY(&sUnknown_202EDB8, 0); + SpriteSetAffine1(&sUnknown_202EDB8, 0); + SpriteSetAffine2(&sUnknown_202EDB8, 0); + SpriteSetObjMode(&sUnknown_202EDB8, 0); + SpriteSetMosaic(&sUnknown_202EDB8, 0); + SpriteSetBpp(&sUnknown_202EDB8, 0); + SpriteSetShape(&sUnknown_202EDB8, 0); + SpriteSetMatrixNum(&sUnknown_202EDB8, 0); + SpriteSetSize(&sUnknown_202EDB8, 0); + SpriteSetX(&sUnknown_202EDB8, 0); + SpriteSetTileNum(&sUnknown_202EDB8, 0); + SpriteSetPriority(&sUnknown_202EDB8, 3); + SpriteSetPalNum(&sUnknown_202EDB8, 5); + SpriteSetUnk6_0(&sUnknown_202EDB8, 0); + SpriteSetUnk6_1(&sUnknown_202EDB8, 0); + SpriteSetUnk6_2(&sUnknown_202EDB8, 0); for (i = 0; i < 2; i++) { for (j = 0; j < 6; j++) { @@ -173,7 +168,7 @@ void DungeonRunFrameActions(u32 a0) static void sub_803E490(u32 unused) { - gUnknown_202EDD4++; + sUnknown_202EDD4++; xxx_draw_string_80524F0(); sub_8085F78(); UpdateCamera(1); @@ -237,12 +232,12 @@ static void sub_803E490(u32 unused) TryResetDungeonMapTilesScheduledForCopy(); ResetSprites(FALSE); nullsub_10(FALSE); - gUnknown_202EDD4--; + sUnknown_202EDD4--; } void sub_803E668(u32 unused) { - gUnknown_202EDD4++; + sUnknown_202EDD4++; nullsub_8(gGameOptionsRef->touchScreen); sub_8005180(); nullsub_12(); @@ -264,7 +259,7 @@ void sub_803E668(u32 unused) UpdateSoundEffectCounters(); ResetSprites(FALSE); nullsub_10(FALSE); - gUnknown_202EDD4--; + sUnknown_202EDD4--; } void sub_803E708(s32 numFrames, u32 a1) @@ -394,7 +389,7 @@ void sub_803E874(bool8 r10, s32 r9) if (r10) { index = 224; - color = gDungeonNameBannerPalette->unk4; + color = gDungeonNameBannerPalette->data; count = 16; for (i = 0; i < count; i++) { SetBGPaletteBufferColorRGB(index, color, r9, NULL); @@ -664,15 +659,15 @@ void DungeonShowWindows(const WindowTemplates *winTemplates, bool8 a1) ShowWindows(winTemplates, TRUE, a1); } -void sub_803ECE0(void) +static void sub_803ECE0(void) { - gUnknown_202EDD8++; - if (gUnknown_202EDD8 < 0) - gUnknown_202EDD8 = 0; - if (gUnknown_202EDD8 > 11) - gUnknown_202EDD8 = 0; + sUnknown_202EDD8++; + if (sUnknown_202EDD8 < 0) + sUnknown_202EDD8 = 0; + if (sUnknown_202EDD8 > 11) + sUnknown_202EDD8 = 0; - ScheduleMemCopy((void *)VRAM + 0x14400, gUnknown_202EC94->unk4 + ((gUnknown_202EDD8 / 4) * 0x240), 0x240); + ScheduleMemCopy((void *)VRAM + 0x14400, gUnknown_202EC94->unk4 + ((sUnknown_202EDD8 / 4) * 0x240), 0x240); } void sub_803ED30(s32 a0, Entity *mon, u8 a2, s32 a3) @@ -713,7 +708,7 @@ void sub_803ED30(s32 a0, Entity *mon, u8 a2, s32 a3) ScheduleMemCopy((void *) VRAM + 0x142C0, gDungeon->unk18, 0x80); } -void sub_803EDF0(void) +static void sub_803EDF0(void) { EntityInfo *entInfo; s32 x, y, y1, y2; diff --git a/src/dungeon_wind.c b/src/dungeon_wind.c index 3d925efca..439e3c4c6 100644 --- a/src/dungeon_wind.c +++ b/src/dungeon_wind.c @@ -6,23 +6,20 @@ #include "constants/ability.h" #include "constants/type.h" #include "dungeon_ai.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_logic.h" #include "dungeon_util.h" #include "dungeon_config.h" #include "dungeon_strings.h" +#include "dungeon_main.h" +#include "dungeon_misc.h" #include "move_util.h" #include "moves.h" #include "structs/str_dungeon.h" #include "dungeon_engine.h" extern u8 DisplayActions(Entity *); -extern void sub_805E804(void); -void TryPointCameraToMonster(Entity *pokemon, u8 param_2); -extern void nullsub_93(DungeonPos *); -extern void sub_807EC28(bool8); -extern void sub_806A5B8(Entity *); void sub_807E378(void) { diff --git a/src/effect_main.c b/src/effect_main.c index 610f4427c..63c8710fa 100644 --- a/src/effect_main.c +++ b/src/effect_main.c @@ -6,7 +6,7 @@ #include "structs/axdata.h" #include "bg_control.h" #include "music_util.h" -#include "code_803E724.h" +#include "dungeon_vram.h" #include "def_filearchives.h" #include "dungeon_map.h" #include "file_system.h" diff --git a/src/effect_sub_1.c b/src/effect_sub_1.c index d20343cf4..1337f5b5b 100644 --- a/src/effect_sub_1.c +++ b/src/effect_sub_1.c @@ -7,7 +7,7 @@ #include "graphics_memory.h" #include "code_800C9CC.h" #include "effect_data.h" -#include "code_803E724.h" +#include "dungeon_vram.h" #include "dungeon_message.h" #include "file_system.h" #include "main_loops.h" diff --git a/src/explosion.c b/src/explosion.c index 4a85c98c0..927a54c99 100644 --- a/src/explosion.c +++ b/src/explosion.c @@ -1,11 +1,11 @@ #include "global.h" #include "globaldata.h" +#include "explosion.h" #include "constants/ability.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "structs/str_dungeon.h" #include "code_8077274_1.h" #include "dungeon_ai.h" @@ -33,8 +33,6 @@ extern void sub_804218C(Entity *pokemon, Entity *target); static EWRAM_INIT u32 gUnknown_203B444[3] = {0x28, 0x28, 0x50}; -void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 param_4,s32 param_5); - static const DungeonPos gUnknown_81070E8[] = { {0, 0}, {0, 1}, @@ -83,6 +81,8 @@ static const DungeonPos *const gUnknown_8107178[3] = { gUnknown_8107110 }; +static void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 param_4,s32 param_5); + void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 param_4,u8 moveType,s16 param_6) { bool8 flag; @@ -171,7 +171,7 @@ void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 para } } -void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 param_4,s32 param_5) +static void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 param_4,s32 param_5) { EntityInfo *targetInfo; u8 flag; diff --git a/src/expose_trap.c b/src/expose_trap.c index 8987ab91c..654979a7a 100644 --- a/src/expose_trap.c +++ b/src/expose_trap.c @@ -1,11 +1,11 @@ #include "global.h" #include "globaldata.h" +#include "expose_trap.h" #include "constants/ability.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "structs/str_dungeon.h" #include "code_8077274_1.h" #include "dungeon_ai.h" @@ -26,8 +26,6 @@ #include "dungeon_items.h" #include "dungeon_strings.h" -bool8 ExposeTrap(s32 x,s32 y); - void sub_807D3CC(Entity *param_1) { u32 room; diff --git a/src/friend_area_action_menu.c b/src/friend_area_action_menu.c index c6c9ebd5e..560418b15 100644 --- a/src/friend_area_action_menu.c +++ b/src/friend_area_action_menu.c @@ -50,8 +50,6 @@ bool8 sub_8027D9C(Pokemon *pokeStruct); extern u8 sub_8027DCC(Pokemon *); extern void SetFriendAreaActionMenuState(u32); extern void PlaySound(u32); -extern void sub_808D31C(Pokemon *); -extern bool8 sub_808D750(s16 index_); u32 sub_8027E18(Pokemon *); u8 sub_8027E4C(Pokemon *r0); diff --git a/src/friend_list.c b/src/friend_list.c index 3e6e958ff..4dc1ccd3d 100644 --- a/src/friend_list.c +++ b/src/friend_list.c @@ -17,8 +17,6 @@ #include "ground_map.h" #include "constants/input.h" -extern bool8 sub_808D750(s32 index_); - static IWRAM_INIT struct unkStruct_3001B60 *sFriendList = {NULL}; static void SortbyAlphabetNo(s32, s32); diff --git a/src/game_options.c b/src/game_options.c index 8b8b705b1..de390e08d 100644 --- a/src/game_options.c +++ b/src/game_options.c @@ -1,14 +1,8 @@ #include "global.h" #include "globaldata.h" +#include "game_options.h" #include "graphics_memory.h" #include "data_serializer.h" -#include "game_options.h" - -struct unkStruct_8094CB0 -{ - u16 unk0; - s16 unk2; -}; EWRAM_INIT GameOptions *gGameOptionsRef = {NULL}; EWRAM_DATA GameOptions gGameOptions = {0}; @@ -201,100 +195,105 @@ void SetWindowBGColor(void) SetFontsBaseColor(winColors[gGameOptionsRef->windowColor & NUM_WINDOW_COLORS]); } -bool8 sub_8094C48(void) +bool8 GameOptions_ShowMiniMap(void) { - switch(gGameOptionsRef->mapOption) - { + switch (gGameOptionsRef->mapOption) { default: return TRUE; - case TOP_TEAM_DATA_NO_BOTTOM: + case TOP_TEAM_DATA_NO_BOTTOM: // MAP_OPTION_OFF case TOP_MESSAGE_LOG_NO_BOTTOM: return FALSE; } } -bool8 DoesNotHaveShadedMap(void) +bool8 GameOptions_IsTransparentMiniMap(void) { - switch(gGameOptionsRef->mapOption) - { + switch (gGameOptionsRef->mapOption) { default: return TRUE; case TOP_TEAM_DATA_SHADED_MAP_BOTTOM: - case TOP_MESSAGE_LOG_SHADED_MAP_BOTTOM: + case TOP_MESSAGE_LOG_SHADED_MAP_BOTTOM: // MAP_OPTION_SHADE return FALSE; } } -void sub_8094C88(void) +void GameOptions_SetTransparentMiniMap(void) { - if (gGameOptionsRef->mapOption == 0 || gGameOptionsRef->mapOption == 1 || gGameOptionsRef->mapOption == 2) - gGameOptionsRef->mapOption = 1; - else if (gGameOptionsRef->mapOption == 3 || gGameOptionsRef->mapOption == 4 || gGameOptionsRef->mapOption == 5) - gGameOptionsRef->mapOption = 4; + if (gGameOptionsRef->mapOption == MAP_OPTION_OFF || gGameOptionsRef->mapOption == MAP_OPTION_CLEAR || gGameOptionsRef->mapOption == MAP_OPTION_SHADE) + gGameOptionsRef->mapOption = MAP_OPTION_CLEAR; + else if (gGameOptionsRef->mapOption == TOP_MESSAGE_LOG_NO_BOTTOM || gGameOptionsRef->mapOption == TOP_MESSAGE_LOG_CLEAR_MAP_BOTTOM || gGameOptionsRef->mapOption == TOP_MESSAGE_LOG_SHADED_MAP_BOTTOM) + gGameOptionsRef->mapOption = TOP_MESSAGE_LOG_CLEAR_MAP_BOTTOM; } -void sub_8094CB0(struct unkStruct_8094CB0 *r0) +// DS Stuff below? +struct unkStruct_8094CB0 +{ + s16 unk0; + s16 unk2; +}; + +UNUSED static void sub_8094CB0(struct unkStruct_8094CB0 *r0) { r0->unk0 = -1; r0->unk2 = -1; } -void sub_8094CC0(struct unkStruct_8094CB0 *r0) +UNUSED static void sub_8094CC0(struct unkStruct_8094CB0 *r0) { r0->unk0 = -1; r0->unk2 = -1; } -void sub_8094CD0(struct unkStruct_8094CB0 *r0) +UNUSED static void sub_8094CD0(struct unkStruct_8094CB0 *r0) { r0->unk0 = -1; r0->unk2 = -1; } -void sub_8094CE0(struct unkStruct_8094CB0 *r0) +UNUSED static void sub_8094CE0(struct unkStruct_8094CB0 *r0) { r0->unk0 = -1; r0->unk2 = -1; } -void sub_8094CF0(struct unkStruct_8094CB0 *r0) +UNUSED static void sub_8094CF0(struct unkStruct_8094CB0 *r0) { r0->unk0 = -1; r0->unk2 = -1; } -void sub_8094D00(struct unkStruct_8094CB0 *r0) +UNUSED static void sub_8094D00(struct unkStruct_8094CB0 *r0) { r0->unk0 = -1; r0->unk2 = -1; } -u32 sub_8094D10(void) +UNUSED static u32 sub_8094D10(void) { return 0; } -u8 sub_8094D14(void) +bool8 sub_8094D14(void) +{ + return FALSE; +} + +UNUSED static u32 sub_8094D18(void) { return 0; } -u32 sub_8094D18(void) +UNUSED static u32 sub_8094D1C(void) { return 0; } -u32 sub_8094D1C(void) +UNUSED static u32 sub_8094D20(void) { return 0; } -u32 sub_8094D20(void) -{ - return 0; -} - -u32 sub_8094D24(void) +UNUSED static u32 sub_8094D24(void) { return 0; } diff --git a/src/ground_lives.c b/src/ground_lives.c index aa988ff48..2858fa264 100644 --- a/src/ground_lives.c +++ b/src/ground_lives.c @@ -130,8 +130,6 @@ extern bool8 GroundScriptNotify(Action *param_1, s32 param_2); extern bool8 GroundScript_Cancel(Action *r0); extern Pokemon *sub_80A8D54(s32); extern void sub_80A6688(struct UnkGroundSpriteStruct *ptr, s32 a0); -extern s32 sub_808D6A4(s32 *ptr); -extern s32 sub_808D654(s32 *ptr); extern bool8 GetCurrentDungeonBounds(PixelPos *a0, PixelPos *a1); extern void sub_80A7428(struct UnkGroundSpriteStruct *ptr, s32 a1_, s32 monsterId_, s32 a3); extern void SetPredefinedScript(Action *param_1, s16 index, const ScriptCommand *param_3); diff --git a/src/ground_sprite.c b/src/ground_sprite.c index 265ede12c..399829cde 100644 --- a/src/ground_sprite.c +++ b/src/ground_sprite.c @@ -11,6 +11,7 @@ #include "memory.h" #include "sprite.h" #include "effect_sub_1.h" +#include "pokemon.h" static IWRAM_INIT unkStruct_3001B7C *gUnknown_3001B7C = {NULL}; @@ -28,9 +29,6 @@ static EWRAM_INIT OpenedFile *gUnknown_203B4B4 = {NULL}; // code_8098BDC.s extern void sub_809971C(u16, const u8 *, s16); extern void sub_80997F4(u16, u16); -// pokemon_2.s -extern void InitShadowSprites(u32, u32); - extern void sub_80ABA7C(void); extern void sub_80ACAD4(void); extern void sub_80AD7AC(void); diff --git a/src/ground_sprite_monster.c b/src/ground_sprite_monster.c index 4b5824a0b..149f30c73 100644 --- a/src/ground_sprite_monster.c +++ b/src/ground_sprite_monster.c @@ -7,7 +7,6 @@ #include "pokemon.h" extern s32 sub_800E700(s32); -extern bool8 AddShadowSprite(s32 species, DungeonPos* a2, axdata* a3); void sub_80A7428(struct UnkGroundSpriteStruct *ptr, s32 a1_, s32 monsterId_, s32 a3) { diff --git a/src/hurl_orb.c b/src/hurl_orb.c index 84f833fc8..0c4d424cd 100644 --- a/src/hurl_orb.c +++ b/src/hurl_orb.c @@ -1,12 +1,12 @@ #include "global.h" #include "globaldata.h" +#include "hurl_orb.h" #include "dungeon_vram.h" #include "code_8041AD0.h" #include "code_804267C.h" #include "code_805D8C8.h" #include "code_806CD90.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "constants/ability.h" #include "constants/monster.h" #include "constants/type.h" @@ -16,7 +16,7 @@ #include "dungeon_config.h" #include "dungeon_generation.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_logic.h" #include "dungeon_map.h" #include "dungeon_map_access.h" @@ -40,15 +40,13 @@ #include "weather.h" #include "dungeon_pos_data.h" #include "dungeon_damage.h" +#include "dungeon_kecleon_shop.h" +#include "blow_away.h" +#include "warp_target.h" -extern void sub_80833E8(DungeonPos *param_1, s32 *param_2); -extern void sub_806A5B8(Entity *); -extern void sub_807D068(Entity *, DungeonPos *); -extern void sub_807EC28(bool8 arg0); +static void sub_807F9BC(Entity *entity); -void sub_807F9BC(Entity *entity); - -void sub_807F43C(Entity *target, Entity *attacker) +void HandleHurlOrb(Entity *target, Entity *attacker) { s32 attackerDirection; s32 var_3C; @@ -233,7 +231,7 @@ void sub_807F43C(Entity *target, Entity *attacker) } } -void sub_807F9BC(Entity *entity) +static void sub_807F9BC(Entity *entity) { if (EntityIsValid(entity)) { EntityInfo *entInfo = GetEntInfo(entity); diff --git a/src/items.c b/src/items.c index 75b4b3541..ae3994770 100644 --- a/src/items.c +++ b/src/items.c @@ -15,10 +15,7 @@ #include "pokemon_types.h" #include "strings.h" #include "dungeon_info.h" - -extern const s32 gUnknown_810A3F0[100]; -extern const s16 gTypeGummiIQBoost[NUM_TYPES][NUMBER_OF_GUMMIS]; -extern u8 gInvalidItemIDs[0x10]; +#include "dungeon_data.h" EWRAM_DATA OpenedFile *gItemParametersFile = {NULL}; EWRAM_DATA ItemDataEntry *gItemParametersData = {NULL}; // NDS=0213BEF0 @@ -27,7 +24,6 @@ EWRAM_INIT TeamInventory *gTeamInventoryRef = {NULL}; // NDS=020EAF98 static void SortKecleonShopInventory(void); static bool8 AddKecleonWareItem(u8 itemIndex); - static void sub_8090F58(u8 *, u8 *, Item *, const unkStruct_8090F58 *); #define UNK_8108F64_ARR_COUNT 64 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/move_orb_actions_1.c b/src/move_orb_actions_1.c index 5d8bfdca5..dd34d3138 100644 --- a/src/move_orb_actions_1.c +++ b/src/move_orb_actions_1.c @@ -3,10 +3,9 @@ #include "move_orb_actions_1.h" #include "dungeon_move_util.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_806CD90.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/status.h" @@ -33,28 +32,7 @@ #include "dungeon_misc.h" #include "dungeon_strings.h" #include "dungeon_damage.h" - -extern void sub_806A5B8(Entity *entity); -void sub_8075900(Entity *pokemon, u8 r1); -extern void sub_807EC28(bool8); -extern void MudWaterSportEffect(u32); -extern void sub_806A6E8(Entity *); - -extern void EndAbilityImmuneStatus(Entity *, Entity *); -extern void HandleExplosion(Entity *pokemon, Entity *target, DungeonPos *pos, u32, u8 moveType, s16); -extern void nullsub_92(Entity *); -extern u8 sub_807EAA0(u32, u32); - -// move_util.h -extern bool8 sub_805727C(Entity *, Entity *, s32); -bool8 RollSecondaryEffect(Entity *pokemon, s32 chance); -bool8 sub_80571F0(Entity * pokemon, Move *move); - -extern s16 sub_8057600(Move *move, s32 itemID); - -// Note: For some reason I have to define these as an array of 1 to match asm. -const s32 gUnknown_8106A4C[1] = {0}; -const s32 gUnknown_8106A50[1] = {1}; +#include "move_util.h" bool8 IronTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { @@ -64,15 +42,13 @@ bool8 IronTailMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon, target, gIronTailSecondaryChance)) { - LowerDefenseStageTarget(pokemon, target, gUnknown_8106A4C[0], 1, 1, FALSE); + LowerDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 1, 1, FALSE); } } return flag; } -static const s24_8 sRolloutModifiers[] = { - IntToF248_2(1.0), IntToF248_2(1.0), IntToF248_2(1.5), IntToF248_2(2.0), IntToF248_2(2.5), IntToF248_2(3.0), IntToF248_2(3.5), IntToF248_2(4.0), IntToF248_2(4.5), IntToF248_2(5.0) -}; +static const s24_8 sRolloutModifiers[]; bool8 sub_805768C(Entity *pokemon, Entity *target, Move *move, s32 param_4) { @@ -144,13 +120,13 @@ bool8 DigMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) bool8 SweetScentMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - LowerAccuracyStageTarget(pokemon,target,gUnknown_8106A50[0],TRUE); + LowerAccuracyStageTarget(pokemon,target,gStatIndexSpecial,TRUE); return TRUE; } bool8 CharmMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A4C[0],FloatToF248(0.5),TRUE); + ChangeAttackMultiplierTarget(pokemon,target,gStatIndexAtkDef,FloatToF248(0.5),TRUE); return TRUE; } @@ -315,7 +291,7 @@ bool8 StringShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para bool8 SwaggerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { ConfuseStatusTarget(pokemon, target, TRUE); - RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C[0], 2); + RaiseAttackStageTarget(pokemon, target, gStatIndexAtkDef, 2); return TRUE; } @@ -340,7 +316,7 @@ bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move * move, s32 param_4) bool8 ScreechMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - ChangeDefenseMultiplierTarget(pokemon, target, gUnknown_8106A4C[0], FloatToF248(0.25), 1); + ChangeDefenseMultiplierTarget(pokemon, target, gStatIndexAtkDef, FloatToF248(0.25), 1); return TRUE; } @@ -395,7 +371,7 @@ bool8 WhirlpoolMoveAction(Entity * pokemon, Entity * target, Move * move, s32 pa bool8 FakeTearsMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) { - LowerDefenseStageTarget(pokemon, target, gUnknown_8106A50[0], 2, 1, TRUE); + LowerDefenseStageTarget(pokemon, target, gStatIndexSpecial, 2, 1, TRUE); return TRUE; } @@ -469,7 +445,7 @@ bool8 AuroraBeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para flag = TRUE; if(sub_805727C(pokemon, target, gAuroraBeamAtkLowerChance)) { - ChangeAttackMultiplierTarget(pokemon, target, gUnknown_8106A4C[0], FloatToF248(0.5), FALSE); + ChangeAttackMultiplierTarget(pokemon, target, gStatIndexAtkDef, FloatToF248(0.5), FALSE); } } return flag; @@ -481,8 +457,8 @@ bool8 MementoMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 entityInfo = GetEntInfo(pokemon); entityInfo->HP = 1; - ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A4C[0],FloatToF248(0.25),TRUE); - ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A50[0],FloatToF248(0.25),TRUE); + ChangeAttackMultiplierTarget(pokemon,target,gStatIndexAtkDef,FloatToF248(0.25),TRUE); + ChangeAttackMultiplierTarget(pokemon,target,gStatIndexSpecial,FloatToF248(0.25),TRUE); entityInfo->unk154 = 1; return TRUE; } @@ -496,7 +472,7 @@ bool8 OctazookaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param flag = TRUE; if(sub_805727C(pokemon, target, gOctazookaAccLowerChance)) { - LowerAccuracyStageTarget(pokemon, target, gUnknown_8106A4C[0], FALSE); + LowerAccuracyStageTarget(pokemon, target, gStatIndexAtkDef, FALSE); } } return flag; @@ -505,7 +481,7 @@ bool8 OctazookaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param bool8 FlatterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { ConfuseStatusTarget(pokemon, target, TRUE); - RaiseAttackStageTarget(pokemon, target, gUnknown_8106A50[0], 1); + RaiseAttackStageTarget(pokemon, target, gStatIndexSpecial, 1); return TRUE; } @@ -619,7 +595,7 @@ bool8 ExposeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) bool8 DoubleTeamMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - RaiseAccuracyStageTarget(pokemon, target, gUnknown_8106A50[0]); + RaiseAccuracyStageTarget(pokemon, target, gStatIndexSpecial); return TRUE; } @@ -640,7 +616,7 @@ bool8 GustMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) // NOTE: Is there a better name for this? bool8 BasicRaiseDefenseMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A4C[0], 1); + RaiseDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 1); return TRUE; } @@ -653,7 +629,7 @@ bool8 DisableMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 // NOTE: Is there a better name for this? bool8 BasicRaiseAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C[0], 1); + RaiseAttackStageTarget(pokemon, target, gStatIndexAtkDef, 1); return TRUE; } @@ -703,7 +679,7 @@ bool8 ShadowBallMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para flag = TRUE; if(sub_805727C(pokemon, target, gShadowBallSecondaryChance)) { - LowerDefenseStageTarget(pokemon, target, gUnknown_8106A50[0], 1, 1, FALSE); + LowerDefenseStageTarget(pokemon, target, gStatIndexSpecial, 1, 1, FALSE); } } return flag; @@ -900,13 +876,13 @@ bool8 SmellingSaltMoveAction(Entity * pokemon, Entity * target, Move * move, s32 bool8 MetalSoundMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - LowerDefenseStageTarget(pokemon, target, gUnknown_8106A50[0], 3, 1, TRUE); + LowerDefenseStageTarget(pokemon, target, gStatIndexSpecial, 3, 1, TRUE); return TRUE; } bool8 TickleMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - s32 index = gUnknown_8106A4C[0]; + s32 index = gStatIndexAtkDef; LowerAttackStageTarget(pokemon, target, index, 1, 1, TRUE); LowerDefenseStageTarget(pokemon, target, index, 1, 1, TRUE); return TRUE; @@ -962,9 +938,9 @@ bool8 AncientPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 pa { entityInfo = GetEntInfo(pokemon); RaiseMovementSpeedTarget(pokemon, pokemon, 0, TRUE); - index1 = gUnknown_8106A4C[0]; + index1 = gStatIndexAtkDef; RaiseAttackStageTarget(pokemon, pokemon, index1, 1); - index2 = gUnknown_8106A50[0]; + index2 = gStatIndexSpecial; RaiseAttackStageTarget(pokemon, pokemon, index2, 1); RaiseDefenseStageTarget(pokemon, pokemon, index1, 1); RaiseDefenseStageTarget(pokemon, pokemon, index2, 1); @@ -1008,8 +984,15 @@ bool8 SureShotMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ bool8 CosmicPowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A4C[0], 1); - RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A50[0], 1); + RaiseDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 1); + RaiseDefenseStageTarget(pokemon, target, gStatIndexSpecial, 1); return TRUE; } +// Put all the way below for matching. +const s32 gStatIndexAtkDef = 0; +const s32 gStatIndexSpecial = 1; + +static const s24_8 sRolloutModifiers[] = { + IntToF248_2(1.0), IntToF248_2(1.0), IntToF248_2(1.5), IntToF248_2(2.0), IntToF248_2(2.5), IntToF248_2(3.0), IntToF248_2(3.5), IntToF248_2(4.0), IntToF248_2(4.5), IntToF248_2(5.0) +}; diff --git a/src/move_orb_actions_2.c b/src/move_orb_actions_2.c index 8012f9143..83fa74473 100644 --- a/src/move_orb_actions_2.c +++ b/src/move_orb_actions_2.c @@ -3,10 +3,9 @@ #include "move_orb_actions_2.h" #include "dungeon_move_util.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_806CD90.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/status.h" @@ -20,11 +19,12 @@ #include "dungeon_random.h" #include "dungeon_util.h" #include "dungeon_move.h" +#include "dungeon_misc.h" #include "move_effects_target.h" #include "moves.h" #include "number_util.h" #include "pokemon.h" -#include "move_orb_actions_4.h" +#include "move_orb_actions_1.h" #include "status.h" #include "structs/dungeon_entity.h" #include "structs/map.h" @@ -34,14 +34,10 @@ #include "dungeon_misc.h" #include "dungeon_strings.h" #include "dungeon_damage.h" +#include "warp_target.h" +#include "explosion.h" -extern void EndAbilityImmuneStatus(Entity *, Entity *); -extern void HandleExplosion(Entity *pokemon, Entity *target, DungeonPos *pos, u32, u8 moveType, s16); extern void nullsub_92(Entity *); -extern u8 sub_807EAA0(u32, u32); - -extern u32 gUnknown_8106A4C; -extern u32 gUnknown_8106A50; bool8 SkyAttackMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { @@ -90,7 +86,7 @@ bool8 MeteorMashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para if(sub_805727C(pokemon, pokemon, gMeteorMashSecondaryChance)) { entityInfo = GetEntInfo(pokemon); - RaiseAttackStageTarget(pokemon, pokemon, gUnknown_8106A4C, 1); + RaiseAttackStageTarget(pokemon, pokemon, gStatIndexAtkDef, 1); SetExpMultplier(entityInfo); } } @@ -164,7 +160,7 @@ bool8 PsychoBoostMoveAction(Entity *pokemon, Entity *target, Move *move, s32 par flag = TRUE; if(RollSecondaryEffect(pokemon, 0)) { - LowerAttackStageTarget(pokemon, pokemon, gUnknown_8106A50, 2, 0, FALSE); + LowerAttackStageTarget(pokemon, pokemon, gStatIndexSpecial, 2, 0, FALSE); } } return flag; @@ -542,7 +538,7 @@ bool8 SandstormMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param bool8 sub_8059528(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - LowerAccuracyStageTarget(pokemon, target, gUnknown_8106A4C, TRUE); + LowerAccuracyStageTarget(pokemon, target, gStatIndexAtkDef, TRUE); return TRUE; } @@ -563,7 +559,7 @@ bool8 SmogMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) bool8 GrowthMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - RaiseAttackStageTarget(pokemon, target, gUnknown_8106A50, 1); + RaiseAttackStageTarget(pokemon, target, gStatIndexSpecial, 1); return TRUE; } @@ -682,7 +678,7 @@ bool8 MuddyWaterMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para flag = TRUE; if(sub_805727C(pokemon, target, gMuddyWaterAccLowerChance)) { - LowerAccuracyStageTarget(pokemon, target, gUnknown_8106A4C, FALSE); + LowerAccuracyStageTarget(pokemon, target, gStatIndexAtkDef, FALSE); } } return flag; @@ -742,7 +738,7 @@ bool8 sub_80599EC(Entity *pokemon, Entity *target, Move *move, s32 param_4) bool8 MinimizeMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - RaiseAccuracyStageTarget(pokemon, target, gUnknown_8106A50); + RaiseAccuracyStageTarget(pokemon, target, gStatIndexSpecial); return TRUE; } @@ -794,7 +790,7 @@ bool8 HornDrillMoveAction(Entity * pokemon,Entity * target,Move * move,s32 param bool8 SwordsDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C, 2); + RaiseAttackStageTarget(pokemon, target, gStatIndexAtkDef, 2); return TRUE; } @@ -857,8 +853,8 @@ bool8 HelpingHandMoveAction(Entity *pokemon, Entity *target, Move *move, s32 par TryDisplayDungeonLoggableMessage3(target, target, gUnknown_80FEB60); } else { - RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C, 1); - RaiseAttackStageTarget(pokemon, target, gUnknown_8106A50, 1); + RaiseAttackStageTarget(pokemon, target, gStatIndexAtkDef, 1); + RaiseAttackStageTarget(pokemon, target, gStatIndexSpecial, 1); flag = TRUE; } return flag; @@ -866,7 +862,7 @@ bool8 HelpingHandMoveAction(Entity *pokemon, Entity *target, Move *move, s32 par bool8 sub_8059CD8(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 2); + RaiseDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 2); return TRUE; } diff --git a/src/move_orb_actions_3.c b/src/move_orb_actions_3.c index ebc84f59b..6f59d2c79 100644 --- a/src/move_orb_actions_3.c +++ b/src/move_orb_actions_3.c @@ -2,10 +2,9 @@ #include "globaldata.h" #include "dungeon_vram.h" #include "move_orb_actions_3.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_806CD90.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/move_id.h" @@ -33,6 +32,7 @@ #include "pokemon.h" #include "status.h" #include "move_orb_actions_4.h" +#include "move_orb_actions_1.h" #include "structs/dungeon_entity.h" #include "structs/map.h" #include "dungeon_damage.h" @@ -41,18 +41,11 @@ #include "weather.h" #include "dungeon_pos_data.h" #include "dungeon_engine.h" +#include "dungeon_kecleon_shop.h" +#include "blow_away.h" +#include "warp_target.h" -extern void sub_807EC28(bool8); static void sub_805A7D4(Entity *, Entity *, Item *, DungeonPos *); -extern void MudWaterSportEffect(u32); -extern void sub_806A6E8(Entity *); - -extern void HandleExplosion(Entity *pokemon, Entity *target, DungeonPos *pos, u32, u8 moveType, s16); -extern void nullsub_92(Entity *); -extern u8 sub_807EAA0(u32, u32); - -extern u32 gUnknown_8106A4C; -extern u32 gUnknown_8106A50; bool8 PoisonStingMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { @@ -263,7 +256,7 @@ bool8 MudSlapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 flag = TRUE; if(sub_805727C(pokemon, target, 0)) { - LowerAccuracyStageTarget(pokemon, target, gUnknown_8106A4C, FALSE); + LowerAccuracyStageTarget(pokemon, target, gStatIndexAtkDef, FALSE); } } return flag; @@ -276,13 +269,13 @@ bool8 ThiefMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) bool8 AmnesiaMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A50, 2); + RaiseDefenseStageTarget(pokemon, target, gStatIndexSpecial, 2); return TRUE; } bool8 GrowlMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - LowerAttackStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, TRUE); + LowerAttackStageTarget(pokemon, target, gStatIndexAtkDef, 1, 1, TRUE); return TRUE; } @@ -339,7 +332,7 @@ bool8 SunnyDayMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_ bool8 LeerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - LowerDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, TRUE); + LowerDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 1, 1, TRUE); return TRUE; } @@ -447,7 +440,7 @@ bool8 SuperpowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 para if (HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,pokemon,0) != 0) { - stat = gUnknown_8106A4C; + stat = gStatIndexAtkDef; LowerAttackStageTarget(pokemon,pokemon,stat,1,0,FALSE); LowerDefenseStageTarget(pokemon,pokemon,stat,1,0,FALSE); } @@ -678,7 +671,7 @@ bool8 BellyDrumMoveAction(Entity * pokemon,Entity * target, Move *move, s32 para info = GetEntInfo(pokemon); flag = FALSE; if (FixedPointToInt(info->belly) > 1) { - RaiseAttackStageTarget(pokemon,target,gUnknown_8106A4C,99); + RaiseAttackStageTarget(pokemon,target,gStatIndexAtkDef,99); info->belly = IntToFixedPoint(1); flag = TRUE; } @@ -714,13 +707,13 @@ bool8 SecretPowerMoveAction(Entity * pokemon, Entity * target, Move *move, s32 p LowerMovementSpeedTarget(pokemon,target,1,FALSE); break; case 3: - LowerAttackStageTarget(pokemon,target,gUnknown_8106A4C,1,1,FALSE); + LowerAttackStageTarget(pokemon,target,gStatIndexAtkDef,1,1,FALSE); break; case 4: - LowerDefenseStageTarget(pokemon,target,gUnknown_8106A4C,1,1,FALSE); + LowerDefenseStageTarget(pokemon,target,gStatIndexAtkDef,1,1,FALSE); break; case 5: - LowerAccuracyStageTarget(pokemon,target,gUnknown_8106A4C,FALSE); + LowerAccuracyStageTarget(pokemon,target,gStatIndexAtkDef,FALSE); break; case 6: ConfuseStatusTarget(pokemon,target,FALSE); @@ -754,7 +747,7 @@ bool8 sub_805AC90(Entity * pokemon, Entity * target, Move *move, s32 param_4) bool8 BulkUpMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - s32 stat = gUnknown_8106A4C; + s32 stat = gStatIndexAtkDef; RaiseAttackStageTarget(pokemon, target, stat, 1); RaiseDefenseStageTarget(pokemon, target, stat, 1); return TRUE; @@ -768,7 +761,7 @@ bool8 ObserverOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4 bool8 FeatherDanceMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - LowerAttackStageTarget(pokemon, target, gUnknown_8106A4C, 2, 1, TRUE); + LowerAttackStageTarget(pokemon, target, gStatIndexAtkDef, 2, 1, TRUE); return TRUE; } @@ -827,7 +820,7 @@ bool8 CrushClawMoveAction(Entity * pokemon, Entity * target, Move *move, s32 par if ( HandleDamagingMove(pokemon, target, move, IntToF248_2(1), param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gCrushClawSecondaryChance) != 0) { - LowerDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, FALSE); + LowerDefenseStageTarget(pokemon, target, gStatIndexAtkDef, 1, 1, FALSE); } } return flag; @@ -967,7 +960,7 @@ bool8 HandleColorChange(Entity * pokemon, Entity * target, Move *move, s32 param bool8 TailGlowMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) { - RaiseAttackStageTarget(pokemon,target,gUnknown_8106A50, 2); + RaiseAttackStageTarget(pokemon,target,gStatIndexSpecial, 2); return TRUE; } diff --git a/src/move_orb_actions_4.c b/src/move_orb_actions_4.c index d1f166475..8af091543 100644 --- a/src/move_orb_actions_4.c +++ b/src/move_orb_actions_4.c @@ -2,13 +2,13 @@ #include "globaldata.h" #include "move_orb_actions_4.h" #include "move_orb_actions_2.h" +#include "move_orb_actions_1.h" #include "dungeon_ai.h" #include "dungeon_move_util.h" #include "dungeon_message.h" #include "dungeon_move.h" #include "code_806CD90.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "dungeon_random.h" #include "constants/ability.h" #include "constants/move_id.h" @@ -36,21 +36,17 @@ #include "dungeon_config.h" #include "dungeon_strings.h" #include "dungeon_damage.h" - -extern void sub_807F43C(Entity *, Entity *); -extern void HandleOneRoomOrb(Entity *, Entity *); -extern void UpdateMinimap(void); -extern void HandleDroughtOrbAction(Entity *); -extern void HandleLuminousOrbAction(Entity *pokemon); -extern void HandleTrawlOrbAction(Entity *, Entity *); -extern void HandlePounceOrbAction(Entity *, Entity *, s32); -extern s16 GetRandomFloorMonsterId(u32); -extern bool8 sub_806AA0C(s32, u32); -extern void sub_806BB6C(Entity *, s32); -extern void HandleSwitcherOrb(Entity *, Entity *, u32); - -extern u32 gUnknown_8106A50; -extern u32 gUnknown_8106A4C; +#include "dungeon_tilemap.h" +#include "dungeon_floor_spawns.h" +#include "dungeon_mon_spawn.h" +#include "dungeon_map.h" +#include "warp_target.h" +#include "expose_trap.h" +#include "one_room_orb.h" +#include "pounce_orb.h" +#include "drought_orb.h" +#include "switcher_orb.h" +#include "trawl_orb.h" bool8 ProtectMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) { @@ -60,7 +56,7 @@ bool8 ProtectMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4 bool8 DefenseCurlMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) { - RaiseDefenseStageTarget(pokemon,target,gUnknown_8106A4C,1); + RaiseDefenseStageTarget(pokemon,target,gStatIndexAtkDef,1); return TRUE; } @@ -78,7 +74,7 @@ bool8 MistBallMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_ if (HandleDamagingMove(pokemon,target,move,IntToF248_2(1),param_4) != 0) { flag = TRUE; if (sub_805727C(pokemon,target,gMistBallSecondaryChance) != 0) { - LowerAttackStageTarget(pokemon,target,gUnknown_8106A50,1,1,0); + LowerAttackStageTarget(pokemon,target,gStatIndexSpecial,1,1,0); } } return flag; @@ -103,7 +99,7 @@ bool8 MirrorCoatMoveAction(Entity * pokemon,Entity * target,Move *move, s32 para bool8 CalmMindMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) { - u32 stat = gUnknown_8106A50; + u32 stat = gStatIndexSpecial; RaiseAttackStageTarget(pokemon,target,stat,1); RaiseDefenseStageTarget(pokemon,target,stat,1); return TRUE; @@ -307,7 +303,7 @@ bool8 DragonRageMoveAction(Entity * pokemon, Entity * target, Move *move, s32 pa bool8 DragonDanceMoveAction( Entity * pokemon, Entity * target, Move *move, s32 param_4) { - RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C, 1); + RaiseAttackStageTarget(pokemon, target, gStatIndexAtkDef, 1); RaiseMovementSpeedTarget(pokemon, target, 0, TRUE); return TRUE; } @@ -336,7 +332,7 @@ bool8 LusterPurgeMoveAction(Entity * pokemon, Entity * target, Move * move, s32 flag = TRUE; if(sub_805727C(pokemon, target, gLusterPurgeSecondaryChance)) { - LowerDefenseStageTarget(pokemon, target, gUnknown_8106A50, 1, 1, 0); + LowerDefenseStageTarget(pokemon, target, gStatIndexSpecial, 1, 1, 0); } } return flag; @@ -453,7 +449,7 @@ bool8 ReboundOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_ bool8 SwitcherOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) { SetExpMultplier(GetEntInfo(pokemon)); - HandleSwitcherOrb(pokemon, target, 1); + HandleSwitcherOrb(pokemon, target, TRUE); return TRUE; } @@ -590,7 +586,7 @@ bool8 TransferOrbAction(Entity *pokemon, Entity * target, Move *move, s32 param_ else { CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[1], targetID); TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FD434); - sub_806BB6C(target, targetID); + UpdateEntitySpecies(target, targetID); didTransfer = TRUE; } } @@ -622,13 +618,13 @@ bool8 PetrifyOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_ bool8 PounceOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) { - HandlePounceOrbAction(pokemon, target, 8); + HandlePounceOrb(pokemon, target, 8); return TRUE; } bool8 TrawlOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) { - HandleTrawlOrbAction(pokemon, target); + HandleTrawlOrb(pokemon, target); return TRUE; } @@ -648,7 +644,7 @@ bool8 EscapeOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4 bool8 DroughtOrbAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) { - HandleDroughtOrbAction(pokemon); + HandleDroughtOrb(pokemon, target); return TRUE; } diff --git a/src/move_orb_actions_5.c b/src/move_orb_actions_5.c index 31df6cde3..dfbed442d 100644 --- a/src/move_orb_actions_5.c +++ b/src/move_orb_actions_5.c @@ -14,9 +14,9 @@ #include "code_806CD90.h" #include "status.h" #include "dungeon_pos_data.h" +#include "dungeon_floor_spawns.h" +#include "hurl_orb.h" -extern void sub_807F43C(Entity *, Entity *); -extern u32 GetRandomFloorItem(u32); extern void sub_807FC3C(DungeonPos *, u32, u32); extern void sub_8042A54(DungeonPos *); extern void sub_8042A64(DungeonPos *); @@ -101,7 +101,7 @@ bool8 ItemizeOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) bool8 HurlOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { - sub_807F43C(pokemon, target); + HandleHurlOrb(pokemon, target); return TRUE; } diff --git a/src/move_orb_effects_1.c b/src/move_orb_effects_1.c index e00dd2edc..ef6317dab 100644 --- a/src/move_orb_effects_1.c +++ b/src/move_orb_effects_1.c @@ -18,11 +18,10 @@ #include "dungeon_ai_items.h" #include "dungeon_ai_movement.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_map_access.h" #include "dungeon_logic.h" #include "dungeon_random.h" -#include "dungeon_util_1.h" #include "dungeon_util.h" #include "pokemon.h" #include "status_checks.h" @@ -34,6 +33,7 @@ #include "status.h" #include "dungeon_vram.h" #include "dungeon_pos_data.h" +#include "dungeon_data.h" extern void sub_80420A0(Entity *); extern void sub_8041C58(Entity *r0); diff --git a/src/move_orb_effects_2.c b/src/move_orb_effects_2.c index cbceea9bf..d1af8cfe6 100644 --- a/src/move_orb_effects_2.c +++ b/src/move_orb_effects_2.c @@ -24,17 +24,17 @@ #include "dungeon_strings.h" #include "dungeon_random.h" #include "dungeon_misc.h" -#include "dungeon_spawns.h" +#include "dungeon_floor_spawns.h" +#include "dungeon_tilemap.h" #include "pokemon_3.h" - -extern u32 gUnknown_8106A4C; +#include "move_orb_actions_1.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 u8 GetFloorType(void); extern void sub_8041CDC(Entity *pokemon); extern void sub_8041CEC(Entity *pokemon); extern void nullsub_73(Entity *); @@ -53,9 +53,7 @@ extern void nullsub_85(Entity *); extern void UpdateMinimap(); extern void EntityUpdateStatusSprites(Entity *); extern void sub_8042A74(Entity *r0); -extern void sub_807EC28(bool8); extern void DealDamageToEntity(Entity *, s16, u32, u32); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_80420C8(Entity *r0); extern void nullsub_68(Entity *); extern void nullsub_67(Entity *); @@ -79,7 +77,6 @@ extern void sub_8041E74(Entity *); extern void sub_8041E60(Entity *); extern void sub_8041E4C(Entity *); extern void sub_8041E3C(Entity *); -extern void UpdateCamera(u32); extern void sub_8041E1C(Entity *); extern void nullsub_89(Entity *); extern void nullsub_88(Entity *); @@ -87,14 +84,10 @@ 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 bool8 sub_806AA0C(s32, u32); -extern void UpdateCamera(u32); -extern void UpdateMinimap(void); extern void sub_8041D9C(Entity *); extern void sub_8041DB0(Entity *pokemon); extern void sub_8041CA8(Entity *); extern void sub_8041C94(Entity *); -extern void sub_803ED30(s32, Entity *r0, u8, s32); extern void sub_8041BF8(Entity *); extern void sub_8041BE8(Entity *); extern void EntityUpdateStatusSprites(Entity *); @@ -562,7 +555,6 @@ void sub_80783C4(Entity * pokemon, Entity * target, bool8 param_3) void CurseStatusTarget(Entity *pokemon, Entity * target) { - u32 statStage; s32 HP; EntityInfo * pokemonEntityData; EntityInfo * targetEntityInfo; @@ -591,9 +583,8 @@ void CurseStatusTarget(Entity *pokemon, Entity * target) TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FB004); } else { - statStage = gUnknown_8106A4C; - RaiseAttackStageTarget(pokemon,pokemon,statStage,1); - RaiseDefenseStageTarget(pokemon,pokemon,statStage,1); + RaiseAttackStageTarget(pokemon,pokemon,gStatIndexAtkDef,1); + RaiseDefenseStageTarget(pokemon,pokemon,gStatIndexAtkDef,1); LowerMovementSpeedTarget(pokemon,pokemon,1,TRUE); } EntityUpdateStatusSprites(target); diff --git a/src/move_orb_effects_3.c b/src/move_orb_effects_3.c index 899aa1ad9..a5198718a 100644 --- a/src/move_orb_effects_3.c +++ b/src/move_orb_effects_3.c @@ -23,7 +23,6 @@ #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" #include "dungeon_map_access.h" -#include "structs/str_806B7F8.h" #include "dungeon_config.h" #include "dungeon_strings.h" #include "dungeon_pos_data.h" diff --git a/src/move_orb_effects_4.c b/src/move_orb_effects_4.c index fac477089..7adac81c6 100644 --- a/src/move_orb_effects_4.c +++ b/src/move_orb_effects_4.c @@ -23,18 +23,15 @@ #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" #include "dungeon_map_access.h" -#include "structs/str_806B7F8.h" #include "dungeon_config.h" #include "dungeon_strings.h" extern void UpdateMinimap(); extern void EntityUpdateStatusSprites(Entity *); extern void sub_8042A74(Entity *r0); -extern void sub_807EC28(bool8); extern s32 GetMonsterApparentID(Entity *param_1, s16 param_2); extern void sub_806A898(Entity *, u32, u32); extern void HealTargetHP(Entity *pokemon, Entity *r1, s16, s16, u32); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_80420C8(Entity *r0); extern void nullsub_68(Entity *); extern void nullsub_67(Entity *); @@ -58,14 +55,12 @@ extern void sub_8041E74(Entity *); extern void sub_8041E60(Entity *); extern void sub_8041E4C(Entity *); extern void sub_8041E3C(Entity *); -extern void UpdateCamera(u32); 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 bool8 sub_806AA0C(s32, u32); 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 1f9a824ef..4579d9c25 100644 --- a/src/move_orb_effects_5.c +++ b/src/move_orb_effects_5.c @@ -22,21 +22,20 @@ #include "structs/dungeon_entity.h" #include "structs/str_dungeon.h" #include "dungeon_map_access.h" -#include "structs/str_806B7F8.h" #include "dungeon_config.h" #include "dungeon_logic.h" #include "dungeon_strings.h" #include "dungeon_pos_data.h" #include "dungeon_damage.h" +#include "dungeon_mon_spawn.h" +#include "dungeon_kecleon_shop.h" extern void UpdateMinimap(); extern void EntityUpdateStatusSprites(Entity *); extern void sub_8042A74(Entity *r0); -extern void sub_807EC28(bool8); extern s32 GetMonsterApparentID(Entity *param_1, s16 param_2); extern void sub_806A898(Entity *, u32, u32); extern void HealTargetHP(Entity *pokemon, Entity *r1, s16, s16, u32); -extern void ResetMonEntityData(EntityInfo *, u32); extern void sub_80420C8(Entity *r0); extern void nullsub_68(Entity *); extern void nullsub_67(Entity *); @@ -60,14 +59,12 @@ extern void sub_8041E74(Entity *); extern void sub_8041E60(Entity *); extern void sub_8041E4C(Entity *); extern void sub_8041E3C(Entity *); -extern void UpdateCamera(u32); 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 bool8 sub_806AA0C(s32, u32); 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 3853ac850..96ad43912 100644 --- a/src/one_room_orb.c +++ b/src/one_room_orb.c @@ -1,11 +1,11 @@ #include "global.h" #include "globaldata.h" +#include "one_room_orb.h" #include "constants/ability.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "structs/str_dungeon.h" #include "code_8077274_1.h" #include "dungeon_ai.h" @@ -25,6 +25,7 @@ #include "dungeon_misc.h" #include "dungeon_items.h" #include "dungeon_strings.h" +#include "warp_target.h" void HandleOneRoomOrb(Entity *pokemon, Entity *target) { diff --git a/src/party_list_menu.c b/src/party_list_menu.c index 3992382ad..1a26d31e3 100644 --- a/src/party_list_menu.c +++ b/src/party_list_menu.c @@ -34,14 +34,12 @@ static EWRAM_INIT unkStruct_203B2B8 *sUnknown_203B2B8 = {NULL}; extern u32 sub_8026F04(Pokemon *); bool8 CanTakePokemonHeldItem(Pokemon *r0); -extern bool8 sub_808D750(s16 index_); bool8 sub_8026E88(Pokemon *r0); bool8 sub_8026EB8(Pokemon *r0); void sub_8026E08(u32 r0); void sub_8026DAC(u32 r0, BulkItem *item); void sub_8026FA4(void); void PartyListMenu_BuildYesNoMenu(void); -extern void sub_808D31C(Pokemon *); void PartyListMenu_CreateMenu2(void); void PartyListMenu_CreateMenu1(void); diff --git a/src/pokemon.c b/src/pokemon.c index e50245abd..a03de37e4 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "pokemon.h" #include "constants/colors.h" #include "constants/monster.h" #include "constants/tactic.h" @@ -12,18 +13,19 @@ #include "file_system.h" #include "friend_area.h" #include "moves.h" -#include "pokemon.h" #include "pokemon_3.h" #include "sprite.h" #include "text_util.h" +#include "dungeon_data.h" +#include "strings.h" -static EWRAM_DATA MonsterDataEntry *gMonsterParameters = {NULL}; // B=02135090 -static EWRAM_DATA OpenedFile *gMonsterParametersFile = {NULL}; -static EWRAM_DATA SpriteOAM gShadowSprites[3] = {0}; -static EWRAM_DATA RecruitedMon gRecruitedPokemon = {0}; // B=02135560 -static EWRAM_DATA u16 gLevelCurrentPokeId = {0}; +static EWRAM_DATA MonsterDataEntry *sMonsterParameters = {NULL}; // B=02135090 +static EWRAM_DATA OpenedFile *sMonsterParametersFile = {NULL}; +static EWRAM_DATA SpriteOAM sShadowSprites[3] = {0}; +static EWRAM_DATA RecruitedMon sRecruitedPokemon = {0}; // B=02135560 +static EWRAM_DATA s16 sLevelCurrentPokeId = {0}; UNUSED static EWRAM_DATA u16 unused_data[3] = {0}; -static EWRAM_DATA LevelData gLevelCurrentData[0x64] = {0}; +static EWRAM_DATA LevelData sLevelCurrentData[0x64] = {0}; // TODO: Add MAX_LEVEL define EWRAM_INIT RecruitedMon *gRecruitedPokemonRef = {NULL}; // B=020EAF94 @@ -33,28 +35,20 @@ struct unkStruct_8107654 s32 unk4; }; -extern s16 gFrenzyPlantIQReq; // 0x14d -extern s16 gHydroCannonIQReq; // 0x14d -extern s16 gBlastBurnIQReq; // 0x14d -extern s16 gVoltTackleIQReq; // 0x14d -extern char* gFormattedStatusNames[]; - -extern void DungeonMonToPokemon(Pokemon*, DungeonMon*); - // arm9.bin::0205C34C void LoadMonsterParameters(void) { - gRecruitedPokemonRef = &gRecruitedPokemon; - gMonsterParametersFile = OpenFileAndGetFileDataPtr("monspara", &gSystemFileArchive); - gMonsterParameters = (MonsterDataEntry *)gMonsterParametersFile->data; - gLevelCurrentPokeId = 0; + gRecruitedPokemonRef = &sRecruitedPokemon; + sMonsterParametersFile = OpenFileAndGetFileDataPtr("monspara", &gSystemFileArchive); + sMonsterParameters = (MonsterDataEntry *)sMonsterParametersFile->data; + sLevelCurrentPokeId = 0; // More in blue } // arm9.bin::0205C340 RecruitedMon *GetRecruitedPokemon(void) { - return &gRecruitedPokemon; + return &sRecruitedPokemon; } // arm9.bin::0205C2A4 @@ -120,7 +114,7 @@ void sub_808CE74(s16 _species, bool32 _isLeader, u8* name) pokemon.name[j] = name[j]; } } - friendArea = gMonsterParameters[species].friendArea; + friendArea = sMonsterParameters[species].friendArea; for (i = 0; i < NUM_MONSTERS; i++) { if (!PokemonExists(&gRecruitedPokemonRef->pokemon[i])) { u8 speciesFriendArea = sub_80923D4(i); @@ -241,7 +235,7 @@ Pokemon *TryAddPokemonToRecruited(Pokemon *pokemon) { s32 i; s32 species = pokemon->speciesNum; - u32 friendArea = gMonsterParameters[species].friendArea; + u32 friendArea = sMonsterParameters[species].friendArea; if (!gFriendAreas[friendArea]) return NULL; @@ -263,7 +257,7 @@ Pokemon *sub_808D278(s32 species) { s32 i; s16 species_s16 = (s16)species; - u32 friendArea = gMonsterParameters[species_s16].friendArea; + u32 friendArea = sMonsterParameters[species_s16].friendArea; if (!gFriendAreas[friendArea]) return NULL; @@ -520,7 +514,7 @@ s32 sub_808D6A4(s32 *ptr) return count; } -bool8 sub_808D6E8() +UNUSED static bool8 sub_808D6E8(void) { s32 i; s32 count = 0; @@ -538,48 +532,51 @@ bool8 sub_808D6E8() return 0; } - bool8 sub_808D750(s32 index_) - { - Pokemon* pokemon; - s32 i; - s32 index = (s16) index_; - s32 count = 0; - s32 size_count = 0; +bool8 sub_808D750(s32 index_) +{ + Pokemon* pokemon; + s32 i; + s32 index = (s16) index_; + s32 count = 0; + s32 size_count = 0; - for (i = 0; i < NUM_MONSTERS; i++) { - pokemon = &gRecruitedPokemonRef->pokemon[i]; - if (PokemonExists(pokemon) && PokemonFlag2(pokemon)) { - size_count += GetBodySize(pokemon->speciesNum); - count++; - } - } - - if (count < 4) { - pokemon = &gRecruitedPokemonRef->pokemon[index]; + for (i = 0; i < NUM_MONSTERS; i++) { + pokemon = &gRecruitedPokemonRef->pokemon[i]; + if (PokemonExists(pokemon) && PokemonFlag2(pokemon)) { size_count += GetBodySize(pokemon->speciesNum); - if (size_count < 7) { - return TRUE; - } + count++; } - - return FALSE; } -void PeekPokemonItem(s16 index_, BulkItem* item) { + if (count < MAX_TEAM_MEMBERS) { + pokemon = &gRecruitedPokemonRef->pokemon[index]; + size_count += GetBodySize(pokemon->speciesNum); + if (size_count <= MAX_TEAM_BODY_SIZE) { + return TRUE; + } + } + + return FALSE; +} + +void PeekPokemonItem(s16 index_, BulkItem* item) +{ s32 index = index_; Pokemon* pokemon = &gRecruitedPokemonRef->pokemon[index]; item->id = pokemon->heldItem.id; item->quantity = pokemon->heldItem.quantity; } -void GivePokemonItem(s16 index_, BulkItem* item) { +void GivePokemonItem(s16 index_, BulkItem* item) +{ s32 index = index_; Pokemon* pokemon = &gRecruitedPokemonRef->pokemon[index]; pokemon->heldItem.id = item->id; pokemon->heldItem.quantity = item->quantity; } -bool8 IsPokemonRenamed(Pokemon* pokemon) { +bool8 IsPokemonRenamed(Pokemon* pokemon) +{ char species_name[20]; char* species = GetMonSpecies(pokemon->speciesNum); s32 i; @@ -621,20 +618,20 @@ bool8 ComparePokemonNames(s16 a1, s16 a2) void CopyMonsterNameToBuffer(u8 * buffer, s32 index) { s16 index_s16 = index; - strncpy(buffer, gMonsterParameters[index_s16].species, 0x14); + strncpy(buffer, sMonsterParameters[index_s16].species, 0x14); } // arm9.bin::0205B274 void CopyYellowMonsterNametoBuffer(u8 *buffer, s16 index) { s32 new_index = index; - sprintfStatic(buffer, _("{color YELLOW_RAW}%s{reset}"), gMonsterParameters[new_index].species); + sprintfStatic(buffer, _("{color YELLOW_RAW}%s{reset}"), sMonsterParameters[new_index].species); } void CopyCyanMonsterNametoBuffer(u8 *buffer, s32 index_) { s32 index = (s16) index_; - sprintfStatic(buffer, _("{color CYAN_RAW}%s{reset}"), gMonsterParameters[index].species); + sprintfStatic(buffer, _("{color CYAN_RAW}%s{reset}"), sMonsterParameters[index].species); } void sub_808D930(u8 *buffer, s32 index) @@ -646,13 +643,13 @@ void sub_808D930(u8 *buffer, s32 index) sprintfStatic(buffer,"%s%c",GetMonSpecies(MONSTER_UNOWN),unownLetters[GetUnownIndex(index_s16)]); } else { - sprintfStatic(buffer,"%s", gMonsterParameters[index_s16].species); + sprintfStatic(buffer,"%s", sMonsterParameters[index_s16].species); } } char * GetMonSpecies(s16 index) { - return gMonsterParameters[index].species; + return sMonsterParameters[index].species; } void PrintColoredPokeNameToBuffer(u8 *buffer, Pokemon *pokemon, s32 colorNum) @@ -723,132 +720,131 @@ bool8 sub_808DA44(s32 _species, u32 a2_) u8 *GetCategoryString(s16 index) { - return gMonsterParameters[index].category; + return sMonsterParameters[index].category; } u8 GetBodySize(s32 index) { s16 index_s16 = index; - return gMonsterParameters[index_s16].bodySize; + return sMonsterParameters[index_s16].bodySize; } u8 GetShadowSize(s16 index) { - return gMonsterParameters[index].shadowSize; + return sMonsterParameters[index].shadowSize; } s32 GetMovementSpeed(s16 index) { - return gMonsterParameters[index].movementSpeed; + return sMonsterParameters[index].movementSpeed; } u8 GetMovementType(s16 index) { - return gMonsterParameters[index].movementType; + return sMonsterParameters[index].movementType; } u8 GetRegenSpeed(s16 index) { - return ((u8)(gMonsterParameters[index].regenSpeed) << 25) >> 24; + return ((u8)(sMonsterParameters[index].regenSpeed) << 25) >> 24; } bool8 GetCanMoveFlag(s16 index) { - return gMonsterParameters[index].canMove; + return sMonsterParameters[index].canMove; } u8 GetChanceAsleep(s16 index) { - return gMonsterParameters[index].chanceAsleep; + return sMonsterParameters[index].chanceAsleep; } u32 GetWeight(s16 index) { - return gMonsterParameters[index].weight; + return sMonsterParameters[index].weight; } u32 GetSize(s16 index) { - return gMonsterParameters[index].size; + return sMonsterParameters[index].size; } u8 GetFriendArea(s32 index) { s16 index_s32 = index; - return gMonsterParameters[index_s32].friendArea; + return sMonsterParameters[index_s32].friendArea; } s32 GetBaseHP(s32 index) { s16 index_s32 = index; - return gMonsterParameters[index_s32].baseHP; + return sMonsterParameters[index_s32].baseHP; } bool8 MonsterIDCanThrowItems(s16 index) { - return gMonsterParameters[index].canThrowItems; + return sMonsterParameters[index].canThrowItems; } u8 GetUnk12(s16 index) { - return gMonsterParameters[index].unk12; + return sMonsterParameters[index].unk12; } s32 GetPokemonEvolveFrom(s32 index) { s16 index_s16 = index; - return gMonsterParameters[index_s16].preEvolution.evolveFrom; + return sMonsterParameters[index_s16].preEvolution.evolveFrom; } s32 GetBaseOffensiveStat(s32 index, u32 r1) { s16 index_s16 = index; - return gMonsterParameters[index_s16].baseAtkSpAtk[r1]; + return sMonsterParameters[index_s16].baseAtkSpAtk[r1]; } s32 GetBaseDefensiveStat(s32 index, u32 r1) { s16 index_s16 = index; - return gMonsterParameters[index_s16].baseDefSpDef[r1]; + return sMonsterParameters[index_s16].baseDefSpDef[r1]; } // arm9.bin::0205AE2C u8 GetPokemonType(s32 index, u32 typeIndex) { s16 newIndex = index; - return gMonsterParameters[newIndex].types[typeIndex]; + return sMonsterParameters[newIndex].types[typeIndex]; } u8 GetPokemonAbility(s16 index, u32 abilityIndex) { - return gMonsterParameters[index].abilities[abilityIndex]; + return sMonsterParameters[index].abilities[abilityIndex]; } s16 GetDexInternalNo(s32 index, u32 r1) { s16 index_s16 = index; - return gMonsterParameters[index_s16].dexInternal[r1]; + return sMonsterParameters[index_s16].dexInternal[r1]; } s16 GetRecruitRate(s16 index) { - return gMonsterParameters[index].recruitRate; + return sMonsterParameters[index].recruitRate; } s16 GetAlphabetParentNo(s16 index, s32 r1) { - return gMonsterParameters[index].alphabetParent[r1]; + return sMonsterParameters[index].alphabetParent[r1]; } - s16 GetInternalNo(s16 index) { - return gMonsterParameters[index].dexInternal[1]; + return sMonsterParameters[index].dexInternal[1]; } s32 CalculateEXPGain(s16 index, s32 level) { - s32 expYield = gMonsterParameters[index].expYield; + s32 expYield = sMonsterParameters[index].expYield; return expYield + (expYield * (level - 1)) / 10; } @@ -856,8 +852,8 @@ s16 GetPokemonEvolveConditions(s16 index, unkEvolve *r1) { PreEvolution temp2; EvolutionRequirements temp1; - temp1 = gMonsterParameters[index].evolutionRequirements; - temp2 = gMonsterParameters[index].preEvolution; + temp1 = sMonsterParameters[index].evolutionRequirements; + temp2 = sMonsterParameters[index].preEvolution; r1->preEvolution = temp2; r1->evolutionRequirements = temp1; // The return value is not used anywhere, but necessary for the function to match. @@ -873,7 +869,7 @@ u8 GetPokemonOverworldPalette(s16 index, bool32 recolorShopKecleon) } else { - return gMonsterParameters[id].overworldPalette; + return sMonsterParameters[id].overworldPalette; } } @@ -882,7 +878,7 @@ OpenedFile *OpenPokemonDialogueSpriteFile(s16 index) // Looks like this loads the dialogue sprite for the pokemon char buffer[0xC]; - if(gMonsterParameters[index].dialogueSprites == 0) + if(sMonsterParameters[index].dialogueSprites == 0) { return NULL; } @@ -897,7 +893,7 @@ OpenedFile *GetDialogueSpriteDataPtr(s32 index) char buffer[0xC]; s16 id = SpeciesId(index); - if(gMonsterParameters[id].dialogueSprites == 0) + if(sMonsterParameters[id].dialogueSprites == 0) { return NULL; } @@ -908,7 +904,7 @@ OpenedFile *GetDialogueSpriteDataPtr(s32 index) bool8 IsPokemonDialogueSpriteAvail(s16 index, s32 spriteId) { // checking to see if dialogue sprite is available?? - return (gMonsterParameters[index].dialogueSprites >> spriteId) & 1; + return (sMonsterParameters[index].dialogueSprites >> spriteId) & 1; } void RecruitedPokemonToDungeonMon(DungeonMon *dst, u32 recruitedPokemonId) @@ -1012,21 +1008,21 @@ void GetLvlUpEntry(LevelData* a1, s32 _id, s32 level) u8 buffer[12]; s32 id = SpeciesId(_id); - if ((s16)gLevelCurrentPokeId != id) + if (sLevelCurrentPokeId != id) { OpenedFile *file; - gLevelCurrentPokeId = id; + sLevelCurrentPokeId = id; sprintf(buffer, "lvmp%03d", id); file = OpenFileAndGetFileDataPtr(buffer, &gSystemFileArchive); - DecompressATFile(gLevelCurrentData, 0, file); + DecompressATFile(sLevelCurrentData, 0, file); CloseFile(file); } level -= 1; if ( level < 0 ) level = 0; - *a1 = gLevelCurrentData[level]; + *a1 = sLevelCurrentData[level]; } const u8* DecompressMoveID(const u8* src, u16* moveID) @@ -1123,7 +1119,6 @@ bool8 CanMonLearnMove(u16 moveID, s16 _species) return FALSE; } - s32 sub_808E218(unkStruct_808E218_arg* a1, Pokemon* pokemon) { s32 i; @@ -1183,7 +1178,7 @@ s32 sub_808E218(unkStruct_808E218_arg* a1, Pokemon* pokemon) return count; } -s32 GetEvolutionSequence(Pokemon* pokemon, struct EvolveStage* a2) +s32 GetEvolutionSequence(Pokemon* pokemon, EvolveStage* a2) { s32 count; s32 species; @@ -1326,7 +1321,7 @@ void InitShadowSprites(s32 param_1, s32 param_2) CloseFile(file); for (spriteIndex = 0; spriteIndex < 3; spriteIndex++) { - SpriteOAM *sprite = &gShadowSprites[spriteIndex]; + SpriteOAM *sprite = &sShadowSprites[spriteIndex]; SpriteSetAffine1(sprite, 0); SpriteSetAffine2(sprite, 0); @@ -1344,23 +1339,24 @@ void InitShadowSprites(s32 param_1, s32 param_2) } } -static const s32 gUnknown_81076C4[6] = {-4, -8, -16, -4, -8, -16}; // x-coord positioning for shadow sprites +static const s32 sShadowXPosOffsets[6] = {-4, -8, -16, -4, -8, -16}; -bool8 AddShadowSprite(s16 species, s16* a2, s16* a3) +bool8 AddShadowSprite(s32 species_, DungeonPos *shadowPos, axdata *axData) { + s16 species = (s16) (species_); if (species != MONSTER_DIGLETT && species != MONSTER_DUGTRIO) { s32 shadowSize = GetShadowSize(species); s32 x, y; - x = a2[0] + a3[8]; - y = a2[1] + a3[9]; - x += gUnknown_81076C4[shadowSize]; + x = shadowPos->x + axData->sub1.shadow.x; + y = shadowPos->y + axData->sub1.shadow.y; + x += sShadowXPosOffsets[shadowSize]; y -= 4; - SpriteSetX(&gShadowSprites[shadowSize], x); - SpriteSetY(&gShadowSprites[shadowSize], y); + SpriteSetX(&sShadowSprites[shadowSize], x); + SpriteSetY(&sShadowSprites[shadowSize], y); - AddSprite(&gShadowSprites[shadowSize], 0, NULL, NULL); + AddSprite(&sShadowSprites[shadowSize], 0, NULL, NULL); } return TRUE; diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 360a68bd9..b129787b4 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -31,16 +31,8 @@ struct UnusedOffenseStruct u8 spDefBoost; }; -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*); -extern void ReadHiddenPowerBits(DataSerializer*, HiddenPower*); -s16 GetPokemonEvolveConditions(s16 index, unkEvolve *r1); +static void ReadHiddenPowerBits(DataSerializer* a1, HiddenPower* a2); +static void WriteHiddenPowerBits(DataSerializer* a1, HiddenPower* a2); // arm9.bin::02059FDC void GenerateHiddenPower(HiddenPower* a1) @@ -782,14 +774,14 @@ void WritePoke1LevelBits(DataSerializer* a1, struct unkPokeSubStruct_C* unkC) } // arm9.bin::0205C414 -void ReadHiddenPowerBits(DataSerializer* a1, HiddenPower* a2) +static void ReadHiddenPowerBits(DataSerializer* a1, HiddenPower* a2) { ReadBits(a1, &a2->hiddenPowerBasePower, 10); ReadBits(a1, &a2->hiddenPowerType, 5); } // arm9.bin::0205C3E4 -void WriteHiddenPowerBits(DataSerializer* a1, HiddenPower* a2) +static void WriteHiddenPowerBits(DataSerializer* a1, HiddenPower* a2) { WriteBits(a1, &a2->hiddenPowerBasePower, 10); WriteBits(a1, &a2->hiddenPowerType, 5); diff --git a/src/position_util.c b/src/position_util.c index 159fc9aa7..fc87d3b9e 100644 --- a/src/position_util.c +++ b/src/position_util.c @@ -3,7 +3,7 @@ #include "constants/direction.h" -const s32 gFacingDirMapping[3][3] = { +static const s32 sFacingDirMapping[3][3] = { {DIRECTION_NORTHWEST, DIRECTION_NORTH, DIRECTION_NORTHEAST}, {DIRECTION_WEST, DIRECTION_SOUTH, DIRECTION_EAST}, {DIRECTION_SOUTHWEST, DIRECTION_SOUTH, DIRECTION_SOUTHEAST} @@ -39,7 +39,7 @@ s32 GetDirectionTowardsPosition(DungeonPos *originPos, DungeonPos *targetPos) { yDiff = -1; } - direction = gFacingDirMapping[yDiff + 1][xDiff + 1]; + direction = sFacingDirMapping[yDiff + 1][xDiff + 1]; } return direction; } diff --git a/src/pounce_orb.c b/src/pounce_orb.c index 5bcc1749c..fbeead05c 100644 --- a/src/pounce_orb.c +++ b/src/pounce_orb.c @@ -1,11 +1,11 @@ #include "global.h" #include "globaldata.h" +#include "pounce_orb.h" #include "constants/ability.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "structs/str_dungeon.h" #include "code_8077274_1.h" #include "dungeon_ai.h" @@ -26,10 +26,10 @@ #include "dungeon_items.h" #include "dungeon_strings.h" #include "dungeon_pos_data.h" +#include "dungeon_kecleon_shop.h" +#include "warp_target.h" -extern void sub_807EC28(u32); - -void HandlePounceOrbAction(Entity *pokemon, Entity *target, u8 r2) +void HandlePounceOrb(Entity *pokemon, Entity *target, u8 r2) { EntityInfo *info; const Tile *tile; @@ -80,7 +80,7 @@ void HandlePounceOrbAction(Entity *pokemon, Entity *target, u8 r2) if(info->isTeamLeader) { DiscoverMinimap(&target->pos); - sub_807EC28(0); + sub_807EC28(FALSE); } sub_806A5B8(target); diff --git a/src/run_dungeon.c b/src/run_dungeon.c index d7348549f..2fd2024f1 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -14,7 +14,7 @@ #include "effect_data.h" #include "code_803D110.h" #include "dungeon_vram.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_805D8C8.h" #include "code_8094F88.h" #include "code_8099360.h" @@ -26,7 +26,8 @@ #include "dungeon_engine.h" #include "dungeon_generation.h" #include "dungeon_items.h" -#include "dungeon_leader.h" +#include "dungeon_leveling.h" +#include "dungeon_range.h" #include "dungeon_map.h" #include "dungeon_map_access.h" #include "dungeon_message.h" @@ -34,7 +35,7 @@ #include "dungeon_misc.h" #include "dungeon_music.h" #include "dungeon_name_banner.h" -#include "dungeon_spawns.h" +#include "dungeon_floor_spawns.h" #include "dungeon_pokemon_sprites.h" #include "dungeon_random.h" #include "dungeon_strings.h" @@ -49,57 +50,33 @@ #include "text_1.h" #include "text_3.h" #include "weather.h" +#include "dungeon_data.h" +#include "dungeon_jobs.h" +#include "dungeon_tilemap.h" +#include "dungeon_cleared_window.h" +#include "dungeon_cutscene.h" +#include "dungeon_mon_spawn.h" EWRAM_INIT struct UnkStruct_203B414 *gUnknown_203B414 = NULL; EWRAM_INIT Dungeon *gDungeon = NULL; static EWRAM_INIT u8 *gSerializedData_203B41C = NULL; -extern u8 gUnknown_203B40C; - -extern void sub_8040094(u8 r0); 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); -extern void sub_803E830(void); extern void sub_8068F28(void); -extern void sub_806C1D8(void); extern void IncrementThievingSuccesses(void); -extern void ShowDungeonClearedWindow(void); -extern void sub_8084424(void); -extern void sub_8086130(void); -extern void sub_80847D4(void); extern void sub_8043D60(void); extern void sub_80840A4(void); -extern void sub_80848F0(void); extern void IncrementAdventureFloorsExplored(void); extern void sub_806AB2C(void); -extern void DisplayPreFightDialogue(void); -extern void EnemyEvolution(Entity *); -extern void sub_803E748(void); -extern void sub_8083D68(void); -extern void sub_803E7C8(void); -extern void UpdateMinimap(void); extern void sub_807E5AC(void); -extern void TryActivateArtificialWeatherAbilities(void); -extern void sub_807E88C(void); extern void nullsub_16(void); extern void sub_80521D0(void); -extern void sub_803F27C(u8); -extern void sub_807E7FC(u8); extern void sub_8068A84(Pokemon *pokemon); -extern void sub_807EAA0(u32, u32); -extern void SetFloorItemMonsterSpawns(void); -extern void sub_80842F0(void); extern void sub_80427AC(void); extern void sub_806AA70(void); -extern void sub_806AD3C(void); -extern void sub_806C42C(void); -extern void sub_806B678(void); -extern void sub_806C3C0(void); -extern void sub_806B168(void); -extern void sub_806B6C4(void); extern void ReevaluateSnatchMonster(void); extern void sub_8051E3C(void); extern void sub_807FA18(void); @@ -109,19 +86,13 @@ 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_803F4A0(Entity *a0); -extern void ResetMonEntityData(EntityInfo *, u32); -extern s32 GetMovesLearnedAtLevel(u16* dst, s16 species, s32 level, s32 IQPoints); extern void sub_8042B0C(Entity *); extern u8 gUnknown_202F32C; extern u8 gUnknown_202F1A8; -extern s32 gDungeonBrightness; -extern Entity *gLeaderPointer; void EnforceMaxItemsAndMoney(void); static void sub_8043FD0(void); -void sub_806B404(void); extern OpenedFile *gDungeonNameBannerPalette; @@ -379,7 +350,7 @@ void RunDungeon_Async(DungeonSetupStruct *setupPtr) if (!r6) { sub_806B168(); sub_806C3C0(); - sub_806B6C4(); + SpawnWildMonsOnFloor(); } else { sub_806B678(); diff --git a/src/save.c b/src/save.c index 5d42dbda5..587152a95 100644 --- a/src/save.c +++ b/src/save.c @@ -9,7 +9,7 @@ #include "friend_area.h" #include "game_options.h" #include "memory.h" -#include "pokemon.h" +#include "pokemon_3.h" #include "random.h" #include "save.h" @@ -38,10 +38,6 @@ ALIGNED(4) static const char fill_save2[] = _("pksdir0"); extern bool8 sub_800DAB0(u16, u8*, s32); extern bool8 sub_800DAB4(u16, u8*, s32); extern bool8 sub_800DAB8(void); -extern u32 SaveRecruitedPokemon(u8 *, u32); -extern u32 RestoreRecruitedPokemon(void* a, s32 b); -extern u32 SavePoke2s(u8 *, u32); -extern u32 RestorePoke2s(void* a, s32 b); extern u32 sub_80954CC(void* a, s32 b); extern u32 sub_8095624(u8 *, u32); extern u32 RestoreMailInfo(void* a, s32 b); diff --git a/src/switcher_orb.c b/src/switcher_orb.c index 02a650642..8c07c3849 100644 --- a/src/switcher_orb.c +++ b/src/switcher_orb.c @@ -1,11 +1,11 @@ #include "global.h" #include "globaldata.h" +#include "switcher_orb.h" #include "constants/ability.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "structs/str_dungeon.h" #include "code_8077274_1.h" #include "dungeon_ai.h" @@ -25,11 +25,11 @@ #include "dungeon_misc.h" #include "dungeon_items.h" #include "dungeon_strings.h" +#include "dungeon_kecleon_shop.h" -extern void sub_807EC28(bool8); extern void nullsub_93(DungeonPos *); -void HandleSwitcherOrb(Entity *pokemon,Entity *target) +void HandleSwitcherOrb(Entity *pokemon, Entity *target, bool8 unused) { DungeonPos pokemonPos; DungeonPos targetPos; diff --git a/src/textbox.c b/src/textbox.c index 6dde1907c..29baf7de5 100644 --- a/src/textbox.c +++ b/src/textbox.c @@ -46,6 +46,7 @@ #include "wigglytuff_shop3.h" #include "wonder_mail.h" #include "naming_screen.h" +#include "game_options.h" #include "script_item.h" #include "structs/menu.h" #include "structs/str_file_system.h" @@ -130,7 +131,6 @@ void sub_8096BD0(void); bool8 DrawCredits(s32 creditsCategoryIndex, s32); u32 sub_8035574(); void sub_803565C(void); -u8 sub_8094D14(void); void GroundMap_ExecuteEvent(s16, u32); bool8 sub_8015080(u8 *buffer, const MenuItem *menuItems); s32 sub_801516C(); diff --git a/src/trap.c b/src/trap.c index f78ca93fe..d426f90d8 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,11 +1,10 @@ #include "global.h" #include "globaldata.h" #include "trap.h" -#include "code_803E724.h" +#include "dungeon_tilemap.h" #include "code_8041AD0.h" #include "dungeon_message.h" #include "code_8077274_1.h" -#include "code_807CD9C.h" #include "dungeon_random.h" #include "code_806CD90.h" #include "constants/trap.h" @@ -18,26 +17,25 @@ #include "dungeon_random.h" #include "dungeon_util.h" #include "dungeon_vram.h" -#include "dungeon_spawns.h" +#include "dungeon_floor_spawns.h" #include "items.h" #include "move_effects_target.h" #include "moves.h" #include "status.h" #include "structs/map.h" #include "structs/str_dungeon.h" -#include "structs/str_806B7F8.h" #include "dungeon_config.h" #include "dungeon_misc.h" #include "dungeon_strings.h" #include "sprite.h" #include "dungeon_pos_data.h" #include "dungeon_damage.h" +#include "warp_target.h" +#include "blow_away.h" +#include "explosion.h" +#include "dungeon_mon_spawn.h" +#include "move_orb_actions_1.h" -extern u32 gUnknown_8106A4C; -extern u32 gUnknown_8106A50; -extern SpriteOAM gUnknown_202EDC0; - -bool8 sub_806AA0C(s32, s32); void sub_80421EC(DungeonPos *, u32); u8 GetFloorType(void); void sub_8045BF8(u8 *, Item *); @@ -45,7 +43,6 @@ void sub_804225C(Entity *, DungeonPos *, u8); void EnemyEvolution(Entity *); void sub_806A1E8(Entity *pokemon); Entity *sub_8045684(u8, DungeonPos *, u8); -extern void HandleExplosion(Entity *pokemon, Entity *target, DungeonPos *pos, u32, u8 moveType, s16); void sub_807FA18(void) { @@ -418,16 +415,16 @@ void HandleMudTrap(Entity *pokemon, Entity *target) rand = DungeonRandInt(100); randDef = rand; if (rand < 25) { - LowerAttackStageTarget(pokemon,target,gUnknown_8106A4C,1,1,1); + LowerAttackStageTarget(pokemon,target,gStatIndexAtkDef,1,1,1); } else if (rand < 50) { - LowerAttackStageTarget(pokemon,target,gUnknown_8106A50,1,1,1); + LowerAttackStageTarget(pokemon,target,gStatIndexSpecial,1,1,1); } else if (randDef < 75) { - LowerDefenseStageTarget(pokemon,target,gUnknown_8106A4C,1,1,1); + LowerDefenseStageTarget(pokemon,target,gStatIndexAtkDef,1,1,1); } else { - LowerDefenseStageTarget(pokemon,target,gUnknown_8106A50,1,1,1); + LowerDefenseStageTarget(pokemon,target,gStatIndexSpecial,1,1,1); } } @@ -623,7 +620,7 @@ void HandleSummonTrap(Entity *pokemon,DungeonPos *pos) u32 direction; int pokemonSummonCount; s16 species; - struct unkStruct_806B7F8 stack; + struct MonSpawnInfo stack; s32 i; @@ -648,7 +645,7 @@ void HandleSummonTrap(Entity *pokemon,DungeonPos *pos) stack.pos.y = pos->y + gAdjacentTileOffsets[direction].y; stack.unk4 = 0; stack.unk10 = 0; - if (sub_806B7F8(&stack, TRUE) != NULL) { + if (SpawnWildMon(&stack, TRUE) != NULL) { pokemonSummonCount++; } } @@ -757,7 +754,7 @@ void HandlePokemonTrap(Entity *param_1,DungeonPos *pos) { s32 x, y, roomId; s32 maxX; - struct unkStruct_806B7F8 local_50; + struct MonSpawnInfo local_50; s32 bottomX; s32 maxY; s32 bottomY; @@ -816,7 +813,7 @@ void HandlePokemonTrap(Entity *param_1,DungeonPos *pos) local_50.pos.y = y; local_50.unk4 = 0; local_50.unk10 = 0; - if (sub_806B7F8(&local_50, TRUE) != 0) { + if (SpawnWildMon(&local_50, TRUE) != 0) { RemoveGroundItem(&local_50.pos,0); counter++; } diff --git a/src/trawl_orb.c b/src/trawl_orb.c index daba3f108..7ea69db19 100644 --- a/src/trawl_orb.c +++ b/src/trawl_orb.c @@ -1,11 +1,11 @@ #include "global.h" #include "globaldata.h" +#include "trawl_orb.h" #include "constants/ability.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "structs/str_dungeon.h" #include "code_8077274_1.h" #include "dungeon_ai.h" @@ -25,11 +25,10 @@ #include "dungeon_misc.h" #include "dungeon_items.h" #include "dungeon_strings.h" +#include "dungeon_pos_data.h" +#include "dungeon_kecleon_shop.h" -extern void sub_807EC28(u32); -extern const DungeonPos gUnknown_80F4468[]; - -void HandleTrawlOrbAction(Entity *user, Entity *target) +void HandleTrawlOrb(Entity *user, Entity *target) { Entity itemEntities[25]; Item itemInfo[25]; diff --git a/src/warp_target.c b/src/warp_target.c index dc04d28d9..121a2335f 100644 --- a/src/warp_target.c +++ b/src/warp_target.c @@ -1,11 +1,11 @@ #include "global.h" #include "globaldata.h" +#include "warp_target.h" #include "constants/ability.h" #include "constants/weather.h" #include "dungeon_vram.h" #include "dungeon_message.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "structs/str_dungeon.h" #include "code_8077274_1.h" #include "dungeon_ai.h" @@ -22,21 +22,15 @@ #include "code_8041AD0.h" #include "weather.h" #include "dungeon_config.h" +#include "dungeon_tilemap.h" #include "dungeon_misc.h" #include "dungeon_items.h" #include "dungeon_strings.h" +#include "dungeon_kecleon_shop.h" +#include "dungeon_range.h" -extern u32 gDungeonFramesCounter; - -bool8 ExposeTrap(s32 x, s32 y); -void UpdateMinimap(); -void sub_807EC28(u32); -u8 IsFloorOver(void); void sub_80421AC(Entity * pokemon, Entity * target); void sub_807BB78(Entity *pokemon); -extern void UpdateCamera(u32); -bool8 sub_808384C(DungeonPos *, DungeonPos *); -u8 sub_8083660(DungeonPos *); void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos) { diff --git a/src/weather.c b/src/weather.c index a671b20dd..a4d4b1a69 100644 --- a/src/weather.c +++ b/src/weather.c @@ -9,7 +9,7 @@ #include "dungeon_vram.h" #include "dungeon_info.h" #include "dungeon_config.h" -#include "dungeon_leader.h" +#include "dungeon_range.h" #include "dungeon_music.h" #include "dungeon_util.h" #include "pokemon.h" @@ -21,7 +21,6 @@ #include "position_util.h" #include "dungeon_ai.h" #include "code_806CD90.h" -#include "code_807CD9C.h" #include "dungeon_random.h" #include "code_805D8C8.h" #include "dungeon_items.h" @@ -36,18 +35,10 @@ #include "dungeon_strings.h" extern void sub_804178C(u32); -extern void sub_803E874(bool8 r10, s32 r9); -extern s32 CalculateStatusTurns(Entity *target, const s16 *turnRange, bool8 factorCurerSkills); extern void sub_80429D8(Entity *r0); -extern void sub_80838EC(u8 *a); extern OpenedFile *gUnknown_202ECA0; -void sub_807E7FC(bool8 arg0); -void sub_807E8F0(Entity *pokemon); -void GetWeatherName(u8 *buffer, u8 weather); -bool8 sub_807EAA0(bool8 arg0, bool8 arg1); - u8 GetApparentWeather(Entity *pokemon) { if (pokemon != NULL && HasHeldItem(pokemon, ITEM_WEATHER_BAND)) @@ -94,7 +85,7 @@ void sub_807E5E4(u8 weather) } // Note: gUnknown_202ECA0 file's 2d array is read as 1d array in functions below, be careful! -void sub_807E698(bool8 arg0) +static void sub_807E698(bool8 arg0) { s32 i, j; s32 weatherArrId = GetApparentWeather(NULL) * COLOR_RAMP_COUNT; 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 = { diff --git a/sym_ewram.txt b/sym_ewram.txt index 05601ff0a..97a795918 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -52,14 +52,13 @@ .include "src/code_8066D04.o" .include "src/dungeon_8067A80.o" .include "src/dungeon_logic.o" - .include "src/code_80718D8.o" - .include "src/dungeon_8072CF4.o" + .include "src/dungeon_leveling.o" + .include "src/dungeon_action_execution.o" .include "src/dungeon_ai_items.o" - .include "src/code_8073CF0.o" .include "src/code_8075708.o" .space 4 .include "src/dungeon_ai_attack.o" - .include "src/code_80848F0.o" + .include "src/dungeon_cutscene.o" .space 4 .include "src/pokemon.o" .include "src/items.o"