Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions regamedll/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -236,6 +237,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);
Expand Down
1 change: 1 addition & 0 deletions regamedll/dlls/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7950,9 +7950,12 @@ 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.
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, edict(), &tr);
UTIL_ManageClientsSolidity(false, 2, 0, iSolidityTypeArray); // Restore solidity from array.

if (tr.flFraction != 1.0f)
{
Expand Down
40 changes: 40 additions & 0 deletions regamedll/dlls/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1857,3 +1857,43 @@ int UTIL_CountPlayersInBrushVolume(bool bOnlyAlive, CBaseEntity *pBrushEntity, i

return playersInCount + playersOutCount;
}

// 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;

if(bStore) {
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;

if(bStore) {
iSolidityTypeArray[iClientID] = pPlayer->pev->solid;
}

if(iSetMode) {
pPlayer->pev->solid = (iSetMode == 1) ? iSolidityType : iSolidityTypeArray[iClientID];
}

iClientsBitsFound |= (1<<(iClientID - 1));
}

return iClientsBitsFound;
}
1 change: 1 addition & 0 deletions regamedll/dlls/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ class CPlayerInVolumeAdapter
};

int UTIL_CountPlayersInBrushVolume(bool bOnlyAlive, CBaseEntity *pBrushEntity, int &playersInCount, int &playersOutCount, CPlayerInVolumeAdapter *pAdapter = nullptr);
int UTIL_ManageClientsSolidity(bool bStore, int iSetMode, int iSolidityType, int iSolidityTypeArray[MAX_CLIENTS + 1] = nullptr);

inline real_t UTIL_FixupAngle(real_t v)
{
Expand Down