Skip to content

Commit 9a2bc09

Browse files
committed
Impl try_and_get_render_data_emblem_info
`c_gui_player_select_screen_widget::try_and_get_render_data_emblem_info`
1 parent 3107a36 commit 9a2bc09

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

game/source/interface/gui_screens/player_select/gui_player_select_screen_widget.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#include "interface/gui_screens/player_select/gui_player_select_screen_widget.hpp"
22

33
#include "game/game_results.hpp"
4+
#include "interface/c_gui_bitmap_widget.hpp"
45
#include "interface/user_interface_networking.hpp"
56
#include "interface/user_interface_text.hpp"
67
#include "interface/user_interface_text_parser.hpp"
78
#include "memory/module.hpp"
89

910
HOOK_DECLARE_CLASS_MEMBER(0x00B08A10, c_gui_player_select_screen_widget, initialize_);
11+
HOOK_DECLARE_CLASS_MEMBER(0x00B0A130, c_gui_player_select_screen_widget, try_and_get_render_data_emblem_info_);
1012

1113
// $TODO: reimplement `c_gui_player_select_screen_widget::update`
1214
// $TODO: reimplement `c_gui_player_select_screen_widget::update_render_state`
@@ -252,3 +254,40 @@ void __thiscall c_gui_player_select_screen_widget::initialize_()
252254
add_game_tag_parser(new c_magic_string_game_tag_parser(L"<most-killed-by-count", this, parse_most_killed_by_count));
253255
add_game_tag_parser(new c_magic_string_game_tag_parser(L"<rematch-timer", this, parse_rematch_timer));
254256
}
257+
258+
bool __thiscall c_gui_player_select_screen_widget::try_and_get_render_data_emblem_info_(c_gui_bitmap_widget* bitmap_widget, s_emblem_info* emblem_info)
259+
{
260+
ASSERT(bitmap_widget != NULL);
261+
ASSERT(emblem_info != NULL);
262+
263+
if (!bitmap_widget->renders_as_player_emblem())
264+
{
265+
return false;
266+
}
267+
268+
c_game_results const* final_game_results = user_interface_networking_get_final_game_results();
269+
270+
s_player_configuration const* configuration = NULL;
271+
if (bitmap_widget->m_name == STRING_ID(gui, killed_emblem))
272+
{
273+
if (final_game_results && m_killed_most_player_index != NONE)
274+
{
275+
configuration = &final_game_results->players[m_killed_most_player_index].configuration;
276+
}
277+
}
278+
else if (bitmap_widget->m_name == STRING_ID(gui, killed_by_emblem))
279+
{
280+
if (final_game_results && m_killed_most_by_player_index != NONE)
281+
{
282+
configuration = &final_game_results->players[m_killed_most_by_player_index].configuration;
283+
}
284+
}
285+
286+
if (!configuration)
287+
{
288+
return false;
289+
}
290+
291+
*emblem_info = configuration->host.appearance.emblem_info;
292+
return true;
293+
}

game/source/interface/gui_screens/player_select/gui_player_select_screen_widget.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ struct c_gui_player_select_screen_widget :
99
public:
1010
void __thiscall initialize_();
1111

12+
bool __thiscall try_and_get_render_data_emblem_info_(c_gui_bitmap_widget* bitmap_widget, s_emblem_info* emblem_info);
13+
1214
c_gui_player_select_screen_widget(int32 name) :
1315
c_gui_screen_widget(name)
1416
{

0 commit comments

Comments
 (0)