-void race_send_recordtime(float msg);
-void race_SendRankings(float pos, float prevpos, float del, float msg);
-
void send_CSQC_teamnagger() {
WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte(MSG_BROADCAST, TE_CSQC_TEAMNAGGER);
{
entity spot;
self.hud = HUD_NORMAL;
- race_PreSpawnObserver();
+
+ if(IS_PLAYER(self)) { pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1); }
spot = SelectSpawnPoint (TRUE);
if(!spot)
WriteEntity(MSG_ONE, self);
}
- if((g_race && g_race_qualifying) || g_cts)
- {
- if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
- self.frags = FRAGS_LMS_LOSER;
- else
- self.frags = FRAGS_SPECTATOR;
- }
- else
- self.frags = FRAGS_SPECTATOR;
+ self.frags = FRAGS_SPECTATOR;
MUTATOR_CALLHOOK(MakePlayerObserver);
Portal_ClearAll(self);
+ Unfreeze(self);
+
if(self.alivetime)
{
if(!warmup_stage)
self.angles_z = 0;
self.fixangle = TRUE;
self.crouch = FALSE;
+ self.revival_time = 0;
setorigin (self, (spot.origin + PL_VIEW_OFS)); // offset it so that the spectator spawns higher off the ground, looks better this way
self.prevorigin = self.origin;
if(self.team < 0)
JoinBestTeam(self, FALSE, TRUE);
- race_PreSpawn();
-
spot = SelectSpawnPoint (FALSE);
if(!spot)
{
self.effects |= EF_TELEPORT_BIT | EF_RESTARTANIM_BIT;
self.air_finished = time + 12;
self.dmg = 2;
- if(WEP_CVAR(vortex, charge))
+ if(autocvar_g_balance_nex_charge)
{
- if(WEP_CVAR_SEC(vortex, chargepool))
- self.vortex_chargepool_ammo = 1;
- self.vortex_charge = WEP_CVAR(vortex, charge_start);
+ if(autocvar_g_balance_nex_secondary_chargepool)
+ self.nex_chargepool_ammo = 1;
+ self.nex_charge = autocvar_g_balance_nex_charge_start;
}
if(warmup_stage)
else
self.superweapons_finished = 0;
- if(g_weaponarena_random) // WEAPONTODO: more stuff that should be in a mutator. also: rename those cvars
+ if(g_weaponarena_random)
{
if(g_weaponarena_random_with_laser)
- self.weapons &= ~WEPSET_BLASTER;
+ self.weapons &= ~WEPSET_LASER;
W_RandomWeapons(self, g_weaponarena_random);
if(g_weaponarena_random_with_laser)
- self.weapons |= WEPSET_BLASTER;
+ self.weapons |= WEPSET_LASER;
}
self.items = start_items;
self.punchvector = '0 0 0';
self.oldvelocity = self.velocity;
self.fire_endtime = -1;
+ self.revival_time = 0;
entity spawnevent = spawn();
spawnevent.owner = self;
Net_LinkEntity(spawnevent, FALSE, 0.5, SpawnEvent_Send);
+ // Cut off any still running player sounds.
+ stopsound(self, CH_PLAYER_SINGLE);
+
self.model = "";
FixPlayermodel();
self.drawonlytoclient = world;
self.speedrunning = FALSE;
- race_PostSpawn(spot);
-
//stuffcmd(self, "chase_active 0");
//stuffcmd(self, "set viewsize $tmpviewsize \n");
// reset fields the weapons may use
for (j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- WEP_ACTION(j, WR_RESETPLAYER);
+ weapon_action(j, WR_RESETPLAYER);
// all weapons must be fully loaded when we spawn
entity e;
e = get_weaponinfo(j);
if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
- self.(weapon_load[j]) = e.reloading_ammo;
+ self.(weapon_load[j]) = cvar(strcat("g_balance_", e.netname, "_reload_ammo"));
}
oldself = self;
activator = world;
self = oldself;
+ Unfreeze(self);
+
spawn_spot = spot;
MUTATOR_CALLHOOK(PlayerSpawn);
WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[1]));
WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[2]));
WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[3]));
- WriteInt24_t(MSG_ENTITY, compressShotOrigin(arc_shotorigin[0]));
- WriteInt24_t(MSG_ENTITY, compressShotOrigin(arc_shotorigin[1]));
- WriteInt24_t(MSG_ENTITY, compressShotOrigin(arc_shotorigin[2]));
- WriteInt24_t(MSG_ENTITY, compressShotOrigin(arc_shotorigin[3]));
-
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[0]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[1]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[2]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[3]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[0]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[1]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[2]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(gauntlet_shotorigin[3]));
if(sv_foginterval && world.fog != "")
WriteString(MSG_ENTITY, world.fog);
else
WriteString(MSG_ENTITY, "");
WriteByte(MSG_ENTITY, self.count * 255.0); // g_balance_armor_blockpercent
- WriteCoord(MSG_ENTITY, self.bouncefactor); // g_balance_mortar_bouncefactor // WEAPONTODO
- WriteCoord(MSG_ENTITY, self.bouncestop); // g_balance_mortar_bouncestop
- WriteCoord(MSG_ENTITY, self.ebouncefactor); // g_balance_mortar_bouncefactor
- WriteCoord(MSG_ENTITY, self.ebouncestop); // g_balance_mortar_bouncestop
- WriteByte(MSG_ENTITY, WEP_CVAR(vortex, secondary)); // client has to know if it should zoom or not // WEAPONTODO
- WriteByte(MSG_ENTITY, WEP_CVAR(rifle, secondary)); // client has to know if it should zoom or not // WEAPONTODO
+ WriteCoord(MSG_ENTITY, self.bouncefactor); // g_balance_grenadelauncher_bouncefactor
+ WriteCoord(MSG_ENTITY, self.bouncestop); // g_balance_grenadelauncher_bouncestop
+ WriteCoord(MSG_ENTITY, self.ebouncefactor); // g_balance_grenadelauncher_bouncefactor
+ WriteCoord(MSG_ENTITY, self.ebouncestop); // g_balance_grenadelauncher_bouncestop
+ WriteByte(MSG_ENTITY, autocvar_g_balance_nex_secondary); // client has to know if it should zoom or not
+ WriteByte(MSG_ENTITY, autocvar_g_balance_rifle_secondary); // client has to know if it should zoom or not
WriteByte(MSG_ENTITY, serverflags); // client has to know if it should zoom or not
- WriteByte(MSG_ENTITY, WEP_CVAR(minelayer, limit)); // minelayer max mines // WEAPONTODO
- WriteByte(MSG_ENTITY, WEP_CVAR_SEC(hagar, load_max)); // hagar max loadable rockets // WEAPONTODO
+ WriteByte(MSG_ENTITY, autocvar_g_balance_minelayer_limit); // minelayer max mines
+ WriteByte(MSG_ENTITY, autocvar_g_balance_hagar_secondary_load_max); // hagar max loadable rockets
WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange);
- WriteByte(MSG_ENTITY, WEP_CVAR(porto, secondary)); // WEAPONTODO
+ WriteByte(MSG_ENTITY, autocvar_g_balance_porto_secondary);
return TRUE;
}
self.count = autocvar_g_balance_armor_blockpercent;
self.SendFlags |= 1;
}
- if(self.bouncefactor != autocvar_g_balance_mortar_bouncefactor) // WEAPONTODO
+ if(self.bouncefactor != autocvar_g_balance_grenadelauncher_bouncefactor)
{
- self.bouncefactor = autocvar_g_balance_mortar_bouncefactor;
+ self.bouncefactor = autocvar_g_balance_grenadelauncher_bouncefactor;
self.SendFlags |= 1;
}
- if(self.bouncestop != autocvar_g_balance_mortar_bouncestop)
+ if(self.bouncestop != autocvar_g_balance_grenadelauncher_bouncestop)
{
- self.bouncestop = autocvar_g_balance_mortar_bouncestop;
+ self.bouncestop = autocvar_g_balance_grenadelauncher_bouncestop;
self.SendFlags |= 1;
}
if(self.ebouncefactor != autocvar_g_balance_electro_secondary_bouncefactor)
{
if(gameover) return;
if(self.player_blocked) return;
- if(self.freezetag_frozen) return;
+ if(self.frozen) return;
ClientKill_TeamChange(0);
}
anticheat_init();
- race_PreSpawnObserver();
-
// identify the right forced team
if(autocvar_g_campaign)
{
if(!sv_foginterval && world.fog != "")
stuffcmd(self, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
- W_HitPlotOpen(self);
-
- if(g_race || g_cts) {
- string rr;
- if(g_cts)
- rr = CTS_RECORD;
- else
- rr = RACE_RECORD;
-
- msg_entity = self;
- race_send_recordtime(MSG_ONE);
- race_send_speedaward(MSG_ONE);
-
- speedaward_alltimebest = stof(db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/speed")));
- speedaward_alltimebest_holder = uid2name(db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/crypto_idfp")));
- race_send_speedaward_alltimebest(MSG_ONE);
-
- float i;
- for (i = 1; i <= RANKINGS_CNT; ++i) {
- race_SendRankings(i, 0, 0, MSG_ONE);
- }
+ if(autocvar_g_hitplots || strstrofs(strcat(" ", autocvar_g_hitplots_individuals, " "), strcat(" ", self.netaddress, " "), 0) >= 0)
+ {
+ self.hitplotfh = fopen(strcat("hits-", matchid, "-", self.netaddress, "-", ftos(self.playerid), ".plot"), FILE_WRITE);
+ fputs(self.hitplotfh, strcat("#name ", self.netname, "\n"));
}
- else if(autocvar_sv_teamnagger && !(autocvar_bot_vs_human && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca
+ else
+ self.hitplotfh = -1;
+
+ if(autocvar_sv_teamnagger && !(autocvar_bot_vs_human && (c3==-1 && c4==-1)) && !g_ca && !g_cts && !g_race) // teamnagger is currently bad for ca, race & cts
send_CSQC_teamnagger();
CheatInitClient();
return;
}
+ if(IS_PLAYER(self)) { pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1); }
+
PlayerStats_AddGlobalInfo(self);
CheatShutdownClient();
- W_HitPlotClose(self);
+ if(self.hitplotfh >= 0)
+ {
+ fclose(self.hitplotfh);
+ self.hitplotfh = -1;
+ }
anticheat_report();
anticheat_shutdown();
Portal_ClearAll(self);
+ Unfreeze(self);
+
RemoveGrapplingHook(self);
// Here, everything has been done that requires this player to be a client.
void player_regen (void)
{
+ float max_mod, regen_mod, rot_mod, limit_mod;
+ max_mod = regen_mod = rot_mod = limit_mod = 1;
+ regen_mod_max = max_mod;
+ regen_mod_regen = regen_mod;
+ regen_mod_rot = rot_mod;
+ regen_mod_limit = limit_mod;
if(!MUTATOR_CALLHOOK(PlayerRegen))
+ if(!self.frozen)
{
- float minh, mina, maxh, maxa, limith, limita, max_mod, regen_mod, rot_mod, limit_mod;
+ float minh, mina, maxh, maxa, limith, limita;
maxh = autocvar_g_balance_health_rotstable;
maxa = autocvar_g_balance_armor_rotstable;
minh = autocvar_g_balance_health_regenstable;
mina = autocvar_g_balance_armor_regenstable;
limith = autocvar_g_balance_health_limit;
limita = autocvar_g_balance_armor_limit;
-
- max_mod = regen_mod = rot_mod = limit_mod = 1;
+
+ max_mod = regen_mod_max;
+ regen_mod = regen_mod_regen;
+ rot_mod = regen_mod_rot;
+ limit_mod = regen_mod_limit;
maxh = maxh * max_mod;
minh = minh * max_mod;
self.switchweapon = spectatee.switchweapon;
self.switchingweapon = spectatee.switchingweapon;
self.weapon = spectatee.weapon;
- self.vortex_charge = spectatee.vortex_charge;
- self.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
+ self.nex_charge = spectatee.nex_charge;
+ self.nex_chargepool_ammo = spectatee.nex_chargepool_ammo;
self.hagar_load = spectatee.hagar_load;
self.minelayer_mines = spectatee.minelayer_mines;
self.punchangle = spectatee.punchangle;
self.dmg_inflictor = spectatee.dmg_inflictor;
self.v_angle = spectatee.v_angle;
self.angles = spectatee.v_angle;
+ self.frozen = spectatee.frozen;
+ self.revive_progress = spectatee.revive_progress;
if(!self.BUTTON_USE)
self.fixangle = TRUE;
setorigin(self, spectatee.origin);
if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0)
{
self.classname = "player";
+ nades_RemoveBonus(self);
if(autocvar_g_campaign || autocvar_g_balance_teams)
{ JoinBestTeam(self, FALSE, TRUE); }
return;
#endif
+ if(self.frozen == 2)
+ {
+ self.revive_progress = bound(0, self.revive_progress + frametime * self.revive_speed, 1);
+ self.health = max(1, self.revive_progress * start_health);
+ self.iceblock.alpha = bound(0.2, 1 - self.revive_progress, 1);
+
+ if(self.revive_progress >= 1)
+ Unfreeze(self);
+ }
+ else if(self.frozen == 3)
+ {
+ self.revive_progress = bound(0, self.revive_progress - frametime * self.revive_speed, 1);
+ self.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * self.revive_progress );
+
+ if(self.health < 1)
+ {
+ if(self.vehicle)
+ vehicles_exit(VHEF_RELESE);
+ self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE, self.origin, '0 0 0');
+ }
+ else if ( self.revive_progress <= 0 )
+ Unfreeze(self);
+ }
+
MUTATOR_CALLHOOK(PlayerPreThink);
if(!self.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
if(frametime)
{
- if(self.weapon == WEP_VORTEX && WEP_CVAR(vortex, charge))
+ if(self.weapon == WEP_NEX && autocvar_g_balance_nex_charge)
{
- self.weaponentity_glowmod_x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit));
- self.weaponentity_glowmod_y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit));
- self.weaponentity_glowmod_z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit));
+ self.weaponentity_glowmod_x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_animlimit);
+ self.weaponentity_glowmod_y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_animlimit);
+ self.weaponentity_glowmod_z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_animlimit);
- if(self.vortex_charge > WEP_CVAR(vortex, charge_animlimit))
+ if(self.nex_charge > autocvar_g_balance_nex_charge_animlimit)
{
- self.weaponentity_glowmod_x = self.weaponentity_glowmod_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));
- self.weaponentity_glowmod_y = self.weaponentity_glowmod_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));
- self.weaponentity_glowmod_z = self.weaponentity_glowmod_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));
+ self.weaponentity_glowmod_x = self.weaponentity_glowmod_x + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.nex_charge - autocvar_g_balance_nex_charge_animlimit) / (1 - autocvar_g_balance_nex_charge_animlimit);
+ self.weaponentity_glowmod_y = self.weaponentity_glowmod_y + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.nex_charge - autocvar_g_balance_nex_charge_animlimit) / (1 - autocvar_g_balance_nex_charge_animlimit);
+ self.weaponentity_glowmod_z = self.weaponentity_glowmod_z + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.nex_charge - autocvar_g_balance_nex_charge_animlimit) / (1 - autocvar_g_balance_nex_charge_animlimit);
}
}
else
do_crouch = 0;
if(self.vehicle)
do_crouch = 0;
- if(self.freezetag_frozen)
+ if(self.frozen)
do_crouch = 0;
-
- // WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
- // It cannot be predicted by the engine!
- if((self.weapon == WEP_SHOCKWAVE || self.weapon == WEP_SHOTGUN) && self.weaponentity.wframe == WFRAME_FIRE2 && time < self.weapon_nextthink)
+ if(self.weapon == WEP_SHOTGUN && self.weaponentity.wframe == WFRAME_FIRE2 && time < self.weapon_nextthink)
do_crouch = 0;
if (do_crouch)
player_regen();
- // WEAPONTODO: Add a weapon request for this
// rot nex charge to the charge limit
- if(WEP_CVAR(vortex, charge_rot_rate) && self.vortex_charge > WEP_CVAR(vortex, charge_limit) && self.vortex_charge_rottime < time)
- self.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), self.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
+ if(autocvar_g_balance_nex_charge_rot_rate && self.nex_charge > autocvar_g_balance_nex_charge_limit && self.nex_charge_rottime < time)
+ self.nex_charge = bound(autocvar_g_balance_nex_charge_limit, self.nex_charge - autocvar_g_balance_nex_charge_rot_rate * frametime / W_TICSPERFRAME, 1);
if(frametime)
player_anim();
SpectatorThink();
}
- // WEAPONTODO: Add weapon request for this
if(!zoomstate_set)
- SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_VORTEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)); // WEAPONTODO
+ SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE && autocvar_g_balance_rifle_secondary == 0));
float oldspectatee_status;
oldspectatee_status = self.spectatee_status;
if(self.spectatee_status != oldspectatee_status)
{
ClientData_Touch(self);
- if(g_race || g_cts)
- race_InitSpectator();
}
if(self.teamkill_soundtime)
target_voicescript_next(self);
- // WEAPONTODO: Move into weaponsystem somehow
// if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring
if(!self.weapon)
self.clip_load = self.clip_size = 0;
playerdemo_write();
- if((g_cts || g_race) && self.cvar_cl_allow_uidtracking == 1 && self.cvar_cl_allow_uid2name == 1)
- {
- if (!self.stored_netname)
- self.stored_netname = strzone(uid2name(self.crypto_idfp));
- if(self.stored_netname != self.netname)
- {
- db_put(ServerProgsDB, strcat("/uid2name/", self.crypto_idfp), self.netname);
- strunzone(self.stored_netname);
- self.stored_netname = strzone(self.netname);
- }
- }
-
- /*
- if(g_race)
- dprintf("%f %.6f\n", time, race_GetFractionalLapCount(self));
- */
-
CSQCMODEL_AUTOUPDATE();
}