|
1 | 1 | #include "interface/gui_screens/player_select/gui_player_select_screen_widget.hpp" |
2 | 2 |
|
3 | 3 | #include "game/game_results.hpp" |
| 4 | +#include "interface/c_gui_bitmap_widget.hpp" |
4 | 5 | #include "interface/user_interface_networking.hpp" |
5 | 6 | #include "interface/user_interface_text.hpp" |
6 | 7 | #include "interface/user_interface_text_parser.hpp" |
7 | 8 | #include "memory/module.hpp" |
8 | 9 |
|
9 | 10 | 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_); |
10 | 12 |
|
11 | 13 | // $TODO: reimplement `c_gui_player_select_screen_widget::update` |
12 | 14 | // $TODO: reimplement `c_gui_player_select_screen_widget::update_render_state` |
@@ -252,3 +254,40 @@ void __thiscall c_gui_player_select_screen_widget::initialize_() |
252 | 254 | add_game_tag_parser(new c_magic_string_game_tag_parser(L"<most-killed-by-count", this, parse_most_killed_by_count)); |
253 | 255 | add_game_tag_parser(new c_magic_string_game_tag_parser(L"<rematch-timer", this, parse_rematch_timer)); |
254 | 256 | } |
| 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 | +} |
0 commit comments