#ifdef CSQC
REGISTER_MUTATOR(cl_nades, true);
-MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay)
-{
- // TODO: make a common orb state!
- if (STAT(HEALING_ORB) > time)
- {
- M_ARGV(0, vector) = NADE_TYPE_HEAL.m_color;
- M_ARGV(1, float) = STAT(HEALING_ORB_ALPHA);
- return true;
- }
- if (STAT(ENTRAP_ORB) > time)
- {
- M_ARGV(0, vector) = NADE_TYPE_ENTRAP.m_color;
- M_ARGV(1, float) = STAT(ENTRAP_ORB_ALPHA);
- return true;
- }
- if (STAT(VEIL_ORB) > time)
- {
- M_ARGV(0, vector) = NADE_TYPE_VEIL.m_color;
- M_ARGV(1, float) = STAT(VEIL_ORB_ALPHA);
- return true;
- }
- return false;
-}
MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile)
{
entity proj = M_ARGV(0, entity);
if ( IS_REAL_CLIENT(toucher) || (IS_VEHICLE(toucher) && toucher.owner) )
{
entity show_tint = (IS_VEHICLE(toucher) && toucher.owner) ? toucher.owner : toucher;
- STAT(ENTRAP_ORB, show_tint) = time + 0.1;
-
- float tint_alpha = 0.75;
- if(SAME_TEAM(toucher, this.realowner))
- tint_alpha = 0.45;
- STAT(ENTRAP_ORB_ALPHA, show_tint) = tint_alpha * (this.ltime - time) / this.orb_lifetime;
+ show_tint.nade_entrap_time = time + 0.1;
}
}
}
}
-
- if ( IS_REAL_CLIENT(toucher) || (IS_VEHICLE(toucher) && toucher.owner) )
- {
- entity show_red = (IS_VEHICLE(toucher) && toucher.owner) ? toucher.owner : toucher;
- STAT(HEALING_ORB, show_red) = time+0.1;
- STAT(HEALING_ORB_ALPHA, show_red) = 0.75 * (this.ltime - time) / this.orb_lifetime;
- }
}
void nade_heal_boom(entity this)
if(SAME_TEAM(toucher, this.realowner))
{
tint_alpha = 0.45;
- if(!STAT(VEIL_ORB, show_tint))
+ if(!show_tint.nade_veil_time)
{
toucher.nade_veil_prevalpha = toucher.alpha;
toucher.alpha = -1;
}
}
- STAT(VEIL_ORB, show_tint) = time + 0.1;
- STAT(VEIL_ORB_ALPHA, show_tint) = tint_alpha * (this.ltime - time) / this.orb_lifetime;
+ show_tint.nade_veil_time = time + 0.1;
}
}
STAT(NADE_BONUS, player) = STAT(NADE_BONUS_SCORE, player) = 0;
}
- if(STAT(VEIL_ORB, player) && STAT(VEIL_ORB, player) <= time)
+ if(player.nade_veil_time && player.nade_veil_time <= time)
{
- STAT(VEIL_ORB, player) = 0;
+ player.nade_veil_time = 0;
if(player.vehicle)
player.vehicle.alpha = player.vehicle.nade_veil_prevalpha;
else
entity player = M_ARGV(0, entity);
// these automatically reset, no need to worry
- if(STAT(ENTRAP_ORB, player) > time)
+ if(player.nade_entrap_time > time)
STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_nades_entrap_speed;
}
{
entity mon = M_ARGV(0, entity);
- if (STAT(ENTRAP_ORB, mon) > time)
+ if (mon.nade_entrap_time > time)
{
M_ARGV(1, float) *= autocvar_g_nades_entrap_speed; // run speed
M_ARGV(2, float) *= autocvar_g_nades_entrap_speed; // walk speed
}
- if (STAT(VEIL_ORB, mon) && STAT(VEIL_ORB, mon) <= time)
+ if (mon.nade_veil_time && mon.nade_veil_time <= time)
{
mon.alpha = mon.nade_veil_prevalpha;
- STAT(VEIL_ORB, mon) = 0;
+ mon.nade_veil_time = 0;
}
}
client.pokenade_type = spectatee.pokenade_type;
STAT(NADE_BONUS, client) = STAT(NADE_BONUS, spectatee);
STAT(NADE_BONUS_SCORE, client) = STAT(NADE_BONUS_SCORE, spectatee);
- STAT(HEALING_ORB, client) = STAT(HEALING_ORB, spectatee);
- STAT(HEALING_ORB_ALPHA, client) = STAT(HEALING_ORB_ALPHA, spectatee);
- STAT(ENTRAP_ORB, client) = STAT(ENTRAP_ORB, spectatee);
- STAT(ENTRAP_ORB_ALPHA, client) = STAT(ENTRAP_ORB_ALPHA, spectatee);
- STAT(VEIL_ORB, client) = STAT(VEIL_ORB, spectatee);
- STAT(VEIL_ORB_ALPHA, client) = STAT(VEIL_ORB_ALPHA, spectatee);
}
MUTATOR_HOOKFUNCTION(nades, BuildMutatorsPrettyString)
#include "nades.qh"
#ifdef CSQC
+#include <client/view.qh>
+
.float ltime;
void orb_draw(entity this)
{
this.angles = this.angles + dt * this.avelocity;
}
+float orb_drawtime; // global storage of last drawn orb frame, to counter overlapping orbs
+void orb_draw2d(entity this)
+{
+ if(time <= orb_drawtime)
+ return;
+
+ if(boxesoverlap(view_origin - '1 1 1', view_origin + '1 1 1', this.absmin, this.absmax))
+ {
+ orb_drawtime = time; // prevent rendering more than one of these per frame!
+ float orb_alpha = 0.65 * (this.ltime - time) / this.orb_lifetime;
+ drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), this.colormod, autocvar_hud_colorflash_alpha * orb_alpha, DRAWFLAG_ADDITIVE);
+ }
+}
+
void orb_setup(entity e)
{
setmodel(e, MDL_NADE_ORB);
e.orb_radius = e.orb_radius/model_radius*0.6;
e.draw = orb_draw;
+ e.draw2d = orb_draw2d;
IL_PUSH(g_drawables, e);
+ IL_PUSH(g_drawables_2d, e);
SetResourceExplicit(e, RES_HEALTH, 255);
set_movetype(e, MOVETYPE_NONE);
e.solid = SOLID_NOT;
REGISTER_STAT(NADE_BONUS, float)
REGISTER_STAT(NADE_BONUS_TYPE, int)
REGISTER_STAT(NADE_BONUS_SCORE, float)
-REGISTER_STAT(HEALING_ORB, float)
-REGISTER_STAT(HEALING_ORB_ALPHA, float)
REGISTER_STAT(PLASMA, int)
REGISTER_STAT(FROZEN, int)
REGISTER_STAT(REVIVE_PROGRESS, float)
REGISTER_STAT(ROUNDLOST, int)
REGISTER_STAT(CAPTURE_PROGRESS, float)
-REGISTER_STAT(ENTRAP_ORB, float)
-REGISTER_STAT(ENTRAP_ORB_ALPHA, float)
REGISTER_STAT(ITEMSTIME, int, autocvar_sv_itemstime)
REGISTER_STAT(KILL_TIME, float)
-REGISTER_STAT(VEIL_ORB, float)
-REGISTER_STAT(VEIL_ORB_ALPHA, float)
#ifdef SVQC
float autocvar_sv_showfps = 0;