Updated HL1 SDK for the October 2, 2024 Steam patch

This commit is contained in:
shawns-valve 2024-10-02 14:22:18 -07:00
parent e5815c34e2
commit 2c78e5d994
15 changed files with 94 additions and 68 deletions

View File

@ -74,12 +74,14 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
{ {
int i, iRes; int i, iRes;
#if !defined( _TFC )
if (ScreenWidth > 2560 && ScreenHeight > 1600) if (ScreenWidth > 2560 && ScreenHeight > 1600)
iRes = 2560; iRes = 2560;
else if (ScreenWidth >= 1280 && ScreenHeight > 720) else if (ScreenWidth >= 1280 && ScreenHeight > 720)
iRes = 1280; iRes = 1280;
else if (ScreenWidth >= 640) else
#endif
if (ScreenWidth >= 640)
iRes = 640; iRes = 640;
else else
iRes = 320; iRes = 320;
@ -332,11 +334,14 @@ int CHudAmmo::VidInit(void)
int nScale = 1; int nScale = 1;
#if !defined( _TFC )
if (ScreenWidth > 2560 && ScreenHeight > 1600) if (ScreenWidth > 2560 && ScreenHeight > 1600)
nScale = 4; nScale = 4;
else if (ScreenWidth >= 1280 && ScreenHeight > 720) else if (ScreenWidth >= 1280 && ScreenHeight > 720)
nScale = 3; nScale = 3;
else if (ScreenWidth >= 640) else
#endif
if (ScreenWidth >= 640)
nScale = 2; nScale = 2;
giABWidth = 10 * nScale; giABWidth = 10 * nScale;

View File

@ -77,8 +77,10 @@ inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int fl
#define XPROJECT(x) ( (1.0f+(x))*ScreenWidth*0.5f ) #define XPROJECT(x) ( (1.0f+(x))*ScreenWidth*0.5f )
#define YPROJECT(y) ( (1.0f-(y))*ScreenHeight*0.5f ) #define YPROJECT(y) ( (1.0f-(y))*ScreenHeight*0.5f )
#define XRES(x) (x * ((float)ScreenWidth / 640)) #define XRES(x) ((x) * ((float)ScreenWidth / 640))
#define YRES(y) (y * ((float)ScreenHeight / 480)) #define YRES(y) ((y) * ((float)ScreenHeight / 480))
#define XRES_HD(x) ((x) * max(1.f, (float)ScreenWidth / 1280.f))
#define YRES_HD(y) ((y) * max(1.f, (float)ScreenHeight / 720.f))
#define GetScreenInfo (*gEngfuncs.pfnGetScreenInfo) #define GetScreenInfo (*gEngfuncs.pfnGetScreenInfo)
#define ServerCmd (*gEngfuncs.pfnServerCmd) #define ServerCmd (*gEngfuncs.pfnServerCmd)

View File

@ -101,6 +101,11 @@ int CHudDeathNotice :: Draw( float flTime )
wrect_t& sprite = gHUD.GetSpriteRect(m_HUD_d_skull); wrect_t& sprite = gHUD.GetSpriteRect(m_HUD_d_skull);
gap = sprite.bottom - sprite.top; gap = sprite.bottom - sprite.top;
SCREENINFO screenInfo;
screenInfo.iSize = sizeof(SCREENINFO);
gEngfuncs.pfnGetScreenInfo(&screenInfo);
gap = max( gap, screenInfo.iCharHeight );
for ( int i = 0; i < MAX_DEATHNOTICES; i++ ) for ( int i = 0; i < MAX_DEATHNOTICES; i++ )
{ {
if ( rgDeathNoticeList[i].iId == 0 ) if ( rgDeathNoticeList[i].iId == 0 )

View File

@ -430,11 +430,14 @@ void CHud :: VidInit( void )
m_hsprLogo = 0; m_hsprLogo = 0;
m_hsprCursor = 0; m_hsprCursor = 0;
#if !defined( _TFC )
if (ScreenWidth > 2560 && ScreenHeight > 1600) if (ScreenWidth > 2560 && ScreenHeight > 1600)
m_iRes = 2560; m_iRes = 2560;
else if (ScreenWidth >= 1280 && ScreenHeight > 720) else if (ScreenWidth >= 1280 && ScreenHeight > 720)
m_iRes = 1280; m_iRes = 1280;
else if (ScreenWidth >= 640) else
#endif
if (ScreenWidth >= 640)
m_iRes = 640; m_iRes = 640;
else else
m_iRes = 320; m_iRes = 320;

View File

@ -656,10 +656,10 @@ int CHudSpectator::Draw(float flTime)
// check if name would be in inset window // check if name would be in inset window
if ( m_pip->value != INSET_OFF ) if ( m_pip->value != INSET_OFF )
{ {
if ( m_vPlayerPos[i][0] > XRES( m_OverviewData.insetWindowX ) && if ( m_vPlayerPos[i][0] > XRES_HD( m_OverviewData.insetWindowX ) &&
m_vPlayerPos[i][1] > YRES( m_OverviewData.insetWindowY ) && m_vPlayerPos[i][1] > YRES_HD( m_OverviewData.insetWindowY ) &&
m_vPlayerPos[i][0] < XRES( m_OverviewData.insetWindowX + m_OverviewData.insetWindowWidth ) && m_vPlayerPos[i][0] < XRES_HD( m_OverviewData.insetWindowX + m_OverviewData.insetWindowWidth ) &&
m_vPlayerPos[i][1] < YRES( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight) m_vPlayerPos[i][1] < YRES_HD( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight)
) continue; ) continue;
} }

View File

@ -264,12 +264,14 @@ int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
if ( !NeedMore ) if ( !NeedMore )
{ // we have the whole string, so we can localise it now { // we have the whole string, so we can localise it now
strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ) ); strncpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ), MAX_MENU_STRING );
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
// Swap in characters // Swap in characters
if ( KB_ConvertString( g_szMenuString, &temp ) ) if ( KB_ConvertString( g_szMenuString, &temp ) )
{ {
strcpy( g_szMenuString, temp ); strncpy( g_szMenuString, temp, MAX_MENU_STRING );
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
free( temp ); free( temp );
} }
} }

View File

@ -121,11 +121,14 @@ HSPRITE LoadSprite(const char *pszName)
int iRes; int iRes;
char sz[256]; char sz[256];
#if !defined( _TFC )
if (ScreenWidth > 2560 && ScreenHeight > 1600) if (ScreenWidth > 2560 && ScreenHeight > 1600)
iRes = 2560; iRes = 2560;
else if (ScreenWidth >= 1280 && ScreenHeight > 720) else if (ScreenWidth >= 1280 && ScreenHeight > 720)
iRes = 1280; iRes = 1280;
else if (ScreenWidth >= 640) else
#endif
if (ScreenWidth >= 640)
iRes = 640; iRes = 640;
else else
iRes = 320; iRes = 320;

View File

@ -30,11 +30,11 @@ void CL_DLLEXPORT HUD_ChatInputPosition( int *x, int *y )
{ {
if ( gHUD.m_Spectator.m_pip->value == INSET_OFF ) if ( gHUD.m_Spectator.m_pip->value == INSET_OFF )
{ {
*y = YRES( PANEL_HEIGHT ); *y = YRES_HD( PANEL_HEIGHT );
} }
else else
{ {
*y = YRES( gHUD.m_Spectator.m_OverviewData.insetWindowHeight + 5 ); *y = YRES_HD( gHUD.m_Spectator.m_OverviewData.insetWindowHeight + 5 );
} }
} }
} }
@ -97,15 +97,15 @@ void SpectatorPanel::Initialize()
SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle( "Team Info Text" ); SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle( "Team Info Text" );
m_TopBorder = new CTransparentPanel(64, 0, 0, ScreenWidth, PANEL_HEIGHT); m_TopBorder = new CTransparentPanel(64, 0, 0, ScreenWidth, YRES_HD( PANEL_HEIGHT ));
m_TopBorder->setParent(this); m_TopBorder->setParent(this);
m_BottomBorder = new CTransparentPanel(64, 0, ScreenHeight - PANEL_HEIGHT, ScreenWidth, PANEL_HEIGHT); m_BottomBorder = new CTransparentPanel(64, 0, ScreenHeight - YRES_HD( PANEL_HEIGHT ), ScreenWidth, YRES_HD( PANEL_HEIGHT ) );
m_BottomBorder->setParent(this); m_BottomBorder->setParent(this);
setPaintBackgroundEnabled(false); setPaintBackgroundEnabled(false);
m_ExtraInfo = new Label( "Extra Info", 0, 0, wide, PANEL_HEIGHT ); m_ExtraInfo = new Label( "Extra Info", 0, 0, wide, YRES_HD( PANEL_HEIGHT ) );
m_ExtraInfo->setParent(m_TopBorder); m_ExtraInfo->setParent(m_TopBorder);
m_ExtraInfo->setFont( pSchemes->getFont(hSmallScheme) ); m_ExtraInfo->setFont( pSchemes->getFont(hSmallScheme) );
@ -118,24 +118,24 @@ void SpectatorPanel::Initialize()
m_TimerImage = new CImageLabel( "timer", 0, 0, 14, 14 ); m_TimerImage = new CImageLabel( "timer", 0, 0, 14, 14 );
m_TimerImage->setParent(m_TopBorder); m_TimerImage->setParent(m_TopBorder);
m_TopBanner = new CImageLabel( "banner", 0, 0, XRES(BANNER_WIDTH), YRES(BANNER_HEIGHT) ); m_TopBanner = new CImageLabel( "banner", 0, 0, XRES_HD(BANNER_WIDTH), YRES_HD(BANNER_HEIGHT) );
m_TopBanner->setParent(this); m_TopBanner->setParent(this);
m_CurrentTime = new Label( "00:00", 0, 0, wide, PANEL_HEIGHT ); m_CurrentTime = new Label( "00:00", 0, 0, wide, YRES_HD(PANEL_HEIGHT) );
m_CurrentTime->setParent(m_TopBorder); m_CurrentTime->setParent(m_TopBorder);
m_CurrentTime->setFont( pSchemes->getFont(hSmallScheme) ); m_CurrentTime->setFont( pSchemes->getFont(hSmallScheme) );
m_CurrentTime->setPaintBackgroundEnabled(false); m_CurrentTime->setPaintBackgroundEnabled(false);
m_CurrentTime->setFgColor( 143, 143, 54, 0 ); m_CurrentTime->setFgColor( 143, 143, 54, 0 );
m_CurrentTime->setContentAlignment( vgui::Label::a_west ); m_CurrentTime->setContentAlignment( vgui::Label::a_west );
m_Separator = new Panel( 0, 0, XRES( 64 ), YRES( 96 )); m_Separator = new Panel( 0, 0, XRES_HD( 64 ), YRES_HD( 96 ));
m_Separator->setParent( m_TopBorder ); m_Separator->setParent( m_TopBorder );
m_Separator->setFgColor( 59, 58, 34, 48 ); m_Separator->setFgColor( 59, 58, 34, 48 );
m_Separator->setBgColor( 59, 58, 34, 48 ); m_Separator->setBgColor( 59, 58, 34, 48 );
for ( int j= 0; j < TEAM_NUMBER; j++ ) for ( int j= 0; j < TEAM_NUMBER; j++ )
{ {
m_TeamScores[j] = new Label( " ", 0, 0, wide, PANEL_HEIGHT ); m_TeamScores[j] = new Label( " ", 0, 0, wide, YRES_HD(PANEL_HEIGHT) );
m_TeamScores[j]->setParent( m_TopBorder ); m_TeamScores[j]->setParent( m_TopBorder );
m_TeamScores[j]->setFont( pSchemes->getFont(hSmallScheme) ); m_TeamScores[j]->setFont( pSchemes->getFont(hSmallScheme) );
m_TeamScores[j]->setPaintBackgroundEnabled(false); m_TeamScores[j]->setPaintBackgroundEnabled(false);
@ -146,8 +146,8 @@ void SpectatorPanel::Initialize()
// Initialize command buttons. // Initialize command buttons.
// m_OptionButton = new ColorButton( CHudTextMessage::BufferedLocaliseTextString( "#SPECT_OPTIONS" ), XRES(15), YRES(6), XRES(OPTIONS_BUTTON_X), YRES(20), false, false ); // m_OptionButton = new ColorButton( CHudTextMessage::BufferedLocaliseTextString( "#SPECT_OPTIONS" ), XRES_HD(15), YRES_HD(6), XRES_HD(OPTIONS_BUTTON_X), YRES_HD(20), false, false );
m_OptionButton = new DropDownButton( CHudTextMessage::BufferedLocaliseTextString( "#SPECT_OPTIONS" ), XRES(15), YRES(6), XRES(OPTIONS_BUTTON_X), YRES(20), false, false ); m_OptionButton = new DropDownButton( CHudTextMessage::BufferedLocaliseTextString( "#SPECT_OPTIONS" ), XRES_HD(15), YRES_HD(6), XRES_HD(OPTIONS_BUTTON_X), YRES_HD(20), false, false );
m_OptionButton->setParent( m_BottomBorder ); m_OptionButton->setParent( m_BottomBorder );
m_OptionButton->setContentAlignment( vgui::Label::a_center ); m_OptionButton->setContentAlignment( vgui::Label::a_center );
m_OptionButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name m_OptionButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name
@ -157,7 +157,7 @@ void SpectatorPanel::Initialize()
m_OptionButton->setUnArmedColor ( 143, 143, 54, 0 ); m_OptionButton->setUnArmedColor ( 143, 143, 54, 0 );
m_OptionButton->setArmedColor ( 194, 202, 54, 0 ); m_OptionButton->setArmedColor ( 194, 202, 54, 0 );
m_CamButton = new DropDownButton( CHudTextMessage::BufferedLocaliseTextString( "#CAM_OPTIONS" ), ScreenWidth - ( XRES ( CAMOPTIONS_BUTTON_X ) + 15 ), YRES(6), XRES ( CAMOPTIONS_BUTTON_X ), YRES(20), false, false ); m_CamButton = new DropDownButton( CHudTextMessage::BufferedLocaliseTextString( "#CAM_OPTIONS" ), ScreenWidth - XRES_HD( CAMOPTIONS_BUTTON_X + 15 ), YRES_HD(6), XRES_HD( CAMOPTIONS_BUTTON_X ), YRES_HD(20), false, false );
m_CamButton->setParent( m_BottomBorder ); m_CamButton->setParent( m_BottomBorder );
m_CamButton->setContentAlignment( vgui::Label::a_center ); m_CamButton->setContentAlignment( vgui::Label::a_center );
m_CamButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name m_CamButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name
@ -167,8 +167,8 @@ void SpectatorPanel::Initialize()
m_CamButton->setUnArmedColor ( 143, 143, 54, 0 ); m_CamButton->setUnArmedColor ( 143, 143, 54, 0 );
m_CamButton->setArmedColor ( 194, 202, 54, 0 ); m_CamButton->setArmedColor ( 194, 202, 54, 0 );
// m_PrevPlayerButton= new ColorButton("<", XRES( 15 + OPTIONS_BUTTON_X + 15 ), YRES(6), XRES(24), YRES(20), false, false ); // m_PrevPlayerButton= new ColorButton("<", XRES_HD( 15 + OPTIONS_BUTTON_X + 15 ), YRES_HD(6), XRES_HD(24), YRES_HD(20), false, false );
m_PrevPlayerButton= new CImageButton("arrowleft", XRES( 15 + OPTIONS_BUTTON_X + 15 ), YRES(6), XRES(24), YRES(20), false, false ); m_PrevPlayerButton= new CImageButton("arrowleft", XRES_HD( 15 + OPTIONS_BUTTON_X + 15 ), YRES_HD(6), XRES_HD(24), YRES_HD(20), false, false );
m_PrevPlayerButton->setParent( m_BottomBorder ); m_PrevPlayerButton->setParent( m_BottomBorder );
m_PrevPlayerButton->setContentAlignment( vgui::Label::a_center ); m_PrevPlayerButton->setContentAlignment( vgui::Label::a_center );
m_PrevPlayerButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name m_PrevPlayerButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name
@ -178,8 +178,8 @@ void SpectatorPanel::Initialize()
m_PrevPlayerButton->setUnArmedColor ( 143, 143, 54, 0 ); m_PrevPlayerButton->setUnArmedColor ( 143, 143, 54, 0 );
m_PrevPlayerButton->setArmedColor ( 194, 202, 54, 0 ); m_PrevPlayerButton->setArmedColor ( 194, 202, 54, 0 );
// m_NextPlayerButton= new ColorButton(">", (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ), YRES(6), XRES(24), YRES(20),false, false ); // m_NextPlayerButton= new ColorButton(">", (ScreenWidth - (XRES_HD ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES_HD ( 24 + 15 ), YRES_HD(6), XRES_HD(24), YRES_HD(20),false, false );
m_NextPlayerButton= new CImageButton("arrowright", (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ), YRES(6), XRES(24), YRES(20),false, false ); m_NextPlayerButton= new CImageButton("arrowright", ScreenWidth - XRES_HD( CAMOPTIONS_BUTTON_X + 15) - XRES_HD( 24 + 15 ), YRES_HD(6), XRES_HD(24), YRES_HD(20), false, false );
m_NextPlayerButton->setParent( m_BottomBorder ); m_NextPlayerButton->setParent( m_BottomBorder );
m_NextPlayerButton->setContentAlignment( vgui::Label::a_center ); m_NextPlayerButton->setContentAlignment( vgui::Label::a_center );
m_NextPlayerButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name m_NextPlayerButton->setBoundKey( (char)255 ); // special no bound to avoid leading spaces in name
@ -191,10 +191,10 @@ void SpectatorPanel::Initialize()
// Initialize the bottom title. // Initialize the bottom title.
float flLabelSize = ( (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ) ) - XRES( (15 + OPTIONS_BUTTON_X + 15) + 38 ); float flLabelSize = ScreenWidth - XRES_HD( CAMOPTIONS_BUTTON_X + 15 ) - XRES_HD( 24 + 15 ) - XRES_HD( (15 + OPTIONS_BUTTON_X + 15) + 38 );
m_BottomMainButton = new DropDownButton("Spectator Bottom", m_BottomMainButton = new DropDownButton("Spectator Bottom",
XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES(6), flLabelSize, YRES(20), XRES_HD( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES_HD(6), flLabelSize, YRES_HD(20),
false, false ); false, false );
m_BottomMainButton->setParent(m_BottomBorder); m_BottomMainButton->setParent(m_BottomBorder);
@ -211,7 +211,7 @@ void SpectatorPanel::Initialize()
m_BottomMainLabel = new Label("Spectator Bottom", m_BottomMainLabel = new Label("Spectator Bottom",
XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES(6), flLabelSize, YRES(20)); XRES_HD( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES_HD(6), flLabelSize, YRES_HD(20));
m_BottomMainLabel->setParent(m_BottomBorder); m_BottomMainLabel->setParent(m_BottomBorder);
m_BottomMainLabel->setPaintBackgroundEnabled(false); m_BottomMainLabel->setPaintBackgroundEnabled(false);
@ -220,7 +220,7 @@ void SpectatorPanel::Initialize()
m_BottomMainLabel->setBorder( NULL ); m_BottomMainLabel->setBorder( NULL );
m_BottomMainLabel->setVisible(false); m_BottomMainLabel->setVisible(false);
m_InsetViewButton = new ColorButton("", XRES(2), YRES(2), XRES(240), YRES(180), false, false ); m_InsetViewButton = new ColorButton("", XRES_HD(2), YRES_HD(2), XRES_HD(240), YRES_HD(180), false, false );
m_InsetViewButton->setParent( this ); m_InsetViewButton->setParent( this );
m_InsetViewButton->setBoundKey( (char)255 ); m_InsetViewButton->setBoundKey( (char)255 );
m_InsetViewButton->addActionSignal( new CSpectatorHandler_Command(this,SPECTATOR_PANEL_CMD_TOGGLE_INSET) ); m_InsetViewButton->addActionSignal( new CSpectatorHandler_Command(this,SPECTATOR_PANEL_CMD_TOGGLE_INSET) );
@ -259,11 +259,11 @@ void SpectatorPanel::ShowMenu(bool isVisible)
m_BottomMainButton->setVisible(false); m_BottomMainButton->setVisible(false);
m_BottomMainLabel->getSize( iLabelSizeX, iLabelSizeY ); m_BottomMainLabel->getSize( iLabelSizeX, iLabelSizeY );
m_BottomMainLabel->setPos( ( ScreenWidth / 2 ) - (iLabelSizeX/2), YRES(6) ); m_BottomMainLabel->setPos( ( ScreenWidth / 2 ) - (iLabelSizeX/2), YRES_HD(6) );
} }
else else
{ {
m_BottomMainButton->setPos( XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES(6) ); m_BottomMainButton->setPos( XRES_HD( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES_HD(6) );
m_BottomMainLabel->setVisible(false); m_BottomMainLabel->setVisible(false);
m_BottomMainButton->setVisible(true); m_BottomMainButton->setVisible(true);
} }
@ -331,18 +331,18 @@ void SpectatorPanel::EnableInsetView(bool isEnabled)
if ( isEnabled ) if ( isEnabled )
{ {
// short black bar to see full inset // short black bar to see full inset
m_TopBorder->setBounds( XRES(offset), 0, XRES(640 - offset ), PANEL_HEIGHT ); m_TopBorder->setBounds( XRES_HD( offset ), 0, ScreenWidth - XRES_HD( offset ), YRES_HD( PANEL_HEIGHT ) );
if ( gEngfuncs.IsSpectateOnly() ) if ( gEngfuncs.IsSpectateOnly() )
{ {
m_TopBanner->setVisible( true ); m_TopBanner->setVisible( true );
m_TopBanner->setPos( XRES(offset), 0 ); m_TopBanner->setPos( XRES_HD( offset ), 0 );
} }
else else
m_TopBanner->setVisible( false ); m_TopBanner->setVisible( false );
m_InsetViewButton->setBounds( XRES( x -1 ), YRES( y ), m_InsetViewButton->setBounds( XRES_HD( x - 1 ), YRES_HD( y ),
XRES( wide +2), YRES( tall ) ); XRES_HD( wide + 2 ), YRES_HD( tall ) );
m_InsetViewButton->setVisible(true); m_InsetViewButton->setVisible(true);
} }
else else
@ -357,7 +357,7 @@ void SpectatorPanel::EnableInsetView(bool isEnabled)
else else
m_TopBanner->setVisible( false ); m_TopBanner->setVisible( false );
m_TopBorder->setBounds( 0, 0, ScreenWidth, PANEL_HEIGHT ); m_TopBorder->setBounds( 0, 0, ScreenWidth, YRES_HD(PANEL_HEIGHT) );
m_InsetViewButton->setVisible(false); m_InsetViewButton->setVisible(false);
} }
@ -399,28 +399,28 @@ void SpectatorPanel::Update()
m_ExtraInfo->getTextSize( iTextWidth, iTextHeight ); m_ExtraInfo->getTextSize( iTextWidth, iTextHeight );
m_CurrentTime->getTextSize( iTimeWidth, iTimeHeight ); m_CurrentTime->getTextSize( iTimeWidth, iTimeHeight );
iTimeWidth += XRES ( SEPERATOR_WIDTH*2 + 1 ); // +timer icon iTimeWidth += XRES_HD( SEPERATOR_WIDTH*2 + 1 ); // +timer icon
iTimeWidth += ( SEPERATOR_WIDTH-(iTimeWidth%SEPERATOR_WIDTH) ); iTimeWidth += ( XRES_HD(SEPERATOR_WIDTH) - ( iTimeWidth % (int)XRES_HD(SEPERATOR_WIDTH) ) );
if ( iTimeWidth > iTextWidth ) if ( iTimeWidth > iTextWidth )
iTextWidth = iTimeWidth; iTextWidth = iTimeWidth;
int xPos = ScreenWidth - ( iTextWidth + XRES ( SEPERATOR_WIDTH + offset ) ); int xPos = ScreenWidth - ( iTextWidth + XRES_HD( SEPERATOR_WIDTH + offset ) );
m_ExtraInfo->setBounds( xPos, YRES( SEPERATOR_HEIGHT ), iTextWidth, iTextHeight ); m_ExtraInfo->setBounds( xPos, SEPERATOR_HEIGHT, iTextWidth, iTextHeight );
m_TimerImage->setBounds( xPos, YRES( SEPERATOR_HEIGHT ) + iTextHeight , XRES(SEPERATOR_WIDTH*2 + 1), YRES(SEPERATOR_HEIGHT + 1) ); m_TimerImage->setBounds( xPos, SEPERATOR_HEIGHT + iTextHeight , XRES_HD( SEPERATOR_WIDTH*2 + 1), SEPERATOR_HEIGHT + 1 );
m_CurrentTime->setBounds( xPos + XRES ( SEPERATOR_WIDTH*2 + 1 ), YRES( SEPERATOR_HEIGHT ) + iTextHeight , iTimeWidth, iTimeHeight ); m_CurrentTime->setBounds( xPos + XRES_HD( SEPERATOR_WIDTH*2 + 1 ), SEPERATOR_HEIGHT + iTextHeight, iTimeWidth, iTimeHeight );
m_Separator->setPos( ScreenWidth - ( iTextWidth + XRES ( 2*SEPERATOR_WIDTH+SEPERATOR_WIDTH/2+offset ) ) , YRES( 5 ) ); m_Separator->setPos( ScreenWidth - ( iTextWidth + XRES_HD( 2*SEPERATOR_WIDTH+SEPERATOR_WIDTH/2+offset ) ) , YRES_HD( 5 ) );
m_Separator->setSize( XRES( 1 ), PANEL_HEIGHT - 10 ); m_Separator->setSize( XRES_HD( 1 ), YRES_HD( PANEL_HEIGHT - 10 ) );
for ( j= 0; j < TEAM_NUMBER; j++ ) for ( j= 0; j < TEAM_NUMBER; j++ )
{ {
int iwidth, iheight; int iwidth, iheight;
m_TeamScores[j]->getTextSize( iwidth, iheight ); m_TeamScores[j]->getTextSize( iwidth, iheight );
m_TeamScores[j]->setBounds( ScreenWidth - ( iTextWidth + XRES ( 2*SEPERATOR_WIDTH+2*SEPERATOR_WIDTH/2+offset ) + iwidth ), YRES( SEPERATOR_HEIGHT ) + ( iheight * j ), iwidth, iheight ); m_TeamScores[j]->setBounds( ScreenWidth - ( iTextWidth + XRES_HD ( 2*SEPERATOR_WIDTH+2*SEPERATOR_WIDTH/2+offset ) + iwidth ), SEPERATOR_HEIGHT + ( iheight * j ), iwidth, iheight );
} }
} }

View File

@ -1594,10 +1594,10 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
// second renderer cycle, inset window // second renderer cycle, inset window
// set inset parameters // set inset parameters
pparams->viewport[0] = XRES(gHUD.m_Spectator.m_OverviewData.insetWindowX); // change viewport to inset window pparams->viewport[0] = XRES_HD(gHUD.m_Spectator.m_OverviewData.insetWindowX); // change viewport to inset window
pparams->viewport[1] = YRES(gHUD.m_Spectator.m_OverviewData.insetWindowY); pparams->viewport[1] = YRES_HD(gHUD.m_Spectator.m_OverviewData.insetWindowY);
pparams->viewport[2] = XRES(gHUD.m_Spectator.m_OverviewData.insetWindowWidth); pparams->viewport[2] = XRES_HD(gHUD.m_Spectator.m_OverviewData.insetWindowWidth);
pparams->viewport[3] = YRES(gHUD.m_Spectator.m_OverviewData.insetWindowHeight); pparams->viewport[3] = YRES_HD(gHUD.m_Spectator.m_OverviewData.insetWindowHeight);
pparams->nextView = 0; // on further view pparams->nextView = 0; // on further view
// override some settings in certain modes // override some settings in certain modes

View File

@ -832,7 +832,8 @@ void CBasePlayer::PackDeadPlayerItems( void )
if ( iAmmoRules == GR_PLR_DROP_AMMO_ACTIVE && iWeaponRules == GR_PLR_DROP_GUN_ACTIVE ) if ( iAmmoRules == GR_PLR_DROP_AMMO_ACTIVE && iWeaponRules == GR_PLR_DROP_GUN_ACTIVE )
{ {
if ( FClassnameIs( rgpPackWeapons[0]->pev, "weapon_satchel" ) && ( iPackAmmo[0] == -1 || ( m_rgAmmo[iPackAmmo[0]] == 0 ) ) ) if ( rgpPackWeapons[0] == nullptr
|| ( FClassnameIs( rgpPackWeapons[0]->pev, "weapon_satchel" ) && ( iPackAmmo[0] == -1 || ( m_rgAmmo[iPackAmmo[0]] == 0 ) ) ) )
{ {
bPackItems = FALSE; bPackItems = FALSE;
} }
@ -3212,12 +3213,6 @@ int CBasePlayer::Restore( CRestore &restore )
m_flNextAttack = UTIL_WeaponTimeBase(); m_flNextAttack = UTIL_WeaponTimeBase();
#endif #endif
// Force a flashlight update for the HUD
if ( m_flFlashLightTime == 0 )
{
m_flFlashLightTime = 1;
}
return status; return status;
} }
@ -4129,6 +4124,12 @@ void CBasePlayer :: UpdateClientData( void )
FireTargets( "game_playerspawn", this, this, USE_TOGGLE, 0 ); FireTargets( "game_playerspawn", this, this, USE_TOGGLE, 0 );
InitStatusBar(); InitStatusBar();
// Update initial flashlight state
MESSAGE_BEGIN( MSG_ONE, gmsgFlashlight, NULL, pev );
WRITE_BYTE( FlashlightIsOn() ? 1 : 0 );
WRITE_BYTE( m_iFlashBattery );
MESSAGE_END();
} }
if ( m_iHideHUD != m_iClientHideHUD ) if ( m_iHideHUD != m_iClientHideHUD )

View File

@ -263,12 +263,14 @@ int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
if ( !NeedMore ) if ( !NeedMore )
{ // we have the whole string, so we can localise it now { // we have the whole string, so we can localise it now
strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ) ); strncpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ), MAX_MENU_STRING );
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
// Swap in characters // Swap in characters
if ( KB_ConvertString( g_szMenuString, &temp ) ) if ( KB_ConvertString( g_szMenuString, &temp ) )
{ {
strcpy( g_szMenuString, temp ); strncpy( g_szMenuString, temp, MAX_MENU_STRING );
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
free( temp ); free( temp );
} }
} }

View File

@ -1539,7 +1539,8 @@ void TEXTURETYPE_Init()
char buffer[512]; char buffer[512];
int i, j; int i, j;
byte *pMemFile; byte *pMemFile;
int fileSize, filePos = 0; int fileSize = 0;
int filePos = 0;
if (fTextureTypeInit) if (fTextureTypeInit)
return; return;

View File

@ -169,12 +169,14 @@ int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
if ( !NeedMore ) if ( !NeedMore )
{ // we have the whole string, so we can localise it now { // we have the whole string, so we can localise it now
strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ) ); strncpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ), MAX_MENU_STRING );
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
// Swap in characters // Swap in characters
if ( KB_ConvertString( g_szMenuString, &temp ) ) if ( KB_ConvertString( g_szMenuString, &temp ) )
{ {
strcpy( g_szMenuString, temp ); strncpy( g_szMenuString, temp, MAX_MENU_STRING );
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
free( temp ); free( temp );
} }
} }

View File

@ -60,8 +60,8 @@ extern int iTeamColors[5][3];
#define MAX_SERVERNAME_LENGTH 32 #define MAX_SERVERNAME_LENGTH 32
// Use this to set any co-ords in 640x480 space // Use this to set any co-ords in 640x480 space
#define XRES(x) (x * ((float)ScreenWidth / 640)) #define XRES(x) ((x) * ((float)ScreenWidth / 640))
#define YRES(y) (y * ((float)ScreenHeight / 480)) #define YRES(y) ((y) * ((float)ScreenHeight / 480))
// Command Menu positions // Command Menu positions
#define MAX_MENUS 40 #define MAX_MENUS 40

View File

@ -1544,7 +1544,7 @@ void TEXTURETYPE_Init()
char buffer[512]; char buffer[512];
int i, j; int i, j;
byte *pMemFile; byte *pMemFile;
int fileSize, filePos = 0; int fileSize, filePos;
if (fTextureTypeInit) if (fTextureTypeInit)
return; return;