org = casingowner.origin + casingowner.view_ofs + org.x * v_forward - org.y * v_right + org.z * v_up;
FOREACH_CLIENT(true, {
- if (!(CS(it).cvar_cl_casings))
+ if (!(CS_CVAR(it).cvar_cl_casings))
continue;
- if (it == casingowner && !(CS(it).cvar_r_drawviewmodel))
+ if (it == casingowner && !(CS_CVAR(it).cvar_r_drawviewmodel))
continue;
msg_entity = it;
msg_entity = this.pusher;
if (IS_REAL_CLIENT(msg_entity))
{
- float atten = (CS(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE;
+ float atten = (CS_CVAR(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE;
if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten, thepitch);
else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten, thepitch);
else soundto(MSG_ONE, this, chan, sample, vol, atten, thepitch);
{
#define X() \
MACRO_BEGIN \
- float atten = (CS(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE; \
+ float atten = (CS_CVAR(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE; \
if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten, thepitch); \
else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten, thepitch); \
else soundto(MSG_ONE, this, chan, sample, vol, atten, thepitch); \
#define X() \
MACRO_BEGIN \
- if (voicetype != VOICETYPE_AUTOTAUNT || tauntrand < CS(msg_entity).cvar_cl_autotaunt) \
+ if (voicetype != VOICETYPE_AUTOTAUNT || tauntrand < CS_CVAR(msg_entity).cvar_cl_autotaunt) \
{ \
- float atten = (CS(msg_entity).cvar_cl_voice_directional >= 1) \
- ? bound(ATTEN_MIN, CS(msg_entity).cvar_cl_voice_directional_taunt_attenuation, \
+ float atten = (CS_CVAR(msg_entity).cvar_cl_voice_directional >= 1) \
+ ? bound(ATTEN_MIN, CS_CVAR(msg_entity).cvar_cl_voice_directional_taunt_attenuation, \
ATTEN_MAX) \
: ATTEN_NONE; \
if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten, thepitch); \
entity player = M_ARGV(0, entity);
- if(CS(player).cvar_cl_allow_uidtracking == 1 && CS(player).cvar_cl_allow_uid2name == 1)
+ if(CS_CVAR(player).cvar_cl_allow_uidtracking == 1 && CS_CVAR(player).cvar_cl_allow_uid2name == 1)
{
if (!player.stored_netname)
player.stored_netname = strzone(uid2name(player.crypto_idfp));
{
entity player = M_ARGV(0, entity);
- if(CS(player).cvar_cl_allow_uidtracking == 1 && CS(player).cvar_cl_allow_uid2name == 1)
+ if(CS_CVAR(player).cvar_cl_allow_uidtracking == 1 && CS_CVAR(player).cvar_cl_allow_uid2name == 1)
{
if (!player.stored_netname)
player.stored_netname = strzone(uid2name(player.crypto_idfp));
{
entity player = M_ARGV(0, entity);
- if(CS(player).cvar_cl_allow_uidtracking == 1 && CS(player).cvar_cl_allow_uid2name == 1)
+ if(CS_CVAR(player).cvar_cl_allow_uidtracking == 1 && CS_CVAR(player).cvar_cl_allow_uid2name == 1)
{
if (!player.stored_netname)
player.stored_netname = strzone(uid2name(player.crypto_idfp));
if (STAT(BUFFS, view))
{
- return CS(view).cvar_cl_buffs_autoreplace == false || STAT(BUFFS, view) != STAT(BUFFS, this.owner);
+ return CS_CVAR(view).cvar_cl_buffs_autoreplace == false || STAT(BUFFS, view) != STAT(BUFFS, this.owner);
}
return WaypointSprite_visible_for_player(this, player, view);
if (STAT(BUFFS, toucher))
{
- if (CS(toucher).cvar_cl_buffs_autoreplace && STAT(BUFFS, toucher) != STAT(BUFFS, this))
+ if (CS_CVAR(toucher).cvar_cl_buffs_autoreplace && STAT(BUFFS, toucher) != STAT(BUFFS, this))
{
// TODO: lost-gained notification for this case
int buffid = buff_FirstFromFlags(STAT(BUFFS, toucher)).m_id;
.float cvar_cl_dodging_timeout;
.bool cvar_cl_dodging;
#define PHYS_DODGING_FRAMETIME sys_frametime
- #define PHYS_DODGING_TIMEOUT(s) CS(s).cvar_cl_dodging_timeout
+ #define PHYS_DODGING_TIMEOUT(s) CS_CVAR(s).cvar_cl_dodging_timeout
#define PHYS_DODGING_PRESSED_KEYS(s) CS(s).pressedkeys
- #define PHYS_DODGING_ENABLED(s) CS(s).cvar_cl_dodging
+ #define PHYS_DODGING_ENABLED(s) CS_CVAR(s).cvar_cl_dodging
#endif
#ifdef SVQC
#elif defined(SVQC)
.int cvar_cl_multijump;
- #define PHYS_MULTIJUMP_CLIENT(s) CS(s).cvar_cl_multijump
+ #define PHYS_MULTIJUMP_CLIENT(s) CS_CVAR(s).cvar_cl_multijump
#endif
MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics)
}
else
{
- ntype = ((autocvar_g_nades_client_select) ? CS(this).cvar_cl_nade_type : autocvar_g_nades_nade_type);
- pntype = ((autocvar_g_nades_client_select) ? CS(this).cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
+ ntype = ((autocvar_g_nades_client_select) ? CS_CVAR(this).cvar_cl_nade_type : autocvar_g_nades_nade_type);
+ pntype = ((autocvar_g_nades_client_select) ? CS_CVAR(this).cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
}
spawn_held_nade(this, this, autocvar_g_nades_nade_lifetime, ntype, pntype);
if(autocvar_g_nades_bonus_client_select)
{
- STAT(NADE_BONUS_TYPE, player) = CS(player).cvar_cl_nade_type;
- player.pokenade_type = CS(player).cvar_cl_pokenade_type;
+ STAT(NADE_BONUS_TYPE, player) = CS_CVAR(player).cvar_cl_nade_type;
+ player.pokenade_type = CS_CVAR(player).cvar_cl_pokenade_type;
}
else
{
player.nade_refire = time + autocvar_g_nades_nade_refire;
if(autocvar_g_nades_bonus_client_select)
- STAT(NADE_BONUS_TYPE, player) = CS(player).cvar_cl_nade_type;
+ STAT(NADE_BONUS_TYPE, player) = CS_CVAR(player).cvar_cl_nade_type;
STAT(NADE_TIMER, player) = 0;
entity spawn_spot = M_ARGV(1, entity);
vector spawn_score = M_ARGV(2, vector);
- if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && CS(player).cvar_cl_spawn_near_teammate))
+ if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && CS_CVAR(player).cvar_cl_spawn_near_teammate))
return;
spawn_spot.msnt_lookat = NULL;
return; // at least 1 team has only 1 player, let's not give the bigger team too much of an advantage!
// Note: when entering this, fixangle is already set.
- if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && CS(player).cvar_cl_spawn_near_teammate))
+ if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && CS_CVAR(player).cvar_cl_spawn_near_teammate))
{
if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death)
player.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
// used by MSG_CHOICE to build list of choices
#ifdef SVQC
-void Notification_GetCvars(entity this)
+void Notification_GetCvars(entity this, entity store)
{
FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum == NUM_TEAM_1), {
GetCvars_handleFloat(
this,
- CS(this),
+ store,
get_cvars_s,
get_cvars_f,
msg_choice_choices[it.nent_choice_idx],
#endif
#ifdef SVQC
-void Notification_GetCvars(entity this);
+void Notification_GetCvars(entity this, entity store);
float autocvar_notification_server_allows_location = 1; // 0 = no, 1 = yes
#else
float autocvar_notification_item_centerprinttime = 1.5;
if(!autocvar_g_physics_clientselect)
return defaultval;
- if(IS_REAL_CLIENT(this) && Physics_Valid(CS(this).cvar_cl_physics))
+ if(IS_REAL_CLIENT(this) && Physics_Valid(CS_CVAR(this).cvar_cl_physics))
{
- string s = strcat("g_physics_", CS(this).cvar_cl_physics, "_", option);
+ string s = strcat("g_physics_", CS_CVAR(this).cvar_cl_physics, "_", option);
if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
return cvar(s);
}
#ifdef SVQC
- #define JETPACK_JUMP(s) CS(s).cvar_cl_jetpack_jump
+ #define JETPACK_JUMP(s) CS_CVAR(s).cvar_cl_jetpack_jump
#elif defined(CSQC)
float autocvar_cl_jetpack_jump;
#define JETPACK_JUMP(s) autocvar_cl_jetpack_jump
#define PHYS_JUMPSPEEDCAP_MIN autocvar_sv_jumpspeedcap_min
#define PHYS_JUMPSPEEDCAP_MAX autocvar_sv_jumpspeedcap_max
- #define PHYS_CL_TRACK_CANJUMP(s) (CS(s).cvar_cl_movement_track_canjump)
+ #define PHYS_CL_TRACK_CANJUMP(s) (CS_CVAR(s).cvar_cl_movement_track_canjump)
#endif
db_put(PS_GR_OUT_DB, sprintf("%s:_playerid", p.playerstats_id), ftos(p.playerid));
- if(CS(p).cvar_cl_allow_uid2name == 1 || IS_BOT_CLIENT(p))
+ if(CS_CVAR(p).cvar_cl_allow_uid2name == 1 || IS_BOT_CLIENT(p))
db_put(PS_GR_OUT_DB, sprintf("%s:_netname", p.playerstats_id), playername(p.netname, p.team, false));
if(teamplay)
PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_AVGLATENCY, latency);
}
- db_put(PS_GR_OUT_DB, sprintf("%s:_ranked", p.playerstats_id), ftos(CS(p).cvar_cl_allow_uidranking));
+ db_put(PS_GR_OUT_DB, sprintf("%s:_ranked", p.playerstats_id), ftos(CS_CVAR(p).cvar_cl_allow_uidranking));
}
strfree(p.playerstats_id);
void ClientState_detach(entity this)
{
- GetCvars(this, CS(this), -1); // free cvars TODO: is this still needed now that it's stored on the clientstate entity?
+ GetCvars(this, CS_CVAR(this), -1); // free cvars TODO: is this still needed now that it's stored on the clientstate entity?
accuracy_free(this); // TODO: needs to be before CS() is deleted!
PlayerScore_Detach(this); // what ^they^ said
W_HitPlotClose(this);
ClientState CS(Client this) { TC(Client, this); assert(this._cs); return this._cs; }
#endif
+// NOTE: this exists to ease migration later on - ClientState does not exist early enough for replicated cvars!
+#define CS_CVAR(this) (this)
+
void ClientState_attach(entity this);
void ClientState_detach(entity this);
);
float lag = ((IS_REAL_CLIENT(actor)) ? ANTILAG_LATENCY(actor) : 0);
- bool noantilag = ((IS_CLIENT(actor)) ? CS(actor).cvar_cl_noantilag : false);
+ bool noantilag = ((IS_CLIENT(actor)) ? CS_CVAR(actor).cvar_cl_noantilag : false);
if(lag < 0.001)
lag = 0;
if(autocvar_g_antilag == 0 || noantilag)
float antilag_getlag(entity e)
{
float lag = ((IS_REAL_CLIENT(e)) ? ANTILAG_LATENCY(e) : 0);
- bool noantilag = ((IS_CLIENT(e)) ? CS(e).cvar_cl_noantilag : false);
+ bool noantilag = ((IS_CLIENT(e)) ? CS_CVAR(e).cvar_cl_noantilag : false);
if(autocvar_g_antilag == 0 || noantilag || lag < 0.001)
lag = 0;
}
void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
{
- bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ bool noantilag = ((IS_CLIENT(source)) ? CS_CVAR(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)
{
- bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ bool noantilag = ((IS_CLIENT(source)) ? CS_CVAR(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)
{
- bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ bool noantilag = ((IS_CLIENT(source)) ? CS_CVAR(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)
{
- bool noantilag = ((IS_CLIENT(source)) ? CS(source).cvar_cl_noantilag : false);
+ bool noantilag = ((IS_CLIENT(source)) ? CS_CVAR(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);
// TODO: remove this function! its only purpose is to update these fields since bot_setnameandstuff is called before ClientState
void bot_setclientfields(entity this)
{
- CS(this).cvar_cl_accuracy_data_share = 1; // share the bots weapon accuracy data with the world
- CS(this).cvar_cl_accuracy_data_receive = 0; // don't receive any weapon accuracy data
+ CS_CVAR(this).cvar_cl_accuracy_data_share = 1; // share the bots weapon accuracy data with the world
+ CS_CVAR(this).cvar_cl_accuracy_data_receive = 0; // don't receive any weapon accuracy data
}
entity bot_spawn()
if (CS(this).impulse) ImpulseCommands(this);
- W_ResetGunAlign(this, CS(this).cvar_cl_gunalign);
+ W_ResetGunAlign(this, CS_CVAR(this).cvar_cl_gunalign);
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
MUTATOR_CALLHOOK(ClientDisconnect, this);
strfree(CS(this).netname_previous); // needs to be before the CS entity is removed!
- strfree(CS(this).weaponorder_byimpulse);
+ strfree(CS_CVAR(this).weaponorder_byimpulse);
ClientState_detach(this);
Portal_ClearAll(this);
bool dualwielding = W_DualWielding(this);
if(this.dualwielding_prev != dualwielding)
{
- W_ResetGunAlign(this, CS(this).cvar_cl_gunalign);
+ W_ResetGunAlign(this, CS_CVAR(this).cvar_cl_gunalign);
this.dualwielding_prev = dualwielding;
}
}
}
else {
- int preferred_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? CS(this).cvar_cl_clippedspectating : !CS(this).cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+ int preferred_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? CS_CVAR(this).cvar_cl_clippedspectating : !CS_CVAR(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;
+ STAT(GUNALIGN, this) = CS_CVAR(this).cvar_cl_gunalign; // TODO
+ STAT(MOVEVARS_CL_TRACK_CANJUMP, this) = CS_CVAR(this).cvar_cl_movement_track_canjump;
WarpZone_PlayerPhysics_FixVAngle(this);
}
// version nagging
- if (CS(this).version_nagtime && CS(this).cvar_g_xonoticversion && time > CS(this).version_nagtime) {
+ if (CS(this).version_nagtime && CS_CVAR(this).cvar_g_xonoticversion && time > CS(this).version_nagtime) {
CS(this).version_nagtime = 0;
- if (strstrofs(CS(this).cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(CS(this).cvar_g_xonoticversion, "autobuild", 0) >= 0) {
+ if (strstrofs(CS_CVAR(this).cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(CS_CVAR(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, CS(this).cvar_g_xonoticversion);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, CS_CVAR(this).cvar_g_xonoticversion);
} else {
- int r = vercmp(CS(this).cvar_g_xonoticversion, autocvar_g_xonoticversion);
+ int r = vercmp(CS_CVAR(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, CS(this).cvar_g_xonoticversion);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, CS_CVAR(this).cvar_g_xonoticversion);
} else if (r > 0) { // old server
- Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, CS(this).cvar_g_xonoticversion);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, CS_CVAR(this).cvar_g_xonoticversion);
}
}
}
this.last_vehiclecheck = time + 1;
}
- if(!CS(this).cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
+ if(!CS_CVAR(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);
{
if (argv(1) != "")
{
- CS(caller).autoswitch = InterpretBoolean(argv(1));
- sprint(caller, strcat("^1autoswitch is currently turned ", (CS(caller).autoswitch ? "on" : "off"), ".\n"));
+ CS_CVAR(caller).autoswitch = InterpretBoolean(argv(1));
+ sprint(caller, strcat("^1autoswitch is currently turned ", (CS_CVAR(caller).autoswitch ? "on" : "off"), ".\n"));
return;
}
}
}
default:
- sprint(caller, strcat("Current physics set: ^3", CS(caller).cvar_cl_physics, "\n"));
+ sprint(caller, strcat("Current physics set: ^3", CS_CVAR(caller).cvar_cl_physics, "\n"));
case CMD_REQUEST_USAGE:
{
sprint(caller, "\nUsage:^3 cmd physics <physics>\n");
tokenize_console(s);
}
- GetCvars(caller, CS(caller), 1);
+ GetCvars(caller, CS_CVAR(caller), 1);
return;
}
string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo)
{
string o = W_FixWeaponOrder_ForceComplete(wo);
- strcpy(CS(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o));
+ strcpy(CS_CVAR(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o));
return o;
}
get_cvars_s = s;
MUTATOR_CALLHOOK(GetCvars);
- Notification_GetCvars(this);
+ Notification_GetCvars(this, store);
ReplicateVars(this, store, s, f);
float Handicap_GetVoluntaryHandicap(entity player)
{
- return bound(1.0, CS(player).cvar_cl_handicap, 10.0);
+ return bound(1.0, CS_CVAR(player).cvar_cl_handicap, 10.0);
}
float Handicap_GetForcedHandicap(entity player)
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
- W_CycleWeapon(this, CS(this).cvar_cl_weaponpriorities[number], dir, weaponentity);
+ W_CycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriorities[number], dir, weaponentity);
if(autocvar_g_weaponswitch_debug != 1)
break;
}
{
FixIntermissionClient(this);
- float server_screenshot = (autocvar_sv_autoscreenshot && CS(this).cvar_cl_autoscreenshot);
- float client_screenshot = (CS(this).cvar_cl_autoscreenshot == 2);
+ float server_screenshot = (autocvar_sv_autoscreenshot && CS_CVAR(this).cvar_cl_autoscreenshot);
+ float client_screenshot = (CS_CVAR(this).cvar_cl_autoscreenshot == 2);
if( (server_screenshot || client_screenshot)
&& ((this.autoscreenshot > 0) && (time > this.autoscreenshot)) )
// if the player is using their best weapon before items are given, they
// probably want to switch to an even better weapon after items are given
- if(CS(player).autoswitch)
+ if(CS_CVAR(player).autoswitch)
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
return false;
// crude hack to enforce switching weapons
- if(g_cts && item.itemdef.instanceOfWeaponPickup && !CS(player).cvar_cl_cts_noautoswitch)
+ if(g_cts && item.itemdef.instanceOfWeaponPickup && !CS_CVAR(player).cvar_cl_cts_noautoswitch)
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
int _switchweapon = 0;
- if(CS(e).autoswitch)
+ if(CS_CVAR(e).autoswitch)
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
a = CS(a).accuracy;
if (to != a.owner)
- if (!autocvar_sv_accuracy_data_share && !CS(a.owner).cvar_cl_accuracy_data_share)
+ if (!autocvar_sv_accuracy_data_share && !CS_CVAR(a.owner).cvar_cl_accuracy_data_share)
sf = 0;
// note: zero sendflags can never be sent... so we can use that to say that we send no accuracy!
WriteInt24_t(MSG_ENTITY, sf);
return false;
}
}
- else if(!weaponLocked(this) && CS(this).cvar_cl_weapon_switch_reload)
+ else if(!weaponLocked(this) && CS_CVAR(this).cvar_cl_weapon_switch_reload)
{
entity actor = this;
w.wr_reload(w, actor, weaponentity);
void W_SwitchWeapon_TryOthers(entity this, Weapon w, .entity weaponentity)
{
- if(!W_SwitchWeapon(this, w, weaponentity) && CS(this).cvar_cl_weapon_switch_fallback_to_impulse)
+ if(!W_SwitchWeapon(this, w, weaponentity) && CS_CVAR(this).cvar_cl_weapon_switch_fallback_to_impulse)
W_NextWeaponOnImpulse(this, w.impulse, weaponentity);
}
void W_NextWeaponOnImpulse(entity this, float imp, .entity weaponentity)
{
float w;
- w = W_GetCycleWeapon(this, CS(this).cvar_cl_weaponpriority, +1, imp, 1, (CS(this).cvar_cl_weaponimpulsemode == 0), weaponentity);
+ w = W_GetCycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriority, +1, imp, 1, (CS_CVAR(this).cvar_cl_weaponimpulsemode == 0), weaponentity);
if(w > 0)
W_SwitchWeapon(this, REGISTRY_GET(Weapons, w), weaponentity);
}
if(list == 0)
W_CycleWeapon(this, weaponorder_byid, -1, weaponentity);
else if(list == 1)
- W_CycleWeapon(this, CS(this).weaponorder_byimpulse, -1, weaponentity);
+ W_CycleWeapon(this, CS_CVAR(this).weaponorder_byimpulse, -1, weaponentity);
else if(list == 2)
- W_CycleWeapon(this, CS(this).cvar_cl_weaponpriority, -1, weaponentity);
+ W_CycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriority, -1, weaponentity);
}
// prev weapon
if(list == 0)
W_CycleWeapon(this, weaponorder_byid, +1, weaponentity);
else if(list == 1)
- W_CycleWeapon(this, CS(this).weaponorder_byimpulse, +1, weaponentity);
+ W_CycleWeapon(this, CS_CVAR(this).weaponorder_byimpulse, +1, weaponentity);
else if(list == 2)
- W_CycleWeapon(this, CS(this).cvar_cl_weaponpriority, +1, weaponentity);
+ W_CycleWeapon(this, CS_CVAR(this).cvar_cl_weaponpriority, +1, weaponentity);
}
// previously used if exists and has ammo, (second) best otherwise
.int weaponcomplainindex;
float W_GetCycleWeapon(entity this, string weaponorder, float dir, float imp, float complain, float skipmissing, .entity weaponentity);
-#define w_getbestweapon(ent,wepent) REGISTRY_GET(Weapons, W_GetCycleWeapon(ent, CS(ent).cvar_cl_weaponpriority, 0, -1, false, true, wepent))
+#define w_getbestweapon(ent,wepent) REGISTRY_GET(Weapons, W_GetCycleWeapon(ent, CS_CVAR(ent).cvar_cl_weaponpriority, 0, -1, false, true, wepent))
void W_SwitchWeapon_Force(Player this, Weapon w, .entity weaponentity);
//vector prevend = w_shotend;
if (antilag)
- if (!CS(ent).cvar_cl_noantilag)
+ if (!CS_CVAR(ent).cvar_cl_noantilag)
{
if (autocvar_g_antilag == 1) // switch to "ghost" if not hitting original
{