Skip to content

Commit

Permalink
Implemented c_gui_roster_list_widget::update
Browse files Browse the repository at this point in the history
  • Loading branch information
theTwister authored and theTwister committed Dec 11, 2022
1 parent d27ad40 commit 34ba354
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 42 deletions.
21 changes: 18 additions & 3 deletions game/source/interface/gui_roster_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,27 @@
#include "memory/module.hpp"
#include "tag_files/string_ids.hpp"

HOOK_DECLARE_CLASS(0x00B24FE0, c_gui_roster_data, get_text_value);
HOOK_DECLARE_CLASS(0x00B24CA0, c_gui_roster_data, _get_integer_value);
HOOK_DECLARE_CLASS(0x00B24FE0, c_gui_roster_data, _get_text_value);

bool __fastcall c_gui_roster_data::get_text_value(c_gui_roster_data* _this, void* unused, long player_row_index, long name, c_static_wchar_string<1024>* text_value)
bool __fastcall c_gui_roster_data::_get_integer_value(c_gui_roster_data* _this, void* unused, long player_row_index, long name, long* integer_value)
{
bool result = false;
HOOK_INVOKE_CLASS(result =, c_gui_roster_data, get_text_value, bool(__thiscall*)(c_gui_roster_data*, long, long, c_static_wchar_string<1024>*), _this, player_row_index, name, text_value);
HOOK_INVOKE_CLASS(result =, c_gui_roster_data, _get_integer_value, bool(__thiscall*)(c_gui_roster_data*, long, long, long*), _this, player_row_index, name, integer_value);

// Look At Me. I'm The Bungie Now.
if (name == STRING_ID(gui, bungienet_user))
{
*integer_value |= FLAG(2);
}

return result;
}

bool __fastcall c_gui_roster_data::_get_text_value(c_gui_roster_data* _this, void* unused, long player_row_index, long name, c_static_wchar_string<1024>* text_value)
{
bool result = false;
HOOK_INVOKE_CLASS(result =, c_gui_roster_data, _get_text_value, bool(__thiscall*)(c_gui_roster_data*, long, long, c_static_wchar_string<1024>*), _this, player_row_index, name, text_value);
return result;
}

3 changes: 2 additions & 1 deletion game/source/interface/gui_roster_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ struct c_gui_roster_data : c_gui_ordered_data
static_assert(sizeof(s_player_row) == 0x1678);

public:
static bool __fastcall get_text_value(c_gui_roster_data* _this, void* unused, long player_row_index, long name, c_static_wchar_string<1024>* text_value);
static bool __fastcall _get_integer_value(c_gui_roster_data* _this, void* unused, long player_row_index, long name, long* integer_value);
static bool __fastcall _get_text_value(c_gui_roster_data* _this, void* unused, long player_row_index, long name, c_static_wchar_string<1024>* text_value);

protected:
long __unknown10C;
Expand Down
81 changes: 43 additions & 38 deletions game/source/interface/gui_roster_list_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "interface/c_gui_bitmap_widget.hpp"
#include "interface/c_gui_list_item_widget.hpp"
#include "interface/c_gui_text_widget.hpp"
#include "interface/gui_roster_data.hpp"
#include "interface/user_interface_data.hpp"
#include "interface/user_interface_utilities.hpp"
#include "memory/module.hpp"
Expand All @@ -21,8 +22,8 @@ void __fastcall c_gui_roster_list_widget::update(c_gui_roster_list_widget* _this

long selectable_item_cap_count = 0;

c_gui_data* data = _this->get_data();
if (data)
c_gui_roster_data* roster_data = static_cast<c_gui_roster_data*>(_this->get_data());
if (roster_data)
{
_this->update_team_mode();

Expand Down Expand Up @@ -95,17 +96,17 @@ void __fastcall c_gui_roster_list_widget::update(c_gui_roster_list_widget* _this
&& experience_hilite_bitmap_widget
&& rank_tray_bitmap_widget
&& rank_tray_hilite_bitmap_widget
&& data->get_text_value(element_handle, STRING_ID(gui, service_tag), &service_tag)
&& data->get_player_appearance(element_handle, &player_appearance)
&& data->get_integer_value(element_handle, STRING_ID(gui, player_index), &session_player_index)
&& data->get_integer_value(element_handle, STRING_ID(gui, player_row_type), &player_row_type)
&& data->get_integer_value(element_handle, STRING_ID(gui, controller_index), &controller_index)
&& data->get_integer_value(element_handle, STRING_ID(gui, voice_output), &voice_output)
&& data->get_integer_value(element_handle, STRING_ID(gui, special_status), &special_status)
&& data->get_integer_value(element_handle, STRING_ID(gui, experience), &experience)
&& data->get_integer_value(element_handle, STRING_ID(gui, skill_level), &skill_level)
&& data->get_integer_value(element_handle, STRING_ID(gui, bungienet_user), &bungienet_user)
//&& data->get_integer_value(element_handle, STRING_ID(gui, matchmaking), &matchmaking) // halo 3 tag test
&& roster_data->get_text_value(element_handle, STRING_ID(gui, service_tag), &service_tag)
&& roster_data->get_player_appearance(element_handle, &player_appearance)
&& roster_data->get_integer_value(element_handle, STRING_ID(gui, player_index), &session_player_index)
&& roster_data->get_integer_value(element_handle, STRING_ID(gui, player_row_type), &player_row_type)
&& roster_data->get_integer_value(element_handle, STRING_ID(gui, controller_index), &controller_index)
&& roster_data->get_integer_value(element_handle, STRING_ID(gui, voice_output), &voice_output)
&& roster_data->get_integer_value(element_handle, STRING_ID(gui, special_status), &special_status)
&& roster_data->get_integer_value(element_handle, STRING_ID(gui, experience), &experience)
&& roster_data->get_integer_value(element_handle, STRING_ID(gui, skill_level), &skill_level)
&& roster_data->get_integer_value(element_handle, STRING_ID(gui, bungienet_user), &bungienet_user)
//&& roster_data->get_integer_value(element_handle, STRING_ID(gui, matchmaking), &matchmaking) // halo 3 tag test
)
{

Expand Down Expand Up @@ -137,23 +138,16 @@ void __fastcall c_gui_roster_list_widget::update(c_gui_roster_list_widget* _this
press_a_to_join_bitmap_widget->set_visible(player_row_type3);
press_a_to_join_text_widget->set_visible(player_row_type3);

check_bitmap_widget->set_visible((special_status - 2) <= 2);
party_up_bitmap_widget->set_visible((special_status - 3) <= 1);

// Look At Me. I'm The Bungie Now.
long nameplate_sprite_frame = 3;
//if (TEST_BIT(bungienet_user, 2))
//{
// nameplate_sprite_frame = 3;
//}
//else if (TEST_BIT(bungienet_user, 1))
//{
// nameplate_sprite_frame = 2;
//}
//else
//{
// nameplate_sprite_frame = TEST_BIT(bungienet_user, 0);
//}
long nameplate_sprite_frame = TEST_BIT(bungienet_user, 0);
if (TEST_BIT(bungienet_user, 1))
{
nameplate_sprite_frame = 2;
}
else if (TEST_BIT(bungienet_user, 2))
{
nameplate_sprite_frame = 3;
}

base_color_bitmap_widget->m_sprite_frame = nameplate_sprite_frame;
base_color_hilite_bitmap_widget->m_sprite_frame = nameplate_sprite_frame;

Expand Down Expand Up @@ -200,20 +194,33 @@ void __fastcall c_gui_roster_list_widget::update(c_gui_roster_list_widget* _this
//sub_1409C7CB0(rank_tray_hilite_bitmap_widget, show_rank_tray);
}

check_bitmap_widget->set_visible(true);
party_up_bitmap_widget->set_visible(true);
switch (special_status)
{
case 2:
check_bitmap_widget->m_sprite_frame = 0;
party_up_bitmap_widget->m_sprite_frame = 0;
break;
case 3:
check_bitmap_widget->m_sprite_frame = 1;
party_up_bitmap_widget->m_sprite_frame = 1;
break;
case 4:
check_bitmap_widget->m_sprite_frame = 2;
party_up_bitmap_widget->m_sprite_frame = 2;
break;
default:
check_bitmap_widget->set_visible(false);
party_up_bitmap_widget->set_visible(false);
}

if (controller_index == -1)
if (controller_index != -1)
{
ring_of_light_bitmap_widget->set_visible(true);
ring_of_light_bitmap_widget->m_sprite_frame = controller_index;
}
else
{
switch (voice_output)
{
Expand All @@ -238,11 +245,6 @@ void __fastcall c_gui_roster_list_widget::update(c_gui_roster_list_widget* _this
break;
}
}
else
{
ring_of_light_bitmap_widget->set_visible(true);
ring_of_light_bitmap_widget->m_sprite_frame = controller_index;
}


static c_static_wchar_string<1024> name;
Expand Down Expand Up @@ -283,7 +285,7 @@ void __fastcall c_gui_roster_list_widget::update(c_gui_roster_list_widget* _this
else
{
name.clear();
data->get_text_value(element_handle, STRING_ID(global, player_name), &name);
roster_data->get_text_value(element_handle, STRING_ID(global, player_name), &name);
name_text_widget->set_text(name.get_string());
name_hilite_text_widget->set_text(name.get_string());
}
Expand Down Expand Up @@ -350,7 +352,10 @@ void __fastcall c_gui_roster_list_widget::update_render_state(c_gui_roster_list_
long color_list_index = base_color;
if (is_team_game)
{
if (session_player_index == -1 || _this->m_temporary_team[session_player_index].temporary_team_change_active)
if (session_player_index == -1
// swap this for `get_current_team_change_team_index`?
|| !_this->m_temporary_team[session_player_index].temporary_team_change_active
&& _this->m_temporary_team->lying_begin_time < a2)
{
long team = -1;
if (data)
Expand Down

0 comments on commit 34ba354

Please sign in to comment.