[Scummvm-git-logs] scummvm master -> 3bec5a7f9dcb0035f221cd001ff0b27a1a11c0a4

peterkohaut peterkohaut at users.noreply.github.com
Sat Mar 10 13:32:36 CET 2018


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

Summary:
3bec5a7f9d BLADERUNNER: Added Guzzo actor


Commit: 3bec5a7f9dcb0035f221cd001ff0b27a1a11c0a4
    https://github.com/scummvm/scummvm/commit/3bec5a7f9dcb0035f221cd001ff0b27a1a11c0a4
Author: Peter Kohaut (peter.kohaut at gmail.com)
Date: 2018-03-10T13:32:06+01:00

Commit Message:
BLADERUNNER: Added Guzzo actor

Added "pos" console command

Changed paths:
  A engines/bladerunner/script/ai/guzza.cpp
    engines/bladerunner/actor.cpp
    engines/bladerunner/debugger.cpp
    engines/bladerunner/debugger.h
    engines/bladerunner/game_constants.h
    engines/bladerunner/module.mk
    engines/bladerunner/script/ai/insect_dealer.cpp
    engines/bladerunner/script/ai_script.cpp
    engines/bladerunner/script/ai_script.h


diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index 3d14ccd..a55d94b 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -354,7 +354,7 @@ void Actor::setAtXYZ(const Vector3 &position, int facing, bool snapFacing, bool
 	_vm->_sceneObjects->remove(_id + kSceneObjectOffsetActors);
 
 	if (_vm->_scene->getSetId() == _setId) {
-		_vm->_sceneObjects->addActor(_id + kSceneObjectOffsetActors, _bbox, &_screenRectangle, 1, moving, _isTarget, retired);
+		_vm->_sceneObjects->addActor(_id + kSceneObjectOffsetActors, _bbox, &_screenRectangle, true, moving, _isTarget, retired);
 	}
 }
 
diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index b817feb..5539082 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -64,6 +64,7 @@ Debugger::Debugger(BladeRunnerEngine *vm) : GUI::Debugger() {
 	registerCmd("flag", WRAP_METHOD(Debugger, cmdFlag));
 	registerCmd("goal", WRAP_METHOD(Debugger, cmdGoal));
 	registerCmd("loop", WRAP_METHOD(Debugger, cmdLoop));
+	registerCmd("pos", WRAP_METHOD(Debugger, cmdPosition));
 	registerCmd("say", WRAP_METHOD(Debugger, cmdSay));
 	registerCmd("scene", WRAP_METHOD(Debugger, cmdScene));
 	registerCmd("var", WRAP_METHOD(Debugger, cmdVariable));
@@ -230,6 +231,65 @@ bool Debugger::cmdLoop(int argc, const char **argv) {
 	}
 }
 
+bool Debugger::cmdPosition(int argc, const char **argv) {
+	if (argc != 2 && argc != 3 && argc != 7) {
+		debugPrintf("Get or set position of the actor.\n");
+		debugPrintf("Usage: %s <actorId> [(<setId> <x> <y> <z> <facing>)|<otherActorId>]\n", argv[0]);
+		return true;
+	}
+
+	int actorId = atoi(argv[1]);
+
+	Actor *actor = nullptr;
+	if (actorId >= 0 && actorId < (int)_vm->_gameInfo->getActorCount()) {
+		actor = _vm->_actors[actorId];
+	}
+
+	if (actor == nullptr) {
+		debugPrintf("Unknown actor %i\n", actorId);
+		return true;
+	}
+
+	if (argc == 2) {
+		debugPrintf("actorSet(%i) = %i\n", actorId, actor->getSetId());
+		debugPrintf("actorX(%i) = %f\n", actorId, actor->getX());
+		debugPrintf("actorY(%i) = %f\n", actorId, actor->getY());
+		debugPrintf("actorZ(%i) = %f\n", actorId, actor->getZ());
+		debugPrintf("actorFacing(%i) = %i\n", actorId, actor->getFacing());
+		return true;
+	}
+
+	if (argc == 3) {
+		int otherActorId = atoi(argv[2]);
+		Actor *otherActor = nullptr;
+		if (otherActorId >= 0 && otherActorId < (int)_vm->_gameInfo->getActorCount()) {
+			otherActor = _vm->_actors[otherActorId];
+		}
+
+		if (otherActor == nullptr) {
+			debugPrintf("Unknown actor %i\n", otherActorId);
+			return true;
+		}
+
+		Vector3 position;
+		otherActor->getXYZ(&position.x, &position.y, &position.z);
+		actor->setSetId(otherActor->getSetId());
+		actor->setAtXYZ(position, otherActor->getFacing());
+		return true;
+	}
+
+	if (argc == 7) {
+		int setId = atoi(argv[2]);
+		Vector3 position(atof(argv[3]), atof(argv[4]), atof(argv[5]));
+		int facing = atoi(argv[6]);
+
+		actor->setSetId(setId);
+		actor->setAtXYZ(position, facing);
+		return true;
+	}
+	return true;
+}
+
 bool Debugger::cmdSay(int argc, const char **argv) {
 	if (argc != 3) {
 		debugPrintf("Actor will say specified line.\n");
diff --git a/engines/bladerunner/debugger.h b/engines/bladerunner/debugger.h
index ca323bb..bfe4e49 100644
--- a/engines/bladerunner/debugger.h
+++ b/engines/bladerunner/debugger.h
@@ -53,6 +53,7 @@ public:
 	bool cmdFlag(int argc, const char **argv);
 	bool cmdGoal(int argc, const char **argv);
 	bool cmdLoop(int argc, const char **argv);
+	bool cmdPosition(int argc, const char **argv);
 	bool cmdSay(int argc, const char **argv);
 	bool cmdScene(int argc, const char **argv);
 	bool cmdVariable(int argc, const char **argv);
diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h
index fbd212c..af4728a 100644
--- a/engines/bladerunner/game_constants.h
+++ b/engines/bladerunner/game_constants.h
@@ -604,8 +604,9 @@ enum AnimationModes {
 	kAnimationModeWalkDown = 45,
 	kAnimationModeCombatWalkUp = 46,
 	kAnimationModeCombatWalkDown = 47,
-	kAnimationModeDie = 48, // or fall down?
+	kAnimationModeDie = 48, // TODO: check
 	kAnimationModeFeeding = 52,
+	kAnimationModeSit = 53, // TODO: check
 	kAnimationModeClimbUp = 64,
 	kAnimationModeClimbDown = 65,
 	kAnimationModeCombatClimbUp = 66,
@@ -688,12 +689,12 @@ enum Scenes {
 	kSceneNR11 = 64,
 	kScenePS01 = 65, // Police Station - Roof
 	kScenePS02 = 66, // Police Station - Elevator
-	kScenePS03 = 67,
+	kScenePS03 = 67, // Police Station - Ground floor
 	kScenePS04 = 68, // Police Station - Guzza's Office
 	kScenePS05 = 69,
 	kScenePS06 = 70,
 	kScenePS07 = 71,
-	kScenePS09 = 72,
+	kScenePS09 = 72, // Police Station - Lockup
 	kScenePS10 = 73,
 	kScenePS11 = 74,
 	kScenePS12 = 75,
diff --git a/engines/bladerunner/module.mk b/engines/bladerunner/module.mk
index 11337f0..c76f7f4 100644
--- a/engines/bladerunner/module.mk
+++ b/engines/bladerunner/module.mk
@@ -59,6 +59,7 @@ MODULE_OBJS = \
 	script/ai/generic_walker_c.o \
 	script/ai/gordo.o \
 	script/ai/grigorian.o \
+	script/ai/guzza.o \
 	script/ai/howie_lee.o \
 	script/ai/hysteria_patron1.o \
 	script/ai/hysteria_patron2.o \
diff --git a/engines/bladerunner/script/ai/guzza.cpp b/engines/bladerunner/script/ai/guzza.cpp
new file mode 100644
index 0000000..0f99fa8
--- /dev/null
+++ b/engines/bladerunner/script/ai/guzza.cpp
@@ -0,0 +1,931 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "bladerunner/script/ai_script.h"
+
+namespace BladeRunner {
+
+AIScriptGuzza::AIScriptGuzza(BladeRunnerEngine *vm) : AIScriptBase(vm) {
+	_frameDelta = 0;
+	_counter = 0;
+	_state = 0;
+	_flag = false;
+}
+
+void AIScriptGuzza::Initialize() {
+	_animationFrame = 0;
+	_animationState = 0;
+	_animationStateNext = 0;
+	_animationNext = 0;
+	_frameDelta = 1;
+	_counter = 0;
+	_state = 0;
+	_flag = false;
+}
+
+bool AIScriptGuzza::Update() {
+	if (Global_Variable_Query(kVariableChapter) == 2) {
+		if (!Game_Flag_Query(462)) {
+			Game_Flag_Set(462);
+			Actor_Put_In_Set(kActorGuzza, kSetFreeSlotC);
+			Actor_Set_At_Waypoint(kActorGuzza, 35, 0);
+			Actor_Set_Goal_Number(kActorGuzza, 100);
+			return true;
+		}
+		if (Actor_Query_Goal_Number(kActorGuzza) != 101 && !Game_Flag_Query(463) && Game_Flag_Query(464)) {
+			Game_Flag_Set(463);
+			Actor_Set_Goal_Number(kActorGuzza, 103);
+			return true;
+		}
+	}
+	return false;
+}
+
+void AIScriptGuzza::TimerExpired(int timer) {
+	//return false;
+}
+
+void AIScriptGuzza::CompletedMovementTrack() {
+	switch (Actor_Query_Goal_Number(kActorGuzza)) {
+	case 100:
+		Actor_Set_Goal_Number(kActorGuzza, 102);
+		// return true;
+		break;
+	case 102:
+		if (Random_Query(1, 2) == 1) {
+			Actor_Set_Goal_Number(kActorGuzza, 101);
+		} else {
+			Actor_Set_Goal_Number(kActorGuzza, 104);
+		}
+		// return true;
+		break;
+	case 103:
+		Actor_Set_Goal_Number(kActorGuzza, 100);
+		// return true;
+		break;
+	case 105:
+		Actor_Set_Goal_Number(kActorGuzza, 100);
+		// return true;
+		break;
+	}
+	// return false;
+}
+
+void AIScriptGuzza::ReceivedClue(int clueId, int fromActorId) {
+	//return false;
+}
+
+void AIScriptGuzza::ClickedByPlayer() {
+	if (Global_Variable_Query(kVariableChapter) == 2 && Game_Flag_Query(462) == 1) {
+		Actor_Face_Actor(kActorMcCoy, kActorGuzza, true);
+		if (Actor_Query_Friendliness_To_Other(kActorGordo, kActorMcCoy) < 48) {
+			Actor_Says(kActorMcCoy, 3970, 13);
+			Actor_Says(kActorGuzza, 780, -1);
+		}
+		//TODO: test this, seems like a bug in game
+		if (Random_Query(1, 4) == 1) {
+			AI_Movement_Track_Pause(4);
+			Actor_Says(kActorMcCoy, 4005, 15);
+			Actor_Says(kActorGuzza, 780, -1);
+			AI_Movement_Track_Unpause(kActorGuzza);
+		} else if (Random_Query(1, 4) == 2) {
+			AI_Movement_Track_Pause(4);
+			Actor_Says(kActorMcCoy, 3970, 14);
+			Actor_Says(kActorGuzza, 780, -1);
+			AI_Movement_Track_Unpause(kActorGuzza);
+		} else if (Random_Query(1, 4) == 3) {
+			Actor_Says(kActorMcCoy, 3970, 16);
+		} else if (Random_Query(1, 4) == 4) {
+			Actor_Says(kActorMcCoy, 3970, 13);
+		}
+	}
+	// return false;
+}
+
+void AIScriptGuzza::EnteredScene(int sceneId) {
+	// return false;
+}
+
+void AIScriptGuzza::OtherAgentEnteredThisScene(int otherActorId) {
+	// return false;
+}
+
+void AIScriptGuzza::OtherAgentExitedThisScene(int otherActorId) {
+	// return false;
+}
+
+void AIScriptGuzza::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
+	// return false;
+}
+
+void AIScriptGuzza::ShotAtAndMissed() {
+	if (Actor_Query_Goal_Number(kActorGuzza) == 301) {
+		Actor_Change_Animation_Mode(kActorGuzza, 22);
+		Actor_Set_Goal_Number(kActorGuzza, 304);
+	}
+	// return false;
+}
+
+bool AIScriptGuzza::ShotAtAndHit() {
+	if (Actor_Query_Goal_Number(kActorGuzza) == 301) {
+		Actor_Change_Animation_Mode(kActorGuzza, 22);
+		Actor_Set_Goal_Number(kActorGuzza, 303);
+	}
+	return false;
+}
+
+void AIScriptGuzza::Retired(int byActorId) {
+	Actor_Set_Goal_Number(kActorGuzza, 599);
+	// return false;
+}
+
+int AIScriptGuzza::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) {
+	return 0;
+}
+
+bool AIScriptGuzza::GoalChanged(int currentGoalNumber, int newGoalNumber) {
+	switch (newGoalNumber) {
+	case 100:
+		AI_Movement_Track_Flush(kActorGuzza);
+		AI_Movement_Track_Append_With_Facing(kActorGuzza, 263, 0, 150);
+		AI_Movement_Track_Append_With_Facing(kActorGuzza, 263, 5, 150);
+		AI_Movement_Track_Append(kActorGuzza, 35, 90);
+		AI_Movement_Track_Repeat(kActorGuzza);
+		return true;
+	case 101:
+		AI_Movement_Track_Flush(kActorGuzza);
+		AI_Movement_Track_Append(kActorGuzza, 258, 0);
+		AI_Movement_Track_Append(kActorGuzza, 260, 8);
+		AI_Movement_Track_Append(kActorGuzza, 261, 5);
+		AI_Movement_Track_Append(kActorGuzza, 262, 0);
+		AI_Movement_Track_Repeat(kActorGuzza);
+		return true;
+	case 102:
+		AI_Movement_Track_Flush(kActorGuzza);
+		AI_Movement_Track_Flush(kActorGuzza);
+		AI_Movement_Track_Append_With_Facing(kActorGuzza, 263, 600, 150);
+		AI_Movement_Track_Repeat(kActorGuzza);
+		return true;
+	case 103:
+		AI_Movement_Track_Flush(kActorGuzza);
+		AI_Movement_Track_Append(kActorGuzza, 258, 0);
+		AI_Movement_Track_Append(kActorGuzza, 259, 1);
+		AI_Movement_Track_Append(kActorGuzza, 258, 0);
+		AI_Movement_Track_Repeat(kActorGuzza);
+		return true;
+	case 104:
+		AI_Movement_Track_Flush(kActorGuzza);
+		AI_Movement_Track_Append(kActorGuzza, 34, 60);
+		AI_Movement_Track_Repeat(kActorGuzza);
+		return true;
+	case 105:
+		AI_Movement_Track_Flush(kActorGuzza);
+		AI_Movement_Track_Append(kActorGuzza, 39, 120);
+		AI_Movement_Track_Repeat(kActorGuzza);
+		return true;
+	case 201:
+		Actor_Change_Animation_Mode(kActorGuzza, 53);
+		_animationState = 1;
+		_animationFrame = 0;
+		Actor_Put_In_Set(kActorGuzza, kSetNR03);
+		Actor_Set_At_XYZ(kActorGuzza, -229.0f, -70.19f, -469.0f, 400);
+		return true;
+	case 300:
+		Actor_Put_In_Set(kActorGuzza, kSetUG18);
+		Actor_Set_At_XYZ(kActorGuzza, 10.79f, 0.0f, -354.17f, 400);
+		Actor_Change_Animation_Mode(kActorGuzza, kAnimationModeIdle);
+		return true;
+	case 301:
+		Actor_Set_Targetable(kActorGuzza, true);
+		return true;
+	case 302:
+	case 303:
+	case 304:
+		Actor_Set_Targetable(kActorGuzza, false);
+		return true;
+	case 305:
+	case 306:
+	case 307:
+	case 390:
+		return true;
+	}
+	return false;
+}
+
+bool AIScriptGuzza::UpdateAnimation(int *animation, int *frame) {
+	switch (_animationState) {
+	case 0:
+		switch (_state) {
+		case 0:
+			*animation = 197;
+			_animationFrame++;
+			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(197)) {
+				_animationFrame = 0;
+				if (Random_Query(0, 5) == 0) {
+					_state = Random_Query(1, 2);
+				}
+			}
+			break;
+		case 1:
+			*animation = 198;
+			_animationFrame++;
+			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(198)) {
+				*animation = 197;
+				_animationFrame = 0;
+				_state = 0;
+			}
+			break;
+		case 2:
+			*animation = 199;
+			_animationFrame++;
+			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(199)) {
+				*animation = 197;
+				_animationFrame = 0;
+				_state = 0;
+			}
+			break;
+		}
+		break;
+	case 1:
+		switch (_state) {
+		case 0:
+			*animation = 189;
+			if (_counter) {
+				_counter--;
+				if (Random_Query(0, 6) == 0) {
+					_frameDelta = -_frameDelta;
+				}
+			} else {
+				_animationFrame += _frameDelta;
+				if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
+					_animationFrame = 0;
+					if (Random_Query(0, 2) == 0) {
+						_state = 2 * Random_Query(0, 1);
+					}
+				}
+				if (_animationFrame < 0) {
+					_animationFrame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1;
+				}
+				_counter = Random_Query(0, 1);
+				if (_animationFrame == 2 || _animationFrame == 15) {
+					_counter = Random_Query(5, 12);
+				}
+				if (_animationFrame == 8) {
+					_counter = Random_Query(3, 7);
+				}
+			}
+			break;
+		case 1:
+			*animation = 190;
+			_animationFrame++;
+			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(190)) {
+				*animation = 189;
+				_animationFrame = 0;
+				_state = 0;
+			}
+			break;
+		case 2:
+			*animation = 191;
+			_animationFrame++;
+			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(191)) {
+				if (Random_Query(0, 2) == 0) {
+					*animation = 189;
+					_animationFrame = 0;
+					_state = 0;
+				} else {
+					*animation = 190;
+					_animationFrame = 0;
+					_state = 1;
+				}
+			}
+			break;
+		}
+		break;
+	case 2:
+		if (_state == 0) {
+			*animation = _animationNext;
+			_animationFrame = 0;
+			_animationState = _animationStateNext;
+		} else {
+			if (_state == 1) {
+				*animation = 198;
+			} else if (_state == 2) {
+				*animation = 199;
+			}
+			_animationFrame += 2;
+			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
+				*animation = _animationNext;
+				_animationFrame = 0;
+				_animationState = _animationStateNext;
+			}
+		}
+		break;
+	case 3:
+		switch (_state) {
+		case 0:
+			*animation = 189;
+			break;
+		case 1:
+			*animation = 190;
+			break;
+		case 2:
+			*animation = 191;
+			break;
+		}
+		_animationFrame += 4;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
+			*animation = _animationNext;
+			_animationFrame = 0;
+			_animationState = _animationStateNext;
+		}
+		break;
+	case 4:
+		*animation = 185;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(185)) {
+			_animationFrame = 0;
+		}
+		break;
+	case 5:
+		*animation = 186;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(186)) {
+			_animationFrame = 0;
+		}
+		break;
+	case 6:
+		*animation = 176;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(176)) {
+			_animationFrame = 0;
+		}
+		break;
+	case 7:
+		*animation = 177;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(177)) {
+			_animationFrame = 0;
+		}
+		break;
+	case 8:
+		*animation = 181;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(181)) {
+			_animationFrame = 0;
+		}
+		break;
+	case 9:
+		*animation = 187;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(187)) {
+			_animationFrame = 0;
+		}
+		break;
+	case 10:
+		*animation = 188;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(188)) {
+			_animationFrame = 0;
+		}
+		break;
+	case 11:
+		if (_animationFrame == 0 && _flag) {
+			*animation = 197;
+			_animationState = 0;
+			_flag = false;
+			_state = 0;
+			_counter = 0;
+			_frameDelta = 1;
+		} else {
+			*animation = 201;
+			_animationFrame++;
+			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(201)) {
+				_animationFrame = 0;
+			}
+		}
+		break;
+	case 12:
+		*animation = 202;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(202)) {
+			*animation = 201;
+			_animationFrame = 0;
+			_animationState = 11;
+		}
+		break;
+	case 13:
+		*animation = 203;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(203)) {
+			*animation = 201;
+			_animationFrame = 0;
+			_animationState = 11;
+		}
+		break;
+	case 14:
+		*animation = 204;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(204)) {
+			*animation = 201;
+			_animationFrame = 0;
+			_animationState = 11;
+		}
+		break;
+	case 15:
+		*animation = 205;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(205)) {
+			*animation = 201;
+			_animationFrame = 0;
+			_animationState = 11;
+		}
+		break;
+	case 16:
+		*animation = 206;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(206)) {
+			*animation = 201;
+			_animationFrame = 0;
+			_animationState = 11;
+		}
+		break;
+	case 17:
+		if (_animationFrame == 0 && _flag) {
+			*animation = 189;
+			_animationState = 1;
+			_flag = false;
+			Actor_Change_Animation_Mode(kActorGuzza, 53);
+			_state = 0;
+			_counter = 0;
+			_frameDelta = 1;
+		} else {
+			*animation = 192;
+			_animationFrame++;
+			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(192)) {
+				_animationFrame = 0;
+			}
+		}
+		break;
+	case 18:
+		*animation = 193;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(193)) {
+			*animation = 192;
+			_animationFrame = 0;
+			_animationState = 17;
+		}
+		break;
+	case 19:
+		*animation = 194;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(194)) {
+			*animation = 192;
+			_animationState = 17;
+			_animationFrame = 0;
+		}
+		break;
+	case 20:
+		*animation = 195;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(195)) {
+			*animation = 192;
+			_animationFrame = 0;
+			_animationState = 17;
+		}
+		break;
+	case 21:
+		*animation = 196;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(196)) {
+			*animation = 192;
+			_animationFrame = 0;
+			_animationState = 17;
+		}
+		break;
+	case 22:
+		if (_animationFrame == 0 && _flag) {
+			*animation = 172;
+			_animationState = 24;
+			_flag = false;
+			Actor_Change_Animation_Mode(kActorGuzza, 4);
+			_state = 0;
+			_counter = 0;
+			_frameDelta = 1;
+		} else {
+			*animation = 179;
+			_animationFrame++;
+			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(179)) {
+				_animationFrame = 0;
+			}
+		}
+		break;
+	case 23:
+		if (_animationFrame == 0 && _flag) {
+			*animation = 172;
+			_animationState = 24;
+			_flag = false;
+			Actor_Change_Animation_Mode(kActorGuzza, kAnimationModeCombatIdle);
+			_state = 0;
+			_counter = 0;
+			_frameDelta = 1;
+		} else {
+			*animation = 180;
+			_animationFrame++;
+			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(180)) {
+				_animationFrame = 0;
+			}
+		}
+		break;
+	case 24:
+		*animation = 172;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(172)) {
+			_animationFrame = 0;
+		}
+		break;
+	case 25:
+		*animation = 173;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(173)) {
+			_animationFrame = 0;
+		}
+		break;
+	case 26:
+		*animation = 174;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(174)) {
+			*animation = 172;
+			_animationFrame = 0;
+			_animationState = 24;
+			Actor_Change_Animation_Mode(kActorGuzza, kAnimationModeCombatIdle);
+		}
+		break;
+	case 27:
+		*animation = 175;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(175)) {
+			*animation = 172;
+			_animationFrame = 0;
+			_animationState = 24;
+			Actor_Change_Animation_Mode(kActorGuzza, kAnimationModeCombatIdle);
+		}
+		break;
+	case 29:
+		*animation = 182;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(182)) {
+			*animation = 172;
+			_animationFrame = 0;
+			_animationState = 24;
+		}
+		break;
+	case 30:
+		*animation = 183;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(183)) {
+			*animation = 197;
+			_animationFrame = 0;
+			_animationState = 0;
+		}
+		break;
+	case 31:
+		*animation = 184;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(184)) {
+			*animation = 172;
+			_animationFrame = 0;
+			_animationState = 24;
+			Actor_Change_Animation_Mode(kActorGuzza, kAnimationModeCombatIdle);
+		}
+		break;
+	case 32:
+		*animation = 200;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(200)) {
+			*animation = 197;
+			_animationFrame = 0;
+			_animationState = 0;
+			Actor_Change_Animation_Mode(kActorGuzza, kAnimationModeIdle);
+		}
+		break;
+	case 33:
+		*animation = 207;
+		_animationFrame++;
+		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(207)) {
+			_animationFrame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1;
+			float x, y, z;
+			Actor_Query_XYZ(kActorGuzza, &x, &y, &z);
+			// TODO: test
+			if (-180.0f <= y) {
+				y -= 15.0f;
+				x += 6.0f;
+				z -= 12.0f;
+				Actor_Set_At_XYZ(kActorGuzza, x, y, z, 729);
+			} else {
+				_animationState = 34;
+			}
+		}
+		break;
+	case 34:
+		*animation = 207;
+		_animationFrame = Slice_Animation_Query_Number_Of_Frames(207) - 1;
+		break;
+	default:
+		*animation = 399;
+		break;
+	}
+	*frame = _animationFrame;
+	return true;
+}
+
+bool AIScriptGuzza::ChangeAnimationMode(int mode) {
+	switch (mode) {
+	case kAnimationModeIdle:
+		switch (_animationState) {
+		case 0:
+		case 30:
+		case 32:
+		case 33:
+			break;
+		case 6:
+		case 7:
+			_animationState = 24;
+			_animationFrame = 0;
+			break;
+		case 11:
+		case 12:
+		case 13:
+		case 14:
+		case 15:
+		case 16:
+		case 17:
+		case 18:
+		case 19:
+		case 20:
+		case 21:
+		case 22:
+		case 23:
+			_flag = true;
+			break;
+		case 24:
+		case 31:
+			_animationState = 30;
+			_animationFrame = 0;
+			break;
+		default:
+			_animationState = 0;
+			_animationFrame = 0;
+			_state = 0;
+			_counter = 0;
+			_frameDelta = 1;
+			break;
+		}
+		break;
+	case kAnimationModeWalk:
+		_animationState = 4;
+		_animationFrame = 0;
+		break;
+	case kAnimationModeRun:
+		_animationState = 5;
+		_animationFrame = 0;
+		break;
+	case kAnimationModeTalk:
+		if (_animationState) {
+			_animationState = 11;
+			_animationFrame = 0;
+			_flag = false;
+		} else {
+			_animationState = 2;
+			_animationFrame = 0;
+			_animationStateNext = 11;
+			_animationNext = 201;
+		}
+		break;
+	case kAnimationModeCombatIdle:
+		if (_animationState == 0) {
+			_animationState = 29;
+			_animationFrame = 0;
+		} else if (_animationState != 24 && _animationState != 29) {
+			_animationState = 24;
+			_animationFrame = 0;
+		}
+		break;
+	case kAnimationModeCombatShoot:
+		_animationState = 31;
+		_animationFrame = 0;
+		break;
+	case kAnimationModeCombatWalk:
+		_animationState = 6;
+		_animationFrame = 0;
+		break;
+	case kAnimationModeCombatRun:
+		_animationState = 7;
+		_animationFrame = 0;
+		break;
+	case 12:
+		if (_animationState) {
+			_animationState = 12;
+			_animationFrame = 0;
+			_flag = false;
+		} else {
+			_animationState = 2;
+			_animationFrame = 0;
+			_animationStateNext = 12;
+			_animationNext = 202;
+		}
+		break;
+	case 13:
+		if (_animationState) {
+			_animationState = 13;
+			_animationFrame = 0;
+			_flag = false;
+		} else {
+			_animationState = 2;
+			_animationFrame = 0;
+			_animationStateNext = 13;
+			_animationNext = 203;
+		}
+		break;
+	case 14:
+		if (_animationState) {
+			_animationState = 14;
+			_animationFrame = 0;
+			_flag = false;
+		} else {
+			_animationState = 2;
+			_animationFrame = 0;
+			_animationStateNext = 14;
+			_animationNext = 204;
+		}
+		break;
+	case 15:
+		if (_animationState) {
+			_animationState = 15;
+			_animationFrame = 0;
+			_flag = false;
+		} else {
+			_animationState = 2;
+			_animationFrame = 0;
+			_animationStateNext = 15;
+			_animationNext = 205;
+		}
+		break;
+	case 16:
+		if (_animationState) {
+			_animationState = 16;
+			_animationFrame = 0;
+			_flag = false;
+		} else {
+			_animationState = 2;
+			_animationFrame = 0;
+			_animationStateNext = 16;
+			_animationNext = 206;
+		}
+		break;
+	case 22:
+		if (Random_Query(0, 1)) {
+			_animationState = 26;
+		} else {
+			_animationState = 27;
+		}
+		_animationFrame = 0;
+		break;
+	case 23:
+		_animationState = 32;
+		_animationFrame = 0;
+		break;
+	case 30:
+		if (_animationState == 1) {
+			_animationState = 3;
+			_animationStateNext = 17;
+			_animationNext = 192;
+		} else {
+			_animationState = 17;
+			_animationFrame = 0;
+			_flag = false;
+		}
+		break;
+	case 31:
+		if (_animationState == 1) {
+			_animationState = 3;
+			_animationStateNext = 18;
+			_animationNext = 193;
+		} else {
+			_animationState = 18;
+			_animationFrame = 0;
+			_flag = false;
+		}
+		break;
+	case 32:
+		if (_animationState == 1) {
+			_animationState = 3;
+			_animationStateNext = 19;
+			_animationNext = 194;
+		} else {
+			_animationState = 19;
+			_animationFrame = 0;
+			_flag = false;
+		}
+		break;
+	case 33:
+		if (_animationState == 1) {
+			_animationState = 3;
+			_animationStateNext = 20;
+			_animationNext = 195;
+		} else {
+			_animationState = 20;
+			_animationFrame = 0;
+			_flag = false;
+		}
+		break;
+	case 34:
+		if (_animationState == 1) {
+			_animationState = 3;
+			_animationStateNext = 21;
+			_animationNext = 196;
+		} else {
+			_animationState = 21;
+			_animationFrame = 0;
+			_flag = false;
+		}
+		break;
+	case kAnimationModeWalkUp:
+		_animationState = 9;
+		_animationFrame = 0;
+		break;
+	case kAnimationModeWalkDown:
+		_animationState = 10;
+		_animationFrame = 0;
+		break;
+	case 48:
+		_animationState = 28;
+		_animationFrame = 0;
+		break;
+	case 53:
+		_animationState = 1;
+		_animationFrame = 0;
+		break;
+	case 58:
+		_animationState = 22;
+		_animationFrame = 0;
+		_flag = false;
+		break;
+	case 59:
+		_animationState = 23;
+		_animationFrame = 0;
+		_flag = false;
+		break;
+	case 61:
+		_animationState = 33;
+		_animationFrame = 0;
+		break;
+	}
+	return true;
+}
+
+void AIScriptGuzza::QueryAnimationState(int *animationState, int *animationFrame, int *animationStateNext, int *animationNext) {
+	*animationState     = _animationState;
+	*animationFrame     = _animationFrame;
+	*animationStateNext = _animationStateNext;
+	*animationNext      = _animationNext;
+}
+
+void AIScriptGuzza::SetAnimationState(int animationState, int animationFrame, int animationStateNext, int animationNext) {
+	_animationState     = animationState;
+	_animationFrame     = animationFrame;
+	_animationStateNext = animationStateNext;
+	_animationNext      = animationNext;
+}
+
+bool AIScriptGuzza::ReachedMovementTrackWaypoint(int waypointId) {
+	if (waypointId == 263) {
+		_animationFrame = 0;
+		_animationState = 1;
+		return false;
+	}
+	return true;
+}
+
+void AIScriptGuzza::FledCombat() {
+	// return false;
+}
+
+} // End of namespace BladeRunner
diff --git a/engines/bladerunner/script/ai/insect_dealer.cpp b/engines/bladerunner/script/ai/insect_dealer.cpp
index 07ac64e..db957f9 100644
--- a/engines/bladerunner/script/ai/insect_dealer.cpp
+++ b/engines/bladerunner/script/ai/insect_dealer.cpp
@@ -160,7 +160,7 @@ bool AIScriptInsectDealer::UpdateAnimation(int *animation, int *frame) {
 			}
 			break;
 		case 2:
-			// TEST: nothing? actor will stuck
+			// TODO: test... actor will be stuck
 			break;
 		}
 		break;
diff --git a/engines/bladerunner/script/ai_script.cpp b/engines/bladerunner/script/ai_script.cpp
index 08ec7c8..01b4026 100644
--- a/engines/bladerunner/script/ai_script.cpp
+++ b/engines/bladerunner/script/ai_script.cpp
@@ -41,6 +41,7 @@ AIScripts::AIScripts(BladeRunnerEngine *vm, int actorCount) {
 
 	_AIScripts[kActorMcCoy] = new AIScriptMcCoy(_vm);                     //  0
 	_AIScripts[kActorGordo] = new AIScriptGordo(_vm);                     //  2
+	_AIScripts[kActorGuzza] = new AIScriptGuzza(_vm);                     //  4
 	_AIScripts[kActorGrigorian] = new AIScriptGrigorian(_vm);             // 11
 	_AIScripts[kActorTransient] = new AIScriptTransient(_vm);             // 12
 	_AIScripts[kActorLance] = new AIScriptLance(_vm);                     // 13
diff --git a/engines/bladerunner/script/ai_script.h b/engines/bladerunner/script/ai_script.h
index e7e4dcb..024e8f6 100644
--- a/engines/bladerunner/script/ai_script.h
+++ b/engines/bladerunner/script/ai_script.h
@@ -136,6 +136,13 @@ DECLARE_SCRIPT(Gordo)
 	void sub_41117C();
 END_SCRIPT
 
+DECLARE_SCRIPT(Guzza)
+	int _frameDelta;
+	int _counter;
+	int _state;
+	bool _flag;
+END_SCRIPT
+
 DECLARE_SCRIPT(Grigorian)
 	int var_45CA10;
 	int var_45CA14;





More information about the Scummvm-git-logs mailing list