From 48d707f23cafe6903e2bcf800fd2f7480ecdab1a Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Mon, 4 Dec 2023 10:43:52 -0600 Subject: [PATCH] Match ObjectLoad --- include/game/hsfformat.h | 2 +- src/game/hsfload.c | 62 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/include/game/hsfformat.h b/include/game/hsfformat.h index a8a0fb33..f2a9412c 100644 --- a/include/game/hsfformat.h +++ b/include/game/hsfformat.h @@ -189,7 +189,7 @@ typedef struct hsf_object_data { typedef struct hsf_object { char *name; - u32 type; + s32 type; HsfConstData *constData; u32 flags; HsfObjectData data; diff --git a/src/game/hsfload.c b/src/game/hsfload.c index 42b07a83..7c3f0322 100644 --- a/src/game/hsfload.c +++ b/src/game/hsfload.c @@ -412,7 +412,6 @@ static void DispObject(HsfObject *parent, HsfObject *object) HsfCluster *cluster; } temp; - temp.parent = parent; object->type = object->type; switch(object->type) { @@ -523,9 +522,7 @@ static void DispObject(HsfObject *parent, HsfObject *object) } } break; - - case 3: { HsfObjectData *data; @@ -619,6 +616,65 @@ static void DispObject(HsfObject *parent, HsfObject *object) } } +static inline void FixupObject(HsfObject *object) +{ + HsfObjectData *objdata_8; + HsfObjectData *objdata_7; + + s32 obj_type = object->type; + switch(obj_type) { + case 8: + { + objdata_8 = &object->data; + object->type = 8; + } + break; + + case 7: + { + objdata_7 = &object->data; + object->type = 7; + } + break; + + default: + break; + + } +} + +static void ObjectLoad(void) +{ + s32 i; + HsfObject *object; + HsfObject *new_object; + + + s32 obj_type; + + + + if(head.object.count) { + objtop = object = (HsfObject *)((u32)fileptr+head.object.ofs); + for(i=0; iname = SetName((u32 *)&object->name); + } + object = objtop; + for(i=0; idata.parent == -1) { + break; + } + } + DispObject(NULL, object); + Model.objectCnt = head.object.count; + object = objtop; + for(i=0; iobject;