From f264c7795d25c2babaff2f374b3b1567a8d3b40d Mon Sep 17 00:00:00 2001 From: Nils Date: Fri, 3 Sep 2021 13:02:35 +0200 Subject: [PATCH] Fixed EnemyJeep TestTriggers call Renamed constants for priority system --- TR5Main/Game/box.cpp | 14 +++++++------- TR5Main/Objects/TR4/Entity/tr4_enemy_jeep.cpp | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/TR5Main/Game/box.cpp b/TR5Main/Game/box.cpp index 0fd52ee51..ad8816c31 100644 --- a/TR5Main/Game/box.cpp +++ b/TR5Main/Game/box.cpp @@ -24,10 +24,10 @@ #define FEELER_ANGLE ANGLE(45.0f) #ifdef CREATURE_AI_PRIORITY_OPTIMIZATION -constexpr int HIGH_PRIO = 8; -constexpr int MEDIUM_PRIO = HIGH_PRIO + HIGH_PRIO * (HIGH_PRIO / 6.0f); -constexpr int LOW_PRIO = MEDIUM_PRIO + MEDIUM_PRIO * (MEDIUM_PRIO / 24.0f); -constexpr int NONE_PRIO = LOW_PRIO + LOW_PRIO * (LOW_PRIO / 32.0f); +constexpr int HIGH_PRIO_RANGE = 8; +constexpr int MEDIUM_PRIO_RANGE = HIGH_PRIO_RANGE + HIGH_PRIO_RANGE * (HIGH_PRIO_RANGE / 6.0f); +constexpr int LOW_PRIO_RANGE = MEDIUM_PRIO_RANGE + MEDIUM_PRIO_RANGE * (MEDIUM_PRIO_RANGE / 24.0f); +constexpr int NONE_PRIO_RANGE = LOW_PRIO_RANGE + LOW_PRIO_RANGE * (LOW_PRIO_RANGE / 32.0f); constexpr auto FRAME_PRIO_BASE = 4; constexpr auto FRAME_PRIO_EXP = 1.5; #endif // CREATURE_AI_PRIORITY_OPTIMIZATION @@ -1086,11 +1086,11 @@ CREATURE_AI_PRIORITY GetCreatureLOTPriority(ITEM_INFO* item) { Vector3 cameraPos = Vector3(Camera.pos.x, Camera.pos.y, Camera.pos.z); float distance = Vector3::Distance(itemPos, cameraPos); distance /= SECTOR(1); - if(distance <= HIGH_PRIO) + if(distance <= HIGH_PRIO_RANGE) return CREATURE_AI_PRIORITY::HIGH; - if(distance <= MEDIUM_PRIO) + if(distance <= MEDIUM_PRIO_RANGE) return CREATURE_AI_PRIORITY::MEDIUM; - if(distance <= LOW_PRIO) + if(distance <= LOW_PRIO_RANGE) return CREATURE_AI_PRIORITY::LOW; return CREATURE_AI_PRIORITY::NONE; } diff --git a/TR5Main/Objects/TR4/Entity/tr4_enemy_jeep.cpp b/TR5Main/Objects/TR4/Entity/tr4_enemy_jeep.cpp index afe98b9f5..aef9a241a 100644 --- a/TR5Main/Objects/TR4/Entity/tr4_enemy_jeep.cpp +++ b/TR5Main/Objects/TR4/Entity/tr4_enemy_jeep.cpp @@ -265,8 +265,7 @@ void EnemyJeepControl(short itemNumber) if (creature->reachedGoal) { - //TODO: CREATURE_TARGET was created to avoid circular dependency between ITEM_INFO and ITEM_DATA - //TestTriggers(target, true, 0x0); + TestTriggers(target->pos.xPos,target->pos.yPos,target->pos.zPos,target->roomNumber, true, 0x0); if (Lara.location < item->itemFlags[3] && item->currentAnimState != 2 && item->goalAnimState != 2) {