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