X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fcl_client.qc;h=33790477b452624c74341a998a1c1a3e03a5a2f3;hb=62dc9cdafd341892fb5ce36dbdbfe2c63d222efb;hp=b096334c95a8e5a2cf30b1f4ae4a42cca3b52532;hpb=b9f20ed0e6980e5c5f27aeb67544d6a4fd5af257;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index b096334c..33790477 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -418,11 +418,12 @@ string CheckPlayerModel(string plyermodel) { return plyermodel; } -void setmodel_apply(string modelname) +void setmodel_apply(string modelname, float reset_anims) { precache_model(modelname); setmodel(self, modelname); // players have high precision - player_setupanimsformodel(); + if(reset_anims) + player_setupanimsformodel(); } string setmodel_state() @@ -458,7 +459,7 @@ void Client_setmodel(string applymodel) applymodel = CheckPlayerModel(applymodel); // this is never "", so no endless loop m1 = self.mins; m2 = self.maxs; - setmodel_apply(applymodel); + setmodel_apply(applymodel, FALSE); setsize (self, m1, m2); } @@ -470,7 +471,7 @@ void Client_uncustomizeentityforclient() float Client_customizeentityforclient() { entity modelsource; - string applymodel; + string stomachmodel; if(self.modelindex == 0) return TRUE; @@ -512,28 +513,25 @@ float Client_customizeentityforclient() // now change the predator's player model into a stomach model for the prey // in other words, when a player is swallowed by another player, the predator becomes an inward stomach model so the prey can see theirself in the stomach // this is only visible to the prey however, otherwise players would appear as a floating stomach to everyone (ewww) + stomachmodel = strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_stomach.md3"); // 4 is the extension length - // don't do this if we have chase_active enabled, as we'd be seeing a floating stomach from third person view - if(other.cvar_chase_active > 0 || other.classname == "observer") // the classname check prevents a bug - { - Client_setmodel(setmodel_state()); - if not(self.predator.classname == "player" || self.fakeprey) - self.alpha = default_player_alpha; - return TRUE; - } if(other.spectatee_status) other = other.enemy; // also do this for the player we are spectating + + // don't do this if we have chase_active enabled, as we'd be seeing a floating stomach from third person view + if not(other.cvar_chase_active || other.classname == "observer") // the observer check prevents a bug if(other.predator == self || other.fakepredator == self) { - applymodel = strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_stomach.md3"); // 4 is the extension length - Client_setmodel(applymodel); - self.frame = 0; // don't use any animations as a stomach + Client_setmodel(stomachmodel); self.alpha = other.cvar_cl_vore_stomachmodel; return TRUE; } + Client_setmodel(setmodel_state()); if not(self.predator.classname == "player" || self.fakeprey) self.alpha = default_player_alpha; + else + self.alpha = -1; // hide all prey return TRUE; } @@ -727,7 +725,7 @@ void FixPlayermodel() { m1 = self.mins; m2 = self.maxs; - setmodel_apply (defaultmodel); + setmodel_apply (defaultmodel, TRUE); setsize (self, m1, m2); chmdl = TRUE; } @@ -740,7 +738,7 @@ void FixPlayermodel() self.playermodel = CheckPlayerModel(self.playermodel); // this is never "", so no endless loop m1 = self.mins; m2 = self.maxs; - setmodel_apply (self.playermodel); + setmodel_apply (self.playermodel, TRUE); setsize (self, m1, m2); chmdl = TRUE; } @@ -831,6 +829,7 @@ void PutClientInServer (void) RemoveGrabber(self); // Wazat's Grabber Vore_DeadPrey_Detach(self); + self.fakeprey = 0; // completely clear the fakeprey status self.classname = "player"; self.wasplayer = TRUE; @@ -1712,10 +1711,31 @@ void UpdateTeamBubble() else self.colormod = '1 1 1'; };*/ +.float oldcolormap; void respawn(void) { + if(self.alpha >= 0 && self.modelindex != 0 && cvar("g_respawn_ghosts")) + { + self.solid = SOLID_NOT; + self.takedamage = DAMAGE_NO; + self.movetype = MOVETYPE_FLY; + self.velocity = '0 0 1' * cvar("g_respawn_ghosts_speed"); + self.avelocity = randomvec() * cvar("g_respawn_ghosts_speed") * 3 - randomvec() * cvar("g_respawn_ghosts_speed") * 3; + self.effects |= EF_ADDITIVE; + self.oldcolormap = self.colormap; + self.colormap = 512; + pointparticles(particleeffectnum("respawn_ghost"), self.origin, '0 0 0', 1); + if(cvar("g_respawn_ghosts_maxtime")) + SUB_SetFade (self, time + cvar("g_respawn_ghosts_maxtime") / 2 + random () * (cvar("g_respawn_ghosts_maxtime") - cvar("g_respawn_ghosts_maxtime") / 2), 1.5); + } + CopyBody(1); self.effects |= EF_NODRAW; // prevent another CopyBody + if(self.oldcolormap) + { + self.colormap = self.oldcolormap; + self.oldcolormap = 0; + } PutClientInServer(); } @@ -2052,6 +2072,7 @@ void SpectateCopy(entity spectatee) { self.dmg_save = spectatee.dmg_save; self.dmg_inflictor = spectatee.dmg_inflictor; self.angles = spectatee.v_angle; + self.scale = spectatee.scale; self.fixangle = TRUE; self.stomach_load = spectatee.stomach_load; self.stat_eaten = spectatee.stat_eaten; @@ -2250,6 +2271,33 @@ float vercmp(string v1, string v2) return vercmp_recursive(v1, v2); } +void ApplyHealthSize() +{ + // change player scale based on the amount of health we have + + if not(cvar("g_healthsize")) + return; + + self.scale = bound(cvar("g_healthsize_min"), self.health, cvar("g_healthsize_max")) / cvar("g_healthsize"); + + // The following code sets the bounding box to match the player's size. + // It is currently disabled because of issues with engine movement prediction (cl_movement). + // The engine expects the bounding box to be default size, and changing it will cause glitches. + // This code may be enabled once the engine has the ability to use different bbox sizes for movement prediction. + if(self.crouch) + { + //setsize (self, PL_CROUCH_MIN * self.scale, PL_CROUCH_MAX * self.scale); + if not(self.predator.classname == "player" || self.fakeprey > 1) + self.view_ofs = PL_CROUCH_VIEW_OFS * self.scale; + } + else + { + //setsize (self, PL_MIN * self.scale, PL_MAX * self.scale); + if not(self.predator.classname == "player" || self.fakeprey > 1) + self.view_ofs = PL_VIEW_OFS * self.scale; + } +} + void ObserverThink() { if (self.flags & FL_JUMPRELEASED) { @@ -2572,6 +2620,8 @@ void PlayerPreThink (void) } } + ApplyHealthSize(); + FixPlayermodel(); GrabberFrame();