[Scummvm-git-logs] scummvm master -> 0f7ee148ea9a49195b91d89247747b708c349455

antoniou79 noreply at scummvm.org
Wed Jul 5 12:00:52 UTC 2023


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f15f37eb97 BLADERUNNER: RC: Restore a roach in UG15
ea23048d60 BLADERUNNER: Better handling of cut overlay
0f7ee148ea BLADERUNNER: Methods for debugging animations


Commit: f15f37eb9730679047ec72bdfe8eece984027122
    https://github.com/scummvm/scummvm/commit/f15f37eb9730679047ec72bdfe8eece984027122
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2023-07-05T14:29:33+03:00

Commit Message:
BLADERUNNER: RC: Restore a roach in UG15

Changed paths:
    engines/bladerunner/script/scene/ug15.cpp


diff --git a/engines/bladerunner/script/scene/ug15.cpp b/engines/bladerunner/script/scene/ug15.cpp
index d7c256138cb..41898eebce7 100644
--- a/engines/bladerunner/script/scene/ug15.cpp
+++ b/engines/bladerunner/script/scene/ug15.cpp
@@ -222,6 +222,12 @@ void SceneScriptUG15::PlayerWalkedIn() {
 		if (!Game_Flag_Query(kFlagUG15RatShot)) {
 			Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15Prepare);
 		}
+		if (_vm->_cutContent && Random_Query(1, 5) == 5) {
+			Overlay_Play("UG15OVER", 0, false, true, 0);
+		}
+	} else if (_vm->_cutContent && Random_Query(1, 3) == 1) {
+			// Show the roach more "often" if McCoy is on the back area of this scene
+			Overlay_Play("UG15OVER", 0, false, true, 0);
 	}
 }
 


Commit: ea23048d60177b748e25cbbd3468230f4b0d929f
    https://github.com/scummvm/scummvm/commit/ea23048d60177b748e25cbbd3468230f4b0d929f
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2023-07-05T14:29:33+03:00

Commit Message:
BLADERUNNER: Better handling of cut overlay

Also some minor code changes (renamed a few variables and added more explanatory comments)

Changed paths:
    engines/bladerunner/overlays.cpp
    engines/bladerunner/script/scene/ug18.cpp
    engines/bladerunner/vqa_decoder.cpp
    engines/bladerunner/vqa_decoder.h
    engines/bladerunner/vqa_player.cpp
    engines/bladerunner/vqa_player.h


diff --git a/engines/bladerunner/overlays.cpp b/engines/bladerunner/overlays.cpp
index c40728969a4..46656bfbc07 100644
--- a/engines/bladerunner/overlays.cpp
+++ b/engines/bladerunner/overlays.cpp
@@ -93,15 +93,21 @@ int Overlays::play(const Common::String &name, int loopId, bool loopForever, boo
 	    && _videos[index].vqaPlayer->getFrameCount() > 0
 	) {
 		skipNewVQAPlayerOpen = true;
+		// INFO The actual enqueuing happens in VQAPlayer -- see: kLoopSetModeEnqueue()
+		// The enqueuedLoopId is a field that is not stored separately, but will be stored as the value of "loopId"
+		// (see Overlays::save()) so that, when loading, the engine will know
+		// that it needs to reach the end frame of the *queued* loop.
+		// It is not used elsewhere. The actual enqueuing as well as the decision of what loop id should be resumed
+		// are done in the VQAPlayer class.
 		_videos[index].enqueuedLoopId = loopId;
 	}
 
 	if (skipNewVQAPlayerOpen || _videos[index].vqaPlayer->open()) {
-		_videos[index].vqaPlayer->setLoop(
-			loopId,
-			loopForever ? -1 : 0,
-			startNow ? kLoopSetModeImmediate : kLoopSetModeEnqueue,
-			nullptr, nullptr);
+		_videos[index].vqaPlayer->setLoop(loopId,
+		                                  loopForever ? -1 : 0,
+		                                  startNow ? kLoopSetModeImmediate : kLoopSetModeEnqueue,
+		                                  nullptr,
+		                                  nullptr);
 	} else {
 		resetSingle(index);
 		return -1;
@@ -128,6 +134,11 @@ void Overlays::resume(bool isLoadingGame) {
 
 			_videos[i].vqaPlayer->seekToFrame(_videos[i].frame);
 			_videos[i].vqaPlayer->update(true);
+			// Update the enqueued loop id, if it was changed within the vqaPlayer->update() call
+			// so that if the user saves the game, the correct queued id will be stored
+			if (_videos[i].enqueuedLoopId != -1 && _videos[i].enqueuedLoopId != _videos[i].vqaPlayer->getLoopIdTarget()) {
+				_videos[i].enqueuedLoopId = _videos[i].vqaPlayer->getLoopIdTarget();
+			}
 		}
 	}
 }
@@ -151,6 +162,11 @@ void Overlays::tick() {
 	for (int i = 0; i < kOverlayVideos; ++i) {
 		if (_videos[i].loaded) {
 			_videos[i].frame = _videos[i].vqaPlayer->update(true);
+			// Update the enqueued loop id, if it was changed within the vqaPlayer->update() call
+			// so that if the user saves the game, the correct queued id will be stored
+			if (_videos[i].enqueuedLoopId != -1 && _videos[i].enqueuedLoopId != _videos[i].vqaPlayer->getLoopIdTarget()) {
+				_videos[i].enqueuedLoopId = _videos[i].vqaPlayer->getLoopIdTarget();
+			}
 			if (_videos[i].frame < 0) {
 				resetSingle(i);
 			}
@@ -202,7 +218,7 @@ void Overlays::save(SaveFileWriteStream &f) {
 		f.writeStringSz(ov.name, 13);
 		f.writeSint32LE(ov.hash);
 		if (ov.enqueuedLoopId != -1) {
-		// When there is an enqueued video, save that loop Id instead
+			// When there is an enqueued video, save that loop Id instead
 			f.writeInt(ov.enqueuedLoopId);
 		} else {
 			f.writeInt(ov.loopId);
diff --git a/engines/bladerunner/script/scene/ug18.cpp b/engines/bladerunner/script/scene/ug18.cpp
index 97c200bebf9..8cc8246c650 100644
--- a/engines/bladerunner/script/scene/ug18.cpp
+++ b/engines/bladerunner/script/scene/ug18.cpp
@@ -329,20 +329,30 @@ void SceneScriptUG18::PlayerWalkedIn() {
 		if (Game_Flag_Query(kFlagUG18GuzzaScene)) {
 			switch (Global_Variable_Query(kVariableUG18StateOfGuzzaCorpse)) {
 			case kUG18GuzzaCorpseFloatsDown:
-				Global_Variable_Set(kVariableUG18StateOfGuzzaCorpse, kUG18GuzzaCorpseStuckInPipes);
-				// same logic as using the BB06OVER for doll explosion case in BB06
+				Global_Variable_Set(kVariableUG18StateOfGuzzaCorpse, kUG18GuzzaCorpseDissolves);
+				// Same logic as using the BB06OVER for doll explosion case in BB06.
+				// (queuing only works on top of a loop that is repeating)
+				// Note that in the current engine implementation the last queued loop
+				// is also supposed to be repeating, which is the case for most queued loops cases.
+				// If it should not, like here, some special case is required for it in VQAPlayer::update(),
+				// see use of _specialUG18DoNotRepeatLastLoop.
+				// Here loop 2 is the last queued loop (queued explicitly in VQAPlayer::update())
+				// which *should not* be repeated more than once.
 				Overlay_Play("UG18OVR2", 0, true, true,  0);
 				Overlay_Play("UG18OVR2", 1, true, false, 0);
 				break;
-			case kUG18GuzzaCorpseStuckInPipes:
-				Global_Variable_Set(kVariableUG18StateOfGuzzaCorpse, kUG18GuzzaCorpseDissolves);
-				Overlay_Play("UG18OVR2", 1, true, true,  0);
-				Overlay_Play("UG18OVR2", 2, false, false, 0);
-				break;
+
+//			case kUG18GuzzaCorpseStuckInPipes:
+//				Global_Variable_Set(kVariableUG18StateOfGuzzaCorpse, kUG18GuzzaCorpseDissolves);
+//				Overlay_Play("UG18OVR2", 1, true, true,  0);
+//				Overlay_Play("UG18OVR2", 2, false, false, 0);
+//				break;
+
 			case kUG18GuzzaCorpseDissolves:
 				Global_Variable_Set(kVariableUG18StateOfGuzzaCorpse, kUG18GuzzaNoCorpse);
 				Overlay_Remove("UG18OVR2");
 				break;
+
 			default:
 				break;
 			}
diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp
index 2c3a974ea87..9b34455eebb 100644
--- a/engines/bladerunner/vqa_decoder.cpp
+++ b/engines/bladerunner/vqa_decoder.cpp
@@ -205,6 +205,15 @@ bool VQADecoder::loadStream(Common::SeekableReadStream *s) {
 	return true;
 }
 
+void VQADecoder::overrideOffsetXY(uint16 offX, uint16 offY) {
+	_header.offsetX = offX;
+	_header.offsetY = offY;
+	if (_videoTrack != nullptr) {
+		_videoTrack->overrideOffsetXY(offX, offY);
+	}
+};
+
+
 void VQADecoder::decodeVideoFrame(Graphics::Surface *surface, int frame, bool forceDraw) {
 	_decodingFrame = frame;
 	_videoTrack->decodeVideoFrame(surface, forceDraw);
@@ -604,18 +613,20 @@ bool VQADecoder::readLNIN(Common::SeekableReadStream *s, uint32 size) {
 	return true;
 }
 
-bool VQADecoder::getLoopBeginAndEndFrame(int loop, int *begin, int *end) {
+bool VQADecoder::getLoopBeginAndEndFrame(int loopId, int *begin, int *end) {
 	assert(begin && end);
 
-	if (loop < 0 || loop >= _loopInfo.loopCount)
+	if (loopId < 0 || loopId >= _loopInfo.loopCount)
 		return false;
 
-	*begin = _loopInfo.loops[loop].begin;
-	*end   = _loopInfo.loops[loop].end;
+	*begin = _loopInfo.loops[loopId].begin;
+	*end   = _loopInfo.loops[loopId].end;
 
 	return true;
 }
 
+// Note that some video loops (scene loops) share frames (but will have different start frame (or end frame?))
+// Thus this method may not return the "correct" loop here. It will just return the first loop that contains the frame.
 int VQADecoder::getLoopIdFromFrame(int frame) {
 	if (frame >= 0) {
 		for (int loopId = 0; loopId < _loopInfo.loopCount; ++loopId) {
@@ -751,6 +762,11 @@ int VQADecoder::VQAVideoTrack::getFrameCount() const {
 	return _numFrames;
 }
 
+void VQADecoder::VQAVideoTrack::overrideOffsetXY(uint16 offX, uint16 offY) {
+	_offsetX = offX;
+	_offsetY = offY;
+}
+
 Common::Rational VQADecoder::VQAVideoTrack::getFrameRate() const {
 	return _frameRate;
 }
diff --git a/engines/bladerunner/vqa_decoder.h b/engines/bladerunner/vqa_decoder.h
index 909b6ba11c4..6dd9d9a67c8 100644
--- a/engines/bladerunner/vqa_decoder.h
+++ b/engines/bladerunner/vqa_decoder.h
@@ -80,10 +80,12 @@ public:
 	uint16 offsetX() const { return _header.offsetX; }
 	uint16 offsetY() const { return _header.offsetY; }
 
+	void overrideOffsetXY(uint16 offX, uint16 offY);
+
 	bool   hasAudio() const { return _header.channels != 0; }
 	uint16 frequency() const { return _header.freq; }
 
-	bool getLoopBeginAndEndFrame(int loop, int *begin, int *end);
+	bool getLoopBeginAndEndFrame(int loopId, int *begin, int *end);
 	int  getLoopIdFromFrame(int frame);
 
 	void allocatePaletteVQPTable(const uint32 numOfPalettes);
@@ -198,6 +200,8 @@ public:
 
 		int getFrameCount() const;
 
+		void overrideOffsetXY(uint16 offX, uint16 offY);
+
 		void decodeVideoFrame(Graphics::Surface *surface, bool forceDraw);
 		void decodeZBuffer(ZBuffer *zbuffer);
 		void decodeView(View *view);
diff --git a/engines/bladerunner/vqa_player.cpp b/engines/bladerunner/vqa_player.cpp
index 7751ed34265..0a3c75d6a0d 100644
--- a/engines/bladerunner/vqa_player.cpp
+++ b/engines/bladerunner/vqa_player.cpp
@@ -49,6 +49,7 @@ bool VQAPlayer::open() {
 
 #if !BLADERUNNER_ORIGINAL_BUGS
 	_specialPS15GlitchFix = false;
+	_specialUG18DoNotRepeatLastLoop = false;
 	// TB05 has wrong end of a loop and this will load empty zbuffer from next loop, which will lead to broken pathfinding
 	if (_name.equals("TB05_2.VQA")) {
 		_decoder._loopInfo.loops[1].end = 60;
@@ -69,6 +70,13 @@ bool VQAPlayer::open() {
 	} else if (_name.equals("PS15.VQA") || _name.equals("PS15_2.VQA")) {
 		// Fix should be applied in Act 1-3 versions of this background
 		_specialPS15GlitchFix = true;
+	} else if (_name.equals("UG19OVR1.VQA")) {
+		// Original has x: 244, y: 88
+		// This still does not look quite right
+		// TODO What is this overlay supposed to be for?
+		_decoder.overrideOffsetXY(248, 110); 
+	} else if (_name.equals("UG18OVR2.VQA")) {
+		_specialUG18DoNotRepeatLastLoop = true;
 	}
 #endif
 
@@ -79,18 +87,18 @@ bool VQAPlayer::open() {
 	}
 
 	_repeatsCount = 0;
-	_loopNext = -1;
+	_loopIdTarget = -1;
 	_frame = -1;
 	_frameBeginNext = -1;
 	_frameEnd = getFrameCount() - 1;
 	_frameEndQueued = -1;
 	_repeatsCountQueued = -1;
 
-	if (_loopInitial >= 0) {
-		// loopInitial is set to the loop Id value that should play,
+	if (_loopIdInitial >= 0) {
+		// loopIdInitial is set to the loop Id value that should play,
 		// when the SeekableReadStream (_s) is nullptr
 		// see setLoop()
-		setLoop(_loopInitial, _repeatsCountInitial, kLoopSetModeImmediate, nullptr, nullptr);
+		setLoop(_loopIdInitial, _repeatsCountInitial, kLoopSetModeImmediate, nullptr, nullptr);
 	} else {
 		_frameNext = 0;
 		// TODO? Removed as redundant
@@ -178,6 +186,8 @@ int VQAPlayer::update(bool forceDraw, bool advanceFrame, bool useTime, Graphics:
 
 	if ((_repeatsCount > 0 || _repeatsCount == -1) && (_frameNext > _frameEnd)) {
 		int loopEndQueued = _frameEndQueued;
+		bool specialEnqueue = false;
+
 		if (_frameEndQueued != -1) {
 			_frameEnd = _frameEndQueued;
 			_frameEndQueued = -1;
@@ -190,7 +200,7 @@ int VQAPlayer::update(bool forceDraw, bool advanceFrame, bool useTime, Graphics:
 			// The code is similar to Scene::advanceFrame()
 			// This will be done once, since this first loop (loopId 1)
 			// is only executed once before moving on to loopId 2
-			if (_name.equals("MA05_3.VQA") && _loopNext == 1) {
+			if (_name.equals("MA05_3.VQA") && _loopIdTarget == 1) {
 				while (update(false, true, false) != 59) {
 					updateZBuffer(_vm->_zbuffer);
 				}
@@ -199,34 +209,70 @@ int VQAPlayer::update(bool forceDraw, bool advanceFrame, bool useTime, Graphics:
 				//     Scene::loopEnded()
 				//
 				_frameBeginNext = 60;
+			} else if (_name.equals("UG18OVR2.VQA")) {
+				// This overlay has three loops (0,1,2) that
+				// need to be played back to back.
+				// However, then engine can only queue up to two loops.
+				// So in this case, we force enqueuing the final loop explicitly here
+				// loop 0:   0 -  59
+				// loop 1:  60 - 119
+				// loop 2: 120 - 135
+				// 
+				if (_loopIdTarget == 1) {
+					// we just loaded up the previously enqueued loop 1
+					_frameNext = _frameBeginNext;
+					// this also has to be enqueued to be (fake) repeated forever,
+					// (presumably _repeatsCountQueued is also -1),
+					// in order for the code to proceed to the newly queued loop 2 after this one (loop 1) ends
+					_repeatsCount =  -1;
+					if (_callbackLoopEnded != nullptr) {
+						_callbackLoopEnded(_callbackData, 0, _loopIdTarget);
+					}
+					specialEnqueue = true;
+					_loopIdTarget = 2;
+					_frameBeginNext = 120;
+					_frameEndQueued = 135;
+					_repeatsCountQueued = 0;
+				}
 			}
+		} else if (_specialUG18DoNotRepeatLastLoop && _loopIdTarget == 2) {
+			// This extra check is needed to stop the last loop (2) of UG18OVR2.VQA from repeating,
+			// in case we loaded a saved game while the queued loops (1 or 2) were playing.
+			result = -3;
+			// _repeatsCount == 0, so return here at the end of the video, to release the resource
+			return result;
 #endif
 		}
 
-		_frameNext = _frameBeginNext;
+		if (!specialEnqueue) {
+			_frameNext = _frameBeginNext;
 
-		if (loopEndQueued == -1) {
-			if (_repeatsCount != -1) {
-				--_repeatsCount;
-			}
-			//callback for repeat, it is not used in the blade runner
-		} else {
-			_repeatsCount = _repeatsCountQueued;
-			_repeatsCountQueued = -1;
+			if (loopEndQueued == -1) {
+				if (_repeatsCount > 0) {
+					--_repeatsCount;
+				}
+				//callback for repeat, it is not used in the blade runner
+			} else {
+				_repeatsCount = _repeatsCountQueued; // ASDF IS THIS STORED IN SAVED GAME?
+				_repeatsCountQueued = -1;
 
-			if (_callbackLoopEnded != nullptr) {
-				_callbackLoopEnded(_callbackData, 0, _loopNext);
+				if (_callbackLoopEnded != nullptr) {
+					_callbackLoopEnded(_callbackData, 0, _loopIdTarget);
+				}
 			}
 		}
 		result = -1;
+
 	} else if (_frameNext > _frameEnd) {
 		result = -3;
 		// _repeatsCount == 0, so return here at the end of the video, to release the resource
 		return result;
+
 	} else if (useTime && (now - (_frameNextTime - kVqaFrameTimeDiff) < kVqaFrameTimeDiff)) {
 		// Not yet time to move to next frame.
 		// Note, we use unsigned difference to avoid potential time overflow issues
 		result = -1;
+
 	} else if (advanceFrame) {
 		_frame = _frameNext;
 		_decoder.readFrame(_frameNext, kVQAReadVideo);
@@ -345,19 +391,20 @@ void VQAPlayer::updateLights(Lights *lights) {
 	_decoder.decodeLights(lights);
 }
 
-bool VQAPlayer::setLoop(int loop, int repeatsCount, int loopSetMode, void (*callback)(void *, int, int), void *callbackData) {
+bool VQAPlayer::setLoop(int loopId, int repeatsCount, int loopSetMode, void (*callback)(void *, int, int), void *callbackData) {
 	if (_s == nullptr) {
-		_loopInitial = loop;
+		_loopIdInitial = loopId;
 		_repeatsCountInitial = repeatsCount;
 		return true;
 	}
 
+	// TODO IF LOOP IS A "TARGET LOOP ID" then begin and end will get the values for that target (final) loop id
 	int begin, end;
-	if (!_decoder.getLoopBeginAndEndFrame(loop, &begin, &end)) {
+	if (!_decoder.getLoopBeginAndEndFrame(loopId, &begin, &end)) {
 		return false;
 	}
 	if (setBeginAndEndFrame(begin, end, repeatsCount, loopSetMode, callback, callbackData)) {
-		_loopNext = loop;
+		_loopIdTarget = loopId; // TODO ASDF MAYBE SET THIS AS TARGET LOOP!
 		return true;
 	}
 	return false;
@@ -375,7 +422,7 @@ bool VQAPlayer::setBeginAndEndFrame(int begin, int end, int repeatsCount, int lo
 	}
 
 	if (repeatsCount < 0) {
-		repeatsCount = -1;
+		repeatsCount = -1; // loop "forever"
 	}
 
 	if (_repeatsCount == 0 && loopSetMode == kLoopSetModeEnqueue) {
@@ -384,14 +431,14 @@ bool VQAPlayer::setBeginAndEndFrame(int begin, int end, int repeatsCount, int lo
 		loopSetMode = kLoopSetModeImmediate;
 	}
 
-	_frameBeginNext = begin;
+	_frameBeginNext = begin; // TODO ASDF THIS IN THE MULTI QUEUE CASE WILL BE THE BEGIN FRAME OF THE FINAL ITEM IN QUEUE
 
 	if (loopSetMode == kLoopSetModeJustStart) {
 		_repeatsCount = repeatsCount;
 		_frameEnd = end;
 	} else if (loopSetMode == kLoopSetModeEnqueue) {
-		_repeatsCountQueued = repeatsCount;
-		_frameEndQueued = end;
+		_repeatsCountQueued = repeatsCount; // TODO applies only to the last of the queued loops
+		_frameEndQueued = end; // TODO ASDF THIS IN THE MULTI QUEUE CASE WILL BE THE END FRAME OF THE FINAL ITEM IN QUEUE
 	} else if (loopSetMode == kLoopSetModeImmediate) {
 		_repeatsCount = repeatsCount;
 		_frameEnd = end;
@@ -411,24 +458,29 @@ bool VQAPlayer::seekToFrame(int frame) {
 }
 
 bool VQAPlayer::getCurrentBeginAndEndFrame(int frame, int *begin, int *end) {
-	int playingLoop = _decoder.getLoopIdFromFrame(frame);
-	if (playingLoop != -1) {
-		return _decoder.getLoopBeginAndEndFrame(playingLoop, begin, end);
+	// updates the values of begin (frame) and end (frame)
+	// based on the value of the "frame" argument.
+	// First, the current loopId is detemined from the value of the "frame" argument.
+	// TODO ASDF THIS MIGHT BE USEFUL!!! _decoder.getLoopIdFromFrame(frame);
+	// ALSO SEE USE OF THE CURRENT METHOD IN Scene::resume()
+	int playingLoopId = _decoder.getLoopIdFromFrame(frame);
+	if (playingLoopId != -1) {
+		return _decoder.getLoopBeginAndEndFrame(playingLoopId, begin, end);
 	}
 	return false;
 }
 
-int VQAPlayer::getLoopBeginFrame(int loop) {
+int VQAPlayer::getLoopBeginFrame(int loopId) {
 	int begin, end;
-	if (!_decoder.getLoopBeginAndEndFrame(loop, &begin, &end)) {
+	if (!_decoder.getLoopBeginAndEndFrame(loopId, &begin, &end)) {
 		return -1;
 	}
 	return begin;
 }
 
-int VQAPlayer::getLoopEndFrame(int loop) {
+int VQAPlayer::getLoopEndFrame(int loopId) {
 	int begin, end;
-	if (!_decoder.getLoopBeginAndEndFrame(loop, &begin, &end)) {
+	if (!_decoder.getLoopBeginAndEndFrame(loopId, &begin, &end)) {
 		return -1;
 	}
 	return end;
diff --git a/engines/bladerunner/vqa_player.h b/engines/bladerunner/vqa_player.h
index 6de6abced66..c8f5ef8b30b 100644
--- a/engines/bladerunner/vqa_player.h
+++ b/engines/bladerunner/vqa_player.h
@@ -63,7 +63,7 @@ class VQAPlayer {
 	int _frameBeginNext; // The frame to begin from, after current playing loop ends.
 	                     // Does not necessarily reflect current playing loop's start frame
 	int _frameEnd;       // The frame to end at for current playing loop
-	int _loopNext;       // Does not necessarily reflect current playing loop's id
+	int _loopIdTarget;   // Does not necessarily reflect current playing loop's id (for a queue of loops this will have the id of the last one in the queue)
 	                     // Used: - as param for _callbackLoopEnded() (which typically is loopEnded()), but never actually used in there)
 	                     //       - for the MA05 inshot glitch workaround
 	                     // It is set at every setLoop call except for the _loopInitial case (when no video stream is loaded)
@@ -78,7 +78,7 @@ class VQAPlayer {
 
 	int _lastAudioFrameSuccessfullyQueued;
 
-	int _loopInitial;
+	int _loopIdInitial;
 	int _repeatsCountInitial;
 
 	uint32 _frameNextTime;
@@ -87,6 +87,7 @@ class VQAPlayer {
 	Audio::SoundHandle _soundHandle;
 
 	bool   _specialPS15GlitchFix;
+	bool   _specialUG18DoNotRepeatLastLoop;
 
 	void (*_callbackLoopEnded)(void *, int frame, int loopId);
 	void  *_callbackData;
@@ -104,17 +105,18 @@ public:
 		  _frameNext(-1),
 		  _frameBeginNext(-1),
 		  _frameEnd(-1),
-		  _loopNext(-1),
+		  _loopIdTarget(-1),
 		  _repeatsCount(-1),
 		  _repeatsCountQueued(-1),
 		  _frameEndQueued(-1),
 		  _lastAudioFrameSuccessfullyQueued(-1),
-		  _loopInitial(-1),
+		  _loopIdInitial(-1),
 		  _repeatsCountInitial(-1),
 		  _frameNextTime(0),
 		  _hasAudio(false),
 		  _audioStarted(false),
 		  _specialPS15GlitchFix(false),
+		  _specialUG18DoNotRepeatLastLoop(false),
 		  _callbackLoopEnded(nullptr),
 		  _callbackData(nullptr) { }
 
@@ -134,13 +136,15 @@ public:
 	void updateLights(Lights *lights);
 
 	bool setBeginAndEndFrame(int begin, int end, int repeatsCount, int loopSetMode, void(*callback)(void *, int, int), void *callbackData);
-	bool setLoop(int loop, int repeatsCount, int loopSetMode, void(*callback)(void*, int, int), void *callbackData);
+	bool setLoop(int loopId, int repeatsCount, int loopSetMode, void(*callback)(void*, int, int), void *callbackData);
 
 	bool seekToFrame(int frame);
 
 	bool getCurrentBeginAndEndFrame(int frame, int *begin, int *end);
-	int getLoopBeginFrame(int loop);
-	int getLoopEndFrame(int loop);
+	int getLoopBeginFrame(int loopId);
+	int getLoopEndFrame(int loopId);
+
+	int getLoopIdTarget() const { return _loopIdTarget; };
 
 	int getFrameCount() const;
 


Commit: 0f7ee148ea9a49195b91d89247747b708c349455
    https://github.com/scummvm/scummvm/commit/0f7ee148ea9a49195b91d89247747b708c349455
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2023-07-05T14:57:58+03:00

Commit Message:
BLADERUNNER: Methods for debugging animations

Changed paths:
    engines/bladerunner/actor.cpp
    engines/bladerunner/actor.h
    engines/bladerunner/bladerunner.h
    engines/bladerunner/debugger.cpp
    engines/bladerunner/detection.cpp
    engines/bladerunner/script/ai/baker.cpp
    engines/bladerunner/script/ai/bryant.cpp
    engines/bladerunner/script/ai/bullet_bob.cpp
    engines/bladerunner/script/ai/chew.cpp
    engines/bladerunner/script/ai/clovis.cpp
    engines/bladerunner/script/ai/crazylegs.cpp
    engines/bladerunner/script/ai/dektora.cpp
    engines/bladerunner/script/ai/desk_clerk.cpp
    engines/bladerunner/script/ai/early_q.cpp
    engines/bladerunner/script/ai/early_q_bartender.cpp
    engines/bladerunner/script/ai/fish_dealer.cpp
    engines/bladerunner/script/ai/free_slot_a.cpp
    engines/bladerunner/script/ai/free_slot_b.cpp
    engines/bladerunner/script/ai/gaff.cpp
    engines/bladerunner/script/ai/general_doll.cpp
    engines/bladerunner/script/ai/generic_walker_a.cpp
    engines/bladerunner/script/ai/generic_walker_b.cpp
    engines/bladerunner/script/ai/generic_walker_c.cpp
    engines/bladerunner/script/ai/gordo.cpp
    engines/bladerunner/script/ai/grigorian.cpp
    engines/bladerunner/script/ai/guzza.cpp
    engines/bladerunner/script/ai/hanoi.cpp
    engines/bladerunner/script/ai/hasan.cpp
    engines/bladerunner/script/ai/hawkers_barkeep.cpp
    engines/bladerunner/script/ai/holloway.cpp
    engines/bladerunner/script/ai/howie_lee.cpp
    engines/bladerunner/script/ai/hysteria_patron1.cpp
    engines/bladerunner/script/ai/hysteria_patron2.cpp
    engines/bladerunner/script/ai/hysteria_patron3.cpp
    engines/bladerunner/script/ai/insect_dealer.cpp
    engines/bladerunner/script/ai/isabella.cpp
    engines/bladerunner/script/ai/izo.cpp
    engines/bladerunner/script/ai/klein.cpp
    engines/bladerunner/script/ai/leon.cpp
    engines/bladerunner/script/ai/lucy.cpp
    engines/bladerunner/script/ai/luther.cpp
    engines/bladerunner/script/ai/maggie.cpp
    engines/bladerunner/script/ai/mccoy.cpp
    engines/bladerunner/script/ai/mia.cpp
    engines/bladerunner/script/ai/moraji.cpp
    engines/bladerunner/script/ai/murray.cpp
    engines/bladerunner/script/ai/mutant1.cpp
    engines/bladerunner/script/ai/mutant2.cpp
    engines/bladerunner/script/ai/mutant3.cpp
    engines/bladerunner/script/ai/officer_grayford.cpp
    engines/bladerunner/script/ai/officer_leary.cpp
    engines/bladerunner/script/ai/photographer.cpp
    engines/bladerunner/script/ai/rachael.cpp
    engines/bladerunner/script/ai/rajif.cpp
    engines/bladerunner/script/ai/runciter.cpp
    engines/bladerunner/script/ai/sadik.cpp
    engines/bladerunner/script/ai/sebastian.cpp
    engines/bladerunner/script/ai/sergeant_walls.cpp
    engines/bladerunner/script/ai/shoeshine_man.cpp
    engines/bladerunner/script/ai/steele.cpp
    engines/bladerunner/script/ai/taffy_patron.cpp
    engines/bladerunner/script/ai/transient.cpp
    engines/bladerunner/script/ai/tyrell.cpp
    engines/bladerunner/script/ai/tyrell_guard.cpp
    engines/bladerunner/script/ai/zuben.cpp


diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index 037e2fa8150..af0e7ccf839 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -202,6 +202,16 @@ void Actor::changeAnimationMode(int animationMode, bool force) {
 	}
 }
 
+// New for debugging purposes
+void Actor::changeAnimationState(int animationState, int animationFrame, int animationStateNext, int animationNext) {
+	_vm->_aiScripts->setAnimationState(_id, animationState, animationFrame, animationStateNext, animationNext);
+}
+
+// New for debugging purposes
+void Actor::queryAnimationState(int *animationState, int *animationFrame, int *animationStateNext, int *animationNext) {
+	_vm->_aiScripts->queryAnimationState(_id, animationState, animationFrame, animationStateNext, animationNext);
+}
+
 int Actor::getFPS() const {
 	return _fps;
 }
diff --git a/engines/bladerunner/actor.h b/engines/bladerunner/actor.h
index 829978df788..b28c41915be 100644
--- a/engines/bladerunner/actor.h
+++ b/engines/bladerunner/actor.h
@@ -139,6 +139,8 @@ public:
 	Vector3 getPosition() const { return _position; }
 
 	void changeAnimationMode(int animationMode, bool force = false);
+	void changeAnimationState(int animationState, int animationFrame, int animationStateNext, int animationNext); // new for debugging purposes
+	void queryAnimationState(int *animationState, int *animationFrame, int *animationStateNext, int *animationNext); // new for debugging purposes
 	int  getFPS() const;
 	void setFPS(int fps);
 	void increaseFPS();
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index d76f1c7ac29..e44445567f1 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -57,7 +57,8 @@ namespace BladeRunner {
 
 enum DebugLevels {
 	kDebugScript = 1 << 0,
-	kDebugSound = 1 << 1
+	kDebugSound = 1 << 1,
+	kDebugAnimation = 1 << 2
 };
 
 class Actor;
diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index c3b235a3f98..f9248d83c97 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -154,6 +154,78 @@ Debugger::~Debugger() {
 	}
 }
 
+const struct AnimationsList {
+	Actors actorId;
+	int animationModelIdStart;
+	int animationModelIdEnd;
+	int animationModelIdSpecial; // for characters that use an animation outside their "own" range (eg. kActorGenwalkerA using Bob's Gun)
+	int animationModeMax;
+	int animationStateMax;
+} animationsList[] = {
+	{ kActorMcCoy,             0,  53, -1, 85, 71 },
+	{ kActorSteele,           54,  92, -1, 86, 41 },
+	{ kActorGordo,            93, 133, -1, 84, 39 },
+	{ kActorDektora,         134, 171, -1, 79, 41 },
+	{ kActorGuzza,           172, 207, -1, 61, 32 },
+	{ kActorClovis,          208, 252, -1, 88, 42 },
+	{ kActorLucy,            253, 276, -1, 48, 21 },
+	{ kActorIzo,             277, 311, -1, 48, 35 },
+	{ kActorSadik,           312, 345, -1, 63, 34 },
+	{ kActorLuther,          346, 359, -1, 50, 12 },
+	{ kActorEarlyQ,          360, 387, -1, 85, 28 },
+	{ kActorZuben,           388, 421, -1, 49, 28 },
+	{ kActorGenwalkerA,      422, 437, 440, 4,  3 },
+	{ kActorGenwalkerB,      422, 437, -1,  1,  2 },
+	{ kActorGenwalkerC,      422, 437, -1,  1,  2 },
+	{ kActorHysteriaPatron3, 438, 439, -1, -1,  2 },
+	// skip animations 441-450 that refer to targets in shooting range (which are items kItemPS10Target1 to kItemPS10Target9)
+	{ kActorBaker,           451, 451, -1, -1,  0 },
+	{ kActorCrazylegs,       452, 469, -1, 43, 19 },
+	{ kActorGrigorian,       470, 486, -1, 16,  7 },
+	{ kActorTransient,       487, 505, -1, 89, 19 },
+	{ kActorBulletBob,       506, 525, -1, 88, 16 },
+	{ kActorRunciter,        526, 544, -1, 48, 15 },
+	{ kActorInsectDealer,    545, 554, -1, 23,  8 },
+	{ kActorTyrellGuard,     555, 565, -1, 55, 11 },
+	{ kActorMia,             566, 570, -1, 23,  4 },
+	{ kActorOfficerLeary,    571, 604, -1, 58, 32 },
+	{ kActorOfficerGrayford, 605, 641, -1, 58, 37 },
+	{ kActorHanoi,           642, 660, -1, 78, 20 },
+	{ kActorDeskClerk,       661, 670, -1, 72,  8 },
+	{ kActorHowieLee,        671, 681, -1, 43,  8 },
+	{ kActorFishDealer,      682, 687, -1, 23,  5 },
+	{ kActorKlein,           688, 697, -1, 16,  8 },
+	{ kActorMurray,          698, 704, -1, 15,  6 },
+	{ kActorHawkersBarkeep,  705, 715, -1, 16,  9 },
+	{ kActorHolloway,        716, 721, -1, 15,  7 },
+	{ kActorSergeantWalls,   722, 731, -1, 23,  9 },
+	{ kActorMoraji,          732, 743, -1, 48, 14 },
+	{ kActorPhotographer,    744, 750, -1, 43,  6 },
+	{ kActorRajif,           751, 751, -1,  0,  0 },
+	{ kActorEarlyQBartender, 752, 757, -1, 23,  4 },
+	{ kActorShoeshineMan,    758, 764, -1, 29,  6 },
+	{ kActorTyrell,          765, 772, -1, 15,  6 },
+	{ kActorChew,            773, 787, -1, 48, 13 },
+	{ kActorGaff,            788, 804, -1, 41,  8 },
+	{ kActorBryant,          805, 808, -1, 48,  3 },
+	{ kActorSebastian,       809, 821, -1, 48, 11 },
+	{ kActorRachael,         822, 832, -1, 18,  9 },
+	{ kActorGeneralDoll,     833, 837, -1, 48,  4 },
+	{ kActorIsabella,        838, 845, -1, 17,  9 },
+	{ kActorLeon,            846, 856, -1, 72, 10 },
+	{ kActorFreeSlotA,       857, 862, -1, 48,  8 },
+	{ kActorFreeSlotB,       857, 862, -1, 48,  8 },
+	{ kActorMaggie,          863, 876, -1, 88, 16 },
+	{ kActorHysteriaPatron1, 877, 884, -1, -1, 26 },
+	{ kActorHysteriaPatron2, 885, 892, -1, -1, 29 },
+	{ kActorMutant1,         893, 900, -1, 88, 10 },
+	{ kActorMutant2,         901, 907, -1, 88,  8 },
+	{ kActorMutant3,         908, 917, -1, 88, 11 },
+	{ kActorTaffyPatron,     918, 919, -1, 48,  2 },
+	{ kActorHasan,           920, 930, -1, 16,  6 }
+	// skip animations 931-996 which refer to item models/animations
+};
+
 bool Debugger::cmdAnimation(int argc, const char **argv) {
 	if (argc != 2 && argc != 4) {
 		debugPrintf("Get or set animation mode of the actor.\n");
@@ -182,7 +254,23 @@ bool Debugger::cmdAnimation(int argc, const char **argv) {
 		return false;
 	}
 
-	debugPrintf("actorAnimationMode(%i) = %i, showDamageWhenMoving = %i, inCombat = %i\n", actorId, actor->getAnimationMode(), actor->getFlagDamageAnimIfMoving(), actor->inCombat());
+	int animationState = -1;
+	int animationFrame = -1;
+	int animationStateNext = -1;
+	int animationNext = -1;
+	actor->queryAnimationState(&animationState, &animationFrame, &animationStateNext, &animationNext);
+
+	debugPrintf("actorAnimationMode(%s) = %i, model: %i, goal: %i, state:%i, frame:%i, stateNext: %i, nextModelId: %i, showDamageWhenMoving = %i, inCombat = %i\n",
+	             _vm->_textActorNames->getText(actorId),
+	             actor->getAnimationMode(),
+	             actor->getAnimationId(),
+	             actor->getGoal(),
+	             animationState,
+	             animationFrame,
+	             animationStateNext,
+	             animationNext,
+	             actor->getFlagDamageAnimIfMoving(),
+	             actor->inCombat());
 	return true;
 }
 
@@ -750,8 +838,9 @@ const struct SceneList {
 	{ 4, "TB03", 17, 83 },   { 4, "TB07", 18, 108 }, { 4, "UG01", 74, 86 },   { 4, "UG02", 75, 87 },
 	{ 4, "UG03", 76, 88 },   { 4, "UG04", 77, 89 },  { 4, "UG05", 78, 90 },   { 4, "UG06", 79, 91 },
 	{ 4, "UG07", 80, 92 },   { 4, "UG08", 81, 93 },  { 4, "UG09", 82, 94 },   { 4, "UG10", 83, 95 },
-	{ 4, "UG12", 84, 96 },   { 4, "UG13", 85, 97 },  { 4, "UG14", 86, 98 },   { 4, "UG15", 87, 99 },
-	{ 4, "UG16", 19, 100 },  { 4, "UG17", 88, 101 }, { 4, "UG18", 89, 102 },  { 4, "UG19", 90, 103 },
+	{ 4, "UG12", 84, 96 },   { 4, "UG12", 6, 96 },   { 4, "UG13", 85, 97 },   { 4, "UG14", 86, 98 },
+	{ 4, "UG15", 87, 99 },   { 4, "UG16", 19, 100 }, { 4, "UG17", 88, 101 },  { 4, "UG18", 89, 102 },
+	{ 4, "UG19", 90, 103 },
 
 	{ 0, nullptr, 0, 0 }
 };
diff --git a/engines/bladerunner/detection.cpp b/engines/bladerunner/detection.cpp
index 8bba32c2c9e..fd6238ca025 100644
--- a/engines/bladerunner/detection.cpp
+++ b/engines/bladerunner/detection.cpp
@@ -34,6 +34,7 @@
 static const DebugChannelDef debugFlagList[] = {
 	{BladeRunner::kDebugScript, "Script", "Debug the scripts"},
 	{BladeRunner::kDebugSound, "Sound", "Debug the sound"},
+	{BladeRunner::kDebugAnimation, "Animation", "Debug the model animations"},
 	DEBUG_CHANNEL_END
 };
 
diff --git a/engines/bladerunner/script/ai/baker.cpp b/engines/bladerunner/script/ai/baker.cpp
index aab4ab13a73..ecb9199bdaa 100644
--- a/engines/bladerunner/script/ai/baker.cpp
+++ b/engines/bladerunner/script/ai/baker.cpp
@@ -97,6 +97,7 @@ bool AIScriptBaker::UpdateAnimation(int *animation, int *frame) {
 }
 
 bool AIScriptBaker::ChangeAnimationMode(int mode) {
+	debugC(6, kDebugAnimation, "AIScriptBaker::ChangeAnimationMode(%d) - Animation mode change is not supported", mode);
 	return true;
 }
 
diff --git a/engines/bladerunner/script/ai/bryant.cpp b/engines/bladerunner/script/ai/bryant.cpp
index d489b1f0222..a0dc0ba7311 100644
--- a/engines/bladerunner/script/ai/bryant.cpp
+++ b/engines/bladerunner/script/ai/bryant.cpp
@@ -262,6 +262,7 @@ bool AIScriptBryant::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptBryant::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 
@@ -288,6 +289,7 @@ bool AIScriptBryant::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptBryant::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 	return true;
diff --git a/engines/bladerunner/script/ai/bullet_bob.cpp b/engines/bladerunner/script/ai/bullet_bob.cpp
index ed16e397443..50c5e4520a9 100644
--- a/engines/bladerunner/script/ai/bullet_bob.cpp
+++ b/engines/bladerunner/script/ai/bullet_bob.cpp
@@ -438,6 +438,7 @@ bool AIScriptBulletBob::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptBulletBob::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -564,6 +565,7 @@ bool AIScriptBulletBob::ChangeAnimationMode(int mode) {
 	default:
 		_animationState = 0;
 		_animationFrame = 0;
+		debugC(6, kDebugAnimation, "AIScriptBulletBob::ChangeAnimationMode(%d) - Target mode is treated as default, state and frame are set to 0", mode);
 		break;
 	}
 	return true;
diff --git a/engines/bladerunner/script/ai/chew.cpp b/engines/bladerunner/script/ai/chew.cpp
index 27960f3541c..312459e3a42 100644
--- a/engines/bladerunner/script/ai/chew.cpp
+++ b/engines/bladerunner/script/ai/chew.cpp
@@ -302,6 +302,7 @@ bool AIScriptChew::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptChew::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -472,6 +473,7 @@ bool AIScriptChew::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptChew::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/clovis.cpp b/engines/bladerunner/script/ai/clovis.cpp
index 4984d061616..99a3426a2db 100644
--- a/engines/bladerunner/script/ai/clovis.cpp
+++ b/engines/bladerunner/script/ai/clovis.cpp
@@ -1263,6 +1263,7 @@ bool AIScriptClovis::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptClovis::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -1543,6 +1544,7 @@ bool AIScriptClovis::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptClovis::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/crazylegs.cpp b/engines/bladerunner/script/ai/crazylegs.cpp
index 4aab1634ff7..874ab2e9b3f 100644
--- a/engines/bladerunner/script/ai/crazylegs.cpp
+++ b/engines/bladerunner/script/ai/crazylegs.cpp
@@ -354,6 +354,7 @@ bool AIScriptCrazylegs::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptCrazylegs::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -491,6 +492,7 @@ bool AIScriptCrazylegs::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptCrazylegs::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/dektora.cpp b/engines/bladerunner/script/ai/dektora.cpp
index eb72d38a83e..2176b3a7c33 100644
--- a/engines/bladerunner/script/ai/dektora.cpp
+++ b/engines/bladerunner/script/ai/dektora.cpp
@@ -1138,6 +1138,7 @@ bool AIScriptDektora::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptDektora::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -1497,6 +1498,7 @@ bool AIScriptDektora::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptDektora::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 	return true;
diff --git a/engines/bladerunner/script/ai/desk_clerk.cpp b/engines/bladerunner/script/ai/desk_clerk.cpp
index 7eb0635da21..62f4099112b 100644
--- a/engines/bladerunner/script/ai/desk_clerk.cpp
+++ b/engines/bladerunner/script/ai/desk_clerk.cpp
@@ -288,6 +288,10 @@ bool AIScriptDeskClerk::UpdateAnimation(int *animation, int *frame) {
 			_animationState = 0;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptDeskClerk::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 
 	*frame = _animationFrame;
@@ -375,6 +379,10 @@ bool AIScriptDeskClerk::ChangeAnimationMode(int mode) {
 			_animationFrame = 0;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptDeskClerk::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/early_q.cpp b/engines/bladerunner/script/ai/early_q.cpp
index f30d843101e..843792eb5b0 100644
--- a/engines/bladerunner/script/ai/early_q.cpp
+++ b/engines/bladerunner/script/ai/early_q.cpp
@@ -837,6 +837,7 @@ bool AIScriptEarlyQ::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptEarlyQ::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -1056,7 +1057,8 @@ bool AIScriptEarlyQ::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
-		return true;
+		debugC(6, kDebugAnimation, "AIScriptEarlyQ::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/early_q_bartender.cpp b/engines/bladerunner/script/ai/early_q_bartender.cpp
index 1cf13fd0ce1..b99ff3913b7 100644
--- a/engines/bladerunner/script/ai/early_q_bartender.cpp
+++ b/engines/bladerunner/script/ai/early_q_bartender.cpp
@@ -187,6 +187,7 @@ bool AIScriptEarlyQBartender::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptEarlyQBartender::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -227,6 +228,7 @@ bool AIScriptEarlyQBartender::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptEarlyQBartender::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/fish_dealer.cpp b/engines/bladerunner/script/ai/fish_dealer.cpp
index 8230d520aee..c2f6e1a6d08 100644
--- a/engines/bladerunner/script/ai/fish_dealer.cpp
+++ b/engines/bladerunner/script/ai/fish_dealer.cpp
@@ -255,6 +255,7 @@ bool AIScriptFishDealer::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptFishDealer::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 
@@ -312,6 +313,7 @@ bool AIScriptFishDealer::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptFishDealer::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		return true;
 	}
 
diff --git a/engines/bladerunner/script/ai/free_slot_a.cpp b/engines/bladerunner/script/ai/free_slot_a.cpp
index b175d9d9e93..7c4b47bf4c1 100644
--- a/engines/bladerunner/script/ai/free_slot_a.cpp
+++ b/engines/bladerunner/script/ai/free_slot_a.cpp
@@ -539,6 +539,7 @@ bool AIScriptFreeSlotA::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptFreeSlotA::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -547,7 +548,7 @@ bool AIScriptFreeSlotA::UpdateAnimation(int *animation, int *frame) {
 
 bool AIScriptFreeSlotA::ChangeAnimationMode(int mode) {
 	switch (mode) {
-	case 0:
+	case kAnimationModeIdle:
 		if ((unsigned int)(_animationState - 1) > 1) {
 			_animationState = 0;
 			_animationFrame = 0;
@@ -556,7 +557,7 @@ bool AIScriptFreeSlotA::ChangeAnimationMode(int mode) {
 		}
 		break;
 
-	case 1:
+	case kAnimationModeWalk:
 		_animationState = 3;
 		_animationFrame = 0;
 		break;
@@ -599,6 +600,10 @@ bool AIScriptFreeSlotA::ChangeAnimationMode(int mode) {
 		_animationState = 7;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptFreeSlotA::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/free_slot_b.cpp b/engines/bladerunner/script/ai/free_slot_b.cpp
index fc63fa09d27..25f8432f4ba 100644
--- a/engines/bladerunner/script/ai/free_slot_b.cpp
+++ b/engines/bladerunner/script/ai/free_slot_b.cpp
@@ -400,6 +400,7 @@ bool AIScriptFreeSlotB::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptFreeSlotB::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -408,7 +409,7 @@ bool AIScriptFreeSlotB::UpdateAnimation(int *animation, int *frame) {
 
 bool AIScriptFreeSlotB::ChangeAnimationMode(int mode) {
 	switch (mode) {
-	case 0:
+	case kAnimationModeIdle:
 		if ((unsigned int)(_animationState - 1) > 1) {
 			_animationState = 0;
 			_animationFrame = 0;
@@ -417,7 +418,7 @@ bool AIScriptFreeSlotB::ChangeAnimationMode(int mode) {
 		}
 		break;
 
-	case 1:
+	case kAnimationModeWalk:
 		_animationState = 3;
 		_animationFrame = 0;
 		break;
@@ -460,6 +461,10 @@ bool AIScriptFreeSlotB::ChangeAnimationMode(int mode) {
 		_animationState = 7;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptFreeSlotB::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/gaff.cpp b/engines/bladerunner/script/ai/gaff.cpp
index 5c828bc44a5..29a47557776 100644
--- a/engines/bladerunner/script/ai/gaff.cpp
+++ b/engines/bladerunner/script/ai/gaff.cpp
@@ -426,6 +426,7 @@ bool AIScriptGaff::UpdateAnimation(int *animation, int *frame) {
 	default:
 		// Dummy placeholder, kModelAnimationZubenWalking (399) is a Zuben animation
 		*animation = kModelAnimationZubenWalking;
+		debugC(6, kDebugAnimation, "AIScriptGaff::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -480,6 +481,10 @@ bool AIScriptGaff::ChangeAnimationMode(int mode) {
 		_animationState = 8;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGaff::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/general_doll.cpp b/engines/bladerunner/script/ai/general_doll.cpp
index b5b39a31590..0c087d48d9b 100644
--- a/engines/bladerunner/script/ai/general_doll.cpp
+++ b/engines/bladerunner/script/ai/general_doll.cpp
@@ -61,6 +61,8 @@ bool AIScriptGeneralDoll::Update() {
 
 void AIScriptGeneralDoll::TimerExpired(int timer) {
 	if (timer == kActorTimerAIScriptCustomTask2) {
+		// TODO A BUG? McCoy dies here too (it's in original this way also)
+		// This is untriggered, so it could be leftover or debug code
 		Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeDie);
 		Actor_Change_Animation_Mode(kActorGeneralDoll, kAnimationModeDie);
 		AI_Countdown_Timer_Reset(kActorGeneralDoll, kActorTimerAIScriptCustomTask2);
@@ -337,6 +339,7 @@ bool AIScriptGeneralDoll::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptGeneralDoll::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -346,7 +349,7 @@ bool AIScriptGeneralDoll::UpdateAnimation(int *animation, int *frame) {
 
 bool AIScriptGeneralDoll::ChangeAnimationMode(int mode) {
 	switch (mode) {
-	case 0:
+	case kAnimationModeIdle:
 		if (_animationState == 1) {
 			_resumeIdleAfterFramesetCompletesFlag = true;
 		} else {
@@ -355,12 +358,12 @@ bool AIScriptGeneralDoll::ChangeAnimationMode(int mode) {
 		}
 		break;
 
-	case 1:
+	case kAnimationModeWalk:
 		_animationState = 2;
 		_animationFrame = 0;
 		break;
 
-	case 3:
+	case kAnimationModeTalk:
 		_animationState = 1;
 		_animationFrame = 0;
 		_resumeIdleAfterFramesetCompletesFlag = false;
@@ -375,6 +378,10 @@ bool AIScriptGeneralDoll::ChangeAnimationMode(int mode) {
 		_animationState = 4;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGeneralDoll::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/generic_walker_a.cpp b/engines/bladerunner/script/ai/generic_walker_a.cpp
index 1c09c89d8ae..d3fcffdbf7d 100644
--- a/engines/bladerunner/script/ai/generic_walker_a.cpp
+++ b/engines/bladerunner/script/ai/generic_walker_a.cpp
@@ -338,6 +338,7 @@ bool AIScriptGenericWalkerA::UpdateAnimation(int *animation, int *frame) {
 	case kGenericWalkerAStatesDie:
 		// This is an animation for Maggie (exploding) but is also used for generic death states (rats, generic walkers)
 		// probably for debug purposes
+		debugC(6, kDebugAnimation, "AIScriptGenericWalkerA::UpdateAnimation() - Current _animationState (%d) is placeholder", _animationState);
 		*animation = kModelAnimationMaggieExploding;
 		++_animationFrame;
 		if (++_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationMaggieExploding))
@@ -351,6 +352,7 @@ bool AIScriptGenericWalkerA::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	case kGenericWalkerAStatesGun:
+		debugC(6, kDebugAnimation, "AIScriptGenericWalkerA::UpdateAnimation() - Current _animationState (%d) is special (bob's gun)", _animationState);
 		*animation = kModelAnimationBulletBobsTrackingGun;
 		++_animationFrame;
 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationBulletBobsTrackingGun)) {
@@ -382,6 +384,10 @@ bool AIScriptGenericWalkerA::ChangeAnimationMode(int mode) {
 		_animationState = kGenericWalkerAStatesGun;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGenericWalkerA::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/generic_walker_b.cpp b/engines/bladerunner/script/ai/generic_walker_b.cpp
index 752a3fb3d36..9b41ba6712c 100644
--- a/engines/bladerunner/script/ai/generic_walker_b.cpp
+++ b/engines/bladerunner/script/ai/generic_walker_b.cpp
@@ -303,8 +303,7 @@ bool AIScriptGenericWalkerB::UpdateAnimation(int *animation, int *frame) {
 		// probably for debug purposes
 		*animation = kModelAnimationMaggieExploding;
 		++_animationFrame;
-		if (++_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationMaggieExploding))
-		{
+		if (++_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationMaggieExploding)) {
 			_animationFrame = 0;
 			Actor_Set_Goal_Number(kActorGenwalkerB, kGoalGenwalkerDefault);
 			_animationState = kGenericWalkerBStatesIdle;
@@ -312,6 +311,10 @@ bool AIScriptGenericWalkerB::UpdateAnimation(int *animation, int *frame) {
 			deltaZ = 0.0f;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGenericWalkerB::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 	*frame = _animationFrame;
 	return true;
@@ -332,6 +335,10 @@ bool AIScriptGenericWalkerB::ChangeAnimationMode(int mode) {
 		_animationState = kGenericWalkerBStatesWalk;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGenericWalkerB::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/generic_walker_c.cpp b/engines/bladerunner/script/ai/generic_walker_c.cpp
index e808bbb35d9..ee42bf184c6 100644
--- a/engines/bladerunner/script/ai/generic_walker_c.cpp
+++ b/engines/bladerunner/script/ai/generic_walker_c.cpp
@@ -312,6 +312,10 @@ bool AIScriptGenericWalkerC::UpdateAnimation(int *animation, int *frame) {
 			deltaZ = 0.0f;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGenericWalkerC::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 	*frame = _animationFrame;
 	return true;
@@ -332,6 +336,10 @@ bool AIScriptGenericWalkerC::ChangeAnimationMode(int mode) {
 		_animationState = kGenericWalkerCStatesWalk;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGenericWalkerC::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/gordo.cpp b/engines/bladerunner/script/ai/gordo.cpp
index 723f85793fa..af40036cc13 100644
--- a/engines/bladerunner/script/ai/gordo.cpp
+++ b/engines/bladerunner/script/ai/gordo.cpp
@@ -1245,6 +1245,10 @@ bool AIScriptGordo::UpdateAnimation(int *animation, int *frame) {
 			_animationState = 24;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGordo::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 	*frame = _animationFrame;
 	return true;
@@ -1614,6 +1618,10 @@ bool AIScriptGordo::ChangeAnimationMode(int mode) {
 		_animationState = 39;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGordo::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/grigorian.cpp b/engines/bladerunner/script/ai/grigorian.cpp
index 8282dd81af6..82ee087eb2c 100644
--- a/engines/bladerunner/script/ai/grigorian.cpp
+++ b/engines/bladerunner/script/ai/grigorian.cpp
@@ -221,6 +221,7 @@ bool AIScriptGrigorian::UpdateAnimation(int *animation, int *frame) {
 	default:
 		// Dummy placeholder, kModelAnimationZubenWalking (399) is a Zuben animation
 		*animation = kModelAnimationZubenWalking;
+		debugC(6, kDebugAnimation, "AIScriptGrigorian::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -271,6 +272,10 @@ bool AIScriptGrigorian::ChangeAnimationMode(int mode) {
 		_animationState = 7;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGrigorian::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/guzza.cpp b/engines/bladerunner/script/ai/guzza.cpp
index 929b61d4b30..c3661d2b039 100644
--- a/engines/bladerunner/script/ai/guzza.cpp
+++ b/engines/bladerunner/script/ai/guzza.cpp
@@ -789,6 +789,7 @@ bool AIScriptGuzza::UpdateAnimation(int *animation, int *frame) {
 	default:
 		// Dummy placeholder, kModelAnimationZubenWalking (399) is a Zuben animation
 		*animation = kModelAnimationZubenWalking;
+		debugC(6, kDebugAnimation, "AIScriptGuzza::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -1085,6 +1086,10 @@ bool AIScriptGuzza::ChangeAnimationMode(int mode) {
 		_animationState = 33;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptGuzza::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/hanoi.cpp b/engines/bladerunner/script/ai/hanoi.cpp
index 4853c3ec8a0..fd384359170 100644
--- a/engines/bladerunner/script/ai/hanoi.cpp
+++ b/engines/bladerunner/script/ai/hanoi.cpp
@@ -643,6 +643,7 @@ bool AIScriptHanoi::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptHanoi::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -767,6 +768,10 @@ bool AIScriptHanoi::ChangeAnimationMode(int mode) {
 		_animationState = 6;
 		_animationFrame = 16;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptHanoi::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/hasan.cpp b/engines/bladerunner/script/ai/hasan.cpp
index 76c7b413242..6092ab67d7f 100644
--- a/engines/bladerunner/script/ai/hasan.cpp
+++ b/engines/bladerunner/script/ai/hasan.cpp
@@ -356,6 +356,7 @@ bool AIScriptHasan::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptHasan::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -392,6 +393,7 @@ bool AIScriptHasan::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptHasan::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 	return true;
diff --git a/engines/bladerunner/script/ai/hawkers_barkeep.cpp b/engines/bladerunner/script/ai/hawkers_barkeep.cpp
index c61f91a3111..6087a748597 100644
--- a/engines/bladerunner/script/ai/hawkers_barkeep.cpp
+++ b/engines/bladerunner/script/ai/hawkers_barkeep.cpp
@@ -327,6 +327,7 @@ bool AIScriptHawkersBarkeep::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptHawkersBarkeep::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 
@@ -419,6 +420,7 @@ bool AIScriptHawkersBarkeep::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptHawkersBarkeep::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/holloway.cpp b/engines/bladerunner/script/ai/holloway.cpp
index fe869ec6d68..882cae7599e 100644
--- a/engines/bladerunner/script/ai/holloway.cpp
+++ b/engines/bladerunner/script/ai/holloway.cpp
@@ -271,6 +271,7 @@ bool AIScriptHolloway::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptHolloway::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -330,6 +331,7 @@ bool AIScriptHolloway::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptHolloway::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/howie_lee.cpp b/engines/bladerunner/script/ai/howie_lee.cpp
index 37dcb6c6c52..18530c98ec4 100644
--- a/engines/bladerunner/script/ai/howie_lee.cpp
+++ b/engines/bladerunner/script/ai/howie_lee.cpp
@@ -444,6 +444,7 @@ bool AIScriptHowieLee::UpdateAnimation(int *animation, int *frame) {
 	default:
 		// Dummy placeholder, kModelAnimationZubenWalking (399) is a Zuben animation
 		*animation = kModelAnimationZubenWalking;
+		debugC(6, kDebugAnimation, "AIScriptHowieLee::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -503,6 +504,10 @@ bool AIScriptHowieLee::ChangeAnimationMode(int mode) {
 		_animationState = 1;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptHowieLee::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/hysteria_patron1.cpp b/engines/bladerunner/script/ai/hysteria_patron1.cpp
index e3f1849ccfb..f427d73cbb6 100644
--- a/engines/bladerunner/script/ai/hysteria_patron1.cpp
+++ b/engines/bladerunner/script/ai/hysteria_patron1.cpp
@@ -140,6 +140,7 @@ bool AIScriptHysteriaPatron1::UpdateAnimation(int *animation, int *frame) {
 }
 
 bool AIScriptHysteriaPatron1::ChangeAnimationMode(int mode) {
+	debugC(6, kDebugAnimation, "AIScriptHysteriaPatron1::ChangeAnimationMode(%d) - Animation mode change is not supported", mode);
 	return true;
 }
 
diff --git a/engines/bladerunner/script/ai/hysteria_patron2.cpp b/engines/bladerunner/script/ai/hysteria_patron2.cpp
index c7f4265a8b5..8d3ab0ec044 100644
--- a/engines/bladerunner/script/ai/hysteria_patron2.cpp
+++ b/engines/bladerunner/script/ai/hysteria_patron2.cpp
@@ -125,6 +125,7 @@ bool AIScriptHysteriaPatron2::UpdateAnimation(int *animation, int *frame) {
 }
 
 bool AIScriptHysteriaPatron2::ChangeAnimationMode(int mode) {
+	debugC(6, kDebugAnimation, "AIScriptHysteriaPatron2::ChangeAnimationMode(%d) - Animation mode change is not supported", mode);
 	return true;
 }
 
diff --git a/engines/bladerunner/script/ai/hysteria_patron3.cpp b/engines/bladerunner/script/ai/hysteria_patron3.cpp
index b85e9ca74ea..aa3ad928f20 100644
--- a/engines/bladerunner/script/ai/hysteria_patron3.cpp
+++ b/engines/bladerunner/script/ai/hysteria_patron3.cpp
@@ -106,31 +106,35 @@ const int animationList[kAnimationsCount] = {
 
 bool AIScriptHysteriaPatron3::UpdateAnimation(int *animation, int *frame) {
 	if (_vm->_cutContent) {
-		*animation = animationList[_animationState];
-
-		if (_animationState == 2) {
-			--_animationFrame;
-			if (_animationFrame == 0) {
-				_animationState = Random_Query(0, 1); // restart the cycle from 0 or 1 state
-				_animationFrame = 0;
-				*animation = animationList[_animationState];
-			}
+		if (_animationState >= kAnimationsCount) {
+			debugC(6, kDebugAnimation, "AIScriptHysteriaPatron3::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		} else {
-			++_animationFrame;
-			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
-				_animationFrame = 0;
-
-				if (_animationState == 0 && Random_Query(0, 2) == 0) {
-					_animationState = 0; // restart same 0 state, with a small random chance
-				} else {
-					++_animationState;
-					if (_animationState == 2) {
-						_animationFrame = Slice_Animation_Query_Number_Of_Frames(animationList[_animationState]) - 1;
-					} else if (_animationState >= kAnimationsCount) {
-						_animationState = Random_Query(0, 1); // restart the cycle from 0 or 1 state
+			*animation = animationList[_animationState];
+
+			if (_animationState == 2) {
+				--_animationFrame;
+				if (_animationFrame == 0) {
+					_animationState = Random_Query(0, 1); // restart the cycle from 0 or 1 state
+					_animationFrame = 0;
+					*animation = animationList[_animationState];
+				}
+			} else {
+				++_animationFrame;
+				if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
+					_animationFrame = 0;
+
+					if (_animationState == 0 && Random_Query(0, 2) == 0) {
+						_animationState = 0; // restart same 0 state, with a small random chance
+					} else {
+						++_animationState;
+						if (_animationState == 2) {
+							_animationFrame = Slice_Animation_Query_Number_Of_Frames(animationList[_animationState]) - 1;
+						} else if (_animationState >= kAnimationsCount) {
+							_animationState = Random_Query(0, 1); // restart the cycle from 0 or 1 state
+						}
 					}
+					*animation = animationList[_animationState];
 				}
-				*animation = animationList[_animationState];
 			}
 		}
 		*frame = _animationFrame;
@@ -139,6 +143,7 @@ bool AIScriptHysteriaPatron3::UpdateAnimation(int *animation, int *frame) {
 }
 
 bool AIScriptHysteriaPatron3::ChangeAnimationMode(int mode) {
+	debugC(6, kDebugAnimation, "AIScriptHysteriaPatron3::ChangeAnimationMode(%d) - Animation mode change is not supported", mode);
 	return true;
 }
 
diff --git a/engines/bladerunner/script/ai/insect_dealer.cpp b/engines/bladerunner/script/ai/insect_dealer.cpp
index 47c034b0f22..a5f20132b5e 100644
--- a/engines/bladerunner/script/ai/insect_dealer.cpp
+++ b/engines/bladerunner/script/ai/insect_dealer.cpp
@@ -262,6 +262,10 @@ bool AIScriptInsectDealer::UpdateAnimation(int *animation, int *frame) {
 			_animationState = 0;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptInsectDealer::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 
 	*frame = _animationFrame;
@@ -331,6 +335,7 @@ bool AIScriptInsectDealer::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptInsectDealer::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/isabella.cpp b/engines/bladerunner/script/ai/isabella.cpp
index 9879119c04f..f99cd3d0feb 100644
--- a/engines/bladerunner/script/ai/isabella.cpp
+++ b/engines/bladerunner/script/ai/isabella.cpp
@@ -342,6 +342,7 @@ bool AIScriptIsabella::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptIsabella::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 
@@ -438,6 +439,7 @@ bool AIScriptIsabella::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptIsabella::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/izo.cpp b/engines/bladerunner/script/ai/izo.cpp
index 945dae4c3ed..1ad39c1b025 100644
--- a/engines/bladerunner/script/ai/izo.cpp
+++ b/engines/bladerunner/script/ai/izo.cpp
@@ -866,6 +866,7 @@ bool AIScriptIzo::UpdateAnimation(int *animation, int *frame) {
 		// Dummy placeholder, kModelAnimationZubenIdle (406) is a Zuben animation
 		*animation = kModelAnimationZubenIdle;
 		_animationFrame = 0;
+		debugC(6, kDebugAnimation, "AIScriptIzo::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 
@@ -1109,6 +1110,10 @@ bool AIScriptIzo::ChangeAnimationMode(int mode) {
 		_animationState = 19;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptIzo::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/klein.cpp b/engines/bladerunner/script/ai/klein.cpp
index ebecfed3ed8..d46765228e8 100644
--- a/engines/bladerunner/script/ai/klein.cpp
+++ b/engines/bladerunner/script/ai/klein.cpp
@@ -488,6 +488,7 @@ bool AIScriptKlein::UpdateAnimation(int *animation, int *frame) {
 	default:
 		// Dummy placeholder, kModelAnimationZubenWalking (399) is a Zuben animation
 		*animation = kModelAnimationZubenWalking;
+		debugC(6, kDebugAnimation, "AIScriptKlein::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -577,6 +578,10 @@ bool AIScriptKlein::ChangeAnimationMode(int mode) {
 			_animationNext = kModelAnimationKleinTalkRaisingBothHands;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptKlein::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/leon.cpp b/engines/bladerunner/script/ai/leon.cpp
index 6410c728e22..1a6cd1c75ce 100644
--- a/engines/bladerunner/script/ai/leon.cpp
+++ b/engines/bladerunner/script/ai/leon.cpp
@@ -387,6 +387,10 @@ bool AIScriptLeon::UpdateAnimation(int *animation, int *frame) {
 			Actor_Change_Animation_Mode(kActorLeon, kAnimationModeIdle);
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptLeon::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 	*frame = _animationFrame;
 	return true;
@@ -478,6 +482,10 @@ bool AIScriptLeon::ChangeAnimationMode(int mode) {
 			_animationFrame = 0;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptLeon::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/lucy.cpp b/engines/bladerunner/script/ai/lucy.cpp
index db5e7528f2e..c68f931b8c2 100644
--- a/engines/bladerunner/script/ai/lucy.cpp
+++ b/engines/bladerunner/script/ai/lucy.cpp
@@ -431,7 +431,9 @@ bool AIScriptLucy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
 		Actor_Says(kActorLucy, 360, 13);
 		Actor_Says(kActorMcCoy, 1710, 13);
 
-		if (Global_Variable_Query(kVariableAffectionTowards) == kAffectionTowardsLucy) { // cut feature? if this is set lucy will not run into hf04
+		if (Global_Variable_Query(kVariableAffectionTowards) == kAffectionTowardsLucy) {
+			// TODO A cut feature? if this is set lucy will not run into hf04
+			// Also this dialogue takes place in HF03 script too, but with different animations
 			Actor_Says(kActorLucy, 940, 13);
 			Actor_Says(kActorMcCoy, 6780, 12);
 			Actor_Says(kActorLucy, 950, 12);
@@ -460,6 +462,7 @@ bool AIScriptLucy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
 		Actor_Says(kActorLucy, 370, 14);
 		Actor_Set_Goal_Number(kActorLucy, kGoalLucyHF04WalkAway);
 
+		// TODO A bug? Should this be here after Lucy walks away? (It's this way in original)
 		if (Global_Variable_Query(kVariableHollowayArrest) == 3) {
 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleHF02LucyRanAway);
 			Game_Flag_Set(kFlagLucyRanAway);
@@ -721,6 +724,7 @@ bool AIScriptLucy::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptLucy::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -844,6 +848,10 @@ bool AIScriptLucy::ChangeAnimationMode(int mode) {
 		_animationState = kLucyStateDie;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptLucy::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/luther.cpp b/engines/bladerunner/script/ai/luther.cpp
index 34d348feeae..9cd728b04a5 100644
--- a/engines/bladerunner/script/ai/luther.cpp
+++ b/engines/bladerunner/script/ai/luther.cpp
@@ -374,6 +374,9 @@ bool AIScriptLuther::UpdateAnimation(int *animation, int *frame) {
 		}
 		break;
 
+	default:
+		debugC(6, kDebugAnimation, "AIScriptLuther::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 	*frame = _animationFrame;
 
@@ -453,6 +456,10 @@ bool AIScriptLuther::ChangeAnimationMode(int mode) {
 		_animationState = 11;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptLuther::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/maggie.cpp b/engines/bladerunner/script/ai/maggie.cpp
index f42fc223e11..41c28be4a90 100644
--- a/engines/bladerunner/script/ai/maggie.cpp
+++ b/engines/bladerunner/script/ai/maggie.cpp
@@ -950,6 +950,10 @@ bool AIScriptMaggie::UpdateAnimation(int *animation, int *frame) {
 			_animationFrame = 0;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMaggie::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 	*frame = _animationFrame;
 	return true;
@@ -1090,6 +1094,9 @@ bool AIScriptMaggie::ChangeAnimationMode(int mode) {
 		_animationFrame = 0;
 		break;
 
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMaggie::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/mccoy.cpp b/engines/bladerunner/script/ai/mccoy.cpp
index ab29fb644b3..32d0ea4a415 100644
--- a/engines/bladerunner/script/ai/mccoy.cpp
+++ b/engines/bladerunner/script/ai/mccoy.cpp
@@ -562,8 +562,7 @@ bool AIScriptMcCoy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
 				Global_Variable_Set(kVariableAffectionTowards, kAffectionTowardsNone);
 			}
 		} else if (affectionTowards == kAffectionTowardsDektora
-		        || affectionTowards == kAffectionTowardsLucy
-		) {
+		        || affectionTowards == kAffectionTowardsLucy) {
 			if (!Game_Flag_Query(kFlagMcCoyIsHelpingReplicants)) {
 				Global_Variable_Set(kVariableAffectionTowards, kAffectionTowardsNone);
 			}
@@ -1422,6 +1421,10 @@ bool AIScriptMcCoy::UpdateAnimation(int *animation, int *frame) {
 			Player_Gains_Control();
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMcCoy::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 	*frame = _animationFrame;
 	return true;
@@ -1944,6 +1947,10 @@ bool AIScriptMcCoy::ChangeAnimationMode(int mode) {
 		_animationFrame = 0;
 		_animationState = 69;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMcCoy::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/mia.cpp b/engines/bladerunner/script/ai/mia.cpp
index e919c678463..7f7361d337a 100644
--- a/engines/bladerunner/script/ai/mia.cpp
+++ b/engines/bladerunner/script/ai/mia.cpp
@@ -165,6 +165,10 @@ bool AIScriptMia::UpdateAnimation(int *animation, int *frame) {
 			_animationState = 2;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMia::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 
 	*frame = _animationFrame;
@@ -207,6 +211,10 @@ bool AIScriptMia::ChangeAnimationMode(int mode) {
 		_animationFrame = 0;
 		_animationState = 1;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMia::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/moraji.cpp b/engines/bladerunner/script/ai/moraji.cpp
index 7d5288b812a..0ee4977dc65 100644
--- a/engines/bladerunner/script/ai/moraji.cpp
+++ b/engines/bladerunner/script/ai/moraji.cpp
@@ -383,6 +383,7 @@ bool AIScriptMoraji::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptMoraji::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -456,6 +457,10 @@ bool AIScriptMoraji::ChangeAnimationMode(int mode) {
 		_animationState = 13;
 		_animationFrame = -1;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMoraji::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/murray.cpp b/engines/bladerunner/script/ai/murray.cpp
index a51a87f25d7..04edadcabe2 100644
--- a/engines/bladerunner/script/ai/murray.cpp
+++ b/engines/bladerunner/script/ai/murray.cpp
@@ -190,6 +190,7 @@ bool AIScriptMurray::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptMurray::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 
@@ -238,6 +239,10 @@ bool AIScriptMurray::ChangeAnimationMode(int mode) {
 		_animationFrame = 0;
 		_resumeIdleAfterFramesetCompletesFlag = false;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMurray::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/mutant1.cpp b/engines/bladerunner/script/ai/mutant1.cpp
index 619a2d2fe25..b380ece937d 100644
--- a/engines/bladerunner/script/ai/mutant1.cpp
+++ b/engines/bladerunner/script/ai/mutant1.cpp
@@ -517,6 +517,7 @@ bool AIScriptMutant1::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptMutant1::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -526,7 +527,7 @@ bool AIScriptMutant1::UpdateAnimation(int *animation, int *frame) {
 
 bool AIScriptMutant1::ChangeAnimationMode(int mode) {
 	switch (mode) {
-	case 0:
+	case kAnimationModeIdle:
 		if (_animationState >= 3 && _animationState <= 5) {
 			_resumeIdleAfterFramesetCompletesFlag = true;
 		} else {
@@ -535,19 +536,23 @@ bool AIScriptMutant1::ChangeAnimationMode(int mode) {
 		}
 		break;
 
-	case 1:
+	case kAnimationModeWalk:
 		// fall through
-	case 7:
+	case kAnimationModeCombatWalk:
 		_animationState = 1;
 		_animationFrame = 0;
 		break;
 
-	case 2:
+	case kAnimationModeRun:
+		// fall through
+	case kAnimationModeCombatRun:
 		_animationState = 2;
 		_animationFrame = 0;
 		break;
 
 	case 3:
+		// fall through
+	case 12:
 		_animationState = 3;
 		_animationFrame = 0;
 		_resumeIdleAfterFramesetCompletesFlag = false;
@@ -567,17 +572,6 @@ bool AIScriptMutant1::ChangeAnimationMode(int mode) {
 		_animationFrame = 0;
 		break;
 
-	case 8:
-		_animationState = 2;
-		_animationFrame = 0;
-		break;
-
-	case 12:
-		_animationState = 3;
-		_animationFrame = 0;
-		_resumeIdleAfterFramesetCompletesFlag = false;
-		break;
-
 	case 13:
 		_animationState = 3;
 		_animationFrame = 0;
@@ -600,6 +594,10 @@ bool AIScriptMutant1::ChangeAnimationMode(int mode) {
 		_animationState = 9;
 		_animationFrame = Slice_Animation_Query_Number_Of_Frames(kModelAnimationMutant1ShotDead) - 1;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMutant1::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/mutant2.cpp b/engines/bladerunner/script/ai/mutant2.cpp
index acd896ae2c2..7c2b2895860 100644
--- a/engines/bladerunner/script/ai/mutant2.cpp
+++ b/engines/bladerunner/script/ai/mutant2.cpp
@@ -505,6 +505,7 @@ bool AIScriptMutant2::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptMutant2::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -514,7 +515,7 @@ bool AIScriptMutant2::UpdateAnimation(int *animation, int *frame) {
 
 bool AIScriptMutant2::ChangeAnimationMode(int mode) {
 	switch (mode) {
-	case 0:
+	case kAnimationModeIdle:
 		if (_animationState >= 3 && _animationState <= 4) {
 			_resumeIdleAfterFramesetCompletesFlag = true;
 		} else {
@@ -523,21 +524,23 @@ bool AIScriptMutant2::ChangeAnimationMode(int mode) {
 		}
 		break;
 
-	case 1:
+	case kAnimationModeWalk:
 		// fall through
-	case 7:
+	case kAnimationModeCombatWalk:
 		_animationState = 1;
 		_animationFrame = 0;
 		break;
 
-	case 2:
+	case kAnimationModeRun:
 		// fall through
-	case 8:
+	case kAnimationModeCombatRun:
 		_animationState = 2;
 		_animationFrame = 0;
 		break;
 
 	case 3:
+		// fall through
+	case 12:
 		_animationState = 3;
 		_animationFrame = 0;
 		_resumeIdleAfterFramesetCompletesFlag = false;
@@ -557,12 +560,6 @@ bool AIScriptMutant2::ChangeAnimationMode(int mode) {
 		_animationFrame = 0;
 		break;
 
-	case 12:
-		_animationState = 3;
-		_animationFrame = 0;
-		_resumeIdleAfterFramesetCompletesFlag = false;
-		break;
-
 	case 21:
 		// fall through
 	case 22:
@@ -580,6 +577,10 @@ bool AIScriptMutant2::ChangeAnimationMode(int mode) {
 		_animationState = 7;
 		_animationFrame = Slice_Animation_Query_Number_Of_Frames(kModelAnimationMutant2ShotDead) - 1;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMutant2::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/mutant3.cpp b/engines/bladerunner/script/ai/mutant3.cpp
index 0d8796fe48b..8e83921be08 100644
--- a/engines/bladerunner/script/ai/mutant3.cpp
+++ b/engines/bladerunner/script/ai/mutant3.cpp
@@ -545,6 +545,7 @@ bool AIScriptMutant3::UpdateAnimation(int *animation, int *frame) {
 	default:
 		// Dummy placeholder, kModelAnimationZubenIdle (406) is a Zuben animation
 		*animation = kModelAnimationZubenIdle;
+		debugC(6, kDebugAnimation, "AIScriptMutant3::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -554,7 +555,7 @@ bool AIScriptMutant3::UpdateAnimation(int *animation, int *frame) {
 
 bool AIScriptMutant3::ChangeAnimationMode(int mode) {
 	switch (mode) {
-	case 0:
+	case kAnimationModeIdle:
 		switch (_animationState) {
 		case 3:
 			// fall through
@@ -577,16 +578,16 @@ bool AIScriptMutant3::ChangeAnimationMode(int mode) {
 		}
 		break;
 
-	case 1:
+	case kAnimationModeWalk:
 		// fall through
-	case 7:
+	case kAnimationModeCombatWalk:
 		_animationState = 1;
 		_animationFrame = 0;
 		break;
 
-	case 2:
+	case kAnimationModeRun:
 		// fall through
-	case 8:
+	case kAnimationModeCombatRun:
 		_animationState = 2;
 		_animationFrame = 0;
 		break;
@@ -621,11 +622,6 @@ bool AIScriptMutant3::ChangeAnimationMode(int mode) {
 		_var1 = 1;
 		break;
 
-	case 88:
-		_animationState = 7;
-		_animationFrame = Slice_Animation_Query_Number_Of_Frames(kModelAnimationMutant3ShotDead) - 1;
-		break;
-
  	case 43:
 		if ((unsigned int)(_animationState - 8) > 1) {
 			_animationState = 9;
@@ -637,6 +633,15 @@ bool AIScriptMutant3::ChangeAnimationMode(int mode) {
 		_animationState = 6;
 		_animationFrame = 0;
 		break;
+
+	case 88:
+		_animationState = 7;
+		_animationFrame = Slice_Animation_Query_Number_Of_Frames(kModelAnimationMutant3ShotDead) - 1;
+		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptMutant3::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/officer_grayford.cpp b/engines/bladerunner/script/ai/officer_grayford.cpp
index 6434b22aab0..5dc3ec28c4a 100644
--- a/engines/bladerunner/script/ai/officer_grayford.cpp
+++ b/engines/bladerunner/script/ai/officer_grayford.cpp
@@ -1297,6 +1297,7 @@ bool AIScriptOfficerGrayford::UpdateAnimation(int *animation, int *frame) {
 	default:
 		// Dummy placeholder, kModelAnimationZubenWalking (399) is a Zuben animation
 		*animation = kModelAnimationZubenWalking;
+		debugC(6, kDebugAnimation, "AIScriptOfficerGrayford::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -1632,6 +1633,9 @@ bool AIScriptOfficerGrayford::ChangeAnimationMode(int mode) {
 		_animationFrame = 0;
 		break;
 
+	default:
+		debugC(6, kDebugAnimation, "AIScriptOfficerGrayford::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/officer_leary.cpp b/engines/bladerunner/script/ai/officer_leary.cpp
index 6ac18263caa..5c8f901009a 100644
--- a/engines/bladerunner/script/ai/officer_leary.cpp
+++ b/engines/bladerunner/script/ai/officer_leary.cpp
@@ -1142,10 +1142,12 @@ bool AIScriptOfficerLeary::UpdateAnimation(int *animation, int *frame) {
 		}
 		*frame = _animationFrame;
 		return true;
+
 	default:
 		// Dummy placeholder, kModelAnimationZubenWalking (399) is a Zuben animation
 		*animation = kModelAnimationZubenWalking;
 		*frame = _animationFrame;
+		debugC(6, kDebugAnimation, "AIScriptOfficerLeary::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		return true;
 	}
 }
@@ -1480,6 +1482,10 @@ bool AIScriptOfficerLeary::ChangeAnimationMode(int mode) {
 		_animationState = 20;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptOfficerLeary::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/photographer.cpp b/engines/bladerunner/script/ai/photographer.cpp
index c67ad115b4c..2a12c0cf45b 100644
--- a/engines/bladerunner/script/ai/photographer.cpp
+++ b/engines/bladerunner/script/ai/photographer.cpp
@@ -296,6 +296,7 @@ bool AIScriptPhotographer::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptPhotographer::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -355,6 +356,7 @@ bool AIScriptPhotographer::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptPhotographer::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 	return true;
diff --git a/engines/bladerunner/script/ai/rachael.cpp b/engines/bladerunner/script/ai/rachael.cpp
index cf958fb05b2..9d7bed49c16 100644
--- a/engines/bladerunner/script/ai/rachael.cpp
+++ b/engines/bladerunner/script/ai/rachael.cpp
@@ -304,6 +304,7 @@ bool AIScriptRachael::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptRachael::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -376,6 +377,7 @@ bool AIScriptRachael::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptRachael::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/rajif.cpp b/engines/bladerunner/script/ai/rajif.cpp
index 9804b86948f..f3b96204d6f 100644
--- a/engines/bladerunner/script/ai/rajif.cpp
+++ b/engines/bladerunner/script/ai/rajif.cpp
@@ -18,7 +18,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
-
+#include "bladerunner/bladerunner.h"
 #include "bladerunner/script/ai_script.h"
 
 namespace BladeRunner {
@@ -110,6 +110,7 @@ bool AIScriptRajif::GoalChanged(int currentGoalNumber, int newGoalNumber) {
 }
 
 bool AIScriptRajif::UpdateAnimation(int *animation, int *frame) {
+#if BLADERUNNER_ORIGINAL_BUGS
 	if (_animationState <= 1) {
 		if (_animationState > 0) {
 			*animation = kModelAnimationRajifWithGunIdle;
@@ -117,7 +118,8 @@ bool AIScriptRajif::UpdateAnimation(int *animation, int *frame) {
 			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationRajifWithGunIdle)) {
 				_animationFrame = 0;
 			}
-		} else { // bug in original. Both branches are equal
+		} else {
+			// bug in original. Both branches are equal. Also _animationState for Rajif is always 0.
 			*animation = kModelAnimationRajifWithGunIdle;
 			++_animationFrame;
 			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationRajifWithGunIdle)) {
@@ -125,6 +127,21 @@ bool AIScriptRajif::UpdateAnimation(int *animation, int *frame) {
 			}
 		}
 	}
+#else
+	switch (_animationState) {
+	case 0:
+		*animation = kModelAnimationRajifWithGunIdle;
+		++_animationFrame;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationRajifWithGunIdle)) {
+			_animationFrame = 0;
+		}
+		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptRajif::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
+	}
+#endif // BLADERUNNER_ORIGINAL_BUGS
 
 	*frame = _animationFrame;
 
@@ -132,9 +149,15 @@ bool AIScriptRajif::UpdateAnimation(int *animation, int *frame) {
 }
 
 bool AIScriptRajif::ChangeAnimationMode(int mode) {
-	if (!mode) {
+	switch (mode) {
+	case kAnimationModeIdle:
 		_animationState = 0;
 		_animationFrame = 0;
+		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptRajif::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/runciter.cpp b/engines/bladerunner/script/ai/runciter.cpp
index 64443a061fc..0deccf17abd 100644
--- a/engines/bladerunner/script/ai/runciter.cpp
+++ b/engines/bladerunner/script/ai/runciter.cpp
@@ -533,6 +533,7 @@ bool AIScriptRunciter::UpdateAnimation(int *animation, int *frame) {
 		*animation = kModelAnimationZubenWalking;
 		_animationFrame = 0;
 		*frame = _animationFrame;
+		debugC(6, kDebugAnimation, "AIScriptRunciter::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 	return true;
diff --git a/engines/bladerunner/script/ai/sadik.cpp b/engines/bladerunner/script/ai/sadik.cpp
index 374daf348ea..178acf3b5f8 100644
--- a/engines/bladerunner/script/ai/sadik.cpp
+++ b/engines/bladerunner/script/ai/sadik.cpp
@@ -900,6 +900,7 @@ bool AIScriptSadik::UpdateAnimation(int *animation, int *frame) {
 		// Dummy placeholder, kModelAnimationZubenIdle (406) is a Zuben animation
 		*animation = kModelAnimationZubenIdle;
 		_animationFrame = 0;
+		debugC(6, kDebugAnimation, "AIScriptSadik::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 
@@ -1138,6 +1139,10 @@ bool AIScriptSadik::ChangeAnimationMode(int mode) {
 			_animationFrame = 2;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptSadik::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/sebastian.cpp b/engines/bladerunner/script/ai/sebastian.cpp
index 3f7bf4c573d..c2bac004f35 100644
--- a/engines/bladerunner/script/ai/sebastian.cpp
+++ b/engines/bladerunner/script/ai/sebastian.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "bladerunner/bladerunner.h"
 #include "bladerunner/script/ai_script.h"
 
 namespace BladeRunner {
@@ -94,7 +95,14 @@ void AIScriptSebastian::OtherAgentEnteredCombatMode(int otherActorId, int combat
 	if (otherActorId == kActorMcCoy
 	 && combatMode
 	) {
+#if BLADERUNNER_ORIGINAL_BUGS
 		Global_Variable_Increment(kVariableGunPulledInFrontOfSebastian, 1);
+#else
+		// This is a minor fix: Prevent increasing the value of kVariableGunPulledInFrontOfSebastian without restriction
+		if (Global_Variable_Query(kVariableGunPulledInFrontOfSebastian) < 2) {
+			Global_Variable_Increment(kVariableGunPulledInFrontOfSebastian, 1);
+		}
+#endif
 		Actor_Modify_Friendliness_To_Other(kActorSebastian, kActorMcCoy, -5);
 		AI_Movement_Track_Pause(kActorSebastian);
 		Actor_Face_Actor(kActorSebastian, kActorMcCoy, true);
@@ -264,6 +272,7 @@ bool AIScriptSebastian::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptSebastian::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -344,6 +353,10 @@ bool AIScriptSebastian::ChangeAnimationMode(int mode) {
 		_animationState = 3;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptSebastian::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/sergeant_walls.cpp b/engines/bladerunner/script/ai/sergeant_walls.cpp
index d7a533da874..650c8bd37d9 100644
--- a/engines/bladerunner/script/ai/sergeant_walls.cpp
+++ b/engines/bladerunner/script/ai/sergeant_walls.cpp
@@ -196,6 +196,7 @@ bool AIScriptSergeantWalls::UpdateAnimation(int *animation, int *frame) {
 	default:
 		// Dummy placeholder, kModelAnimationZubenWalking (399) is a Zuben animation
 		*animation = kModelAnimationZubenWalking;
+		debugC(6, kDebugAnimation, "AIScriptSergeantWalls::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -248,6 +249,10 @@ bool AIScriptSergeantWalls::ChangeAnimationMode(int mode) {
 		_animationState = 9;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptSergeantWalls::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/shoeshine_man.cpp b/engines/bladerunner/script/ai/shoeshine_man.cpp
index 7a63eeadad9..ce71317fbd6 100644
--- a/engines/bladerunner/script/ai/shoeshine_man.cpp
+++ b/engines/bladerunner/script/ai/shoeshine_man.cpp
@@ -119,6 +119,26 @@ bool AIScriptShoeshineMan::GoalChanged(int currentGoalNumber, int newGoalNumber)
 }
 
 bool AIScriptShoeshineMan::UpdateAnimation(int *animation, int *frame) {
+	switch(_animationState) {
+	case 0:
+		// fall through
+	case 1:
+		// fall through
+	case 2:
+		// fall through
+	case 3:
+		// fall through
+	case 4:
+		// fall through
+	case 5:
+		// fall through
+	case 6:
+		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptShoeshineMan::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
+	}
 	return true;
 }
 
@@ -167,6 +187,7 @@ bool AIScriptShoeshineMan::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptShoeshineMan::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/steele.cpp b/engines/bladerunner/script/ai/steele.cpp
index 12d71f49961..3c264a5c0eb 100644
--- a/engines/bladerunner/script/ai/steele.cpp
+++ b/engines/bladerunner/script/ai/steele.cpp
@@ -125,7 +125,7 @@ bool AIScriptSteele::Update() {
 		break;
 
 	case 3:
-		if (Global_Variable_Query(kVariableChapter) != 3) { // why is this here? double check?
+		if (Global_Variable_Query(kVariableChapter) != 3) { // TODO A BUG? why is this here? double check? redundant?
 			break;
 		}
 
@@ -2008,6 +2008,7 @@ bool AIScriptSteele::UpdateAnimation(int *animation, int *frame) {
 		// Dummy placeholder, kModelAnimationZubenIdle (406) is a Zuben animation
 		*animation = kModelAnimationZubenIdle;
 		_animationFrame = 0;
+		debugC(6, kDebugAnimation, "AIScriptSteele::UpdateAnimation() - Current _animationState (%d) is placeholder", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
diff --git a/engines/bladerunner/script/ai/taffy_patron.cpp b/engines/bladerunner/script/ai/taffy_patron.cpp
index e1cc6430b4f..ed92ae2e8ca 100644
--- a/engines/bladerunner/script/ai/taffy_patron.cpp
+++ b/engines/bladerunner/script/ai/taffy_patron.cpp
@@ -135,6 +135,7 @@ bool AIScriptTaffyPatron::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptTaffyPatron::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -144,12 +145,12 @@ bool AIScriptTaffyPatron::UpdateAnimation(int *animation, int *frame) {
 
 bool AIScriptTaffyPatron::ChangeAnimationMode(int mode) {
 	switch (mode) {
-	case 0:
+	case kAnimationModeIdle:
 		_animationState = 0;
 		_animationFrame = 0;
 		break;
 
-	case 2:
+	case kAnimationModeRun:
 		_animationState = 1;
 		_animationFrame = 0;
 		break;
@@ -160,6 +161,7 @@ bool AIScriptTaffyPatron::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptTaffyPatron::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/transient.cpp b/engines/bladerunner/script/ai/transient.cpp
index 127a8c459d1..7e71986826e 100644
--- a/engines/bladerunner/script/ai/transient.cpp
+++ b/engines/bladerunner/script/ai/transient.cpp
@@ -407,6 +407,7 @@ bool AIScriptTransient::UpdateAnimation(int *animation, int *frame) {
 	default:
 		// Dummy placeholder, kModelAnimationZubenWalking (399) is a Zuben animation
 		*animation = kModelAnimationZubenWalking;
+		debugC(6, kDebugAnimation, "AIScriptTransient::UpdateAnimation() - Current _animationState (%d) is a placeholder", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -545,6 +546,10 @@ bool AIScriptTransient::ChangeAnimationMode(int mode) {
 		_animationState = 12;
 		_animationFrame = Slice_Animation_Query_Number_Of_Frames(kModelAnimationTransientLayingShotDead) - 1;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptTransient::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 
 	return true;
diff --git a/engines/bladerunner/script/ai/tyrell.cpp b/engines/bladerunner/script/ai/tyrell.cpp
index 36f40e98e1e..400a7cc4658 100644
--- a/engines/bladerunner/script/ai/tyrell.cpp
+++ b/engines/bladerunner/script/ai/tyrell.cpp
@@ -190,6 +190,7 @@ bool AIScriptTyrell::UpdateAnimation(int *animation, int *frame) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptTyrell::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -244,6 +245,7 @@ bool AIScriptTyrell::ChangeAnimationMode(int mode) {
 		break;
 
 	default:
+		debugC(6, kDebugAnimation, "AIScriptTyrell::ChangeAnimationMode(%d) - Target mode is not supported", mode);
 		break;
 	}
 
diff --git a/engines/bladerunner/script/ai/tyrell_guard.cpp b/engines/bladerunner/script/ai/tyrell_guard.cpp
index 78c64a94fa9..888efe82ae6 100644
--- a/engines/bladerunner/script/ai/tyrell_guard.cpp
+++ b/engines/bladerunner/script/ai/tyrell_guard.cpp
@@ -265,6 +265,10 @@ bool AIScriptTyrellGuard::UpdateAnimation(int *animation, int *frame) {
 			_animationState = 0;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptTyrellGuard::UpdateAnimation() - Current _animationState (%d) is not supported", _animationState);
+		break;
 	}
 
 	*frame = _animationFrame;
@@ -374,6 +378,10 @@ bool AIScriptTyrellGuard::ChangeAnimationMode(int mode) {
 			_animationFrame = 0;
 		}
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptTyrellGuard::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }
diff --git a/engines/bladerunner/script/ai/zuben.cpp b/engines/bladerunner/script/ai/zuben.cpp
index 5e190f23685..fa1e3929044 100644
--- a/engines/bladerunner/script/ai/zuben.cpp
+++ b/engines/bladerunner/script/ai/zuben.cpp
@@ -1036,7 +1036,7 @@ bool AIScriptZuben::UpdateAnimation(int *animation, int *frame) {
 		*animation = kModelAnimationZubenBashOnDoor;
 		++_animationFrame;
 		if (_animationFrame == 5) {
-			Overlay_Play("ct02over", 1, false, true, 0);
+			Overlay_Play("CT02OVER", 1, false, true, 0);
 		}
 		if (_animationFrame == 6) {
 			Sound_Play(kSfxMTLDOOR2, 40, 0, 0, 50);
@@ -1065,6 +1065,7 @@ bool AIScriptZuben::UpdateAnimation(int *animation, int *frame) {
 
 	default:
 		*animation = kModelAnimationZubenWalking;
+		debugC(6, kDebugAnimation, "AIScriptZuben::UpdateAnimation() - Current _animationState (%d) is default (walking)", _animationState);
 		break;
 	}
 	*frame = _animationFrame;
@@ -1259,6 +1260,10 @@ bool AIScriptZuben::ChangeAnimationMode(int mode) {
 		_animationState = 14;
 		_animationFrame = 0;
 		break;
+
+	default:
+		debugC(6, kDebugAnimation, "AIScriptZuben::ChangeAnimationMode(%d) - Target mode is not supported", mode);
+		break;
 	}
 	return true;
 }




More information about the Scummvm-git-logs mailing list