X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=a1047ea9d07595dae83fcb3fd49953b5b24062c7;hb=6426f2fc8a6e41ebd34a33dd24a23fd6a9926631;hp=11bff62af1f71256b12f87e0d038f1f6f1815cf0;hpb=b3531989fe085982b9fa1b4c8e3a35947936e441;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 11bff62af..9326cec68 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -132,9 +132,9 @@ vector Spawn_Score(entity spot, entity playerlist, float teamcheck, float anypoi prio = 0; // filter out spots for the wrong team - if(teamcheck) - if(spot.team != teamcheck) - return '-1 0 0'; + if(teamcheck >= 0) + if(spot.team != teamcheck) + return '-1 0 0'; if(race_spawns) if(spot.target == "") @@ -269,7 +269,7 @@ entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindis spotlist = spot; /* - if(teamcheck) + if(teamcheck >= 0) if(spot.team != teamcheck) error("invalid spawn added"); @@ -283,7 +283,7 @@ entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindis /* entity e; - if(teamcheck) + if(teamcheck >= 0) for(e = spotlist; e; e = e.chain) { print("seen ", etos(e), "\n"); @@ -325,10 +325,30 @@ entity SelectSpawnPoint (float anypoint) if (spot) return spot; - teamcheck = 0; + if(anypoint) + teamcheck = -1; + else if(have_team_spawns > 0) + { + if(have_team_spawns_forteam[self.team] == 0) + { + // we request a spawn for a team, and we have team + // spawns, but that team has no spawns? + if(have_team_spawns_forteam[0]) + // try noteam spawns + teamcheck = 0; + else + // if not, any spawn has to do + teamcheck = -1; + } + else + teamcheck = self.team; // MUST be team + } + else if(have_team_spawns == 0 && have_team_spawns_forteam[0]) + teamcheck = 0; // MUST be noteam + else + teamcheck = -1; + // if we get here, we either require team spawns but have none, or we require non-team spawns and have none; use any spawn then - if(!anypoint && have_team_spawns > 0) - teamcheck = self.team; // get the list of players playerlist = findchain(classname, "player"); @@ -368,7 +388,7 @@ entity SelectSpawnPoint (float anypoint) print("spot mindistance: ", vtos(spot.spawnpoint_score), "\n"); entity e; - if(teamcheck) + if(teamcheck >= 0) for(e = firstspot; e; e = e.chain) if(e.team != teamcheck) error("invalid spawn found"); @@ -633,13 +653,13 @@ void PutObserverInServer (void) accuracy_resend(self); self.spectatortime = time; - + self.classname = "observer"; self.iscreature = FALSE; self.health = -666; self.takedamage = DAMAGE_NO; self.solid = SOLID_NOT; - self.movetype = MOVETYPE_NOCLIP; + self.movetype = MOVETYPE_SPECTATOR; //(self.cvar_cl_clippedspectating ? MOVETYPE_NOCLIP : MOVETYPE_FLY); // it's too early for this anyway, lets just set it in playerprethink self.flags = FL_CLIENT | FL_NOTARGET; self.armorvalue = 666; self.effects = 0; @@ -668,9 +688,9 @@ void PutObserverInServer (void) self.fixangle = TRUE; self.crouch = FALSE; - self.view_ofs = PL_VIEW_OFS; + self.view_ofs = '0 0 0'; // so that you can't go inside walls with MOVETYPE_FLY, previously "PL_VIEW_OFS" - for some reason this is diff from normal players setorigin (self, spot.origin); - setsize (self, '0 0 0', '0 0 0'); + setsize (self, '-16 -16 -24', '16 16 24'); // so that you can't go inside walls with MOVETYPE_FLY self.prevorigin = self.origin; self.items = 0; self.weapons = 0; @@ -1050,8 +1070,17 @@ void PutClientInServer (void) // reset fields the weapons may use for (j = WEP_FIRST; j <= WEP_LAST; ++j) + { 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] = cvar(strcat("g_balance_", e.netname, "_reload_ammo")); + } + self.weapon_forbidchange = FALSE; + oldself = self; self = spot; activator = oldself; @@ -1065,8 +1094,6 @@ void PutClientInServer (void) self.cnt = self.switchweapon; self.weapon = 0; - self.wish_reload = 0; - if(!self.alivetime) self.alivetime = time; } else if(self.classname == "observer" || (g_ca && !allowed_to_spawn)) { @@ -1107,9 +1134,10 @@ float ClientInit_SendEntity(entity to, float sf) 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_sniperrifle_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, autocvar_g_balance_sniperrifle_magazinecapacity); // rifle max bullets + 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); return TRUE; } @@ -1497,6 +1525,7 @@ Called when a client connects to the server string ColoredTeamName(float t); void DecodeLevelParms (void); //void dom_player_join_team(entity pl); +void set_dom_state(entity e); void ClientConnect (void) { float t; @@ -1513,7 +1542,7 @@ void ClientConnect (void) DecodeLevelParms(); #ifdef WATERMARK - sprint(self, strcat("^4SVQC Build information: ", WATERMARK(), "\n")); + sprint(self, strcat("^4SVQC Build information: ^1", WATERMARK(), "\n")); #endif self.classname = "player_joining"; @@ -1610,6 +1639,9 @@ void ClientConnect (void) self.playerid = (playerid_last = playerid_last + 1); + if(clienttype(self) == CLIENTTYPE_BOT) + PlayerStats_AddPlayer(self); + if(autocvar_sv_eventlog) GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((clienttype(self) == CLIENTTYPE_REAL) ? self.netaddress : "bot"), ":", self.netname)); @@ -1672,8 +1704,7 @@ void ClientConnect (void) ctf_clientconnect(); }*/ - if(teams_matter || radar_showennemies) - attach_entcs(); + attach_entcs(); bot_relinkplayerlist(); @@ -1738,9 +1769,10 @@ void ClientConnect (void) else if(autocvar_sv_teamnagger && !(autocvar_bot_vs_human && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca send_CSQC_teamnagger(); - CheatInitClient(); + if (g_domination) + set_dom_state(self); - PlayerStats_AddPlayer(self); + CheatInitClient(); } /* @@ -1751,7 +1783,6 @@ Called when a client disconnects from the server ============= */ .entity chatbubbleentity; -.entity teambubbleentity; void ReadyCount(); void ClientDisconnect (void) { @@ -1805,9 +1836,6 @@ void ClientDisconnect (void) if (self.chatbubbleentity) remove (self.chatbubbleentity); - if (self.teambubbleentity) - remove (self.teambubbleentity); - if (self.killindicator) remove (self.killindicator); @@ -1888,52 +1916,6 @@ void UpdateChatBubble() } -void TeamBubbleThink() -{ - self.nextthink = time; - if (!self.owner.modelindex || self.owner.teambubbleentity != self) - { - if(self.owner) // but why can that ever be world? - self.owner.teambubbleentity = world; - remove(self); - return; - } -// setorigin(self, self.owner.origin + '0 0 15' + self.owner.maxs_z * '0 0 1'); // bandwidth hog. setattachment does this now - if (self.owner.BUTTON_CHAT || self.owner.deadflag || self.owner.killindicator) - self.model = ""; - else - self.model = self.mdl; - -}; - -float TeamBubble_customizeentityforclient() -{ - return (self.owner != other && self.owner.team == other.team && other.killcount > -666); -} - -void UpdateTeamBubble() -{ - if (!self.modelindex || !teams_matter) - return; - // spawn a teambubble entity if needed - if (!self.teambubbleentity && teams_matter) - { - self.teambubbleentity = spawn(); - self.teambubbleentity.owner = self; - self.teambubbleentity.exteriormodeltoclient = self; - self.teambubbleentity.think = TeamBubbleThink; - self.teambubbleentity.nextthink = time; - setmodel(self.teambubbleentity, "models/misc/teambubble.spr"); // precision set below -// setorigin(self.teambubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1'); - setorigin(self.teambubbleentity, '0 0 15' + self.maxs_z * '0 0 1'); - setattachment(self.teambubbleentity, self, ""); // sticks to moving player better, also conserves bandwidth - self.teambubbleentity.mdl = self.teambubbleentity.model; - self.teambubbleentity.model = self.teambubbleentity.mdl; - self.teambubbleentity.customizeentityforclient = TeamBubble_customizeentityforclient; - self.teambubbleentity.effects = EF_LOWPRECISION; - } -} - // LordHavoc: this hack will be removed when proper _pants/_shirt layers are // added to the model skins /*void UpdateColorModHack() @@ -2341,11 +2323,14 @@ void SpectateCopy(entity spectatee) { self.ammo_nails = spectatee.ammo_nails; self.ammo_rockets = spectatee.ammo_rockets; self.ammo_fuel = spectatee.ammo_fuel; + self.clip_load = spectatee.clip_load; + self.clip_size = spectatee.clip_size; self.effects = spectatee.effects & EFMASK_CHEAP; // eat performance self.health = spectatee.health; self.impulse = 0; self.items = spectatee.items; self.last_pickup = spectatee.last_pickup; + self.hit_time = spectatee.hit_time; self.metertime = spectatee.metertime; self.strength_finished = spectatee.strength_finished; self.invincible_finished = spectatee.invincible_finished; @@ -2353,6 +2338,10 @@ void SpectateCopy(entity spectatee) { self.weapons = spectatee.weapons; self.switchweapon = spectatee.switchweapon; self.weapon = spectatee.weapon; + 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.view_ofs = spectatee.view_ofs; self.v_angle = spectatee.v_angle; @@ -2516,6 +2505,7 @@ void checkSpectatorBlock() { void ObserverThink() { + float prefered_movetype; if (self.flags & FL_JUMPRELEASED) { if (self.BUTTON_JUMP && !self.version_mismatch) { self.welcomemessage_time = 0; @@ -2527,6 +2517,10 @@ void ObserverThink() if(SpectateNext() == 1) { self.classname = "spectator"; } + } else { + prefered_movetype = (self.cvar_cl_clippedspectating ? MOVETYPE_SPECTATOR : MOVETYPE_NOCLIP); + if (self.movetype != prefered_movetype) + self.movetype = prefered_movetype; } } else { if (!(self.BUTTON_ATCK || self.BUTTON_JUMP)) { @@ -2597,6 +2591,8 @@ void() nexball_setstatus; .float items_added; void PlayerPreThink (void) { + WarpZone_PlayerPhysics_FixVAngle(); + self.stat_game_starttime = game_starttime; self.stat_allow_oldnexbeam = autocvar_g_allow_oldnexbeam; self.stat_leadlimit = autocvar_leadlimit; @@ -2681,18 +2677,9 @@ void PlayerPreThink (void) return; // the think tics } - if(self.teleport_time) - if(time > self.teleport_time) - { - self.teleport_time = 0; - self.effects = self.effects - (self.effects & EF_NODRAW); - } - - if(frametime > 0) // don't do this in cl_movement frames, just in server ticks - UpdateSelectedPlayer(); - //don't allow the player to turn around while game is paused! if(timeoutStatus == 2) { + // FIXME turn this into CSQC stuff self.v_angle = self.lastV_angle; self.angles = self.lastV_angle; self.fixangle = TRUE; @@ -2716,7 +2703,26 @@ void PlayerPreThink (void) self.glowmod_z = -1; } else + { + // set weapon and player glowmod self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2; + + 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.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.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.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 + self.weaponentity_glowmod = self.glowmod; + } player_powerups(); } @@ -2901,7 +2907,7 @@ void PlayerPreThink (void) } if(!zoomstate_set) - SetZoomState(self.BUTTON_ZOOM || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_SNIPERRIFLE && autocvar_g_balance_sniperrifle_secondary == 0)); + 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; @@ -2942,6 +2948,10 @@ void PlayerPreThink (void) } target_voicescript_next(self); + + // 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; } float isInvisibleString(string s) @@ -3038,7 +3048,6 @@ void PlayerPostThink (void) if(self.classname == "player") { CheckRules_Player(); UpdateChatBubble(); - UpdateTeamBubble(); if (self.impulse) ImpulseCommands(); if (intermission_running) @@ -3095,7 +3104,7 @@ void PlayerPostThink (void) playerdemo_write(); - if((g_cts || g_race) && self.cvar_cl_allow_uid2name == 1) + 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));