X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=9244c93eb0f1016782db538b9b184e3c76821609;hp=cf941e9e3c2ee269d7a3b171791a3a22a09ebed4;hb=4cf67f3644408e5ac791692650b6b9b0660884cf;hpb=fef280899c7d1bb27078da823b0a64843b2f1129 diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index cf941e9e3c..9244c93eb0 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -398,8 +398,15 @@ Checks if the argument string can be a valid playermodel. Returns a valid one in doubt. ============= */ -string FallbackPlayerModel = "models/player/marine.zym"; +string FallbackPlayerModel; string CheckPlayerModel(string plyermodel) { + if(FallbackPlayerModel != cvar_defstring("_cl_playermodel")) + { + // note: we cannot summon Don Strunzone here, some player may + // still have the model string set. In case anyone manages how + // to change a cvar default, we'll have a small leak here. + FallbackPlayerModel = strzone(cvar_defstring("_cl_playermodel")); + } if(strlen(plyermodel) < 4) return FallbackPlayerModel; if( substring(plyermodel,0,14) != "models/player/") @@ -555,6 +562,7 @@ void setmodel_lod(entity e, string modelname) self.modelindex_lod0_from_xonotic = ((s == "") || (substring(s, 0, 4) == "data")); player_setupanimsformodel(); + UpdatePlayerSounds(); } /* @@ -931,6 +939,7 @@ void PutClientInServer (void) self.nextthink = 0; self.hook_time = 0; self.dmg_team = 0; + self.ballistics_density = cvar("g_ballistics_density_player"); self.metertime = 0; @@ -1054,10 +1063,18 @@ float ClientInit_SendEntity(entity to, float sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_INIT); WriteByte(MSG_ENTITY, g_nexball_meter_period * 32); - WriteCoord(MSG_ENTITY, hook_shotorigin_x); - WriteCoord(MSG_ENTITY, hook_shotorigin_y); - WriteCoord(MSG_ENTITY, hook_shotorigin_z); - + WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[0])); + 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(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 @@ -1098,10 +1115,11 @@ void ClientInit_Spawn() { entity o; entity e; + e = spawn(); e.classname = "clientinit"; e.think = ClientInit_CheckUpdate; - e.nextthink = time; Net_LinkEntity(e, FALSE, 0, ClientInit_SendEntity); + o = self; self = e; ClientInit_CheckUpdate(); @@ -1385,6 +1403,10 @@ void ClientConnect (void) DecodeLevelParms(); +#ifdef WATERMARK + sprint(self, strcat("^4SVQC Build information: ", WATERMARK(), "\n")); +#endif + self.classname = "player_joining"; self.flags = FL_CLIENT; @@ -2586,7 +2608,23 @@ void PlayerPreThink (void) if(frametime) { - self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2; + if(self.health <= 0 && cvar("g_deathglow")) + { + if(self.glowmod_x > 0) + self.glowmod_x -= cvar("g_deathglow") * frametime; + else + self.glowmod_x = -1; + if(self.glowmod_y > 0) + self.glowmod_y -= cvar("g_deathglow") * frametime; + else + self.glowmod_y = -1; + if(self.glowmod_z > 0) + self.glowmod_z -= cvar("g_deathglow") * frametime; + else + self.glowmod_z = -1; + } + else + self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2; player_powerups(); } @@ -2646,7 +2684,6 @@ void PlayerPreThink (void) FOR_EACH_PLAYER(other) if(self != other) { if(time > other.touchexplode_time) - if(other.classname == "player") if(other.deadflag == DEAD_NO) if not(IS_INDEPENDENT_PLAYER(other)) if(boxesoverlap(self.absmin, self.absmax, other.absmin, other.absmax)) @@ -2764,7 +2801,7 @@ void PlayerPreThink (void) } if(!zoomstate_set) - SetZoomState(self.BUTTON_ZOOM || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX)); + SetZoomState(self.BUTTON_ZOOM || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_CAMPINGRIFLE && cvar("g_balance_campingrifle_secondary") == 0)); float oldspectatee_status; oldspectatee_status = self.spectatee_status; @@ -2835,6 +2872,18 @@ Called every frame for each client after the physics are run ============= */ .float idlekick_lasttimeleft; +.entity showheadshotbbox; +void showheadshotbbox_think() +{ + if(self.owner.showheadshotbbox != self) + { + remove(self); + return; + } + self.nextthink = time; + setorigin(self, self.owner.origin); + setsize(self, GetHeadshotMins(self.owner), GetHeadshotMaxs(self.owner)); +} void PlayerPostThink (void) { // Savage: Check for nameless players @@ -2936,6 +2985,26 @@ void PlayerPostThink (void) if(self.waypointsprite_attachedforcarrier) WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, cvar("g_balance_armor_blockpercent"))); + if(self.classname == "player" && self.deadflag == DEAD_NO && cvar("r_showbboxes")) + { + if(!self.showheadshotbbox) + { + self.showheadshotbbox = spawn(); + self.showheadshotbbox.classname = "headshotbbox"; + self.showheadshotbbox.owner = self; + self.showheadshotbbox.think = showheadshotbbox_think; + self.showheadshotbbox.nextthink = time; + self = self.showheadshotbbox; + self.think(); + self = self.owner; + } + } + else + { + if(self.showheadshotbbox) + remove(self.showheadshotbbox); + } + playerdemo_write(); /*