Skip to content

Commit

Permalink
Merge pull request #493 from FreeSlave/sohl1.2-merge
Browse files Browse the repository at this point in the history
Merge sohl1.2 branch upon latest master
  • Loading branch information
nekonomicon authored Dec 21, 2024
2 parents 6c9e104 + 18e2ff7 commit 9be3a5c
Show file tree
Hide file tree
Showing 43 changed files with 333 additions and 156 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
STEAMRT_SNAPSHOT: latest-steam-client-general-availability
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -38,10 +39,10 @@ jobs:
uses: actions/cache@v4
with:
path: com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
key: ${{ runner.os }}-steam-runtime
key: steam-runtime-${{ env.STEAMRT_SNAPSHOT }}
- name: Download steam-runtime
if: startsWith(matrix.os, 'ubuntu') && steps.cache-steam-runtime.outputs.cache-hit != 'true'
run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/0.20210610.0/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/${{ env.STEAMRT_SNAPSHOT }}/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
- name: Install steam runtime
if: startsWith(matrix.os, 'ubuntu')
run: |
Expand All @@ -52,14 +53,15 @@ jobs:
- name: Build on Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
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"
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"
schroot --chroot steamrt_scout_i386 -- cmake --build build --target all
schroot --chroot steamrt_scout_i386 -- cmake --build build --target install
- name: Build on Linux with vgui
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.cc, 'gcc')
run: |
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"
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"
cp vgui_support/vgui-dev/lib/vgui.so build-vgui/cl_dll
cp vgui_support/vgui-dev/lib/vgui.so build-vgui
schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target all
schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target install
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
options:
- 'OFF'
- 'ON'
steamrt_snapshot:
type: string
description: SteamRT Snapshot
default: 'latest-steam-client-general-availability'
jobs:
build:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -48,10 +52,10 @@ jobs:
uses: actions/cache@v4
with:
path: com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
key: ${{ runner.os }}-steam-runtime
key: steam-runtime-${{ github.event.inputs.steamrt_snapshot }}
- name: Download steam-runtime
if: startsWith(matrix.os, 'ubuntu') && steps.cache-steam-runtime.outputs.cache-hit != 'true'
run: wget --no-verbose https://repo.steampowered.com/steamrt-images-scout/snapshots/0.20210610.0/com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz
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
- name: Install steam runtime
if: startsWith(matrix.os, 'ubuntu')
run: |
Expand All @@ -64,10 +68,11 @@ jobs:
run: |
mkdir -p build/cl_dll
cp vgui_support/vgui-dev/lib/vgui.so build/cl_dll
cp vgui_support/vgui-dev/lib/vgui.so build
- name: Build on Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
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 }}
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 }}
schroot --chroot steamrt_scout_i386 -- cmake --build build --target all
schroot --chroot steamrt_scout_i386 -- cmake --build build --target install
Expand All @@ -93,11 +98,6 @@ jobs:
run: |
copy build/cl_dll/Debug/client.pdb dist/${{ steps.extract_gamedir.outputs.gamedir }}/cl_dlls/
copy build/dlls/Debug/hl.pdb dist/${{ steps.extract_gamedir.outputs.gamedir }}/dlls/
- name: Delete .lib files from dist
if: startsWith(matrix.os, 'windows')
run: |
Remove-Item -Force -Path dist/${{ steps.extract_gamedir.outputs.gamedir }}/cl_dlls/client.lib
Remove-Item -Force -Path dist/${{ steps.extract_gamedir.outputs.gamedir }}/dlls/hl.lib
- name: Upload linux artifact
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v4
Expand Down
9 changes: 6 additions & 3 deletions cl_dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,14 @@ if(HAVE_LTO)
endif()

install( TARGETS ${CLDLL_LIBRARY}
DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
RUNTIME DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
LIBRARY DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE )

add_custom_command(TARGET ${CLDLL_LIBRARY}
if(CMAKE_BUILD_TYPE MATCHES "Release")
add_custom_command(TARGET ${CLDLL_LIBRARY}
POST_BUILD DEPENDS ${CLDLL_LIBRARY}
COMMAND $<$<CONFIG:release>:${CMAKE_STRIP}> -s $<TARGET_FILE:${CLDLL_LIBRARY}>)
COMMAND ${CMAKE_STRIP} -s $<TARGET_FILE:${CLDLL_LIBRARY}>)
endif()
21 changes: 19 additions & 2 deletions cl_dll/ammo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,9 @@ int CHudAmmo::MsgFunc_WeaponList( const char *pszName, int iSize, void *pbuf )

WEAPON Weapon;

strcpy( Weapon.szName, READ_STRING() );
strncpy( Weapon.szName, READ_STRING(), sizeof(Weapon.szName) );
Weapon.szName[sizeof(Weapon.szName) - 1] = '\0';

Weapon.iAmmoType = (int)READ_CHAR();

Weapon.iMax1 = READ_BYTE();
Expand All @@ -679,6 +681,21 @@ int CHudAmmo::MsgFunc_WeaponList( const char *pszName, int iSize, void *pbuf )
Weapon.iFlags = READ_BYTE();
Weapon.iClip = 0;

if( Weapon.iId < 0 || Weapon.iId >= MAX_WEAPONS )
return 0;
if( Weapon.iSlot < 0 || Weapon.iSlot >= MAX_WEAPON_SLOTS + 1 )
return 0;
if( Weapon.iSlotPos < 0 || Weapon.iSlotPos >= MAX_WEAPON_POSITIONS + 1 )
return 0;
if( Weapon.iAmmoType < -1 || Weapon.iAmmoType >= MAX_AMMO_TYPES )
return 0;
if( Weapon.iAmmo2Type < -1 || Weapon.iAmmo2Type >= MAX_AMMO_TYPES )
return 0;
if( Weapon.iAmmoType >= 0 && Weapon.iMax1 == 0 )
return 0;
if( Weapon.iAmmo2Type >= 0 && Weapon.iMax2 == 0 )
return 0;

gWR.AddWeapon( &Weapon );

return 1;
Expand Down Expand Up @@ -1194,7 +1211,7 @@ client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz, int iRe

while( i-- )
{
if( ( !strcmp( psz, p->szName ) ) && ( p->iRes == iRes ) )
if( p->iRes == iRes && !strcmp( psz, p->szName ))
return p;
p++;
}
Expand Down
2 changes: 2 additions & 0 deletions cl_dll/cl_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int fl
// Use this to set any co-ords in 640x480 space
#define XRES(x) ( (int)( float(x) * ( (float)ScreenWidth / 640.0f ) + 0.5f ) )
#define YRES(y) ( (int)( float(y) * ( (float)ScreenHeight / 480.0f ) + 0.5f ) )
#define XRES_HD(x) ( (int)( float(x) * Q_max(1.f, (float)ScreenWidth / 1280.f )))
#define YRES_HD(y) ( (int)( float(y) * Q_max(1.f, (float)ScreenHeight / 720.f )))

// use this to project world coordinates to screen coordinates
#define XPROJECT(x) ( ( 1.0f + (x) ) * ScreenWidth * 0.5f )
Expand Down
19 changes: 15 additions & 4 deletions cl_dll/death.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ int CHudDeathNotice::Draw( float flTime )
{
int x, y, r, g, b;

int gap = 20;

const wrect_t& sprite = gHUD.GetSpriteRect(m_HUD_d_skull);
gap = sprite.bottom - sprite.top;

SCREENINFO screenInfo;

screenInfo.iSize = sizeof(SCREENINFO);
gEngfuncs.pfnGetScreenInfo(&screenInfo);
gap = Q_max( gap, screenInfo.iCharHeight );

for( int i = 0; i < MAX_DEATHNOTICES; i++ )
{
if( rgDeathNoticeList[i].iId == 0 )
Expand All @@ -119,10 +130,10 @@ int CHudDeathNotice::Draw( float flTime )
#endif
{
// Draw the death notice
y = YRES( DEATHNOTICE_TOP ) + 2 + ( 20 * i ); //!!!
y = YRES( DEATHNOTICE_TOP ) + 2 + ( gap * i ); //!!!

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

if( !rgDeathNoticeList[i].iSuicide )
{
Expand All @@ -131,7 +142,7 @@ int CHudDeathNotice::Draw( float flTime )
// Draw killers name
if( rgDeathNoticeList[i].KillerColor )
DrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] );
x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller );
x = 5 + DrawConsoleString( x, y + 4, rgDeathNoticeList[i].szKiller );
}

r = 255; g = 80; b = 0;
Expand All @@ -151,7 +162,7 @@ int CHudDeathNotice::Draw( float flTime )
{
if( rgDeathNoticeList[i].VictimColor )
DrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] );
x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim );
x = DrawConsoleString( x, y + 4, rgDeathNoticeList[i].szVictim );
}
}
}
Expand Down
18 changes: 10 additions & 8 deletions cl_dll/hud_spectator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ void UTIL_StringToVector( float * pVector, const char *pString )
char *pstr, *pfront, tempString[128];
int j;

strcpy( tempString, pString );
strncpy( tempString, pString, sizeof( tempString ) );
tempString[sizeof( tempString ) - 1] = '\0';

pstr = pfront = tempString;

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

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

v1[0] = READ_COORD(); // view angle
v1[1] = READ_COORD(); // vJumpAngles
v1[2] = READ_COORD();
v2[0] = READ_COORD(); // view angle
v2[1] = READ_COORD(); // vJumpAngles
v2[2] = READ_COORD();

f1 = READ_BYTE(); // fov
i1 = READ_WORD(); // target
Expand Down
2 changes: 1 addition & 1 deletion cl_dll/input_goldsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ void GoldSourceInput::IN_Init (void)
{
ignoreNextDelta = false;
m_filter = gEngfuncs.pfnRegisterVariable ( "m_filter","0", FCVAR_ARCHIVE );
sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE ); // user mouse sensitivity setting.
sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE | FCVAR_FILTERSTUFFTEXT ); // user mouse sensitivity setting.

in_joystick = gEngfuncs.pfnRegisterVariable ( "joystick","0", FCVAR_ARCHIVE );
joy_name = gEngfuncs.pfnRegisterVariable ( "joyname", "joystick", 0 );
Expand Down
2 changes: 1 addition & 1 deletion cl_dll/input_xash3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void FWGSInput::IN_Shutdown( void )
// Register cvars and reset data
void FWGSInput::IN_Init( void )
{
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE );
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE | FCVAR_FILTERSTUFFTEXT );
in_joystick = gEngfuncs.pfnRegisterVariable( "joystick", "0", FCVAR_ARCHIVE );
cl_laddermode = gEngfuncs.pfnRegisterVariable( "cl_laddermode", "2", FCVAR_ARCHIVE );
ac_forwardmove = ac_sidemove = rel_yaw = rel_pitch = 0;
Expand Down
12 changes: 10 additions & 2 deletions cl_dll/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void CHudMenu::InitHUDData( void )
{
m_fMenuDisplayed = 0;
m_bitsValidSlots = 0;
m_iFlags &= ~HUD_ACTIVE;
Reset();
}

Expand Down Expand Up @@ -87,6 +88,11 @@ int CHudMenu::Draw( float flTime )
return 1;
#endif

SCREENINFO screenInfo;

screenInfo.iSize = sizeof( SCREENINFO );
gEngfuncs.pfnGetScreenInfo( &screenInfo );

// draw the menu, along the left-hand side of the screen
// count the number of newlines
int nlc = 0;
Expand All @@ -96,15 +102,17 @@ int CHudMenu::Draw( float flTime )
nlc++;
}

int nFontHeight = Q_max(12, screenInfo.iCharHeight);

// center it
int y = ( ScreenHeight / 2 ) - ( ( nlc / 2 ) * 12 ) - 40; // make sure it is above the say text
int y = ( ScreenHeight / 2 ) - ( ( nlc / 2 ) * nFontHeight ) - (3 * nFontHeight + nFontHeight / 3); // make sure it is above the say text
int x = 20;

i = 0;
while( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' )
{
gHUD.DrawHudString( x, y, 320, g_szMenuString + i, 255, 255, 255 );
y += 12;
y += nFontHeight;

while( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' && g_szMenuString[i] != '\n' )
i++;
Expand Down
Loading

0 comments on commit 9be3a5c

Please sign in to comment.