Compare commits
7 Commits
2f701c471b
...
dd2aeeb66d
Author | SHA1 | Date |
---|---|---|
Jarrod Doyle | dd2aeeb66d | |
Jarrod Doyle | 41797a0c17 | |
Jarrod Doyle | 7fa4db7f4f | |
Jarrod Doyle | b17ecb3f3d | |
Jarrod Doyle | 1979d85f58 | |
Jarrod Doyle | 6ad11c4af5 | |
Jarrod Doyle | 24b68df3b3 |
|
@ -29,6 +29,8 @@
|
||||||
#include "db_files/chunks/MAPISRC.hexpat"
|
#include "db_files/chunks/MAPISRC.hexpat"
|
||||||
#include "db_files/chunks/Mission_GameSysEAX.hexpat"
|
#include "db_files/chunks/Mission_GameSysEAX.hexpat"
|
||||||
#include "db_files/chunks/MultiBrush.hexpat"
|
#include "db_files/chunks/MultiBrush.hexpat"
|
||||||
|
#include "db_files/chunks/OBJ_MAP.hexpat"
|
||||||
|
#include "db_files/chunks/P$_.hexpat"
|
||||||
#include "db_files/chunks/RENDPARAMS.hexpat"
|
#include "db_files/chunks/RENDPARAMS.hexpat"
|
||||||
#include "db_files/chunks/ROOM_DB.hexpat"
|
#include "db_files/chunks/ROOM_DB.hexpat"
|
||||||
#include "db_files/chunks/ROOM_EAX.hexpat"
|
#include "db_files/chunks/ROOM_EAX.hexpat"
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <std/string.pat>
|
|
||||||
#include <std/io.pat>
|
|
||||||
|
|
||||||
#include "db_files/FileBase.pat"
|
|
||||||
#include "db_files/AllChunks.pat"
|
|
||||||
|
|
||||||
FileHeader file_header @ 0x0;
|
|
||||||
TableOfContents toc @ file_header.toc_offset;
|
|
||||||
|
|
||||||
TOCEntry brlist_toc = get_toc_entry(toc, "BRLIST");
|
|
||||||
TOCEntry scrmodules_toc = get_toc_entry(toc, "ScrModules");
|
|
||||||
|
|
||||||
Chunk<AiRoomDb::ChunkData> ai_room_db @ get_offset(toc, "AI_ROOM_DB");
|
|
||||||
Chunk<AiAcuitySets> ai_acuity_sets @ get_offset(toc, "AIACS");
|
|
||||||
Chunk<AiConverse> ai_conversations @ get_offset(toc, "AICONVERSE");
|
|
||||||
Chunk<AiCreatureSizes> ai_creature_sizes @ get_offset(toc, "AICRTSZ");
|
|
||||||
Chunk<AiGamesysPathOptions> ai_gamesys_path_options @ get_offset(toc, "AIGPTHVAR");
|
|
||||||
Chunk<AiHearStat> ai_hear_stat @ get_offset(toc, "AIHearStat");
|
|
||||||
Chunk<AiPathVar> ai_path_var @ get_offset(toc, "AIPATHVAR");
|
|
||||||
Chunk<AiSndTwk> ai_sound_tweaks @ get_offset(toc, "AISNDTWK");
|
|
||||||
Chunk<Ambient> ambient @ get_offset(toc, "AMBIENT");
|
|
||||||
Chunk<Bash> bash @ get_offset(toc, "BASH");
|
|
||||||
Chunk<BrHead> br_head @ get_offset(toc, "BRHEAD");
|
|
||||||
Chunk<BrList> br_list @ get_offset(toc, "BRLIST");
|
|
||||||
Chunk<BrushVersion> brush_version @ get_offset(toc, "BRVER");
|
|
||||||
Chunk<CellMotion> cell_motion @ get_offset(toc, "CELL_MOTION");
|
|
||||||
Chunk<CelObjVar> celestial_object_var_1 @ get_offset(toc, "CELOBJVAR1");
|
|
||||||
Chunk<CelObjVar> celestial_object_var_2 @ get_offset(toc, "CELOBJVAR2");
|
|
||||||
Chunk<CelObjVar> celestial_object_var_3 @ get_offset(toc, "CELOBJVAR3");
|
|
||||||
Chunk<CloudObjVar> cloud_object_var @ get_offset(toc, "CLOUDOBJVAR");
|
|
||||||
Chunk<DarkCombat> dark_combat @ get_offset(toc, "DARKCOMBAT");
|
|
||||||
Chunk<DarkMiss> dark_miss @ get_offset(toc, "DARKMISS");
|
|
||||||
Chunk<DistantArtVar> distant_art_var @ get_offset(toc, "DISTOBJVAR");
|
|
||||||
Chunk<DarkSettings> dark_settings @ get_offset(toc, "DRKSET");
|
|
||||||
Chunk<EnvMapVar> env_map_var @ get_offset(toc, "ENVMAPVAR");
|
|
||||||
Chunk<Family> family @ get_offset(toc, "FAMILY");
|
|
||||||
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<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<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");
|
|
||||||
Chunk<ScrModules::ChunkData> script_modules @ get_offset(toc, "ScrModules");
|
|
||||||
Chunk<SkyMode> sky_mode @ get_offset(toc, "SKYMODE");
|
|
||||||
Chunk<SkyObjVar> sky_object_var @ get_offset(toc, "SKYOBJVAR");
|
|
||||||
Chunk<MissionSongParams> mision_song_params @ get_offset(toc, "SONGPARAMS");
|
|
||||||
Chunk<StarObjVar> star_object_var @ get_offset(toc, "STAROBJVAR");
|
|
||||||
Chunk<TiList> ti_list @ get_offset(toc, "TILIST");
|
|
||||||
Chunk<TxList> texture_list @ get_offset(toc, "TXLIST");
|
|
||||||
Chunk<TexturePatchDatabase> texture_patch_database @ get_offset(toc, "TXTPAT_DB");
|
|
||||||
Chunk<WaterBanks> water_banks @ get_offset(toc, "WATERBANKS");
|
|
||||||
Chunk<WeatherVar> weather_var @ get_offset(toc, "WEATHERVAR");
|
|
||||||
Chunk<WrExt> world_rep @ get_offset(toc, "WREXT");
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
#pragma once
|
||||||
|
#pragma pattern_limit 262144
|
||||||
|
|
||||||
|
#include <std/string.pat>
|
||||||
|
#include <std/io.pat>
|
||||||
|
|
||||||
|
#include "db_files/AllChunks.pat"
|
||||||
|
|
||||||
|
struct Version {
|
||||||
|
u32 major;
|
||||||
|
u32 minor;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ChunkHeader {
|
||||||
|
char name[12];
|
||||||
|
Version version;
|
||||||
|
padding[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Chunk<T> {
|
||||||
|
ChunkHeader header;
|
||||||
|
T data;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FileHeader {
|
||||||
|
u32 toc_offset;
|
||||||
|
Version version;
|
||||||
|
padding[256];
|
||||||
|
u32 deadbeef;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TOCEntry {
|
||||||
|
char name[while($[$] != 0x00)];
|
||||||
|
$ = $ + 12 - std::string::length(name);
|
||||||
|
u32 offset;
|
||||||
|
u32 size;
|
||||||
|
u32 data_end = offset + size + 24;
|
||||||
|
|
||||||
|
match (name) {
|
||||||
|
("AI_ROOM_DB"): Chunk<AiRoomDb::ChunkData> ai_room_db @ offset;
|
||||||
|
("AIACS"): Chunk<AiAcuitySets> ai_acuity_sets @ offset;
|
||||||
|
("AICONVERSE"): Chunk<AiConverse> ai_conversations @ offset;
|
||||||
|
("AICRTSZ"): Chunk<AiCreatureSizes> ai_creature_sizes @ offset;
|
||||||
|
("AIGPTHVAR"): Chunk<AiGamesysPathOptions> ai_gamesys_path_options @ offset;
|
||||||
|
("AIHearStat"): Chunk<AiHearStat> ai_hear_stat @ offset;
|
||||||
|
("AIPATHVAR"): Chunk<AiPathVar> ai_path_var @ offset;
|
||||||
|
("AISNDTWK"): Chunk<AiSndTwk> ai_sound_tweaks @ offset;
|
||||||
|
("AMBIENT"): Chunk<Ambient> ambient @ offset;
|
||||||
|
("BASH"): Chunk<Bash> bash @ offset;
|
||||||
|
("BRHEAD"): Chunk<BrHead> br_head @ offset;
|
||||||
|
("BRLIST"): Chunk<BrList> br_list @ offset;
|
||||||
|
("BRVER"): Chunk<BrushVersion> brush_version @ offset;
|
||||||
|
("CELL_MOTION"): Chunk<CellMotion> cell_motion @ offset;
|
||||||
|
("CELOBJVAR1"): Chunk<CelObjVar> celestial_object_var_1 @ offset;
|
||||||
|
("CELOBJVAR2"): Chunk<CelObjVar> celestial_object_var_2 @ offset;
|
||||||
|
("CELOBJVAR3"): Chunk<CelObjVar> celestial_object_var_3 @ offset;
|
||||||
|
("CLOUDOBJVAR"): Chunk<CloudObjVar> cloud_object_var @ offset;
|
||||||
|
("DARKCOMBAT"): Chunk<DarkCombat> dark_combat @ offset;
|
||||||
|
("DARKMISS"): Chunk<DarkMiss> dark_miss @ offset;
|
||||||
|
("DISTOBJVAR"): Chunk<DistantArtVar> distant_art_var @ offset;
|
||||||
|
("DRKSET"): Chunk<DarkSettings> dark_settings @ offset;
|
||||||
|
("ENVMAPVAR"): Chunk<EnvMapVar> env_map_var @ offset;
|
||||||
|
("FAMILY"): Chunk<Family> family @ offset;
|
||||||
|
("FILE_TYPE"): Chunk<FileType> file_type @ offset;
|
||||||
|
("FLOW_TEX"): Chunk<FlowTex> flow_tex @ offset;
|
||||||
|
("FOGZONEVAR"): Chunk<FogZoneVar> fog_zone_var @ offset;
|
||||||
|
("GameSysEAX"): Chunk<AccousticsProperty> gamesys_eax @ offset;
|
||||||
|
("HotRegions"): Chunk<HotRegions> hot_regions @ offset;
|
||||||
|
("MAPISRC"): Chunk<MapISrc> map_i_src @ offset;
|
||||||
|
("MissionEAX"): Chunk<AccousticsProperty> mission_eax @ offset;
|
||||||
|
("MultiBrush"): Chunk<MultiBrush> multibrush @ offset;
|
||||||
|
("OBJ_MAP"): Chunk<ObjMap> obj_map @ offset;
|
||||||
|
("RENDPARAMS"): Chunk<RendParams> rend_params @ offset;
|
||||||
|
("ROOM_DB"): Chunk<RoomDb> room_db @ offset;
|
||||||
|
("ROOM_EAX"): Chunk<RoomEax> room_eax @ offset;
|
||||||
|
("ScrModules"): Chunk<ScrModules::ChunkData> script_modules @ offset;
|
||||||
|
("SKYMODE"): Chunk<SkyMode> sky_mode @ offset;
|
||||||
|
("SKYOBJVAR"): Chunk<SkyObjVar> sky_object_var @ offset;
|
||||||
|
("SONGPARAMS"): Chunk<MissionSongParams> mision_song_params @ offset;
|
||||||
|
("STAROBJVAR"): Chunk<StarObjVar> star_object_var @ offset;
|
||||||
|
("TILIST"): Chunk<TiList> ti_list @ offset;
|
||||||
|
("TXLIST"): Chunk<TxList> texture_list @ offset;
|
||||||
|
("TXTPAT_DB"): Chunk<TexturePatchDatabase> texture_patch_database @ offset;
|
||||||
|
("WATERBANKS"): Chunk<WaterBanks> water_banks @ offset;
|
||||||
|
("WEATHERVAR"): Chunk<WeatherVar> weather_var @ offset;
|
||||||
|
("WREXT"): Chunk<WrExt> world_rep @ offset;
|
||||||
|
(_): {
|
||||||
|
if (std::string::starts_with(name, "P$")) {
|
||||||
|
Chunk<PropertyMap> property_chunk @ offset [[name(name)]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TableOfContents {
|
||||||
|
u32 item_count;
|
||||||
|
TOCEntry items[item_count];
|
||||||
|
};
|
||||||
|
|
||||||
|
FileHeader file_header @ 0x0;
|
||||||
|
TableOfContents toc @ file_header.toc_offset;
|
|
@ -1,48 +0,0 @@
|
||||||
#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;
|
|
||||||
};
|
|
|
@ -9,26 +9,46 @@ using BrMedia;
|
||||||
using BrType;
|
using BrType;
|
||||||
|
|
||||||
struct BrList {
|
struct BrList {
|
||||||
Br brushes[while($ < brlist_toc.offset + brlist_toc.size)];
|
u32 max = parent.parent.data_end;
|
||||||
|
Br brushes[while($ < max)];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Potentially rename fields depending on the media type?
|
// There's one core struct here, but fields are used differently for non-terrain brushes
|
||||||
|
// Lights:
|
||||||
|
// - primal_id -> Object Handle (ID + 1?)
|
||||||
|
// - size -> (Brightness, Hue, Saturation)
|
||||||
|
// - num_faces -> Type (omni/spotlight) (Spotlight doesn't actually seem to be used by the engine)
|
||||||
|
//
|
||||||
|
// Areas:
|
||||||
|
// - texture_id -> Bitfield (Active = 1, MeOnly = 2) (these can both be true)
|
||||||
|
//
|
||||||
|
// Objects:
|
||||||
|
// - primal_id -> Object ID
|
||||||
|
// - num_faces -> This is always 255/-1, not sure what it means
|
||||||
|
//
|
||||||
|
// Flow:
|
||||||
|
// - texture_id -> Flow Group ID
|
||||||
|
//
|
||||||
|
// Rooms:
|
||||||
|
// - primal_id -> Concrete room ID (shared between all rooms using the same archetype)
|
||||||
|
// - texture_id -> Secondary room ID (unique to every room brush)
|
||||||
struct Br {
|
struct Br {
|
||||||
s16 br_id;
|
s16 brush_id;
|
||||||
s16 timestamp;
|
s16 timestamp;
|
||||||
BrType primal_id;
|
BrType primal_id;
|
||||||
s16 tx_id;
|
s16 texture_id;
|
||||||
BrMedia media;
|
BrMedia media;
|
||||||
s8 flags; // potential bitfield
|
s8 flags; // potential bitfield
|
||||||
Vec3<float> pos; // Brush center
|
Vec3<float> position; // Brush center
|
||||||
Vec3<float> sz; // Brush extents (dimensions)
|
Vec3<float> size; // Brush extents (dimensions)
|
||||||
Vec3<u16> ang;
|
Vec3<u16> angle;
|
||||||
s16 cur_face;
|
s16 current_face_index;
|
||||||
Grid grid;
|
Grid grid_settings;
|
||||||
u8 num_faces;
|
u8 num_faces;
|
||||||
|
// The next 4 values are selection/multibrush related
|
||||||
s8 edge;
|
s8 edge;
|
||||||
s8 point;
|
s8 point;
|
||||||
s8 use_flg;
|
s8 use_flag;
|
||||||
s8 group_id;
|
s8 group_id;
|
||||||
padding[4];
|
padding[4];
|
||||||
// We have to do a double cast here because otherwise the s8 for non-terrain brushes is just wrong??
|
// We have to do a double cast here because otherwise the s8 for non-terrain brushes is just wrong??
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
struct ObjMapElement {
|
||||||
|
s32 value;
|
||||||
|
s32 name_len;
|
||||||
|
if (name_len != -1) {
|
||||||
|
char name[name_len];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ObjMap {
|
||||||
|
u32 max = parent.parent.data_end;
|
||||||
|
ObjMapElement objects[while($ < max)];
|
||||||
|
};
|
|
@ -0,0 +1,14 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Common.hexpat"
|
||||||
|
|
||||||
|
struct ObjectProperty {
|
||||||
|
s32 obj_id;
|
||||||
|
u32 data_size;
|
||||||
|
u8 data[data_size];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct PropertyMap {
|
||||||
|
u32 max = parent.parent.data_end;
|
||||||
|
ObjectProperty props[while($ < max)];
|
||||||
|
};
|
|
@ -9,6 +9,7 @@ namespace ScrModules {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ChunkData {
|
struct ChunkData {
|
||||||
Name names[while($ < scrmodules_toc.offset + scrmodules_toc.size)];
|
u32 max = parent.parent.data_end;
|
||||||
|
Name names[while($ < max)];
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue