mirror of
https://github.com/pmret/papermario.git
synced 2024-11-09 12:32:38 +01:00
Merge pull request #93 from pixel-stuck/fixup_types
add list types and fix code that uses them
This commit is contained in:
commit
6b1ca37bc6
@ -115,6 +115,8 @@ typedef struct Npc {
|
||||
/* 0x0AB */ char unk_AB[661];
|
||||
} Npc; // size = 0x340
|
||||
|
||||
typedef Npc* NpcList[MAX_NPCS];
|
||||
|
||||
typedef struct PlayerData {
|
||||
/* 0x000 */ s8 bootsLevel;
|
||||
/* 0x001 */ s8 hammerLevel;
|
||||
@ -204,6 +206,8 @@ typedef struct Trigger {
|
||||
/* 0x34 */ ScriptID runningScriptID;
|
||||
} Trigger; // size = 0x38
|
||||
|
||||
typedef Trigger* TriggerList[MAX_TRIGGERS];
|
||||
|
||||
typedef struct ScriptInstance {
|
||||
/* 0x000 */ u8 state;
|
||||
/* 0x001 */ u8 currentArgc;
|
||||
@ -271,6 +275,10 @@ typedef struct Entity {
|
||||
/* 0xB1 */ char unk_B1[71];
|
||||
} Entity; // size = 0xF8
|
||||
|
||||
typedef Entity* EntityList[MAX_ENTITIES];
|
||||
|
||||
typedef UNK_TYPE* DynamicEntityList[MAX_DYNAMIC_ENTITIES];
|
||||
|
||||
typedef struct StaticEntityData {
|
||||
/* 0x00 */ s16 flags;
|
||||
/* 0x02 */ s16 argSize;
|
||||
@ -364,6 +372,7 @@ typedef struct UiStatus {
|
||||
/* 0x68 */ s32 iconIndex13;
|
||||
/* 0x6C */ s8 unk_6C[4];
|
||||
} UiStatus; // size = 0x70
|
||||
|
||||
typedef struct Collider {
|
||||
/* 0x00 */ s32 flags;
|
||||
/* 0x04 */ s16 nextSibling;
|
||||
@ -672,6 +681,8 @@ typedef struct Model {
|
||||
/* 0xAA */ char unk_AA[6];
|
||||
} Model; // size = 0xB0
|
||||
|
||||
typedef Model* ModelList[MAX_MODELS];
|
||||
|
||||
typedef struct AnimatedMesh {
|
||||
/* 0x000 */ s32 flags;
|
||||
/* 0x004 */ u8 renderMode;
|
||||
@ -921,6 +932,8 @@ typedef struct Shadow {
|
||||
/* 0x28 */ char unk_28[80];
|
||||
} Shadow; // size = 0x78
|
||||
|
||||
typedef Shadow* ShadowList[MAX_SHADOWS];
|
||||
|
||||
typedef struct PushBlockGrid {
|
||||
/* 0x00 */ s8* cells;
|
||||
/* 0x04 */ u8 numCellsX;
|
||||
|
@ -23,7 +23,13 @@
|
||||
#define MAX_MAPVARS 16
|
||||
#define MAX_MAPFLAGS 3
|
||||
|
||||
#define MAX_MODELS 256
|
||||
#define MAX_SCRIPTS 128
|
||||
#define MAX_NPCS 64
|
||||
#define MAX_TRIGGERS 64
|
||||
#define MAX_SHADOWS 60
|
||||
#define MAX_ENTITIES 30
|
||||
#define MAX_DYNAMIC_ENTITIES 16
|
||||
|
||||
//NOTE: SCRIPT_ALLOC is probably not quite correct, but this is the closest thing to matching for the functions its used in. Needs more work.
|
||||
#define SCRIPT_ALLOC(new, index) \
|
||||
|
@ -38,30 +38,31 @@ extern s32 gScriptIndexList[MAX_SCRIPTS];
|
||||
|
||||
extern s32 gMoveScriptTable[][4];
|
||||
|
||||
extern Model* gWorldModelList[256];
|
||||
extern Model* gBattleModelList[256];
|
||||
extern Model** gCurrentModelListPtr[256];
|
||||
extern ModelList gWorldModelList;
|
||||
extern ModelList gBattleModelList;
|
||||
extern ModelList* gCurrentModelListPtr;
|
||||
|
||||
// TODO: potentially a display list, figure this out
|
||||
extern u32* gWorldModelSpecialDls[32];
|
||||
extern u32* gBattleModelSpecialDls[32];
|
||||
extern u32** gCurrentModelSpecialDlsPtr[32];
|
||||
|
||||
extern Entity* gWorldEntityList[30];
|
||||
extern Entity* gBattleEntityList[30];
|
||||
extern Entity** gCurrentEntityListPtr[30];
|
||||
extern EntityList gWorldEntityList;
|
||||
extern EntityList gBattleEntityList;
|
||||
extern EntityList* gCurrentEntityListPtr;
|
||||
extern s32 gLastCreatedEntityIndex;
|
||||
|
||||
extern UNK_TYPE* gWorldDynamicEntityList[16];
|
||||
extern UNK_TYPE* gBattleDynamicEntityList[16];
|
||||
extern UNK_TYPE*** gCurrentDynamicEntityListPtr;
|
||||
extern DynamicEntityList gWorldDynamicEntityList;
|
||||
extern DynamicEntityList gBattleDynamicEntityList;
|
||||
extern DynamicEntityList* gCurrentDynamicEntityListPtr;
|
||||
|
||||
extern Npc* gWorldNpcList[64];
|
||||
extern Npc* gBattleNpcList[64];
|
||||
extern Npc** gCurrentNpcListPtr[64];
|
||||
extern NpcList gWorldNpcList;
|
||||
extern NpcList gBattleNpcList;
|
||||
extern NpcList* gCurrentNpcListPtr;
|
||||
|
||||
extern Shadow* gWorldShadowList[60];
|
||||
extern Shadow* gBattleShadowList[60];
|
||||
extern Shadow** gCurrentShadowListPtr[60];
|
||||
extern ShadowList gWorldShadowList;
|
||||
extern ShadowList gBattleShadowList;
|
||||
extern ShadowList* gCurrentShadowListPtr;
|
||||
|
||||
extern Camera gCameras[4];
|
||||
extern s32 gCurrentCameraID;
|
||||
@ -89,9 +90,9 @@ extern PrintContext* D_802DB268;
|
||||
|
||||
// Triggers
|
||||
extern s16 gTriggerCount;
|
||||
extern Trigger* gTriggerList1[64];
|
||||
extern Trigger* gTriggerList2[64];
|
||||
extern Trigger** gCurrentTriggerListPtr[64];
|
||||
extern TriggerList gTriggerList1;
|
||||
extern TriggerList gTriggerList2;
|
||||
extern TriggerList* gCurrentTriggerListPtr;
|
||||
|
||||
// Map transition data. Should probably be a struct
|
||||
extern u16 gMapTransitionAlpha;
|
||||
|
@ -34,24 +34,24 @@ Shadow* get_shadow_by_index(s32 index) {
|
||||
return (*gCurrentShadowListPtr)[index & 0xFFF];
|
||||
}
|
||||
|
||||
Entity** get_entity_list(void) {
|
||||
Entity** ret;
|
||||
EntityList* get_entity_list(void) {
|
||||
EntityList* ret;
|
||||
|
||||
if (!GAME_STATUS->isBattle) {
|
||||
ret = gWorldEntityList;
|
||||
ret = &gWorldEntityList;
|
||||
} else {
|
||||
ret = gBattleEntityList;
|
||||
ret = &gBattleEntityList;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Shadow** get_shadow_list(void) {
|
||||
Shadow** ret;
|
||||
ShadowList* get_shadow_list(void) {
|
||||
ShadowList* ret;
|
||||
|
||||
if (!GAME_STATUS->isBattle) {
|
||||
ret = gWorldShadowList;
|
||||
ret = &gWorldShadowList;
|
||||
} else {
|
||||
ret = gBattleShadowList;
|
||||
ret = &gBattleShadowList;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ INCLUDE_ASM(s32, "code_dbd70_len_700", clear_trigger_data);
|
||||
|
||||
void init_trigger_list(void) {
|
||||
if (!GAME_STATUS->isBattle) {
|
||||
*gCurrentTriggerListPtr = gTriggerList1;
|
||||
gCurrentTriggerListPtr = &gTriggerList1;
|
||||
} else {
|
||||
*gCurrentTriggerListPtr = gTriggerList2;
|
||||
gCurrentTriggerListPtr = &gTriggerList2;
|
||||
}
|
||||
|
||||
gTriggerCount = 0;
|
||||
@ -22,16 +22,17 @@ INCLUDE_ASM(s32, "code_dbd70_len_700", update_triggers);
|
||||
|
||||
void delete_trigger(Trigger* toDelete) {
|
||||
s32 i;
|
||||
TriggerList** currentTriggerListPtr = &gCurrentTriggerListPtr;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gCurrentTriggerListPtr); i++) {
|
||||
if ((*gCurrentTriggerListPtr)[i] == toDelete) {
|
||||
for (i = 0; i < MAX_TRIGGERS; i++) {
|
||||
if ((**currentTriggerListPtr)[i] == toDelete) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i < ARRAY_COUNT(gCurrentTriggerListPtr)) {
|
||||
heap_free((*gCurrentTriggerListPtr)[i]);
|
||||
(*gCurrentTriggerListPtr)[i] = NULL;
|
||||
if (i < MAX_TRIGGERS) {
|
||||
heap_free((**currentTriggerListPtr)[i]);
|
||||
(**currentTriggerListPtr)[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +49,7 @@ s32 func_80145CE8(s32 arg0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gCurrentTriggerListPtr); i++) {
|
||||
for (i = 0; i < MAX_TRIGGERS; i++) {
|
||||
Trigger* trigger = (*gCurrentTriggerListPtr)[i];
|
||||
|
||||
if ((trigger != NULL) &&
|
||||
|
Loading…
Reference in New Issue
Block a user