]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
cl_minfps: make gibs die faster on low fps
authorRudolf Polzer <divVerent@xonotic.org>
Thu, 17 Nov 2011 13:17:46 +0000 (14:17 +0100)
committerRudolf Polzer <divVerent@xonotic.org>
Thu, 17 Nov 2011 13:18:21 +0000 (14:18 +0100)
qcsrc/client/View.qc
qcsrc/client/csqc_builtins.qc
qcsrc/client/gibs.qc
qcsrc/client/main.qh

index 2d79f8f1045b4c181694d9e76f946e546680eb8f..d4192381107c1a5acc630a5ec8417b571ba60bf1 100644 (file)
@@ -369,6 +369,11 @@ void CSQC_UpdateView(float w, float h)
        float a;
        hud = getstati(STAT_HUD);
 
+       if(checkextension("DP_CSQC_MINFPS_QUALITY"))
+               view_quality = R_SetView(VF_MINFPS_QUALITY);
+       else
+               view_quality = 1;
+
        button_attack2 = (input_buttons & BUTTON_3);
        button_zoom = (input_buttons & BUTTON_4);
 
index 35cf6b19bcd6aa87308efbd243064b98269c3bc7..96e28b96abcc114f01f1bab91e4009bedf2bc937 100644 (file)
@@ -348,3 +348,11 @@ string(string digest, string data, ...) digest_hex = #639;
 //only the "MD4" digest is always supported!
 //if the given digest is not supported, string_null is returned
 //the digest string is matched case sensitively, use "MD4", not "md4"!
+
+//DP_CSQC_MINFPS_QUALITY
+//idea: divVerent
+//darkplaces implementation: divVerent
+//constant definitions:
+const float VF_MINFPS_QUALITY   = 213;
+//use getproperty(VF_MINFPS_QUALITY); to do CSQC based LOD based on cl_minfps
+//1 should lead to an unmodified view
index dca48bd82ff64891f4a7cab6c3ff88f5b3cb070c..779f9f7ff358ff2384cdf5cc9a0913bbfe60c332 100644 (file)
@@ -94,6 +94,11 @@ void Gib_Draw()
                trailparticles(self, particleeffectnum(strcat(species_prefix(self.cnt), "TR_BLOOD")), oldorg, self.origin);
 
        self.renderflags = 0;
+
+       // make gibs die faster at low view quality
+       // if view_quality is 0.5, we want to have them die twice as fast
+       self.nextthink -= frametime * (1 / bound(0.01, view_quality, 1.00) - 1);
+
        self.alpha = bound(0, self.nextthink - time, 1);
 
        if(self.alpha < ALPHA_MIN_VISIBLE)
index 2a4147170fa1e7cb1f4e20efabff1c823b1dbb6a..6efedb7deb6f52b2410793f5892d4df7c83de5ee 100644 (file)
@@ -165,5 +165,6 @@ float g_trueaim_minrange;
 entity entcs_receiver[255]; // 255 is the engine limit on maxclients
 
 float hud;
+float view_quality;
 
 void cvar_clientsettemp(string cv, string val);