Skip to content

Commit

Permalink
Added bxt_triggers_color
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyAG authored and YaLTeR committed Aug 6, 2021
1 parent 478264b commit 6f33f0e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions BunnymodXT/cvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace CVars
CVarWrapper bxt_show_nodes("bxt_show_nodes", "0");
CVarWrapper bxt_show_displacer_earth_targets("bxt_show_displacer_earth_targets", "0");
CVarWrapper bxt_show_custom_triggers("bxt_show_custom_triggers", "1");
CVarWrapper bxt_triggers_color("bxt_triggers_color", "");
CVarWrapper bxt_wallhack("bxt_wallhack", "0");
CVarWrapper bxt_wallhack_additive("bxt_wallhack_additive", "0");
CVarWrapper bxt_wallhack_alpha("bxt_wallhack_alpha", "0.6");
Expand Down Expand Up @@ -154,6 +155,7 @@ namespace CVars
&bxt_disable_autosave,
&bxt_disable_changelevel,
&bxt_show_custom_triggers,
&bxt_triggers_color,
&bxt_wallhack,
&bxt_wallhack_additive,
&bxt_wallhack_alpha,
Expand Down
1 change: 1 addition & 0 deletions BunnymodXT/cvars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ namespace CVars
extern CVarWrapper bxt_show_nodes;
extern CVarWrapper bxt_show_displacer_earth_targets;
extern CVarWrapper bxt_show_custom_triggers;
extern CVarWrapper bxt_triggers_color;
extern CVarWrapper bxt_wallhack;
extern CVarWrapper bxt_wallhack_additive;
extern CVarWrapper bxt_wallhack_alpha;
Expand Down
1 change: 1 addition & 0 deletions BunnymodXT/modules/ClientDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ void ClientDLL::RegisterCVarsAndCommands()
if (ORIG_HUD_DrawTransparentTriangles && pEngfuncs) {
REG(bxt_show_triggers);
REG(bxt_show_custom_triggers);
REG(bxt_triggers_color);
REG(bxt_show_nodes);
REG(bxt_show_pickup_bbox);
REG(bxt_show_displacer_earth_targets);
Expand Down
21 changes: 20 additions & 1 deletion BunnymodXT/triangle_drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,26 @@ namespace TriangleDrawing
auto corner_positions = trigger.get_corner_positions();

pTriAPI->RenderMode(kRenderTransAdd);
pTriAPI->Color4f(1.0f, 0.5f, 0.0f, 0.3f);

if (!CVars::bxt_triggers_color.IsEmpty())
{
unsigned r = 0, g = 0, b = 0, a = 0;
std::istringstream ss(CVars::bxt_triggers_color.GetString());
ss >> r >> g >> b >> a;

static float triggerColor[3];
triggerColor[0] = r / 255.0f;
triggerColor[1] = g / 255.0f;
triggerColor[2] = b / 255.0f;
triggerColor[3] = a / 255.0f;

pTriAPI->Color4f(triggerColor[0], triggerColor[1], triggerColor[2], triggerColor[3]);
}
else
{
pTriAPI->Color4f(1.0f, 0.5f, 0.0f, 0.3f);
}

TriangleUtils::DrawAACuboid(pTriAPI, corner_positions.first, corner_positions.second);

pTriAPI->RenderMode(kRenderTransColor);
Expand Down

0 comments on commit 6f33f0e

Please sign in to comment.