diff --git a/TR5Main/Game/Lara/lara_helpers.cpp b/TR5Main/Game/Lara/lara_helpers.cpp index 5f3b17d1f..b4f330c23 100644 --- a/TR5Main/Game/Lara/lara_helpers.cpp +++ b/TR5Main/Game/Lara/lara_helpers.cpp @@ -215,7 +215,7 @@ void SetLaraRunJumpQueue(ITEM_INFO* item, COLL_INFO* coll) (probe.Position.Floor - y) >= CLICK(0.5f)) && // OR there is a drop below far ahead. probe.Position.Floor != NO_HEIGHT) { - info->runJumpQueued = (item->targetState == LS_RUN_FORWARD); + info->runJumpQueued = IsRunJumpQueueableState((LARA_STATE)item->targetState); } else info->runJumpQueued = false; @@ -348,11 +348,11 @@ void HandleLaraMovementParameters(ITEM_INFO* item, COLL_INFO* coll) LaraInfo*& info = item->data; // Reset running jump timer. - if (!IsRunJumpCountState((LARA_STATE)item->activeState)) + if (!IsRunJumpCountableState((LARA_STATE)item->activeState)) info->runJumpCount = 0; // Reset running jump action queue. - if (item->activeState != LS_RUN_FORWARD) + if (!IsRunJumpQueueableState((LARA_STATE)item->activeState)) info->runJumpQueued = false; // Reset projected height value used by step function. diff --git a/TR5Main/Game/Lara/lara_tests.cpp b/TR5Main/Game/Lara/lara_tests.cpp index 0bb0e68fa..b21b9bcd6 100644 --- a/TR5Main/Game/Lara/lara_tests.cpp +++ b/TR5Main/Game/Lara/lara_tests.cpp @@ -1216,7 +1216,19 @@ bool IsJumpState(LARA_STATE state) return false; } -bool IsRunJumpCountState(LARA_STATE state) +bool IsRunJumpQueueableState(LARA_STATE state) +{ + if (state == LS_RUN_FORWARD || + state == LS_STEP_UP || + state == LS_STEP_DOWN) + { + return true; + } + + return false; +} + +bool IsRunJumpCountableState(LARA_STATE state) { if (state == LS_RUN_FORWARD || state == LS_WALK_FORWARD || @@ -1344,20 +1356,32 @@ bool TestLaraMoveTolerance(ITEM_INFO* item, COLL_INFO* coll, MoveTestSetup testS bool isSlopeUp = testSetup.CheckSlopeUp ? (probe.Position.FloorSlope && probe.Position.Floor < y) : false; bool isDeath = testSetup.CheckDeath ? probe.Block->Flags.Death : false; + auto start1 = GAME_VECTOR(item->pos.xPos, + y + testSetup.UpperFloorBound - 1, + item->pos.zPos, + item->roomNumber); + + auto end1 = GAME_VECTOR(probe.Coordinates.x, + y + testSetup.UpperFloorBound - 1, + probe.Coordinates.z, + item->roomNumber); + + auto start2 = GAME_VECTOR(item->pos.xPos, + y - coll->Setup.Height + 1, + item->pos.zPos, + item->roomNumber); + + auto end2 = GAME_VECTOR(probe.Coordinates.x, + probe.Coordinates.y + 1, + probe.Coordinates.z, + item->roomNumber); + // Conduct "ray" test at upper floor bound. - auto start = GAME_VECTOR( - item->pos.xPos, - y + testSetup.UpperFloorBound - 1, - item->pos.zPos, - item->roomNumber); + if (!LOS(&start1, &end1)) + return false; - auto end = GAME_VECTOR( - probe.Coordinates.x, - probe.Coordinates.y - 1, - probe.Coordinates.z, - item->roomNumber); - - if (!LOS(&start, &end)) + // Conduct "ray" test at lowest ceiling bound. + if (!LOS(&start2, &end2)) return false; // Assess move feasibility to location ahead. @@ -1525,20 +1549,32 @@ bool TestLaraCrawlMoveTolerance(ITEM_INFO* item, COLL_INFO* coll, MoveTestSetup bool isSlopeUp = testSetup.CheckSlopeUp ? (probe.Position.FloorSlope && probe.Position.Floor < y) : false; bool isDeath = testSetup.CheckDeath ? probe.Block->Flags.Death : false; + auto start1 = GAME_VECTOR(item->pos.xPos, + y + testSetup.UpperFloorBound - 1, + item->pos.zPos, + item->roomNumber); + + auto end1 = GAME_VECTOR(probe.Coordinates.x, + y + testSetup.UpperFloorBound - 1, + probe.Coordinates.z, + item->roomNumber); + + auto start2 = GAME_VECTOR(item->pos.xPos, + y - LARA_HEIGHT_CRAWL + 1, + item->pos.zPos, + item->roomNumber); + + auto end2 = GAME_VECTOR(probe.Coordinates.x, + probe.Coordinates.y + 1, + probe.Coordinates.z, + item->roomNumber); + // Conduct "ray" test at upper floor bound. - auto start = GAME_VECTOR( - item->pos.xPos, - y + testSetup.UpperFloorBound - 1, - item->pos.zPos, - item->roomNumber); + if (!LOS(&start1, &end1)) + return false; - auto end = GAME_VECTOR( - probe.Coordinates.x, - probe.Coordinates.y - 1, - probe.Coordinates.z, - item->roomNumber); - - if (!LOS(&start, &end)) + // Conduct "ray" test at lowest ceiling bound. + if (!LOS(&start2, &end2)) return false; // Assess move feasibility to location ahead. diff --git a/TR5Main/Game/Lara/lara_tests.h b/TR5Main/Game/Lara/lara_tests.h index babb71d85..01ea1ca92 100644 --- a/TR5Main/Game/Lara/lara_tests.h +++ b/TR5Main/Game/Lara/lara_tests.h @@ -50,7 +50,8 @@ void GetTighRopeFallOff(int Regularity); bool IsStandingWeapon(LARA_WEAPON_TYPE gunType); bool IsJumpState(LARA_STATE state); -bool IsRunJumpCountState(LARA_STATE state); +bool IsRunJumpQueueableState(LARA_STATE state); +bool IsRunJumpCountableState(LARA_STATE state); bool IsVaultState(LARA_STATE state); bool TestLaraSplat(ITEM_INFO* item, int dist, int height, int side = 0);