mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-12 07:58:05 +00:00
Merge branch 'poke646' into poke646_vendetta
This commit is contained in:
commit
f874d30ef3
@ -645,14 +645,14 @@ int CHudAmmo::MsgFunc_WeaponList( const char *pszName, int iSize, void *pbuf )
|
||||
strcpy( Weapon.szName, READ_STRING() );
|
||||
Weapon.iAmmoType = (int)READ_CHAR();
|
||||
|
||||
Weapon.iMax1 = READ_BYTE();
|
||||
if( Weapon.iMax1 == 255 )
|
||||
Weapon.iMax1 = -1;
|
||||
Weapon.iMax1 = READ_SHORT();
|
||||
// if( Weapon.iMax1 == 255 )
|
||||
// Weapon.iMax1 = -1;
|
||||
|
||||
Weapon.iAmmo2Type = READ_CHAR();
|
||||
Weapon.iMax2 = READ_BYTE();
|
||||
if( Weapon.iMax2 == 255 )
|
||||
Weapon.iMax2 = -1;
|
||||
Weapon.iMax2 = READ_SHORT();
|
||||
// if( Weapon.iMax2 == 255 )
|
||||
// Weapon.iMax2 = -1;
|
||||
|
||||
Weapon.iSlot = READ_CHAR();
|
||||
Weapon.iSlotPos = READ_CHAR();
|
||||
|
@ -240,6 +240,7 @@ void CHud::Init( void )
|
||||
|
||||
// In case we get messages before the first update -- time will be valid
|
||||
m_flTime = 1.0;
|
||||
m_flScaleColorTime = 3.0f;
|
||||
|
||||
m_Ammo.Init();
|
||||
m_Health.Init();
|
||||
@ -259,6 +260,7 @@ void CHud::Init( void )
|
||||
m_Scoreboard.Init();
|
||||
|
||||
m_Menu.Init();
|
||||
m_Scope.Init();
|
||||
|
||||
MsgFunc_ResetHUD( 0, 0, NULL );
|
||||
}
|
||||
@ -438,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 );
|
||||
|
||||
|
@ -93,7 +93,17 @@ int CHud::Redraw( float flTime, int intermission )
|
||||
|
||||
// Clock was reset, reset delta
|
||||
if( m_flTimeDelta < 0 )
|
||||
{
|
||||
m_flTimeDelta = 0;
|
||||
m_flScaleColorTime = 0.0f;
|
||||
}
|
||||
|
||||
if( m_flScaleColorTime != 0.0f )
|
||||
{
|
||||
float flTimeDiff = m_flScaleColorTime - m_flTime;
|
||||
if( flTimeDiff <= 0.0f )
|
||||
m_flScaleColorTime = 0.0f;
|
||||
}
|
||||
|
||||
if( !m_iIntermission && intermission )
|
||||
{
|
||||
@ -199,7 +209,7 @@ void ScaleColors( int &r, int &g, int &b, int a )
|
||||
}
|
||||
f = 1.0f - flTimeDiff;
|
||||
}
|
||||
float x = f * (float)a / 255;
|
||||
float x = f * ((float)a / 255.0f);
|
||||
r = (int)( r * x );
|
||||
g = (int)( g * x );
|
||||
b = (int)( b * x );
|
||||
|
@ -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 );
|
||||
|
@ -3951,9 +3951,9 @@ void CBasePlayer::UpdateClientData( void )
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsgWeaponList, NULL, pev );
|
||||
WRITE_STRING( pszName ); // string weapon name
|
||||
WRITE_BYTE( GetAmmoIndex( II.pszAmmo1 ) ); // byte Ammo Type
|
||||
WRITE_BYTE( II.iMaxAmmo1 ); // byte Max Ammo 1
|
||||
WRITE_SHORT( II.iMaxAmmo1 ); // byte Max Ammo 1
|
||||
WRITE_BYTE( GetAmmoIndex( II.pszAmmo2 ) ); // byte Ammo2 Type
|
||||
WRITE_BYTE( II.iMaxAmmo2 ); // byte Max Ammo 2
|
||||
WRITE_SHORT( II.iMaxAmmo2 ); // byte Max Ammo 2
|
||||
WRITE_BYTE( II.iSlot ); // byte bucket
|
||||
WRITE_BYTE( II.iPosition ); // byte bucket pos
|
||||
WRITE_BYTE( II.iId ); // byte id (bit index into pev->weapons)
|
||||
|
Loading…
Reference in New Issue
Block a user