From 00141d5ab09894f6543862de7cfea675b0910854 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Wed, 17 Mar 2021 06:12:50 +0100 Subject: [PATCH] Add View_PreDraw() and move View_Stairsmooth() into that. --- src/client/entry.qc | 5 +--- src/client/view.qc | 29 +++++++++++++++--------- src/gs-entbase/client/env_glow.qc | 20 ++++++++++++++++ src/gs-entbase/shared/trigger_gravity.qc | 23 ++++++------------- 4 files changed, 46 insertions(+), 31 deletions(-) diff --git a/src/client/entry.qc b/src/client/entry.qc index 75cf1360..ab3a0f4e 100644 --- a/src/client/entry.qc +++ b/src/client/entry.qc @@ -256,7 +256,7 @@ CSQC_UpdateView(float w, float h, float focus) pl.viewzoom = oldzoom; - View_Stairsmooth(); + View_PreDraw(); if (pSeat->m_pWeaponFX) { CBaseFX p = (CBaseFX)pSeat->m_pWeaponFX; @@ -331,9 +331,6 @@ CSQC_UpdateView(float w, float h, float focus) Fade_Update((int)video_mins[0],(int)video_mins[1], (int)w, (int)h); IN_Saturn_DrawMenu(); -#if 0 - Cstrike_PostDraw((int)video_mins[0],(int)video_mins[1], (int)w, (int)h); -#endif View_PostDraw(); if (g_iIntermission) { diff --git a/src/client/view.qc b/src/client/view.qc index bfc76f97..43d8e09c 100644 --- a/src/client/view.qc +++ b/src/client/view.qc @@ -207,17 +207,6 @@ View_DrawViewModel(void) } } -void -View_PostDraw(void) -{ - entity m_eMuzzleflash = pSeat->m_eMuzzleflash; - - // Take away alpha once it has drawn fully at least once - if (m_eMuzzleflash.alpha > 0.0f) { - m_eMuzzleflash.alpha -= (clframetime * 16); - } -} - void View_Stairsmooth(void) { @@ -247,6 +236,24 @@ View_Stairsmooth(void) oldpos = endpos; } + +void +View_PreDraw(void) +{ + View_Stairsmooth(); +} + +void +View_PostDraw(void) +{ + entity m_eMuzzleflash = pSeat->m_eMuzzleflash; + + // Take away alpha once it has drawn fully at least once + if (m_eMuzzleflash.alpha > 0.0f) { + m_eMuzzleflash.alpha -= (clframetime * 16); + } +} + /* ==================== View_PlayAnimation diff --git a/src/gs-entbase/client/env_glow.qc b/src/gs-entbase/client/env_glow.qc index ec8f3a18..152a95dc 100644 --- a/src/gs-entbase/client/env_glow.qc +++ b/src/gs-entbase/client/env_glow.qc @@ -81,6 +81,7 @@ env_glow::predraw(void) /* Project it, always facing the player */ makevectors(view_angles); +#ifndef FTE_QUADFIX R_BeginPolygon(m_strSprite, 1, 0); R_PolygonVertex(forg + v_right * fsize[0] - v_up * fsize[1], [1,1], m_vecColor * m_flMaxAlpha, m_flAlpha); @@ -91,6 +92,24 @@ env_glow::predraw(void) R_PolygonVertex(forg + v_right * fsize[0] + v_up * fsize[1], [1,0], m_vecColor * m_flMaxAlpha, m_flAlpha); R_EndPolygon(); +#else + R_BeginPolygon(m_strSprite, 1, 0); + R_PolygonVertex(forg + v_right * fsize[0] - v_up * fsize[1], + [1,1], m_vecColor * m_flMaxAlpha, m_flAlpha); + R_PolygonVertex(forg - v_right * fsize[0] - v_up * fsize[1], + [0,1], m_vecColor * m_flMaxAlpha, m_flAlpha); + R_PolygonVertex(forg - v_right * fsize[0] + v_up * fsize[1], + [0,0], m_vecColor * m_flMaxAlpha, m_flAlpha); + R_EndPolygon(); + R_BeginPolygon(m_strSprite, 1, 0); + R_PolygonVertex(forg - v_right * fsize[0] - v_up * fsize[1], + [0,1], m_vecColor * m_flMaxAlpha, m_flAlpha); + R_PolygonVertex(forg - v_right * fsize[0] + v_up * fsize[1], + [0,0], m_vecColor * m_flMaxAlpha, m_flAlpha); + R_PolygonVertex(forg + v_right * fsize[0] + v_up * fsize[1], + [1,0], m_vecColor * m_flMaxAlpha, m_flAlpha); + R_EndPolygon(); +#endif addentity(this); return PREDRAW_NEXT; @@ -139,5 +158,6 @@ env_glow::env_glow(void) drawmask = MASK_ENGINE; setsize(this, [0,0,0], [0,0,0]); setorigin(this, origin); + effects &= ~EF_NOSHADOW; Init(); } diff --git a/src/gs-entbase/shared/trigger_gravity.qc b/src/gs-entbase/shared/trigger_gravity.qc index 60b36894..378e1365 100644 --- a/src/gs-entbase/shared/trigger_gravity.qc +++ b/src/gs-entbase/shared/trigger_gravity.qc @@ -31,9 +31,9 @@ class trigger_gravity:CBaseTrigger #endif { float m_flGravity; + void(void) trigger_gravity; virtual void(void) touch; - virtual void(void) Respawn; virtual void(string, string) SpawnKey; #ifdef CLIENT @@ -47,25 +47,15 @@ trigger_gravity::touch(void) other.gravity = m_flGravity; } -/* TODO: Make this redundant */ -void -trigger_gravity::Respawn(void) -{ - solid = SOLID_BSPTRIGGER; -#ifdef GS_DEVELOPER - alpha = 0.5f; -#endif -} - void trigger_gravity::SpawnKey(string strField, string strKey) { switch (strField) { - case "gravity": - m_flGravity = stof(strKey); - break; - default: - CBaseEntity::SpawnKey(strField, strKey); + case "gravity": + m_flGravity = stof(strKey); + break; + default: + CBaseEntity::SpawnKey(strField, strKey); } } @@ -75,6 +65,7 @@ trigger_gravity::trigger_gravity(void) #ifdef SERVER CBaseEntity::CBaseEntity(); CBaseTrigger::InitBrushTrigger(); + SetSolid(SOLID_BSPTRIGGER); #endif }