Git Repos / fte_dogmode / qc / cshift.qc
Last update to this file was on 2024-03-24 at 02:40.
Show cshift.qc
//==============================================================================
// cshift.qc
//==============================================================================
//======================================================================
// fields
//======================================================================
.entity csf_controller; // cshift controller
.vector csf_color;
.float csf_density;
.float fade_amt;
//======================================================================
// forward declarations
//======================================================================
inline void(entity client, float density, vector color) csf_save;
inline void(entity client) csf_apply;
void(entity client, float density, vector color) csf_set;
void() csf_controller_think;
void(entity client) csf_controller_start;
void(entity client, float density, vector color, float spd) csf_fade;
//------------------------------------------------------------------------------
//----------------------------------------------------------------------
inline void(entity client, float density, vector color) csf_save =
{
client.csf_color = color;
client.csf_density = density;
};
//----------------------------------------------------------------------
inline void(entity client) csf_apply =
{
stuffcmd (client, "\nv_cshift ");
stuffcmd (client, ftos(client.csf_color_x));
stuffcmd (client, " ");
stuffcmd (client, ftos(client.csf_color_y));
stuffcmd (client, " ");
stuffcmd (client, ftos(client.csf_color_z));
stuffcmd (client, " ");
stuffcmd (client, ftos(client.csf_density));
stuffcmd (client, "\n");
};
//----------------------------------------------------------------------
void(entity client, float density, vector color) csf_set =
{
csf_save (client, density, color);
csf_apply (client);
};
//----------------------------------------------------------------------
void() csf_controller_think =
{
entity e = self.owner;
if (self.pain_finished > time && e.csf_density != self.csf_density)
{
local float density, fraction;
local vector color;
// wat
fraction = 1 - (self.pain_finished - time) / self.speed;
density = lerp_hermite (e.csf_density, self.csf_density,
fraction);
color = lerp_vector_hermite (e.csf_color, self.csf_color,
fraction);
csf_set (e, density, color);
self.nextthink = time + 0.04;
}
else
{
csf_set (e, self.csf_density, self.csf_color);
}
};
//----------------------------------------------------------------------
void(entity client) csf_controller_start =
{
if (client.csf_controller.classname == "csfcontroller" &&
client.csf_controller.owner == client)
{
return;
}
entity e = spawn ();
client.csf_controller = e;
e.owner = client;
e.classname = "csfcontroller";
e.think = csf_controller_think;
};
//----------------------------------------------------------------------
void(entity client, float density, vector color, float spd) csf_fade =
{
csf_controller_start (client);
entity ct = client.csf_controller;
ct.speed = spd;
ct.pain_finished = time + spd;
ct.csf_color = color;
ct.csf_density = density;
ct.nextthink = time + 0.04;
};
Return to the top of this page or return to the overview of this repo.
Log cshift.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2024-03-24 | 2nd pass refactor, rework QC class structure | cev | +33 | -11 |
2024-01-31 | Class based monster refactor & start projectiles | cev | +1 | -2 |
2023-12-02 | More refactoring & moving, begin adding mdls & snd | cev | +15 | -4 |
2023-11-16 | pmove bug fixes, moved q3 compat code, cleanup | cev | +48 | -44 |
2023-10-13 | Rename "qc-server" dir to "qc" | cev | +75 |
Return to the top of this page or return to the overview of this repo.