mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +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
|
||||
{
|
||||
public:
|
||||
int m_x_pos;
|
||||
int m_y_pos;
|
||||
int m_width;
|
||||
int m_height;
|
||||
int m_max_chars;
|
||||
int m_alignment;
|
||||
int m_x_pos = 0;
|
||||
int m_y_pos = 0;
|
||||
int m_width = 0;
|
||||
int m_height = 0;
|
||||
int m_max_chars = 0;
|
||||
int m_alignment = 0;
|
||||
};
|
||||
|
||||
bool m_not_selectable;
|
||||
bool m_no_scrollbars;
|
||||
bool m_use_paging;
|
||||
double m_element_width;
|
||||
double m_element_height;
|
||||
double m_feeder;
|
||||
int m_element_style;
|
||||
bool m_not_selectable = false;
|
||||
bool m_no_scrollbars = false;
|
||||
bool m_use_paging = false;
|
||||
double m_element_width = 0;
|
||||
double m_element_height = 0;
|
||||
double m_feeder = 0;
|
||||
int m_element_style = 0;
|
||||
CommonColor m_select_border;
|
||||
std::string m_select_icon;
|
||||
|
||||
@ -52,12 +52,12 @@ namespace menu
|
||||
public:
|
||||
std::string m_dvar;
|
||||
std::string m_local_var;
|
||||
double m_def_val;
|
||||
double m_min_val;
|
||||
double m_max_val;
|
||||
int m_max_chars;
|
||||
int m_max_paint_chars;
|
||||
bool m_max_chars_goto_next;
|
||||
double m_def_val = -1.0;
|
||||
double m_min_val = -1.0;
|
||||
double m_max_val = -1.0;
|
||||
int m_max_chars = 0;
|
||||
int m_max_paint_chars = 0;
|
||||
bool m_max_chars_goto_next = false;
|
||||
};
|
||||
|
||||
class CommonItemFeaturesMultiValue
|
||||
@ -71,9 +71,9 @@ namespace menu
|
||||
class CommonItemFeaturesNewsTicker
|
||||
{
|
||||
public:
|
||||
int m_spacing;
|
||||
int m_speed;
|
||||
int m_news_feed_id;
|
||||
int m_spacing = 0;
|
||||
int m_speed = 0;
|
||||
int m_news_feed_id = 0;
|
||||
};
|
||||
|
||||
class CommonItemDef
|
||||
@ -91,29 +91,29 @@ namespace menu
|
||||
|
||||
std::string m_name;
|
||||
std::string m_text;
|
||||
bool m_text_save_game;
|
||||
bool m_text_cinematic_subtitle;
|
||||
bool m_text_save_game = false;
|
||||
bool m_text_cinematic_subtitle = false;
|
||||
std::string m_group;
|
||||
CommonRect m_rect;
|
||||
int m_style;
|
||||
bool m_decoration;
|
||||
bool m_auto_wrapped;
|
||||
bool m_horizontal_scroll;
|
||||
int m_type;
|
||||
CommonItemFeatureType m_feature_type;
|
||||
int m_border;
|
||||
double m_border_size;
|
||||
int m_owner_draw;
|
||||
int m_owner_draw_flags;
|
||||
int m_align;
|
||||
int m_text_align;
|
||||
double m_text_align_x;
|
||||
double m_text_align_y;
|
||||
double m_text_scale;
|
||||
int m_text_style;
|
||||
int m_text_font;
|
||||
int m_style = 0;
|
||||
bool m_decoration = false;
|
||||
bool m_auto_wrapped = false;
|
||||
bool m_horizontal_scroll = false;
|
||||
int m_type = 0;
|
||||
CommonItemFeatureType m_feature_type = CommonItemFeatureType::NONE;
|
||||
int m_border = 0;
|
||||
double m_border_size = 0;
|
||||
int m_owner_draw = 0;
|
||||
int m_owner_draw_flags = 0;
|
||||
int m_align = 0;
|
||||
int m_text_align = 0;
|
||||
double m_text_align_x = 0;
|
||||
double m_text_align_y = 0;
|
||||
double m_text_scale = 0;
|
||||
int m_text_style = 0;
|
||||
int m_text_font = 0;
|
||||
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_outline_color;
|
||||
CommonColor m_disable_color;
|
||||
@ -127,11 +127,11 @@ namespace menu
|
||||
std::vector<std::string> m_show_dvar;
|
||||
std::vector<std::string> m_hide_dvar;
|
||||
std::vector<std::string> m_focus_dvar;
|
||||
int m_game_message_window_index;
|
||||
int m_game_message_window_mode;
|
||||
int m_fx_letter_time;
|
||||
int m_fx_decay_start_time;
|
||||
int m_fx_decay_duration;
|
||||
int m_game_message_window_index = 0;
|
||||
int m_game_message_window_mode = 0;
|
||||
int m_fx_letter_time = 0;
|
||||
int m_fx_decay_start_time = 0;
|
||||
int m_fx_decay_duration = 0;
|
||||
|
||||
std::unique_ptr<ISimpleExpression> m_visible_expression;
|
||||
std::unique_ptr<ISimpleExpression> m_disabled_expression;
|
||||
|
@ -17,23 +17,23 @@ namespace menu
|
||||
public:
|
||||
std::string m_name;
|
||||
CommonRect m_rect;
|
||||
int m_style;
|
||||
int m_border;
|
||||
double m_border_size;
|
||||
int m_style = 0;
|
||||
int m_border = 0;
|
||||
double m_border_size = 0;
|
||||
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_focus_color;
|
||||
CommonColor m_outline_color;
|
||||
std::string m_background;
|
||||
int m_owner_draw;
|
||||
int m_owner_draw_flags;
|
||||
int m_owner_draw = 0;
|
||||
int m_owner_draw_flags = 0;
|
||||
std::string m_sound_loop;
|
||||
double m_fade_clamp;
|
||||
int m_fade_cycle;
|
||||
double m_fade_amount;
|
||||
double m_fade_in_amount;
|
||||
double m_blur_radius;
|
||||
double m_fade_clamp = 0;
|
||||
int m_fade_cycle = 0;
|
||||
double m_fade_amount = 0;
|
||||
double m_fade_in_amount = 0;
|
||||
double m_blur_radius = 0;
|
||||
std::string m_allowed_binding;
|
||||
std::unique_ptr<ISimpleExpression> m_visible_expression;
|
||||
std::unique_ptr<ISimpleExpression> m_rect_x_exp;
|
||||
@ -48,16 +48,16 @@ namespace menu
|
||||
std::unique_ptr<CommonEventHandlerSet> m_on_esc;
|
||||
std::map<int, std::unique_ptr<CommonEventHandlerSet>> m_key_handlers;
|
||||
|
||||
bool m_full_screen;
|
||||
bool m_screen_space;
|
||||
bool m_decoration;
|
||||
bool m_out_of_bounds_click;
|
||||
bool m_popup;
|
||||
bool m_legacy_split_screen_scale;
|
||||
bool m_hidden_during_scope;
|
||||
bool m_hidden_during_flashbang;
|
||||
bool m_hidden_during_ui;
|
||||
bool m_text_only_focus;
|
||||
bool m_full_screen = false;
|
||||
bool m_screen_space = false;
|
||||
bool m_decoration = false;
|
||||
bool m_out_of_bounds_click = false;
|
||||
bool m_popup = false;
|
||||
bool m_legacy_split_screen_scale = false;
|
||||
bool m_hidden_during_scope = false;
|
||||
bool m_hidden_during_flashbang = false;
|
||||
bool m_hidden_during_ui = false;
|
||||
bool m_text_only_focus = false;
|
||||
|
||||
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->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;
|
||||
int horizontalAlign;
|
||||
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:
|
||||
void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||
{
|
||||
auto newMenu = std::make_unique<CommonMenuDef>();
|
||||
ApplyDefaults(*newMenu);
|
||||
state->m_current_menu = newMenu.get();
|
||||
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:
|
||||
void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||
{
|
||||
auto newItemDef = std::make_unique<CommonItemDef>();
|
||||
ApplyDefaults(*newItemDef);
|
||||
state->m_current_item = newItemDef.get();
|
||||
state->m_current_menu->m_items.emplace_back(std::move(newItemDef));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user