This commit is contained in:
Lwmte 2025-04-25 07:38:28 +02:00
parent 8c11b4cda0
commit c1eb5b141e
2 changed files with 5 additions and 3 deletions

View file

@ -11,6 +11,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
### Bug fixes
* Fixed crashes when shooting, if gunflash or gunshell objects are not present in a level.
* Fixed crashes when Lara is on a vehicle unreachable by friendly NPCs.
* Fixed Teleporter object.
* Fixed Wraith objects not working correctly in flipped rooms.
* Fixed lensflare enabled status not saved in a savegame.

View file

@ -971,7 +971,8 @@ void TargetBox(LOTInfo* LOT, int boxNumber)
{
if (boxNumber == NO_VALUE)
return;
auto* box = &g_Level.PathfindingBoxes[boxNumber];
const auto* box = &g_Level.PathfindingBoxes[boxNumber];
// Maximize target precision. DO NOT change bracket precedence!
LOT->Target.x = (int)((box->top * BLOCK(1)) + (float)GetRandomControl() * (((float)(box->bottom - box->top) - 1.0f) / 32.0f) + CLICK(2.0f));
@ -1637,9 +1638,9 @@ void CreatureMood(ItemInfo* item, AI_INFO* AI, bool isViolent)
auto* enemy = creature->Enemy;
// HACK: Fallback to bored mood from attack mood if enemy was cleared.
// HACK: Fallback to bored mood from attack or escape mood if enemy was cleared.
// Replaces previous "fix" with early exit, because it was breaking friendly NPC pathfinding. -- Lwmte, 24.03.25
if (enemy == nullptr && creature->Mood == MoodType::Attack)
if (enemy == nullptr && (creature->Mood == MoodType::Attack || creature->Mood == MoodType::Escape))
creature->Mood = MoodType::Bored;
int boxNumber;