diff --git a/.github/workflows/.github.yml b/.github/workflows/build.yml similarity index 75% rename from .github/workflows/.github.yml rename to .github/workflows/build.yml index 2795f59e..29c3bdaa 100644 --- a/.github/workflows/.github.yml +++ b/.github/workflows/build.yml @@ -49,44 +49,32 @@ 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 - - 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 - - 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 c2a56a45..d307d5eb 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 \ @@ -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) @@ -63,6 +64,9 @@ 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(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) option(MOBILE_HACKS "Enable dirty hacks for simple mods" ON) @@ -141,6 +145,21 @@ 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(HANDGRENADE_DEPLOY_FIX) + message(STATUS "Handgrenade deploy animation fix enabled") + 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/README.md b/README.md index 32d4fc05..310194e7 100644 --- a/README.md +++ b/README.md @@ -1,140 +1,215 @@ -# 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-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 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: +``` +git clone --recursive https://github.com/FWGS/hlsdk-portable +``` - 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++" +# Build Instructions -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. +## Windows -See below, if CMake is not suitable for you: +### Prerequisites -### Windows +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...*. -#### Using msvc +### Opening command prompt -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. +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`. - set MSVCDir=C:\Program Files\Microsoft Visual Studio - compile.bat +Inside the prompt navigate to the hlsdk directory, using `cd` command, e.g. +``` +cd C:\Users\username\projects\hlsdk-portable +``` -These scripts also can be ran via wine: +Note: if hlsdk-portable is unpacked on another disk, nagivate there first: +``` +D: +cd projects\hlsdk-portable +``` - MSVCDir="z:\home\$USER\.wine\drive_c\Program Files\Microsoft Visual Studio" wine cmd /c compile.bat +### Building -The libraries built this way are always GoldSource compatible. +Сonfigure the project: +``` +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. -#### Using mingw +The next step is to compile the libraries: +``` +cmake --build build --config Release +``` +`hl.dll` and `client.dll` will appear in the `build/dlls/Release` and `build/cl_dll/Release` directories. -TODO +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 `cmake` with `--target install` parameter: +``` +cmake --build build --config Release --target install +``` -### Unix-like +#### Choosing Visual Studio version -To use waf, you need to install python (2.7 minimum) +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 +``` - (./waf configure -T release) - (./waf) +### Editing code in Visual Studio -### Android +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. -Just typical `ndk-build`. -TODO: describe what it is. +## Windows. Using Microsoft Visual Studio 6 -### Building GoldSource-compatible libraries +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: -To enable building the goldsource compatible client library add GOLDSOURCE_SUPPORT flag when calling cmake: +``` +set MSVCDir=C:\Program Files\Microsoft Visual Studio +cd dlls && compile.bat && cd ../cl_dll && compile.bat +``` + +`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 --`: +``` +schroot --chroot steamrt_scout_i386 -- cmake -B build-in-steamrt -S . +schroot --chroot steamrt_scout_i386 -- cmake --build build-in-steamrt +``` -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 +``` +cmake -B build -S . +cmake --build build +``` -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`. + +### Building + +Prepend any make or cmake call with `schroot -c jessie --`: +``` +schroot --chroot jessie -- cmake -B build-in-chroot -S . +schroot --chroot jessie -- cmake --build build-in-chroot +``` + +## Android + +TODO - mkdir build-in-chroot && cd build-in-chroot - schroot --chroot jessie -- cmake ../ -DGOLDSOURCE_SUPPORT=ON - schroot --chroot jessie -- make +## Other platforms -#### Method 4: Install the needed g++ version yourself +Building on other Unix-like platforms (e.g. FreeBSD) is supported. -TODO: describe steps. +### Prerequisites -#### Configuring Qt Creator to use toolchain from chroot +Install C and C++ compilers (like gcc or clang), cmake and make (or gmake) -Create a file with the following contents anywhere: +### Building -```sh -#!/bin/sh -schroot --chroot steamrt_scout_i386 -- cmake "$@" +``` +cmake -B build -S . +cmake --build build +``` + +### Building with waf + +To use waf, you need to install python (2.7 minimum) + +``` +(./waf configure -T release) +(./waf) ``` -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. +## 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 +``` diff --git a/appveyor.yml b/appveyor.yml index 6616ee57..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 @@ -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 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/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/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(); 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/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 ) { diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index 9dd69180..b7245b40 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -366,7 +366,7 @@ void CCrowbar::WeaponIdle( void ) if( flRand > 0.5f ) { iAnim = CROWBAR_IDLE; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 30.0f; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 25.0f; } else { diff --git a/dlls/handgrenade.cpp b/dlls/handgrenade.cpp index 56d3dd68..c9ee7d99 100644 --- a/dlls/handgrenade.cpp +++ b/dlls/handgrenade.cpp @@ -183,7 +183,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; 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..38ebec08 100644 --- a/dlls/satchel.cpp +++ b/dlls/satchel.cpp @@ -293,14 +293,20 @@ BOOL CSatchel::CanDeploy( void ) BOOL CSatchel::Deploy() { m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f ); + 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 b544e179..18a9024d 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -487,7 +487,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 */ ) diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index 9da8b90e..3a46c6a5 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 ); @@ -483,6 +488,8 @@ void CTripmine::PrimaryAttack( void ) void CTripmine::WeaponIdle( void ) { + pev->body = 0; + if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() ) return; 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 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 diff --git a/wscript b/wscript index 92c40655..684f8042 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]') grp.add_option('--enable-simple-mod-hacks', action = 'store_true', dest = 'SIMPLE_MOD_HACKS', default = False, help = 'enable hacks for simple mods that mostly compatible with Half-Life but has little changes. Enforced for Android. [default: %default]')