diff --git a/include/game/hsfformat.h b/include/game/hsfformat.h
index 875b6725..fa43d0ae 100644
--- a/include/game/hsfformat.h
+++ b/include/game/hsfformat.h
@@ -3,6 +3,17 @@
#include "dolphin.h"
+typedef struct hsf_vector3f {
+ float x;
+ float y;
+ float z;
+} HsfVector3f;
+
+typedef struct hsf_vector2f {
+ float x;
+ float y;
+} HsfVector2f;
+
typedef struct hsf_section {
s32 ofs;
s32 count;
@@ -88,7 +99,7 @@ typedef struct hsf_material {
typedef struct hsf_vertex_buf {
char *name;
- u32 count;
+ s32 count;
void *data;
} HsfVertexBuf;
@@ -105,12 +116,6 @@ typedef struct hsf_face {
};
} HSFFace;
-typedef struct hsf_face_buf {
- char *name;
- u32 count;
- HSFFace *data;
-} HsfFaceBuf;
-
typedef struct hsf_const_data {
u32 flags;
u8 unk[64];
@@ -122,12 +127,8 @@ typedef struct hsf_transform {
Vec scale;
} HsfTransform;
-typedef struct hsf_object {
- char *name;
- u32 type;
- HsfConstData *constData;
- u32 flags;
- u32 idx;
+typedef struct hsf_object_data {
+ struct hsf_object *parent;
u32 childrenCount;
struct hsf_object **children;
HsfTransform base;
@@ -135,7 +136,7 @@ typedef struct hsf_object {
Vec min;
Vec max;
u8 unk[136];
- HsfFaceBuf *face;
+ HsfVertexBuf *face;
HsfVertexBuf *vertex;
HsfVertexBuf *normal;
HsfVertexBuf *st;
@@ -143,6 +144,14 @@ typedef struct hsf_object {
HsfMaterial *material;
HsfAttribute *attribute;
u8 unk2[36];
+} HsfObjectData;
+
+typedef struct hsf_object {
+ char *name;
+ u32 type;
+ HsfConstData *constData;
+ u32 flags;
+ HsfObjectData data;
} HsfObject;
typedef struct hsf_cenv {
@@ -212,7 +221,7 @@ typedef struct hsf_data {
HsfVertexBuf *normal;
HsfVertexBuf *st;
HsfVertexBuf *color;
- HsfFaceBuf *face;
+ HsfVertexBuf *face;
HsfBitmap *bitmap;
HsfPalette *palette;
HsfObject *root;
diff --git a/src/game/hsfload.c b/src/game/hsfload.c
index e6f69db1..8ce0c687 100644
--- a/src/game/hsfload.c
+++ b/src/game/hsfload.c
@@ -223,7 +223,6 @@ static void SceneLoad(void)
}
}
-
static void ColorLoad(void)
{
s32 i;
@@ -250,6 +249,113 @@ static void ColorLoad(void)
}
}
+static void VertexLoad(void)
+{
+ s32 i, j;
+ HsfVertexBuf *file_vertex;
+ HsfVertexBuf *new_vertex;
+ void *data;
+ HsfVector3f *data_elem;
+ void *temp_data;
+
+ if(head.vertex.count) {
+ vtxtop = file_vertex = (HsfVertexBuf *)((u32)fileptr+head.vertex.ofs);
+ data = (void *)&file_vertex[head.vertex.count];
+ for(i=0; i
count; j++) {
+ data_elem = (HsfVector3f *)(((u32)data)+((u32)file_vertex->data)+(j*sizeof(HsfVector3f)));
+ }
+ }
+ new_vertex = vtxtop;
+ Model.vertex = new_vertex;
+ Model.vertexCnt = head.vertex.count;
+ file_vertex = (HsfVertexBuf *)((u32)fileptr+head.vertex.ofs);
+ VertexDataTop = data = (void *)&file_vertex[head.vertex.count];
+ for(i=0; idata;
+ new_vertex->count = file_vertex->count;
+ new_vertex->name = SetName((u32 *)&file_vertex->name);
+ new_vertex->data = (void *)((u32)data+(u32)temp_data);
+ for(j=0; jcount; j++) {
+ data_elem = (HsfVector3f *)(((u32)data)+((u32)temp_data)+(j*sizeof(HsfVector3f)));
+ ((HsfVector3f *)new_vertex->data)[j].x = data_elem->x;
+ ((HsfVector3f *)new_vertex->data)[j].y = data_elem->y;
+ ((HsfVector3f *)new_vertex->data)[j].z = data_elem->z;
+ }
+ }
+ }
+}
+
+static void NormalLoad(void)
+{
+ s32 i, j;
+ void *temp_data;
+ HsfVertexBuf *file_normal;
+ HsfVertexBuf *new_normal;
+ HsfVertexBuf *temp_normal;
+ void *data;
+
+
+ if(head.normal.count) {
+ s32 cenv_count = head.cenv.count;
+ temp_normal = file_normal = (HsfVertexBuf *)((u32)fileptr+head.normal.ofs);
+ data = (void *)&file_normal[head.normal.count];
+ new_normal = temp_normal;
+ Model.normal = new_normal;
+ Model.normalCnt = head.normal.count;
+ file_normal = (HsfVertexBuf *)((u32)fileptr+head.normal.ofs);
+ NormalDataTop = data = (void *)&file_normal[head.normal.count];
+ for(i=0; idata;
+ new_normal->count = file_normal->count;
+ new_normal->name = SetName((u32 *)&file_normal->name);
+ new_normal->data = (void *)((u32)data+(u32)temp_data);
+ }
+ }
+}
+
+static void STLoad(void)
+{
+ s32 i, j;
+ HsfVertexBuf *file_st;
+ HsfVertexBuf *temp_st;
+ HsfVertexBuf *new_st;
+ void *data;
+ HsfVector2f *data_elem;
+ void *temp_data;
+
+ if(head.st.count) {
+ temp_st = file_st = (HsfVertexBuf *)((u32)fileptr+head.st.ofs);
+ data = (void *)&file_st[head.st.count];
+ for(i=0; icount; j++) {
+ data_elem = (HsfVector2f *)(((u32)data)+((u32)file_st->data)+(j*sizeof(HsfVector2f)));
+ }
+ }
+ new_st = temp_st;
+ Model.st = new_st;
+ Model.stCnt = head.st.count;
+ file_st = (HsfVertexBuf *)((u32)fileptr+head.st.ofs);
+ data = (void *)&file_st[head.st.count];
+ for(i=0; idata;
+ new_st->count = file_st->count;
+ new_st->name = SetName((u32 *)&file_st->name);
+ new_st->data = (void *)((u32)data+(u32)temp_data);
+ for(j=0; jcount; j++) {
+ data_elem = (HsfVector2f *)(((u32)data)+((u32)temp_data)+(j*sizeof(HsfVector2f)));
+ ((HsfVector2f *)new_st->data)[j].x = data_elem->x;
+ ((HsfVector2f *)new_st->data)[j].y = data_elem->y;
+ }
+ }
+ }
+}
+
+static void FaceLoad(void)
+{
+
+}
+
static HsfBitmap *SearchBitmapPtr(s32 id)
{
HsfBitmap *bitmap;