int mask = (intermission || (getstati(STAT_HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
float a = this.alpha;
int c = stof(getplayerkeyvalue(current_player, "colors"));
- vector g = this.glowmod; // TODO: completely clientside: colormapPaletteColor(c & 0x0F, true) * 2;
+ vector g;
+ Weapon wep = Weapons_from(switchingweapon);
+ if (!(g = wep.wr_glow(wep))) g = colormapPaletteColor(c & 0x0F, true) * 2;
entity me = CSQCModel_server2csqc(player_localentnum - 1);
int fx = ((me.csqcmodel_effects & EFMASK_CHEAP)
| EF_NODEPTHTEST)
#ifndef STATS_H
#define STATS_H
+#ifdef SVQC
+#include "../server/cl_client.qh"
+#endif
+
// Full list of all stat constants, included in a single location for easy reference
// 255 is the current limit (MAX_CL_STATS - 1), engine will need to be modified if you wish to add more stats
/** weapon currently being switched to (is copied from switchweapon once switch is possible) */
REGISTER_STAT(SWITCHINGWEAPON, int)
REGISTER_STAT(WEAPON_NEXTTHINK, float)
+#ifdef SVQC
+SPECTATE_COPY(_STAT(WEAPON_NEXTTHINK))
+#endif
REGISTER_STAT(GAMESTARTTIME, float)
REGISTER_STAT(STRENGTH_FINISHED, float)
}
#endif
-REGISTER_NET_TEMP(wglow)
-#ifdef CSQC
-NET_HANDLE(wglow, bool isNew)
-{
- vector g = '0 0 0';
- g.x = ReadCoord();
- g.y = ReadCoord();
- g.z = ReadCoord();
- viewmodel.glowmod = g;
- return true;
-}
-#endif
-
-#ifdef SVQC
-void wglow_send(entity actor, vector g)
-{
- if (!IS_REAL_CLIENT(actor)) return;
- int channel = MSG_ONE;
- msg_entity = actor;
- WriteHeader(channel, wglow);
- WriteCoord(channel, g.x);
- WriteCoord(channel, g.y);
- WriteCoord(channel, g.z);
-}
-#endif
-
#endif
#endif
// no weapon specific image for this weapon
return false;
}
+ /** (CLIENT) weapon specific glow */
+ METHOD(Weapon, wr_glow, vector(Weapon this)) { return '0 0 0'; }
/** (SERVER) the weapon is dropped */
METHOD(Weapon, wr_drop, void(Weapon this)) {}
/** (SERVER) a weapon is picked up */
#endif
#ifdef IMPLEMENTATION
+REGISTER_STAT(WEP_CVAR_vortex_charge, bool, WEP_CVAR(vortex, charge))
+REGISTER_STAT(WEP_CVAR_vortex_charge_animlimit, float, WEP_CVAR(vortex, charge_animlimit))
+
+#if defined(CSQC)
+float autocvar_g_weapon_charge_colormod_red_full;
+float autocvar_g_weapon_charge_colormod_red_half;
+float autocvar_g_weapon_charge_colormod_green_full;
+float autocvar_g_weapon_charge_colormod_blue_full;
+float autocvar_g_weapon_charge_colormod_blue_half;
+float autocvar_g_weapon_charge_colormod_green_half;
+float autocvar_g_weapon_charge_colormod_hdrmultiplier;
+
+METHOD(Vortex, wr_glow, vector(Vortex this))
+{
+ if (!STAT(WEP_CVAR_vortex_charge)) return '0 0 0';
+ float charge = STAT(VORTEX_CHARGE);
+ float animlimit = STAT(WEP_CVAR_vortex_charge_animlimit);
+ vector g;
+ g.x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, charge / animlimit);
+ g.y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, charge / animlimit);
+ g.z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * min(1, charge / animlimit);
+ if (charge > animlimit)
+ {
+ g.x += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (charge - animlimit) / (1 - animlimit);
+ g.y += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (charge - animlimit) / (1 - animlimit);
+ g.z += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (charge - animlimit) / (1 - animlimit);
+ }
+ return g;
+}
+#endif
+
REGISTER_NET_TEMP(TE_CSQC_VORTEXBEAMPARTICLE)
#if defined(SVQC)
bool autocvar_g_waypointeditor;
int autocvar_g_waypointeditor_auto;
bool autocvar_g_waypoints_for_items;
-float autocvar_g_weapon_charge_colormod_blue_full;
-float autocvar_g_weapon_charge_colormod_blue_half;
-float autocvar_g_weapon_charge_colormod_green_full;
-float autocvar_g_weapon_charge_colormod_green_half;
-float autocvar_g_weapon_charge_colormod_hdrmultiplier;
-float autocvar_g_weapon_charge_colormod_red_full;
-float autocvar_g_weapon_charge_colormod_red_half;
#define autocvar_g_weapon_stay cvar("g_weapon_stay")
bool autocvar_g_weapon_throwable;
#define autocvar_g_weaponarena cvar_string("g_weaponarena")
======================
*/
-void SpectateCopy(entity spectatee)
-{SELFPARAM();
+void SpectateCopy(entity this, entity spectatee)
+{
MUTATOR_CALLHOOK(SpectateCopy, spectatee, self);
self.armortype = spectatee.armortype;
self.armorvalue = spectatee.armorvalue;
self.switchweapon = spectatee.switchweapon;
self.switchingweapon = spectatee.switchingweapon;
self.weapon = spectatee.weapon;
- self.weapon_nextthink = spectatee.weapon_nextthink;
self.vortex_charge = spectatee.vortex_charge;
self.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
self.hagar_load = spectatee.hagar_load;
return false;
}
- SpectateCopy(self.enemy);
+ SpectateCopy(this, this.enemy);
return true;
}
}
-void wglow_send(entity actor, vector g);
-
/*
=============
PlayerPreThink
if(frametime)
{
- vector g;
- if (IS_SPEC(self))
- {
- g = self.enemy.weaponentity_glowmod;
- }
- else if(self.weapon == WEP_VORTEX.m_id && WEP_CVAR(vortex, charge))
- {
- g.x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit));
- g.y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit));
- g.z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit));
-
- if(self.vortex_charge > WEP_CVAR(vortex, charge_animlimit))
- {
- g.x += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit));
- g.y += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit));
- g.z += autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit));
- }
- }
- else
- g = colormapPaletteColor(self.clientcolors & 0x0F, true) * 2;
- if (g != self.weaponentity_glowmod)
- wglow_send(self, self.weaponentity_glowmod = g);
player_powerups();
}
float Spectate(entity pl);
+#define SPECTATE_COPY(fld) [[accumulate]] void SpectateCopy(entity this, entity spectatee) { this.(fld) = spectatee.(fld); }
+
#endif