]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add cvars to control maximum drawing distance of sandbox objects
authorMario <zacjardine@y7mail.com>
Sat, 25 Apr 2015 13:46:49 +0000 (23:46 +1000)
committerMario <zacjardine@y7mail.com>
Sat, 25 Apr 2015 13:46:49 +0000 (23:46 +1000)
qcsrc/client/csqcmodel_hooks.qc
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/physics.qc
qcsrc/server/autocvars.qh
qcsrc/server/mutators/mutator_multijump.qc
qcsrc/server/mutators/sandbox.qc

index dd19955795fb39f727e4579831bdbdd8f354406f..c574f4f8fe154491404f97402586423403366d55 100644 (file)
@@ -626,6 +626,24 @@ void CSQCModel_Effects_Apply(void)
        }
 }
 
+void CSQCModel_Fade_Apply()
+{
+       vector org;
+       float alph;
+       org = getpropertyvec(VF_ORIGIN);
+       if(!checkpvs(org, self)) // this makes sense as long as we don't support recursive warpzones
+               alph = 0;
+       else if(self.fade_start)
+               alph = bound(0, (self.fade_end - vlen(org - self.origin - 0.5 * (self.mins + self.maxs))) / (self.fade_end - self.fade_start), 1);
+       else
+               alph = 1;
+       //printf("%v <-> %v\n", view_origin, self.origin + 0.5 * (self.mins + self.maxs));
+       if(alph <= 0)
+               self.drawmask = 0;
+       else
+               self.drawmask = MASK_NORMAL;
+}
+
 void CSQCPlayer_Precache()
 {
        precache_sound("misc/jetpack_fly.wav");
@@ -658,6 +676,8 @@ void CSQCModel_Hook_PreDraw(bool isplayer)
        else
                self.drawmask = MASK_NORMAL;
 
+       CSQCModel_Fade_Apply();
+
        if(self.isplayermodel) // this checks if it's a player MODEL!
        {
                CSQCPlayer_ModelAppearance_Apply(self.entnum == player_localnum + 1);
index adc2e1ddb05ba20a40c48df3e1bde73d0376b50b..86da718ac3fd6d4415b94bc840a09d36da7e9f10 100644 (file)
@@ -61,7 +61,9 @@
        CSQCMODEL_PROPERTY(1024, float, ReadAngle, WriteAngle, v_angle_x) \
        CSQCMODEL_PROPERTY_SCALED(4096, float, ReadByte, WriteByte, scale, 16, 0, 255) \
        CSQCMODEL_PROPERTY(8192, TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) \
-       CSQCMODEL_PROPERTY(16384, int, ReadInt24_t, WriteInt24_t, dphitcontentsmask)
+       CSQCMODEL_PROPERTY(16384, int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \
+       CSQCMODEL_PROPERTY(32768, float, ReadCoord, WriteCoord, fade_start) \
+       CSQCMODEL_PROPERTY(32768, float, ReadCoord, WriteCoord, fade_end)
 // TODO get rid of colormod/glowmod here, find good solution for vortex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody
 
 // add hook function calls here
index 83c0cf42bed6571ebd391c179208f6a909dc8bc4..a61897671937c0517c3d808f504409dd94032ca9 100644 (file)
@@ -533,7 +533,7 @@ When you press the jump key
 returns true if handled
 =============
 */
-float PlayerJump (void)
+bool PlayerJump (void)
 {
        if (PHYS_FROZEN(self))
                return true; // no jumping in freezetag when frozen
index e7c194a4d63c8e3e154682244a2695d85e982fff..80ef32afc4eaa11c1de656c601005503c4b48890 100644 (file)
@@ -751,6 +751,8 @@ int autocvar_g_sandbox_editor_maxobjects;
 int autocvar_g_sandbox_editor_free;
 float autocvar_g_sandbox_editor_distance_spawn;
 float autocvar_g_sandbox_editor_distance_edit;
+float autocvar_g_sandbox_object_fade_start;
+float autocvar_g_sandbox_object_fade_end;
 float autocvar_g_sandbox_object_scale_min;
 float autocvar_g_sandbox_object_scale_max;
 float autocvar_g_sandbox_object_material_velocity_min;
index 0d9c8ac99e8bc0e5104290152f1afb4a57c6a64b..2476a0cbfc484edb1f13319697d06f55beb38854 100644 (file)
@@ -50,11 +50,17 @@ void PM_multijump()
        }
 }
 
-float PM_multijump_checkjump()
+bool PM_multijump_checkjump()
 {
        if(!PHYS_MULTIJUMP) { return false; }
 
-       if (!IS_JUMP_HELD(self) && !IS_ONGROUND(self) && self.cvar_cl_multijump) // jump button pressed this frame and we are in midair
+#ifdef SVQC
+       bool client_multijump = self.cvar_cl_multijump;
+#elif defined(CSQC)
+       bool client_multijump = cvar("cl_multijump");
+#endif
+
+       if (!IS_JUMP_HELD(self) && !IS_ONGROUND(self) && client_multijump) // jump button pressed this frame and we are in midair
                self.multijump_ready = true;  // this is necessary to check that we released the jump button and pressed it again
        else
                self.multijump_ready = false;
@@ -99,7 +105,12 @@ float PM_multijump_checkjump()
                                        // keep velocity_z unchanged!
                                }
                                if (PHYS_MULTIJUMP > 0)
+                               {
+                                       #ifdef CSQC
+                                       print("Increasing!\n");
+                                       #endif
                                        self.multijump_count += 1;
+                               }
                        }
                }
                self.multijump_ready = false; // require releasing and pressing the jump button again for the next jump
index 346d85299fa8efc94ce71607af9f6ce6543edb9b..7531f822c25e17df5a0da5482f0d630ece69da02 100644 (file)
@@ -77,6 +77,9 @@ void sandbox_ObjectFunction_Think()
                self.realowner = world;
        }
 
+       self.fade_start = autocvar_g_sandbox_object_fade_start;
+       self.fade_end = autocvar_g_sandbox_object_fade_end;
+
        self.nextthink = time;
 
        CSQCMODEL_AUTOUPDATE();