elevators for sp and list some dvars

This commit is contained in:
Skull 2022-07-18 04:51:24 +03:00
parent c2a2c6f174
commit 2bc11cec20
2 changed files with 26 additions and 10 deletions

View File

@ -166,11 +166,11 @@ namespace gameplay
a.jnz(allsolid); a.jnz(allsolid);
a.bind(stand); a.bind(stand);
a.and_(dword_ptr(r15, 0x54), 0xFFFFFFFD); a.and_(dword_ptr(SELECT_VALUE(r14, r15), 0x54), 0xFFFFFFFD);
a.jmp(0x2C9F9D_b); a.jmp(SELECT_VALUE(0x499628_b, 0x2C9F9D_b));
a.bind(allsolid); a.bind(allsolid);
a.jmp(0x2C9F9F_b); a.jmp(SELECT_VALUE(0x6878D4_b, 0x2C9F9F_b));
}; };
void client_end_frame_stub2(game::mp::gentity_s* entity) void client_end_frame_stub2(game::mp::gentity_s* entity)
@ -273,6 +273,13 @@ namespace gameplay
public: public:
void post_unpack() override void post_unpack() override
{ {
// Influence PM_JitterPoint code flow so the trace->startsolid checks are 'ignored'
pm_player_trace_hook.create(SELECT_VALUE(0x4A0A90_b, 0x2D14C0_b), &pm_player_trace_stub);
// If g_enableElevators is 1 the 'ducked' flag will always be removed from the player state
utils::hook::jump(SELECT_VALUE(0x499617_b, 0x2C9F90_b), utils::hook::assemble(pm_trace_stub), true);
dvars::g_enableElevators = dvars::register_bool("g_enableElevators", false, game::DVAR_FLAG_REPLICATED, "Enables Elevators");
if (game::environment::is_sp()) if (game::environment::is_sp())
{ {
return; return;
@ -300,12 +307,6 @@ namespace gameplay
utils::hook::jump(0x3FF812_b, client_end_frame_stub(), true); utils::hook::jump(0x3FF812_b, client_end_frame_stub(), true);
utils::hook::nop(0x3FF808_b, 1); utils::hook::nop(0x3FF808_b, 1);
// Influence PM_JitterPoint code flow so the trace->startsolid checks are 'ignored'
pm_player_trace_hook.create(0x2D14C0_b, &pm_player_trace_stub);
// If g_enableElevators is 1 the 'ducked' flag will always be removed from the player state
utils::hook::jump(0x2C9F90_b, utils::hook::assemble(pm_trace_stub), true);
dvars::g_enableElevators = dvars::register_bool("g_enableElevators", false, game::DVAR_FLAG_REPLICATED, "Enables Elevators");
auto* timescale = dvars::register_float("timescale", 1.0f, 0.1f, 50.0f, game::DVAR_FLAG_REPLICATED, "Changes Timescale of the game"); auto* timescale = dvars::register_float("timescale", 1.0f, 0.1f, 50.0f, game::DVAR_FLAG_REPLICATED, "Changes Timescale of the game");
utils::hook::inject(0x15B204_b, &timescale->current.value); // Com_GetTimeScale utils::hook::inject(0x15B204_b, &timescale->current.value); // Com_GetTimeScale
utils::hook::inject(0x17D243_b, &timescale->current.value); // Com_Restart utils::hook::inject(0x17D243_b, &timescale->current.value); // Com_Restart

View File

@ -3757,7 +3757,7 @@ namespace dvars
}, },
{ {
"g_ai", "g_ai",
"Enable AI.", "Enable AI",
generate_hash("g_ai") generate_hash("g_ai")
}, },
{ {
@ -4160,6 +4160,16 @@ namespace dvars
"Time after the last talk packet was received that the player is considered by the\nserver to still be talking in milliseconds", "Time after the last talk packet was received that the player is considered by the\nserver to still be talking in milliseconds",
generate_hash("g_voiceChatTalkingDuration") generate_hash("g_voiceChatTalkingDuration")
}, },
{
"g_gravity",
"Game gravity in inches per second squared",
generate_hash("g_gravity")
},
{
"g_speed",
"changes the speed of the player",
generate_hash("g_speed")
},
{ {
"gamedate", "gamedate",
"The date compiled", "The date compiled",
@ -4605,6 +4615,11 @@ namespace dvars
"Slow player movement after jumping", "Slow player movement after jumping",
generate_hash("jump_slowdownEnable") generate_hash("jump_slowdownEnable")
}, },
{
"jump_height",
"The maximum height of a player\'s jump",
generate_hash("jump_height")
},
{ {
"laserDebug", "laserDebug",
"Enables the display of various debug info.", "Enables the display of various debug info.",