From: Mario Date: Sat, 25 Apr 2015 13:46:49 +0000 (+1000) Subject: Add cvars to control maximum drawing distance of sandbox objects X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ed12e4922838d7ee86e6f614b35b707f5e00cc1d;p=xonotic%2Fxonotic-data.pk3dir.git Add cvars to control maximum drawing distance of sandbox objects --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index dd1995579..c574f4f8f 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -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); diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index adc2e1ddb..86da718ac 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -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 diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 83c0cf42b..a61897671 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -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 diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index e7c194a4d..80ef32afc 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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; diff --git a/qcsrc/server/mutators/mutator_multijump.qc b/qcsrc/server/mutators/mutator_multijump.qc index 0d9c8ac99..2476a0cbf 100644 --- a/qcsrc/server/mutators/mutator_multijump.qc +++ b/qcsrc/server/mutators/mutator_multijump.qc @@ -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 diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 346d85299..7531f822c 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -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();