Skip to content

Add transparency to your own team flags when close by #1338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions csqc/pmove.qc
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,8 @@ static void ParseCvars() {

#define MUX_IN(ef, bit, src) \
do { if ((ef) & (bit)) { rad = max(rad, src.i); col += src.v; } } while (0)
static void LocalEffects() {
float effects = pstate_server.effects;

void LocalEffects(float effects, vector org) {
float rad = 0;
vector col = '0 0 0';

Expand All @@ -946,7 +946,7 @@ static void LocalEffects() {
MUX_IN(effects, EF_BLUE, bluelight_l);

rad = min(rad, 400);
dynamiclight_add(pm.vieworg, rad, col);
dynamiclight_add(org, rad, col, 0, "", 0);
}
#undef MUX_IN

Expand All @@ -958,7 +958,7 @@ void PM_UpdateView() {
makevectors(view_angles);
SetListener(pm.vieworg, v_forward, v_right, v_up);

LocalEffects();
LocalEffects(pstate_server.effects, pm.vieworg);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
23 changes: 17 additions & 6 deletions csqc/tfx.qc
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,20 @@ static void UpdateFlagOutline(entity flag) {
}

float UpdateFlag(float isnew) {
if (isnew) {
float mindex = self.modelindex;
AddOutline(self);
// Flags have their own shader already, just make them shiny for now.
}
/* if (isnew) { */
/* float mindex = self.modelindex; */
/* AddOutline(self); */
/* // Flags have their own shader already, just make them shiny for now. */
/* } */

UpdateFlagOutline(self);
/* UpdateFlagOutline(self); */

LocalEffects(self.effects, self.origin);

if (self.skin == team_no) {
local float distance = vlen(self.origin - PM_Org());
self.alpha = min(0.25 + (distance / 200), 1);
}

return TRUE;
}
Expand Down Expand Up @@ -309,4 +316,8 @@ void TF_Init() {

shader_over_outline = shaderforname(rnds("over_outline"), "{ sort 7 }");
#endif

deltalisten("progs/ff_flag.mdl", UpdateFlag, 0);
deltalisten("progs/tf_flag.mdl", UpdateFlag, 0);
deltalisten("progs/tf_stan.mdl", UpdateFlag, 0);
}