From 2a5b52cdaf90c99358500929729e56db7b598d80 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 29 Sep 2024 16:31:55 +0100 Subject: [PATCH] Change PfnEntityUpdates to use OVL_EXPORT --- config/splat.us.strwrp.yaml | 4 ++-- config/symbols.stmad.txt | 2 +- config/symbols.us.stdre.txt | 2 +- config/symbols.us.stno3.txt | 2 +- config/symbols.us.stst0.txt | 2 +- include/stage.h | 6 ------ src/boss/mar/create_entity.c | 2 ++ src/boss/mar/cutscene.c | 3 ++- src/boss/mar/e_init.c | 2 +- src/boss/mar/e_misc.c | 1 + src/pc/sotn.c | 1 + src/pc/stages/stage_cen.c | 3 +++ src/pc/stages/stage_wrp.c | 3 +++ src/st/cen/cen.h | 2 -- src/st/cen/create_entity.c | 3 ++- src/st/cen/cutscene.c | 1 + src/st/cen/e_init.c | 2 +- src/st/cen/e_misc.c | 1 + src/st/dre/create_entity.c | 3 ++- src/st/dre/cutscene.c | 1 + src/st/dre/dre.h | 1 - src/st/dre/e_misc.c | 1 + src/st/mad/create_entity.c | 2 +- src/st/mad/e_misc.c | 1 + src/st/mad/mad.h | 1 - src/st/make_entity_from_id.h | 3 ++- src/st/no3/create_entity.c | 3 ++- src/st/no3/cutscene.c | 1 + src/st/no3/e_misc.c | 1 + src/st/no3/no3.h | 2 -- src/st/np3/4B018.c | 2 +- src/st/np3/create_entity.c | 2 ++ src/st/np3/e_init.c | 4 ++-- src/st/np3/e_misc.c | 1 + src/st/np3/np3.h | 3 +-- src/st/nz0/create_entity.c | 3 ++- src/st/nz0/cutscene.c | 1 + src/st/nz0/e_init.c | 2 +- src/st/nz0/e_misc.c | 1 + src/st/nz0/nz0.h | 1 - src/st/pfn_entity_update.h | 11 +++++++++++ src/st/rwrp/create_entity.c | 4 ++++ src/st/rwrp/e_init.c | 2 +- src/st/rwrp/e_misc.c | 1 + src/st/st0/create_entity.c | 8 +++++--- src/st/st0/cutscene.c | 1 + src/st/st0/e_misc.c | 2 +- src/st/st0/st0.h | 1 - src/st/wrp/create_entity.c | 2 ++ src/st/wrp/e_init.c | 2 +- src/st/wrp/e_misc.c | 1 + src/st/wrp_psp/create_entity.c | 1 + src/st/wrp_psp/st_init_wrp.c | 1 + 53 files changed, 78 insertions(+), 41 deletions(-) create mode 100644 src/st/pfn_entity_update.h create mode 100644 src/st/rwrp/create_entity.c diff --git a/config/splat.us.strwrp.yaml b/config/splat.us.strwrp.yaml index 3f4db76c32..5c66af8f47 100644 --- a/config/splat.us.strwrp.yaml +++ b/config/splat.us.strwrp.yaml @@ -76,7 +76,7 @@ segments: - [0x91C0, c, rwrp/warp] - [0xA168, c, wrp/st_update] - [0xA59C, c, wrp/collision] - - [0xBD58, c, wrp/create_entity] + - [0xBD58, c, rwrp/create_entity] - [0xC8D0, c, wrp/e_red_door] - [0xD580, c, wrp/st_common] - [0xEA30, c, wrp/e_collect] @@ -87,7 +87,7 @@ segments: - [0x14DD4, c, wrp/e_room_fg] - [0x14EC0, c, wrp/popup] - [0x151F0, c, wrp/prim_helpers] - - [0x15A20, .bss, wrp/create_entity] + - [0x15A20, .bss, rwrp/create_entity] - [0x15A36, .bss, rwrp/bss] - [0x166A8, .bss, wrp/e_collect] - [0x166E8] diff --git a/config/symbols.stmad.txt b/config/symbols.stmad.txt index ae52e5c27a..37931f5040 100644 --- a/config/symbols.stmad.txt +++ b/config/symbols.stmad.txt @@ -1,7 +1,7 @@ g_pStTilesetDebug = 0x80180290; MAD_gfxBanks = 0x801802A4; g_pStObjLayoutHorizontal = 0x801802F4; -PfnEntityUpdates = 0x8018049C; +MAD_EntityUpdates = 0x8018049C; g_eBreakableInit = 0x801804F0; g_InitDataEnt13 = 0x8018052C; g_eInitGeneric2 = 0x80180544; diff --git a/config/symbols.us.stdre.txt b/config/symbols.us.stdre.txt index f38a015752..db398ccb73 100644 --- a/config/symbols.us.stdre.txt +++ b/config/symbols.us.stdre.txt @@ -1,5 +1,5 @@ DRE_gfxBanks = 0x801801D0; -PfnEntityUpdates = 0x801803C8; +DRE_EntityUpdates = 0x801803C8; g_eBreakableInit = 0x80180458; g_InitializeData0 = 0x80180464; g_InitializeEntityData0 = 0x80180470; diff --git a/config/symbols.us.stno3.txt b/config/symbols.us.stno3.txt index 1f335ed1b1..79561c3a1a 100644 --- a/config/symbols.us.stno3.txt +++ b/config/symbols.us.stno3.txt @@ -1,4 +1,4 @@ -PfnEntityUpdates = 0x80180924; +NO3_EntityUpdates = 0x80180924; g_eBreakableInit = 0x80180AAC; g_InitializeData0 = 0x80180AB8; g_InitializeEntityData0 = 0x80180AC4; diff --git a/config/symbols.us.stst0.txt b/config/symbols.us.stst0.txt index 000ff3aa97..7266af83c0 100644 --- a/config/symbols.us.stst0.txt +++ b/config/symbols.us.stst0.txt @@ -1,5 +1,5 @@ g_EntityGfxs = 0x801802C4; -PfnEntityUpdates = 0x801804BC; +ST0_EntityUpdates = 0x801804BC; g_eBreakableInit = 0x80180574; g_InitializeData0 = 0x80180580; g_InitializeEntityData0 = 0x8018058C; diff --git a/include/stage.h b/include/stage.h index fe8982f642..f3939aa8f7 100644 --- a/include/stage.h +++ b/include/stage.h @@ -43,12 +43,6 @@ extern LayoutEntity* g_pStObjLayoutVertical[]; #endif -#if defined(VERSION_PSP) -extern PfnEntityUpdate* PfnEntityUpdates; -#else -extern PfnEntityUpdate PfnEntityUpdates[]; -#endif - extern u16 g_ItemIconSlots[32]; /* diff --git a/src/boss/mar/create_entity.c b/src/boss/mar/create_entity.c index 1708689640..1fa99c27a3 100644 --- a/src/boss/mar/create_entity.c +++ b/src/boss/mar/create_entity.c @@ -1,2 +1,4 @@ // SPDX-License-Identifier: AGPL-3.0-or-later +#include "mar.h" +#include "../../st/pfn_entity_update.h" #include "../../st/create_entity.h" diff --git a/src/boss/mar/cutscene.c b/src/boss/mar/cutscene.c index d91604892c..632337610f 100644 --- a/src/boss/mar/cutscene.c +++ b/src/boss/mar/cutscene.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later -#include +#include "mar.h" +#include "../../st/pfn_entity_update.h" #include #include "mar.h" diff --git a/src/boss/mar/e_init.c b/src/boss/mar/e_init.c index 299d644861..6b769757a1 100644 --- a/src/boss/mar/e_init.c +++ b/src/boss/mar/e_init.c @@ -34,7 +34,7 @@ void OVL_EXPORT(EntityCutscene)(Entity* self); void func_us_8018C90C(Entity* self); void func_us_8018CA94(Entity* self); -PfnEntityUpdate PfnEntityUpdates[] = { +PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = { EntityBreakable, EntityExplosion, EntityPrizeDrop, EntityDamageDisplay, EntityRedDoor, EntityIntenseExplosion, diff --git a/src/boss/mar/e_misc.c b/src/boss/mar/e_misc.c index 61fbd8d09b..0e2e3549e1 100644 --- a/src/boss/mar/e_misc.c +++ b/src/boss/mar/e_misc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "mar.h" +#include "../../st/pfn_entity_update.h" void EntityUnkId13(Entity* self); void EntityUnkId14(Entity* self); diff --git a/src/pc/sotn.c b/src/pc/sotn.c index 8ddc875598..5234ac007c 100644 --- a/src/pc/sotn.c +++ b/src/pc/sotn.c @@ -13,6 +13,7 @@ u16 g_RawVram[VRAM_W * VRAM_H]; GameApi g_ApiInit = {0}; u8 g_DemoRecordingBuffer[DEMO_MAX_LEN]; extern bool g_IsQuitRequested; +PfnEntityUpdate* PfnEntityUpdates; ServantDesc D_80170000; diff --git a/src/pc/stages/stage_cen.c b/src/pc/stages/stage_cen.c index 5ee02ac788..fa62088911 100644 --- a/src/pc/stages/stage_cen.c +++ b/src/pc/stages/stage_cen.c @@ -17,6 +17,8 @@ u8 D_8018199C[8356]; u8 D_80185830[3420]; extern Overlay OVL_EXPORT(Overlay); +extern PfnEntityUpdate* PfnEntityUpdates; +extern PfnEntityUpdate OVL_EXPORT(EntityUpdates)[]; void InitStageCEN(Overlay* o) { LoadReset(); LOAD_ASSET("assets/st/cen/D_8018658C.bin", D_8018658C); @@ -29,4 +31,5 @@ void InitStageCEN(Overlay* o) { LOAD_ASSET("assets/st/cen/D_8018199C.bin", D_8018199C); LOAD_ASSET("assets/st/cen/D_80185830.bin", D_80185830); memcpy(o, &OVL_EXPORT(Overlay), sizeof(Overlay)); + // PfnEntityUpdates = OVL_EXPORT(EntityUpdates); } diff --git a/src/pc/stages/stage_wrp.c b/src/pc/stages/stage_wrp.c index 00e74f523b..e54471eb56 100644 --- a/src/pc/stages/stage_wrp.c +++ b/src/pc/stages/stage_wrp.c @@ -11,10 +11,13 @@ u32 D_80181420[836]; u16 D_80181D08[48]; extern Overlay OVL_EXPORT(Overlay); +extern PfnEntityUpdate* PfnEntityUpdates; +extern PfnEntityUpdate OVL_EXPORT(EntityUpdates)[]; void InitStageWRP(Overlay* o) { LoadReset(); LOAD_ASSET("assets/st/wrp/D_80181D08.bin", D_80181D08); LOAD_ASSET("assets/st/wrp/D_80181420.bin", D_80181420); LOAD_ASSET("assets/st/wrp/D_80181764.bin", D_80181764); memcpy(o, &OVL_EXPORT(Overlay), sizeof(Overlay)); + PfnEntityUpdates = OVL_EXPORT(EntityUpdates); } diff --git a/src/st/cen/cen.h b/src/st/cen/cen.h index 28018a8d4b..14e01822dc 100644 --- a/src/st/cen/cen.h +++ b/src/st/cen/cen.h @@ -48,8 +48,6 @@ u16 GetNormalizedAngle(u16 arg0, u16 arg1, u16 arg2); void EntityUnkId14(Entity* entity); void EntityGreyPuff(Entity* entity); -extern PfnEntityUpdate PfnEntityUpdates[]; - /*** Initializers ***/ extern u16 D_80180404[]; extern u16 g_InitializeData0[]; diff --git a/src/st/cen/create_entity.c b/src/st/cen/create_entity.c index 466e913fad..394b93a580 100644 --- a/src/st/cen/create_entity.c +++ b/src/st/cen/create_entity.c @@ -1,3 +1,4 @@ // SPDX-License-Identifier: AGPL-3.0-or-later - +#include "cen.h" +#include "../pfn_entity_update.h" #include "../create_entity.h" diff --git a/src/st/cen/cutscene.c b/src/st/cen/cutscene.c index 4f9f261107..82944e2305 100644 --- a/src/st/cen/cutscene.c +++ b/src/st/cen/cutscene.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "cen.h" +#include "../pfn_entity_update.h" #include // Bizarre variable - u8 here, but u16 in EntityHeartDrop diff --git a/src/st/cen/e_init.c b/src/st/cen/e_init.c index 39c54ecd23..eab47d9a94 100644 --- a/src/st/cen/e_init.c +++ b/src/st/cen/e_init.c @@ -31,7 +31,7 @@ void EntityElevatorStationary(Entity*); void EntityUnkId1B(Entity*); void EntityMovingElevator(Entity*); -PfnEntityUpdate PfnEntityUpdates[] = { +PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = { EntityBreakable, EntityExplosion, EntityPrizeDrop, EntityDamageDisplay, EntityRedDoor, EntityIntenseExplosion, diff --git a/src/st/cen/e_misc.c b/src/st/cen/e_misc.c index 9fffbd718e..a53838663c 100644 --- a/src/st/cen/e_misc.c +++ b/src/st/cen/e_misc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "cen.h" +#include "../pfn_entity_update.h" #define HEART_DROP_CASTLE_FLAG 0xC0 diff --git a/src/st/dre/create_entity.c b/src/st/dre/create_entity.c index 38f00025f5..ee7448b5a4 100644 --- a/src/st/dre/create_entity.c +++ b/src/st/dre/create_entity.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later -#include +#include "dre.h" +#include "../pfn_entity_update.h" u32 D_801A3264[24]; diff --git a/src/st/dre/cutscene.c b/src/st/dre/cutscene.c index 684e0a32dc..58afef41c5 100644 --- a/src/st/dre/cutscene.c +++ b/src/st/dre/cutscene.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "dre.h" +#include "../pfn_entity_update.h" #include #include "../cutscene_unk1.h" diff --git a/src/st/dre/dre.h b/src/st/dre/dre.h index 9ddb4af7de..cdcd71eac1 100644 --- a/src/st/dre/dre.h +++ b/src/st/dre/dre.h @@ -103,7 +103,6 @@ extern u16 g_InitializeEntityData0[]; extern u16 g_eInitGeneric2[]; extern u16 D_801804F4[]; extern s8 c_HeartPrizes[]; -extern PfnEntityUpdate PfnEntityUpdates[]; extern u16 D_801804E8[]; extern u16 D_8018050C[]; extern u16 D_80180528[]; diff --git a/src/st/dre/e_misc.c b/src/st/dre/e_misc.c index d42e9bef12..17dd0bb2bf 100644 --- a/src/st/dre/e_misc.c +++ b/src/st/dre/e_misc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "dre.h" +#include "../pfn_entity_update.h" #define HEART_DROP_CASTLE_FLAG 0x118 #include "../e_misc.h" diff --git a/src/st/mad/create_entity.c b/src/st/mad/create_entity.c index bfa098695d..8680b55ce9 100644 --- a/src/st/mad/create_entity.c +++ b/src/st/mad/create_entity.c @@ -1,4 +1,4 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "mad.h" - +#include "../pfn_entity_update.h" #include "../create_entity.h" diff --git a/src/st/mad/e_misc.c b/src/st/mad/e_misc.c index 0b43eaa46c..efdd864f9a 100644 --- a/src/st/mad/e_misc.c +++ b/src/st/mad/e_misc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "mad.h" +#include "../pfn_entity_update.h" #define HEART_DROP_CASTLE_FLAG 0 #include "../e_misc.h" diff --git a/src/st/mad/mad.h b/src/st/mad/mad.h index 34fa4d95b3..ad7e45ca09 100644 --- a/src/st/mad/mad.h +++ b/src/st/mad/mad.h @@ -85,7 +85,6 @@ extern u8 g_UnkEntityAnimData[]; // extern u16 g_testCollPrizeTable[]; // extern u16 g_testCollRandTable; extern RoomHeader g_rooms[]; -extern PfnEntityUpdate PfnEntityUpdates[]; extern u16 g_eBreakableInit[]; extern u8* g_eBreakableAnimations[8]; diff --git a/src/st/make_entity_from_id.h b/src/st/make_entity_from_id.h index f6e26e1e8c..5f5852ac6a 100644 --- a/src/st/make_entity_from_id.h +++ b/src/st/make_entity_from_id.h @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later -extern PfnEntityUpdate PfnEntityUpdates[]; +#include "pfn_entity_update.h" + void MakeEntityFromId(u16 entityId, Entity* src, Entity* dst) { DestroyEntity(dst); dst->entityId = entityId; diff --git a/src/st/no3/create_entity.c b/src/st/no3/create_entity.c index 3a6be69b02..993b61a4eb 100644 --- a/src/st/no3/create_entity.c +++ b/src/st/no3/create_entity.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later -#include +#include "no3.h" +#include "../pfn_entity_update.h" STATIC_PAD_BSS(96); diff --git a/src/st/no3/cutscene.c b/src/st/no3/cutscene.c index 395f72be6e..b862fc3b47 100644 --- a/src/st/no3/cutscene.c +++ b/src/st/no3/cutscene.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "no3.h" +#include "../pfn_entity_update.h" #include static const char* actor_names[] = {_S("Alucard"), _S("Death")}; diff --git a/src/st/no3/e_misc.c b/src/st/no3/e_misc.c index b3aa2caba2..fd8c1a8337 100644 --- a/src/st/no3/e_misc.c +++ b/src/st/no3/e_misc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "no3.h" +#include "../pfn_entity_update.h" #define HEART_DROP_CASTLE_FLAG 0x30 #include "../e_misc.h" diff --git a/src/st/no3/no3.h b/src/st/no3/no3.h index 6f28e6b2a1..50c4280c26 100644 --- a/src/st/no3/no3.h +++ b/src/st/no3/no3.h @@ -243,8 +243,6 @@ extern s32 D_801D7D54; extern s32 D_801D7D58; extern u32 g_CutsceneFlags; -extern PfnEntityUpdate PfnEntityUpdates[]; - // *** EntityFireWarg properties START *** extern Entity D_8007A958; diff --git a/src/st/np3/4B018.c b/src/st/np3/4B018.c index e9b4fd921f..3ad3cf7f4c 100644 --- a/src/st/np3/4B018.c +++ b/src/st/np3/4B018.c @@ -36,7 +36,7 @@ void EntityOwl(Entity* self) { } switch (self->step) { case 0: - InitializeEntity(&D_80180B2C); + InitializeEntity(D_80180B2C); // Turns out the knight is spawned from the owl. Neat! CreateEntityFromEntity(E_OWL_KNIGHT, self, KNIGHT); CreateEntityFromEntity(E_801CD620, self, self + 3); diff --git a/src/st/np3/create_entity.c b/src/st/np3/create_entity.c index 6159c30f12..65b28161ca 100644 --- a/src/st/np3/create_entity.c +++ b/src/st/np3/create_entity.c @@ -1,2 +1,4 @@ // SPDX-License-Identifier: AGPL-3.0-or-later +#include "np3.h" +#include "../pfn_entity_update.h" #include "../create_entity.h" diff --git a/src/st/np3/e_init.c b/src/st/np3/e_init.c index 845e422905..1c9f14b0ab 100644 --- a/src/st/np3/e_init.c +++ b/src/st/np3/e_init.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-or-later -#include +#include "np3.h" void EntityBreakable(Entity* self); void EntityExplosion(Entity* self); @@ -93,7 +93,7 @@ void EntityGurkhaSword(Entity* self); void EntityBlade(Entity* self); void EntityBladeSword(Entity* self); -PfnEntityUpdate PfnEntityUpdates[] = { +PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = { EntityBreakable, EntityExplosion, EntityPrizeDrop, diff --git a/src/st/np3/e_misc.c b/src/st/np3/e_misc.c index d1cfdf8472..b0d634f47a 100644 --- a/src/st/np3/e_misc.c +++ b/src/st/np3/e_misc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "np3.h" +#include "../pfn_entity_update.h" #define HEART_DROP_CASTLE_FLAG 0x30 #include "../e_misc.h" diff --git a/src/st/np3/np3.h b/src/st/np3/np3.h index 5fbbaf0cf2..2237427c76 100644 --- a/src/st/np3/np3.h +++ b/src/st/np3/np3.h @@ -271,7 +271,6 @@ extern u8 D_8018267C[]; // Animation: Walking faster extern s32 D_8018268C; extern s32 D_801826A4; extern s32 D_801826C4; -extern PfnEntityUpdate PfnEntityUpdates[]; extern u8 D_80182914[]; extern u8 D_80182935[]; @@ -333,7 +332,7 @@ extern s16 D_801833A0[]; extern s16 D_801833CC[]; // For EntityOwl -extern u16 D_80180B2C; +extern u16 D_80180B2C[]; extern u16 D_801826CC[]; extern u8 D_801826EC[]; extern u8 D_801826F8[]; diff --git a/src/st/nz0/create_entity.c b/src/st/nz0/create_entity.c index a30481659f..6562d221e2 100644 --- a/src/st/nz0/create_entity.c +++ b/src/st/nz0/create_entity.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later -#include +#include "nz0.h" +#include "../pfn_entity_update.h" u32 D_801CAA14[24]; diff --git a/src/st/nz0/cutscene.c b/src/st/nz0/cutscene.c index a36af096b0..14a9c4ae05 100644 --- a/src/st/nz0/cutscene.c +++ b/src/st/nz0/cutscene.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "nz0.h" +#include "../pfn_entity_update.h" static const char* actor_names[] = {_S("Alucard"), _S("Maria")}; diff --git a/src/st/nz0/e_init.c b/src/st/nz0/e_init.c index 206041a87f..99a8414ba1 100644 --- a/src/st/nz0/e_init.c +++ b/src/st/nz0/e_init.c @@ -79,7 +79,7 @@ void NZ0_EntityCutscene(Entity*); void EntityMaria(Entity*); void func_801B8E0C(Entity*); -PfnEntityUpdate PfnEntityUpdates[] = { +PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = { EntityBreakableNZ0, EntityExplosion, EntityPrizeDrop, diff --git a/src/st/nz0/e_misc.c b/src/st/nz0/e_misc.c index 421ffd2fbc..8c0fcb6f4a 100644 --- a/src/st/nz0/e_misc.c +++ b/src/st/nz0/e_misc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "nz0.h" +#include "../pfn_entity_update.h" #define HEART_DROP_CASTLE_FLAG 0xF8 #include "../e_misc.h" diff --git a/src/st/nz0/nz0.h b/src/st/nz0/nz0.h index dd8e080770..36f640b656 100644 --- a/src/st/nz0/nz0.h +++ b/src/st/nz0/nz0.h @@ -98,7 +98,6 @@ void EntityGreyPuff(Entity* entity); void func_801C4CC0(void); extern u8 D_8003BE6F[]; -extern PfnEntityUpdate PfnEntityUpdates[]; extern u16 g_InitializeEntityData0[]; extern u16 g_EInitGeneric[]; // Init Elevator2 extern u16 g_eInitGeneric2[]; diff --git a/src/st/pfn_entity_update.h b/src/st/pfn_entity_update.h new file mode 100644 index 0000000000..84c373b125 --- /dev/null +++ b/src/st/pfn_entity_update.h @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + +// NOTE: include this AFTER the stage entity is included +// this is to ensure OVL_EXPORT is defined + +#if defined(VERSION_PSP) || defined(VERSION_PC) +extern PfnEntityUpdate* PfnEntityUpdates; +#else +extern PfnEntityUpdate OVL_EXPORT(EntityUpdates)[]; +#define PfnEntityUpdates OVL_EXPORT(EntityUpdates) +#endif diff --git a/src/st/rwrp/create_entity.c b/src/st/rwrp/create_entity.c new file mode 100644 index 0000000000..bb93d2352d --- /dev/null +++ b/src/st/rwrp/create_entity.c @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later +#include "rwrp.h" +#include "../pfn_entity_update.h" +#include "../create_entity.h" diff --git a/src/st/rwrp/e_init.c b/src/st/rwrp/e_init.c index dacfe2326c..14ae53d4c5 100644 --- a/src/st/rwrp/e_init.c +++ b/src/st/rwrp/e_init.c @@ -10,7 +10,7 @@ void EntityGreyPuff(Entity*); void EntityRWarpRoom(Entity*); void EntityWarpSmallRocks(Entity*); void EntityPrizeDrop(Entity*); -PfnEntityUpdate PfnEntityUpdates[] = { +PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = { EntityBreakable, EntityExplosion, EntityPrizeDrop, EntityDamageDisplay, EntityRedDoor, EntityIntenseExplosion, EntitySoulStealOrb, EntityRoomForeground, EntityStageNamePopup, diff --git a/src/st/rwrp/e_misc.c b/src/st/rwrp/e_misc.c index effa794fcc..2a58814adb 100644 --- a/src/st/rwrp/e_misc.c +++ b/src/st/rwrp/e_misc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "rwrp.h" +#include "../pfn_entity_update.h" #define HEART_DROP_CASTLE_FLAG 0x2F8 #include "../e_misc.h" diff --git a/src/st/st0/create_entity.c b/src/st/st0/create_entity.c index 32b488eda1..c5638955bb 100644 --- a/src/st/st0/create_entity.c +++ b/src/st/st0/create_entity.c @@ -1,9 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-or-later -#include +#include u32 D_801BEB00[25]; -u32 D_801BEB64; -u32 D_801BEB68[165]; +Point32 D_801BEB64[0x53]; u32 D_801BEDFC; u32 D_801BEE00; u32 D_801BEE04; @@ -11,4 +10,7 @@ u16 D_801BEE08[2]; u16 D_801BEE0C[66]; u16 D_801BEE90[2312]; +// HACK move the header inclusion at the end to not scrable the BSS variables +#include "st0.h" +#include "../pfn_entity_update.h" #include "../create_entity.h" diff --git a/src/st/st0/cutscene.c b/src/st/st0/cutscene.c index 160bd8cf24..1255f00554 100644 --- a/src/st/st0/cutscene.c +++ b/src/st/st0/cutscene.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "st0.h" +#include "../pfn_entity_update.h" #include #include "../cutscene_unk1.h" diff --git a/src/st/st0/e_misc.c b/src/st/st0/e_misc.c index 4362a56d59..3da760ba1f 100644 --- a/src/st/st0/e_misc.c +++ b/src/st/st0/e_misc.c @@ -1,4 +1,4 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "st0.h" - +#include "../pfn_entity_update.h" #include "../e_misc.h" diff --git a/src/st/st0/st0.h b/src/st/st0/st0.h index 1f1f069faa..39e1864f20 100644 --- a/src/st/st0/st0.h +++ b/src/st/st0/st0.h @@ -56,7 +56,6 @@ extern const char* D_801A7984; extern const char* D_801A7990; extern const char* D_801A799C; -extern PfnEntityUpdate PfnEntityUpdates[]; extern bool g_isSecretStairsButtonPressed; extern bool g_isDraculaFirstFormDefeated; diff --git a/src/st/wrp/create_entity.c b/src/st/wrp/create_entity.c index 6159c30f12..6b0ae8edd8 100644 --- a/src/st/wrp/create_entity.c +++ b/src/st/wrp/create_entity.c @@ -1,2 +1,4 @@ // SPDX-License-Identifier: AGPL-3.0-or-later +#include "wrp.h" +#include "../pfn_entity_update.h" #include "../create_entity.h" diff --git a/src/st/wrp/e_init.c b/src/st/wrp/e_init.c index 2a4c25176d..12aa41e361 100644 --- a/src/st/wrp/e_init.c +++ b/src/st/wrp/e_init.c @@ -10,7 +10,7 @@ void EntityGreyPuff(Entity*); void EntityWarpRoom(Entity*); void EntityWarpSmallRocks(Entity*); void EntityPrizeDrop(Entity*); -PfnEntityUpdate PfnEntityUpdates[] = { +PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = { EntityBreakable, EntityExplosion, EntityPrizeDrop, EntityDamageDisplay, EntityRedDoor, EntityIntenseExplosion, EntitySoulStealOrb, EntityRoomForeground, EntityStageNamePopup, diff --git a/src/st/wrp/e_misc.c b/src/st/wrp/e_misc.c index 21b3f2da07..3a4d16f42d 100644 --- a/src/st/wrp/e_misc.c +++ b/src/st/wrp/e_misc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "wrp.h" +#include "../pfn_entity_update.h" #define HEART_DROP_CASTLE_FLAG 280 #include "../e_misc.h" diff --git a/src/st/wrp_psp/create_entity.c b/src/st/wrp_psp/create_entity.c index e03c229c4b..c8a5255f90 100644 --- a/src/st/wrp_psp/create_entity.c +++ b/src/st/wrp_psp/create_entity.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "../wrp/wrp.h" +#include "../pfn_entity_update.h" static u16* g_LayoutObjHorizontal; static u16* g_LayoutObjVertical; diff --git a/src/st/wrp_psp/st_init_wrp.c b/src/st/wrp_psp/st_init_wrp.c index ea3ebac07e..c0763e9fd0 100644 --- a/src/st/wrp_psp/st_init_wrp.c +++ b/src/st/wrp_psp/st_init_wrp.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later #include "../wrp/wrp.h" +#include "../pfn_entity_update.h" // entity table to allocate new entities extern PfnEntityUpdate* D_08C6BC30;