Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions HaloCEVR/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,11 @@ bool Game::GetCalculatedHandPositions(Matrix4& controllerTransform, Vector3& dom
return inputHandler.GetCalculatedHandPositions(controllerTransform, dominantHandPos, offHand);
}

bool Game::ShouldBlockAutoReloadStart() const
{
return inputHandler.ShouldBlockAutoReloadStart();
}

void Game::ReloadStart(HaloID param1, short param2, bool param3)
{
VR_PROFILE_SCOPE(Game_ReloadStart);
Expand Down Expand Up @@ -1092,6 +1097,8 @@ void Game::SetupConfigs()
c_LeftShoulderHolsterOffset = config.RegisterVector3("LeftShoulderHolsterOffset", "The (foward, left, up) Offset of the left shoulder holster relative to the headset's location", Vector3(-0.15f, 0.25f, -0.25f));
c_RightShoulderHolsterActivationDistance = config.RegisterFloat("RightShoulderHolsterDistance", "The 'size' of the right shoulder holster. This is the distance that the dominant hand needs to be from the holster to change weapons (<0 to disable)", 0.3f);
c_RightShoulderHolsterOffset = config.RegisterVector3("RightShoulderHolsterOffset", "The (foward, left, up) Offset of the right shoulder holster relative to the headset's location", Vector3(-0.15f, -0.25f, -0.25f));
// Manual reload settings
c_DisableEmptyMagazineAutoReload = config.RegisterBool("DisableEmptyMagazineAutoReload", "When enabled, the game will not automatically reload when the magazine is empty. Press Reload to reload manually", false);
// Misc settings
c_ShowRoomCentre = config.RegisterBool("ShowRoomCentre", "Draw an indicator at your feet to show where the player character is actually positioned", true);
c_d3d9Path = config.RegisterString("CustomD3D9Path", "If set first try to load d3d9.dll from the specified path instead of from system32", "");
Expand Down
2 changes: 2 additions & 0 deletions HaloCEVR/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Game
bool GetCalculatedHandPositions(Matrix4& controllerTransform, Vector3& dominantHandPos, Vector3& offHand);
void ReloadStart(HaloID param1, short param2, bool param3);
void ReloadEnd(short param1, HaloID param2);
bool ShouldBlockAutoReloadStart() const;

void UpdateInputs();
void CalculateSmoothedInput();
Expand Down Expand Up @@ -237,6 +238,7 @@ class Game
FloatProperty* c_LeftHandMeleeSwingSpeed = nullptr;
FloatProperty* c_RightHandMeleeSwingSpeed = nullptr;
FloatProperty* c_CrouchHeight = nullptr;
BoolProperty* c_DisableEmptyMagazineAutoReload = nullptr;
BoolProperty* c_ShowRoomCentre = nullptr;
BoolProperty* c_ToggleGrip = nullptr;
FloatProperty* c_TwoHandDistance = nullptr;
Expand Down
6 changes: 6 additions & 0 deletions HaloCEVR/Hooking/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,12 @@ void Hooks::H_ReloadStart(HaloID param1, short param2, bool param3)
{
VR_PROFILE_SCOPE(Hooks_ReloadStart);

// Block auto-reload from starting.
if (Game::instance.ShouldBlockAutoReloadStart())
{
return;
}

ReloadStart.Original(param1, param2, param3);

Game::instance.ReloadStart(param1, param2, param3);
Expand Down
11 changes: 11 additions & 0 deletions HaloCEVR/InputHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
#define ApplyBoolInput(x) controls.##x = vr->GetBoolInput(x) ? 127 : 0;
#define ApplyImpulseBoolInput(x) controls.##x = vr->GetBoolInput(x, bHasChanged) && bHasChanged ? 127 : 0;

bool InputHandler::ShouldBlockAutoReloadStart() const
{
if (!Game::instance.c_DisableEmptyMagazineAutoReload->Value())
{
return false;
}

IVR* vr = Game::instance.GetVR();
return !vr->GetBoolInput(Reload);
}

void InputHandler::RegisterInputs()
{
IVR* vr = Game::instance.GetVR();
Expand Down
2 changes: 2 additions & 0 deletions HaloCEVR/InputHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class InputHandler
bool GetCalculatedHandPositions(Matrix4& controllerTransform, Vector3& dominantHandPos, Vector3& offHand);
void CalculateSmoothedInput();

bool ShouldBlockAutoReloadStart() const;

Vector3 smoothedPosition = Vector3(0.0f, 0.0f, 0.0f);

// Track previous yaw offset to detect snap turns for weapon position smoothing
Expand Down