mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-12 05:10:52 +01:00
Merge branch 'master' into noffice
This commit is contained in:
commit
a0a6dc5cc2
@ -75,10 +75,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
|
||||
{
|
||||
int i, iRes;
|
||||
|
||||
if( ScreenWidth < 640 )
|
||||
iRes = 320;
|
||||
else
|
||||
iRes = 640;
|
||||
iRes = GetSpriteRes( ScreenWidth, ScreenHeight );
|
||||
|
||||
char sz[256];
|
||||
|
||||
@ -323,21 +320,24 @@ int CHudAmmo::VidInit( void )
|
||||
giBucketWidth = gHUD.GetSpriteRect( m_HUD_bucket0 ).right - gHUD.GetSpriteRect( m_HUD_bucket0 ).left;
|
||||
giBucketHeight = gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top;
|
||||
|
||||
gHR.iHistoryGap = Q_max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top );
|
||||
gHR.iHistoryGap = gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top;
|
||||
|
||||
// If we've already loaded weapons, let's get new sprites
|
||||
gWR.LoadAllWeaponSprites();
|
||||
|
||||
if( ScreenWidth >= 640 )
|
||||
{
|
||||
giABWidth = 20;
|
||||
giABHeight = 4;
|
||||
}
|
||||
const int res = GetSpriteRes( ScreenWidth, ScreenHeight );
|
||||
int factor;
|
||||
if( res >= 2560 )
|
||||
factor = 4;
|
||||
else if( res >= 1280 )
|
||||
factor = 3;
|
||||
else if( res >= 640 )
|
||||
factor = 2;
|
||||
else
|
||||
{
|
||||
giABWidth = 10;
|
||||
giABHeight = 2;
|
||||
}
|
||||
factor = 1;
|
||||
|
||||
giABWidth = 10 * factor;
|
||||
giABHeight = 2 * factor;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -876,6 +876,7 @@ int CHudAmmo::Draw( float flTime )
|
||||
|
||||
// Does this weapon have a clip?
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
|
||||
y += gHUD.m_iHudNumbersYOffset; // a1ba: fix HL25 HUD vertical inconsistensy
|
||||
|
||||
// Does weapon have any ammo at all?
|
||||
if( m_pWeapon->iAmmoType > 0 )
|
||||
|
@ -131,7 +131,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
||||
|
||||
// Draw the pic
|
||||
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
|
||||
int xpos = ScreenWidth - 24;
|
||||
int xpos = ScreenWidth - (rcPic.right - rcPic.left);
|
||||
if( spr && *spr ) // weapon isn't loaded yet so just don't draw the pic
|
||||
{
|
||||
// the dll has to make sure it has sent info the weapons you need
|
||||
@ -142,7 +142,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
||||
// do not draw black console string
|
||||
if( !( ( hud_textmode->value == 2 ) && ( scale < 200 ) ) )
|
||||
// Draw the number
|
||||
gHUD.DrawHudNumberString( xpos - 10, ypos, xpos - 100, rgAmmoHistory[i].iCount, r, g, b );
|
||||
gHUD.DrawHudNumberString( xpos - 14, ypos, xpos - 104, rgAmmoHistory[i].iCount, r, g, b );
|
||||
}
|
||||
else if( rgAmmoHistory[i].type == HISTSLOT_WEAP )
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs );
|
||||
void DLLEXPORT HUD_Frame( double time );
|
||||
void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking);
|
||||
void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf );
|
||||
void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs );
|
||||
int DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs );
|
||||
}
|
||||
|
||||
/*
|
||||
@ -392,11 +392,12 @@ void DLLEXPORT HUD_DirectorMessage( int iSize, void *pbuf )
|
||||
gHUD.m_Spectator.DirectorMessage( iSize, pbuf );
|
||||
}
|
||||
|
||||
void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs )
|
||||
int DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs )
|
||||
{
|
||||
if( gpMobileEngfuncs->version != MOBILITY_API_VERSION )
|
||||
return;
|
||||
return 1;
|
||||
gMobileEngfuncs = gpMobileEngfuncs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool HUD_MessageBox( const char *msg )
|
||||
|
@ -153,6 +153,27 @@ inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex(
|
||||
#define Q_min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define fabs(x) ((x) > 0 ? (x) : 0 - (x))
|
||||
|
||||
inline int GetSpriteRes( int width, int height )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( width < 640 )
|
||||
i = 320;
|
||||
else if( width < 1280 || !gHUD.m_pAllowHD->value )
|
||||
i = 640;
|
||||
else
|
||||
{
|
||||
if( height <= 720 )
|
||||
i = 640;
|
||||
else if( width <= 2560 || height <= 1600 )
|
||||
i = 1280;
|
||||
else
|
||||
i = 2560;
|
||||
}
|
||||
|
||||
return Q_min( i, gHUD.m_iMaxRes );
|
||||
}
|
||||
|
||||
void ScaleColors( int &r, int &g, int &b, int a );
|
||||
|
||||
#define DotProduct(x, y) ((x)[0] * (y)[0] + (x)[1] * (y)[1] + (x)[2] * (y)[2])
|
||||
|
@ -392,6 +392,7 @@ void CHud::Init( void )
|
||||
default_fov = CVAR_CREATE( "default_fov", "90", FCVAR_ARCHIVE );
|
||||
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
|
||||
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
||||
m_pAllowHD = CVAR_CREATE ( "hud_allow_hd", "1", FCVAR_ARCHIVE );
|
||||
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
|
||||
cl_viewbob = CVAR_CREATE( "cl_viewbob", "1", FCVAR_ARCHIVE );
|
||||
|
||||
@ -496,16 +497,28 @@ void CHud::VidInit( void )
|
||||
m_hsprLogo = 0;
|
||||
m_hsprCursor = 0;
|
||||
|
||||
if( ScreenWidth < 640 )
|
||||
m_iRes = 320;
|
||||
else
|
||||
m_iRes = 640;
|
||||
// a1ba: don't break the loading order here and
|
||||
// don't cause memory leak but check
|
||||
// maximum HUD sprite resolution we have
|
||||
m_iMaxRes = 640;
|
||||
client_sprite_t *pSpriteList = m_pSpriteList ? m_pSpriteList :
|
||||
SPR_GetList( "sprites/hud.txt", &m_iSpriteCountAllRes );
|
||||
if( pSpriteList )
|
||||
{
|
||||
for( int i = 0; i < m_iSpriteCountAllRes; i++ )
|
||||
{
|
||||
if( m_iMaxRes < pSpriteList[i].iRes )
|
||||
m_iMaxRes = pSpriteList[i].iRes;
|
||||
}
|
||||
}
|
||||
|
||||
m_iRes = GetSpriteRes( ScreenWidth, ScreenHeight );
|
||||
|
||||
// Only load this once
|
||||
if( !m_pSpriteList )
|
||||
{
|
||||
// we need to load the hud.txt, and all sprites within
|
||||
m_pSpriteList = SPR_GetList( "sprites/hud.txt", &m_iSpriteCountAllRes );
|
||||
m_pSpriteList = pSpriteList;
|
||||
|
||||
if( m_pSpriteList )
|
||||
{
|
||||
|
11
cl_dll/hud.h
11
cl_dll/hud.h
@ -30,6 +30,7 @@
|
||||
#include "wrect.h"
|
||||
#include "cl_dll.h"
|
||||
#include "ammo.h"
|
||||
#include "cvardef.h"
|
||||
|
||||
#define DHN_DRAWZERO 1
|
||||
#define DHN_2DIGITS 2
|
||||
@ -559,8 +560,11 @@ public:
|
||||
int m_iFOV;
|
||||
int m_Teamplay;
|
||||
int m_iRes;
|
||||
int m_iMaxRes;
|
||||
int m_iHudNumbersYOffset;
|
||||
cvar_t *m_pCvarStealMouse;
|
||||
cvar_t *m_pCvarDraw;
|
||||
cvar_t *m_pAllowHD;
|
||||
|
||||
int m_iFontHeight;
|
||||
int DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b );
|
||||
@ -589,6 +593,13 @@ public:
|
||||
{
|
||||
return m_rgrcRects[index];
|
||||
}
|
||||
|
||||
inline bool IsHL25( void )
|
||||
{
|
||||
// a1ba: only HL25 have higher resolution HUD spritesheets
|
||||
// and only accept HUD style changes if user has allowed HD sprites
|
||||
return m_iMaxRes > 640 && m_pAllowHD->value;
|
||||
}
|
||||
|
||||
int GetSpriteIndex( const char *SpriteName ); // gets a sprite index, for use in the m_rghSprites[] array
|
||||
|
||||
|
@ -153,6 +153,8 @@ int CHud::Redraw( float flTime, int intermission )
|
||||
// if no redrawing is necessary
|
||||
// return 0;
|
||||
|
||||
m_iHudNumbersYOffset = IsHL25() ? m_iFontHeight * 0.2 : 0;
|
||||
|
||||
if( m_pCvarDraw->value )
|
||||
{
|
||||
HUDLIST *pList = m_pHudList;
|
||||
|
@ -123,14 +123,9 @@ void VectorMA( const float *veca, float scale, const float *vecb, float *vecc )
|
||||
|
||||
HSPRITE LoadSprite( const char *pszName )
|
||||
{
|
||||
int i;
|
||||
int i = GetSpriteRes( ScreenWidth, ScreenHeight );
|
||||
char sz[256];
|
||||
|
||||
if( ScreenWidth < 640 )
|
||||
i = 320;
|
||||
else
|
||||
i = 640;
|
||||
|
||||
sprintf( sz, pszName, i );
|
||||
|
||||
return SPR_Load( sz );
|
||||
|
@ -278,7 +278,10 @@ void CGrenade::BounceTouch( CBaseEntity *pOther )
|
||||
if( pev->framerate > 1.0f )
|
||||
pev->framerate = 1.0f;
|
||||
else if( pev->framerate < 0.5f )
|
||||
{
|
||||
pev->framerate = 0.0f;
|
||||
pev->frame = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void CGrenade::SlideTouch( CBaseEntity *pOther )
|
||||
|
Loading…
Reference in New Issue
Block a user