Fix underwater switch jump spam issue

This commit is contained in:
Lwmte 2024-12-30 08:33:00 +01:00
parent 5597750c2c
commit 147aea42f5
2 changed files with 4 additions and 8 deletions

View file

@ -11,6 +11,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Fixed issues with launching the engine from directories with non-Western characters in the path.
* Fixed rare case of not being able to start a new game or exit game from the main menu on very slow GPUs.
* Fixed occasional crashes with creatures stuck in a sector with no pathfinding set.
* Fixed occasional cases of underwater switch animation not playing, if player spams jump key while pulling the switch.
* Fixed antialiasing quality not changing after changing it in display settings.
* Fixed endless explosion effect for Puna.
* Fixed diary pick-up item inventory state not preserved in the savegame.

View file

@ -62,7 +62,7 @@ namespace TEN::Entities::Switches
auto* lara = GetLaraInfo(laraItem);
auto* switchItem = &g_Level.Items[itemNumber];
if (IsHeld(In::Action) &&
if (IsHeld(In::Action) && !IsHeld(In::Jump) &&
switchItem->Status == ITEM_NOT_ACTIVE &&
lara->Control.WaterStatus == WaterStatus::Underwater &&
lara->Control.HandStatus == HandStatus::Free &&
@ -75,15 +75,10 @@ namespace TEN::Entities::Switches
{
if (MoveLaraPosition(UnderwaterSwitchPos, switchItem, laraItem))
{
SetAnimation(laraItem, LA_WATERLEVER_PULL);
laraItem->Animation.Velocity.y = 0;
laraItem->Animation.TargetState = LS_SWITCH_DOWN;
do
{
AnimateItem(laraItem);
} while (laraItem->Animation.TargetState != LS_SWITCH_DOWN);
laraItem->Animation.TargetState = LS_UNDERWATER_IDLE;
lara->Control.HandStatus = HandStatus::Busy;
switchItem->Animation.TargetState = switchItem->Animation.ActiveState != SWITCH_ON;
switchItem->Status = ITEM_ACTIVE;