From 523f94206b6cab4e2457492cc7b10eae53b106d3 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Fri, 23 Aug 2024 15:37:15 +0100 Subject: [PATCH] Add ObjVec pattern --- MainChunks.md | 2 +- patterns/db_files/AllChunks.pat | 1 + patterns/db_files/DbFile.pat | 6 +++++- patterns/db_files/chunks/ObjVec.hexpat | 8 ++++++++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 patterns/db_files/chunks/ObjVec.hexpat diff --git a/MainChunks.md b/MainChunks.md index b6e3055..5e66fe7 100644 --- a/MainChunks.md +++ b/MainChunks.md @@ -36,7 +36,7 @@ - [X] MAPISRC - [X] MissionEAX - [X] MultiBrush -- [ ] ObjVec +- [X] ObjVec - [X] OBJ_MAP - [ ] PHYS_SYSTEM - [ ] PLAYER diff --git a/patterns/db_files/AllChunks.pat b/patterns/db_files/AllChunks.pat index a09a9f2..bb8836e 100644 --- a/patterns/db_files/AllChunks.pat +++ b/patterns/db_files/AllChunks.pat @@ -31,6 +31,7 @@ #include "db_files/chunks/Mission_GameSysEAX.hexpat" #include "db_files/chunks/MultiBrush.hexpat" #include "db_files/chunks/OBJ_MAP.hexpat" +#include "db_files/chunks/ObjVec.hexpat" #include "db_files/chunks/P$_.hexpat" #include "db_files/chunks/Relations.hexpat" #include "db_files/chunks/RENDPARAMS.hexpat" diff --git a/patterns/db_files/DbFile.pat b/patterns/db_files/DbFile.pat index 7bb753c..031911c 100644 --- a/patterns/db_files/DbFile.pat +++ b/patterns/db_files/DbFile.pat @@ -70,6 +70,7 @@ struct TOCEntry { ("MissionEAX"): Chunk mission_eax @ offset; ("MultiBrush"): Chunk multibrush @ offset; ("OBJ_MAP"): Chunk obj_map @ offset; + ("ObjVec"): Chunk obj_vec @ offset; ("Relations"): Chunk relations @ offset; ("RENDPARAMS"): Chunk rend_params @ offset; ("ROOM_DB"): Chunk room_db @ offset; @@ -92,10 +93,13 @@ struct TOCEntry { // if (std::string::starts_with(name, "LD$")) { // std::print("LD: {}", name); // } - if (std::string::starts_with(name, "L$")) { + else if (std::string::starts_with(name, "L$")) { Chunk link_chunk @ offset [[name(name)]]; // std::print("L: {}", name); } + else { + std::print("Didn't load chunk: {}", name); + } } } }; diff --git a/patterns/db_files/chunks/ObjVec.hexpat b/patterns/db_files/chunks/ObjVec.hexpat new file mode 100644 index 0000000..5228fb9 --- /dev/null +++ b/patterns/db_files/chunks/ObjVec.hexpat @@ -0,0 +1,8 @@ +#pragma once + +struct ObjVec { + s32 min_id; + s32 max_id; + s32 byte_count = (max_id - min_id) / 8; + u8 bitmap[byte_count] [[comment("Each bit indicates whether that ID is being used.")]]; +}; \ No newline at end of file