From f563942ebb9e4dd70deb6880788438e4644053c4 Mon Sep 17 00:00:00 2001 From: StevenKal Date: Fri, 18 Feb 2022 18:38:32 +0000 Subject: [PATCH 01/10] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78a8b7d3f..ca1c0f7df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ on: jobs: windows: name: 'Windows' - runs-on: windows-latest + runs-on: windows-2019 env: solution: 'msvc/ReGameDLL.sln' From bd8f0bfe56b362414cea946bd1a80b825f4dcc8c Mon Sep 17 00:00:00 2001 From: StevenKal Date: Fri, 18 Feb 2022 18:39:24 +0000 Subject: [PATCH 02/10] Update util.cpp --- regamedll/dlls/util.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp index 8385be350..9ad6d580c 100644 --- a/regamedll/dlls/util.cpp +++ b/regamedll/dlls/util.cpp @@ -1853,3 +1853,43 @@ int UTIL_CountPlayersInBrushVolume(bool bOnlyAlive, CBaseEntity *pBrushEntity, i return playersInCount + playersOutCount; } + +int UTIL_GetClientsSolidity(int iSolidityTypeArray[MAX_CLIENTS + 1]) { + Q_memset(iSolidityTypeArray, SOLID_NOT, sizeof(iSolidityTypeArray)); + + int iClientsBitsFound = 0; + for(int iClientID = 1; iClientID <= gpGlobals->maxClients; iClientID++) + { + CBasePlayer *pPlayer = UTIL_PlayerByIndex(iClientID); + + if (!pPlayer || pPlayer->has_disconnected || !pPlayer->IsAlive()) + continue; + + iSolidityTypeArray[iClientID] = pPlayer->pev->solid; + iClientsBitsFound |= (1<<(iClientID - 1)); + } + + return iClientsBitsFound; +} + +int UTIL_SetClientsSolidity(int iClientsBitsToSet, bool bSetFromArray, int iSolidityType, int iSolidityTypeArray[MAX_CLIENTS + 1]) { + if(iClientsBitsToSet == 0) + return 0; + + int iClientsBitsSet = 0; + for(int iClientID = 1; iClientID <= gpGlobals->maxClients; iClientID++) + { + CBasePlayer *pPlayer = UTIL_PlayerByIndex(iClientID); + + if (!pPlayer || pPlayer->has_disconnected || !pPlayer->IsAlive()) + continue; + + if(!(iClientsBitsToSet & (1<<(iClientID - 1)))) + continue; + + pPlayer->pev->solid = (bSetFromArray == false) ? iSolidityType : iSolidityTypeArray[iClientID]; + iClientsBitsSet |= (1<<(iClientID - 1)); + } + + return iClientsBitsSet; +} From b8e7950cc351788784dc8f6697f555c866863dd8 Mon Sep 17 00:00:00 2001 From: StevenKal Date: Fri, 18 Feb 2022 18:39:46 +0000 Subject: [PATCH 03/10] Update util.h --- regamedll/dlls/util.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/regamedll/dlls/util.h b/regamedll/dlls/util.h index baeea3634..3f0366d3f 100644 --- a/regamedll/dlls/util.h +++ b/regamedll/dlls/util.h @@ -354,6 +354,8 @@ class CPlayerInVolumeAdapter }; int UTIL_CountPlayersInBrushVolume(bool bOnlyAlive, CBaseEntity *pBrushEntity, int &playersInCount, int &playersOutCount, CPlayerInVolumeAdapter *pAdapter = nullptr); +int UTIL_GetClientsSolidity(int iSolidityTypeArray[MAX_CLIENTS + 1]); +int UTIL_SetClientsSolidity(int iClientsBitsToSet, bool bSetFromArray, int iSolidityType, int iSolidityTypeArray[MAX_CLIENTS + 1] = nullptr); inline real_t UTIL_FixupAngle(real_t v) { From e6d3a7f32a053fa339c7baef34c739fbef2ec49b Mon Sep 17 00:00:00 2001 From: StevenKal Date: Fri, 18 Feb 2022 18:40:49 +0000 Subject: [PATCH 04/10] Update player.cpp --- regamedll/dlls/player.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 9a97f2c86..4d22cfbff 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -7758,7 +7758,11 @@ void CBasePlayer::UpdateStatusBar() Vector vecSrc = EyePosition(); Vector vecEnd = vecSrc + (gpGlobals->v_forward * ((pev->flags & FL_SPECTATOR) != 0 ? MAX_SPEC_ID_RANGE : MAX_ID_RANGE)); + int iSolidityTypeArray[MAX_CLIENTS + 1]; + int iClientsBits = UTIL_GetClientsSolidity(iSolidityTypeArray); // Store solidity. + iClientsBits = UTIL_SetClientsSolidity(iClientsBits, false, SOLID_SLIDEBOX); // Set solidity. UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, edict(), &tr); + UTIL_SetClientsSolidity(iClientsBits, true, 0, iSolidityTypeArray); // Restore solidity. if (tr.flFraction != 1.0f) { From 2d4d01fd0d8198bacdf476fcacaf47618e36fffb Mon Sep 17 00:00:00 2001 From: StevenKal Date: Fri, 18 Feb 2022 20:02:39 +0000 Subject: [PATCH 05/10] Update player.cpp --- regamedll/dlls/player.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 4d22cfbff..ed5c30bd8 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -7759,10 +7759,9 @@ void CBasePlayer::UpdateStatusBar() Vector vecEnd = vecSrc + (gpGlobals->v_forward * ((pev->flags & FL_SPECTATOR) != 0 ? MAX_SPEC_ID_RANGE : MAX_ID_RANGE)); int iSolidityTypeArray[MAX_CLIENTS + 1]; - int iClientsBits = UTIL_GetClientsSolidity(iSolidityTypeArray); // Store solidity. - iClientsBits = UTIL_SetClientsSolidity(iClientsBits, false, SOLID_SLIDEBOX); // Set solidity. + UTIL_ManageClientsSolidity(true, 1, SOLID_SLIDEBOX, iSolidityTypeArray); // Store in array & set solidity from variable. UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, edict(), &tr); - UTIL_SetClientsSolidity(iClientsBits, true, 0, iSolidityTypeArray); // Restore solidity. + UTIL_ManageClientsSolidity(false, 2, 0, iSolidityTypeArray); // Restore solidity from array. if (tr.flFraction != 1.0f) { From d8abfe1fa0a5aac2e9d0f3449a56d9e2230dd41b Mon Sep 17 00:00:00 2001 From: StevenKal Date: Fri, 18 Feb 2022 20:03:07 +0000 Subject: [PATCH 06/10] Update util.cpp --- regamedll/dlls/util.cpp | 50 ++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp index 9ad6d580c..b74de53ba 100644 --- a/regamedll/dlls/util.cpp +++ b/regamedll/dlls/util.cpp @@ -1854,29 +1854,25 @@ int UTIL_CountPlayersInBrushVolume(bool bOnlyAlive, CBaseEntity *pBrushEntity, i return playersInCount + playersOutCount; } -int UTIL_GetClientsSolidity(int iSolidityTypeArray[MAX_CLIENTS + 1]) { - Q_memset(iSolidityTypeArray, SOLID_NOT, sizeof(iSolidityTypeArray)); - - int iClientsBitsFound = 0; - for(int iClientID = 1; iClientID <= gpGlobals->maxClients; iClientID++) - { - CBasePlayer *pPlayer = UTIL_PlayerByIndex(iClientID); - - if (!pPlayer || pPlayer->has_disconnected || !pPlayer->IsAlive()) - continue; - - iSolidityTypeArray[iClientID] = pPlayer->pev->solid; - iClientsBitsFound |= (1<<(iClientID - 1)); +// Set modes (iSetMode): +// 0 - Do not set solidity. +// 1 - Set solidity from the value of the variable "iSolidityType". +// 2 - Set solidity from the value of the array "iSolidityTypeArray". +int UTIL_ManageClientsSolidity(bool bStore, int iSetMode, int iSolidityType, int iSolidityTypeArray[MAX_CLIENTS + 1]) { + iSetMode = clamp(iSetMode, 0, 2); + + // Note: Can not store to array & set from it at the same time! Not made for such goal! + if(bStore && iSetMode == 2) { + iSetMode = 0; } + else if(iSetMode == 0) + return 0; - return iClientsBitsFound; -} + if(bStore) { + Q_memset(iSolidityTypeArray, SOLID_NOT, sizeof(iSolidityTypeArray)); + } -int UTIL_SetClientsSolidity(int iClientsBitsToSet, bool bSetFromArray, int iSolidityType, int iSolidityTypeArray[MAX_CLIENTS + 1]) { - if(iClientsBitsToSet == 0) - return 0; - - int iClientsBitsSet = 0; + int iClientsBitsFound = 0; for(int iClientID = 1; iClientID <= gpGlobals->maxClients; iClientID++) { CBasePlayer *pPlayer = UTIL_PlayerByIndex(iClientID); @@ -1884,12 +1880,16 @@ int UTIL_SetClientsSolidity(int iClientsBitsToSet, bool bSetFromArray, int iSoli if (!pPlayer || pPlayer->has_disconnected || !pPlayer->IsAlive()) continue; - if(!(iClientsBitsToSet & (1<<(iClientID - 1)))) - continue; + if(bStore) { + iSolidityTypeArray[iClientID] = pPlayer->pev->solid; + } + + if(iSetMode) { + pPlayer->pev->solid = (iSetMode == 1) ? iSolidityType : iSolidityTypeArray[iClientID]; + } - pPlayer->pev->solid = (bSetFromArray == false) ? iSolidityType : iSolidityTypeArray[iClientID]; - iClientsBitsSet |= (1<<(iClientID - 1)); + iClientsBitsFound |= (1<<(iClientID - 1)); } - return iClientsBitsSet; + return iClientsBitsFound; } From ea1751a6379f0af86d4ddaa2e3fd59c0a8492ba3 Mon Sep 17 00:00:00 2001 From: StevenKal Date: Fri, 18 Feb 2022 20:03:26 +0000 Subject: [PATCH 07/10] Update util.h --- regamedll/dlls/util.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/regamedll/dlls/util.h b/regamedll/dlls/util.h index 3f0366d3f..6c4f411c8 100644 --- a/regamedll/dlls/util.h +++ b/regamedll/dlls/util.h @@ -354,8 +354,7 @@ class CPlayerInVolumeAdapter }; int UTIL_CountPlayersInBrushVolume(bool bOnlyAlive, CBaseEntity *pBrushEntity, int &playersInCount, int &playersOutCount, CPlayerInVolumeAdapter *pAdapter = nullptr); -int UTIL_GetClientsSolidity(int iSolidityTypeArray[MAX_CLIENTS + 1]); -int UTIL_SetClientsSolidity(int iClientsBitsToSet, bool bSetFromArray, int iSolidityType, int iSolidityTypeArray[MAX_CLIENTS + 1] = nullptr); +int UTIL_ManageClientsSolidity(bool bStore, int iSetMode, int iSolidityType, int iSolidityTypeArray[MAX_CLIENTS + 1] = nullptr); inline real_t UTIL_FixupAngle(real_t v) { From 64db5a89056e669f752b97d2936a49acafeac033 Mon Sep 17 00:00:00 2001 From: StevenKal Date: Mon, 21 Feb 2022 01:32:29 +0000 Subject: [PATCH 08/10] Update game.cpp --- regamedll/dlls/game.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 14dc2d11e..d7c54a08c 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -9,6 +9,7 @@ cvar_t *g_psv_friction = nullptr; cvar_t *g_psv_stopspeed = nullptr; cvar_t *g_psv_stepsize = nullptr; cvar_t *g_psv_clienttrace = nullptr; +cvar_t *g_psv_zmax = nullptr; cvar_t displaysoundlist = { "displaysoundlist", "0", 0, 0.0f, nullptr }; cvar_t timelimit = { "mp_timelimit", "0", FCVAR_SERVER, 0.0f, nullptr }; @@ -214,6 +215,7 @@ void EXT_FUNC GameDLLInit() g_psv_stopspeed = CVAR_GET_POINTER("sv_stopspeed"); g_psv_stepsize = CVAR_GET_POINTER("sv_stepsize"); g_psv_clienttrace = CVAR_GET_POINTER("sv_clienttrace"); + g_psv_zmax = CVAR_GET_POINTER("sv_zmax"); CVAR_REGISTER(&displaysoundlist); CVAR_REGISTER(&timelimit); From d663e5e6b3d0a750040bb49064f21d47dc57313f Mon Sep 17 00:00:00 2001 From: StevenKal Date: Mon, 21 Feb 2022 01:32:50 +0000 Subject: [PATCH 09/10] Update game.h --- regamedll/dlls/game.h | 1 + 1 file changed, 1 insertion(+) diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 5c75387b7..910ff1113 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -48,6 +48,7 @@ extern cvar_t *g_psv_friction; extern cvar_t *g_psv_stopspeed; extern cvar_t *g_psv_stepsize; extern cvar_t *g_psv_clienttrace; +extern cvar_t *g_psv_zmax; extern cvar_t *g_footsteps; extern cvar_t displaysoundlist; From b5f60274b66a77a882ba8a74ccfb3072fab42cc0 Mon Sep 17 00:00:00 2001 From: StevenKal Date: Mon, 21 Feb 2022 01:33:48 +0000 Subject: [PATCH 10/10] Update player.cpp --- regamedll/dlls/player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index ed5c30bd8..365373095 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -7756,7 +7756,7 @@ void CBasePlayer::UpdateStatusBar() UTIL_MakeVectors(pev->v_angle + pev->punchangle); Vector vecSrc = EyePosition(); - Vector vecEnd = vecSrc + (gpGlobals->v_forward * ((pev->flags & FL_SPECTATOR) != 0 ? MAX_SPEC_ID_RANGE : MAX_ID_RANGE)); + Vector vecEnd = vecSrc + (gpGlobals->v_forward * (g_psv_zmax ? g_psv_zmax->value : ((pev->flags & FL_SPECTATOR) != 0 ? MAX_SPEC_ID_RANGE : MAX_ID_RANGE))); int iSolidityTypeArray[MAX_CLIENTS + 1]; UTIL_ManageClientsSolidity(true, 1, SOLID_SLIDEBOX, iSolidityTypeArray); // Store in array & set solidity from variable.