From 782e0b817bfc3b4ac5b569207c473a596a1a4e26 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 21 Oct 2025 12:39:54 +0200 Subject: [PATCH] ground sprite ground lives externs --- include/ground_event.h | 8 +++++ include/ground_lives.h | 2 ++ include/ground_sprite.h | 15 ++++++-- include/ground_sprite_monster.h | 12 +++++++ src/ground_effect.c | 36 +++++++++---------- src/ground_event.c | 11 +++--- src/ground_lives.c | 63 +++++++++++++++------------------ src/ground_main.c | 13 ++----- src/ground_object.c | 18 ++++------ src/ground_script.c | 4 +-- src/ground_sprite.c | 4 +-- src/ground_sprite_monster.c | 1 + 12 files changed, 98 insertions(+), 89 deletions(-) create mode 100644 include/ground_sprite_monster.h diff --git a/include/ground_event.h b/include/ground_event.h index 84b2347be..bec4c6f95 100644 --- a/include/ground_event.h +++ b/include/ground_event.h @@ -2,7 +2,15 @@ #define GUARD_GROUND_EVENT_H #include "structs/str_position.h" +#include "structs/str_ground_script.h" +void AllocGroundEvents(void); +void DeleteGroundEvents(void); +void FreeGroundEvents(void); +void GroundEvent_Select(s32 scriptID, s32 group, s32 sector); +void GroundEvent_Cancel(s32 scriptID, s32 sector); +bool8 sub_80ADC64(s32 id, ScriptInfoSmall *dst); s16 FindGroundEvent(u32 flags, PixelPos *arg1, PixelPos *arg2); +void nullsub_124(void); #endif // GUARD_GROUND_EVENT_H diff --git a/include/ground_lives.h b/include/ground_lives.h index 458ea84ad..ff91636fe 100644 --- a/include/ground_lives.h +++ b/include/ground_lives.h @@ -42,5 +42,7 @@ s32 sub_80A9050(s32 id_, s8 *a1); s32 sub_80A9090(s32 id_, s32 a1_); s16 GetFriendAreaDialogueId(s32 id_); s32 GetLivesCollision_80A92A0(s32 id_, u32 flags, PixelPos *pixelPos1, PixelPos *pixelPos2); +void GroundLives_Action(void); +void sub_80ABA7C(void); #endif // GUARD_GROUND_LIVES_H diff --git a/include/ground_sprite.h b/include/ground_sprite.h index a6f9bdf54..87f7c4766 100644 --- a/include/ground_sprite.h +++ b/include/ground_sprite.h @@ -63,15 +63,24 @@ typedef struct unkStruct_3001B7C unkStruct_3001B7C_sub108 unk108[UNK_3001B7C_SUB108_COUNT]; } unkStruct_3001B7C; -void GroundSprite_Reset(s32); -void GroundSprite_ExtendPaletteAdd(struct UnkGroundSpriteStruct *ptr, u16); -void GroundSprite_ExtendPaletteDelete(struct UnkGroundSpriteStruct *ptr); +void sub_80A62F0(void); +void GroundSprite_Reset(s32 a0); +void sub_80A658C(void); +void sub_80A6688(struct UnkGroundSpriteStruct *ptr, s32 a0); +bool8 SpriteHasPokemonSize_80A66A4(struct UnkGroundSpriteStruct *ptr); +bool8 sub_80A66D4(struct UnkGroundSpriteStruct *ptr); bool8 IsOnscreen_80A675C(struct UnkGroundSpriteStruct *ptr, PixelPos *pixPosArg); void sub_80A67CC(struct UnkGroundSpriteStruct *ptr, struct UnkGroundSpriteSubStructx48 *a1, s32 a2); void sub_80A68A0(struct UnkGroundSpriteStruct *ptr); +void GroundSprite_ExtendPaletteAdd(struct UnkGroundSpriteStruct *ptr, u16 a1); +void GroundSprite_ExtendPaletteDelete(struct UnkGroundSpriteStruct *ptr); +void sub_80A6E68(void); +void sub_80A6E80(void); +void sub_80A6EC8(struct UnkGroundSpriteStruct *ptr, s32 a1); void sub_80A6EFC(struct UnkGroundSpriteStruct *ptr, s32 a1_, s32 a2_); void sub_80A7040(struct UnkGroundSpriteStruct *ptr, s32 a1_, s32 a2_, s32 a3); bool8 sub_80A7094(struct UnkGroundSpriteStruct *ptr, PixelPos *r10, PixelPos *posArg, s32 a3); bool8 sub_80A7310(struct UnkGroundSpriteStruct *ptr, PixelPos *posArg1, PixelPos *posArg2, s32 a3); +void sub_80A73EC(void); #endif // GUARD_GROUND_SPRITE_H diff --git a/include/ground_sprite_monster.h b/include/ground_sprite_monster.h new file mode 100644 index 000000000..0f685af09 --- /dev/null +++ b/include/ground_sprite_monster.h @@ -0,0 +1,12 @@ +#ifndef GUARD_GROUND_SPRITE_MONSTER_H +#define GUARD_GROUND_SPRITE_MONSTER_H + +#include "ground_sprite.h" +#include "structs/str_position.h" + +void sub_80A7428(struct UnkGroundSpriteStruct *ptr, s32 a1_, s32 monsterId_, s32 a3); +void sub_80A74E4(struct UnkGroundSpriteStruct *ptr); +void sub_80A74F0(struct UnkGroundSpriteStruct *ptr, s32 a1_, s32 a2_, s32 a3); +void sub_80A7524(struct UnkGroundSpriteStruct *ptr, s32 monsterId_, PixelPos *pixelPosArg, s32 a3); + +#endif // GUARD_GROUND_SPRITE_MONSTER_H diff --git a/src/ground_effect.c b/src/ground_effect.c index 96199ba05..aa1a262a8 100644 --- a/src/ground_effect.c +++ b/src/ground_effect.c @@ -58,13 +58,11 @@ bool8 GetCurrentDungeonBounds(PixelPos *, PixelPos *); void sub_80A7688(struct UnkGroundSpriteStruct *ptr, s32 unused, s32 a2_, s32 a3); extern void SetPredefinedScript(Action *param_1, s16 index, const ScriptCommand *param_3); void sub_80A7714(struct UnkGroundSpriteStruct *); -void sub_80A6688(struct UnkGroundSpriteStruct *, s32); extern bool8 GroundScriptNotify(Action*, s32); extern bool8 GroundScript_Cancel(Action *r0); s32 sub_80AD3E0(GroundEffect *, PixelPos *); extern bool8 sub_80A66F8(struct UnkGroundSpriteStruct *ptr); extern bool8 sub_80A671C(struct UnkGroundSpriteStruct *ptr); -bool8 sub_80A66D4(struct UnkGroundSpriteStruct *ptr); void sub_80A7720(struct UnkGroundSpriteStruct *ptr, PixelPos *pixelPos, s32 a2); @@ -112,7 +110,9 @@ static const CallbackData gGroundEffectCallbacks = { }; extern const u8 gUnknown_81185D8[]; #define FAKE_FILENAME gUnknown_81185D8 - + + + @@ -165,10 +165,10 @@ void AllocGroundEffects(void) { s32 index; GroundEffect* current; - + gGroundEffects = MemoryAlloc(NUM_GROUND_EFFECTS * sizeof(GroundEffect), 6); current = gGroundEffects; - for (index = 0; index < NUM_GROUND_EFFECTS; index = (s16) (index + 0x1), current++) { + for (index = 0; index < NUM_GROUND_EFFECTS; index = (s16) (index + 0x1), current++) { current->kind = -1; } DeleteGroundEffects(); @@ -179,9 +179,9 @@ void DeleteGroundEffects(void) { s32 index; GroundEffect* current; - + current = gGroundEffects; - for (index = 0; index < NUM_GROUND_EFFECTS; index = (s16) (index + 0x1), current++) { + for (index = 0; index < NUM_GROUND_EFFECTS; index = (s16) (index + 0x1), current++) { if(current->kind != -1) GroundEffect_Delete(index); } @@ -319,7 +319,7 @@ s32 GroundEffect_Add(s32 _id, const GroundEffectData *effectData,s32 _group,s32 } if (id < 0) { return -1; - } + } parent = &gGroundEffects[id]; Log(0,"GroundEffect Add id %3d kind %3d type %3d group %3d sector %3d",id,effectData->kind,puVar4->type,group,sector); @@ -384,7 +384,7 @@ s32 GroundEffect_Add(s32 _id, const GroundEffectData *effectData,s32 _group,s32 if (puVar4->type == 1) { script = gFunctionScriptTable[58].script; } - if (script == NULL) + if (script == NULL) return id; } SetPredefinedScript(&parent->action,0,script); @@ -412,7 +412,7 @@ void sub_80AD0C8(s32 _id, s32 flags) if(parent->kind != -1) { - parent->flags |= flags; + parent->flags |= flags; sub_80A6688(&parent->unk144, parent->flags); } } @@ -476,7 +476,7 @@ bool8 GroundEffectsNotifyAll(s32 index_) s32 counter; GroundEffect *parent = &gGroundEffects[0]; bool8 flag = FALSE; - + for(counter = 0; counter < NUM_GROUND_EFFECTS; counter = (s16)(counter + 1), parent++) { if(parent->kind != -1) @@ -491,7 +491,7 @@ bool8 GroundEffectsCancelAll(void) s32 counter; GroundEffect *parent = &gGroundEffects[0]; bool8 flag = FALSE; - + for(counter = 0; counter < NUM_GROUND_EFFECTS; counter = (s16)(counter + 1), parent++) { if(parent->kind != -1) @@ -543,8 +543,8 @@ s16 sub_80AD360(s32 index_, PixelPos *pos) pos->y = 0; } else { - pos->x = parent->unk124.x + parent->unk14.x; - pos->y = parent->unk124.y + parent->unk14.y; + pos->x = parent->unk124.x + parent->unk14.x; + pos->y = parent->unk124.y + parent->unk14.y; } return parent->kind; @@ -556,7 +556,7 @@ s16 sub_80AD3B4(s32 index_, PixelPos *pos) GroundEffect *parent = &gGroundEffects[index]; sub_80AD3E0(parent, pos); - + return parent->kind; } @@ -571,7 +571,7 @@ s32 sub_80AD3E0(GroundEffect *param_1,PixelPos *param_2) } else { param_1->unk124 = local_1c; - param_1->unk12C = local_14; + param_1->unk12C = local_14; return 0; } } @@ -604,7 +604,7 @@ s32 sub_80AD430(GroundEffect *param_1,PixelPos *param_2) return 0; } -static s16 CallbackEffectGetIndex(void *ptr) +static s16 CallbackEffectGetIndex(void *ptr) { struct GroundEffect *groundObject = ptr; return groundObject->id; @@ -829,7 +829,7 @@ void sub_80AD7AC(void) if (objectPtr->kind != (s16)minus1) { PixelPos pos = {objectPtr->unk124.x + (objectPtr->unk14).x, objectPtr->unk124.y + (objectPtr->unk14).y}; - s32 num = objectPtr->unk134.x + objectPtr->unk134.y; + s32 num = objectPtr->unk134.x + objectPtr->unk134.y; if ((sub_80A66D4(&objectPtr->unk144))) { objectPtr->directionRelated = FALSE; diff --git a/src/ground_event.c b/src/ground_event.c index 3d731e9cb..c2fdbe423 100644 --- a/src/ground_event.c +++ b/src/ground_event.c @@ -5,6 +5,7 @@ #include "ground_lives.h" #include "debug.h" #include "memory.h" +#include "ground_script_file.h" typedef struct GroundEvent { @@ -20,10 +21,8 @@ typedef struct GroundEvent IWRAM_INIT GroundEvent *gGroundEvents = NULL; -void DeleteGroundEvents(void); -void GroundEvent_Delete(s32); -const struct GroundScriptHeader *GetGroundScript(s16 a0, const DebugLocation *); -s32 GroundEvent_Add(s32 id, const GroundEventData*, s32 group, s32 sector); +static s32 GroundEvent_Add(s32 id, const GroundEventData *eventData, s32 group, s32 sector); +static void GroundEvent_Delete(s32 id); void AllocGroundEvents(void) { @@ -118,7 +117,7 @@ void GroundEvent_Cancel(s32 scriptID, s32 sector) } } -s32 GroundEvent_Add(s32 id, const GroundEventData *eventData, s32 group, s32 sector) +static s32 GroundEvent_Add(s32 id, const GroundEventData *eventData, s32 group, s32 sector) { s32 i; s32 scriptID_s32 = (s16) id; @@ -179,7 +178,7 @@ s32 GroundEvent_Add(s32 id, const GroundEventData *eventData, s32 group, s32 sec return scriptID_s32; } -void GroundEvent_Delete(s32 id) +static void GroundEvent_Delete(s32 id) { s32 scriptID_s32 = (s16) id; GroundEvent *ptr = &gGroundEvents[scriptID_s32]; diff --git a/src/ground_lives.c b/src/ground_lives.c index 582292bfc..dadc8920b 100644 --- a/src/ground_lives.c +++ b/src/ground_lives.c @@ -17,6 +17,7 @@ #include "code_8002774.h" #include "friend_area_dialogue.h" #include "ground_lives_helper.h" +#include "ground_sprite_monster.h" struct GroundLivesMeta_Sub1 { @@ -104,12 +105,8 @@ extern const struct GroundLiveTypeData gGroundLivesTypeData_811E63C[]; extern s32 sub_8002984(s32 _direction1, u32 caseID); extern u8 sub_809D248(PixelPos *r0); extern s16 HandleAction(Action *action, const DebugLocation *debug); -extern void sub_80A7524(struct UnkGroundSpriteStruct *ptr, s32 monsterId_, PixelPos *pixelPosArg, s32 a3); -extern bool8 sub_80A66D4(struct UnkGroundSpriteStruct *ptr); -extern void sub_80A74F0(struct UnkGroundSpriteStruct *ptr, s32 a1_, s32 a2_, s32 a3); extern bool8 sub_80A66F8(struct UnkGroundSpriteStruct *ptr); extern bool8 sub_80A671C(struct UnkGroundSpriteStruct *ptr); -extern void sub_80A6EC8(struct UnkGroundSpriteStruct *ptr, s32 a1); extern s32 sub_80AC554(u32 a0, PixelPos *pixelPosArg1, PixelPos *pixelPosArg2); extern s32 sub_80AC448(s32 id_, PixelPos *pixelPos); extern bool8 sub_80A595C(u32 a0, PixelPos *pixelPosArg1, PixelPos *pixelPosArg2); @@ -124,21 +121,21 @@ extern bool8 GetPredefinedScript(Action *param_1, ScriptInfoSmall *script, s32 _ extern bool8 sub_809D678(Action *action); extern bool8 GroundObject_GetScript(s32 a0, ScriptInfoSmall *scriptInfo, s32 a2); extern void GroundObject_ExecuteScript(s32, void *, ScriptInfoSmall *); -extern bool8 sub_80ADC64(s32 id, ScriptInfoSmall *dst); 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 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); extern void sub_809D170(s32 r0, s32 r1); -extern void sub_80A74E4(struct UnkGroundSpriteStruct *ptr); extern const struct GroundScriptHeader *GetGroundScript(s16 a0, const DebugLocation *); static s32 sub_80A7B94(s16 *a0); static s32 GroundLives_Add(s32 id_, const GroundLivesData *ptr, s32 group_, s32 sector_); static void GroundLives_Delete(s32 id_); +static bool8 sub_80A9750(struct GroundLive *ptr, u16 a1); +static s32 sub_80A9F20(struct GroundLive *livesPtr, PixelPos *pixelPosArg); +static bool8 sub_80AA3F8(struct GroundLive *livesPtr, s32 a1_); +static void sub_80AAF68(struct GroundLive *livesPtr, u32 unused); static s16 CallbackLivesGetIndex(void *livesPtr_); static void CallbackLivesGetSize(void *livesPtr_, PixelPos *out); static void CallbackLivesSetHitboxPos(void *livesPtr_, PixelPos *posOrNull); @@ -159,13 +156,9 @@ static void CallbackLivesSetFlags(void *livesPtr_, u32 flags); static void CallbackLivesClearFlags(void *livesPtr_, u32 flags); static void CallbackLivesSpriteRelated_80AB238(void *livesPtr_, s32 a1); static s32 CallbackLivesMoveRelative(void *livesPtr_, PixelPos *pos); -bool8 sub_80A9750(struct GroundLive *ptr, u16 a1); -void sub_80AB5A4(void); -s32 sub_80A9F20(struct GroundLive *livesPtr, PixelPos *pixelPos); -bool8 sub_80AA3F8(struct GroundLive *livesPtr, s32 a1); -void sub_80AB5D4(struct GroundLive *livesPtr); -s32 sub_80ABA00(s32); -void sub_80AAF68(struct GroundLive *livesPtr, u32 unused); +static void sub_80AB5A4(void); +static void sub_80AB5D4(struct GroundLive *livesPtr); +static s32 sub_80ABA00(s32 a0); static const CallbackData gGroundLivesCallbacks = { .maybeId = 1, @@ -1591,7 +1584,7 @@ s32 GetLivesCollision_80A92A0(s32 id_, u32 flags, PixelPos *pixelPos1, PixelPos return -1; } -s32 sub_80A9344(s32 id_, u32 flags, PixelPos *pixelPos1, PixelPos *pixelPos2) +static s32 sub_80A9344(s32 id_, u32 flags, PixelPos *pixelPos1, PixelPos *pixelPos2) { s32 i; struct GroundLive *livesPtr; @@ -1614,7 +1607,7 @@ s32 sub_80A9344(s32 id_, u32 flags, PixelPos *pixelPos1, PixelPos *pixelPos2) return -1; } -u8 sub_80A93F0(s32 id_, s32 a1_) +static u8 sub_80A93F0(s32 id_, s32 a1_) { s32 id = (s16) id_; s32 a1 = (u8) a1_; @@ -1626,7 +1619,7 @@ u8 sub_80A93F0(s32 id_, s32 a1_) return sub_80A5934(a1, &pixPos1, &pixPos2); } -s32 sub_80A9488(struct GroundLive *livesPtr, PixelPos *posArg1, PixelPos *posArg2) +static s32 sub_80A9488(struct GroundLive *livesPtr, PixelPos *posArg1, PixelPos *posArg2) { PixelPos pixPos1 = {posArg1->x / 2048, posArg1->y / 2048}; PixelPos posTemp = {((posArg2->x - 1) / 2048), ((posArg2->y - 1) / 2048)}; @@ -1656,7 +1649,7 @@ s32 sub_80A9488(struct GroundLive *livesPtr, PixelPos *posArg1, PixelPos *posArg return 0; } -s32 sub_80A95AC(struct GroundLive *livesPtr, PixelPos *posArg1, PixelPos *posArg2) +static s32 sub_80A95AC(struct GroundLive *livesPtr, PixelPos *posArg1, PixelPos *posArg2) { PixelPos pixPos1 = {posArg1->x / 2048, posArg1->y / 2048}; PixelPos posTemp = {((posArg2->x - 1) / 2048), ((posArg2->y - 1) / 2048)}; @@ -1710,7 +1703,7 @@ s32 sub_80A95AC(struct GroundLive *livesPtr, PixelPos *posArg1, PixelPos *posArg return 0; } -bool8 sub_80A9750(struct GroundLive *livesPtr, u16 a1) +static bool8 sub_80A9750(struct GroundLive *livesPtr, u16 a1) { s32 r2; u16 f1 = a1 & 0xFF; @@ -1817,7 +1810,7 @@ bool8 sub_80A9750(struct GroundLive *livesPtr, u16 a1) return FALSE; } -s32 sub_80A9F20(struct GroundLive *livesPtr, PixelPos *pixelPosArg) +static s32 sub_80A9F20(struct GroundLive *livesPtr, PixelPos *pixelPosArg) { s32 ret; PixelPos pixPos1, pixPos2; @@ -1845,7 +1838,7 @@ s32 sub_80A9F20(struct GroundLive *livesPtr, PixelPos *pixelPosArg) } } -s32 sub_80A9F94(struct GroundLive *livesPtr, PixelPos *pixelPosArg) +static s32 sub_80A9F94(struct GroundLive *livesPtr, PixelPos *pixelPosArg) { s32 ret; bool8 changed; @@ -1898,7 +1891,7 @@ s32 sub_80A9F94(struct GroundLive *livesPtr, PixelPos *pixelPosArg) } } -s32 sub_80AA074(struct GroundLive *livesPtr, PixelPos *pixelPosArg) +static s32 sub_80AA074(struct GroundLive *livesPtr, PixelPos *pixelPosArg) { s32 ret; PixelPos pixPos1, pixPos2; @@ -1949,7 +1942,7 @@ s32 sub_80AA074(struct GroundLive *livesPtr, PixelPos *pixelPosArg) return ret; } -s32 sub_80AA180(struct GroundLive *livesPtr, u32 flags, PixelPos *pixelPosArg1, PixelPos *pixelPosArg2) +static s32 sub_80AA180(struct GroundLive *livesPtr, u32 flags, PixelPos *pixelPosArg1, PixelPos *pixelPosArg2) { PixelPos pixPos1, pixPos2; @@ -2003,7 +1996,7 @@ s32 sub_80AA180(struct GroundLive *livesPtr, u32 flags, PixelPos *pixelPosArg1, return 0; } -s32 sub_80AA2BC(struct GroundLive *livesPtr, u32 flags, PixelPos *pixelPosArg1, PixelPos *pixelPosArg2) +static s32 sub_80AA2BC(struct GroundLive *livesPtr, u32 flags, PixelPos *pixelPosArg1, PixelPos *pixelPosArg2) { PixelPos pixPos1, pixPos2, pixPos3; PixelPos posTemp; @@ -2042,7 +2035,7 @@ s32 sub_80AA2BC(struct GroundLive *livesPtr, u32 flags, PixelPos *pixelPosArg1, return 0; } -bool8 sub_80AA3F8(struct GroundLive *livesPtr, s32 a1_) +static bool8 sub_80AA3F8(struct GroundLive *livesPtr, s32 a1_) { s32 i; s32 a1 = (s8) a1_; @@ -2131,7 +2124,7 @@ bool8 sub_80AA3F8(struct GroundLive *livesPtr, s32 a1_) return FALSE; } -s32 sub_80AA660(struct GroundLive *livesPtr, PixelPos *pixelPosArg1, PixelPos *pixelPosArg2) +static s32 sub_80AA660(struct GroundLive *livesPtr, PixelPos *pixelPosArg1, PixelPos *pixelPosArg2) { s32 id = (s16) sub_80AC4C8(0x100, pixelPosArg1, pixelPosArg2); @@ -2143,7 +2136,7 @@ s32 sub_80AA660(struct GroundLive *livesPtr, PixelPos *pixelPosArg1, PixelPos *p return 0; } -bool8 sub_80AA690(struct GroundLive *livesPtr, s32 a1_) +static bool8 sub_80AA690(struct GroundLive *livesPtr, s32 a1_) { s32 i; s32 a1 = (s8) a1_; @@ -2183,7 +2176,7 @@ bool8 sub_80AA690(struct GroundLive *livesPtr, s32 a1_) return FALSE; } -s32 sub_80AA7B0(struct GroundLive *livesPtr, s16 *a1, u32 flags, PixelPos *pixelPosArg1, PixelPos *pixelPosArg2) +static s32 sub_80AA7B0(struct GroundLive *livesPtr, s16 *a1, u32 flags, PixelPos *pixelPosArg1, PixelPos *pixelPosArg2) { PixelPos pixPos1 = *pixelPosArg1; PixelPos pixPos3 = *pixelPosArg2; @@ -2211,7 +2204,7 @@ s32 sub_80AA7B0(struct GroundLive *livesPtr, s16 *a1, u32 flags, PixelPos *pixel return 0; } -bool8 sub_80AA8BC(struct GroundLive *livesPtr, s16 *a1, s32 dir_) +static bool8 sub_80AA8BC(struct GroundLive *livesPtr, s16 *a1, s32 dir_) { s32 i; s32 dir = (s8) dir_; @@ -2288,7 +2281,7 @@ bool8 sub_80AA8BC(struct GroundLive *livesPtr, s16 *a1, s32 dir_) return FALSE; } -void sub_80AAAE8(struct GroundLive *livesPtr, u32 a1, s32 dir_, s32 unused) +static void sub_80AAAE8(struct GroundLive *livesPtr, u32 a1, s32 dir_, s32 unused) { s32 unk; s32 dir = (s8) dir_; @@ -2508,7 +2501,7 @@ void sub_80AAAE8(struct GroundLive *livesPtr, u32 a1, s32 dir_, s32 unused) } } -void sub_80AAF68(struct GroundLive *livesPtr, u32 unused) +static void sub_80AAF68(struct GroundLive *livesPtr, u32 unused) { if (livesPtr->flags & 0x4000) { if (sub_80A93F0(livesPtr->id, 1)) { @@ -2866,7 +2859,7 @@ void GroundLives_Action(void) } } -void sub_80AB5A4(void) +static void sub_80AB5A4(void) { struct GroundLivesMeta_Sub1 *loopPtr; s32 i; @@ -2882,7 +2875,7 @@ void sub_80AB5A4(void) } } -void sub_80AB5D4(struct GroundLive *livesPtr) +static void sub_80AB5D4(struct GroundLive *livesPtr) { struct GroundLivesMeta_Sub1 *metaPtr = &gGroundLivesMeta->unk0[livesPtr->unk13C]; @@ -3059,7 +3052,7 @@ void sub_80AB5D4(struct GroundLive *livesPtr) } } -s32 sub_80ABA00(s32 a0) +static s32 sub_80ABA00(s32 a0) { s32 i; s32 ret = 0; diff --git a/src/ground_main.c b/src/ground_main.c index d37d070ca..c54f864a2 100644 --- a/src/ground_main.c +++ b/src/ground_main.c @@ -25,6 +25,8 @@ #include "unk_ds_only_feature.h" #include "textbox.h" #include "ground_lives.h" +#include "ground_event.h" +#include "ground_sprite.h" EWRAM_DATA u32 gUnknown_20398A8 = {0}; EWRAM_DATA s32 gUnknown_20398AC = {0}; @@ -64,7 +66,6 @@ extern void sub_8095494(DungeonMailSeed *param_1, u8 index); extern u16 gUnknown_2026E4E; // TODO: Move these externs to headers -extern void GroundSprite_Reset(s32); extern s16 sub_8098FCC(u32 unused); extern s16 sub_80A2654(s16 r0); extern bool8 sub_809AFAC(void); @@ -73,8 +74,6 @@ extern u8 sub_80023E4(u32); extern bool8 sub_8099B94(void); extern void FreeGroundObjects(void); extern void FreeGroundEffects(void); -extern void FreeGroundEvents(void); -extern void sub_80A658C(void); extern void sub_809D508(void); extern void nullsub_119(void); extern void sub_8099768(void); @@ -83,12 +82,8 @@ extern void sub_8099648(void); extern void sub_809975C(void); extern void sub_809D0AC(void); extern void sub_809D490(void); -extern void sub_80A62F0(void); -extern void AllocGroundEvents(void); extern void AllocGroundObjects(void); extern void AllocGroundEffects(void); -extern void nullsub_124(void); -extern void GroundLives_Action(void); extern void GroundObject_Action(void); extern void GroundEffect_Action(void); extern void sub_809B474(void); @@ -96,7 +91,6 @@ extern void GroundScript_Unlock(); extern void sub_809D25C(void); extern void sub_80A59DC(void); extern void sub_809B614(void); -extern void sub_80A6E80(void); extern void sub_8099BE4(void); extern void sub_8099744(void); extern void WaitForNextFrameAndAdvanceRNG(void); @@ -104,16 +98,13 @@ extern void LoadBufferedInputs(void); extern void nullsub_120(void); extern void sub_80A5E70(void); extern void sub_809B638(void); -extern void sub_80A73EC(void); extern void sub_8099750(void); extern void sub_809D0BC(void); -extern void DeleteGroundEvents(void); extern void DeleteGroundObjects(void); extern void DeleteGroundEffects(void); extern void nullsub_16(void); extern void UpdateAdventureAchievements(void); extern void xxx_call_update_bg_sound_input(void); -extern void sub_80A6E68(void); extern void sub_80060EC(void); extern void sub_809977C(void); extern void UpdateFadeInTile(s32); diff --git a/src/ground_object.c b/src/ground_object.c index 9b3b4968e..ddca38a9f 100644 --- a/src/ground_object.c +++ b/src/ground_object.c @@ -6,6 +6,7 @@ #include "event_flag.h" #include "ground_script.h" #include "ground_sprite.h" +#include "ground_lives.h" #include "memory.h" typedef struct GroundObject { @@ -57,7 +58,6 @@ void SetPredefinedScript(Action *param_1, s16 index, const ScriptCommand *param_ extern bool8 GetCurrentDungeonBounds(PixelPos *a0, PixelPos *a1); void sub_80A75CC(void *, s32, s32, s32); -bool8 SpriteHasPokemonSize_80A66A4(struct UnkGroundSpriteStruct *ptr); s32 GroundObject_Add(s32 id_,const GroundObjectData *objectData,s32 group_,s32 sector_); @@ -490,10 +490,8 @@ s32 GroundObject_Add(s32 id_,const GroundObjectData *objectData,s32 group_,s32 s return id; } - -void sub_80A6688(struct UnkGroundSpriteStruct *, s32); - -void GroundObject_Delete(s32 index_) { +void GroundObject_Delete(s32 index_) +{ s32 index = (s16)index_; GroundObject *parent = &gGroundObjects[index]; @@ -716,13 +714,12 @@ s32 GetObjectCollision_80AC5F4(GroundObject *param_1, PixelPos *param_2, PixelPo PixelPos iVar1 = { (param_3->x - 1) / 2048, (param_3->y - 1) / 2048 }; PixelPos local_20 = { (iVar1.x - local_28.x) + 1, (iVar1.y - local_28.y) + 1 }; - if (param_1->flags & 1) - { - if(CheckMapCollision_80A585C(&local_28,&local_20)) + if (param_1->flags & 1) { + if (CheckMapCollision_80A585C(&local_28,&local_20)) return 1; } - if (((param_1->flags & 4))) { - if(((s16)GetLivesCollision_80A92A0(-1,4,param_2,param_3) >= 0)) + if (param_1->flags & 4) { + if ((s16) GetLivesCollision_80A92A0(-1,4,param_2,param_3) >= 0) return 4; } return 0; @@ -1024,7 +1021,6 @@ void GroundObject_Action(void) } void sub_80A7664(struct UnkGroundSpriteStruct *ptr, PixelPos *pixelPos, s32 a2); -extern bool8 sub_80A66D4(struct UnkGroundSpriteStruct *ptr); void sub_80ACAD4(void) { diff --git a/src/ground_script.c b/src/ground_script.c index 38e3edfe4..5b4bac483 100644 --- a/src/ground_script.c +++ b/src/ground_script.c @@ -50,6 +50,7 @@ #include "ground_map_conversion_table.h" #include "unk_ds_only_feature.h" #include "textbox.h" +#include "ground_event.h" void GroundMap_Select(s16); void GroundMap_SelectDungeon(s32, DungeonLocation*, u32); @@ -58,10 +59,8 @@ void GroundObject_ExecuteScript(s32, ActionUnkIds *, ScriptInfoSmall *); void GroundEffect_ExecuteScript(s32, ActionUnkIds *, ScriptInfoSmall *); void GroundObject_Select(s32, s32 group, s32 sector); void GroundEffect_Select(s32, s32 group, s32 sector); -void GroundEvent_Select(s32, s32 group, s32 sector); void GroundObject_Cancel(s32 group, s32 sector); void GroundEffect_Cancel(s32 group, s32 sector); -void GroundEvent_Cancel(s32 group, s32 sector); void GroundObject_CancelBlank(void); void GroundEffect_CancelBlank(void); void GroundWeather_Select(s16); @@ -99,7 +98,6 @@ s16 sub_80AC448(s16, PixelPos*); s32 sub_80AC49C(s16, PixelPos*); s16 sub_80AD360(s16, PixelPos*); s16 sub_80AD3B4(s16, PixelPos*); -void DeleteGroundEvents(void); void DeleteGroundObjects(void); void DeleteGroundEffects(void); s32 ExecuteScriptCommand(Action *action); diff --git a/src/ground_sprite.c b/src/ground_sprite.c index 399829cde..786541f2a 100644 --- a/src/ground_sprite.c +++ b/src/ground_sprite.c @@ -1,13 +1,14 @@ #include "global.h" #include "globaldata.h" +#include "ground_sprite.h" #include "structs/axdata.h" #include "effect_main.h" #include "debug.h" #include "def_filearchives.h" #include "file_system.h" #include "ground_map.h" -#include "ground_sprite.h" #include "ground_sprite_data.h" +#include "ground_lives.h" #include "memory.h" #include "sprite.h" #include "effect_sub_1.h" @@ -29,7 +30,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); -extern void sub_80ABA7C(void); extern void sub_80ACAD4(void); extern void sub_80AD7AC(void); extern void sub_800E970(void); diff --git a/src/ground_sprite_monster.c b/src/ground_sprite_monster.c index 149f30c73..ea417ae6b 100644 --- a/src/ground_sprite_monster.c +++ b/src/ground_sprite_monster.c @@ -1,5 +1,6 @@ #include "global.h" #include "globaldata.h" +#include "ground_sprite_monster.h" #include "def_filearchives.h" #include "file_system.h" #include "ground_sprite.h"