Skip to content

Commit 5eff131

Browse files
mjkzyDivity
andcommitted
add experimental bg_disableBarrierClips dvar
Co-Authored-By: Kenneth Skeens <73408742+divity@users.noreply.github.com>
1 parent f3a998e commit 5eff131

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

src/client/component/gameplay.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace gameplay
1717
namespace
1818
{
1919
game::dvar_t* player_sustain_ammo = nullptr;
20+
game::dvar_t* bg_disable_barrier_clips = nullptr;
2021

2122
utils::hook::detour pm_weapon_use_ammo_hook;
2223

@@ -186,6 +187,18 @@ namespace gameplay
186187
pm_crashland_hook.invoke<void>(ps, pml);
187188
}
188189
}
190+
191+
utils::hook::detour pmove_single_hook;
192+
void pmove_single_stub(game::pmove_t* pm, void* a2, unsigned int a3, int a4, int a5)
193+
{
194+
if (bg_disable_barrier_clips && bg_disable_barrier_clips->current.enabled && pm)
195+
{
196+
pm->tracemask &= ~0x10000;
197+
pm->tracemask |= 0x400;
198+
}
199+
200+
pmove_single_hook.invoke<void>(pm, a2, a3, a4, a5);
201+
}
189202
}
190203

191204
class component final : public component_interface
@@ -228,8 +241,12 @@ namespace gameplay
228241
// Implement fall damage dvar
229242
dvars::jump_enableFallDamage = game::Dvar_RegisterBool("jump_enableFallDamage", true, game::DVAR_FLAG_REPLICATED, "Enable fall damage");
230243
pm_crashland_hook.create(0x1406F9860, pm_crashland_stub);
244+
245+
// Add a feature to toggle barrier clips on maps
246+
bg_disable_barrier_clips = game::Dvar_RegisterBool("bg_disableBarrierClips", false, game::DVAR_FLAG_REPLICATED, "(Experimental) Disables barrier clips in maps to access things easily");
247+
pmove_single_hook.create(0x14070F530, pmove_single_stub);
231248
}
232249
};
233250
}
234251

235-
REGISTER_COMPONENT(gameplay::component)
252+
REGISTER_COMPONENT(gameplay::component)

src/client/game/structs.hpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -879,13 +879,14 @@ namespace game
879879

880880
struct pmove_t
881881
{
882-
void* unk;
883-
playerState_s* ps;
884-
usercmd_s cmd;
885-
usercmd_s oldcmd;
886-
char __pad0[312];
887-
void* weaponMap;
888-
unsigned char handler;
882+
void* unk; // 0
883+
playerState_s* ps; // 8
884+
usercmd_s cmd; // 16
885+
usercmd_s oldcmd; // 136
886+
int tracemask; // 256
887+
char __pad1[304]; // 264
888+
void* weaponMap; // 568
889+
unsigned char handler; // 576
889890
};
890891
assert_offsetof(pmove_t, handler, 576);
891892
assert_offsetof(pmove_t, weaponMap, 568);

0 commit comments

Comments
 (0)