Merge pull request #253 from diamante0018/elevators

Clarify some things in the elevators patch
This commit is contained in:
Edo 2022-05-07 09:47:58 -04:00 committed by GitHub
commit 099b779db2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>(); const auto elevatorSetting = Elevators::BG_Elevators.get<int>();
while (true) while (true)
{ {
point[0] = ps->origin[0] + Game::CorrectSolidDeltas[i][0]; point[0] = ps->origin[0] + (*Game::CorrectSolidDeltas)[i][0];
point[1] = ps->origin[1] + Game::CorrectSolidDeltas[i][1]; point[1] = ps->origin[1] + (*Game::CorrectSolidDeltas)[i][1];
point[2] = ps->origin[2] + Game::CorrectSolidDeltas[i][2]; point[2] = ps->origin[2] + (*Game::CorrectSolidDeltas)[i][2];
Game::PM_playerTrace(pm, trace, point, point, &pm->bounds, ps->clientNum, pm->tracemask); Game::PM_playerTrace(pm, trace, point, point, &pm->bounds, ps->clientNum, pm->tracemask);
@ -40,8 +40,8 @@ namespace Components
} }
} }
i += 1; ++i;
if (i >= 26) if (i >= 26) // CorrectSolidDeltas count
{ {
ps->groundEntityNum = Game::ENTITYNUM_NONE; ps->groundEntityNum = Game::ENTITYNUM_NONE;
pml->groundPlane = 0; pml->groundPlane = 0;
@ -62,15 +62,15 @@ namespace Components
return 1; return 1;
} }
void Elevators::PM_Trace_Hk(Game::pmove_s* pm, Game::trace_t* trace, const float* f3, void Elevators::PM_Trace_Hk(Game::pmove_s* pm, Game::trace_t* results, const float* start,
const float* f4, const Game::Bounds* bounds, int a6, int a7) 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 // Allow the player to stand even when there is no headroom
if (Elevators::BG_Elevators.get<int>() == Elevators::EASY) 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"); Elevators::ENABLED, Game::DVAR_CODINFO, "Elevators glitch settings");
}); });
//Replace PM_CorrectAllSolid Utils::Hook(0x57369E, Elevators::PM_CorrectAllSolidStub, HOOK_CALL).install()->quick(); // PM_GroundTrace
Utils::Hook(0x57369E, Elevators::PM_CorrectAllSolidStub, HOOK_CALL).install()->quick();
// Place hooks in PM_CheckDuck. If the elevators dvar is set to easy the // 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 // flags for duck/prone will always be removed from the player state

View File

@ -548,11 +548,11 @@ namespace Game
FastCriticalSection* db_hashCritSect = reinterpret_cast<FastCriticalSection*>(0x16B8A54); 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); level_locals_t* level = reinterpret_cast<level_locals_t*>(0x1A831A8);
float(*penetrationDepthTable)[PENETRATE_TYPE_COUNT][SURF_TYPE_COUNT] = reinterpret_cast<float(*)[PENETRATE_TYPE_COUNT][SURF_TYPE_COUNT]>(0x7C4878); float (*penetrationDepthTable)[PENETRATE_TYPE_COUNT][SURF_TYPE_COUNT] = reinterpret_cast<float(*)[PENETRATE_TYPE_COUNT][SURF_TYPE_COUNT]>(0x7C4878);
WinMouseVars_t* s_wmv = reinterpret_cast<WinMouseVars_t*>(0x649D640); WinMouseVars_t* s_wmv = reinterpret_cast<WinMouseVars_t*>(0x649D640);

View File

@ -1002,10 +1002,10 @@ namespace Game
typedef void(__cdecl * Jump_ClearState_t)(playerState_s* ps); typedef void(__cdecl * Jump_ClearState_t)(playerState_s* ps);
extern Jump_ClearState_t Jump_ClearState; 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; 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; extern PM_Trace_t PM_Trace;
typedef EffectiveStance(__cdecl * PM_GetEffectiveStance_t)(const playerState_s* ps); typedef EffectiveStance(__cdecl * PM_GetEffectiveStance_t)(const playerState_s* ps);
@ -1148,13 +1148,13 @@ namespace Game
constexpr auto MAX_MODELS = 512; constexpr auto MAX_MODELS = 512;
extern XModel** cached_models; extern XModel** cached_models;
extern vec3_t* CorrectSolidDeltas; extern float (*CorrectSolidDeltas)[26][3];
extern FastCriticalSection* db_hashCritSect; extern FastCriticalSection* db_hashCritSect;
extern level_locals_t* level; extern level_locals_t* level;
extern float(*penetrationDepthTable)[PENETRATE_TYPE_COUNT][SURF_TYPE_COUNT]; extern float (*penetrationDepthTable)[PENETRATE_TYPE_COUNT][SURF_TYPE_COUNT];
extern WinMouseVars_t* s_wmv; extern WinMouseVars_t* s_wmv;