X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=143b2d18b82f6396948a08785d28e52b45b47c88;hb=2ea018e26b688038823d6a52a17ab8b6abd26a9e;hp=0e0a271276c43afbfab43a0c102de4468f0c081e;hpb=ba1635faec69d9ae0cb4fe4713f1bf6e43fca90a;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 0e0a27127..143b2d18b 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1,6 +1,3 @@ -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); @@ -76,6 +73,8 @@ void ClientData_Touch(entity e) .string netname_previous; +void SetSpectator(entity player, entity spectatee); + /* ============= @@ -140,7 +139,8 @@ void PutObserverInServer (void) { 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) @@ -154,20 +154,14 @@ void PutObserverInServer (void) 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) @@ -239,6 +233,7 @@ void PutObserverInServer (void) 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; @@ -265,6 +260,7 @@ void PutObserverInServer (void) self.punchvector = '0 0 0'; self.oldvelocity = self.velocity; self.fire_endtime = -1; + self.event_damage = func_null; } .float model_randomizer; @@ -283,7 +279,7 @@ void FixPlayermodel() if(teamplay) { string s; - s = Team_ColorName_Lower(self.team); + s = Static_Team_ColorName_Lower(self.team); if(s != "neutral") { defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", s)); @@ -373,6 +369,8 @@ void PutClientInServer (void) WriteEntity(MSG_ONE, self); } + SetSpectator(self, world); + // reset player keys self.itemkeys = 0; @@ -391,8 +389,6 @@ void PutClientInServer (void) if(self.team < 0) JoinBestTeam(self, FALSE, TRUE); - race_PreSpawn(); - spot = SelectSpawnPoint (FALSE); if(!spot) { @@ -467,10 +463,10 @@ void PutClientInServer (void) if(g_weaponarena_random) // WEAPONTODO: more stuff that should be in a mutator. also: rename those cvars { - if(g_weaponarena_random_with_laser) + if(g_weaponarena_random_with_blaster) self.weapons &= ~WEPSET_BLASTER; W_RandomWeapons(self, g_weaponarena_random); - if(g_weaponarena_random_with_laser) + if(g_weaponarena_random_with_blaster) self.weapons |= WEPSET_BLASTER; } @@ -514,6 +510,8 @@ void PutClientInServer (void) self.angles = spot.angles; self.angles_z = 0; // never spawn tilted even if the spot says to + if(IS_BOT_CLIENT(self)) + self.v_angle = self.angles; self.fixangle = TRUE; // turn this way immediately self.velocity = '0 0 0'; self.avelocity = '0 0 0'; @@ -521,11 +519,15 @@ void PutClientInServer (void) 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; @@ -549,7 +551,6 @@ void PutClientInServer (void) self.spider_slowness = 0; - self.statdraintime = time + 5; self.BUTTON_ATCK = self.BUTTON_JUMP = self.BUTTON_ATCK2 = 0; if(self.killcount == -666) { @@ -564,8 +565,6 @@ void PutClientInServer (void) self.speedrunning = FALSE; - race_PostSpawn(spot); - //stuffcmd(self, "chase_active 0"); //stuffcmd(self, "set viewsize $tmpviewsize \n"); @@ -594,6 +593,8 @@ void PutClientInServer (void) activator = world; self = oldself; + Unfreeze(self); + spawn_spot = spot; MUTATOR_CALLHOOK(PlayerSpawn); @@ -785,8 +786,8 @@ void ClientKill_Now() if(self.killindicator_teamchange) ClientKill_Now_TeamChange(); - // in any case: - Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0'); + if(IS_PLAYER(self)) + Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0'); // now I am sure the player IS dead } @@ -940,7 +941,7 @@ void ClientKill (void) { if(gameover) return; if(self.player_blocked) return; - if(self.freezetag_frozen) return; + if(self.frozen) return; ClientKill_TeamChange(0); } @@ -1056,8 +1057,6 @@ void ClientConnect (void) anticheat_init(); - race_PreSpawnObserver(); - // identify the right forced team if(autocvar_g_campaign) { @@ -1202,27 +1201,7 @@ void ClientConnect (void) 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); - } - } - else if(autocvar_sv_teamnagger && !(autocvar_bot_vs_human && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca + 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(); @@ -1256,6 +1235,8 @@ void ClientDisconnect (void) return; } + if(IS_PLAYER(self)) { pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1); } + PlayerStats_AddGlobalInfo(self); CheatShutdownClient(); @@ -1281,6 +1262,8 @@ void ClientDisconnect (void) Portal_ClearAll(self); + Unfreeze(self); + RemoveGrapplingHook(self); // Here, everything has been done that requires this player to be a client. @@ -1414,7 +1397,7 @@ void player_powerups (void) // add a way to see what the items were BEFORE all of these checks for the mutator hook olditems = self.items; - if((self.items & IT_USING_JETPACK) && !self.deadflag) + if((self.items & IT_USING_JETPACK) && !self.deadflag && !gameover) self.modelflags |= MF_ROCKET; else self.modelflags &= ~MF_ROCKET; @@ -1427,7 +1410,7 @@ void player_powerups (void) Fire_ApplyDamage(self); Fire_ApplyEffect(self); - if (!g_minstagib) + if (!g_instagib) { if (self.items & IT_STRENGTH) { @@ -1574,17 +1557,27 @@ float CalcRotRegen(float current, float regenstable, float regenfactor, float re 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; @@ -1712,6 +1705,7 @@ void SpectateCopy(entity spectatee) { self.vortex_charge = spectatee.vortex_charge; self.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo; self.hagar_load = spectatee.hagar_load; + self.arc_heat_percent = spectatee.arc_heat_percent; self.minelayer_mines = spectatee.minelayer_mines; self.punchangle = spectatee.punchangle; self.view_ofs = spectatee.view_ofs; @@ -1721,6 +1715,8 @@ void SpectateCopy(entity spectatee) { 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); @@ -1755,15 +1751,16 @@ void SpectateCopy(entity spectatee) { } } -float SpectateUpdate() { +float SpectateUpdate() +{ if(!self.enemy) return 0; - if (self == self.enemy) - return 0; - - if (!IS_PLAYER(self.enemy)) + if(!IS_PLAYER(self.enemy) || self == self.enemy) + { + SetSpectator(self, world); return 0; + } SpectateCopy(self.enemy); @@ -1801,13 +1798,25 @@ float SpectateSet() return TRUE; } +void SetSpectator(entity player, entity spectatee) +{ + entity old_spectatee = player.enemy; + + player.enemy = spectatee; + + // WEAPONTODO + // these are required to fix the spectator bug with arc + if(old_spectatee && old_spectatee.arc_beam) { old_spectatee.arc_beam.SendFlags |= ARC_SF_SETTINGS; } + if(player.enemy && player.enemy.arc_beam) { player.enemy.arc_beam.SendFlags |= ARC_SF_SETTINGS; } +} + float Spectate(entity pl) { if(g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer) if(pl.team != self.team) return 0; - self.enemy = pl; + SetSpectator(self, pl); return SpectateSet(); } @@ -1847,8 +1856,7 @@ float SpectateNext() other = find(other, classname, "player"); } - if (other) - self.enemy = other; + if(other) { SetSpectator(self, other); } return SpectateSet(); } @@ -1887,7 +1895,7 @@ float SpectatePrev() else other = first; } - self.enemy = other; + SetSpectator(self, other); return SpectateSet(); } @@ -1926,6 +1934,7 @@ void LeaveSpectatorMode() 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); } @@ -1981,7 +1990,7 @@ float nJoinAllowed(entity ignore) { float currentlyPlaying = 0; FOR_EACH_REALCLIENT(e) - if(IS_PLAYER(e) || e.caplayer == 1) + if(IS_PLAYER(e) || e.caplayer) currentlyPlaying += 1; if(currentlyPlaying < autocvar_g_maxplayers) @@ -1995,7 +2004,10 @@ float nJoinAllowed(entity ignore) { * g_maxplayers_spectator_blocktime seconds */ void checkSpectatorBlock() { - if(IS_SPEC(self) || IS_OBSERVER(self)) { + if(IS_SPEC(self) || IS_OBSERVER(self)) + if(!self.caplayer) + if(IS_REAL_CLIENT(self)) + { if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) { Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING); dropclient(self); @@ -2160,7 +2172,7 @@ void PlayerPreThink (void) self.stat_game_starttime = game_starttime; self.stat_round_starttime = round_starttime; - self.stat_allow_oldnexbeam = autocvar_g_allow_oldnexbeam; + self.stat_allow_oldvortexbeam = autocvar_g_allow_oldvortexbeam; self.stat_leadlimit = autocvar_leadlimit; if(frametime) @@ -2231,6 +2243,30 @@ void PlayerPreThink (void) 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 @@ -2355,7 +2391,7 @@ void PlayerPreThink (void) 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 @@ -2409,7 +2445,7 @@ void PlayerPreThink (void) player_regen(); // WEAPONTODO: Add a weapon request for this - // rot nex charge to the charge limit + // rot vortex 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); @@ -2450,8 +2486,6 @@ void PlayerPreThink (void) if(self.spectatee_status != oldspectatee_status) { ClientData_Touch(self); - if(g_race || g_cts) - race_InitSpectator(); } if(self.teamkill_soundtime) @@ -2611,22 +2645,5 @@ void PlayerPostThink (void) 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(); }