Skip to content

Commit d38205d

Browse files
committed
Merge branch 'master' into visitors
2 parents 0eb97d5 + 810cd60 commit d38205d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+358
-162
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
env:
2121
CC: ${{ matrix.cc }}
2222
CXX: ${{ matrix.cxx }}
23+
STEAMRT_SNAPSHOT: latest-steam-client-general-availability
2324
steps:
2425
- name: Checkout
2526
uses: actions/checkout@v4
@@ -38,10 +39,10 @@ jobs:
3839
uses: actions/cache@v4
3940
with:
4041
path: com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
41-
key: ${{ runner.os }}-steam-runtime
42+
key: steam-runtime-${{ env.STEAMRT_SNAPSHOT }}
4243
- name: Download steam-runtime
4344
if: startsWith(matrix.os, 'ubuntu') && steps.cache-steam-runtime.outputs.cache-hit != 'true'
44-
run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/0.20210610.0/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
45+
run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/${{ env.STEAMRT_SNAPSHOT }}/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
4546
- name: Install steam runtime
4647
if: startsWith(matrix.os, 'ubuntu')
4748
run: |
@@ -52,14 +53,15 @@ jobs:
5253
- name: Build on Linux
5354
if: startsWith(matrix.os, 'ubuntu')
5455
run: |
55-
schroot --chroot steamrt_scout_i386 -- cmake -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_INSTALL_PREFIX="$PWD/dist"
56+
schroot --chroot steamrt_scout_i386 -- cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_INSTALL_PREFIX="$PWD/dist"
5657
schroot --chroot steamrt_scout_i386 -- cmake --build build --target all
5758
schroot --chroot steamrt_scout_i386 -- cmake --build build --target install
5859
- name: Build on Linux with vgui
5960
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.cc, 'gcc')
6061
run: |
61-
schroot --chroot steamrt_scout_i386 -- cmake -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build-vgui -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist-vgui"
62+
schroot --chroot steamrt_scout_i386 -- cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPOLLY=ON -B build-vgui -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist-vgui"
6263
cp vgui_support/vgui-dev/lib/vgui.so build-vgui/cl_dll
64+
cp vgui_support/vgui-dev/lib/vgui.so build-vgui
6365
schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target all
6466
schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target install
6567

.github/workflows/manual.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
options:
1616
- 'OFF'
1717
- 'ON'
18+
steamrt_snapshot:
19+
type: string
20+
description: SteamRT Snapshot
21+
default: 'latest-steam-client-general-availability'
1822
jobs:
1923
build:
2024
runs-on: ${{ matrix.os }}
@@ -48,10 +52,10 @@ jobs:
4852
uses: actions/cache@v4
4953
with:
5054
path: com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
51-
key: ${{ runner.os }}-steam-runtime
55+
key: steam-runtime-${{ github.event.inputs.steamrt_snapshot }}
5256
- name: Download steam-runtime
5357
if: startsWith(matrix.os, 'ubuntu') && steps.cache-steam-runtime.outputs.cache-hit != 'true'
54-
run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/0.20210610.0/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
58+
run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/${{ github.event.inputs.steamrt_snapshot }}/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
5559
- name: Install steam runtime
5660
if: startsWith(matrix.os, 'ubuntu')
5761
run: |
@@ -64,10 +68,11 @@ jobs:
6468
run: |
6569
mkdir -p build/cl_dll
6670
cp vgui_support/vgui-dev/lib/vgui.so build/cl_dll
71+
cp vgui_support/vgui-dev/lib/vgui.so build
6772
- name: Build on Linux
6873
if: startsWith(matrix.os, 'ubuntu')
6974
run: |
70-
schroot --chroot steamrt_scout_i386 -- cmake -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_BUILD_TYPE=${{ github.event.inputs.buildtype }} -DCMAKE_INSTALL_PREFIX="$PWD/dist" -DUSE_VGUI=${{ github.event.inputs.usevgui }}
75+
schroot --chroot steamrt_scout_i386 -- cmake -GNinja -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DCMAKE_BUILD_TYPE=${{ github.event.inputs.buildtype }} -DCMAKE_INSTALL_PREFIX="$PWD/dist" -DUSE_VGUI=${{ github.event.inputs.usevgui }}
7176
schroot --chroot steamrt_scout_i386 -- cmake --build build --target all
7277
schroot --chroot steamrt_scout_i386 -- cmake --build build --target install
7378
@@ -93,11 +98,6 @@ jobs:
9398
run: |
9499
copy build/cl_dll/Debug/client.pdb dist/${{ steps.extract_gamedir.outputs.gamedir }}/cl_dlls/
95100
copy build/dlls/Debug/hl.pdb dist/${{ steps.extract_gamedir.outputs.gamedir }}/dlls/
96-
- name: Delete .lib files from dist
97-
if: startsWith(matrix.os, 'windows')
98-
run: |
99-
Remove-Item -Force -Path dist/${{ steps.extract_gamedir.outputs.gamedir }}/cl_dlls/client.lib
100-
Remove-Item -Force -Path dist/${{ steps.extract_gamedir.outputs.gamedir }}/dlls/hl.lib
101101
- name: Upload linux artifact
102102
if: startsWith(matrix.os, 'ubuntu')
103103
uses: actions/upload-artifact@v4

cl_dll/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,14 @@ if(HAVE_LTO)
230230
endif()
231231

232232
install( TARGETS ${CLDLL_LIBRARY}
233-
DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
233+
RUNTIME DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
234+
LIBRARY DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
234235
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
235236
GROUP_READ GROUP_EXECUTE
236237
WORLD_READ WORLD_EXECUTE )
237238

238-
add_custom_command(TARGET ${CLDLL_LIBRARY}
239+
if(CMAKE_BUILD_TYPE MATCHES "Release")
240+
add_custom_command(TARGET ${CLDLL_LIBRARY}
239241
POST_BUILD DEPENDS ${CLDLL_LIBRARY}
240-
COMMAND $<$<CONFIG:release>:${CMAKE_STRIP}> -s $<TARGET_FILE:${CLDLL_LIBRARY}>)
242+
COMMAND ${CMAKE_STRIP} -s $<TARGET_FILE:${CLDLL_LIBRARY}>)
243+
endif()

cl_dll/ammo.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,9 @@ int CHudAmmo::MsgFunc_WeaponList( const char *pszName, int iSize, void *pbuf )
647647

648648
WEAPON Weapon;
649649

650-
strcpy( Weapon.szName, READ_STRING() );
650+
strncpy( Weapon.szName, READ_STRING(), sizeof(Weapon.szName) );
651+
Weapon.szName[sizeof(Weapon.szName) - 1] = '\0';
652+
651653
Weapon.iAmmoType = (int)READ_CHAR();
652654

653655
Weapon.iMax1 = READ_BYTE();
@@ -665,6 +667,21 @@ int CHudAmmo::MsgFunc_WeaponList( const char *pszName, int iSize, void *pbuf )
665667
Weapon.iFlags = READ_BYTE();
666668
Weapon.iClip = 0;
667669

670+
if( Weapon.iId < 0 || Weapon.iId >= MAX_WEAPONS )
671+
return 0;
672+
if( Weapon.iSlot < 0 || Weapon.iSlot >= MAX_WEAPON_SLOTS + 1 )
673+
return 0;
674+
if( Weapon.iSlotPos < 0 || Weapon.iSlotPos >= MAX_WEAPON_POSITIONS + 1 )
675+
return 0;
676+
if( Weapon.iAmmoType < -1 || Weapon.iAmmoType >= MAX_AMMO_TYPES )
677+
return 0;
678+
if( Weapon.iAmmo2Type < -1 || Weapon.iAmmo2Type >= MAX_AMMO_TYPES )
679+
return 0;
680+
if( Weapon.iAmmoType >= 0 && Weapon.iMax1 == 0 )
681+
return 0;
682+
if( Weapon.iAmmo2Type >= 0 && Weapon.iMax2 == 0 )
683+
return 0;
684+
668685
gWR.AddWeapon( &Weapon );
669686

670687
return 1;
@@ -1175,7 +1192,7 @@ client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz, int iRe
11751192

11761193
while( i-- )
11771194
{
1178-
if( ( !strcmp( psz, p->szName ) ) && ( p->iRes == iRes ) )
1195+
if( p->iRes == iRes && !strcmp( psz, p->szName ))
11791196
return p;
11801197
p++;
11811198
}

cl_dll/cl_util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int fl
7171
// Use this to set any co-ords in 640x480 space
7272
#define XRES(x) ( (int)( float(x) * ( (float)ScreenWidth / 640.0f ) + 0.5f ) )
7373
#define YRES(y) ( (int)( float(y) * ( (float)ScreenHeight / 480.0f ) + 0.5f ) )
74+
#define XRES_HD(x) ( (int)( float(x) * Q_max(1.f, (float)ScreenWidth / 1280.f )))
75+
#define YRES_HD(y) ( (int)( float(y) * Q_max(1.f, (float)ScreenHeight / 720.f )))
7476

7577
// use this to project world coordinates to screen coordinates
7678
#define XPROJECT(x) ( ( 1.0f + (x) ) * ScreenWidth * 0.5f )

cl_dll/death.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ int CHudDeathNotice::Draw( float flTime )
9696
{
9797
int x, y, r, g, b;
9898

99+
int gap = 20;
100+
101+
const wrect_t& sprite = gHUD.GetSpriteRect(m_HUD_d_skull);
102+
gap = sprite.bottom - sprite.top;
103+
104+
SCREENINFO screenInfo;
105+
106+
screenInfo.iSize = sizeof(SCREENINFO);
107+
gEngfuncs.pfnGetScreenInfo(&screenInfo);
108+
gap = Q_max( gap, screenInfo.iCharHeight );
109+
99110
for( int i = 0; i < MAX_DEATHNOTICES; i++ )
100111
{
101112
if( rgDeathNoticeList[i].iId == 0 )
@@ -119,10 +130,10 @@ int CHudDeathNotice::Draw( float flTime )
119130
#endif
120131
{
121132
// Draw the death notice
122-
y = YRES( DEATHNOTICE_TOP ) + 2 + ( 20 * i ); //!!!
133+
y = YRES( DEATHNOTICE_TOP ) + 2 + ( gap * i ); //!!!
123134

124135
int id = ( rgDeathNoticeList[i].iId == -1 ) ? m_HUD_d_skull : rgDeathNoticeList[i].iId;
125-
x = ScreenWidth - ConsoleStringLen( rgDeathNoticeList[i].szVictim ) - ( gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left );
136+
x = ScreenWidth - ConsoleStringLen( rgDeathNoticeList[i].szVictim ) - ( gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left ) - 4;
126137

127138
if( !rgDeathNoticeList[i].iSuicide )
128139
{
@@ -131,7 +142,7 @@ int CHudDeathNotice::Draw( float flTime )
131142
// Draw killers name
132143
if( rgDeathNoticeList[i].KillerColor )
133144
DrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] );
134-
x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller );
145+
x = 5 + DrawConsoleString( x, y + 4, rgDeathNoticeList[i].szKiller );
135146
}
136147

137148
r = 255; g = 80; b = 0;
@@ -151,7 +162,7 @@ int CHudDeathNotice::Draw( float flTime )
151162
{
152163
if( rgDeathNoticeList[i].VictimColor )
153164
DrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] );
154-
x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim );
165+
x = DrawConsoleString( x, y + 4, rgDeathNoticeList[i].szVictim );
155166
}
156167
}
157168
}

cl_dll/hud_spectator.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ void UTIL_StringToVector( float * pVector, const char *pString )
218218
char *pstr, *pfront, tempString[128];
219219
int j;
220220

221-
strcpy( tempString, pString );
221+
strncpy( tempString, pString, sizeof( tempString ) );
222+
tempString[sizeof( tempString ) - 1] = '\0';
223+
222224
pstr = pfront = tempString;
223225

224226
for( j = 0; j < 3; j++ )
@@ -655,10 +657,10 @@ int CHudSpectator::Draw( float flTime )
655657
// check if name would be in inset window
656658
if( m_pip->value != INSET_OFF )
657659
{
658-
if( m_vPlayerPos[i][0] > XRES( m_OverviewData.insetWindowX ) &&
659-
m_vPlayerPos[i][1] > YRES( m_OverviewData.insetWindowY ) &&
660-
m_vPlayerPos[i][0] < XRES( m_OverviewData.insetWindowX + m_OverviewData.insetWindowWidth ) &&
661-
m_vPlayerPos[i][1] < YRES( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight) )
660+
if( m_vPlayerPos[i][0] > XRES_HD( m_OverviewData.insetWindowX ) &&
661+
m_vPlayerPos[i][1] > YRES_HD( m_OverviewData.insetWindowY ) &&
662+
m_vPlayerPos[i][0] < XRES_HD( m_OverviewData.insetWindowX + m_OverviewData.insetWindowWidth ) &&
663+
m_vPlayerPos[i][1] < YRES_HD( m_OverviewData.insetWindowY + m_OverviewData.insetWindowHeight) )
662664
continue;
663665
}
664666

@@ -725,9 +727,9 @@ void CHudSpectator::DirectorMessage( int iSize, void *pbuf )
725727
v1[1] = READ_COORD();
726728
v1[2] = READ_COORD(); // vJumpOrigin
727729

728-
v1[0] = READ_COORD(); // view angle
729-
v1[1] = READ_COORD(); // vJumpAngles
730-
v1[2] = READ_COORD();
730+
v2[0] = READ_COORD(); // view angle
731+
v2[1] = READ_COORD(); // vJumpAngles
732+
v2[2] = READ_COORD();
731733

732734
f1 = READ_BYTE(); // fov
733735
i1 = READ_WORD(); // target

cl_dll/input_goldsource.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,7 @@ void GoldSourceInput::IN_Init (void)
15921592
{
15931593
ignoreNextDelta = false;
15941594
m_filter = gEngfuncs.pfnRegisterVariable ( "m_filter","0", FCVAR_ARCHIVE );
1595-
sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE ); // user mouse sensitivity setting.
1595+
sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE | FCVAR_FILTERSTUFFTEXT ); // user mouse sensitivity setting.
15961596

15971597
in_joystick = gEngfuncs.pfnRegisterVariable ( "joystick","0", FCVAR_ARCHIVE );
15981598
joy_name = gEngfuncs.pfnRegisterVariable ( "joyname", "joystick", 0 );
@@ -1614,6 +1614,11 @@ void GoldSourceInput::IN_Init (void)
16141614
joy_wwhack1 = gEngfuncs.pfnRegisterVariable ( "joywwhack1", "0.0", 0 );
16151615
joy_wwhack2 = gEngfuncs.pfnRegisterVariable ( "joywwhack2", "0.0", 0 );
16161616

1617+
// HL25 checks this cvar and if it doesn't exist or set to zero
1618+
// it will lock any usage of gamepads
1619+
// see: https://github.com/ValveSoftware/halflife/issues/3621
1620+
gEngfuncs.pfnRegisterVariable( "joysupported", "1", 0 );
1621+
16171622
m_customaccel = gEngfuncs.pfnRegisterVariable ( "m_customaccel", "0", FCVAR_ARCHIVE );
16181623
m_customaccel_scale = gEngfuncs.pfnRegisterVariable ( "m_customaccel_scale", "0.04", FCVAR_ARCHIVE );
16191624
m_customaccel_max = gEngfuncs.pfnRegisterVariable ( "m_customaccel_max", "0", FCVAR_ARCHIVE );

cl_dll/input_xash3d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ void FWGSInput::IN_Shutdown( void )
280280
// Register cvars and reset data
281281
void FWGSInput::IN_Init( void )
282282
{
283-
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE );
283+
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE | FCVAR_FILTERSTUFFTEXT );
284284
in_joystick = gEngfuncs.pfnRegisterVariable( "joystick", "0", FCVAR_ARCHIVE );
285285
cl_laddermode = gEngfuncs.pfnRegisterVariable( "cl_laddermode", "2", FCVAR_ARCHIVE );
286286
ac_forwardmove = ac_sidemove = rel_yaw = rel_pitch = 0;

cl_dll/menu.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ void CHudMenu::InitHUDData( void )
5151
{
5252
m_fMenuDisplayed = 0;
5353
m_bitsValidSlots = 0;
54+
m_iFlags &= ~HUD_ACTIVE;
5455
Reset();
5556
}
5657

@@ -87,6 +88,11 @@ int CHudMenu::Draw( float flTime )
8788
return 1;
8889
#endif
8990

91+
SCREENINFO screenInfo;
92+
93+
screenInfo.iSize = sizeof( SCREENINFO );
94+
gEngfuncs.pfnGetScreenInfo( &screenInfo );
95+
9096
// draw the menu, along the left-hand side of the screen
9197
// count the number of newlines
9298
int nlc = 0;
@@ -96,15 +102,17 @@ int CHudMenu::Draw( float flTime )
96102
nlc++;
97103
}
98104

105+
int nFontHeight = Q_max(12, screenInfo.iCharHeight);
106+
99107
// center it
100-
int y = ( ScreenHeight / 2 ) - ( ( nlc / 2 ) * 12 ) - 40; // make sure it is above the say text
108+
int y = ( ScreenHeight / 2 ) - ( ( nlc / 2 ) * nFontHeight ) - (3 * nFontHeight + nFontHeight / 3); // make sure it is above the say text
101109
int x = 20;
102110

103111
i = 0;
104112
while( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' )
105113
{
106114
gHUD.DrawHudString( x, y, 320, g_szMenuString + i, 255, 255, 255 );
107-
y += 12;
115+
y += nFontHeight;
108116

109117
while( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' && g_szMenuString[i] != '\n' )
110118
i++;

0 commit comments

Comments
 (0)