Address parts of review
This commit is contained in:
parent
8cf5208c29
commit
ec43adda59
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Components
|
||||
{
|
||||
Dvar::Var Elevators::SV_Elevators;
|
||||
Dvar::Var Elevators::BG_Elevators;
|
||||
|
||||
int Elevators::PM_CorrectAllSolid(Game::pmove_s* pm, Game::pml_t* pml, Game::trace_t* trace)
|
||||
{
|
||||
@ -13,8 +13,8 @@ namespace Components
|
||||
auto* ps = pm->ps;
|
||||
|
||||
auto i = 0;
|
||||
const auto EleSettings = Elevators::SV_Elevators.get<int>();
|
||||
while (TRUE)
|
||||
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];
|
||||
@ -23,7 +23,7 @@ namespace Components
|
||||
Game::PM_playerTrace(pm, trace, point, point, &pm->bounds, ps->clientNum, pm->tracemask);
|
||||
|
||||
// If the player wishes to glitch without effort they can do so
|
||||
if (!trace->startsolid || EleSettings == Elevators::EASY)
|
||||
if (!trace->startsolid || elevatorSetting == Elevators::EASY)
|
||||
{
|
||||
ps->origin[0] = point[0];
|
||||
ps->origin[1] = point[1];
|
||||
@ -34,7 +34,7 @@ namespace Components
|
||||
|
||||
// If elevators are disabled we need to check that startsolid is false before proceeding
|
||||
// like later versions of the game do
|
||||
if (!trace->startsolid || EleSettings >= Elevators::ENABLED)
|
||||
if (!trace->startsolid || elevatorSetting >= Elevators::ENABLED)
|
||||
{
|
||||
pml->groundTrace.fraction = trace->fraction;
|
||||
pml->groundTrace.normal[0] = trace->normal[0];
|
||||
@ -73,13 +73,13 @@ namespace Components
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Elevators::PM_TraceStub(Game::pmove_s* pm, Game::trace_t* trace, const float* f3,
|
||||
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)
|
||||
{
|
||||
Game::PM_Trace(pm, trace, f3, f4, bounds, a6, a7);
|
||||
|
||||
// Allow the player to stand even when there is no headroom
|
||||
if (Elevators::SV_Elevators.get<int>() == Elevators::EASY)
|
||||
if (Elevators::BG_Elevators.get<int>() == Elevators::EASY)
|
||||
{
|
||||
trace->allsolid = false;
|
||||
}
|
||||
@ -112,13 +112,13 @@ namespace Components
|
||||
{
|
||||
static const char* values[] =
|
||||
{
|
||||
"Disable elevators",
|
||||
"Enable elevators",
|
||||
"Enable easy elevators",
|
||||
"off",
|
||||
"normal",
|
||||
"easy",
|
||||
nullptr
|
||||
};
|
||||
|
||||
Elevators::SV_Elevators = Game::Dvar_RegisterEnum("sv_Elevators", values,
|
||||
Elevators::BG_Elevators = Game::Dvar_RegisterEnum("bg_elevators", values,
|
||||
Elevators::ENABLED, Game::DVAR_FLAG_REPLICATED, "Elevators glitch settings");
|
||||
});
|
||||
|
||||
@ -126,7 +126,7 @@ namespace Components
|
||||
Utils::Hook(0x57369E, Elevators::PM_CorrectAllSolidStub, HOOK_CALL).install()->quick();
|
||||
|
||||
// Place hook in PM_CheckDuck
|
||||
Utils::Hook(0x570EC5, Elevators::PM_TraceStub, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x570EC5, Elevators::PM_Trace_Hk, HOOK_CALL).install()->quick();
|
||||
}
|
||||
|
||||
Elevators::~Elevators()
|
||||
|
@ -10,10 +10,10 @@ namespace Components
|
||||
|
||||
private:
|
||||
enum ElevatorSettings { DISABLED, ENABLED, EASY };
|
||||
static Dvar::Var SV_Elevators;
|
||||
static Dvar::Var BG_Elevators;
|
||||
|
||||
static int PM_CorrectAllSolid(Game::pmove_s* move, Game::pml_t* pml, Game::trace_t* trace);
|
||||
static void PM_CorrectAllSolidStub();
|
||||
static void PM_TraceStub(Game::pmove_s*, Game::trace_t*, const float*, const float*, const Game::Bounds*, int, int);
|
||||
static void PM_Trace_Hk(Game::pmove_s*, Game::trace_t*, const float*, const float*, const Game::Bounds*, int, int);
|
||||
};
|
||||
}
|
||||
|
@ -6985,16 +6985,15 @@ namespace Game
|
||||
TRACE_HITTYPE_GLASS = 4
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct trace_t
|
||||
{
|
||||
float fraction;
|
||||
float normal[3];
|
||||
int surfaceFlags;
|
||||
int contents;
|
||||
const char* material;
|
||||
TraceHitType hitType;
|
||||
unsigned __int16 hitId;
|
||||
float fractionForHitType;
|
||||
unsigned __int16 modelIndex;
|
||||
unsigned __int16 partName;
|
||||
unsigned __int16 partGroup;
|
||||
@ -7002,7 +7001,8 @@ namespace Game
|
||||
bool startsolid;
|
||||
bool walkable;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
static_assert(sizeof(trace_t) == 0x2C);
|
||||
|
||||
struct pmove_s
|
||||
{
|
||||
@ -7045,6 +7045,8 @@ namespace Game
|
||||
int holdrand;
|
||||
};
|
||||
|
||||
static_assert(sizeof(pml_t) == 0x84);
|
||||
|
||||
enum EffectiveStance
|
||||
{
|
||||
PM_EFF_STANCE_DEFAULT = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user