Skip to content

Commit

Permalink
triangle_drawing: don't call GetTrigger(Color/Alpha) functions more t…
Browse files Browse the repository at this point in the history
…han once
  • Loading branch information
SmileyAG committed Jul 11, 2024
1 parent 07f9904 commit b948729
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions BunnymodXT/triangle_drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,18 @@ namespace TriangleDrawing
continue;

const bool active = ent->v.solid != SOLID_NOT || std::strcmp(classname, "trigger_transition") == 0;
float r, g, b, a;
ServerDLL::GetTriggerColor(classname, r, g, b);
ServerDLL::GetTriggerAlpha(classname, !active, true, a);
r /= 255.0f;
g /= 255.0f;
b /= 255.0f;
a /= 255.0f;

const msurface_t *surfs = model->surfaces + model->firstmodelsurface;
for (int i = 0; i < model->nummodelsurfaces; ++i) {
// Offset to make each surface look slightly different
const float offset = i * float(M_PI) / 7;
float r, g, b, a;
ServerDLL::GetTriggerColor(classname, r, g, b);
ServerDLL::GetTriggerAlpha(classname, !active, true, a);
r /= 255.0f;
g /= 255.0f;
b /= 255.0f;
a /= 255.0f;
if (active)
a = GetPulsatingAlpha(a, svTime + offset);

Expand Down

0 comments on commit b948729

Please sign in to comment.