Skip to content

Commit 6c3f9e6

Browse files
committed
Updated c_gui_widget
1 parent d1e86dd commit 6c3f9e6

6 files changed

Lines changed: 81 additions & 16 deletions

File tree

game/source/interface/c_gui_widget.cpp

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ bool c_gui_widget::can_receive_focus()
204204
bool c_gui_widget::controller_can_drive(e_controller_index controller_index)
205205
{
206206
return INVOKE_CLASS_MEMBER(0x00AB7960, c_gui_widget, controller_can_drive, controller_index);
207+
208+
//return controller_index == k_any_controller || get_driving_controller() == k_any_controller || get_driving_controller() == controller_index;
207209
}
208210

209211
//.text:00AB79D0 ; public: c_gui_button_key_widget* c_gui_widget::create_and_add_button_key(s_button_key_block const*)
@@ -507,6 +509,33 @@ c_gui_widget* c_gui_widget::get_deepest_widget_that_can_receive_focus()
507509
int32 c_gui_widget::get_definition_index()
508510
{
509511
return INVOKE_CLASS_MEMBER(0x00AB8E20, c_gui_widget, get_definition_index);
512+
513+
//c_gui_widget* parent_widget = get_parent();
514+
//if (!parent_widget)
515+
//{
516+
// return NONE;
517+
//}
518+
//
519+
//c_gui_widget* child_widget = parent_widget->get_children();
520+
//if (!child_widget)
521+
//{
522+
// return NONE;
523+
//}
524+
//
525+
//int32 definition_index = 0;
526+
//
527+
//while (child_widget != this)
528+
//{
529+
// child_widget = child_widget->get_next();
530+
// if (!child_widget)
531+
// {
532+
// return NONE;
533+
// }
534+
//
535+
// definition_index++;
536+
//}
537+
//
538+
//return definition_index;
510539
}
511540

512541
e_controller_index c_gui_widget::get_driving_controller() const
@@ -572,6 +601,18 @@ c_gui_widget* c_gui_widget::get_first_child_widget_by_type(e_gui_widget_type typ
572601
c_gui_widget* c_gui_widget::get_last_child_widget_by_type(e_gui_widget_type type)
573602
{
574603
return INVOKE_CLASS_MEMBER(0x00AB9010, c_gui_widget, get_last_child_widget_by_type, type);
604+
605+
//c_gui_widget* last_child_widget = NULL;
606+
//for (c_gui_widget* child_widget = get_children(); child_widget; child_widget = child_widget->get_next())
607+
//{
608+
// if (child_widget->m_type != type)
609+
// {
610+
// continue;
611+
// }
612+
//
613+
// last_child_widget = child_widget;
614+
//}
615+
//return last_child_widget;
575616
}
576617

577618
//.text:00AB9080 ; void __cdecl get_local_coordinate_system_position_from_rotation_keyframe(c_gui_widget*, s_rotation_keyframe_block const*, real_point2d*)
@@ -648,7 +689,7 @@ int32 c_gui_widget::get_name() const
648689
{
649690
//return INVOKE_CLASS_MEMBER(0x00AB94B0, c_gui_widget, get_name);
650691

651-
return m_name.get_value();
692+
return m_name;
652693
}
653694

654695
c_gui_widget* c_gui_widget::get_previous()
@@ -1317,8 +1358,31 @@ bool c_gui_widget::verify_animation_period(e_animation_state animation_state, in
13171358
return INVOKE_CLASS_MEMBER(0x00ABB220, c_gui_widget, verify_animation_period, animation_state, period);
13181359
}
13191360

1320-
//.text:00ABB270 ; public: static char const* __cdecl c_gui_widget::widget_name_to_string(int32)
1321-
//.text:00ABB280 ; public: static char const* __cdecl c_gui_widget::widget_type_to_string(e_gui_widget_type)
1361+
char const* __cdecl c_gui_widget::widget_name_to_string(int32 name)
1362+
{
1363+
//return INVOKE(0x00ABB270, c_gui_widget::widget_name_to_string, name);
1364+
1365+
return "";
1366+
}
1367+
1368+
char const* __cdecl gui_widget_type_to_string(e_gui_widget_type type)
1369+
{
1370+
//return INVOKE(0x00ABB280, gui_widget_type_to_string, type);
1371+
1372+
switch (type)
1373+
{
1374+
case _gui_text: return "text";
1375+
case _gui_bitmap: return "bitmap";
1376+
case _gui_model: return "model";
1377+
case _gui_group: return "group";
1378+
case _gui_button_key: return "button_key";
1379+
case _gui_list_item: return "item";
1380+
case _gui_slider: return "slider";
1381+
case _gui_list: return "list";
1382+
case _gui_screen: return "screen";
1383+
}
1384+
return "<unknown>";
1385+
}
13221386

13231387
bool c_gui_widget::within_focus_chain()
13241388
{

game/source/interface/c_gui_widget.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ struct c_gui_widget
256256
void stomp_bounds(real_rectangle2d const* new_bounds);
257257
void update_animation(uns32 current_milliseconds);
258258
bool verify_animation_period(e_animation_state animation_state, int32 period);
259+
static char const* __cdecl widget_name_to_string(int32 name);
259260

260261
//protected:
261262
int32 __unknown4;
@@ -268,7 +269,7 @@ struct c_gui_widget
268269
c_robust_pointer<c_gui_widget> m_children;
269270
c_robust_pointer<c_gui_widget> m_next;
270271
c_robust_pointer<c_gui_widget> m_previous;
271-
c_string_id m_name;
272+
string_id m_name;
272273
real32 __unknown44;
273274
uns32 m_flags;
274275
int32 __unknown4C;
@@ -295,3 +296,4 @@ static_assert(0x50 == OFFSETOF(c_gui_widget, m_animated_state));
295296
static_assert(0xD8 == OFFSETOF(c_gui_widget, m_last_animated_milliseconds));
296297
static_assert(0xDC == OFFSETOF(c_gui_widget, __unknownDC));
297298

299+
extern char const* __cdecl gui_widget_type_to_string(e_gui_widget_type type);

game/source/interface/gui_screens/pregame_lobby/gui_screen_pregame_lobby.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ bool c_gui_screen_pregame_lobby::handle_list_item_chosen(c_controller_input_mess
120120
if (c_load_pregame_selection_screen_message* screen_message = new c_load_pregame_selection_screen_message(
121121
message->get_controller(),
122122
get_render_window(),
123-
m_name.get_value(),
123+
m_name,
124124
_gui_selection_type_network_mode))
125125
{
126126
screen_message->set_parent_screen_index(m_screen_index);
@@ -137,7 +137,7 @@ bool c_gui_screen_pregame_lobby::handle_list_item_chosen(c_controller_input_mess
137137
STRING_ID(gui, pregame_switch_lobby),
138138
k_any_controller,
139139
get_render_window(),
140-
m_name.get_value()))
140+
m_name))
141141
{
142142
screen_message->set_parent_screen_index(m_screen_index);
143143
screen_message->set_focus_on_load_by_name(

game/source/interface/gui_screens/pregame_lobby/gui_screen_pregame_lobby_campaign.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ bool __thiscall c_gui_screen_pregame_lobby_campaign::handle_controller_input_mes
4747
STRING_ID(gui, campaign_settings),
4848
message->get_controller(),
4949
get_render_window(),
50-
m_name.get_value()))
50+
m_name))
5151
{
5252
screen_message->set_parent_screen_index(m_screen_index);
5353
user_interface_messaging_post(screen_message);
@@ -77,7 +77,7 @@ bool __thiscall c_gui_screen_pregame_lobby_campaign::handle_list_item_chosen_(c_
7777
STRING_ID(gui, campaign_select_level),
7878
message->get_controller(),
7979
get_render_window(),
80-
m_name.get_value(),
80+
m_name,
8181
_campaign_level_setup_mode_lobby,
8282
campaign_id,
8383
map_id,
@@ -94,7 +94,7 @@ bool __thiscall c_gui_screen_pregame_lobby_campaign::handle_list_item_chosen_(c_
9494
STRING_ID(gui, campaign_select_difficulty),
9595
message->get_controller(),
9696
get_render_window(),
97-
m_name.get_value(),
97+
m_name,
9898
_campaign_difficulty_setup_mode_lobby,
9999
_campaign_id_default,
100100
_map_id_none,
@@ -114,7 +114,7 @@ bool __thiscall c_gui_screen_pregame_lobby_campaign::handle_list_item_chosen_(c_
114114
STRING_ID(gui, select_scoring),
115115
message->get_controller(),
116116
get_render_window(),
117-
m_name.get_value()))
117+
m_name))
118118
{
119119
screen_message->set_parent_screen_index(m_screen_index);
120120
user_interface_messaging_post(screen_message);
@@ -127,7 +127,7 @@ bool __thiscall c_gui_screen_pregame_lobby_campaign::handle_list_item_chosen_(c_
127127
STRING_ID(gui, campaign_select_skulls),
128128
message->get_controller(),
129129
get_render_window(),
130-
m_name.get_value()))
130+
m_name))
131131
{
132132
screen_message->set_parent_screen_index(m_screen_index);
133133
user_interface_messaging_post(screen_message);

game/source/interface/gui_screens/pregame_lobby/gui_screen_pregame_lobby_multiplayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ bool __thiscall c_gui_screen_pregame_lobby_multiplayer::handle_list_item_chosen_
3232
if (c_load_pregame_selection_screen_message* pregame_selection_screen_message = new c_load_pregame_selection_screen_message(
3333
message->get_controller(),
3434
get_render_window(),
35-
m_name.get_value(),
35+
m_name,
3636
selection_type))
3737
{
3838
pregame_selection_screen_message->set_parent_screen_index(m_screen_index);

game/source/interface/gui_screens/start_menu/panes/settings_appearance_colors/start_menu_settings_appearance_colors.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ bool __thiscall c_start_menu_settings_appearance_colors::handle_controller_input
136136
if (c_gui_widget* focused_widget = get_focused_widget())
137137
parent_list_item = focused_widget->get_parent_list_item();
138138

139-
int32 parent_list_item_name = parent_list_item->m_name.get_value();
140-
if (c_gui_list_widget* child_list = get_child_list_widget(parent_list_item_name))
139+
if (c_gui_list_widget* child_list = get_child_list_widget(parent_list_item->m_name))
141140
{
142141
int32 focused_item_index = child_list->get_focused_item_index();
143142
for (c_gui_list_item_widget* child_list_item = (c_gui_list_item_widget*)child_list->get_first_child_widget_by_type(_gui_list_item);
@@ -161,12 +160,12 @@ bool __thiscall c_start_menu_settings_appearance_colors::handle_controller_input
161160
}
162161
else if (event_type == _event_type_button_press && (component == _controller_component_button_a || component == _controller_component_button_b))
163162
{
164-
int32 parent_list_name = focused_parent_list_widget->m_name.get_value();
163+
int32 parent_list_name = focused_parent_list_widget->m_name;
165164
for (c_gui_list_item_widget* child_list_item = (c_gui_list_item_widget*)group_selector_child_list->get_first_child_widget_by_type(_gui_list_item);
166165
child_list_item;
167166
child_list_item = get_next_list_item_widget(true))
168167
{
169-
if (child_list_item->m_name.get_value() == parent_list_name)
168+
if (child_list_item->m_name == parent_list_name)
170169
{
171170
group_selector_child_list->set_focused_item_index(child_list_item->get_list_item_index(), false);
172171
transfer_focus(child_list_item);

0 commit comments

Comments
 (0)