]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
bring death glow back, fix issues with respawning
authorRudolf Polzer <divverent@alientrap.org>
Mon, 9 Jan 2012 18:44:18 +0000 (19:44 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 9 Jan 2012 18:44:18 +0000 (19:44 +0100)
defaultXonotic.cfg
qcsrc/client/autocvars.qh
qcsrc/client/csqcmodel_hooks.qc
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/util.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc

index 7f85e4d04dee3fa75964114b5ceb2b4f3b322aeb..eadb6a16f51097906d657456407d986441892087 100644 (file)
@@ -324,6 +324,7 @@ set g_teleport_maxspeed 0 "maximum speed that a player can keep when going throu
 set g_respawn_ghosts 1 "if 1 dead bodies become ghosts and float away when the player respawns"
 set g_respawn_ghosts_speed 5 "the speed with which respawn ghosts float and rotate"
 set g_respawn_ghosts_maxtime 6 "maximum amount of time a respawn ghost can last, minimum time is half this value. 0 disables and ghosts fade when the body would"
+set cl_deathglow 0.8 "number of seconds during which dead bodies glow out"
 
 set sv_gibhealth 100 "Minus health a dead body must have in order to get gibbed"
 
index 31fe318458f3af5a07e5114d6108b4094292c34f..705e2c51954524060fdd20ba399fd236c074f3e8 100644 (file)
@@ -384,3 +384,4 @@ float autocvar_cl_forcemyplayercolors;
 float autocvar__cl_playerskin;
 string autocvar__cl_playermodel;
 float autocvar_cl_precacheplayermodels;
+float autocvar_cl_deathglow;
index c4767c63e7ccbb840d0ad58ad4ffcd436eeb1c7c..7204981bd4f3ee8d83806688af7c04fe97b3c74c 100644 (file)
@@ -266,16 +266,6 @@ void CSQCPlayer_FallbackFrame_Apply(void)
        self.frame4 = CSQCPlayer_FallbackFrame(self.frame4);
 }
 
-// FEATURE: auto glowmod
-.vector glowmod;
-void CSQCPlayer_GlowMod_Apply(void)
-{
-       if(self.colormap > 0)
-               self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, TRUE) * 2;
-       else
-               self.glowmod = '1 1 1';
-}
-
 // FEATURE: auto tag_index
 .entity tag_entity;
 .float tag_entity_lastmodelindex;
@@ -386,6 +376,7 @@ void CSQCModel_Effects_PostUpdate(void)
 void CSQCModel_Effects_Apply(void)
 {
        float eff = self.csqcmodel_effects;
+       eff &~= CSQCMODEL_EF_RESPAWNGHOST;
 
        self.renderflags &~= (RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
        self.effects = 0;
@@ -449,6 +440,34 @@ void CSQCModel_Effects_Apply(void)
                Projectile_DrawTrail(self.origin);
        else
                Projectile_ResetTrail(self.origin);
+
+       if(self.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
+               self.renderflags |= RF_ADDITIVE;
+               // also special in CSQCPlayer_GlowMod_Apply
+}
+
+// FEATURE: auto glowmod
+.vector glowmod;
+void CSQCPlayer_GlowMod_Apply(void)
+{
+       float cm = self.colormap;
+
+       if(self.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
+               cm = 1024;
+
+       if(self.colormap > 0)
+               self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, TRUE) * 2;
+       else
+               self.glowmod = '1 1 1';
+
+       if(autocvar_cl_deathglow > 0)
+               if(self.csqcmodel_isdead)
+               {
+                       self.glowmod = self.glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1);
+                       // prevent the zero vector
+                       if(self.glowmod_x == 0)
+                               self.glowmod_x = -1;
+               }
 }
 
 // general functions
index 5a05a67888ba68f55721b06e876fb938b45280e9..bdeab298ebe9172fb6239359afef528a3342ef24 100644 (file)
@@ -81,4 +81,4 @@ float autocvar_sv_use_csqc_players;
 # endif
 #endif
 
-#define CSQCMODEL_EF_INVISIBLE EF_SELECTABLE
+#define CSQCMODEL_EF_RESPAWNGHOST EF_SELECTABLE
index 356f5b3e7b6771d5bcd1b139edf95d1727962be2..57e653113235c27ac3babe72102a286a1c249366 100644 (file)
@@ -2186,7 +2186,7 @@ void m_shutdown()
 #ifdef SVQC
 void WriteApproxPastTime(float dst, float t)
 {
-       float dt = t - time;
+       float dt = time - t;
 
        // warning: this is approximate; do not resend when you don't have to!
        // be careful with sendflags here!
@@ -2209,6 +2209,6 @@ float ReadApproxPastTime()
        // map from range...PPROXPASTTIME_MAX / 256
        dt = (APPROXPASTTIME_MAX / 256) * (dt / (256 - dt));
 
-       return servertime + dt;
+       return servertime - dt;
 }
 #endif
index e5f6a7b36b8bad1da8b3f673ec9b7d0935b8af21..298fd47e3c4f7273d3d461d14bf8ba041109bfc2 100644 (file)
@@ -1761,7 +1761,7 @@ void respawn(void)
                self.movetype = MOVETYPE_FLY;
                self.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
                self.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
-               self.effects |= EF_ADDITIVE;
+               self.effects |= CSQCMODEL_EF_RESPAWNGHOST;
                pointparticles(particleeffectnum("respawn_ghost"), self.origin, '0 0 0', 1);
                if(autocvar_g_respawn_ghosts_maxtime)
                        SUB_SetFade (self, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
index 5de1be4bc33b0e9cbbf1c351f2d98ad8918f856c..75f1c076b9312953d1a0fa84b6d01634257cd625 100644 (file)
@@ -166,6 +166,7 @@ void CopyBody(float keepvelocity)
        self.animstate_endtime = oldself.animstate_endtime;
        self.animstate_override = oldself.animstate_override;
        self.animstate_looping = oldself.animstate_looping;
+       self.death_time = oldself.death_time;
        self.frame = oldself.frame;
        self.pain_finished = oldself.pain_finished;
        self.health = oldself.health;