Add View_PreDraw() and move View_Stairsmooth() into that.

This commit is contained in:
Marco Cawthorne 2021-03-17 06:12:50 +01:00
parent 51d9d4caa8
commit 00141d5ab0
4 changed files with 46 additions and 31 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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();
}

View File

@ -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
}