- Migrate from set_global/get_global to ctx_set/ctx_get - Replace if-else chains with match() expressions - Update inline pointer handling patterns - Improve GfxWorld and asset parsing structures - Clean up redundant code across 60+ definition files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
158 lines
3.6 KiB
Plaintext
158 lines
3.6 KiB
Plaintext
type menudef [display="Menu Definition"]
|
|
{
|
|
const PTR_INLINE = -1;
|
|
|
|
// WindowDef_t embedded
|
|
window = parse_here("windowdef");
|
|
ui("window", "Window");
|
|
|
|
// Menu Properties
|
|
i32 font_ptr;
|
|
ui("font_ptr", "Font Ptr");
|
|
|
|
i32 full_screen;
|
|
ui("full_screen", "Full Screen");
|
|
|
|
i32 item_count;
|
|
ui("item_count", "Item Count");
|
|
|
|
i32 font_index;
|
|
ui("font_index", "Font Index");
|
|
|
|
i32 cursor_item;
|
|
ui("cursor_item", "Cursor Item");
|
|
|
|
i32 fade_cycle;
|
|
ui("fade_cycle", "Fade Cycle");
|
|
|
|
f32 fade_clamp;
|
|
ui("fade_clamp", "Fade Clamp");
|
|
|
|
f32 fade_amount;
|
|
ui("fade_amount", "Fade Amount");
|
|
|
|
f32 fade_in_amount;
|
|
ui("fade_in_amount", "Fade In Amount");
|
|
|
|
f32 blur_radius;
|
|
ui("blur_radius", "Blur Radius");
|
|
|
|
i32 on_open_ptr;
|
|
ui("on_open_ptr", "OnOpen Ptr");
|
|
|
|
i32 on_close_ptr;
|
|
ui("on_close_ptr", "OnClose Ptr");
|
|
|
|
i32 on_esc_ptr;
|
|
ui("on_esc_ptr", "OnESC Ptr");
|
|
|
|
i32 on_key_ptr;
|
|
ui("on_key_ptr", "OnKey Ptr");
|
|
|
|
visible_exp = parse_here("statement");
|
|
ui("visible_exp", "Visible Exp");
|
|
|
|
i32 allowed_binding_ptr;
|
|
ui("allowed_binding_ptr", "Allowed Binding Ptr");
|
|
|
|
i32 sound_name_ptr;
|
|
ui("sound_name_ptr", "Sound Name Ptr");
|
|
|
|
i32 image_track;
|
|
ui("image_track", "Image Track");
|
|
|
|
f32 focus_color_r;
|
|
ui("focus_color_r", "Focus R");
|
|
|
|
f32 focus_color_g;
|
|
ui("focus_color_g", "Focus G");
|
|
|
|
f32 focus_color_b;
|
|
ui("focus_color_b", "Focus B");
|
|
|
|
f32 focus_color_a;
|
|
ui("focus_color_a", "Focus A");
|
|
|
|
f32 disable_color_r;
|
|
ui("disable_color_r", "Disable R");
|
|
|
|
f32 disable_color_g;
|
|
ui("disable_color_g", "Disable G");
|
|
|
|
f32 disable_color_b;
|
|
ui("disable_color_b", "Disable B");
|
|
|
|
f32 disable_color_a;
|
|
ui("disable_color_a", "Disable A");
|
|
|
|
rect_x_exp = parse_here("statement");
|
|
ui("rect_x_exp", "Rect X Exp");
|
|
|
|
rect_y_exp = parse_here("statement");
|
|
ui("rect_y_exp", "Rect Y Exp");
|
|
|
|
i32 items_ptr;
|
|
ui("items_ptr", "Items Ptr");
|
|
|
|
// ============ INLINE DATA ============
|
|
|
|
// Window inline data
|
|
_win_name_ptr = get(window, "name_ptr");
|
|
if (_win_name_ptr == PTR_INLINE) {
|
|
name = cstring();
|
|
ui("name", "Name");
|
|
set_name(name);
|
|
}
|
|
|
|
_win_group_ptr = get(window, "group_ptr");
|
|
if (_win_group_ptr == PTR_INLINE) {
|
|
group = cstring();
|
|
ui("group", "Group");
|
|
}
|
|
|
|
_win_bg_ptr = get(window, "background_ptr");
|
|
if (_win_bg_ptr == PTR_INLINE) {
|
|
background = parse_here("material");
|
|
ui("background", "Background");
|
|
}
|
|
|
|
// Simple inline strings
|
|
inline cstring font when font_ptr [ui="Font"];
|
|
inline cstring on_open when on_open_ptr [ui="OnOpen"];
|
|
inline cstring on_close when on_close_ptr [ui="OnClose"];
|
|
inline cstring on_esc when on_esc_ptr [ui="OnESC"];
|
|
inline itemkeyhandler on_key when on_key_ptr [ui="OnKey"];
|
|
|
|
// Visible expression entries
|
|
_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;
|
|
}
|
|
|
|
inline cstring allowed_binding when allowed_binding_ptr [ui="Allowed Binding"];
|
|
inline cstring sound_name when sound_name_ptr [ui="Sound Name"];
|
|
|
|
// Rect expression entries
|
|
_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;
|
|
}
|
|
|
|
// Items array
|
|
if (items_ptr == PTR_INLINE && item_count > 0) {
|
|
skip item_count * 4;
|
|
array[item_count] items: itemdef;
|
|
}
|
|
}
|