XPlor/definitions/cod/itemdef.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

196 lines
5.8 KiB
Plaintext

type itemdef ui("Item Def")
{
const PTR_INLINE = -1;
// itemDef_s struct - ~368 bytes fixed
// WindowDef_t embedded
window = parse_here("windowdef") ui("Window");
// Text Rect
text_rect = parse_here("rectdef") ui("Text Rect");
// Item Properties
i32 item_type ui("Type");
i32 data_type ui("Data Type");
i32 alignment ui("Alignment");
i32 font_enum ui("Font Enum");
i32 text_align_mode ui("Text Align Mode");
f32 text_align_x ui("Text Align X");
f32 text_align_y ui("Text Align Y");
f32 text_scale ui("Text Scale");
i32 text_style ui("Text Style");
i32 game_msg_window_index ui("Game Msg Window Index");
i32 game_msg_window_mode ui("Game Msg Window Mode");
// Pointers
i32 text_ptr ui("Text Ptr");
i32 item_flags ui("Item Flags");
i32 parent_ptr ui("Parent Ptr");
i32 mouse_enter_text_ptr ui("Mouse Enter Text Ptr");
i32 mouse_exit_text_ptr ui("Mouse Exit Text Ptr");
i32 mouse_enter_ptr ui("Mouse Enter Ptr");
i32 mouse_exit_ptr ui("Mouse Exit Ptr");
i32 action_ptr ui("Action Ptr");
i32 on_accept_ptr ui("On Accept Ptr");
i32 on_focus_ptr ui("On Focus Ptr");
i32 leave_focus_ptr ui("Leave Focus Ptr");
i32 dvar_ptr ui("Dvar Ptr");
i32 dvar_test_ptr ui("Dvar Test Ptr");
i32 on_key_ptr ui("On Key Ptr");
i32 enable_dvar_ptr ui("Enable Dvar Ptr");
i32 dvar_flags ui("Dvar Flags");
i32 focus_sound_ptr ui("Focus Sound Ptr");
f32 special ui("Special");
i32 cursor_pos ui("Cursor Pos");
i32 type_data_ptr ui("Type Data Ptr");
i32 image_track ui("Image Track");
// Expressions
visible_exp = parse_here("statement") ui("Visible Exp");
text_exp = parse_here("statement") ui("Text Exp");
material_exp = parse_here("statement") ui("Material Exp");
rect_x_exp = parse_here("statement") ui("Rect X Exp");
rect_y_exp = parse_here("statement") ui("Rect Y Exp");
rect_w_exp = parse_here("statement") ui("Rect W Exp");
rect_h_exp = parse_here("statement") ui("Rect H Exp");
forecolor_a_exp = parse_here("statement") ui("Forecolor A Exp");
// ============ INLINE DATA ============
// Window inline data
_win_name_ptr = get(window, "name_ptr");
if (_win_name_ptr == PTR_INLINE) {
name = cstring() ui("Name");
}
_win_group_ptr = get(window, "group_ptr");
if (_win_group_ptr == PTR_INLINE) {
group = cstring() ui("Group");
}
_win_bg_ptr = get(window, "background_ptr");
if (_win_bg_ptr == PTR_INLINE) {
background = parse_here("material") ui("Background");
}
// Simple inline strings
if (text_ptr == PTR_INLINE) {
text = cstring() ui("Text");
}
if (mouse_enter_text_ptr == PTR_INLINE) {
mouse_enter_text = cstring() ui("Mouse Enter Text");
}
if (mouse_exit_text_ptr == PTR_INLINE) {
mouse_exit_text = cstring() ui("Mouse Exit Text");
}
if (mouse_enter_ptr == PTR_INLINE) {
mouse_enter = cstring() ui("Mouse Enter");
}
if (mouse_exit_ptr == PTR_INLINE) {
mouse_exit = cstring() ui("Mouse Exit");
}
if (action_ptr == PTR_INLINE) {
action = cstring() ui("Action");
}
if (on_accept_ptr == PTR_INLINE) {
on_accept = cstring() ui("On Accept");
}
if (on_focus_ptr == PTR_INLINE) {
on_focus = cstring() ui("On Focus");
}
if (leave_focus_ptr == PTR_INLINE) {
leave_focus = cstring() ui("Leave Focus");
}
if (dvar_ptr == PTR_INLINE) {
dvar = cstring() ui("Dvar");
}
if (dvar_test_ptr == PTR_INLINE) {
dvar_test = cstring() ui("Dvar Test");
}
if (on_key_ptr == PTR_INLINE) {
on_key = parse_here("itemkeyhandler") ui("On Key");
}
if (enable_dvar_ptr == PTR_INLINE) {
enable_dvar = cstring() ui("Enable Dvar");
}
if (focus_sound_ptr == PTR_INLINE) {
focus_sound = parse_here("sound") ui("Focus Sound");
}
// Type-specific data
if (type_data_ptr == PTR_INLINE) {
match(item_type) {
6 => {
type_data = parse_here("listboxdef") ui("List Box Data");
}
4 | 9 | 16 | 17 | 18 => {
type_data = parse_here("editfielddef") ui("Edit Field Data");
}
12 => {
type_data = parse_here("multidef") ui("Multi Data");
}
13 => {
type_data = cstring() ui("Enum Dvar Name");
}
}
}
// Expression entries (complex patterns - need ptr array first)
_vis_num = get(visible_exp, "num_entries");
_vis_ptr = get(visible_exp, "entries_ptr");
if (_vis_ptr == PTR_INLINE && _vis_num > 0) {
skip _vis_num * 4;
array[_vis_num] vis_entries: expressionentry;
}
_txt_num = get(text_exp, "num_entries");
_txt_ptr = get(text_exp, "entries_ptr");
if (_txt_ptr == PTR_INLINE && _txt_num > 0) {
skip _txt_num * 4;
array[_txt_num] txt_entries: expressionentry;
}
_mat_num = get(material_exp, "num_entries");
_mat_ptr = get(material_exp, "entries_ptr");
if (_mat_ptr == PTR_INLINE && _mat_num > 0) {
skip _mat_num * 4;
array[_mat_num] mat_entries: expressionentry;
}
_rx_num = get(rect_x_exp, "num_entries");
_rx_ptr = get(rect_x_exp, "entries_ptr");
if (_rx_ptr == PTR_INLINE && _rx_num > 0) {
skip _rx_num * 4;
array[_rx_num] rx_entries: expressionentry;
}
_ry_num = get(rect_y_exp, "num_entries");
_ry_ptr = get(rect_y_exp, "entries_ptr");
if (_ry_ptr == PTR_INLINE && _ry_num > 0) {
skip _ry_num * 4;
array[_ry_num] ry_entries: expressionentry;
}
_rw_num = get(rect_w_exp, "num_entries");
_rw_ptr = get(rect_w_exp, "entries_ptr");
if (_rw_ptr == PTR_INLINE && _rw_num > 0) {
skip _rw_num * 4;
array[_rw_num] rw_entries: expressionentry;
}
_rh_num = get(rect_h_exp, "num_entries");
_rh_ptr = get(rect_h_exp, "entries_ptr");
if (_rh_ptr == PTR_INLINE && _rh_num > 0) {
skip _rh_num * 4;
array[_rh_num] rh_entries: expressionentry;
}
_fc_num = get(forecolor_a_exp, "num_entries");
_fc_ptr = get(forecolor_a_exp, "entries_ptr");
if (_fc_ptr == PTR_INLINE && _fc_num > 0) {
skip _fc_num * 4;
array[_fc_num] fc_entries: expressionentry;
}
}