sotn-decomp/include/stage.h
Luciano Ciccariello 533822ad76
Some checks are pending
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (i686, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-macos (Debug) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo) (push) Blocked by required conditions
Build C code / build-windows (Debug) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo) (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build Debug Module tool / build (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
WRP and CEN cohabitation (#1701)
Experimental piece of work I feel confident enough to submit. A few
things to take in consideration:

* The new `pfn_entity_updates.h` header aims to use the PSP variant of
`PfnEntityUpdates` and the two `g_pStObjLayout`, I just tweaked a bit
the code from `stage.h`
* Add overlay prefix to the PSX version of `PfnEntityUpdates` and the
two `g_pStObjLayout`
* Changed `wrp/create_entity` to `rwrp/create_entity` in RWRP because we
need the `RWRP_` prefix to be issued
* Remodernized the WRP header
* I am still not sure what's wrong with `g_HeartDropArray` in `warp.c`.
I am pretty sure it is a PSX bug. I opted for the PSP version

There's a `// PfnEntityUpdates = OVL_EXPORT(EntityUpdates);`. If you
uncomment and resolve the multiple definitions you will have the two
overlays linked. I still need to figure out how to handle the
`InitializeEntity` parameters in `e_init` without going mad with the
`#ifdef`.

Takeaways from the Xbox 360 build:

* `EntityBreakable` is different in every overlay, so we can use the
`OVL_EXPORT` in our decomp
* Every other function seem to be de-duplciated. For those functions
that are slightly different between overlays, the developers of the Xbox
port opted for `if (g_StageId == XYZ)`

Takeaways from the PSP build:

* god bless the psp
2024-10-13 22:15:19 +01:00

71 lines
1.5 KiB
C

#ifndef STAGE_H
#define STAGE_H
#define STAGE 0xCC
#include "common.h"
#include "game.h"
#include "items.h"
#include "objects.h"
#include "sfx.h"
typedef struct {
/* 0x0 */ u16 posX;
/* 0x2 */ u16 posY;
/* 0x4 */ u16 entityId;
/* 0x6 */ u16 entityRoomIndex;
/* 0x8 */ u16 params;
} LayoutEntity; // size = 0xA
typedef struct {
u16* layout;
TileDefinition* tileDef;
u32 params;
u16 zPriority;
u8 unkE;
u8 unkF;
} MyLayer;
typedef struct {
MyLayer* fg;
MyLayer* bg;
} MyRoomDef;
extern u16 g_ItemIconSlots[32];
/*
* Sets up layout arrays and initializes stage state to
* initial values.
*
* - Parameters:
* - objLayoutId - the room to initialize
*/
void InitRoomEntities(s32 objLayoutId);
/*
* An callback for notifying the stage that the
* viewport has changed.
*/
void UpdateRoomPosition();
void Update(void);
void HitDetection(void);
s32 Random();
void CreateEntityFromEntity(u16 entityId, Entity* source, Entity* entity);
void CreateEntityFromLayout(Entity* entity, LayoutEntity* initDesc);
void DestroyEntity(Entity*);
void DestroyEntitiesFromIndex(s16 index);
void MoveEntity();
void FallEntity(void);
Entity* AllocEntity(Entity* start, Entity* end);
// used by InitializeEntity to pre-fill certain entity fields
// cannot be declared as a struct, field order:
// animSet, animCurFrame, unk5A, palette, enemyID
typedef u16 EInit[5];
// InitializeEntity takes a EInit but treats it as a `u16[]`
void InitializeEntity(u16 arg0[]);
#endif