Browse Source

Merge branch 'poke646' into poke646_vendetta

poke646_vendetta
Andrey Akhmichin 4 years ago
parent
commit
f874d30ef3
  1. 12
      cl_dll/ammo.cpp
  2. 3
      cl_dll/hud.cpp
  3. 4
      cl_dll/hud.h
  4. 12
      cl_dll/hud_redraw.cpp
  5. 20
      cl_dll/poke646/scope.cpp
  6. 4
      dlls/player.cpp

12
cl_dll/ammo.cpp

@ -645,14 +645,14 @@ int CHudAmmo::MsgFunc_WeaponList( const char *pszName, int iSize, void *pbuf )
strcpy( Weapon.szName, READ_STRING() ); strcpy( Weapon.szName, READ_STRING() );
Weapon.iAmmoType = (int)READ_CHAR(); Weapon.iAmmoType = (int)READ_CHAR();
Weapon.iMax1 = READ_BYTE(); Weapon.iMax1 = READ_SHORT();
if( Weapon.iMax1 == 255 ) // if( Weapon.iMax1 == 255 )
Weapon.iMax1 = -1; // Weapon.iMax1 = -1;
Weapon.iAmmo2Type = READ_CHAR(); Weapon.iAmmo2Type = READ_CHAR();
Weapon.iMax2 = READ_BYTE(); Weapon.iMax2 = READ_SHORT();
if( Weapon.iMax2 == 255 ) // if( Weapon.iMax2 == 255 )
Weapon.iMax2 = -1; // Weapon.iMax2 = -1;
Weapon.iSlot = READ_CHAR(); Weapon.iSlot = READ_CHAR();
Weapon.iSlotPos = READ_CHAR(); Weapon.iSlotPos = READ_CHAR();

3
cl_dll/hud.cpp

@ -240,6 +240,7 @@ void CHud::Init( void )
// In case we get messages before the first update -- time will be valid // In case we get messages before the first update -- time will be valid
m_flTime = 1.0; m_flTime = 1.0;
m_flScaleColorTime = 3.0f;
m_Ammo.Init(); m_Ammo.Init();
m_Health.Init(); m_Health.Init();
@ -259,6 +260,7 @@ void CHud::Init( void )
m_Scoreboard.Init(); m_Scoreboard.Init();
m_Menu.Init(); m_Menu.Init();
m_Scope.Init();
MsgFunc_ResetHUD( 0, 0, NULL ); MsgFunc_ResetHUD( 0, 0, NULL );
} }
@ -438,6 +440,7 @@ void CHud::VidInit( void )
m_StatusIcons.VidInit(); m_StatusIcons.VidInit();
m_Scoreboard.VidInit(); m_Scoreboard.VidInit();
m_MOTD.VidInit(); m_MOTD.VidInit();
m_Scope.VidInit();
} }
int CHud::MsgFunc_Logo( const char *pszName, int iSize, void *pbuf ) int CHud::MsgFunc_Logo( const char *pszName, int iSize, void *pbuf )

4
cl_dll/hud.h

@ -563,9 +563,11 @@ private:
// //
//----------------------------------------------------- //-----------------------------------------------------
// //
class CHudScope class CHudScope : public CHudBase
{ {
public: public:
int Init( void );
int VidInit( void );
int DrawScope( void ); int DrawScope( void );
int DrawText( void ); int DrawText( void );

12
cl_dll/hud_redraw.cpp

@ -93,7 +93,17 @@ int CHud::Redraw( float flTime, int intermission )
// Clock was reset, reset delta // Clock was reset, reset delta
if( m_flTimeDelta < 0 ) if( m_flTimeDelta < 0 )
{
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 ) if( !m_iIntermission && intermission )
{ {
@ -199,7 +209,7 @@ void ScaleColors( int &r, int &g, int &b, int a )
} }
f = 1.0f - flTimeDiff; f = 1.0f - flTimeDiff;
} }
float x = f * (float)a / 255; float x = f * ((float)a / 255.0f);
r = (int)( r * x ); r = (int)( r * x );
g = (int)( g * x ); g = (int)( g * x );
b = (int)( b * x ); b = (int)( b * x );

20
cl_dll/poke646/scope.cpp

@ -34,6 +34,20 @@ extern vec3_t v_cl_angles; // last client/mouse angle
extern vec3_t v_sim_org; // last sim origin extern vec3_t v_sim_org; // last sim origin
extern cvar_t *adjust_fov; 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() int CHudScope::DrawScope()
{ {
vec3_t angles, forward, right, up; vec3_t angles, forward, right, up;
@ -62,12 +76,12 @@ int CHudScope::DrawScope()
flDist = Length( delta ); flDist = Length( delta );
if( flDist >= 118.0f ) if( flDist >= 118.0f )
sprintf( m_szDist, "%.2f m", flDist * 0.0254f ); sprintf( m_szDist, "%.2f m", (double)(flDist / 39.37f) );
else else
strcpy( m_szDist, "-.-- m" ); strcpy( m_szDist, "-.-- m" );
x = tan( gHUD.m_iFOV * 0.008726646259971648 ) * 11.0; x = tan( gHUD.m_iFOV / 114.6f ) * 11.0f;
y = x * 0.00390625; y = x * / 255.0f;
gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture ); //additive gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture ); //additive
gEngfuncs.pTriAPI->CullFace( TRI_NONE ); gEngfuncs.pTriAPI->CullFace( TRI_NONE );

4
dlls/player.cpp

@ -3951,9 +3951,9 @@ void CBasePlayer::UpdateClientData( void )
MESSAGE_BEGIN( MSG_ONE, gmsgWeaponList, NULL, pev ); MESSAGE_BEGIN( MSG_ONE, gmsgWeaponList, NULL, pev );
WRITE_STRING( pszName ); // string weapon name WRITE_STRING( pszName ); // string weapon name
WRITE_BYTE( GetAmmoIndex( II.pszAmmo1 ) ); // byte Ammo Type 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( 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.iSlot ); // byte bucket
WRITE_BYTE( II.iPosition ); // byte bucket pos WRITE_BYTE( II.iPosition ); // byte bucket pos
WRITE_BYTE( II.iId ); // byte id (bit index into pev->weapons) WRITE_BYTE( II.iId ); // byte id (bit index into pev->weapons)

Loading…
Cancel
Save