From 39b9ddc04c0cac9c9fb98f1ee2be773db7b777a3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 16 Sep 2021 21:11:26 +0200 Subject: [PATCH] - target stuff in aiInitSprite --- source/games/blood/src/ai.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index 6df3e48db..879b09ae6 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -1730,16 +1730,20 @@ void aiInitSprite(DBloodActor* actor) pDudeExtraE->active = 0; #ifdef NOONE_EXTENSIONS - int stateTimer = -1, targetMarker = -1; + int stateTimer = -1; int targetX = 0, targetY = 0, targetZ = 0; + DBloodActor* pTargetMarker = nullptr; // dude patrol init if (gModernMap) { // must keep it in case of loading save - if (pXSprite->dudeFlag4 && spriRangeIsFine(pXSprite->target_i) && sprite[pXSprite->target_i].type == kMarkerPath) { - stateTimer = pXSprite->stateTimer; targetMarker = pXSprite->target_i; - targetX = pXSprite->targetX; targetY = pXSprite->targetY; + if (pXSprite->dudeFlag4 && actor->GetTarget() && actor->GetTarget()->s().type == kMarkerPath) + { + stateTimer = pXSprite->stateTimer; + pTargetMarker = actor->GetTarget(); + targetX = pXSprite->targetX; + targetY = pXSprite->targetY; targetZ = pXSprite->targetZ; } } @@ -1955,9 +1959,9 @@ void aiInitSprite(DBloodActor* actor) if (pXSprite->dudeFlag4) { // restore dude's path - if (spriRangeIsFine(targetMarker)) + if (pTargetMarker) { - pXSprite->target_i = targetMarker; + actor->SetTarget(pTargetMarker); pXSprite->targetX = targetX; pXSprite->targetY = targetY; pXSprite->targetZ = targetZ;