Skip to content

Commit

Permalink
Updating bxt_hud_origin accordingly to TAS Editor frame bulk
Browse files Browse the repository at this point in the history
  • Loading branch information
khanghugo committed Oct 14, 2022
1 parent 86cc867 commit 8e896fc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
22 changes: 17 additions & 5 deletions BunnymodXT/hud_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ namespace CustomHud

float vel;
float zvel;
float xpos;
float ypos;
float zpos;
float realyaw;
float health;
Expand Down Expand Up @@ -544,9 +546,18 @@ namespace CustomHud
}
else
{
out << "X: " << player.origin[0] << "\n"
<< "Y: " << player.origin[1] << "\n"
<< "Z: " << player.origin[2];
if (frame_bulk_selected)
{
out << "X: " << frame_bulk_status.xpos << "\n"
<< "Y: " << frame_bulk_status.ypos << "\n"
<< "Z: " << frame_bulk_status.zpos;
}
else
{
out << "X: " << player.origin[0] << "\n"
<< "Y: " << player.origin[1] << "\n"
<< "Z: " << player.origin[2];
}
}

DrawMultilineString(x, y, out.str());
Expand Down Expand Up @@ -1321,7 +1332,6 @@ namespace CustomHud

out << "Vel: " << frame_bulk_status.vel << '\n';
out << "Z Vel: " << frame_bulk_status.zvel << '\n';
out << "Z Pos: " << frame_bulk_status.zpos << '\n';

out << "Health: " << frame_bulk_status.health << '\n';
out << "Armor: " << frame_bulk_status.armor << '\n';
Expand Down Expand Up @@ -1746,13 +1756,15 @@ namespace CustomHud
return si;
}

void UpdateTASEditorStatus(const HLTAS::Frame& frame_bulk, const float& player_vel, const float& player_zvel, const float& player_zpos, const float& player_realyaw, const float& player_health, const float& player_armor, const float& player_stamina)
void UpdateTASEditorStatus(const HLTAS::Frame& frame_bulk, const float& player_vel, const float& player_zvel, const float& player_xpos, const float& player_ypos, const float& player_zpos, const float& player_realyaw, const float& player_health, const float& player_armor, const float& player_stamina)
{
frame_bulk_selected = true;
frame_bulk_status = FrameBulkStatus{};

frame_bulk_status.vel = player_vel;
frame_bulk_status.zvel = player_zvel;
frame_bulk_status.xpos = player_xpos;
frame_bulk_status.ypos = player_ypos;
frame_bulk_status.zpos = player_zpos;
frame_bulk_status.realyaw = player_realyaw;

Expand Down
2 changes: 1 addition & 1 deletion BunnymodXT/hud_custom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ namespace CustomHud

const SCREENINFO& GetScreenInfo();

void UpdateTASEditorStatus(const HLTAS::Frame& frame_bulk, const float& player_vel, const float& player_zvel, const float& player_zpos, const float& player_realyaw, const float& player_health, const float& player_armor, const float& player_stamina);
void UpdateTASEditorStatus(const HLTAS::Frame& frame_bulk, const float& player_vel, const float& player_zvel, const float& player_xpos, const float& player_ypos, const float& player_zpos, const float& player_realyaw, const float& player_health, const float& player_armor, const float& player_stamina);
};
6 changes: 5 additions & 1 deletion BunnymodXT/triangle_drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,8 @@ namespace TriangleDrawing

float current_player_vel = 0;
float current_player_zvel = 0;
float current_player_xpos = 0;
float current_player_ypos = 0;
float current_player_zpos = 0;
float current_player_realyaw = 0;

Expand All @@ -1692,6 +1694,8 @@ namespace TriangleDrawing

current_player_vel = std::hypotf(current_player_vels[0], current_player_vels[1]);
current_player_zvel = current_player_vels[2];
current_player_xpos = current_player_data.Origin[0];
current_player_ypos = current_player_data.Origin[1];
current_player_zpos = current_player_data.Origin[2];
current_player_realyaw = current_player_data.Viewangles[1];

Expand All @@ -1704,7 +1708,7 @@ namespace TriangleDrawing
// Update the HUD status before any changes, since that's the state that was visualized earlier.
CustomHud::UpdateTASEditorStatus(
frame_bulk,
current_player_vel, current_player_zvel, current_player_zpos,
current_player_vel, current_player_zvel, current_player_xpos, current_player_ypos, current_player_zpos,
current_player_realyaw,
current_player_health, current_player_armor, current_player_stamina);

Expand Down

0 comments on commit 8e896fc

Please sign in to comment.