X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=e6f0433c4e9eefc196bd7230db425506630af3fe;hb=5119ca4560e0c9864b4a88c91297a43e41947cc2;hp=0d82ed855c7b8a99175d6014c696904d142c63ca;hpb=845688edbe9045b65b6e9978be287b0e3bda3e30;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 0d82ed855..e6f0433c4 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -158,7 +158,7 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck) if (thisdist < shortest) shortest = thisdist; } - if(shortest < mindist) + if(shortest > mindist) prio += SPAWN_PRIO_GOOD_DISTANCE; spawn_score = prio * '1 0 0' + shortest * '0 1 0'; @@ -311,7 +311,7 @@ entity SelectSpawnPoint (float anypoint) if (!spot) { if(autocvar_spawn_debug) - GotoNextMap(); + GotoNextMap(0); else { if(some_spawn_has_been_used) @@ -456,7 +456,7 @@ void PutObserverInServer (void) self.health = -666; self.takedamage = DAMAGE_NO; self.solid = SOLID_NOT; - self.movetype = MOVETYPE_FLY_WORLDONLY; //(self.cvar_cl_clippedspectating ? MOVETYPE_NOCLIP : MOVETYPE_FLY); // it's too early for this anyway, lets just set it in playerprethink + self.movetype = MOVETYPE_FLY_WORLDONLY; // user preference is controlled by playerprethink self.flags = FL_CLIENT | FL_NOTARGET; self.armorvalue = 666; self.effects = 0; @@ -466,7 +466,6 @@ void PutObserverInServer (void) self.pauseregen_finished = 0; self.damageforcescale = 0; self.death_time = 0; - self.dead_frame = 0; self.alpha = 0; self.scale = 0; self.fade_time = 0; @@ -485,7 +484,7 @@ void PutObserverInServer (void) self.fixangle = TRUE; self.crouch = FALSE; - setorigin (self, spot.origin); + 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; self.items = 0; self.weapons = 0; @@ -584,13 +583,6 @@ void FixPlayermodel() } } - if(self.modelindex == 0 && self.deadflag == DEAD_NO) - { - if(self.model != "") - bprint("\{1}^1Player ", self.netname, "^1 has a zero modelindex, trying to fix...\n"); - self.model = ""; // force the != checks to return true - } - if(defaultmodel != "") { if (defaultmodel != self.model) @@ -767,7 +759,6 @@ void PutClientInServer (void) } self.items = start_items; - self.jump_interval = time; self.spawnshieldtime = time + autocvar_g_spawnshieldtime; self.pauserotarmor_finished = time + autocvar_g_balance_pause_armor_rot_spawn; @@ -783,8 +774,6 @@ void PutClientInServer (void) } self.damageforcescale = 2; self.death_time = 0; - self.dead_frame = 0; - self.alpha = 0; self.scale = 0; self.fade_time = 0; self.pain_frame = 0; @@ -925,6 +914,8 @@ void PutClientInServer (void) if(!self.alivetime) self.alivetime = time; + + antilag_clear(self); } else if(self.classname == "observer" || (g_ca && !allowed_to_spawn)) { PutObserverInServer (); } @@ -1121,7 +1112,7 @@ void KillIndicator_Think() return; } - if (!self.owner.modelindex) + if (self.owner.alpha < 0) { self.owner.killindicator = world; remove(self); @@ -1181,7 +1172,7 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 if(!self.killindicator) { - if(self.modelindex && self.deadflag == DEAD_NO) + if(self.deadflag == DEAD_NO) { killtime = max(killtime, self.clientkill_nexttime - time); self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam; @@ -1509,8 +1500,6 @@ void ClientConnect (void) else stuffcmd(self, "set _teams_available 0\n"); - stuffcmd(self, strcat("set gametype ", ftos(game), "\n")); - if(g_arena || g_ca) { self.classname = "observer"; @@ -1533,7 +1522,7 @@ void ClientConnect (void) } self.jointime = time; - self.allowedTimeouts = autocvar_sv_timeout_number; + self.allowed_timeouts = autocvar_sv_timeout_number; if(clienttype(self) == CLIENTTYPE_REAL) { @@ -1705,7 +1694,7 @@ void ClientDisconnect (void) void ChatBubbleThink() { self.nextthink = time; - if (!self.owner.modelindex || self.owner.chatbubbleentity != self) + if ((self.owner.alpha < 0) || self.owner.chatbubbleentity != self) { if(self.owner) // but why can that ever be world? self.owner.chatbubbleentity = world; @@ -1724,7 +1713,7 @@ void ChatBubbleThink() void UpdateChatBubble() { - if (!self.modelindex) + if (self.alpha < 0) return; // spawn a chatbubble entity if needed if (!self.chatbubbleentity) @@ -1764,7 +1753,7 @@ void UpdateChatBubble() .float oldcolormap; void respawn(void) { - if(self.modelindex != 0 && autocvar_g_respawn_ghosts) + if(self.alpha >= 0 && autocvar_g_respawn_ghosts) { self.solid = SOLID_NOT; self.takedamage = DAMAGE_NO; @@ -1813,9 +1802,9 @@ void player_powerups (void) self.modelflags &~= MF_ROCKET; } - self.effects &~= (EF_DIMLIGHT | EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST); + self.effects &~= (EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST); - if(!self.modelindex || self.deadflag) // don't apply the flags if the player is gibbed + if(self.alpha < 0 || self.deadflag) // don't apply the flags if the player is gibbed return; Fire_ApplyDamage(self); @@ -1850,7 +1839,7 @@ void player_powerups (void) if (self.items & IT_INVINCIBLE) { play_countdown(self.invincible_finished, "misc/poweroff.wav"); - if (time > self.invincible_finished && autocvar_g_balance_powerup_timer) + if (time > self.invincible_finished) { self.items = self.items - (self.items & IT_INVINCIBLE); sprint(self, "^3Speed has worn off\n"); @@ -1871,7 +1860,7 @@ void player_powerups (void) { play_countdown(self.strength_finished, "misc/poweroff.wav"); self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); - if (time > self.strength_finished && autocvar_g_balance_powerup_timer) + if (time > self.strength_finished) { self.items = self.items - (self.items & IT_STRENGTH); sprint(self, "^3Strength has worn off\n"); @@ -1889,7 +1878,7 @@ void player_powerups (void) { play_countdown(self.invincible_finished, "misc/poweroff.wav"); self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); - if (time > self.invincible_finished && autocvar_g_balance_powerup_timer) + if (time > self.invincible_finished) { self.items = self.items - (self.items & IT_INVINCIBLE); sprint(self, "^3Shield has worn off\n"); @@ -1903,26 +1892,26 @@ void player_powerups (void) sprint(self, "^3Shield surrounds you\n"); } } + } + + if(autocvar_g_nodepthtestplayers) + self.effects = self.effects | EF_NODEPTHTEST; - if(autocvar_g_nodepthtestplayers) - self.effects = self.effects | EF_NODEPTHTEST; - - if(autocvar_g_fullbrightplayers) - self.effects = self.effects | EF_FULLBRIGHT; + if(autocvar_g_fullbrightplayers) + self.effects = self.effects | EF_FULLBRIGHT; - // midair gamemode: damage only while in the air - // if in midair mode, being on ground grants temporary invulnerability - // (this is so that multishot weapon don't clear the ground flag on the - // first damage in the frame, leaving the player vulnerable to the - // remaining hits in the same frame) - if (self.flags & FL_ONGROUND) - if (g_midair) - self.spawnshieldtime = max(self.spawnshieldtime, time + autocvar_g_midair_shieldtime); + // midair gamemode: damage only while in the air + // if in midair mode, being on ground grants temporary invulnerability + // (this is so that multishot weapon don't clear the ground flag on the + // first damage in the frame, leaving the player vulnerable to the + // remaining hits in the same frame) + if (self.flags & FL_ONGROUND) + if (g_midair) + self.spawnshieldtime = max(self.spawnshieldtime, time + autocvar_g_midair_shieldtime); - if (time >= game_starttime) - if (time < self.spawnshieldtime) - self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT); - } + if (time >= game_starttime) + if (time < self.spawnshieldtime) + self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT); MUTATOR_CALLHOOK(PlayerPowerups); } @@ -2608,7 +2597,7 @@ void PlayerPreThink (void) } //don't allow the player to turn around while game is paused! - if(timeoutStatus == 2) { + if(timeout_status == TIMEOUT_ACTIVE) { // FIXME turn this into CSQC stuff self.v_angle = self.lastV_angle; self.angles = self.lastV_angle; @@ -2928,10 +2917,8 @@ void PlayerPostThink (void) stuffcmd(self, strcat("name ", self.netname, substring(ftos(random()), 2, -1), "\n")); } - if(sv_maxidle && frametime) + if(sv_maxidle && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero). { - // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero). - float timeleft; if (time - self.parm_idlesince < 1) // instead of (time == self.parm_idlesince) to support sv_maxidle <= 10 { if(self.idlekick_lasttimeleft) @@ -2939,34 +2926,37 @@ void PlayerPostThink (void) Send_CSQC_Centerprint_Generic_Expire(self, CPID_DISCONNECT_IDLING); self.idlekick_lasttimeleft = 0; } - return; } - timeleft = ceil(sv_maxidle - (time - self.parm_idlesince)); - if(timeleft == min(10, sv_maxidle - 1)) // - 1 to support sv_maxidle <= 10 - { - if(!self.idlekick_lasttimeleft) - Send_CSQC_Centerprint_Generic(self, CPID_DISCONNECT_IDLING, "^3Stop idling!\n^3Disconnecting in %d seconds...", 1, timeleft); - } - if(timeleft <= 0) - { - bprint("^3", self.netname, "^3 was kicked for idling.\n"); - AnnounceTo(self, "terminated"); - dropclient(self); - return; - } - else if(timeleft <= 10) + else { - if(timeleft != self.idlekick_lasttimeleft) - AnnounceTo(self, ftos(timeleft)); - self.idlekick_lasttimeleft = timeleft; + float timeleft; + timeleft = ceil(sv_maxidle - (time - self.parm_idlesince)); + if(timeleft == min(10, sv_maxidle - 1)) // - 1 to support sv_maxidle <= 10 + { + if(!self.idlekick_lasttimeleft) + Send_CSQC_Centerprint_Generic(self, CPID_DISCONNECT_IDLING, "^3Stop idling!\n^3Disconnecting in %d seconds...", 1, timeleft); + } + if(timeleft <= 0) + { + bprint("^3", self.netname, "^3 was kicked for idling.\n"); + AnnounceTo(self, "terminated"); + dropclient(self); + return; + } + else if(timeleft <= 10) + { + if(timeleft != self.idlekick_lasttimeleft) + AnnounceTo(self, ftos(timeleft)); + self.idlekick_lasttimeleft = timeleft; + } } } #ifdef TETRIS if(self.impulse == 100) ImpulseCommands(); - if (TetrisPostFrame()) - return; + if (!TetrisPostFrame()) + { #endif CheatFrame(); @@ -2987,6 +2977,10 @@ void PlayerPostThink (void) //do nothing } +#ifdef TETRIS + } +#endif + /* float i; for(i = 0; i < 1000; ++i)