- wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints
- wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache
- make
- - EXPECT=61265f867b0817396a503ecc0411dc25
+ - EXPECT=585cfa6d62ce59f4854bedfce7c51c20
- HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
| tee /dev/stderr
| grep '^:'
r_glsl_offsetmapping_lod 1
r_glsl_offsetmapping_reliefmapping 0
r_glsl_offsetmapping_scale 0.02
-// execute effects-normal.cfg to make sure that all effect settings are reset
+
+// create a temporary empty alias for menu_sync so that execution of effects-normal.cfg
+// on game start doesn't show an error message in the console
alias menu_sync "" // will be re-aliased later
// misc
/** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(DrawViewModel, EV_DrawViewModel);
+
+/** Called when updating the view's liquid contents, return true to disable the standard checks and apply your own */
+MUTATOR_HOOKABLE(HUD_Contents, EV_NO_ARGS);
}
}
+const int MAX_SPECIALCOMMAND = 15;
+vector specialcommand_slots[MAX_SPECIALCOMMAND];
+vector specialcommand_colors[MAX_SPECIALCOMMAND];
+const float SPECIALCOMMAND_SPEED = 150;
+const float SPECIALCOMMAND_TURNSPEED = 2;
+const float SPECIALCOMMAND_SIZE = 0.025;
+const float SPECIALCOMMAND_CHANCE = 0.35;
+float sc_spawntime, sc_changetime;
+vector sc_color = '1 1 1';
+void SpecialCommand()
+{
+ if(!STAT(MOVEVARS_SPECIALCOMMAND))
+ return;
+
+ if(time >= sc_changetime)
+ {
+ sc_changetime = time + 1;
+ sc_color = randomvec() * 1.5;
+ sc_color.x = bound(0.2, sc_color.x, 0.75);
+ sc_color.y = bound(0.2, sc_color.y, 0.75);
+ sc_color.z = bound(0.2, sc_color.z, 0.75);
+ }
+ drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), sc_color, autocvar_hud_colorflash_alpha * bound(0.1, sc_changetime - time, 0.3), DRAWFLAG_ADDITIVE);
+
+ if(!precache_pic("gfx/smile"))
+ return; // damn party poopers
+
+ for(int j = MAX_SPECIALCOMMAND - 1; j >= 0; --j)
+ {
+ vector slot = specialcommand_slots[j];
+ if(slot.y)
+ slot.y += SPECIALCOMMAND_SPEED * frametime;
+ if(slot.z)
+ slot.z = sin(SPECIALCOMMAND_TURNSPEED * M_PI * time);
+ if(slot.y >= vid_conheight)
+ slot = '0 0 0';
+
+ if(slot == '0 0 0')
+ {
+ if(random() <= SPECIALCOMMAND_CHANCE && time > sc_spawntime) // low chance to spawn!
+ {
+ slot.x = bound(0, (random() * vid_conwidth + 1), vid_conwidth);
+ slot.y = 1; // start it off 0 so we can use it
+ slot.z = random();
+ sc_spawntime = time + bound(0.4, random(), 0.75); // prevent spawning another one for this amount of time!
+ vector newcolor = randomvec() * 2;
+ newcolor.x = bound(0.4, newcolor.x, 1);
+ newcolor.y = bound(0.4, newcolor.y, 1);
+ newcolor.z = bound(0.4, newcolor.z, 1);
+ specialcommand_colors[j] = newcolor;
+ }
+ }
+ else
+ {
+ vector splash_size = '0 0 0';
+ splash_size.x = max(vid_conwidth, vid_conheight) * SPECIALCOMMAND_SIZE;
+ splash_size.y = max(vid_conwidth, vid_conheight) * SPECIALCOMMAND_SIZE;
+ drawpic(vec2(slot), "gfx/smile", vec2(splash_size), specialcommand_colors[j], 0.95, DRAWFLAG_NORMAL);
+ //drawrotpic(vec2(slot), slot.z, "gfx/smile", vec2(splash_size), vec2(splash_size) / 2, specialcommand_colors[j], 0.95, DRAWFLAG_NORMAL);
+ }
+
+ specialcommand_slots[j] = slot;
+ }
+}
+
void HUD_Draw(entity this)
{
// if we don't know gametype and scores yet avoid drawing the scoreboard
}
// crosshair goes VERY LAST
+ SpecialCommand();
UpdateDamage();
HUD_Crosshair(this);
HitSound();
// improved polyblend
- if(autocvar_hud_contents)
+ if(autocvar_hud_contents && !MUTATOR_CALLHOOK(HUD_Contents))
{
float contentalpha_temp, incontent, liquidalpha, contentfadetime;
vector liquidcolor;
}
else // add it to the end of the list if the list doesn't already have it
{
- argc = tokenizebyseparator(cvar_string(original_cvar), " ");
- int i;
- for(i = 0; i < argc; ++i)
- if(argv(i) == tmp_string)
- return; // already in list
+ FOREACH_WORD(cvar_string(original_cvar), it == tmp_string,
+ {
+ return; // already in the list
+ });
- cvar_set(original_cvar, strcat(tmp_string, " ", cvar_string(original_cvar)));
+ cvar_set(original_cvar, cons(cvar_string(original_cvar), tmp_string));
}
return;
}
{
if(argc == 3)
{
- float i;
string original_cvar = argv(1);
string removal = argv(2);
- string tmp_string;
- argc = tokenizebyseparator(cvar_string(original_cvar), " ");
-
- tmp_string = "";
- for(i = 0; i < argc; ++i)
- if(argv(i) != removal)
- tmp_string = strcat(tmp_string, " ", argv(i));
+ string tmp_string = "";
+ FOREACH_WORD(cvar_string(original_cvar), it != removal,
+ {
+ tmp_string = cons(tmp_string, it);
+ });
- tmp_string = substring(tmp_string, 1, strlen(tmp_string) - 1);
cvar_set(original_cvar, tmp_string);
return;
return;
}
- if((this.team && DIFF_TEAM(toucher, this))
- || (STAT(FROZEN, toucher))
- || (toucher.vehicle)
- || (time < toucher.buff_shield)
- || (!this.buff_active)
- )
- {
- // can't touch this
+ if(!this.buff_active)
return;
- }
if(MUTATOR_CALLHOOK(BuffTouch, this, toucher))
return;
if(!IS_PLAYER(toucher))
return; // incase mutator changed toucher
+ if((this.team && DIFF_TEAM(toucher, this))
+ || (STAT(FROZEN, toucher))
+ || (toucher.vehicle)
+ || (time < PS(toucher).buff_shield)
+ )
+ {
+ // can't touch this
+ return;
+ }
+
if (toucher.buffs)
{
if (toucher.cvar_cl_buffs_autoreplace && toucher.buffs != this.buffs)
player.buffs = 0;
player.buff_time = 0;
- player.buff_shield = time + 0.5; // prevent picking up buffs immediately
+ PS(player).buff_shield = time + 0.5; // prevent picking up buffs immediately
// reset timers here to prevent them continuing after re-spawn
player.buff_disability_time = 0;
player.buff_disability_effect_time = 0;
Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
player.buffs = 0;
- player.buff_shield = time + max(0, autocvar_g_buffs_pickup_delay);
+ PS(player).buff_shield = time + max(0, autocvar_g_buffs_pickup_delay);
//player.buff_time = 0; // already notified
sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
return true;
else
Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
player.buffs = 0;
- player.buff_shield = time + max(0, autocvar_g_buffs_pickup_delay); // always put in a delay, even if small
+ PS(player).buff_shield = time + max(0, autocvar_g_buffs_pickup_delay); // always put in a delay, even if small
}
}
FOREACH(Notifications, it.nent_type == MSG_CHOICE, {
GetCvars_handleFloat(
this,
+ CS(this),
get_cvars_s,
get_cvars_f,
msg_choice_choices[it.nent_choice_idx],
#define RECURSE_FROM_CHOICE(ent,action) MACRO_BEGIN { \
if (notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) { \
- switch (ent.msg_choice_choices[net_name.nent_choice_idx]) \
+ switch (CS(ent).msg_choice_choices[net_name.nent_choice_idx]) \
{ \
case 1: found_choice = notif.nent_optiona; break; \
case 2: found_choice = notif.nent_optionb; break; \
.float specialcommand_pos;
void SpecialCommand(entity this)
{
- if (!CheatImpulse(this, CHIMPULSE_GIVE_ALL.impulse))
- LOG_INFO("A hollow voice says \"Plugh\".\n");
+ if(autocvar_sv_cheats || this.maycheat)
+ {
+ if (!CheatImpulse(this, CHIMPULSE_GIVE_ALL.impulse))
+ LOG_INFO("A hollow voice says \"Plugh\".\n");
+ }
+ else
+ STAT(MOVEVARS_SPECIALCOMMAND, this) = true;
}
#endif
else
c = "?";
- if (c == substring(specialcommand, this.specialcommand_pos, 1))
+ if (c == substring(specialcommand, CS(this).specialcommand_pos, 1))
{
- this.specialcommand_pos += 1;
- if (this.specialcommand_pos >= strlen(specialcommand))
+ CS(this).specialcommand_pos += 1;
+ if (CS(this).specialcommand_pos >= strlen(specialcommand))
{
- this.specialcommand_pos = 0;
+ CS(this).specialcommand_pos = 0;
SpecialCommand(this);
return true;
}
}
- else if (this.specialcommand_pos && (c != substring(specialcommand, this.specialcommand_pos - 1, 1)))
- this.specialcommand_pos = 0;
+ else if (CS(this).specialcommand_pos && (c != substring(specialcommand, CS(this).specialcommand_pos - 1, 1)))
+ CS(this).specialcommand_pos = 0;
#endif
return false;
}
{
#ifdef SVQC
// needs to be called before physics are run!
- PM_UpdateButtons(this, CS(this));
+ if(IS_REAL_CLIENT(this))
+ PM_UpdateButtons(this, CS(this));
#endif
sys_phys_update(this, PHYS_INPUT_TIMELENGTH);
.float spectatorspeed;
#endif
+.int buttons_old;
.vector movement_old;
.vector v_angle_old;
.string lastclassname;
void PlayerStats_GameReport_Accuracy(entity p)
{
#define ACCMAC(suffix, field) \
- PS_GR_P_ADDVAL(p, sprintf("acc-%s-%s", it.netname, suffix), p.accuracy.(field[i-1]));
+ PS_GR_P_ADDVAL(p, sprintf("acc-%s-%s", it.netname, suffix), CS(p).accuracy.(field[i-1]));
FOREACH(Weapons, it != WEP_Null, {
ACCMAC("hit", accuracy_hit)
ACCMAC("fired", accuracy_fired)
if(IS_REAL_CLIENT(p))
{
- if(p.latency_cnt)
+ if(CS(p).latency_cnt)
{
- float latency = (p.latency_sum / p.latency_cnt);
+ float latency = (CS(p).latency_sum / CS(p).latency_cnt);
if(latency) { PS_GR_P_ADDVAL(p, PLAYERSTATS_AVGLATENCY, latency); }
}
}
void ClientState_detach(entity this)
{
+ accuracy_free(this); // TODO: needs to be before CS() is deleted!
+ PlayerScore_Detach(this); // what ^they^ said
+ W_HitPlotClose(this);
+ ClientData_Detach(this);
delete(CS(this));
this._cs = NULL;
bot_clientdisconnect(this);
- W_HitPlotClose(this);
anticheat_report_to_eventlog(this);
playerdemo_shutdown(this);
entcs_detach(this);
- accuracy_free(this);
- ClientData_Detach(this);
- PlayerScore_Detach(this);
}
REGISTER_STAT(MOVEVARS_STEPHEIGHT, float, autocvar_sv_stepheight)
REGISTER_STAT(MOVEVARS_AIRACCEL_QW, float)
REGISTER_STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, float)
+REGISTER_STAT(MOVEVARS_SPECIALCOMMAND, bool)
#ifdef CSQC
thiswep.wr_reload(thiswep, actor, weaponentity);
} else
{
- actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
+ actor.(weaponentity).rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.(weaponentity).rifle_accumulator, time);
if(fire & 1)
if(weapon_prepareattack_check(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire)))
- if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
+ if(time >= actor.(weaponentity).rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
{
weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire));
W_Rifle_BulletHail(actor, weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
- actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
+ actor.(weaponentity).rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
}
if(fire & 2)
{
} else
{
if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)))
- if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
+ if(time >= actor.(weaponentity).rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
{
weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire));
W_Rifle_BulletHail(actor, weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
- actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
+ actor.(weaponentity).rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
}
}
}
sys_in_update(this, dt);
sys_phys_fix(this, dt);
- if (sys_phys_override(this, dt)) { return; } sys_phys_monitor(this, dt);
+ if (sys_phys_override(this, dt))
+ return;
+
+ sys_phys_monitor(this, dt);
PHYS_CS(this).movement_old = PHYS_CS(this).movement;
- this.v_angle_old = this.v_angle;
+ PHYS_CS(this).v_angle_old = this.v_angle;
+ PHYS_CS(this).buttons_old = PHYS_INPUT_BUTTON_MASK(this);
sys_phys_ai(this);
if (sv_maxidle > 0) {
if (buttons != CS(this).buttons_old
|| CS(this).movement != CS(this).movement_old
- || this.v_angle != this.v_angle_old) { CS(this).parm_idlesince = time; }
+ || this.v_angle != CS(this).v_angle_old) { CS(this).parm_idlesince = time; }
}
PM_check_nickspam(this);
PM_check_punch(this, dt);
-
- CS(this).buttons_old = PHYS_INPUT_BUTTON_MASK(this);
}
void sys_phys_ai(entity this)
return e;
}
-float WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher)
+bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher)
{
return !WarpZoneLib_BoxTouchesBrush(toucher.absmin, toucher.absmax, this, toucher);
}
}
}
-float WarpZoneLib_MoveOutOfSolid(entity e)
+bool WarpZoneLib_MoveOutOfSolid(entity e)
{
- vector o, m0, m1;
-
- o = e.origin;
+ vector o = e.origin;
traceline(o, o, MOVE_WORLDONLY, e);
if (trace_startsolid)
return false;
if (!trace_startsolid)
return true;
- m0 = e.mins;
- m1 = e.maxs;
+ vector m0 = e.mins;
+ vector m1 = e.maxs;
e.mins = '0 0 0';
e.maxs = '0 0 0';
- WarpZoneLib_MoveOutOfSolid_Expand(e, '1 0 0' * m0_x);
- e.mins_x = m0_x;
- WarpZoneLib_MoveOutOfSolid_Expand(e, '1 0 0' * m1_x);
- e.maxs_x = m1_x;
- WarpZoneLib_MoveOutOfSolid_Expand(e, '0 1 0' * m0_y);
- e.mins_y = m0_y;
- WarpZoneLib_MoveOutOfSolid_Expand(e, '0 1 0' * m1_y);
- e.maxs_y = m1_y;
- WarpZoneLib_MoveOutOfSolid_Expand(e, '0 0 1' * m0_z);
- e.mins_z = m0_z;
- WarpZoneLib_MoveOutOfSolid_Expand(e, '0 0 1' * m1_z);
- e.maxs_z = m1_z;
+ WarpZoneLib_MoveOutOfSolid_Expand(e, eX * m0.x); e.mins.x = m0.x;
+ WarpZoneLib_MoveOutOfSolid_Expand(e, eX * m1.x); e.maxs.x = m1.x;
+ WarpZoneLib_MoveOutOfSolid_Expand(e, eY * m0.y); e.mins.y = m0.y;
+ WarpZoneLib_MoveOutOfSolid_Expand(e, eY * m1.y); e.maxs.y = m1.y;
+ WarpZoneLib_MoveOutOfSolid_Expand(e, eZ * m0.z); e.mins.z = m0.z;
+ WarpZoneLib_MoveOutOfSolid_Expand(e, eZ * m1.z); e.maxs.z = m1.z;
setorigin(e, e.origin);
tracebox(e.origin, e.mins, e.maxs, e.origin, MOVE_WORLDONLY, e);
#ifndef BITXOR_ASSIGN
# define BITXOR_ASSIGN(a,b) ((a) = ((a) | (b)) - ((a) & (b)))
#endif
-float WarpZoneLib_MoveOutOfSolid(entity e);
+bool WarpZoneLib_MoveOutOfSolid(entity e);
#define move_out_of_solid(e) WarpZoneLib_MoveOutOfSolid(e)
-float WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
+bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
void WarpZoneLib_ExactTrigger_Init(entity this);
// WARNING: this kills the trace globals
#pragma once
-float WarpZoneLib_MoveOutOfSolid(entity e);
-float WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
+bool WarpZoneLib_MoveOutOfSolid(entity e);
+bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher);
#ifdef SVQC
void WarpZoneLib_ExactTrigger_Init(entity this);
#endif
void ClientData_Attach(entity this)
{
- Net_LinkEntity(this.clientdata = new_pure(clientdata), false, 0, ClientData_Send);
- this.clientdata.drawonlytoclient = this;
- this.clientdata.owner = this;
+ Net_LinkEntity(CS(this).clientdata = new_pure(clientdata), false, 0, ClientData_Send);
+ CS(this).clientdata.drawonlytoclient = this;
+ CS(this).clientdata.owner = this;
}
void ClientData_Detach(entity this)
{
- delete(this.clientdata);
- this.clientdata = NULL;
+ delete(CS(this).clientdata);
+ CS(this).clientdata = NULL;
}
void ClientData_Touch(entity e)
{
- e.clientdata.SendFlags = 1;
+ CS(e).clientdata.SendFlags = 1;
// make it spectatable
- FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, LAMBDA(it.clientdata.SendFlags = 1));
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, LAMBDA(CS(it).clientdata.SendFlags = 1));
}
void SetSpectatee(entity this, entity spectatee);
int n = tokenize_console(defaultmodel);
if(n > 0)
{
- defaultmodel = argv(floor(n * player.model_randomizer));
+ defaultmodel = argv(floor(n * CS(player).model_randomizer));
// However, do NOT randomize if the player-selected model is in the list.
for (int i = 0; i < n; ++i)
if ((argv(i) == player.playermodel && defaultskin == stof(player.playerskin)) || argv(i) == strcat(player.playermodel, ":", player.playerskin))
TRANSMUTE(Player, this);
- this.wasplayer = true;
+ CS(this).wasplayer = true;
this.iscreature = true;
this.teleportable = TELEPORT_NORMAL;
if(!this.damagedbycontents)
setthink(this, func_null); // players have no think function
this.nextthink = 0;
this.dmg_team = 0;
- this.ballistics_density = autocvar_g_ballistics_density_player;
+ PS(this).ballistics_density = autocvar_g_ballistics_density_player;
this.deadflag = DEAD_NO;
CSQCMODEL_AUTOINIT(this);
- this.model_randomizer = random();
+ CS(this).model_randomizer = random();
if (IS_REAL_CLIENT(this))
sv_notice_join(this);
.bool team_selected;
bool ShowTeamSelection(entity this)
{
- if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || this.team_selected || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
+ if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || this.team_selected || (CS(this).wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
return false;
stuffcmd(this, "menu_showteamselect\n");
return true;
ATTRIB(Client, zoomstate, bool, this.zoomstate);
ATTRIB(Client, just_joined, bool, this.just_joined);
ATTRIB(Client, race_completed, bool, this.race_completed);
+ ATTRIBARRAY(Client, msg_choice_choices, int, 50); // TODO: actually NOTIF_CHOICE_MAX
+ ATTRIB(Client, latency_sum, float, this.latency_sum);
+ ATTRIB(Client, latency_cnt, int, this.latency_cnt);
+ ATTRIB(Client, latency_time, float, this.latency_time);
+ ATTRIB(Client, v_angle_old, vector, this.v_angle_old);
+ ATTRIB(Client, model_randomizer, float, this.model_randomizer);
+ ATTRIB(Client, accuracy, entity, this.accuracy);
+ ATTRIB(Client, hasweapon_complain_spam, float, this.hasweapon_complain_spam);
+ ATTRIB(Client, scorekeeper, entity, this.scorekeeper);
+ ATTRIB(Client, specialcommand_pos, int, this.specialcommand_pos);
+ ATTRIB(Client, hitplotfh, int, this.hitplotfh);
+ ATTRIB(Client, clientdata, entity, this.clientdata);
+ ATTRIB(Client, wasplayer, bool, this.wasplayer);
METHOD(Client, m_unwind, bool(Client this));
ATTRIB(Player, dual_weapons, vector, this.dual_weapons); // TODO: actually WepSet!
ATTRIB(Player, itemkeys, int, this.itemkeys);
+ ATTRIB(Player, ballistics_density, float, this.ballistics_density);
+ ATTRIB(Player, prevstrengthsound, float, this.prevstrengthsound);
+ ATTRIB(Player, prevstrengthsoundattempt, float, this.prevstrengthsoundattempt);
+ ATTRIB(Player, buff_shield, float, this.buff_shield);
INIT(Player) {
this.classname = STR_PLAYER;
{
sprint(caller, "^7You already are on that team.\n");
}
- else if (caller.wasplayer && autocvar_g_changeteam_banned)
+ else if (CS(caller).wasplayer && autocvar_g_changeteam_banned)
{
sprint(caller, "^1You cannot change team, forbidden by the server.\n");
}
//vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
-.float wasplayer;
+.bool wasplayer;
float servertime, serverprevtime, serverframetime;
WriteByte(MSG_BROADCAST, min(ceil(CS(e).ping_movementloss * 255), 255));
// record latency times for clients throughout the match so we can report it to playerstats
- if(time > (e.latency_time + LATENCY_THINKRATE))
+ if(time > (CS(e).latency_time + LATENCY_THINKRATE))
{
- e.latency_sum += CS(e).ping;
- e.latency_cnt += 1;
- e.latency_time = time;
- //print("sum: ", ftos(e.latency_sum), ", cnt: ", ftos(e.latency_cnt), ", avg: ", ftos(e.latency_sum / e.latency_cnt), ".\n");
+ CS(e).latency_sum += CS(e).ping;
+ CS(e).latency_cnt += 1;
+ CS(e).latency_time = time;
+ //print("sum: ", ftos(CS(e).latency_sum), ", cnt: ", ftos(CS(e).latency_cnt), ", avg: ", ftos(CS(e).latency_sum / CS(e).latency_cnt), ".\n");
}
}
else
}
}
}
-void GetCvars_handleFloat(entity this, string thisname, float f, .float field, string name)
+void GetCvars_handleFloat(entity this, entity store, string thisname, float f, .float field, string name)
{
if (f < 0)
{
else if (f > 0)
{
if (thisname == name)
- this.(field) = stof(argv(f + 1));
+ store.(field) = stof(argv(f + 1));
}
else
stuffcmd(this, strcat("cl_cmd sendcvar ", name, "\n"));
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, s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking");
+ GetCvars_handleFloat(this, 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)
void play2team(float t, string filename);
-void GetCvars_handleFloat(entity this, string thisname, float f, .float field, string name);
+void GetCvars_handleFloat(entity this, entity store, string thisname, float f, .float field, string name);
float spamsound(entity e, float chan, Sound samp, float vol, float _atten);
clone.move_qcphysics = false; // don't run gamecode logic on clones, too many
set_movetype(clone, this.move_movetype);
clone.solid = this.solid;
- clone.ballistics_density = this.ballistics_density;
clone.takedamage = this.takedamage;
setcefc(clone, getcefc(this));
clone.uncustomizeentityforclient = this.uncustomizeentityforclient;
// increment frag counter for used weapon type
Weapon w = DEATH_WEAPONOF(deathtype);
if(w != WEP_Null && accuracy_isgooddamage(attacker, this))
- attacker.accuracy.(accuracy_frags[w.m_id-1]) += 1;
+ CS(attacker).accuracy.(accuracy_frags[w.m_id-1]) += 1;
MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, this, deathtype, damage);
damage = M_ARGV(4, float);
set_movetype(this, MOVETYPE_TOSS);
// shootable corpse
this.solid = SOLID_CORPSE;
- this.ballistics_density = autocvar_g_ballistics_density_corpse;
+ PS(this).ballistics_density = autocvar_g_ballistics_density_corpse;
// don't stick to the floor
UNSET_ONGROUND(this);
// dying animation
this.deadflag = DEAD_DYING;
+ STAT(MOVEVARS_SPECIALCOMMAND, this) = false; // sweet release
+
// when to allow respawn
calculate_player_respawn_time(this);
g_race_qualifying = qual;
- IL_EACH(g_race_targets, true,
+ IL_EACH(g_race_targets, it.classname == "target_checkpoint" || it.classname == "target_startTimer" || it.classname == "target_stopTimer",
{
+ if(it.targetname == "" || !it.targetname) // somehow this is a case...
+ continue;
entity cpt = it;
FOREACH_ENTITY_STRING(target, cpt.targetname,
{
if (race_timed_checkpoint) {
if (defrag_ents) {
- IL_EACH(g_race_targets, true,
+ IL_EACH(g_race_targets, it.classname == "target_checkpoint" || it.classname == "target_startTimer" || it.classname == "target_stopTimer",
{
entity cpt = it;
if(it.classname == "target_startTimer" || it.classname == "target_stopTimer") {
+ if(it.targetname == "" || !it.targetname) // somehow this is a case...
+ continue;
FOREACH_ENTITY_STRING(target, cpt.targetname, {
- WaypointSprite_UpdateSprites(it.sprite, ((cpt.classname == "target_startTimer") ? WP_RaceStart : WP_RaceFinish), WP_Null, WP_Null);
+ if(it.sprite)
+ WaypointSprite_UpdateSprites(it.sprite, ((cpt.classname == "target_startTimer") ? WP_RaceStart : WP_RaceFinish), WP_Null, WP_Null);
});
}
if(it.classname == "target_checkpoint") {
if(MUTATOR_CALLHOOK(ForbidPlayerScore_Clear)) return 0;
- sk = player.scorekeeper;
+ sk = CS(player).scorekeeper;
FOREACH(Scores, true, {
if(sk.(scores(it)) != 0)
if(scores_label(it) != "")
entity sk;
float t;
FOREACH_CLIENTSLOT(true, {
- sk = it.scorekeeper;
+ sk = CS(it).scorekeeper;
if (!sk) continue;
FOREACH(Scores, true, {
if(sk.(scores(it)) != 0)
void PlayerScore_Attach(entity player)
{
- if(player.scorekeeper)
+ if(CS(player).scorekeeper)
error("player already has a scorekeeper");
entity sk = new_pure(scorekeeper);
sk.owner = player;
Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
- player.scorekeeper = sk;
+ CS(player).scorekeeper = sk;
}
void PlayerScore_Detach(entity player)
{
- if(!player.scorekeeper)
+ if(!CS(player).scorekeeper)
error("player has no scorekeeper");
- delete(player.scorekeeper);
- player.scorekeeper = NULL;
+ delete(CS(player).scorekeeper);
+ CS(player).scorekeeper = NULL;
}
float PlayerScore_Add(entity player, PlayerScoreField scorefield, float score)
score = 0;
if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
- entity s = player.scorekeeper;
+ entity s = CS(player).scorekeeper;
if(!s)
{
if(game_stopped)
winnerscorekeeper = NULL;
secondscorekeeper = NULL;
FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
- sk = it.scorekeeper;
+ sk = CS(it).scorekeeper;
c = PlayerScore_Compare(winnerscorekeeper, sk, 1);
if(c < 0)
{
});
out = substring(out, 0, strlen(out) - 1);
}
- else if((sk = pl.scorekeeper))
+ else if((sk = CS(pl).scorekeeper))
{
FOREACH(Scores, true, {
if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
return 0;
}
- return PlayerScore_Compare(p1.scorekeeper, p2.scorekeeper, strict);
+ return PlayerScore_Compare(CS(p1).scorekeeper, CS(p2).scorekeeper, strict);
}
entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators)
FOREACH_CLIENT(true, LAMBDA(it.(field) = 0));
- FOREACH_CLIENT(it.scorekeeper,
+ FOREACH_CLIENT(CS(it).scorekeeper,
{
if(nospectators)
if(it.frags == FRAGS_SPECTATOR)
float fl, sc;
s = " ";
- sk = p.scorekeeper;
+ sk = CS(p).scorekeeper;
s = strcat(s, playername(p, false));
for (;;)
void PlayerScore_PlayerStats(entity p)
{
- entity s = p.scorekeeper;
+ entity s = CS(p).scorekeeper;
FOREACH(Scores, true, {
if(s.(scores(it)) != 0)
if(scores_label(it) != "")
return;
}
- if((autocvar_g_campaign) || (autocvar_g_changeteam_banned && this.wasplayer)) {
+ if((autocvar_g_campaign) || (autocvar_g_changeteam_banned && CS(this).wasplayer)) {
Send_Notification(NOTIF_ONE, this, MSG_INFO, INFO_TEAMCHANGE_NOTALLOWED);
return; // changing teams is not allowed
}
entity a = this.owner;
if (IS_SPEC(a)) a = a.enemy;
- a = a.accuracy;
+ a = CS(a).accuracy;
if (to != a.owner)
if (!autocvar_sv_accuracy_data_share && !a.owner.cvar_cl_accuracy_data_share)
// init/free
void accuracy_init(entity e)
{
- entity a = e.accuracy = new_pure(accuracy);
+ entity a = CS(e).accuracy = new_pure(accuracy);
a.owner = e;
a.drawonlytoclient = e;
Net_LinkEntity(a, false, 0, accuracy_send);
void accuracy_free(entity e)
{
- delete(e.accuracy);
+ delete(CS(e).accuracy);
}
// force a resend of a player's accuracy stats
void accuracy_resend(entity e)
{
- e.accuracy.SendFlags = 0xFFFFFF;
+ CS(e).accuracy.SendFlags = 0xFFFFFF;
}
// update accuracy stats
void accuracy_add(entity this, int w, int fired, int hit)
{
if (IS_INDEPENDENT_PLAYER(this)) return;
- entity a = this.accuracy;
+ entity a = CS(this).accuracy;
if (!a) return;
if (!hit && !fired) return;
w -= WEP_FIRST;
if (b == accuracy_byte(a.accuracy_hit[w], a.accuracy_fired[w])) return; // no change
int sf = 1 << (w % 24);
a.SendFlags |= sf;
- FOREACH_CLIENT(IS_SPEC(it) && it.enemy == this, LAMBDA(it.accuracy.SendFlags |= sf));
+ FOREACH_CLIENT(IS_SPEC(it) && it.enemy == this, LAMBDA(CS(it).accuracy.SendFlags |= sf));
}
bool accuracy_isgooddamage(entity attacker, entity targ)
#include <common/net_linked.qh>
#include <common/deathtypes/all.qh>
#include <common/notifications/all.qh>
+#include <common/state.qh>
#include <common/util.qh>
#include <common/weapons/_all.qh>
#include <common/items/_mod.qh>
}
}
-void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound
+void W_PlayStrengthSound(entity player)
{
+ entity store = IS_PLAYER(player) ? PS(player) : player; // because non-player entities can fire, but can they have items? TODO
+
if((player.items & ITEM_Strength.m_itemid)
- && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
- || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
+ && ((time > store.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
+ || (time > store.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
{
sound(player, CH_TRIGGER, SND_STRENGTH_FIRE, VOL_BASE, ATTEN_NORM);
- player.prevstrengthsound = time;
+ store.prevstrengthsound = time;
}
- player.prevstrengthsoundattempt = time;
+ store.prevstrengthsoundattempt = time;
}
float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception)
void W_HitPlotAnalysis(entity player, .entity weaponentity, vector screenforward, vector screenright, vector screenup)
{
- vector hitplot;
- vector org;
- float lag;
-
- if(player.hitplotfh >= 0)
+ if(CS(player).hitplotfh >= 0)
{
- lag = ANTILAG_LATENCY(player);
+ float lag = ANTILAG_LATENCY(player);
if(lag < 0.001)
lag = 0;
if(!IS_REAL_CLIENT(player))
lag = 0; // only antilag for clients
- org = player.origin + player.view_ofs;
+ vector org = player.origin + player.view_ofs;
traceline_antilag_force(player, org, org + screenforward * max_shot_distance, MOVE_NORMAL, player, lag);
if(IS_CLIENT(trace_ent) || IS_MONSTER(trace_ent))
{
entity store = IS_CLIENT(trace_ent) ? CS(trace_ent) : trace_ent;
antilag_takeback(trace_ent, store, time - lag);
- hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
+ vector hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
antilag_restore(trace_ent, store);
- fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(player.(weaponentity).m_switchweapon.m_id), "\n"));
+ fputs(CS(player).hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(player.(weaponentity).m_switchweapon.m_id), "\n"));
//print(strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), "\n"));
}
}
{
if(autocvar_g_hitplots || strhasword(autocvar_g_hitplots_individuals, player.netaddress))
{
- player.hitplotfh = fopen(strcat("hits-", matchid, "-", player.netaddress, "-", ftos(player.playerid), ".plot"), FILE_WRITE);
- fputs(player.hitplotfh, strcat("#name ", playername(player, false), "\n"));
+ CS(player).hitplotfh = fopen(strcat("hits-", matchid, "-", player.netaddress, "-", ftos(player.playerid), ".plot"), FILE_WRITE);
+ fputs(CS(player).hitplotfh, strcat("#name ", playername(player, false), "\n"));
}
- else { player.hitplotfh = -1; }
+ else { CS(player).hitplotfh = -1; }
}
void W_HitPlotClose(entity player)
{
- if(player.hitplotfh >= 0)
+ if(CS(player).hitplotfh >= 0)
{
- fclose(player.hitplotfh);
- player.hitplotfh = -1;
+ fclose(CS(player).hitplotfh);
+ CS(player).hitplotfh = -1;
}
}
{
float f = 0;
- if (time < this.hasweapon_complain_spam)
+ if (time < CS(this).hasweapon_complain_spam)
complain = 0;
// ignore hook button when using other offhand equipment
complain = 0;
if (complain)
- this.hasweapon_complain_spam = time + 0.2;
+ CS(this).hasweapon_complain_spam = time + 0.2;
if (wpn == WEP_Null)
{
break;
float maxdist;
+ entity hitstore = IS_PLAYER(hit) ? PS(hit) : hit;
if(max_solid_penetration < 0)
break;
- else if(hit.ballistics_density < -1)
+ else if(hitstore.ballistics_density < -1)
break; // -2: no solid penetration, ever
- else if(hit.ballistics_density < 0)
+ else if(hitstore.ballistics_density < 0)
maxdist = vlen(hit.maxs - hit.mins) + 1; // -1: infinite travel distance
- else if(hit.ballistics_density == 0)
+ else if(hitstore.ballistics_density == 0)
maxdist = max_solid_penetration * solid_penetration_left;
else
- maxdist = max_solid_penetration * solid_penetration_left * hit.ballistics_density;
+ maxdist = max_solid_penetration * solid_penetration_left * hitstore.ballistics_density;
if(maxdist <= autocvar_g_ballistics_mindistance)
break;
set -eu
cd ${0%/*}
+# This script attempts to build the codebase in every possible header configuration,
+# to check that all files #include what they need, so that we can eventually move away
+# from a unity build and into incremental compilation.
+
+# If these files exist from previous compilation, `./all compile` will stop
+# detecting changes after running this script so delete them to trigger
+# a recompile next time.
+if [ -f ../../csprogs.dat ]; then
+ rm ../../csprogs.dat
+fi
+
+if [ -f ../../menu.dat ]; then
+ rm ../../menu.dat
+fi
+
+if [ -f ../../progs.dat ]; then
+ rm ../../progs.dat
+fi
+
WORKDIR=../.tmp
CPP="cc -xc -E"