Compare commits

...

2 Commits

21 changed files with 101 additions and 76 deletions

View File

@ -17,3 +17,17 @@ struct Vec4<T> {
T z;
T w;
};
struct Plane {
float x;
float y;
float z;
float d;
};
struct DPlane {
double x;
double y;
double z;
double d;
};

View File

@ -25,8 +25,10 @@
#include "db_files/chunks/FILE_TYPE.hexpat"
#include "db_files/chunks/FLOW_TEX.hexpat"
#include "db_files/chunks/FOGZONEVAR.hexpat"
#include "db_files/chunks/HotRegions.hexpat"
#include "db_files/chunks/MAPISRC.hexpat"
#include "db_files/chunks/Mission_GameSysEAX.hexpat"
#include "db_files/chunks/MultiBrush.hexpat"
#include "db_files/chunks/RENDPARAMS.hexpat"
#include "db_files/chunks/ROOM_DB.hexpat"
#include "db_files/chunks/ROOM_EAX.hexpat"

View File

@ -1,53 +1,5 @@
#pragma once
struct Version {
u32 major;
u32 minor;
};
struct FileHeader {
u32 toc_offset;
Version version;
padding[256];
u32 deadbeef;
};
struct TOCEntry {
char name[12];
u32 offset;
u32 size;
};
struct TableOfContents {
u32 item_count;
TOCEntry items[item_count];
};
struct ChunkHeader {
char name[12];
Version version;
padding[4];
};
struct Chunk<T> {
ChunkHeader header;
T data;
};
struct Plane {
float x;
float y;
float z;
float d;
};
struct DPlane {
double x;
double y;
double z;
double d;
};
namespace NameNum {
struct Tag {
s32 value;

View File

@ -1,9 +1,9 @@
#pragma once
#include <std/string.pat>
#include <std/io.pat>
#include "FileBase.hexpat"
#include "lgtypes.hexpat"
#include "db_files/FileBase.pat"
#include "db_files/AllChunks.pat"
FileHeader file_header @ 0x0;
@ -40,10 +40,10 @@ Chunk<FileType> file_type @ get_offset(toc, "FILE_TYPE");
Chunk<FlowTex> flow_tex @ get_offset(toc, "FLOW_TEX");
Chunk<FogZoneVar> fog_zone_var @ get_offset(toc, "FOGZONEVAR");
Chunk<AccousticsProperty> gamesys_eax @ get_offset(toc, "GameSysEAX");
Chunk<NameNum> hot_regions @ get_offset(toc, "HotRegions");
Chunk<HotRegions> hot_regions @ get_offset(toc, "HotRegions");
Chunk<MapISrc> map_i_src @ get_offset(toc, "MAPISRC");
Chunk<AccousticsProperty> mission_eax @ get_offset(toc, "MissionEAX");
Chunk<NameNum> multibrush @ get_offset(toc, "MultiBrush");
Chunk<MultiBrush> multibrush @ get_offset(toc, "MultiBrush");
Chunk<RendParams> rend_params @ get_offset(toc, "RENDPARAMS");
Chunk<RoomDb> room_db @ get_offset(toc, "ROOM_DB");
Chunk<RoomEax> room_eax @ get_offset(toc, "ROOM_EAX");

View File

@ -0,0 +1,48 @@
#pragma once
struct Version {
u32 major;
u32 minor;
};
struct FileHeader {
u32 toc_offset;
Version version;
padding[256];
u32 deadbeef;
};
struct TOCEntry {
char name[12];
u32 offset;
u32 size;
};
struct TableOfContents {
u32 item_count;
TOCEntry items[item_count];
};
struct ChunkHeader {
char name[12];
Version version;
padding[4];
};
struct Chunk<T> {
ChunkHeader header;
T data;
};
fn get_toc_entry(TableOfContents toc, str entry_name) {
for (u32 i = 0, i < toc.item_count, i = i + 1) {
if (std::string::starts_with(toc.items[i].name, entry_name)) {
return toc.items[i];
}
}
};
fn get_offset(TableOfContents toc, str entry_name) {
TOCEntry entry = get_toc_entry(toc, entry_name);
return entry.offset;
};

View File

@ -1,14 +0,0 @@
#pragma once
fn get_toc_entry(TableOfContents toc, str entry_name) {
for (u32 i = 0, i < toc.item_count, i = i + 1) {
if (std::string::starts_with(toc.items[i].name, entry_name)) {
return toc.items[i];
}
}
};
fn get_offset(TableOfContents toc, str entry_name) {
TOCEntry entry = get_toc_entry(toc, entry_name);
return entry.offset;
};

View File

@ -1,7 +1,6 @@
#pragma once
#include "Common.hexpat"
#include "lgtypes.hexpat"
namespace AiRoomDb {
struct Cell {

View File

@ -1,6 +1,6 @@
#pragma once
#include "lgtypes.hexpat"
#include "Common.hexpat"
using Br;
using Grid;

View File

@ -1,6 +1,6 @@
#pragma once
#include "lgtypes.hexpat"
#include "Common.hexpat"
struct CellMotionPortal {
Vec3<float> center;

View File

@ -1,5 +1,7 @@
#pragma once
#include "Common.hexpat"
struct CelObjVar {
bool enable_object;
padding[3];

View File

@ -1,6 +1,7 @@
#pragma once
#include "lgtypes.hexpat"
#include "Common.hexpat"
#include "db_files/Common.hexpat"
using ColorSettings;

View File

@ -1,5 +1,7 @@
#pragma once
#include "Common.hexpat"
struct DistantArtVar {
bool enable_distant_art;
padding[3];

View File

@ -1,6 +1,6 @@
#pragma once
#include "lgtypes.hexpat"
#include "Common.hexpat"
struct FogZone {
padding[1];

View File

@ -0,0 +1,7 @@
#pragma once
#include "db_files/Common.hexpat"
struct HotRegions {
NameNum::Table name_num;
};

View File

@ -0,0 +1,7 @@
#pragma once
#include "db_files/Common.hexpat"
struct MultiBrush {
NameNum::Table name_num;
};

View File

@ -1,6 +1,6 @@
#pragma once
#include "lgtypes.hexpat"
#include "Common.hexpat"
enum SunlightMode : s32 {
SingleUnshadowed = 0x0,

View File

@ -1,6 +1,6 @@
#pragma once
#include "lgtypes.hexpat"
#include "Common.hexpat"
struct RoomPortal {
s32 id;

View File

@ -1,6 +1,7 @@
#pragma once
#include "lgtypes.hexpat"
#include "Common.hexpat"
#include "db_files/Common.hexpat"
struct SkyObjVar {
bool enable_new_sky;

View File

@ -1,5 +1,7 @@
#pragma once
#include "Common.hexpat"
struct RGBA {
Vec3<u8> rgb;
padding[1];

View File

@ -1,5 +1,7 @@
#pragma once
#include "Common.hexpat"
enum Precipitation : u32 {
Snow = 0x0,
Rain = 0x1,

View File

@ -4,7 +4,7 @@
#include <std/math.pat>
#include <std/core.pat>
#include <std/io.pat>
#include "FileBase.hexpat"
#include "Common.hexpat"
using WrHeader;
using WrCell;