XPlor/definitions/cod/material.xscript

80 lines
2.6 KiB
Plaintext
Raw Normal View History

2026-01-01 22:18:40 -05:00
type material [display="Material"]
{
// Parse material info inline to get material_name_ptr
i32 material_name_ptr [ui, readonly, display="Material Name Ptr"];
u8 game_flags [ui, readonly, display="Game Flags"];
u8 sort_key [ui, readonly, display="Sort Key"];
u8 texture_atlas_row_count [ui, readonly, display="Texture Atlas Row Count"];
u8 texture_atlas_column_count [ui, readonly, display="Texture Atlas Column Count"];
draw_surf = parse_here("gfxdrawsurf") [ui];
u32 surface_type_bits [ui, readonly, display="Surface Type Bits"];
u16 hash_index [ui, readonly, display="Hash Index"];
skip(2); // padding
// State bits entry array (34 bytes)
state_bits_entries_raw = read(34);
state_bits_entries_raw = state_bits_entries_raw [ui, readonly, display="State Bits Entries"];
u8 texture_count [ui, readonly, display="Texture Count"];
u8 constant_count [ui, readonly, display="Constant Count"];
u8 state_bits_count [ui, readonly, display="State Bits Count"];
u8 state_flags [ui, readonly, display="State Flags"];
u8 camera_region [ui, readonly, display="Camera Region"];
skip(1); // padding
// Pointers to sub-assets
i32 technique_set_ptr [ui, readonly, display="Technique Set Ptr"];
i32 texture_table_ptr [ui, readonly, display="Texture Table Ptr"];
i32 constant_table_ptr [ui, readonly, display="Constant Table Ptr"];
i32 state_bits_table_ptr [ui, readonly, display="State Bits Table Ptr"];
// Material name string (parse if inline)
if (material_name_ptr == -1) {
material_name = cstring() [ui, readonly, display="Material Name"];
_name = material_name; // Set display name
}
// Parse sub-assets if inline
if (technique_set_ptr == -1) {
technique_set = parse_here("materialtechniqueset") [ui];
}
if (texture_table_ptr == -1) {
texture_defs = 0;
if (texture_count > 0) {
repeat(texture_count) {
_texture_def = parse_here("materialtexturedef") [ui];
texture_defs = push("texture_defs", _texture_def);
}
}
texture_defs = texture_defs [ui];
}
if (constant_table_ptr == -1) {
constant_defs = 0;
if (constant_count > 0) {
repeat(constant_count) {
_constant_def = parse_here("materialconstantdef") [ui];
constant_defs = push("constant_defs", _constant_def);
}
}
constant_defs = constant_defs [ui];
}
if (state_bits_table_ptr == -1) {
state_bits = 0;
if (state_bits_count > 0) {
repeat(state_bits_count) {
_state_bit = parse_here("gfxstatebits") [ui];
state_bits = push("state_bits", _state_bit);
}
}
state_bits = state_bits [ui];
}
}