From 4e7d64180bf28988e0d3a4ea2797a629d444a268 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Thu, 21 Jul 2022 17:23:09 +0300 Subject: [PATCH 01/13] 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 02/13] 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 03/13] 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 04/13] 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 05/13] 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 06/13] 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 07/13] 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 08/13] 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 09/13] 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 10/13] 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 11/13] 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 12/13] 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 13/13] 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 ) {