mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Initialize default values of menus via class level defaults
This commit is contained in:
parent
bf7e136c54
commit
f30bbd65da
@ -25,21 +25,21 @@ namespace menu
|
|||||||
class Column
|
class Column
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_x_pos;
|
int m_x_pos = 0;
|
||||||
int m_y_pos;
|
int m_y_pos = 0;
|
||||||
int m_width;
|
int m_width = 0;
|
||||||
int m_height;
|
int m_height = 0;
|
||||||
int m_max_chars;
|
int m_max_chars = 0;
|
||||||
int m_alignment;
|
int m_alignment = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool m_not_selectable;
|
bool m_not_selectable = false;
|
||||||
bool m_no_scrollbars;
|
bool m_no_scrollbars = false;
|
||||||
bool m_use_paging;
|
bool m_use_paging = false;
|
||||||
double m_element_width;
|
double m_element_width = 0;
|
||||||
double m_element_height;
|
double m_element_height = 0;
|
||||||
double m_feeder;
|
double m_feeder = 0;
|
||||||
int m_element_style;
|
int m_element_style = 0;
|
||||||
CommonColor m_select_border;
|
CommonColor m_select_border;
|
||||||
std::string m_select_icon;
|
std::string m_select_icon;
|
||||||
|
|
||||||
@ -52,12 +52,12 @@ namespace menu
|
|||||||
public:
|
public:
|
||||||
std::string m_dvar;
|
std::string m_dvar;
|
||||||
std::string m_local_var;
|
std::string m_local_var;
|
||||||
double m_def_val;
|
double m_def_val = -1.0;
|
||||||
double m_min_val;
|
double m_min_val = -1.0;
|
||||||
double m_max_val;
|
double m_max_val = -1.0;
|
||||||
int m_max_chars;
|
int m_max_chars = 0;
|
||||||
int m_max_paint_chars;
|
int m_max_paint_chars = 0;
|
||||||
bool m_max_chars_goto_next;
|
bool m_max_chars_goto_next = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CommonItemFeaturesMultiValue
|
class CommonItemFeaturesMultiValue
|
||||||
@ -71,9 +71,9 @@ namespace menu
|
|||||||
class CommonItemFeaturesNewsTicker
|
class CommonItemFeaturesNewsTicker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_spacing;
|
int m_spacing = 0;
|
||||||
int m_speed;
|
int m_speed = 0;
|
||||||
int m_news_feed_id;
|
int m_news_feed_id = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CommonItemDef
|
class CommonItemDef
|
||||||
@ -91,29 +91,29 @@ namespace menu
|
|||||||
|
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
std::string m_text;
|
std::string m_text;
|
||||||
bool m_text_save_game;
|
bool m_text_save_game = false;
|
||||||
bool m_text_cinematic_subtitle;
|
bool m_text_cinematic_subtitle = false;
|
||||||
std::string m_group;
|
std::string m_group;
|
||||||
CommonRect m_rect;
|
CommonRect m_rect;
|
||||||
int m_style;
|
int m_style = 0;
|
||||||
bool m_decoration;
|
bool m_decoration = false;
|
||||||
bool m_auto_wrapped;
|
bool m_auto_wrapped = false;
|
||||||
bool m_horizontal_scroll;
|
bool m_horizontal_scroll = false;
|
||||||
int m_type;
|
int m_type = 0;
|
||||||
CommonItemFeatureType m_feature_type;
|
CommonItemFeatureType m_feature_type = CommonItemFeatureType::NONE;
|
||||||
int m_border;
|
int m_border = 0;
|
||||||
double m_border_size;
|
double m_border_size = 0;
|
||||||
int m_owner_draw;
|
int m_owner_draw = 0;
|
||||||
int m_owner_draw_flags;
|
int m_owner_draw_flags = 0;
|
||||||
int m_align;
|
int m_align = 0;
|
||||||
int m_text_align;
|
int m_text_align = 0;
|
||||||
double m_text_align_x;
|
double m_text_align_x = 0;
|
||||||
double m_text_align_y;
|
double m_text_align_y = 0;
|
||||||
double m_text_scale;
|
double m_text_scale = 0;
|
||||||
int m_text_style;
|
int m_text_style = 0;
|
||||||
int m_text_font;
|
int m_text_font = 0;
|
||||||
CommonColor m_back_color;
|
CommonColor m_back_color;
|
||||||
CommonColor m_fore_color;
|
CommonColor m_fore_color = CommonColor(1.0, 1.0, 1.0, 1.0);
|
||||||
CommonColor m_border_color;
|
CommonColor m_border_color;
|
||||||
CommonColor m_outline_color;
|
CommonColor m_outline_color;
|
||||||
CommonColor m_disable_color;
|
CommonColor m_disable_color;
|
||||||
@ -127,11 +127,11 @@ namespace menu
|
|||||||
std::vector<std::string> m_show_dvar;
|
std::vector<std::string> m_show_dvar;
|
||||||
std::vector<std::string> m_hide_dvar;
|
std::vector<std::string> m_hide_dvar;
|
||||||
std::vector<std::string> m_focus_dvar;
|
std::vector<std::string> m_focus_dvar;
|
||||||
int m_game_message_window_index;
|
int m_game_message_window_index = 0;
|
||||||
int m_game_message_window_mode;
|
int m_game_message_window_mode = 0;
|
||||||
int m_fx_letter_time;
|
int m_fx_letter_time = 0;
|
||||||
int m_fx_decay_start_time;
|
int m_fx_decay_start_time = 0;
|
||||||
int m_fx_decay_duration;
|
int m_fx_decay_duration = 0;
|
||||||
|
|
||||||
std::unique_ptr<ISimpleExpression> m_visible_expression;
|
std::unique_ptr<ISimpleExpression> m_visible_expression;
|
||||||
std::unique_ptr<ISimpleExpression> m_disabled_expression;
|
std::unique_ptr<ISimpleExpression> m_disabled_expression;
|
||||||
|
@ -17,23 +17,23 @@ namespace menu
|
|||||||
public:
|
public:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
CommonRect m_rect;
|
CommonRect m_rect;
|
||||||
int m_style;
|
int m_style = 0;
|
||||||
int m_border;
|
int m_border = 0;
|
||||||
double m_border_size;
|
double m_border_size = 0;
|
||||||
CommonColor m_back_color;
|
CommonColor m_back_color;
|
||||||
CommonColor m_fore_color;
|
CommonColor m_fore_color = CommonColor(1.0, 1.0, 1.0, 1.0);
|
||||||
CommonColor m_border_color;
|
CommonColor m_border_color;
|
||||||
CommonColor m_focus_color;
|
CommonColor m_focus_color;
|
||||||
CommonColor m_outline_color;
|
CommonColor m_outline_color;
|
||||||
std::string m_background;
|
std::string m_background;
|
||||||
int m_owner_draw;
|
int m_owner_draw = 0;
|
||||||
int m_owner_draw_flags;
|
int m_owner_draw_flags = 0;
|
||||||
std::string m_sound_loop;
|
std::string m_sound_loop;
|
||||||
double m_fade_clamp;
|
double m_fade_clamp = 0;
|
||||||
int m_fade_cycle;
|
int m_fade_cycle = 0;
|
||||||
double m_fade_amount;
|
double m_fade_amount = 0;
|
||||||
double m_fade_in_amount;
|
double m_fade_in_amount = 0;
|
||||||
double m_blur_radius;
|
double m_blur_radius = 0;
|
||||||
std::string m_allowed_binding;
|
std::string m_allowed_binding;
|
||||||
std::unique_ptr<ISimpleExpression> m_visible_expression;
|
std::unique_ptr<ISimpleExpression> m_visible_expression;
|
||||||
std::unique_ptr<ISimpleExpression> m_rect_x_exp;
|
std::unique_ptr<ISimpleExpression> m_rect_x_exp;
|
||||||
@ -48,16 +48,16 @@ namespace menu
|
|||||||
std::unique_ptr<CommonEventHandlerSet> m_on_esc;
|
std::unique_ptr<CommonEventHandlerSet> m_on_esc;
|
||||||
std::map<int, std::unique_ptr<CommonEventHandlerSet>> m_key_handlers;
|
std::map<int, std::unique_ptr<CommonEventHandlerSet>> m_key_handlers;
|
||||||
|
|
||||||
bool m_full_screen;
|
bool m_full_screen = false;
|
||||||
bool m_screen_space;
|
bool m_screen_space = false;
|
||||||
bool m_decoration;
|
bool m_decoration = false;
|
||||||
bool m_out_of_bounds_click;
|
bool m_out_of_bounds_click = false;
|
||||||
bool m_popup;
|
bool m_popup = false;
|
||||||
bool m_legacy_split_screen_scale;
|
bool m_legacy_split_screen_scale = false;
|
||||||
bool m_hidden_during_scope;
|
bool m_hidden_during_scope = false;
|
||||||
bool m_hidden_during_flashbang;
|
bool m_hidden_during_flashbang = false;
|
||||||
bool m_hidden_during_ui;
|
bool m_hidden_during_ui = false;
|
||||||
bool m_text_only_focus;
|
bool m_text_only_focus = false;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<CommonItemDef>> m_items;
|
std::vector<std::unique_ptr<CommonItemDef>> m_items;
|
||||||
};
|
};
|
||||||
|
@ -19,3 +19,23 @@ CommonColor::CommonColor(const double r, const double g, const double b, const d
|
|||||||
this->b = b;
|
this->b = b;
|
||||||
this->a = a;
|
this->a = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CommonRect::CommonRect()
|
||||||
|
: CommonRect(0, 0, 0, 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CommonRect::CommonRect(const double x, const double y, const double w, const double h)
|
||||||
|
: CommonRect(x, y, w, h, 0, 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CommonRect::CommonRect(const double x, const double y, const double w, const double h, const int horizontalAlign, const int verticalAlign)
|
||||||
|
: x(x),
|
||||||
|
y(y),
|
||||||
|
w(w),
|
||||||
|
h(h),
|
||||||
|
horizontalAlign(horizontalAlign),
|
||||||
|
verticalAlign(verticalAlign)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -25,5 +25,9 @@ namespace menu
|
|||||||
double h;
|
double h;
|
||||||
int horizontalAlign;
|
int horizontalAlign;
|
||||||
int verticalAlign;
|
int verticalAlign;
|
||||||
|
|
||||||
|
CommonRect();
|
||||||
|
CommonRect(double x, double y, double w, double h);
|
||||||
|
CommonRect(double x, double y, double w, double h, int horizontalAlign, int verticalAlign);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -61,17 +61,10 @@ namespace menu::global_scope_sequences
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
static void ApplyDefaults(CommonMenuDef& menu)
|
|
||||||
{
|
|
||||||
menu.m_fore_color = CommonColor(1.0, 1.0, 1.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||||
{
|
{
|
||||||
auto newMenu = std::make_unique<CommonMenuDef>();
|
auto newMenu = std::make_unique<CommonMenuDef>();
|
||||||
ApplyDefaults(*newMenu);
|
|
||||||
state->m_current_menu = newMenu.get();
|
state->m_current_menu = newMenu.get();
|
||||||
state->m_menus.emplace_back(std::move(newMenu));
|
state->m_menus.emplace_back(std::move(newMenu));
|
||||||
}
|
}
|
||||||
|
@ -86,17 +86,10 @@ namespace menu::menu_scope_sequences
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
static void ApplyDefaults(CommonItemDef& item)
|
|
||||||
{
|
|
||||||
item.m_fore_color = CommonColor(1.0, 1.0, 1.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||||
{
|
{
|
||||||
auto newItemDef = std::make_unique<CommonItemDef>();
|
auto newItemDef = std::make_unique<CommonItemDef>();
|
||||||
ApplyDefaults(*newItemDef);
|
|
||||||
state->m_current_item = newItemDef.get();
|
state->m_current_item = newItemDef.get();
|
||||||
state->m_current_menu->m_items.emplace_back(std::move(newItemDef));
|
state->m_current_menu->m_items.emplace_back(std::move(newItemDef));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user