remove some externs, dungeon_monster_house.c

This commit is contained in:
DizzyEggg 2025-10-06 12:44:13 +02:00
parent eac9b788aa
commit 5b9295e6cf
12 changed files with 76 additions and 81 deletions

View File

@ -49,7 +49,6 @@ void SendMuzzledEndMessage(Entity * pokemon, Entity * target);
bool8 TrySendImmobilizeSleepEndMsg(Entity *pokemon, Entity *target);
void WakeUpPokemon(Entity * pokemon);
void SendThawedMessage(Entity *pokemon, Entity *target);
void sub_807AA30(void);
void sub_8079E34(Entity * pokemon, Entity * target, bool8 param_3);
#endif // !GUARD_CODE_8077274_1_H

View File

@ -0,0 +1,9 @@
#ifndef GUARD_DUNGEON_MONSTER_HOUSE_H
#define GUARD_DUNGEON_MONSTER_HOUSE_H
#include "structs/dungeon_entity.h"
void TryWakeSleepingWildPokemon(void);
void TriggerMonsterHouse(Entity *entity, bool8 forcedMonsterHouse);
#endif // GUARD_DUNGEON_MONSTER_HOUSE_H

View File

@ -0,0 +1,8 @@
#ifndef GUARD_MOVE_ORB_EFFECTS_2_H
#define GUARD_MOVE_ORB_EFFECTS_2_H
#include "structs/dungeon_entity.h"
#endif

View File

@ -254,7 +254,7 @@ SECTIONS {
src/move_orb_effects_3.o(.text);
src/move_orb_effects_4.o(.text);
src/move_orb_effects_5.o(.text);
src/code_8077274_1.o(.text);
src/dungeon_monster_house.o(.text);
src/dungeon_ai_movement.o(.text);
src/dungeon_ai_attack.o(.text);
src/blow_away.o(.text);
@ -639,7 +639,7 @@ SECTIONS {
src/move_orb_effects_3.o(.rodata);
src/move_orb_effects_4.o(.rodata);
src/move_orb_effects_5.o(.rodata);
src/code_8077274_1.o(.rodata);
src/dungeon_monster_house.o(.rodata);
src/dungeon_ai_movement.o(.rodata);
src/dungeon_ai_attack.o(.rodata);
src/blow_away.o(.rodata);

View File

@ -43,11 +43,11 @@
#include "dungeon_kecleon_shop.h"
#include "dungeon_item_action.h"
#include "dungeon_leveling.h"
#include "dungeon_monster_house.h"
#include "warp_target.h"
extern void sub_8057588(Entity * pokemon, u8 param_2);
void sub_8042208(Entity *pokemon, u8 r1);
extern void sub_807AB38(Entity *, u32);
Entity *sub_806773C(Entity *entity);
void sub_8067558(Entity *entity, Entity *targetEntity, s32 a2);
void sub_8067794(Entity *entity, Entity *targetEntity, s32 a2);
@ -197,7 +197,7 @@ void HandleGiveItemAction(Entity *param_1)
if (!info2->isTeamLeader) {
info2->flags = info2->flags | MOVEMENT_FLAG_UNK_14;
}
sub_807AB38(param_1,gDungeon->forceMonsterHouse);
TriggerMonsterHouse(param_1,gDungeon->forceMonsterHouse);
}
}
@ -237,7 +237,7 @@ void HandleTakeItemAction(Entity *param_1)
if (!info->isTeamLeader) {
info->flags |= MOVEMENT_FLAG_UNK_14;
}
sub_807AB38(param_1,gDungeon->forceMonsterHouse);
TriggerMonsterHouse(param_1,gDungeon->forceMonsterHouse);
}
}
}
@ -281,7 +281,7 @@ void sub_8066BD4(Entity *param_1)
if (!info->isTeamLeader) {
info->flags = info->flags | MOVEMENT_FLAG_UNK_14;
}
sub_807AB38(param_1,gDungeon->forceMonsterHouse);
TriggerMonsterHouse(param_1,gDungeon->forceMonsterHouse);
}
}
@ -331,7 +331,7 @@ void HandlePlaceItemAction(Entity *entity)
PlaySoundEffect(0x14d);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8E28);
sub_807AB38(entity,gDungeon->forceMonsterHouse);
TriggerMonsterHouse(entity,gDungeon->forceMonsterHouse);
}
}
}
@ -386,7 +386,7 @@ void sub_8066E14(Entity *entity)
sub_8045BF8(gFormatBuffer_Items[1],&newItems[0]);
PlaySoundEffect(0x14d);
LogMessageByIdWithPopupCheckUser(entity,gSwappedGroundItem);
sub_807AB38(entity,gDungeon->forceMonsterHouse);
TriggerMonsterHouse(entity,gDungeon->forceMonsterHouse);
}
}
}
@ -435,7 +435,7 @@ void sub_8066FA4(Entity *entity)
FillInventoryGaps();
PlaySoundEffect(0x14d);
LogMessageByIdWithPopupCheckUser(entity,gSwappedGroundItem);
sub_807AB38(entity,gDungeon->forceMonsterHouse);
TriggerMonsterHouse(entity,gDungeon->forceMonsterHouse);
}
}
}
@ -455,7 +455,7 @@ void sub_8067110(Entity *entity)
sub_8044DF0(entity,0,0x66);
sub_803E708(0x1e,0x11);
sub_80479B8(0,0,0,entity,entity,&item2);
sub_807AB38(entity,gDungeon->forceMonsterHouse);
TriggerMonsterHouse(entity,gDungeon->forceMonsterHouse);
}
}
@ -582,7 +582,7 @@ void sub_80671A0(Entity *entity)
if (EntityIsValid(entity)) {
sub_806CE68(entity, info->action.direction);
sub_807AB38(entity,gDungeon->forceMonsterHouse);
TriggerMonsterHouse(entity,gDungeon->forceMonsterHouse);
}
}
}

View File

@ -47,6 +47,8 @@
#include "dungeon_turn_effects.h"
#include "dungeon_leveling.h"
#include "dungeon_cutscene.h"
#include "dungeon_monster_house.h"
#include "dungeon_strings.h"
#include "warp_target.h"
extern void sub_8073D14(Entity *);
@ -245,7 +247,7 @@ bool8 DisplayActions(Entity *a0)
}
}
sub_807AA30();
TryWakeSleepingWildPokemon();
for (j = 0; j < 2; j++) {
for (loop = 0; loop < DUNGEON_MAX_POKEMON; loop++) {
DungeonPos monPosBefore;
@ -508,9 +510,6 @@ error:
return 0;
}
extern char *gPtrItsaMonsterHouseMessage;
extern void sub_807AB38(Entity *, u32);
extern void sub_8041888(u32);
void sub_8075900(Entity *pokemon, u8 r1)
@ -528,7 +527,7 @@ void sub_8075900(Entity *pokemon, u8 r1)
// It's a monster house!
LogMessageByIdWithPopupCheckUser(GetLeader(), gPtrItsaMonsterHouseMessage);
gDungeon->unk644.monsterHouseTriggeredEvent = TRUE;
sub_807AB38(pokemon, r1);
TriggerMonsterHouse(pokemon, r1);
sub_8041888(0);
if(sub_803F428(&pokemon->pos))
sub_803E708(0x78, 0x39);

View File

@ -32,6 +32,8 @@
#include "dungeon_pos_data.h"
#include "dungeon_engine.h"
#include "dungeon_damage.h"
#include "dungeon_leveling.h"
#include "dungeon_items.h"
#include "dungeon_kecleon_shop.h"
#include "dungeon_strings.h"
@ -43,9 +45,6 @@ EWRAM_DATA s32 gPotentialAttackTargetWeights[NUM_DIRECTIONS] = {0};
EWRAM_DATA Entity *gPotentialTargets[NUM_DIRECTIONS] = {0};
extern void sub_806A1B0(Entity *);
extern void sub_8045BF8(u8 *, struct Item *);
extern void EnemyEvolution(struct Entity *);
extern void DiscoverMinimap(DungeonPos *);
void ChooseAIMove(Entity *pokemon)
{

View File

@ -26,7 +26,6 @@
#include "constants/dungeon.h"
#include "dungeon_engine.h"
extern void sub_8045BF8(u8 *, Item *);
extern void sub_8067110(Entity *);
extern void sub_80671A0(Entity *);

View File

@ -35,16 +35,13 @@
#include "dungeon_logic.h"
#include "dungeon_damage.h"
#include "dungeon_strings.h"
#include "dungeon_generation_fixed.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_804245C(Entity *, Item *);
extern s32 sub_8042520(Entity *);
extern void sub_8042390(Entity *, Item *);

View File

@ -51,6 +51,7 @@
#include "dungeon_cutscene.h"
#include "dungeon_mon_spawn.h"
#include "dungeon_info.h"
#include "dungeon_monster_house.h"
static void EnsureCastformLoaded(void);
static void EnsureDeoxysLoaded(void);
@ -1508,7 +1509,7 @@ void sub_806A6E8(Entity *entity)
UpdateMinimap();
}
}
sub_807AA30();
TryWakeSleepingWildPokemon();
}
if (ItemExists(&info->heldItem)) {

View File

@ -1,5 +1,6 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_monster_house.h"
#include "dungeon_vram.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
@ -31,66 +32,51 @@
extern void sub_804178C(u32);
void sub_807AA30(void)
void TryWakeSleepingWildPokemon(void)
{
bool32 adjacentCheck;
bool32 forceWakeup;
u8 room;
s32 xDiff;
s32 wildIndex;
s32 yDiff;
Entity *teamEntity;
Entity *wildEntity;
EntityInfo *entityInfo;
s32 teamIndex;
s32 wildIndex, teamIndex;
for(wildIndex = 0; wildIndex < DUNGEON_MAX_WILD_POKEMON; wildIndex++)
{
wildEntity = gDungeon->wildPokemon[wildIndex];
if (EntityIsValid(wildEntity) &&
(entityInfo = GetEntInfo(wildEntity), entityInfo->sleepClassStatus.status == STATUS_SLEEP) &&
(entityInfo->sleepClassStatus.turns == 0x7F)) {
adjacentCheck = FALSE;
forceWakeup = FALSE;
room = GetEntityRoom(wildEntity);
for (wildIndex = 0; wildIndex < DUNGEON_MAX_WILD_POKEMON; wildIndex++) {
Entity *wildEntity = gDungeon->wildPokemon[wildIndex];
if (EntityIsValid(wildEntity)) {
EntityInfo *entityInfo = GetEntInfo(wildEntity);
if (entityInfo->sleepClassStatus.status != STATUS_SLEEP)
continue;
if (entityInfo->sleepClassStatus.turns == 0x7F) {
bool8 adjacentCheck = FALSE;
bool8 wakeUp = FALSE;
u8 room = GetEntityRoom(wildEntity);
for(teamIndex = 0; teamIndex < MAX_TEAM_MEMBERS; teamIndex++)
{
teamEntity = gDungeon->teamPokemon[teamIndex];
if (EntityIsValid(teamEntity) && !HasHeldItem(teamEntity, ITEM_SNEAK_SCARF)) {
xDiff = teamEntity->pos.x - wildEntity->pos.x;
if (xDiff < 0) {
xDiff = -xDiff;
}
if (xDiff < 2) {
yDiff = teamEntity->pos.y- wildEntity->pos.y;
if (yDiff < 0) {
yDiff = -yDiff;
for (teamIndex = 0; teamIndex < MAX_TEAM_MEMBERS; teamIndex++) {
Entity *teamEntity = gDungeon->teamPokemon[teamIndex];
if (EntityIsValid(teamEntity) && !HasHeldItem(teamEntity, ITEM_SNEAK_SCARF)) {
if (abs(teamEntity->pos.x - wildEntity->pos.x) <= 1
&& abs(teamEntity->pos.y- wildEntity->pos.y) <= 1)
{
adjacentCheck = TRUE;
break;
}
else if (HasHeldItem(teamEntity, ITEM_RACKET_BAND) && room == GetEntityRoom(teamEntity)) {
wakeUp = TRUE;
break;
}
}
}
if (!wakeUp) {
if (adjacentCheck)
wakeUp = TRUE;
}
if (wakeUp) {
WakeUpPokemon(wildEntity);
}
}
if (yDiff < 2) {
adjacentCheck = TRUE;
break;
}
}
if (HasHeldItem(teamEntity, ITEM_RACKET_BAND) && (room == GetEntityRoom(teamEntity)))
goto _WakeUp;
}
}
if(forceWakeup)
goto _WakeUp;
else if(adjacentCheck)
forceWakeup = TRUE;
if (forceWakeup) {
_WakeUp:
WakeUpPokemon(wildEntity);
}
}
}
}
void sub_807AB38(Entity *entity, bool8 forcedMonsterHouse)
void TriggerMonsterHouse(Entity *entity, bool8 forcedMonsterHouse)
{
u8 monsterHouseRoomId;
DungeonPos positions[100];

View File

@ -32,6 +32,7 @@
#include "sprite.h"
#include "dungeon_pos_data.h"
#include "dungeon_damage.h"
#include "dungeon_leveling.h"
#include "warp_target.h"
#include "blow_away.h"
#include "explosion.h"
@ -39,10 +40,7 @@
#include "move_orb_actions_1.h"
void sub_80421EC(DungeonPos *, u32);
u8 GetFloorType(void);
void sub_8045BF8(u8 *, Item *);
void sub_804225C(Entity *, DungeonPos *, u8);
void EnemyEvolution(Entity *);
void sub_806A1E8(Entity *pokemon);
Entity *sub_8045684(u8, DungeonPos *, u8);