#pragma once
#ifdef SVQC
+#include <server/autocvars.qh>
#include <server/client.qh>
#endif
.int cvar_cl_gunalign;
REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
#endif
- REGISTER_STAT(GUNALIGN, int, this.cvar_cl_gunalign)
+ REGISTER_STAT(GUNALIGN, int)
#ifdef SVQC
SPECTATE_COPYFIELD(_STAT(GUNALIGN))
#endif
#include "client.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
#include "anticheat.qh"
#include "impulse.qh"
#include "player.qh"
TRANSMUTE(Spectator, this);
}
} else {
- int preferred_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? this.cvar_cl_clippedspectating : !this.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+ int preferred_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? CS(this).cvar_cl_clippedspectating : !CS(this).cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
set_movetype(this, preferred_movetype);
}
} else {
.float last_vehiclecheck;
void PlayerPreThink (entity this)
{
+ STAT(GUNALIGN, this) = CS(this).cvar_cl_gunalign; // TODO
+ STAT(MOVEVARS_CL_TRACK_CANJUMP, this) = CS(this).cvar_cl_movement_track_canjump;
+
WarpZone_PlayerPhysics_FixVAngle(this);
if (frametime) {
}
// version nagging
- if (CS(this).version_nagtime && this.cvar_g_xonoticversion && time > CS(this).version_nagtime) {
+ if (CS(this).version_nagtime && CS(this).cvar_g_xonoticversion && time > CS(this).version_nagtime) {
CS(this).version_nagtime = 0;
- if (strstrofs(this.cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(this.cvar_g_xonoticversion, "autobuild", 0) >= 0) {
+ if (strstrofs(CS(this).cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(CS(this).cvar_g_xonoticversion, "autobuild", 0) >= 0) {
// git client
} else if (strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0) {
// git server
- Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, CS(this).cvar_g_xonoticversion);
} else {
- int r = vercmp(this.cvar_g_xonoticversion, autocvar_g_xonoticversion);
+ int r = vercmp(CS(this).cvar_g_xonoticversion, autocvar_g_xonoticversion);
if (r < 0) { // old client
- Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, CS(this).cvar_g_xonoticversion);
} else if (r > 0) { // old server
- Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, CS(this).cvar_g_xonoticversion);
}
}
}
this.last_vehiclecheck = time + 1;
}
- if(!this.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
+ if(!CS(this).cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
{
if(PHYS_INPUT_BUTTON_USE(this) && !CS(this).usekeypressed)
PlayerUseKey(this);
#pragma once
+#include "utils.qh"
+#include <common/sounds/all.qh>
+
void ClientState_attach(entity this);
IntrusiveList g_players;
ATTRIB(Client, specialcommand_pos, int, this.specialcommand_pos);
ATTRIB(Client, hitplotfh, int, this.hitplotfh);
ATTRIB(Client, clientdata, entity, this.clientdata);
+ ATTRIB(Client, cmd_floodcount, int, this.cmd_floodcount);
+ ATTRIB(Client, cmd_floodtime, float, this.cmd_floodtime);
ATTRIB(Client, wasplayer, bool, this.wasplayer);
+ // networked cvars
+
+ ATTRIB(Client, cvar_cl_allow_uid2name, int, this.cvar_cl_allow_uid2name);
+ ATTRIB(Client, cvar_cl_allow_uidtracking, int, this.cvar_cl_allow_uidtracking);
+ ATTRIB(Client, cvar_cl_autotaunt, float, this.cvar_cl_autotaunt);
+ ATTRIB(Client, cvar_cl_voice_directional, int, this.cvar_cl_voice_directional);
+ ATTRIB(Client, cvar_cl_voice_directional_taunt_attenuation, float, this.cvar_cl_voice_directional_taunt_attenuation);
+ ATTRIB(Client, cvar_cl_physics, string, this.cvar_cl_physics);
+ ATTRIB(Client, cvar_cl_buffs_autoreplace, bool, this.cvar_cl_buffs_autoreplace);
+ ATTRIB(Client, cvar_cl_nade_type, int, this.cvar_cl_nade_type);
+ ATTRIB(Client, cvar_cl_pokenade_type, string, this.cvar_cl_pokenade_type);
+ ATTRIB(Client, cvar_cl_spawn_near_teammate, bool, this.cvar_cl_spawn_near_teammate);
+ ATTRIB(Client, cvar_cl_gunalign, int, this.cvar_cl_gunalign);
+ ATTRIB(Client, cvar_cl_handicap, float, this.cvar_cl_handicap);
+ ATTRIB(Client, cvar_cl_clippedspectating, bool, this.cvar_cl_clippedspectating);
+ ATTRIB(Client, cvar_cl_autoscreenshot, int, this.cvar_cl_autoscreenshot);
+ ATTRIB(Client, cvar_cl_jetpack_jump, bool, this.cvar_cl_jetpack_jump);
+ ATTRIB(Client, cvar_cl_newusekeysupported, bool, this.cvar_cl_newusekeysupported);
+ ATTRIB(Client, cvar_cl_noantilag, bool, this.cvar_cl_noantilag);
+ ATTRIB(Client, cvar_cl_movement_track_canjump, bool, this.cvar_cl_movement_track_canjump);
+ ATTRIB(Client, cvar_cl_weaponimpulsemode, int, this.cvar_cl_weaponimpulsemode);
+ ATTRIB(Client, cvar_g_xonoticversion, string, this.cvar_g_xonoticversion);
+ ATTRIB(Client, autoswitch, bool, this.autoswitch);
+ ATTRIB(Client, cvar_cl_dodging_timeout, float, this.cvar_cl_dodging_timeout);
+ ATTRIB(Client, cvar_cl_multijump, bool, this.cvar_cl_multijump);
+ ATTRIB(Client, cvar_cl_accuracy_data_share, bool, this.cvar_cl_accuracy_data_share);
+ ATTRIB(Client, cvar_cl_accuracy_data_receive, bool, this.cvar_cl_accuracy_data_receive);
+
METHOD(Client, m_unwind, bool(Client this));
STATIC_METHOD(Client, Add, void(Client this, int _team));
#include "cmd.qh"
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
#include <common/command/_mod.qh>
#include "common.qh"
bool SV_ParseClientCommand_floodcheck(entity this)
{
+ entity store = IS_CLIENT(this) ? CS(this) : this; // unfortunately, we need to store these on the client initially
+
if (!timeout_status) // not while paused
{
- if (time <= (this.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
+ if (time <= (store.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
{
- this.cmd_floodcount += 1;
- if (this.cmd_floodcount > autocvar_sv_clientcommand_antispam_count) return false; // too much spam, halt
+ store.cmd_floodcount += 1;
+ if (store.cmd_floodcount > autocvar_sv_clientcommand_antispam_count) return false; // too much spam, halt
}
else
{
- this.cmd_floodtime = time;
- this.cmd_floodcount = 1;
+ store.cmd_floodtime = time;
+ store.cmd_floodcount = 1;
}
}
return true; // continue, as we're not flooding yet
{
if (argv(1) != "")
{
- caller.autoswitch = InterpretBoolean(argv(1));
- sprint(caller, strcat("^1autoswitch is currently turned ", (caller.autoswitch ? "on" : "off"), ".\n"));
+ CS(caller).autoswitch = InterpretBoolean(argv(1));
+ sprint(caller, strcat("^1autoswitch is currently turned ", (CS(caller).autoswitch ? "on" : "off"), ".\n"));
return;
}
}
}
default:
- sprint(caller, strcat("Current physics set: ^3", caller.cvar_cl_physics, "\n"));
+ sprint(caller, strcat("Current physics set: ^3", CS(caller).cvar_cl_physics, "\n"));
case CMD_REQUEST_USAGE:
{
sprint(caller, "\nUsage:^3 cmd physics <physics>\n");
#include "g_subs.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "antilag.qh"
#include "command/common.qh"
#include "../common/state.qh"
}
void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
{
- if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+ bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ if (autocvar_g_antilag != 2 || noantilag)
lag = 0;
traceline_antilag_force(source, v1, v2, nomonst, forent, lag);
}
void tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
{
- if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+ bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ if (autocvar_g_antilag != 2 || noantilag)
lag = 0;
tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, false);
}
}
void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
{
- if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+ bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ if (autocvar_g_antilag != 2 || noantilag)
lag = 0;
WarpZone_traceline_antilag_force(source, v1, v2, nomonst, forent, lag);
}
void WarpZone_tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag)
{
- if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
+ bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ if (autocvar_g_antilag != 2 || noantilag)
lag = 0;
tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, true);
}
this.nextthink = time + delta;
e = edict_num(this.cnt + 1);
- if(IS_REAL_CLIENT(e))
+ if(IS_CLIENT(e) && IS_REAL_CLIENT(e))
{
WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
WriteByte(MSG_BROADCAST, this.cnt);
{
FixIntermissionClient(this);
- float server_screenshot = (autocvar_sv_autoscreenshot && this.cvar_cl_autoscreenshot);
- float client_screenshot = (this.cvar_cl_autoscreenshot == 2);
+ float server_screenshot = (autocvar_sv_autoscreenshot && CS(this).cvar_cl_autoscreenshot);
+ float client_screenshot = (CS(this).cvar_cl_autoscreenshot == 2);
if( (server_screenshot || client_screenshot)
&& ((this.autoscreenshot > 0) && (time > this.autoscreenshot)) )
#include "miscfunctions.qh"
+
#include "antilag.qh"
#include "command/common.qh"
#include "constants.qh"
Notification_GetCvars(this);
- ReplicateVars(this, s, f);
+ ReplicateVars(this, CS(this), s, f);
GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[8], "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
GetCvars_handleString_Fixup(this, s, f, cvar_cl_weaponpriorities[9], "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
- GetCvars_handleFloat(this, this, s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking");
+ GetCvars_handleFloat(this, CS(this), s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking");
// fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early)
if (f > 0)
#include "gamemode_ctf.qh"
#ifndef CSQC
+#include <common/effects/all.qh>
void ctf_Initialize();
REGISTER_MUTATOR(ctf, false)
entity player = M_ARGV(0, entity);
- if(player.cvar_cl_allow_uidtracking == 1 && player.cvar_cl_allow_uid2name == 1)
+ if(CS(player).cvar_cl_allow_uidtracking == 1 && CS(player).cvar_cl_allow_uid2name == 1)
{
if (!player.stored_netname)
player.stored_netname = strzone(uid2name(player.crypto_idfp));
#include "player.qh"
+#include <common/effects/all.qh>
#include "bot/api.qh"
#include "cheats.qh"
#include "g_damage.qh"
if(!DEATH_ISSPECIAL(deathtype))
{
- damage *= bound(1.0, this.cvar_cl_handicap, 10.0);
- if(this != attacker)
- damage /= bound(1.0, attacker.cvar_cl_handicap, 10.0);
+ damage *= bound(1.0, CS(this).cvar_cl_handicap, 10.0);
+ if(this != attacker && IS_PLAYER(attacker))
+ damage /= bound(1.0, CS(attacker).cvar_cl_handicap, 10.0);
}
if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1)
#include "tracing.qh"
+#include <common/effects/all.qh>
+
#include "accuracy.qh"
#include "common.qh"
#include "hitplot.qh"
//vector prevend = w_shotend;
if (antilag)
- if (!ent.cvar_cl_noantilag)
+ if (!CS(ent).cvar_cl_noantilag)
{
if (autocvar_g_antilag == 1) // switch to "ghost" if not hitting original
{
float lag = ((IS_REAL_CLIENT(this)) ? ANTILAG_LATENCY(this) : 0);
if(lag < 0.001)
lag = 0;
- if(autocvar_g_antilag == 0 || this.cvar_cl_noantilag)
+ bool noantilag = ((IS_CLIENT(this)) ? CS(this).cvar_cl_noantilag : false);
+ if(autocvar_g_antilag == 0 || noantilag)
lag = 0; // only do hitscan, but no antilag
if(lag)
{