From 1c42a4170c603281d62d708800fe660f0e3810fe Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Fri, 8 Jul 2022 20:17:29 +0300 Subject: [PATCH 01/35] Fix drawing non-latin characters from titles.txt (#261) --- cl_dll/message.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cl_dll/message.cpp b/cl_dll/message.cpp index 29834a13..a07e85d5 100644 --- a/cl_dll/message.cpp +++ b/cl_dll/message.cpp @@ -294,7 +294,7 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time ) for( j = 0; j < m_parms.lineLength; j++ ) { - m_parms.text = pLineStart[j]; + m_parms.text = (unsigned char)pLineStart[j]; int next = m_parms.x + gHUD.m_scrinfo.charWidths[m_parms.text]; MessageScanNextChar(); From c01f154873013da409f1c31eeba5cb2e9e185e01 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Fri, 8 Jul 2022 20:17:50 +0300 Subject: [PATCH 02/35] Fix tripmine viewmodel having wrong body on first pickup (#262) --- dlls/tripmine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index 9da8b90e..7c41b3a6 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -1,4 +1,4 @@ -/*** +/*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. * @@ -483,6 +483,8 @@ void CTripmine::PrimaryAttack( void ) void CTripmine::WeaponIdle( void ) { + pev->body = 0; + if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) return; From c8c2841ab9471da8a33fb83c29f133fcadfa692b Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sat, 9 Jul 2022 23:35:57 +0300 Subject: [PATCH 03/35] Build with GoldSource input by default on Windows and Linux (#264) --- .github/workflows/.github.yml | 21 ++++++++------------- CMakeLists.txt | 3 ++- appveyor.yml | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/.github.yml b/.github/workflows/.github.yml index 2795f59e..8a9d50a4 100644 --- a/.github/workflows/.github.yml +++ b/.github/workflows/.github.yml @@ -49,21 +49,16 @@ jobs: ./steam-runtime/setup_chroot.sh --i386 --tarball ./com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz sudo sed -i 's/groups=sudo/groups=adm/g' /etc/schroot/chroot.d/steamrt_scout_i386.conf - - name: Build with xash3d-fwgs input + - name: Build on Linux if: startsWith(matrix.os, 'ubuntu') run: | - schroot --chroot steamrt_scout_i386 -- cmake -B build-fwgs -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" - schroot --chroot steamrt_scout_i386 -- cmake --build build-fwgs --target all - - name: Build with goldsource input - if: startsWith(matrix.os, 'ubuntu') - run: | - schroot --chroot steamrt_scout_i386 -- cmake -B build -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist" + schroot --chroot steamrt_scout_i386 -- cmake -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 with goldsource input and vgui + - name: Build on Linux with vgui if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.cc, 'gcc') run: | - schroot --chroot steamrt_scout_i386 -- cmake -B build-vgui -S . -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DGOLDSOURCE_SUPPORT=ON -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="$PWD/dist-vgui" + schroot --chroot steamrt_scout_i386 -- cmake -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 schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target all schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target install @@ -78,15 +73,15 @@ jobs: - name: Add msbuild to PATH if: startsWith(matrix.os, 'windows') uses: microsoft/setup-msbuild@v1.0.2 - - name: Build with msvc + - name: Build on Windows if: startsWith(matrix.os, 'windows') run: | - cmake -G "Visual Studio 16 2019" -A Win32 -B build -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="dist" + cmake -G "Visual Studio 16 2019" -A Win32 -B build -DCMAKE_INSTALL_PREFIX="dist" msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj - - name: Build with msvc and vgui + - name: Build on Windows with vgui if: startsWith(matrix.os, 'windows') run: | - cmake -G "Visual Studio 16 2019" -A Win32 -B build -DGOLDSOURCE_SUPPORT=ON -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="dist-vgui" + cmake -G "Visual Studio 16 2019" -A Win32 -B build -DUSE_VGUI=ON -DCMAKE_INSTALL_PREFIX="dist-vgui" msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj - name: Extract branch name diff --git a/CMakeLists.txt b/CMakeLists.txt index 489b84de..75372379 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,6 @@ option(USE_NOVGUI_SCOREBOARD "Prefer non-VGUI Scoreboard when USE_VGUI is enable option(USE_VOICEMGR "Enable VOICE MANAGER." OFF) option(BUILD_CLIENT "Build client dll" ON) option(BUILD_SERVER "Build server dll" ON) -option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF) if (CMAKE_SIZEOF_VOID_P EQUAL 4 OR ((WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") @@ -53,8 +52,10 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 4 OR OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64"))) option(64BIT "Disable auto -m32 appending to compiler flags" OFF) + option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" ON) else() option(64BIT "Disable auto -m32 appending to compiler flags" ON) + option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF) endif() option(BARNACLE_FIX_VISIBILITY "Enable barnacle tongue length fix" OFF) diff --git a/appveyor.yml b/appveyor.yml index 6616ee57..75269482 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,7 +20,7 @@ configuration: before_build: - git submodule update --init --recursive - - cmake -G "%GENERATOR_NAME%" -B build -DGOLDSOURCE_SUPPORT=ON -DCMAKE_INSTALL_PREFIX="dist" + - cmake -G "%GENERATOR_NAME%" -B build -DCMAKE_INSTALL_PREFIX="dist" artifacts: - path: dist From 7e8dec0c036ca6c02aad57f2c3516e07a78ae0e4 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sun, 10 Jul 2022 01:39:26 +0300 Subject: [PATCH 04/35] Update README.me with better build instructions (#266) --- README.md | 247 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 170 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 32d4fc05..96b16e40 100644 --- a/README.md +++ b/README.md @@ -1,140 +1,233 @@ -# Half-Life SDK for Xash3D [![Build Status](https://github.com/FWGS/hlsdk-xash3d/actions/workflows/.github.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-xash3d/actions/workflows/.github.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-xash3d?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-xash3d) +# Half-Life SDK for GoldSource and Xash3D [![Build Status](https://github.com/FWGS/hlsdk-xash3d/actions/workflows/.github.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-xash3d/actions/workflows/.github.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-xash3d?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-xash3d) -Half-Life SDK for Xash3D & GoldSource with some fixes. +Half-Life SDK for GoldSource & Xash3D with some bugfixes. -## How to build +# Obtaining source code -### CMake as most universal way +Either clone the repository via [git](`https://git-scm.com/downloads`) or just download ZIP via **Code** button on github. The first option is more preferable as it also allows you to search through the repo history, switch between branches and clone the vgui submodule. - mkdir build && cd build - cmake ../ - make +To clone the repository with git type in Git Bash (on Windows) or in terminal (on Unix-like operating systems): -Crosscompiling using mingw: - - mkdir build-mingw && cd build-mingw - TOOLCHAIN_PREFIX=i686-w64-mingw32 # check up the actual mingw prefix of your mingw installation - cmake ../ -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="$TOOLCHAIN_PREFIX-gcc" -DCMAKE_CXX_COMPILER="$TOOLCHAIN_PREFIX-g++" +``` +git clone --recursive https://github.com/FWGS/hlsdk-xash3d +``` -You may enable or disable some build options by -Dkey=value. All available build options are defined in CMakeLists.txt at root directory. -See below if you want to build the GoldSource compatible libraries. +# Build Instructions -See below, if CMake is not suitable for you: +## Windows. Using Developer Command Propmt for Visual Studio -### Windows +### Prerequisites -#### Using msvc +Install and run [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/). The installer allows you to choose specific components. Select `Desktop development with C++`. You can untick everything you don't need in Installation details, but you must keep `MSVC` and `C++ CMake tools for Windows` ticked. -We use compilers provided with Microsoft Visual Studio 6. There're `compile.bat` scripts in both `cl_dll` and `dlls` directories. -Before running any of those files you must define `MSVCDir` variable which is the path to your msvc installation. +### Building - set MSVCDir=C:\Program Files\Microsoft Visual Studio - compile.bat +Run `Developer command prompt for VS` via Windows `Start` menu. Inside the prompt navigate to the hlsdk directory, using `cd` command, e.g. +``` +cd C:\Users\username\projects\hlsdk-xash3d +``` -These scripts also can be ran via wine: +Note: if hlsdk-xash3d is unpacked on another disk, nagivate there first: +``` +D: +cd projects\hlsdk-xash3d +``` - MSVCDir="z:\home\$USER\.wine\drive_c\Program Files\Microsoft Visual Studio" wine cmd /c compile.bat +Сonfigure the project: +``` +cmake -A Win32 -B build -DCMAKE_INSTALL_PREFIX="dist" +``` +Once you configure the project you don't need to call `cmake` anymore unless you modify `CMakeLists.txt` files or want to reconfigure the project with different parameters. -The libraries built this way are always GoldSource compatible. +The next step is to compile the libraries: +``` +msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj +``` +`hl.dll` and `client.dll` will appear in the directory configured via **CMAKE_INSTALL_PREFIX** option (**dist** in this example). -#### Using mingw +If you have a mod and want to automatically install libraries to the mod directory, set **GAMEDIR** variable to the directory name and **CMAKE_INSTALL_PREFIX** to your Half-Life or Xash3D installation path: +``` +cmake -A Win32 -B build -DGAMEDIR=mod -DCMAKE_INSTALL_PREFIX="C:\Program Files (x86)\Steam\steamapps\common\Half-Life" +``` +Then call `msbuild` as described above. -TODO +#### Choosing Visual Studio version -### Unix-like +You can explicitly choose a Visual Studio version on the configuration step by specifying cmake generator: +``` +cmake -G "Visual Studio 16 2019" -A Win32 -B build -DCMAKE_INSTALL_PREFIX="dist" +``` -To use waf, you need to install python (2.7 minimum) +### Editing code in Visual Studio - (./waf configure -T release) - (./waf) +After the configuration step, `HLSDK-XASH3D.sln` should appear in the `build` directory. You can open this solution in Visual Studio and continue developing there. -### Android +## Windows. Using Microsoft Visual Studio 6 -Just typical `ndk-build`. -TODO: describe what it is. +Microsoft Visual Studio 6 is very old, but if you still have it installed, you can use it to build this hlsdk. There are no project files, but two `.bat` files, for server and client libraries. They require variable **MSVCDir** to be set to the installation path of Visual Studio: -### Building GoldSource-compatible libraries +``` +set MSVCDir=C:\Program Files\Microsoft Visual Studio +cd dlls && compile.bat && cd ../cl_dll && compile.bat +``` -To enable building the goldsource compatible client library add GOLDSOURCE_SUPPORT flag when calling cmake: +`hl.dll` and `client.dll` will appear in `dlls/` and `cl_dll/` diretories. The libraries built with msvc6 should be compatible with Windows XP. - cmake .. -DGOLDSOURCE_SUPPORT=ON +## Linux. Using Steam Runtime in chroot -or when using waf: +### Prerequisites - ./waf configure -T release --enable-goldsrc-support +The official way to build Steam compatible games for Linux is through steam-runtime. -Unlike original client by Valve the resulting client library will not depend on vgui or SDL2 just like the one that's used in FWGS Xash3d. +Install schroot. On Ubuntu or Debian: -Note for **Windows**: it's not possible to create GoldSource compatible libraries using mingw, only msvc builds will work. +``` +sudo apt install schroot +``` -Note for **Linux**: GoldSource requires libraries (both client and server) to be compiled with libstdc++ bundled with g++ of major version 4 (versions from 4.6 to 4.9 should work). -If your Linux distribution does not provide compatible g++ version you have several options. +Clone https://github.com/ValveSoftware/steam-runtime and follow instructions: [download](https://github.com/ValveSoftware/steam-runtime/blob/e014a74f60b45a861d38a867b1c81efe8484f77a/README.md#downloading-a-steam-runtime) and [setup](https://github.com/ValveSoftware/steam-runtime/blob/e014a74f60b45a861d38a867b1c81efe8484f77a/README.md#using-schroot) the chroot. -#### Method 1: Statically build with c++ library +``` +sudo ./setup_chroot.sh --i386 --tarball ./com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz +``` -This one is the most simple but has a drawback. +### Building - cmake ../ -DGOLDSOURCE_SUPPORT=ON -DCMAKE_C_FLAGS="-static-libstdc++ -static-libgcc" +Now you can use cmake and make prepending the commands with `schroot --chroot steamrt_scout_i386 --`: +``` +mkdir build-in-steamrt && cd build-in-steamrt +schroot --chroot steamrt_scout_i386 -- cmake .. +schroot --chroot steamrt_scout_i386 -- make +``` -The drawback is that the compiled libraries will be larger in size. +## Linux. Build without Steam Runtime -#### Method 2: Build in Steam Runtime chroot +### Prerequisites -This is the official way to build Steam compatible games for Linux. +Install C++ compilers, cmake and x86 development libraries for C, C++ and SDL2. On Ubuntu/Debian: +``` +sudo apt install cmake build-essential gcc-multilib g++-multilib libsdl2-dev:i386 +``` -Clone https://github.com/ValveSoftware/steam-runtime and follow instructions https://github.com/ValveSoftware/steam-runtime#building-in-the-runtime +### Building - sudo ./setup_chroot.sh --i386 +``` +mkdir build && cd build +cmake .. +make +``` -Then use cmake and make as usual, but prepend the commands with `schroot --chroot steamrt_scout_i386 --`: +Note that the libraries built this way might be not compatible with Steam Half-Life. If you have such issue you can configure it to build statically with c++ and gcc libraries: +``` +cmake .. -DCMAKE_C_FLAGS="-static-libstdc++ -static-libgcc" +``` +To ensure portability it's still better to build using Steam Runtime or another chroot of some older distro. - mkdir build-in-steamrt && cd build-in-steamrt - schroot --chroot steamrt_scout_i386 -- cmake ../ -DGOLDSOURCE_SUPPORT=ON - schroot --chroot steamrt_scout_i386 -- make +## Linux. Build in your own chroot -#### Method 3: Create your own chroot with older distro that includes g++ 4. +### Prerequisites -Use the most suitable way for you to create an old distro 32-bit chroot. E.g. on Debian (and similar) you can use debootstrap. +Use the most suitable way for you to create an old distro 32-bit chroot. E.g. on Ubuntu/Debian you can use debootstrap. - sudo debootstrap --arch=i386 jessie /var/chroot/jessie-debian-i386 # On Ubuntu type trusty instead of jessie - sudo chroot /var/chroot/jessie-debian-i386 +``` +sudo apt install debootstrap schroot +sudo mkdir -p /var/choots +sudo debootstrap --arch=i386 jessie /var/chroots/jessie-i386 # On Ubuntu type trusty instead of jessie +sudo chroot /var/chroots/jessie-i386 +``` -Inside chroot install cmake, make, g++ and libsdl2-dev. Then exit the chroot. +``` +# inside chroot +apt install cmake build-essential gcc-multilib g++-multilib libsdl2-dev +exit +``` -On the host system install schroot. Then create and adapt the following config in /etc/schroot/chroot.d/jessie.conf (you can choose a different name): +Create and adapt the following config in /etc/schroot/chroot.d/jessie.conf (you can choose a different name): ``` [jessie] type=directory description=Debian jessie i386 -directory=/var/chroot/debian-jessie-i386/ +directory=/var/chroots/jessie-i386/ users=yourusername -groups=yourusername +groups=adm root-groups=root preserve-environment=true personality=linux32 ``` -Insert your actual user name in place of `yourusername`. Then prepend any make or cmake call with `schroot -c jessie --`: +Insert your actual user name in place of `yourusername`. - mkdir build-in-chroot && cd build-in-chroot - schroot --chroot jessie -- cmake ../ -DGOLDSOURCE_SUPPORT=ON - schroot --chroot jessie -- make +### Building -#### Method 4: Install the needed g++ version yourself +Prepend any make or cmake call with `schroot -c jessie --`: +``` +mkdir build-in-chroot && cd build-in-chroot +schroot --chroot jessie -- cmake .. +schroot --chroot jessie -- make +``` -TODO: describe steps. +## Linux. Crosscompiling using mingw -#### Configuring Qt Creator to use toolchain from chroot +Note that GoldSource won't work with libraries compiled with mingw. -Create a file with the following contents anywhere: +TODO: do we need this section at all? Is Xash3D-FWGS distributed with support for game libraries built with mingw? -```sh -#!/bin/sh -schroot --chroot steamrt_scout_i386 -- cmake "$@" +### Prerequisites + +Install mingw. On Ubuntu/Debian: +``` +sudo apt-get install -y mingw-w64-i686-dev binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686 +``` + +### Building + +``` +mkdir build-mingw && cd build-mingw +TOOLCHAIN_PREFIX=i686-w64-mingw32 # check up the actual mingw prefix of your mingw installation +cmake .. -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="$TOOLCHAIN_PREFIX-gcc" -DCMAKE_CXX_COMPILER="$TOOLCHAIN_PREFIX-g++" ``` -Make it executable. -In Qt Creator go to `Tools` -> `Options` -> `Build & Run` -> `CMake`. Add a new cmake tool and specify the path of previously created file. -Go to `Kits` tab, clone your default configuration and choose your CMake tool there. -Choose the new kit when opening CMakeLists.txt. +## Android + +TODO + +## Other platforms + +Building on other Unix-like platforms (e.g. FreeBSD) is supported. + +### Prerequisites + +Install C and C++ compilers (like gcc or clang), cmake and make (or gmake) + +### Building + +``` +mkdir build && cd build +cmake .. +make +``` + +### Building with waf + +To use waf, you need to install python (2.7 minimum) + +``` +(./waf configure -T release) +(./waf) +``` + +## Build options + +Some useful build options that can be set during the cmake step. + +* **GOLDSOURCE_SUPPORT** - allows to turn off/on the support for GoldSource input. Set to **ON** by default on Windows and Linux, **OFF** on other platforms. +* **USE_VGUI** - whether to use VGUI library. **OFF** by default. You need to init `vgui_support` submodule in order to build with VGUI. + +This list is incomplete. Look at `CMakeLists.txt` to see all available options. + +Prepend option names with `-D` when passing to cmake. Boolean options can take values **OFF** and **ON**. Example: + +``` +cmake .. -DUSE_VGUI=ON -DGOLDSOURCE_SUPPORT=ON -DCROWBAR_IDLE_ANIM=ON -DCROWBAR_FIX_RAPID_CROWBAR=ON +``` From 33aa1b0a10e9d60159780e69f78825101289ea97 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 10 Jul 2022 18:40:16 +0300 Subject: [PATCH 05/35] engine: add new undocumented function to server funcs --- engine/eiface.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/eiface.h b/engine/eiface.h index f7cdb095..2863319e 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -268,6 +268,9 @@ typedef struct enginefuncs_s void (*pfnQueryClientCvarValue)( const edict_t *player, const char *cvarName ); void (*pfnQueryClientCvarValue2)( const edict_t *player, const char *cvarName, int requestID ); int (*CheckParm)( char *parm, char **ppnext ); + + // added in 8279 + edict_t* (*pfnPEntityOfEntIndexAllEntities)( int iEntIndex ); } enginefuncs_t; // ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138 From 468780d9979d84ea020589d018e9075839e08e71 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 10 Jul 2022 18:49:03 +0300 Subject: [PATCH 06/35] wscript: sync with cmake, enable goldsrc support by default --- wscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wscript b/wscript index 336e8d34..46017809 100644 --- a/wscript +++ b/wscript @@ -28,8 +28,8 @@ def options(opt): grp.add_option('--enable-voicemgr', action = 'store_true', dest = 'VOICEMGR', default = False, help = 'enable voice manager [default: %default]') - grp.add_option('--enable-goldsrc-support', action = 'store_true', dest = 'GOLDSRC', default = False, - help = 'enable GoldSource engine support [default: %default]') + grp.add_option('--disable-goldsrc-support', action = 'store_false', dest = 'GOLDSRC', default = True, + help = 'disable GoldSource engine support [default: %default]') opt.load('compiler_optimizations subproject') From 5a68ce08bc16c3ad04bd068a501d07b3f540aca7 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Mon, 11 Jul 2022 23:36:25 +0300 Subject: [PATCH 07/35] Add TRIPMINE_BEAM_DUPLICATION_FIX macros for fixing beam duplication on level transition (#272) --- CMakeLists.txt | 6 ++++++ dlls/tripmine.cpp | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75372379..ab6a1872 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ option(CROWBAR_IDLE_ANIM "Enable crowbar idle animation" OFF) option(CROWBAR_DELAY_FIX "Enable crowbar attack delay fix" OFF) option(CROWBAR_FIX_RAPID_CROWBAR "Enable rapid crowbar fix" OFF) option(GAUSS_OVERCHARGE_FIX "Enable gauss overcharge fix" OFF) +option(TRIPMINE_BEAM_DUPLICATION_FIX "Enable fix of tripmine beam duplication on level transition" OFF) option(OEM_BUILD "Enable OEM Build" OFF) option(HLDEMO_BUILD "Enable Demo Build" OFF) @@ -136,6 +137,11 @@ if(GAUSS_OVERCHARGE_FIX) add_definitions(-DGAUSS_OVERCHARGE_FIX) endif() +if(TRIPMINE_BEAM_DUPLICATION_FIX) + message(STATUS "Tripmine beam duplication fix enabled") + add_definitions(-DTRIPMINE_BEAM_DUPLICATION_FIX) +endif() + if(OEM_BUILD) message(STATUS "OEM build enabled") add_definitions(-DOEM_BUILD) diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index 7c41b3a6..e9e55b67 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -82,7 +82,9 @@ TYPEDESCRIPTION CTripmineGrenade::m_SaveData[] = DEFINE_FIELD( CTripmineGrenade, m_vecEnd, FIELD_POSITION_VECTOR ), DEFINE_FIELD( CTripmineGrenade, m_flBeamLength, FIELD_FLOAT ), DEFINE_FIELD( CTripmineGrenade, m_hOwner, FIELD_EHANDLE ), +#if !TRIPMINE_BEAM_DUPLICATION_FIX DEFINE_FIELD( CTripmineGrenade, m_pBeam, FIELD_CLASSPTR ), +#endif DEFINE_FIELD( CTripmineGrenade, m_posOwner, FIELD_POSITION_VECTOR ), DEFINE_FIELD( CTripmineGrenade, m_angleOwner, FIELD_VECTOR ), DEFINE_FIELD( CTripmineGrenade, m_pRealOwner, FIELD_EDICT ), @@ -256,6 +258,9 @@ void CTripmineGrenade::MakeBeam( void ) Vector vecTmpEnd = pev->origin + m_vecDir * 2048.0f * m_flBeamLength; m_pBeam = CBeam::BeamCreate( g_pModelNameLaser, 10 ); +#if TRIPMINE_BEAM_DUPLICATION_FIX + m_pBeam->pev->spawnflags |= SF_BEAM_TEMPORARY; +#endif m_pBeam->PointEntInit( vecTmpEnd, entindex() ); m_pBeam->SetColor( 0, 214, 198 ); m_pBeam->SetScrollRate( 255 ); From 1313bb1b66d77764569bda423fadc303d9dd494f Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Mon, 18 Jul 2022 16:13:44 +0300 Subject: [PATCH 08/35] Update build instructions. Rename cmake project from HLSDK-XASH3D to HLSDK-PORTABLE (#274) --- CMakeLists.txt | 2 +- README.md | 57 ++++++++++++++++++++++++++------------------------ appveyor.yml | 2 +- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab6a1872..7342ec7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ include(CheckIncludeFile) include(CheckCSourceCompiles) include(VSForceXPToolchain) # Force XP toolchain for Visual Studio -project (HLSDK-XASH3D) +project (HLSDK-PORTABLE) #-------------- # USER DEFINES \ diff --git a/README.md b/README.md index 96b16e40..f9335307 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Half-Life SDK for GoldSource and Xash3D [![Build Status](https://github.com/FWGS/hlsdk-xash3d/actions/workflows/.github.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-xash3d/actions/workflows/.github.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-xash3d?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-xash3d) +# Half-Life SDK for GoldSource and Xash3D [![Build Status](https://github.com/FWGS/hlsdk-portable/actions/workflows/.github.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-portable/actions/workflows/.github.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-xash3d?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-xash3d) Half-Life SDK for GoldSource & Xash3D with some bugfixes. @@ -9,58 +9,65 @@ Either clone the repository via [git](`https://git-scm.com/downloads`) or just d To clone the repository with git type in Git Bash (on Windows) or in terminal (on Unix-like operating systems): ``` -git clone --recursive https://github.com/FWGS/hlsdk-xash3d +git clone --recursive https://github.com/FWGS/hlsdk-portable ``` # Build Instructions -## Windows. Using Developer Command Propmt for Visual Studio +## Windows ### Prerequisites -Install and run [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/). The installer allows you to choose specific components. Select `Desktop development with C++`. You can untick everything you don't need in Installation details, but you must keep `MSVC` and `C++ CMake tools for Windows` ticked. +Install and run [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/). The installer allows you to choose specific components. Select `Desktop development with C++`. You can untick everything you don't need in Installation details, but you must keep `MSVC` ticked. You may also keep `C++ CMake tools for Windows` ticked as you'll need **cmake**. Alternatively you can install **cmake** from the [cmake.org](https://cmake.org/download/) and during installation tick *Add to the PATH...*. -### Building +### Opening command prompt + +If **cmake** was installed with Visual Studio Installer, you'll need to run `Developer command prompt for VS` via Windows `Start` menu. If **cmake** was installed with cmake installer, you can run the regular Windows `cmd`. -Run `Developer command prompt for VS` via Windows `Start` menu. Inside the prompt navigate to the hlsdk directory, using `cd` command, e.g. +Inside the prompt navigate to the hlsdk directory, using `cd` command, e.g. ``` -cd C:\Users\username\projects\hlsdk-xash3d +cd C:\Users\username\projects\hlsdk-portable ``` -Note: if hlsdk-xash3d is unpacked on another disk, nagivate there first: +Note: if hlsdk-portable is unpacked on another disk, nagivate there first: ``` D: -cd projects\hlsdk-xash3d +cd projects\hlsdk-portable ``` +### Building + Сonfigure the project: ``` -cmake -A Win32 -B build -DCMAKE_INSTALL_PREFIX="dist" +cmake -A Win32 -B build ``` Once you configure the project you don't need to call `cmake` anymore unless you modify `CMakeLists.txt` files or want to reconfigure the project with different parameters. The next step is to compile the libraries: ``` -msbuild -verbosity:normal /property:Configuration=Release build/INSTALL.vcxproj +cmake --build build --config Release ``` -`hl.dll` and `client.dll` will appear in the directory configured via **CMAKE_INSTALL_PREFIX** option (**dist** in this example). +`hl.dll` and `client.dll` will appear in the `build/dlls/Release` and `build/cl_dll/Release` directories. If you have a mod and want to automatically install libraries to the mod directory, set **GAMEDIR** variable to the directory name and **CMAKE_INSTALL_PREFIX** to your Half-Life or Xash3D installation path: ``` cmake -A Win32 -B build -DGAMEDIR=mod -DCMAKE_INSTALL_PREFIX="C:\Program Files (x86)\Steam\steamapps\common\Half-Life" ``` -Then call `msbuild` as described above. +Then call `cmake` with `--target install` parameter: +``` +cmake --build build --config Release --target install +``` #### Choosing Visual Studio version You can explicitly choose a Visual Studio version on the configuration step by specifying cmake generator: ``` -cmake -G "Visual Studio 16 2019" -A Win32 -B build -DCMAKE_INSTALL_PREFIX="dist" +cmake -G "Visual Studio 16 2019" -A Win32 -B build ``` ### Editing code in Visual Studio -After the configuration step, `HLSDK-XASH3D.sln` should appear in the `build` directory. You can open this solution in Visual Studio and continue developing there. +After the configuration step, `HLSDK-PORTABLE.sln` should appear in the `build` directory. You can open this solution in Visual Studio and continue developing there. ## Windows. Using Microsoft Visual Studio 6 @@ -95,9 +102,8 @@ sudo ./setup_chroot.sh --i386 --tarball ./com.valvesoftware.SteamRuntime.Sdk-i38 Now you can use cmake and make prepending the commands with `schroot --chroot steamrt_scout_i386 --`: ``` -mkdir build-in-steamrt && cd build-in-steamrt -schroot --chroot steamrt_scout_i386 -- cmake .. -schroot --chroot steamrt_scout_i386 -- make +schroot --chroot steamrt_scout_i386 -- cmake -B build-in-steamrt -S . +schroot --chroot steamrt_scout_i386 -- cmake --build build-in-steamrt ``` ## Linux. Build without Steam Runtime @@ -112,9 +118,8 @@ sudo apt install cmake build-essential gcc-multilib g++-multilib libsdl2-dev:i38 ### Building ``` -mkdir build && cd build -cmake .. -make +cmake -B build -S . +cmake --build build ``` Note that the libraries built this way might be not compatible with Steam Half-Life. If you have such issue you can configure it to build statically with c++ and gcc libraries: @@ -162,9 +167,8 @@ Insert your actual user name in place of `yourusername`. Prepend any make or cmake call with `schroot -c jessie --`: ``` -mkdir build-in-chroot && cd build-in-chroot -schroot --chroot jessie -- cmake .. -schroot --chroot jessie -- make +schroot --chroot jessie -- cmake -B build-in-chroot -S . +schroot --chroot jessie -- cmake --build build-in-chroot ``` ## Linux. Crosscompiling using mingw @@ -203,9 +207,8 @@ Install C and C++ compilers (like gcc or clang), cmake and make (or gmake) ### Building ``` -mkdir build && cd build -cmake .. -make +cmake -B build -S . +cmake --build build ``` ### Building with waf diff --git a/appveyor.yml b/appveyor.yml index 75269482..044bb512 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ environment: # - os: Visual Studio 2017 # GENERATOR_NAME: "Visual Studio 15 2017" -clone_folder: c:\projects\xash\hlsdk-xash3d +clone_folder: c:\projects\xash\hlsdk-portable build: project: build/INSTALL.vcxproj From 763af2905467b6b2df87a393866340821d4074dc Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Mon, 18 Jul 2022 16:13:58 +0300 Subject: [PATCH 09/35] Add HANDGRENADE_DEPLOY_FIX macros for fixing the handgrenade deploy animation after finishing a throw (#275) --- CMakeLists.txt | 6 ++++++ dlls/handgrenade.cpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7342ec7f..7d75ade3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ option(CROWBAR_DELAY_FIX "Enable crowbar attack delay fix" OFF) option(CROWBAR_FIX_RAPID_CROWBAR "Enable rapid crowbar fix" OFF) option(GAUSS_OVERCHARGE_FIX "Enable gauss overcharge fix" OFF) option(TRIPMINE_BEAM_DUPLICATION_FIX "Enable fix of tripmine beam duplication on level transition" OFF) +option(HANDGRENADE_DEPLOY_FIX "Enable handgrenade deploy animation fix after finishing a throw" OFF) option(OEM_BUILD "Enable OEM Build" OFF) option(HLDEMO_BUILD "Enable Demo Build" OFF) @@ -142,6 +143,11 @@ if(TRIPMINE_BEAM_DUPLICATION_FIX) add_definitions(-DTRIPMINE_BEAM_DUPLICATION_FIX) endif() +if(HANDGRENADE_DEPLOY_FIX) + message(STATUS "Handgrenade deploy animation fix enabled") + add_definitions(-DHANDGRENADE_DEPLOY_FIX) +endif() + if(OEM_BUILD) message(STATUS "OEM build enabled") add_definitions(-DOEM_BUILD) diff --git a/dlls/handgrenade.cpp b/dlls/handgrenade.cpp index 0e9fde30..f9f360ec 100644 --- a/dlls/handgrenade.cpp +++ b/dlls/handgrenade.cpp @@ -173,7 +173,9 @@ void CHandGrenade::WeaponIdle( void ) // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); +#if !HANDGRENADE_DEPLOY_FIX m_flReleaseThrow = 0.0f; +#endif m_flStartThrow = 0.0f; m_flNextPrimaryAttack = GetNextAttackDelay( 0.5f ); m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f; From 12a2aeb3c14cdd52fa954eadd8f4111e296796e3 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Mon, 18 Jul 2022 22:31:56 +0300 Subject: [PATCH 10/35] Add WEAPONS_ANIMATION_TIMES_FIX macros for fixing some weapons animation times --- CMakeLists.txt | 6 ++++++ dlls/crowbar.cpp | 4 ++++ dlls/rpg.cpp | 5 ++++- dlls/satchel.cpp | 17 ++++++++++++++--- dlls/squeakgrenade.cpp | 9 ++++++++- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d75ade3..86d0a981 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ option(CROWBAR_FIX_RAPID_CROWBAR "Enable rapid crowbar fix" OFF) option(GAUSS_OVERCHARGE_FIX "Enable gauss overcharge fix" OFF) option(TRIPMINE_BEAM_DUPLICATION_FIX "Enable fix of tripmine beam duplication on level transition" OFF) option(HANDGRENADE_DEPLOY_FIX "Enable handgrenade deploy animation fix after finishing a throw" OFF) +option(WEAPONS_ANIMATION_TIMES_FIX "Enable animation times fix for some weapons" OFF) option(OEM_BUILD "Enable OEM Build" OFF) option(HLDEMO_BUILD "Enable Demo Build" OFF) @@ -148,6 +149,11 @@ if(HANDGRENADE_DEPLOY_FIX) add_definitions(-DHANDGRENADE_DEPLOY_FIX) endif() +if(WEAPONS_ANIMATION_TIMES_FIX) + message(STATUS "Weapons animation times fix enabled") + add_definitions(-DWEAPONS_ANIMATION_TIMES_FIX) +endif() + if(OEM_BUILD) message(STATUS "OEM build enabled") add_definitions(-DOEM_BUILD) diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index f1b2393b..667ebd7e 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -366,7 +366,11 @@ void CCrowbar::WeaponIdle( void ) if( flRand > 0.5f ) { iAnim = CROWBAR_IDLE; +#if WEAPONS_ANIMATION_TIMES_FIX + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 25.0f; +#else m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 30.0f; +#endif } else { diff --git a/dlls/rpg.cpp b/dlls/rpg.cpp index 65f1bd49..c81e6246 100644 --- a/dlls/rpg.cpp +++ b/dlls/rpg.cpp @@ -518,8 +518,11 @@ void CRpg::WeaponIdle( void ) iAnim = RPG_FIDGET_UL; else iAnim = RPG_FIDGET; - +#if WEAPONS_ANIMATION_TIMES_FIX + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 6.1f; +#else m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f; +#endif } SendWeaponAnim( iAnim ); diff --git a/dlls/satchel.cpp b/dlls/satchel.cpp index 528a3ba8..625a88d1 100644 --- a/dlls/satchel.cpp +++ b/dlls/satchel.cpp @@ -293,14 +293,25 @@ BOOL CSatchel::CanDeploy( void ) BOOL CSatchel::Deploy() { m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f; +#if !WEAPONS_ANIMATION_TIMES_FIX m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f ); +#endif + + BOOL result; if( m_chargeReady ) - return DefaultDeploy( "models/v_satchel_radio.mdl", "models/p_satchel_radio.mdl", SATCHEL_RADIO_DRAW, "hive" ); + result = DefaultDeploy( "models/v_satchel_radio.mdl", "models/p_satchel_radio.mdl", SATCHEL_RADIO_DRAW, "hive" ); else - return DefaultDeploy( "models/v_satchel.mdl", "models/p_satchel.mdl", SATCHEL_DRAW, "trip" ); + result = DefaultDeploy( "models/v_satchel.mdl", "models/p_satchel.mdl", SATCHEL_DRAW, "trip" ); - return TRUE; +#if WEAPONS_ANIMATION_TIMES_FIX + if ( result ) + { + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; + } +#endif + + return result; } void CSatchel::Holster( int skiplocal /* = 0 */ ) diff --git a/dlls/squeakgrenade.cpp b/dlls/squeakgrenade.cpp index 4bf2e3df..f332a5a8 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -465,7 +465,14 @@ BOOL CSqueak::Deploy() m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME; - return DefaultDeploy( "models/v_squeak.mdl", "models/p_squeak.mdl", SQUEAK_UP, "squeak" ); + const BOOL result = DefaultDeploy( "models/v_squeak.mdl", "models/p_squeak.mdl", SQUEAK_UP, "squeak" ); +#if WEAPONS_ANIMATION_TIMES_FIX + if ( result ) + { + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.7f; + } +#endif + return result; } void CSqueak::Holster( int skiplocal /* = 0 */ ) From 058626fc18d76fa1e33685c22a15993b68ef79a3 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 19 Jul 2022 12:29:32 +0300 Subject: [PATCH 11/35] Remove redundant assignment to m_flTimeWeaponIdle in CSatchel::Deploy --- dlls/satchel.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dlls/satchel.cpp b/dlls/satchel.cpp index 625a88d1..38ebec08 100644 --- a/dlls/satchel.cpp +++ b/dlls/satchel.cpp @@ -293,10 +293,6 @@ BOOL CSatchel::CanDeploy( void ) BOOL CSatchel::Deploy() { m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f; -#if !WEAPONS_ANIMATION_TIMES_FIX - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f ); -#endif - BOOL result; if( m_chargeReady ) @@ -310,7 +306,6 @@ BOOL CSatchel::Deploy() m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; } #endif - return result; } From 74f3ec7f61055e00b2f7602a8be849f4ce2aca0e Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 19 Jul 2022 12:32:51 +0300 Subject: [PATCH 12/35] Fix crowbar idle animation time regardless of WEAPONS_ANIMATION_TIMES_FIX macro --- dlls/crowbar.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index 667ebd7e..5342e7c2 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -366,11 +366,7 @@ void CCrowbar::WeaponIdle( void ) if( flRand > 0.5f ) { iAnim = CROWBAR_IDLE; -#if WEAPONS_ANIMATION_TIMES_FIX m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 25.0f; -#else - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 30.0f; -#endif } else { From 88e13e8ce1c2ed8bdaed2c56bdac9d71b480a82e Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 19 Jul 2022 13:17:59 +0300 Subject: [PATCH 13/35] readme: update appveyor links AppVeyor didn't ack'ed that we changed repository name, so it was done manually. Thanks, @FreeSlave, for pointing me at this --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f9335307..c71b303a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Half-Life SDK for GoldSource and Xash3D [![Build Status](https://github.com/FWGS/hlsdk-portable/actions/workflows/.github.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-portable/actions/workflows/.github.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-xash3d?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-xash3d) +# Half-Life SDK for GoldSource and Xash3D [![Build Status](https://github.com/FWGS/hlsdk-portable/actions/workflows/.github.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-portable/actions/workflows/.github.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-portable?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-portable) Half-Life SDK for GoldSource & Xash3D with some bugfixes. From e51878c45b618f9b3920b46357545cbb47befeda Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 19 Jul 2022 14:35:27 +0300 Subject: [PATCH 14/35] Fix alien controllers facing in idle state (#282) --- dlls/controller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/controller.cpp b/dlls/controller.cpp index 20c9a502..bfe3032e 100644 --- a/dlls/controller.cpp +++ b/dlls/controller.cpp @@ -669,8 +669,11 @@ void CController::RunTask( Task_t *pTask ) case TASK_WAIT: case TASK_WAIT_FACE_ENEMY: case TASK_WAIT_PVS: - MakeIdealYaw( m_vecEnemyLKP ); - ChangeYaw( pev->yaw_speed ); + if (m_hEnemy != 0) + { + MakeIdealYaw( m_vecEnemyLKP ); + ChangeYaw( pev->yaw_speed ); + } if( m_fSequenceFinished ) { From bed35fe8d1c9f90c21f751cb8a44526f01783a26 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 19 Jul 2022 14:35:44 +0300 Subject: [PATCH 15/35] Remove mingw build instructions and remove building with mingw from github workflow (#283) --- .github/workflows/.github.yml | 7 ------- README.md | 21 --------------------- 2 files changed, 28 deletions(-) diff --git a/.github/workflows/.github.yml b/.github/workflows/.github.yml index 8a9d50a4..29c3bdaa 100644 --- a/.github/workflows/.github.yml +++ b/.github/workflows/.github.yml @@ -63,13 +63,6 @@ jobs: schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target all schroot --chroot steamrt_scout_i386 -- cmake --build build-vgui --target install - - name: Build with mingw - if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.cc, 'gcc') - run: | - sudo apt-get install -y mingw-w64-i686-dev binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686 - cmake -B build-mingw -S . -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ - cmake --build build-mingw --target all - - name: Add msbuild to PATH if: startsWith(matrix.os, 'windows') uses: microsoft/setup-msbuild@v1.0.2 diff --git a/README.md b/README.md index c71b303a..06d18e4e 100644 --- a/README.md +++ b/README.md @@ -171,27 +171,6 @@ schroot --chroot jessie -- cmake -B build-in-chroot -S . schroot --chroot jessie -- cmake --build build-in-chroot ``` -## Linux. Crosscompiling using mingw - -Note that GoldSource won't work with libraries compiled with mingw. - -TODO: do we need this section at all? Is Xash3D-FWGS distributed with support for game libraries built with mingw? - -### Prerequisites - -Install mingw. On Ubuntu/Debian: -``` -sudo apt-get install -y mingw-w64-i686-dev binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686 -``` - -### Building - -``` -mkdir build-mingw && cd build-mingw -TOOLCHAIN_PREFIX=i686-w64-mingw32 # check up the actual mingw prefix of your mingw installation -cmake .. -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="$TOOLCHAIN_PREFIX-gcc" -DCMAKE_CXX_COMPILER="$TOOLCHAIN_PREFIX-g++" -``` - ## Android TODO From 66482655943ac8967b5ca9adce3ed59aa3954ed2 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 19 Jul 2022 15:29:44 +0300 Subject: [PATCH 16/35] compile.bat in release mode. Remove BOM from tripmine.cpp (#284) --- cl_dll/compile.bat | 5 ++--- dlls/compile.bat | 5 ++--- dlls/tripmine.cpp | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cl_dll/compile.bat b/cl_dll/compile.bat index 18b45459..7442b89a 100644 --- a/cl_dll/compile.bat +++ b/cl_dll/compile.bat @@ -71,12 +71,11 @@ set SOURCES=../dlls/crossbow.cpp ^ view.cpp ^ scoreboard.cpp ^ MOTD.cpp -set DEFINES=/DCLIENT_DLL /DCLIENT_WEAPONS /Dsnprintf=_snprintf /DNO_VOICEGAMEMGR /DGOLDSOURCE_SUPPORT +set DEFINES=/DCLIENT_DLL /DCLIENT_WEAPONS /Dsnprintf=_snprintf /DNO_VOICEGAMEMGR /DGOLDSOURCE_SUPPORT /DNDEBUG set LIBS=user32.lib Winmm.lib set OUTNAME=client.dll -set DEBUG=/debug -cl %DEFINES% %LIBS% %SOURCES% %INCLUDES% -o %OUTNAME% /link /dll /out:%OUTNAME% %DEBUG% +cl %DEFINES% %LIBS% %SOURCES% %INCLUDES% -o %OUTNAME% /link /dll /out:%OUTNAME% /release echo -- Compile done. Cleaning... diff --git a/dlls/compile.bat b/dlls/compile.bat index f97806a5..4eba92c7 100644 --- a/dlls/compile.bat +++ b/dlls/compile.bat @@ -108,12 +108,11 @@ set SOURCES=agrunt.cpp ^ xen.cpp ^ zombie.cpp ^ ../pm_shared/pm_debug.c ../pm_shared/pm_math.c ../pm_shared/pm_shared.c -set DEFINES=/DCLIENT_WEAPONS /Dsnprintf=_snprintf /DNO_VOICEGAMEMGR +set DEFINES=/DCLIENT_WEAPONS /Dsnprintf=_snprintf /DNO_VOICEGAMEMGR /DNDEBUG set LIBS=user32.lib set OUTNAME=hl.dll -set DEBUG=/debug -cl %DEFINES% %LIBS% %SOURCES% %INCLUDES% -o %OUTNAME% /link /dll /out:%OUTNAME% %DEBUG% /def:".\hl.def" +cl %DEFINES% %LIBS% %SOURCES% %INCLUDES% -o %OUTNAME% /link /dll /out:%OUTNAME% /release /def:".\hl.def" echo -- Compile done. Cleaning... diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index e9e55b67..3a46c6a5 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -1,4 +1,4 @@ -/*** +/*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. * From 695e2e060bfea4ac9ad96aab91762c0296edaee0 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 20 Jul 2022 08:23:52 +0300 Subject: [PATCH 17/35] Rename false_vgui to fake_vgui (#286) --- cl_dll/CMakeLists.txt | 2 +- utils/{false_vgui => fake_vgui}/include/VGUI.h | 0 utils/{false_vgui => fake_vgui}/include/VGUI_App.h | 0 utils/{false_vgui => fake_vgui}/include/VGUI_Color.h | 0 utils/{false_vgui => fake_vgui}/include/VGUI_Cursor.h | 0 utils/{false_vgui => fake_vgui}/include/VGUI_Dar.h | 0 utils/{false_vgui => fake_vgui}/include/VGUI_KeyCode.h | 0 utils/{false_vgui => fake_vgui}/include/VGUI_MouseCode.h | 0 utils/{false_vgui => fake_vgui}/include/VGUI_Panel.h | 0 utils/{false_vgui => fake_vgui}/include/VGUI_Scheme.h | 0 10 files changed, 1 insertion(+), 1 deletion(-) rename utils/{false_vgui => fake_vgui}/include/VGUI.h (100%) rename utils/{false_vgui => fake_vgui}/include/VGUI_App.h (100%) rename utils/{false_vgui => fake_vgui}/include/VGUI_Color.h (100%) rename utils/{false_vgui => fake_vgui}/include/VGUI_Cursor.h (100%) rename utils/{false_vgui => fake_vgui}/include/VGUI_Dar.h (100%) rename utils/{false_vgui => fake_vgui}/include/VGUI_KeyCode.h (100%) rename utils/{false_vgui => fake_vgui}/include/VGUI_MouseCode.h (100%) rename utils/{false_vgui => fake_vgui}/include/VGUI_Panel.h (100%) rename utils/{false_vgui => fake_vgui}/include/VGUI_Scheme.h (100%) diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index 4c4474ea..bd97f73c 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -159,7 +159,7 @@ if (USE_VGUI) link_directories(${CMAKE_SOURCE_DIR}/vgui_support/vgui-dev/lib) include_directories(../vgui_support/vgui-dev/include) else() - include_directories(../utils/false_vgui/include) + include_directories(../utils/fake_vgui/include) endif() if(USE_VOICEMGR) diff --git a/utils/false_vgui/include/VGUI.h b/utils/fake_vgui/include/VGUI.h similarity index 100% rename from utils/false_vgui/include/VGUI.h rename to utils/fake_vgui/include/VGUI.h diff --git a/utils/false_vgui/include/VGUI_App.h b/utils/fake_vgui/include/VGUI_App.h similarity index 100% rename from utils/false_vgui/include/VGUI_App.h rename to utils/fake_vgui/include/VGUI_App.h diff --git a/utils/false_vgui/include/VGUI_Color.h b/utils/fake_vgui/include/VGUI_Color.h similarity index 100% rename from utils/false_vgui/include/VGUI_Color.h rename to utils/fake_vgui/include/VGUI_Color.h diff --git a/utils/false_vgui/include/VGUI_Cursor.h b/utils/fake_vgui/include/VGUI_Cursor.h similarity index 100% rename from utils/false_vgui/include/VGUI_Cursor.h rename to utils/fake_vgui/include/VGUI_Cursor.h diff --git a/utils/false_vgui/include/VGUI_Dar.h b/utils/fake_vgui/include/VGUI_Dar.h similarity index 100% rename from utils/false_vgui/include/VGUI_Dar.h rename to utils/fake_vgui/include/VGUI_Dar.h diff --git a/utils/false_vgui/include/VGUI_KeyCode.h b/utils/fake_vgui/include/VGUI_KeyCode.h similarity index 100% rename from utils/false_vgui/include/VGUI_KeyCode.h rename to utils/fake_vgui/include/VGUI_KeyCode.h diff --git a/utils/false_vgui/include/VGUI_MouseCode.h b/utils/fake_vgui/include/VGUI_MouseCode.h similarity index 100% rename from utils/false_vgui/include/VGUI_MouseCode.h rename to utils/fake_vgui/include/VGUI_MouseCode.h diff --git a/utils/false_vgui/include/VGUI_Panel.h b/utils/fake_vgui/include/VGUI_Panel.h similarity index 100% rename from utils/false_vgui/include/VGUI_Panel.h rename to utils/fake_vgui/include/VGUI_Panel.h diff --git a/utils/false_vgui/include/VGUI_Scheme.h b/utils/fake_vgui/include/VGUI_Scheme.h similarity index 100% rename from utils/false_vgui/include/VGUI_Scheme.h rename to utils/fake_vgui/include/VGUI_Scheme.h From c1f0f25f1be481d99c98b2892085d0bb517b498e Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 20 Jul 2022 08:24:03 +0300 Subject: [PATCH 18/35] Rename .github.yml to build.yml (#285) --- .github/workflows/{.github.yml => build.yml} | 0 README.md | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{.github.yml => build.yml} (100%) diff --git a/.github/workflows/.github.yml b/.github/workflows/build.yml similarity index 100% rename from .github/workflows/.github.yml rename to .github/workflows/build.yml diff --git a/README.md b/README.md index 06d18e4e..310194e7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Half-Life SDK for GoldSource and Xash3D [![Build Status](https://github.com/FWGS/hlsdk-portable/actions/workflows/.github.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-portable/actions/workflows/.github.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-portable?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-portable) +# Half-Life SDK for GoldSource and Xash3D [![Build Status](https://github.com/FWGS/hlsdk-portable/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/FWGS/hlsdk-portable/actions/workflows/build.yml) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-portable?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-portable) Half-Life SDK for GoldSource & Xash3D with some bugfixes. From 0207817bf40811832afa90b35b9e968dd563683f Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin <15944199+nekonomicon@users.noreply.github.com> Date: Wed, 20 Jul 2022 14:42:45 +0500 Subject: [PATCH 19/35] client: wscript: false_vgui->fake_vgui. --- cl_dll/wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cl_dll/wscript b/cl_dll/wscript index 07dabf08..b516fe5f 100644 --- a/cl_dll/wscript +++ b/cl_dll/wscript @@ -96,7 +96,7 @@ def build(bld): '../pm_shared', '../game_shared', '../public', - '../utils/false_vgui/include' + '../utils/fake_vgui/include' ] defines = ['CLIENT_DLL'] From 4e7d64180bf28988e0d3a4ea2797a629d444a268 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Thu, 21 Jul 2022 17:23:09 +0300 Subject: [PATCH 20/35] Fix trace initialization in PM_TraceModel usage. Related issue: https://github.com/ValveSoftware/halflife/issues/3283 (#287) --- pm_shared/pm_shared.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pm_shared/pm_shared.c b/pm_shared/pm_shared.c index e16072de..15156910 100644 --- a/pm_shared/pm_shared.c +++ b/pm_shared/pm_shared.c @@ -120,6 +120,20 @@ static char grgchTextureType[CTEXTURESMAX]; int g_onladder = 0; +static inline void PM_InitTrace( trace_t *trace, const vec3_t end ) +{ + memset( trace, 0, sizeof( *trace )); + VectorCopy( end, trace->endpos ); + trace->allsolid = true; + trace->fraction = 1.0f; +} + +static void PM_TraceModel( physent_t *pe, float *start, float *end, trace_t *trace ) +{ + PM_InitTrace( trace, end ); + pmove->PM_TraceModel(pe, start, end, trace); +} + void PM_SwapTextures( int i, int j ) { char chTemp; @@ -2108,7 +2122,7 @@ void PM_LadderMove( physent_t *pLadder ) onFloor = false; pmove->gravity = 0; - pmove->PM_TraceModel( pLadder, pmove->origin, ladderCenter, &trace ); + PM_TraceModel(pLadder, pmove->origin, ladderCenter, &trace); if( trace.fraction != 1.0f ) { float forward = 0, right = 0; From 25ba2b4e5f737aff106077fa9a93a5b59e1ce588 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Thu, 21 Jul 2022 17:23:22 +0300 Subject: [PATCH 21/35] Fix ServerActivate check for clients (#288) --- dlls/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index 82b8e7e7..5c0d8392 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -734,7 +734,7 @@ void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ) continue; // Clients aren't necessarily initialized until ClientPutInServer() - if( i < clientMax || !pEdictList[i].pvPrivateData ) + if( (i > 0 && i <= clientMax) || !pEdictList[i].pvPrivateData ) continue; pClass = CBaseEntity::Instance( &pEdictList[i] ); From ed676a5413c2d26b2982e5b014e0731f0eda6a0d Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Thu, 21 Jul 2022 17:40:51 +0300 Subject: [PATCH 22/35] Fix deploy animations on fast weapon switching (#289) --- dlls/player.cpp | 17 +++++++++++++++++ dlls/weapons.cpp | 2 +- dlls/weapons.h | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/player.cpp b/dlls/player.cpp index cce57d02..e4d7f0fb 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -3095,7 +3095,15 @@ void CBasePlayer::SelectItem( const char *pstr ) if( m_pActiveItem ) { + CBasePlayerWeapon* weapon = (CBasePlayerWeapon*)(m_pActiveItem->GetWeaponPtr()); + if (weapon) + weapon->m_ForceSendAnimations = true; + m_pActiveItem->Deploy(); + + if (weapon) + weapon->m_ForceSendAnimations = false; + m_pActiveItem->UpdateItemInfo(); } } @@ -3121,7 +3129,16 @@ void CBasePlayer::SelectLastItem( void ) CBasePlayerItem *pTemp = m_pActiveItem; m_pActiveItem = m_pLastItem; m_pLastItem = pTemp; + + CBasePlayerWeapon* weapon = (CBasePlayerWeapon*)(m_pActiveItem->GetWeaponPtr()); + if (weapon) + weapon->m_ForceSendAnimations = true; + m_pActiveItem->Deploy(); + + if (weapon) + weapon->m_ForceSendAnimations = false; + m_pActiveItem->UpdateItemInfo(); } diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 76e5408d..094a4f38 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -820,7 +820,7 @@ int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer ) void CBasePlayerWeapon::SendWeaponAnim( int iAnim, int skiplocal, int body ) { if( UseDecrement() ) - skiplocal = 1; + skiplocal = !m_ForceSendAnimations; else skiplocal = 0; diff --git a/dlls/weapons.h b/dlls/weapons.h index c5f0d46a..396f3724 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -351,6 +351,9 @@ public: // hle time creep vars float m_flPrevPrimaryAttack; float m_flLastFireTime; + + //Hack so deploy animations work when weapon prediction is enabled. + bool m_ForceSendAnimations; }; class CBasePlayerAmmo : public CBaseEntity From d3dba792b109c008644620d345d867f847af86bb Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Thu, 21 Jul 2022 17:46:05 +0300 Subject: [PATCH 23/35] Fix client event angles (#290) --- cl_dll/com_weapons.cpp | 2 +- cl_dll/com_weapons.h | 1 + cl_dll/view.cpp | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cl_dll/com_weapons.cpp b/cl_dll/com_weapons.cpp index 4b9ae338..854f8689 100644 --- a/cl_dll/com_weapons.cpp +++ b/cl_dll/com_weapons.cpp @@ -137,7 +137,7 @@ void HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short event // Weapon prediction events are assumed to occur at the player's origin org = g_finalstate->playerstate.origin; - ang = v_angles; + ang = v_client_aimangles; gEngfuncs.pfnPlaybackEvent( flags, pInvoker, eventindex, delay, org, ang, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 ); } diff --git a/cl_dll/com_weapons.h b/cl_dll/com_weapons.h index 89fb3cfe..349a848d 100644 --- a/cl_dll/com_weapons.h +++ b/cl_dll/com_weapons.h @@ -39,6 +39,7 @@ extern cvar_t *cl_lw; extern int g_runfuncs; extern vec3_t v_angles; +extern vec3_t v_client_aimangles; extern float g_lastFOV; extern struct local_state_s *g_finalstate; #endif diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index fdbee778..6c9a1582 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -88,6 +88,7 @@ float v_cameraFocusAngle = 35.0f; int v_cameraMode = CAM_MODE_FOCUS; qboolean v_resetCamera = 1; +vec3_t v_client_aimangles; vec3_t g_ev_punchangle; cvar_t *scr_ofsx; @@ -724,6 +725,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams ) // Store off v_angles before munging for third person v_angles = pparams->viewangles; + v_client_aimangles = pparams->cl_viewangles; v_lastAngles = pparams->viewangles; //v_cl_angles = pparams->cl_viewangles; // keep old user mouse angles ! if( CL_IsThirdPerson() ) From 3b0046cb3dcd7df36c30afd578431fea14aabe00 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Fri, 22 Jul 2022 04:12:08 +0300 Subject: [PATCH 24/35] Fix func_button's sparks origin when func_button has origin brush (#291) --- dlls/buttons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/buttons.cpp b/dlls/buttons.cpp index 7ca7c2fd..9c7d5d39 100644 --- a/dlls/buttons.cpp +++ b/dlls/buttons.cpp @@ -639,7 +639,7 @@ void CBaseButton::ButtonSpark( void ) SetThink( &CBaseButton::ButtonSpark ); pev->nextthink = pev->ltime + 0.1f + RANDOM_FLOAT( 0.0f, 1.5f );// spark again at random interval - DoSpark( pev, pev->mins ); + DoSpark( pev, pev->absmin ); } // From b69d37e30e0d6a16f07f5beff8aad5606f86b17a Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Fri, 22 Jul 2022 15:56:02 +0300 Subject: [PATCH 25/35] Fix scientist's voice pitch selection (#292) --- dlls/scientist.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index e04fabea..15acf989 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -639,6 +639,13 @@ void CScientist::HandleAnimEvent( MonsterEvent_t *pEvent ) //========================================================= void CScientist::Spawn( void ) { + // We need to set it before precache so the right voice will be chosen + if( pev->body == -1 ) + { + // -1 chooses a random head + pev->body = RANDOM_LONG( 0, NUM_SCIENTIST_HEADS - 1 );// pick a head, any head + } + Precache(); SET_MODEL( ENT( pev ), "models/scientist.mdl" ); @@ -659,12 +666,6 @@ void CScientist::Spawn( void ) // White hands pev->skin = 0; - if( pev->body == -1 ) - { - // -1 chooses a random head - pev->body = RANDOM_LONG( 0, NUM_SCIENTIST_HEADS - 1 );// pick a head, any head - } - // Luther is black, make his hands black if( pev->body == HEAD_LUTHER ) pev->skin = 1; @@ -722,7 +723,7 @@ void CScientist::TalkInit() m_szGrp[TLK_MORTAL] = "SC_MORTAL"; // get voice for head - switch( pev->body % 3 ) + switch( pev->body % NUM_SCIENTIST_HEADS ) { default: case HEAD_GLASSES: From 4678d493929c59239c97e10182a443d97581e916 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 27 Jul 2022 08:23:58 +0300 Subject: [PATCH 26/35] Add manual workflow (#296) * Add manual workflow * Quote OFF and ON for YAML --- .github/workflows/manual.yml | 113 +++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 .github/workflows/manual.yml diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 00000000..19cf0201 --- /dev/null +++ b/.github/workflows/manual.yml @@ -0,0 +1,113 @@ +name: manual build + +on: + workflow_dispatch: + inputs: + buildtype: + type: choice + description: Build Type + options: + - Release + - Debug + usevgui: + type: choice + description: Use VGUI + options: + - 'OFF' + - 'ON' +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + cc: gcc + cxx: g++ + - os: windows-2019 + cc: cl + cxx: cl + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Checkout steam-runtime + if: startsWith(matrix.os, 'ubuntu') + uses: actions/checkout@v2 + with: + repository: ValveSoftware/steam-runtime + path: steam-runtime + - name: Cache steam-runtime + if: startsWith(matrix.os, 'ubuntu') + id: cache-steam-runtime + uses: actions/cache@v2 + with: + path: com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz + key: ${{ runner.os }}-steam-runtime + - 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 + - name: Install steam runtime + if: startsWith(matrix.os, 'ubuntu') + run: | + sudo apt update + ./steam-runtime/setup_chroot.sh --i386 --tarball ./com.valvesoftware.SteamRuntime.Sdk-i386-scout-sysroot.tar.gz + sudo sed -i 's/groups=sudo/groups=adm/g' /etc/schroot/chroot.d/steamrt_scout_i386.conf + + - name: Copy vgui.so + if: ${{ startsWith(matrix.os, 'ubuntu') && github.event.inputs.usevgui == 'ON' }} + run: | + mkdir -p build/cl_dll + cp vgui_support/vgui-dev/lib/vgui.so build/cl_dll + - 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 --build build --target all + schroot --chroot steamrt_scout_i386 -- cmake --build build --target install + + - name: Add msbuild to PATH + if: startsWith(matrix.os, 'windows') + uses: microsoft/setup-msbuild@v1.0.2 + - name: Build on Windows + if: startsWith(matrix.os, 'windows') + run: | + cmake -G "Visual Studio 16 2019" -A Win32 -B build -DCMAKE_INSTALL_PREFIX="dist" -DUSE_VGUI=${{ github.event.inputs.usevgui }} + msbuild -verbosity:normal /property:Configuration=${{ github.event.inputs.buildtype }} build/INSTALL.vcxproj + + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/} | tr '/' '_')" + id: extract_branch + - name: Extract gamedir + shell: bash + run: echo "##[set-output name=gamedir;]$(grep build/CMakeCache.txt -Ee 'GAMEDIR:STRING=[a-z]+' | cut -d '=' -f 2)" + id: extract_gamedir + - name: Copy pdbs to dist dir + if: ${{ startsWith(matrix.os, 'windows') && github.event.inputs.buildtype == 'Debug' }} + 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@v2 + with: + name: hlsdk-${{ steps.extract_branch.outputs.branch }}-linux + path: dist/${{ steps.extract_gamedir.outputs.gamedir }} + - name: Upload windows artifact + if: startsWith(matrix.os, 'windows') + uses: actions/upload-artifact@v2 + with: + name: hlsdk-${{ steps.extract_branch.outputs.branch }}-windows + path: dist/${{ steps.extract_gamedir.outputs.gamedir }} + From 5d64c9ceb428265a33bc18df3c4dce3c0206b160 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 27 Jul 2022 08:24:10 +0300 Subject: [PATCH 27/35] Fix building with msvc 6 (#295) --- cl_dll/compile.bat | 2 +- pm_shared/pm_shared.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cl_dll/compile.bat b/cl_dll/compile.bat index 7442b89a..cc4ed5ac 100644 --- a/cl_dll/compile.bat +++ b/cl_dll/compile.bat @@ -7,7 +7,7 @@ set PATH=%MSVCDir%\VC98\Bin;%MSVCDir%\Common\MSDev98\Bin\;%PATH% echo -- Compiler is MSVC6 set XASH3DSRC=..\..\Xash3D_original -set INCLUDES=-I../common -I../engine -I../pm_shared -I../game_shared -I../public -I../external -I../dlls -I../utils/false_vgui/include +set INCLUDES=-I../common -I../engine -I../pm_shared -I../game_shared -I../public -I../external -I../dlls -I../utils/fake_vgui/include set SOURCES=../dlls/crossbow.cpp ^ ../dlls/crowbar.cpp ^ ../dlls/egon.cpp ^ diff --git a/pm_shared/pm_shared.c b/pm_shared/pm_shared.c index 15156910..d5ad05d5 100644 --- a/pm_shared/pm_shared.c +++ b/pm_shared/pm_shared.c @@ -120,7 +120,7 @@ static char grgchTextureType[CTEXTURESMAX]; int g_onladder = 0; -static inline void PM_InitTrace( trace_t *trace, const vec3_t end ) +static void PM_InitTrace( trace_t *trace, const vec3_t end ) { memset( trace, 0, sizeof( *trace )); VectorCopy( end, trace->endpos ); From 8d91e9b4c09f4cb79b3043c4289a30a23e00e71e Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 27 Jul 2022 08:24:22 +0300 Subject: [PATCH 28/35] Use MAX_WEAPONS constant instead of magic numbers (#294) --- cl_dll/entity.cpp | 2 +- cl_dll/hl/hl_weapons.cpp | 8 ++++---- dlls/client.cpp | 7 ++----- dlls/weapons.h | 2 -- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/cl_dll/entity.cpp b/cl_dll/entity.cpp index ba524f6a..36705466 100644 --- a/cl_dll/entity.cpp +++ b/cl_dll/entity.cpp @@ -222,7 +222,7 @@ void DLLEXPORT HUD_TxferPredictionData( struct entity_state_s *ps, const struct VectorCopy( ppcd->vuser3, pcd->vuser3 ); VectorCopy( ppcd->vuser4, pcd->vuser4 ); - memcpy( wd, pwd, 32 * sizeof(weapon_data_t) ); + memcpy( wd, pwd, MAX_WEAPONS * sizeof(weapon_data_t) ); } /* diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index b982fa7f..f8473eaa 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -36,7 +36,7 @@ extern globalvars_t *gpGlobals; extern int g_iUser1; // Pool of client side entities/entvars_t -static entvars_t ev[32]; +static entvars_t ev[MAX_WEAPONS]; static int num_ents = 0; // The entity we'll use to represent the local client @@ -45,7 +45,7 @@ static CBasePlayer player; // Local version of game .dll global variables ( time, etc. ) static globalvars_t Globals; -static CBasePlayerWeapon *g_pWpns[32]; +static CBasePlayerWeapon *g_pWpns[MAX_WEAPONS]; float g_flApplyVel = 0.0; int g_irunninggausspred = 0; @@ -752,7 +752,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm if( !pWeapon ) return; - for( i = 0; i < 32; i++ ) + for( i = 0; i < MAX_WEAPONS; i++ ) { pCurrent = g_pWpns[i]; if( !pCurrent ) @@ -921,7 +921,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm HUD_SendWeaponAnim( to->client.weaponanim, body, 1 ); } - for( i = 0; i < 32; i++ ) + for( i = 0; i < MAX_WEAPONS; i++ ) { pCurrent = g_pWpns[i]; diff --git a/dlls/client.cpp b/dlls/client.cpp index 5c0d8392..2ca1de59 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1627,6 +1627,7 @@ void RegisterEncoders( void ) int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) { + memset( info, 0, MAX_WEAPONS * sizeof(weapon_data_t) ); #if CLIENT_WEAPONS int i; weapon_data_t *item; @@ -1634,8 +1635,6 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) CBasePlayer *pl = (CBasePlayer *)CBasePlayer::Instance( pev ); CBasePlayerWeapon *gun; - memset( info, 0, 32 * sizeof(weapon_data_t) ); - if( !pl ) return 1; @@ -1656,7 +1655,7 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) // Get The ID. gun->GetItemInfo( &II ); - if( II.iId >= 0 && II.iId < 32 ) + if( II.iId >= 0 && II.iId < MAX_WEAPONS ) { item = &info[II.iId]; @@ -1682,8 +1681,6 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) } } } -#else - memset( info, 0, 32 * sizeof(weapon_data_t) ); #endif return 1; } diff --git a/dlls/weapons.h b/dlls/weapons.h index 396f3724..2963afa6 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -83,8 +83,6 @@ public: #define WEAPON_SUIT 31 // ????? -#define MAX_WEAPONS 32 - #define MAX_NORMAL_BATTERY 100 // weapon weight factors (for auto-switching) (-1 = noswitch) From 70516c988fa73199d7124789bf4e448e2b92ac13 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 1 Aug 2022 14:43:42 +0300 Subject: [PATCH 29/35] scripts: upgrade to Android NDK 25 --- scripts/waifulib/xcompile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/waifulib/xcompile.py b/scripts/waifulib/xcompile.py index 0abf53f1..b9ce398f 100644 --- a/scripts/waifulib/xcompile.py +++ b/scripts/waifulib/xcompile.py @@ -20,12 +20,12 @@ import os import sys ANDROID_NDK_ENVVARS = ['ANDROID_NDK_HOME', 'ANDROID_NDK'] -ANDROID_NDK_SUPPORTED = [10, 19, 20, 23] +ANDROID_NDK_SUPPORTED = [10, 19, 20, 23, 25] ANDROID_NDK_HARDFP_MAX = 11 # latest version that supports hardfp ANDROID_NDK_GCC_MAX = 17 # latest NDK that ships with GCC ANDROID_NDK_UNIFIED_SYSROOT_MIN = 15 ANDROID_NDK_SYSROOT_FLAG_MAX = 19 # latest NDK that need --sysroot flag -ANDROID_NDK_API_MIN = { 10: 3, 19: 16, 20: 16, 23: 16 } # minimal API level ndk revision supports +ANDROID_NDK_API_MIN = { 10: 3, 19: 16, 20: 16, 23: 16, 25: 19 } # minimal API level ndk revision supports ANDROID_STPCPY_API_MIN = 21 # stpcpy() introduced in SDK 21 ANDROID_64BIT_API_MIN = 21 # minimal API level that supports 64-bit targets From abf08e4520e3b6cd12a40f269f4a256cf8496227 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Fri, 5 Aug 2022 16:21:43 +0300 Subject: [PATCH 30/35] Fix client tripmine body and weapon bodies passed to EV_WeaponAnimation (#298) --- cl_dll/ev_hldm.cpp | 32 ++++++++++++++++---------------- cl_dll/hl/hl_weapons.cpp | 6 +----- dlls/tripmine.cpp | 5 +++++ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 6eee0328..c0b8b475 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -486,7 +486,7 @@ static void EV_FireGlock_Impl( event_args_t *args ) if( EV_IsLocal( idx ) ) { EV_MuzzleFlash(); - gEngfuncs.pEventAPI->EV_WeaponAnimation( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, 0 ); V_PunchAxis( 0, -2.0 ); } @@ -549,7 +549,7 @@ void EV_FireShotGunDouble( event_args_t *args ) { // Add muzzle flash to current weapon model EV_MuzzleFlash(); - gEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE2, 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE2, 0 ); V_PunchAxis( 0, -10.0 ); } @@ -603,7 +603,7 @@ void EV_FireShotGunSingle( event_args_t *args ) { // Add muzzle flash to current weapon model EV_MuzzleFlash(); - gEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE, 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE, 0 ); V_PunchAxis( 0, -5.0 ); } @@ -660,7 +660,7 @@ void EV_FireMP5( event_args_t *args ) { // Add muzzle flash to current weapon model EV_MuzzleFlash(); - gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_FIRE1 + gEngfuncs.pfnRandomLong( 0, 2 ), 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_FIRE1 + gEngfuncs.pfnRandomLong( 0, 2 ), 0 ); V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -2, 2 ) ); } @@ -697,7 +697,7 @@ void EV_FireMP52( event_args_t *args ) if( EV_IsLocal( idx ) ) { - gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_LAUNCH, 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_LAUNCH, 0 ); V_PunchAxis( 0, -10 ); } @@ -862,7 +862,7 @@ void EV_FireGauss( event_args_t *args ) if( EV_IsLocal( idx ) ) { V_PunchAxis( 0.0f, -2.0f ); - gEngfuncs.pEventAPI->EV_WeaponAnimation( GAUSS_FIRE2, 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( GAUSS_FIRE2, 0 ); if( m_fPrimaryFire == false ) g_flApplyVel = flDamage; @@ -1129,13 +1129,13 @@ void EV_Crowbar( event_args_t *args ) switch( (g_iSwing++) % 3 ) { case 0: - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 0 ); break; case 1: - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK2MISS, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK2MISS, 0 ); break; case 2: - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK3MISS, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK3MISS, 0 ); break; } } @@ -1203,9 +1203,9 @@ void EV_FireCrossbow2( event_args_t *args ) if( EV_IsLocal( idx ) ) { if( args->iparam1 ) - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE1, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE1, 0 ); else - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 0 ); } // Store off the old count @@ -1279,9 +1279,9 @@ void EV_FireCrossbow( event_args_t *args ) if( EV_IsLocal( idx ) ) { if( args->iparam1 ) - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE1, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE1, 0 ); else - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 0 ); V_PunchAxis( 0.0f, -2.0f ); } @@ -1321,7 +1321,7 @@ void EV_FireRpg( event_args_t *args ) //Only play the weapon anims if I shot it. if( EV_IsLocal( idx ) ) { - gEngfuncs.pEventAPI->EV_WeaponAnimation( RPG_FIRE2, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( RPG_FIRE2, 0 ); V_PunchAxis( 0, -5.0 ); } @@ -1422,7 +1422,7 @@ void EV_EgonFire( event_args_t *args ) //Only play the weapon anims if I shot it. if( EV_IsLocal( idx ) ) - gEngfuncs.pEventAPI->EV_WeaponAnimation( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 0 ); if( iStartup == 1 && EV_IsLocal( idx ) && !( pBeam || pBeam2 || pFlare ) && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction. { @@ -1564,7 +1564,7 @@ void EV_HornetGunFire( event_args_t *args ) if( EV_IsLocal( idx ) ) { V_PunchAxis( 0, gEngfuncs.pfnRandomLong( 0, 2 ) ); - gEngfuncs.pEventAPI->EV_WeaponAnimation( HGUN_SHOOT, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( HGUN_SHOOT, 0 ); } switch( gEngfuncs.pfnRandomLong( 0, 2 ) ) diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index f8473eaa..4f119f02 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -907,11 +907,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm // over the wire ( fixes some animation glitches ) if( g_runfuncs && ( HUD_GetWeaponAnim() != to->client.weaponanim ) ) { - int body = 2; - - //Pop the model to body 0. - if( pWeapon == &g_Tripmine ) - body = 0; + int body = 0; //Show laser sight/scope combo if( pWeapon == &g_Python && bIsMultiplayer() ) diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index 3a46c6a5..7df4b93d 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -364,7 +364,12 @@ void CTripmine::Spawn() m_iId = WEAPON_TRIPMINE; SET_MODEL( ENT( pev ), "models/v_tripmine.mdl" ); pev->frame = 0; + +#ifdef CLIENT_DLL + pev->body = 0; +#else pev->body = 3; +#endif pev->sequence = TRIPMINE_GROUND; // ResetSequenceInfo(); pev->framerate = 0; From 4053dca7a9cf999391cbd77224144da207e4540b Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Fri, 5 Aug 2022 16:22:03 +0300 Subject: [PATCH 31/35] Fix deploy animations sometimes not playing on weapon pickup (#299) --- dlls/player.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/player.cpp b/dlls/player.cpp index e4d7f0fb..234cfb31 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -4609,8 +4609,16 @@ BOOL CBasePlayer::SwitchWeapon( CBasePlayerItem *pWeapon ) } m_pActiveItem = pWeapon; + + CBasePlayerWeapon* weapon = (CBasePlayerWeapon*)(pWeapon->GetWeaponPtr()); + if (weapon) + weapon->m_ForceSendAnimations = true; + pWeapon->Deploy(); + if (weapon) + weapon->m_ForceSendAnimations = false; + return TRUE; } From ae4d65439c0a87308164027fbced1cb249768e85 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Fri, 5 Aug 2022 16:22:36 +0300 Subject: [PATCH 32/35] Don't play tripmine draw animation after placing the last tripmine (#300) --- cl_dll/ev_hldm.cpp | 3 ++- dlls/tripmine.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index c0b8b475..a3160cb9 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -1609,6 +1609,7 @@ void EV_TripmineFire( event_args_t *args ) pmtrace_t tr; idx = args->entindex; + const bool last = args->bparam1 != 0; VectorCopy( args->origin, vecSrc ); VectorCopy( args->angles, angles ); @@ -1631,7 +1632,7 @@ void EV_TripmineFire( event_args_t *args ) gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecSrc + forward * 128.0f, PM_NORMAL, -1, &tr ); //Hit something solid - if( tr.fraction < 1.0f ) + if( tr.fraction < 1.0f && !last ) gEngfuncs.pEventAPI->EV_WeaponAnimation ( TRIPMINE_DRAW, 0 ); gEngfuncs.pEventAPI->EV_PopPMStates(); diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index 7df4b93d..859e3548 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -454,7 +454,7 @@ void CTripmine::PrimaryAttack( void ) #else flags = 0; #endif - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usTripFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 0, 0, 0, 0 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usTripFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 0, 0, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] == 1, 0 ); if( tr.flFraction < 1.0f ) { From d9d46bcc2b12da2ebf7bf26eef482c60215bab03 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sat, 6 Aug 2022 17:39:55 +0300 Subject: [PATCH 33/35] Include changelog in README.md [ci skip] (#302) --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/README.md b/README.md index 310194e7..c07deea0 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,52 @@ Half-Life SDK for GoldSource & Xash3D with some bugfixes. +
Changelog +

+ +- Fixed an occasional bug when houndeyes stuck unable to do anything. Technical detail: now monster's `Activity` is set before the call to `SetYawSpeed`. [Patch](https://github.com/FWGS/hlsdk-portable/commit/467899b99aa225a95d90222137f18c141c929c86) +- Monsters now play idle sounds as it's supposed by the code. Technical detail: the problem was a check for a wrong variable. [Patch](https://github.com/FWGS/hlsdk-portable/commit/9fc712da019a1ca646171e912209a993e7c43976) +- Fixed a bug that caused talk monsters (scientists and security guards) to face a wrong direction during scripted sequence sometimes. [Patch](https://github.com/FWGS/hlsdk-portable/commit/3e2808de62e479e83068c075cb88b4f177f9acc7) +- Fixed squad member removal. This bug affected houndeye attacks as their attack depends on percieved number of squad members. [Patch](https://github.com/FWGS/hlsdk-portable/commit/b4502f71336a08f3f2c72b7b061b2838a149a11b) +- Scientists now react to smells. [Patch](https://github.com/FWGS/hlsdk-portable/commit/2de4e7ab003d5b1674d12525f5aefb1e57a49fa3) +- Tau-cannon (gauss) plays idle animations. +- Tau-cannon (gauss) beam color depends on the charge as it was before the prediction code was introduced in Half-Life. [Patch](https://github.com/FWGS/hlsdk-portable/commit/0a29ec49c8183ebb8da22a6d2ef395eae9c3dffe) +- Brought back gluon flare in singleplayer. +- Hand grenades don't stay primed after holster, preventing detonation after weapon switch. [Patch](https://github.com/FWGS/hlsdk-portable/commit/6e1059026faa90c5bfe5e3b3f4f58fde398d4524) +- Fixed flashlight battery appearing as depleted on restore. +- Fixed a potential overflow when reading sentences.txt. [Patch](https://github.com/FWGS/hlsdk-xash3d/commit/cb51d2aa179f1eb622e08c1c07b053ccd49e40a5) +- Fixed beam attachment invalidated on restore (that led to visual bugs). [Patch](https://github.com/FWGS/hlsdk-xash3d/commit/74b5543c83c5cdcb88e9254bacab08bc63c4c896) +- Fixed alien controllers facing wrong direction in non-combat state. [Patch](https://github.com/FWGS/hlsdk-portable/commit/e51878c45b618f9b3920b46357545cbb47befeda) +- Fixed weapon deploy animations not playing sometimes on fast switching between weapons. [Patch](https://github.com/FWGS/hlsdk-portable/commit/ed676a5413c2d26b2982e5b014e0731f0eda6a0d) [Patch2](https://github.com/FWGS/hlsdk-portable/commit/4053dca7a9cf999391cbd77224144da207e4540b) +- Fixed tripmine sometimes having wrong body on pickup [Patch](https://github.com/FWGS/hlsdk-portable/commit/abf08e4520e3b6cd12a40f269f4a256cf8496227) + +Bugfix-related macros that can be enabled during the compilation: + +- **CROWBAR_DELAY_FIX** fixes a bug when crowbar has a longer delay after the first hit. +- **CROWBAR_FIX_RAPID_CROWBAR** fixes a "rapid crowbar" bug when hitting corpses of killed monsters. +- **GAUSS_OVERCHARGE_FIX** fixes tau-cannon (gauss) charge sound not stopping after the overcharge. +- **CROWBAR_IDLE_ANIM** makes crowbar play idle animations. +- **TRIPMINE_BEAM_DUPLICATION_FIX** fixes tripmine's beam duplication on level transition. +- **HANDGRENADE_DEPLOY_FIX** makes handgrenade play draw animation after finishing a throw. +- **WEAPONS_ANIMATION_TIMES_FIX** fixes deploy and idle animation times of some weapons. + +Bugfix-related server cvars: + +- **satchelfix**: if set to 1, doors won't get blocked by satchels. Fixes an infamous exploit on `crossfire` map. +- **explosionfix**: if set to 1, explosion damage won't propagate through thin bruses. +- **selfgauss**: if set to 0, players won't hurt themselves with secondary attack when shooting thick brushes. + +*Note*: the macros and cvars were adjusted in [hlfixed](https://github.com/FWGS/hlsdk-portable/tree/hlfixed) branch. The bugfix macros are kept turned off in master branch to maintain the compatibility with vanilla servers and clients. + +Other server cvars: + +- **mp_bhopcap**: if set to 1, enable bunny-hop. +- **chargerfix**: if set to 1, wall-mounted health and battery chargers will play reject sounds if player has the full health or armor. +- **corpsephysics**: if set to 1, corpses of killed monsters will fly a bit from an impact. It's a cut feature from Half-Life. + +

+
+ # Obtaining source code Either clone the repository via [git](`https://git-scm.com/downloads`) or just download ZIP via **Code** button on github. The first option is more preferable as it also allows you to search through the repo history, switch between branches and clone the vgui submodule. From e12d1aa743ccc7557302358fc7a57f1675044495 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sat, 6 Aug 2022 17:40:26 +0300 Subject: [PATCH 34/35] Replace usage of m_ForceSendAnimations with entvars to avoid changing the class data layout (#306) --- dlls/player.cpp | 28 ++++++---------------------- dlls/weapons.cpp | 2 +- dlls/weapons.h | 3 --- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/dlls/player.cpp b/dlls/player.cpp index 234cfb31..f011b550 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -3095,15 +3095,9 @@ void CBasePlayer::SelectItem( const char *pstr ) if( m_pActiveItem ) { - CBasePlayerWeapon* weapon = (CBasePlayerWeapon*)(m_pActiveItem->GetWeaponPtr()); - if (weapon) - weapon->m_ForceSendAnimations = true; - + m_pActiveItem->pev->oldbuttons = 1; m_pActiveItem->Deploy(); - - if (weapon) - weapon->m_ForceSendAnimations = false; - + m_pActiveItem->pev->oldbuttons = 0; m_pActiveItem->UpdateItemInfo(); } } @@ -3130,14 +3124,9 @@ void CBasePlayer::SelectLastItem( void ) m_pActiveItem = m_pLastItem; m_pLastItem = pTemp; - CBasePlayerWeapon* weapon = (CBasePlayerWeapon*)(m_pActiveItem->GetWeaponPtr()); - if (weapon) - weapon->m_ForceSendAnimations = true; - + m_pActiveItem->pev->oldbuttons = 1; m_pActiveItem->Deploy(); - - if (weapon) - weapon->m_ForceSendAnimations = false; + m_pActiveItem->pev->oldbuttons = 0; m_pActiveItem->UpdateItemInfo(); } @@ -4610,14 +4599,9 @@ BOOL CBasePlayer::SwitchWeapon( CBasePlayerItem *pWeapon ) m_pActiveItem = pWeapon; - CBasePlayerWeapon* weapon = (CBasePlayerWeapon*)(pWeapon->GetWeaponPtr()); - if (weapon) - weapon->m_ForceSendAnimations = true; - + pWeapon->pev->oldbuttons = 1; pWeapon->Deploy(); - - if (weapon) - weapon->m_ForceSendAnimations = false; + pWeapon->pev->oldbuttons = 0; return TRUE; } diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 094a4f38..0443d271 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -820,7 +820,7 @@ int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer ) void CBasePlayerWeapon::SendWeaponAnim( int iAnim, int skiplocal, int body ) { if( UseDecrement() ) - skiplocal = !m_ForceSendAnimations; + skiplocal = !pev->oldbuttons; else skiplocal = 0; diff --git a/dlls/weapons.h b/dlls/weapons.h index 2963afa6..889e0c5a 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -349,9 +349,6 @@ public: // hle time creep vars float m_flPrevPrimaryAttack; float m_flLastFireTime; - - //Hack so deploy animations work when weapon prediction is enabled. - bool m_ForceSendAnimations; }; class CBasePlayerAmmo : public CBaseEntity From 8f5c36dc62b463044cffa3ddf40347905ea39f08 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 8 Aug 2022 23:36:39 +0300 Subject: [PATCH 35/35] client: fix GoldSrc input being enabled for Android on x86 --- cl_dll/input_mouse.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cl_dll/input_mouse.h b/cl_dll/input_mouse.h index 0ecd8147..814e239f 100644 --- a/cl_dll/input_mouse.h +++ b/cl_dll/input_mouse.h @@ -1,4 +1,7 @@ #pragma once + +#include "build.h" + #if !defined(INPUT_MOUSE_H) #define INPUT_MOUSE_H #include "cl_dll.h" @@ -45,7 +48,7 @@ protected: }; // No need for goldsource input support on the platforms that are not supported by GoldSource. -#if GOLDSOURCE_SUPPORT && (_WIN32 || __linux__ || __APPLE__) && (__i386 || _M_IX86) +#if GOLDSOURCE_SUPPORT && ( XASH_WIN32 || ( XASH_LINUX && !XASH_ANDROID ) || XASH_APPLE ) && XASH_X86 #define SUPPORT_GOLDSOURCE_INPUT 1 #if _WIN32