From 7e677d4596cc28e4a9bd5aeb9d0a1f779583eadf Mon Sep 17 00:00:00 2001 From: MysterD Date: Fri, 1 Apr 2022 17:59:40 -0700 Subject: [PATCH] Fixed up DynOS collision files --- data/dynos_col_load.cpp | 5 ++++- data/dynos_col_write.cpp | 1 + data/dynos_gfx_write.cpp | 4 ++++ .../big-paddle/actors/big_paddle_collision.col | Bin 409 -> 410 bytes 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/data/dynos_col_load.cpp b/data/dynos_col_load.cpp index 62b83e2d..720e5e9a 100644 --- a/data/dynos_col_load.cpp +++ b/data/dynos_col_load.cpp @@ -26,7 +26,10 @@ DataNode* DynOS_Col_LoadFromBinary(const SysPath &aPackFolder, const SysPath _Filename = fstring("%s/%s.col", aPackFolder.begin(), aCollisionName); FILE *_File = fopen(_Filename.c_str(), "rb"); if (_File) { - collisionNode = LoadCollisionData(_File); + u8 type = ReadBytes(_File); + if (type == DATA_TYPE_COLLISION) { + collisionNode = LoadCollisionData(_File); + } fclose(_File); } diff --git a/data/dynos_col_write.cpp b/data/dynos_col_write.cpp index 66041143..e18b5026 100644 --- a/data/dynos_col_write.cpp +++ b/data/dynos_col_write.cpp @@ -8,6 +8,7 @@ static void WriteCollisionData(FILE* aFile, GfxData* aGfxData, DataNodemData) return; // Name + WriteBytes(aFile, DATA_TYPE_COLLISION); aNode->mName.Write(aFile); // Data diff --git a/data/dynos_gfx_write.cpp b/data/dynos_gfx_write.cpp index 07ddc253..6b341a10 100644 --- a/data/dynos_gfx_write.cpp +++ b/data/dynos_gfx_write.cpp @@ -313,6 +313,10 @@ void DynOS_Gfx_Free(GfxData* aGfxData) { Delete(_Node->mData); Delete(_Node); } + for (auto& _Node : aGfxData->mCollisions) { + Delete(_Node->mData); + Delete(_Node); + } Delete(aGfxData); } } diff --git a/docs/lua/examples/big-paddle/actors/big_paddle_collision.col b/docs/lua/examples/big-paddle/actors/big_paddle_collision.col index 4a76fd329fa80390f98a20836f5029d2c51a13ca..13462b642cd423a03594a90002fce8434f3680c4 100644 GIT binary patch delta 9 QcmbQqJd2r;d&5jd01Z9@kN^Mx delta 8 PcmbQmJd=4N<4i^X42%MX