mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-12 07:58:05 +00:00
Fix scope drawing after changelevel.
This commit is contained in:
parent
f8444ba06c
commit
5766ab7779
@ -260,6 +260,7 @@ void CHud::Init( void )
|
||||
m_Scoreboard.Init();
|
||||
|
||||
m_Menu.Init();
|
||||
m_Scope.Init();
|
||||
|
||||
MsgFunc_ResetHUD( 0, 0, NULL );
|
||||
}
|
||||
@ -439,6 +440,7 @@ void CHud::VidInit( void )
|
||||
m_StatusIcons.VidInit();
|
||||
m_Scoreboard.VidInit();
|
||||
m_MOTD.VidInit();
|
||||
m_Scope.VidInit();
|
||||
}
|
||||
|
||||
int CHud::MsgFunc_Logo( const char *pszName, int iSize, void *pbuf )
|
||||
|
@ -563,9 +563,11 @@ private:
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
//
|
||||
class CHudScope
|
||||
class CHudScope : public CHudBase
|
||||
{
|
||||
public:
|
||||
int Init( void );
|
||||
int VidInit( void );
|
||||
int DrawScope( void );
|
||||
int DrawText( void );
|
||||
|
||||
|
@ -34,6 +34,20 @@ extern vec3_t v_cl_angles; // last client/mouse angle
|
||||
extern vec3_t v_sim_org; // last sim origin
|
||||
extern cvar_t *adjust_fov;
|
||||
|
||||
int CHudScope::Init( void )
|
||||
{
|
||||
gHUD.AddHudElem( this );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudScope::VidInit( void )
|
||||
{
|
||||
m_hSprite = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudScope::DrawScope()
|
||||
{
|
||||
vec3_t angles, forward, right, up;
|
||||
@ -62,12 +76,12 @@ int CHudScope::DrawScope()
|
||||
flDist = Length( delta );
|
||||
|
||||
if( flDist >= 118.0f )
|
||||
sprintf( m_szDist, "%.2f m", flDist * 0.0254f );
|
||||
sprintf( m_szDist, "%.2f m", (double)(flDist / 39.37f) );
|
||||
else
|
||||
strcpy( m_szDist, "-.-- m" );
|
||||
|
||||
x = tan( gHUD.m_iFOV * 0.008726646259971648 ) * 11.0;
|
||||
y = x * 0.00390625;
|
||||
x = tan( gHUD.m_iFOV / 114.6f ) * 11.0f;
|
||||
y = x * / 255.0f;
|
||||
|
||||
gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture ); //additive
|
||||
gEngfuncs.pTriAPI->CullFace( TRI_NONE );
|
||||
|
Loading…
Reference in New Issue
Block a user