Skip to content

Commit a747240

Browse files
committed
configurable movespeed
1 parent 7d23805 commit a747240

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

MGS3CrouchWalk/dllmain.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ MotionControl* mCtrlGlobal = NULL;
1313
mINI::INIStructure Config;
1414

1515
float CamoIndexModifier = 1.0f;
16+
float CrouchWalkSpeed = 6.0f;
17+
float CrouchStalkSpeed = 3.0f;
1618
int CamoIndexValue = 0;
1719
bool CrouchWalkEnabled = false;
1820
bool CrouchMoving = false;
@@ -77,7 +79,7 @@ int* __fastcall CalculateCamoIndexHook(int* a1, int a2)
7779
{
7880
int* result = CalculateCamoIndex(a1, a2);
7981

80-
if (CamoIndexData == NULL || CrouchWalkEnabled || !CrouchMoving)
82+
if (CamoIndexData == NULL || !CrouchWalkEnabled || !CrouchMoving)
8183
return result;
8284

8385
int index = a2 << 7;
@@ -130,7 +132,7 @@ int* __fastcall ActionSquatStillHook(int64_t work, MovementWork* plWork, int64_t
130132
plWork->motion = PlayerSetMotion(work, PlayerMotion::StandMoveStalk); // hijack the stalking motion
131133

132134
if (mCtrlGlobal != NULL)
133-
mCtrlGlobal->mtcmControl->motionTimeBase = CrouchMovingSlow ? 3.0 : 6.0;
135+
mCtrlGlobal->mtcmControl->motionTimeBase = CrouchMovingSlow ? CrouchStalkSpeed : CrouchWalkSpeed;
134136

135137
CrouchWalkEnabled = true;
136138
}
@@ -175,6 +177,8 @@ void ReadConfig()
175177
file.read(Config);
176178
CamoIndexModifier = std::stof(Config["Settings"]["CamoIndexModifier"]);
177179
CamoIndexValue = std::stoi(Config["Settings"]["CamoIndexValue"]) * 10;
180+
CrouchWalkSpeed = std::stof(Config["Settings"]["CrouchWalkSpeed"]);
181+
CrouchStalkSpeed = std::stof(Config["Settings"]["CrouchStalkSpeed"]);
178182
}
179183

180184
DWORD WINAPI MainThread(LPVOID lpParam)

0 commit comments

Comments
 (0)