XPlor/definitions/cod/gfxworld.xscript
njohnson 7b1f5d34a1 Consolidate XScript definitions with byte order inheritance
- Volition VPP: Unified BE/LE types using inheritance pattern
- THQA PAK: Child types now inherit byte order from parent
- Various XScript definition updates and fixes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 16:08:46 -05:00

152 lines
5.0 KiB
Plaintext

type gfxworld ui("GFX World")
{
const PTR_INLINE = -1;
// ========================================
// GfxWorld Header - PC VERSION (732 bytes)
// ========================================
// Name pointers (8 bytes)
i32 name_ptr ui("Name Ptr");
i32 basename_ptr ui("Base Name Ptr");
// Counts and indices (16 bytes)
i32 plane_count ui("Plane Count");
i32 node_count ui("Node Count");
i32 index_count ui("Index Count");
i32 indices_ptr ui("Indices Ptr");
// PC has no D3DIndexBuffer - just surfaceCount + unk (8 bytes)
i32 surface_count ui("Surface Count");
i32 unk ui("Unknown");
// Sky data (16 bytes)
i32 sky_surf_count ui("Sky Surf Count");
i32 sky_start_surfs_ptr ui("Sky Start Surfs Ptr");
i32 sky_image_ptr ui("Sky Image Ptr");
u8 sky_sampler_state ui("Sky Sampler State");
skip 3; // padding
// Vertex data (4 + 8 = 12 bytes)
u32 vertex_count ui("Vertex Count");
vertex_data = parse_here("gfxworldvertexdata");
// Vertex layer data (4 + 8 = 12 bytes)
u32 vertex_layer_data_size ui("Vertex Layer Data Size");
vertex_layer_data = parse_here("gfxworldvertexlayerdata");
// Sun light parse params - EMBEDDED (128 bytes on PC - name is char[64])
sun_parse = parse_here("sunlightparseparams");
// Sun light pointer (4 bytes)
i32 sun_light_ptr ui("Sun Light Ptr");
// Sun color from BSP (12 bytes)
sun_color = read(12) ui("Sun Color");
// Light counts and reflection probes (24 bytes)
u32 sun_primary_light_index ui("Sun Primary Light Index");
u32 primary_light_count ui("Primary Light Count");
i32 cull_group_count ui("Cull Group Count");
u32 reflection_probe_count ui("Reflection Probe Count");
i32 reflection_probes_ptr ui("Reflection Probes Ptr");
i32 reflection_probe_textures_ptr ui("Reflection Probe Textures Ptr");
// DPVS planes - EMBEDDED (16 bytes)
dpvs_planes = parse_here("gfxworlddpvsplanes");
// Cells and lightmaps (16 bytes)
i32 cell_bits_count ui("Cell Bits Count");
i32 cells_ptr ui("Cells Ptr");
i32 lightmap_count ui("Lightmap Count");
i32 lightmaps_ptr ui("Lightmaps Ptr");
// Light grid - EMBEDDED (56 bytes on PC - mins/maxs are uint16)
light_grid = parse_here("gfxlightgrid");
// Texture pointers (16 bytes)
i32 lightmaps_primary_ptr ui("Lightmaps Primary Ptr");
i32 lightmaps_secondary_ptr ui("Lightmaps Secondary Ptr");
i32 model_count ui("Model Count");
i32 models_ptr ui("Models Ptr");
// Bounds (24 bytes)
mins = read(12) ui("Mins");
maxs = read(12) ui("Maxs");
// Checksum and material memory (12 bytes)
u32 checksum ui("Checksum");
i32 material_memory_count ui("Material Memory Count");
i32 material_memory_ptr ui("Material Memory Ptr");
// Sun flare - EMBEDDED (96 bytes)
sun_flare = parse_here("sunflare");
// Outdoor lookup matrix (64 bytes)
outdoor_lookup_matrix = read(64) ui("Outdoor Lookup Matrix");
// Final pointers (40 bytes)
i32 outdoor_image_ptr ui("Outdoor Image Ptr");
i32 cell_caster_bits_ptr ui("Cell Caster Bits Ptr");
i32 scene_dyn_model_ptr ui("Scene Dyn Model Ptr");
i32 scene_dyn_brush_ptr ui("Scene Dyn Brush Ptr");
i32 primary_light_ent_shadow_vis_ptr ui("Primary Light Ent Shadow Vis Ptr");
i32 primary_light_dyn_ent_shadow_vis_ptr_0 ui("Primary Light Dyn Ent Shadow Vis Ptr 0");
i32 primary_light_dyn_ent_shadow_vis_ptr_1 ui("Primary Light Dyn Ent Shadow Vis Ptr 1");
i32 primary_light_for_model_dyn_ent_ptr ui("Primary Light For Model Dyn Ent Ptr");
i32 shadow_geom_ptr ui("Shadow Geom Ptr");
i32 light_region_ptr ui("Light Region Ptr");
// DPVS static - EMBEDDED (104 bytes on PC - has 3 extra fields)
dpvs = parse_here("gfxworlddpvsstatic");
// DPVS dynamic - EMBEDDED (48 bytes)
dpvs_dyn = parse_here("gfxworlddpvsdynamic");
// ========================================
// Inline data (after header, ptr == -1)
// ========================================
// Parse names if inline
if (name_ptr == PTR_INLINE) {
name = cstring() ui("Name");
set_name(name);
}
if (basename_ptr == PTR_INLINE) {
basename = cstring() ui("Base Name");
}
// Indices array - only if inline (ptr == -1)
if (indices_ptr == PTR_INLINE && index_count > 0) {
indices = read(index_count * 2) ui("Indices");
}
// Sky start surfs - only if inline
if (sky_start_surfs_ptr == PTR_INLINE && sky_surf_count > 0) {
sky_start_surfs = read(sky_surf_count * 4) ui("Sky Start Surfs");
}
// Sky image - only if inline
if (sky_image_ptr == PTR_INLINE) {
sky_image = parse_here("image");
}
// Sun light - only if inline
if (sun_light_ptr == PTR_INLINE) {
sun_light = parse_here("gfxlight");
}
// Reflection probes - only if inline
if (reflection_probes_ptr == PTR_INLINE && reflection_probe_count > 0) {
array[reflection_probe_count] reflection_probes: gfxreflectionprobe;
}
// Reflection probe textures - only if inline
if (reflection_probe_textures_ptr == PTR_INLINE && reflection_probe_count > 0) {
array[reflection_probe_count] reflection_probe_textures: gfxtexture;
}
}