- 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>
59 lines
1.8 KiB
Plaintext
59 lines
1.8 KiB
Plaintext
type material ui("Material")
|
|
{
|
|
// Material struct - PC COD4 format (80 bytes header)
|
|
const PTR_INLINE = -1;
|
|
|
|
// ============ MaterialInfo (24 bytes) ============
|
|
i32 material_name_ptr ui("Material Name Ptr");
|
|
u8 game_flags ui("Game Flags");
|
|
u8 sort_key ui("Sort Key");
|
|
u8 texture_atlas_row_count ui("Texture Atlas Row Count");
|
|
u8 texture_atlas_column_count ui("Texture Atlas Column Count");
|
|
|
|
// Draw surface - 8 bytes (uint64_t packed bitfield)
|
|
draw_surf = read(8) ui("Draw Surf");
|
|
|
|
u32 surface_type_bits ui("Surface Type Bits");
|
|
u16 hash_index ui("Hash Index");
|
|
skip 2;
|
|
|
|
// ============ Material body (56 bytes) ============
|
|
// State bits entry array - 34 bytes (TECHNIQUE_COUNT = 34)
|
|
state_bits_entry = read(34) ui("State Bits Entry");
|
|
|
|
u8 texture_count ui("Texture Count");
|
|
u8 constant_count ui("Constant Count");
|
|
u8 state_bits_count ui("State Bits Count");
|
|
u8 state_flags ui("State Flags");
|
|
u8 camera_region ui("Camera Region");
|
|
skip 1;
|
|
|
|
// Pointers
|
|
i32 technique_set_ptr ui("Technique Set Ptr");
|
|
i32 texture_table_ptr ui("Texture Table Ptr");
|
|
i32 constant_table_ptr ui("Constant Table Ptr");
|
|
i32 state_bits_table_ptr ui("State Bits Table Ptr");
|
|
|
|
// ============ Inline data (after header) ============
|
|
if (material_name_ptr == PTR_INLINE) {
|
|
material_name = cstring() ui("Material Name");
|
|
set_name(material_name);
|
|
}
|
|
|
|
if (technique_set_ptr == PTR_INLINE) {
|
|
technique_set = parse_here("materialtechniqueset");
|
|
}
|
|
|
|
if (texture_table_ptr == PTR_INLINE && texture_count > 0) {
|
|
array[texture_count] texture_defs: materialtexturedef;
|
|
}
|
|
|
|
if (constant_table_ptr == PTR_INLINE && constant_count > 0) {
|
|
array[constant_count] constant_defs: materialconstantdef;
|
|
}
|
|
|
|
if (state_bits_table_ptr == PTR_INLINE && state_bits_count > 0) {
|
|
array[state_bits_count] state_bits: gfxstatebits;
|
|
}
|
|
}
|