Skip to content

Commit

Permalink
Merge pull request #497 from pas-de-2/UpdateAnalogTurning
Browse files Browse the repository at this point in the history
Tweaked SmoothAnalogTurning
  • Loading branch information
nipkownix committed Mar 19, 2023
2 parents fd755ec + 3e0c2f7 commit 17029b2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
6 changes: 3 additions & 3 deletions dllmain/ControllerTweaks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void re4t::init::ControllerTweaks()
float deltaAnalogLX = RawAnalogLX / 32767.0f; // use RawAnalog so we can establish a deadzone independent of Xinput override
if (abs(deltaAnalogLX) > LXDeadZone)
{
float turnSpeed = cPlayer__SPEED_WALK_TURN * std::min((abs(deltaAnalogLX) - LXDeadZone) / (1.0f - LXDeadZone - .15f), 1.0f);
float turnSpeed = 1.4f * cPlayer__SPEED_WALK_TURN * std::min((abs(deltaAnalogLX) - LXDeadZone) / (1.0f - LXDeadZone - .10f), 1.0f);

if (deltaAnalogLX > 0.0f)
PlayerPtr()->ang_A0.y -= GlobalPtr()->deltaTime_70 * turnSpeed;
Expand Down Expand Up @@ -185,7 +185,7 @@ void re4t::init::ControllerTweaks()
float deltaAnalogLX = RawAnalogLX / 32767.0f;
if (abs(deltaAnalogLX) > LXDeadZone)
{
float turnSpeed = cPlayer__SPEED_RUN_TURN * std::min((abs(deltaAnalogLX) - LXDeadZone) / (1.0f - LXDeadZone - .15f), 1.0f) * pl_speed2_xxx_1216;
float turnSpeed = 1.4f * cPlayer__SPEED_RUN_TURN * std::min((abs(deltaAnalogLX) - LXDeadZone) / (1.0f - LXDeadZone - .10f), 1.0f) * pl_speed2_xxx_1216;

if (deltaAnalogLX > 0.0f)
PlayerPtr()->ang_A0.y -= GlobalPtr()->deltaTime_70 * turnSpeed;
Expand Down Expand Up @@ -214,7 +214,7 @@ void re4t::init::ControllerTweaks()
if (isController() && re4t::cfg->bSmoothAnalogTurning)
{
float deltaAnalogLX = RawAnalogLX / 32767.0f;
float turnSpeed = cPlayer__SPEED_WALK_TURN * std::min((deltaAnalogLX / (1.0f - .15f)), 1.0f);
float turnSpeed = 1.4f * cPlayer__SPEED_WALK_TURN * std::min((deltaAnalogLX / (1.0f - .10f)), 1.0f);

PlayerPtr()->ang_A0.y -= GlobalPtr()->deltaTime_70 * turnSpeed;
}
Expand Down
23 changes: 19 additions & 4 deletions dllmain/Gameplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,27 @@ void re4t::init::Gameplay()
if (re4t::cfg->bEnableNTSCMode)
{
// Normal mode and Separate Ways: increased starting difficulty (3500->5500)
auto pattern = hook::pattern("8A 50 ? FE CA 0F B6 C2");
Patch(pattern.count(1).get(0).get<uint32_t>(0), { 0xB2, 0x01, 0x90 }); // GamePointInit, { mov dl, 1 }
auto pattern = hook::pattern("05 7C 15 00 00 6A 00 89 81 94 4F 00 00");
struct GamePointInit_NormalGameRank
{
void operator()(injector::reg_pack& regs)
{
*(uint32_t*)(regs.ecx + 0x4F94) = SystemSavePtr()->language_8 == 1 || re4t::cfg->bEnableNTSCMode ? 5500 : 3500;
}
}; injector::MakeInline<GamePointInit_NormalGameRank>(pattern.count(1).get(0).get<uint32_t>(7), pattern.count(1).get(0).get<uint32_t>(13));

// Assignment Ada: increased difficulty (4500->6500)
pattern = hook::pattern("66 39 B1 ? ? 00 00 75 10");
injector::MakeNOP(pattern.count(1).get(0).get<uint32_t>(7), 2); // GameAddPoint
pattern = hook::pattern("8B ? ? ? ? ? 80 7E 08 01 74");
struct GameAddPoint_AAdaGameRank
{
void operator()(injector::reg_pack& regs)
{
if (SystemSavePtr()->language_8 == 1 || re4t::cfg->bEnableNTSCMode)
regs.ef |= (1 << regs.zero_flag);
else
regs.ef &= ~(1 << regs.zero_flag);
}
}; injector::MakeInline<GameAddPoint_AAdaGameRank>(pattern.count(1).get(0).get<uint32_t>(0), pattern.count(1).get(0).get<uint32_t>(10));

// Shooting range: increased bottle cap score requirements (1000->3000)
pattern = hook::pattern("8B F9 8A ? ? 8B ? ? FE C9");
Expand Down
4 changes: 2 additions & 2 deletions dllmain/cfgMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1489,8 +1489,8 @@ void cfgMenuRender()
ImGui_ItemSeparator();

ImGui::Dummy(ImVec2(10, 10 * esHook._cur_monitor_dpi));
ImGui::TextWrapped("Unlocks minor difficulty boosts previously exclusive to the North American console versions of RE4.");
ImGui::TextWrapped("Higher starting adaptive difficulty, more difficult Ada missions, and a more difficult Mercenaries village stage.");
ImGui::TextWrapped("Unlocks minor difficulty modifiers previously exclusive to the North American console versions of RE4.");
ImGui::TextWrapped("Higher starting adaptive difficulty in Normal mode and Separate Ways, higher fixed difficulty in Assignment Ada, and unlocked dynamic difficulty in the Mercenaries village stage.");
ImGui::TextWrapped("Bottle caps require 3000 points in the shooting gallery, and Easy difficulty is removed from the title menu.");
}

Expand Down
4 changes: 2 additions & 2 deletions settings/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ AshleyJPCameraAngles = false
; Adds a menu to choose between Normal and Professional difficulty modes when starting a new game of Separate Ways.
SeparateWaysProfessional = true

; Unlocks minor difficulty boosts previously exclusive to the NTSC console versions of RE4.
; Higher starting adaptive difficulty, more difficult Ada missions, and a more difficult Mercenaries village stage.
; Unlocks minor difficulty modifiers previously exclusive to the North American console versions of RE4.
; Higher starting adaptive difficulty in Normal mode and Separate Ways, higher fixed difficulty in Assignment Ada, and unlocked dynamic difficulty in the Mercenaries village stage.
; Bottle caps require 3000 points in the shooting gallery, and Easy difficulty is removed from the title menu.
EnableNTSCMode = false

Expand Down

0 comments on commit 17029b2

Please sign in to comment.