Clarify some things in the elevators patch

This commit is contained in:
FutureRave 2022-05-05 10:20:10 +01:00
parent 6737106785
commit 9685dccdcd
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955
3 changed files with 16 additions and 17 deletions

View File

@ -16,9 +16,9 @@ namespace Components
const auto elevatorSetting = Elevators::BG_Elevators.get<int>();
while (true)
{
point[0] = ps->origin[0] + Game::CorrectSolidDeltas[i][0];
point[1] = ps->origin[1] + Game::CorrectSolidDeltas[i][1];
point[2] = ps->origin[2] + Game::CorrectSolidDeltas[i][2];
point[0] = ps->origin[0] + (*Game::CorrectSolidDeltas)[i][0];
point[1] = ps->origin[1] + (*Game::CorrectSolidDeltas)[i][1];
point[2] = ps->origin[2] + (*Game::CorrectSolidDeltas)[i][2];
Game::PM_playerTrace(pm, trace, point, point, &pm->bounds, ps->clientNum, pm->tracemask);
@ -40,8 +40,8 @@ namespace Components
}
}
i += 1;
if (i >= 26)
++i;
if (i >= 26) // CorrectSolidDeltas count
{
ps->groundEntityNum = Game::ENTITYNUM_NONE;
pml->groundPlane = 0;
@ -62,15 +62,15 @@ namespace Components
return 1;
}
void Elevators::PM_Trace_Hk(Game::pmove_s* pm, Game::trace_t* trace, const float* f3,
const float* f4, const Game::Bounds* bounds, int a6, int a7)
void Elevators::PM_Trace_Hk(Game::pmove_s* pm, Game::trace_t* results, const float* start,
const float* end, const Game::Bounds* bounds, int passEntityNum, int contentMask)
{
Game::PM_Trace(pm, trace, f3, f4, bounds, a6, a7);
Game::PM_Trace(pm, results, start, end, bounds, passEntityNum, contentMask);
// Allow the player to stand even when there is no headroom
if (Elevators::BG_Elevators.get<int>() == Elevators::EASY)
{
trace->allsolid = false;
results->allsolid = false;
}
}
@ -111,8 +111,7 @@ namespace Components
Elevators::ENABLED, Game::DVAR_CODINFO, "Elevators glitch settings");
});
//Replace PM_CorrectAllSolid
Utils::Hook(0x57369E, Elevators::PM_CorrectAllSolidStub, HOOK_CALL).install()->quick();
Utils::Hook(0x57369E, Elevators::PM_CorrectAllSolidStub, HOOK_CALL).install()->quick(); // PM_GroundTrace
// Place hooks in PM_CheckDuck. If the elevators dvar is set to easy the
// flags for duck/prone will always be removed from the player state

View File

@ -547,7 +547,7 @@ namespace Game
FastCriticalSection* db_hashCritSect = reinterpret_cast<FastCriticalSection*>(0x16B8A54);
vec3_t* CorrectSolidDeltas = reinterpret_cast<vec3_t*>(0x739BB8); // Count 26
float (*CorrectSolidDeltas)[26][3] = reinterpret_cast<float(*)[26][3]>(0x739BB8); // Count 26
level_locals_t* level = reinterpret_cast<level_locals_t*>(0x1A831A8);

View File

@ -999,10 +999,10 @@ namespace Game
typedef void(__cdecl * Jump_ClearState_t)(playerState_s* ps);
extern Jump_ClearState_t Jump_ClearState;
typedef void(__cdecl * PM_playerTrace_t)(pmove_s*, trace_t*, const float*, const float*, const Bounds*, int, int);
typedef void(__cdecl * PM_playerTrace_t)(pmove_s* pm, trace_t* results, const float* start, const float* end, const Bounds* bounds, int passEntityNum, int contentMask);
extern PM_playerTrace_t PM_playerTrace;
typedef void(__cdecl * PM_Trace_t)(pmove_s*, trace_t*, const float*, const float*, const Bounds*, int, int);
typedef void(__cdecl * PM_Trace_t)(pmove_s* pm, trace_t* results, const float* start, const float* end, const Bounds* bounds, int passEntityNum, int contentMask);
extern PM_Trace_t PM_Trace;
typedef EffectiveStance(__cdecl * PM_GetEffectiveStance_t)(const playerState_s* ps);
@ -1145,7 +1145,7 @@ namespace Game
constexpr auto MAX_MODELS = 512;
extern XModel** cached_models;
extern vec3_t* CorrectSolidDeltas;
extern float (*CorrectSolidDeltas)[26][3];
extern FastCriticalSection* db_hashCritSect;