aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-06-12 22:20:28 -0400
committerPaul Gilbert2015-06-12 22:20:28 -0400
commit5dc79a8f3272f8e5c9131fac925d4533a25ab4d9 (patch)
treedcaf6b03f70ac7d9d60d1ffcee3ceaa9b43023ff /engines
parenta3fb5ab1fbb0cf3ff448ba9e9966ef21c7dc3847 (diff)
downloadscummvm-rg350-5dc79a8f3272f8e5c9131fac925d4533a25ab4d9.tar.gz
scummvm-rg350-5dc79a8f3272f8e5c9131fac925d4533a25ab4d9.tar.bz2
scummvm-rg350-5dc79a8f3272f8e5c9131fac925d4533a25ab4d9.zip
SHERLOCK: RT: Implement animation structure changes
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/objects.cpp59
-rw-r--r--engines/sherlock/objects.h14
-rw-r--r--engines/sherlock/scalpel/scalpel_scene.cpp16
-rw-r--r--engines/sherlock/scalpel/scalpel_user_interface.cpp8
-rw-r--r--engines/sherlock/scene.cpp6
-rw-r--r--engines/sherlock/talk.cpp2
-rw-r--r--engines/sherlock/tattoo/tattoo_scene.cpp2
7 files changed, 65 insertions, 42 deletions
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 9e18f7738c..ee04644a9e 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -1527,19 +1527,36 @@ void CAnim::load(Common::SeekableReadStream &s, bool isRoseTattoo) {
_flags = s.readByte();
}
- _goto.x = s.readSint16LE();
- _goto.y = s.readSint16LE();
- _gotoDir = s.readSint16LE();
- _teleportPos.x = s.readSint16LE();
- _teleportPos.y = s.readSint16LE();
- if (!isRoseTattoo) {
- _goto.x = _goto.x * FIXED_INT_MULTIPLIER / 100;
- _goto.y = _goto.y * FIXED_INT_MULTIPLIER / 100;
- _teleportPos.x = _teleportPos.x * FIXED_INT_MULTIPLIER / 100;
- _teleportPos.y = _teleportPos.y * FIXED_INT_MULTIPLIER / 100;
+ _goto[0].x = s.readSint16LE();
+ _goto[0].y = s.readSint16LE();
+ _goto[0]._facing = s.readSint16LE();
+
+ if (isRoseTattoo) {
+ // Get Goto position and facing for second NPC
+ _goto[1].x = s.readSint16LE();
+ _goto[1].y = s.readSint16LE();
+ _goto[1]._facing = s.readSint16LE();
+ } else {
+ // For Serrated Scalpel, adjust the loaded co-ordinates
+ _goto[0].x = _goto[0].x * FIXED_INT_MULTIPLIER / 100;
+ _goto[0].y = _goto[0].y * FIXED_INT_MULTIPLIER / 100;
+
}
- _teleportDir = s.readSint16LE();
+ _teleport[0].x = s.readSint16LE();
+ _teleport[0].y = s.readSint16LE();
+ _teleport[0]._facing = s.readSint16LE();
+
+ if (isRoseTattoo) {
+ // Get Teleport position and facing for second NPC
+ _teleport[1].x = s.readSint16LE();
+ _teleport[1].y = s.readSint16LE();
+ _teleport[1]._facing = s.readSint16LE();
+ } else {
+ // For Serrated Scalpel, adjust the loaded co-ordinates
+ _teleport[0].x = _teleport[0].x * FIXED_INT_MULTIPLIER / 100;
+ _teleport[0].y = _teleport[0].y * FIXED_INT_MULTIPLIER / 100;
+ }
}
void CAnim::load3DO(Common::SeekableReadStream &s) {
@@ -1553,13 +1570,13 @@ void CAnim::load3DO(Common::SeekableReadStream &s) {
_type = (SpriteType)s.readUint16BE();
- _goto.x = s.readSint16BE();
- _goto.y = s.readSint16BE();
- _gotoDir = s.readSint16BE();
+ _goto[0].x = s.readSint16BE();
+ _goto[0].y = s.readSint16BE();
+ _goto[0]._facing = s.readSint16BE();
- _teleportPos.x = s.readSint16BE();
- _teleportPos.y = s.readSint16BE();
- _teleportDir = s.readSint16BE();
+ _teleport[0].x = s.readSint16BE();
+ _teleport[0].y = s.readSint16BE();
+ _teleport[0]._facing = s.readSint16BE();
char buffer[12];
s.read(buffer, 12);
@@ -1570,10 +1587,10 @@ void CAnim::load3DO(Common::SeekableReadStream &s) {
s.skip(3); // Filler
- _goto.x = _goto.x * FIXED_INT_MULTIPLIER / 100;
- _goto.y = _goto.y * FIXED_INT_MULTIPLIER / 100;
- _teleportPos.x = _teleportPos.x * FIXED_INT_MULTIPLIER / 100;
- _teleportPos.y = _teleportPos.y * FIXED_INT_MULTIPLIER / 100;
+ _goto[0].x = _goto[0].x * FIXED_INT_MULTIPLIER / 100;
+ _goto[0].y = _goto[0].y * FIXED_INT_MULTIPLIER / 100;
+ _teleport[0].x = _teleport[0].x * FIXED_INT_MULTIPLIER / 100;
+ _teleport[0].y = _teleport[0].y * FIXED_INT_MULTIPLIER / 100;
}
/*----------------------------------------------------------------*/
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index a22606bcb3..6035bb4ee6 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -433,15 +433,21 @@ public:
void setObjTalkSequence(int seq);
};
+
+class PositionFacing : public Point32 {
+public:
+ int _facing;
+
+ PositionFacing() : Point32(), _facing(0) {}
+};
+
struct CAnim {
Common::String _name; // Name
Common::Point _position; // Position
int _size; // Size of uncompressed animation
int _flags; // Tells if can be walked behind
- Point32 _goto; // coords holmes should walk to before starting canim
- int _gotoDir;
- Point32 _teleportPos; // Location Holmes shoul teleport to after
- int _teleportDir; // playing canim
+ PositionFacing _goto[2]; // Position Holmes (and NPC in Rose Tattoo) should walk to before anim starts
+ PositionFacing _teleport[2]; // Location Holmes (and NPC) shoul teleport to after playing canim
// Scalpel specific
byte _sequences[MAX_FRAME]; // Animation sequences
diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp
index 47ec639559..a1943e59a0 100644
--- a/engines/sherlock/scalpel/scalpel_scene.cpp
+++ b/engines/sherlock/scalpel/scalpel_scene.cpp
@@ -508,16 +508,16 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) {
CAnim &cAnim = _cAnim[cAnimNum];
if (playRate < 0) {
// Reverse direction
- walkPos = cAnim._teleportPos;
- walkDir = cAnim._teleportDir;
- tpPos = cAnim._goto;
- tpDir = cAnim._gotoDir;
+ walkPos = cAnim._teleport[0];
+ walkDir = cAnim._teleport[0]._facing;
+ tpPos = cAnim._goto[0];
+ tpDir = cAnim._goto[0]._facing;
} else {
// Forward direction
- walkPos = cAnim._goto;
- walkDir = cAnim._gotoDir;
- tpPos = cAnim._teleportPos;
- tpDir = cAnim._teleportDir;
+ walkPos = cAnim._goto[0];
+ walkDir = cAnim._goto[0]._facing;
+ tpPos = cAnim._teleport[0];
+ tpDir = cAnim._teleport[0]._facing;
}
CursorId oldCursor = events.getCursor();
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index 739eb5d1bb..dfe4d252cc 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.cpp
+++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp
@@ -2200,11 +2200,11 @@ void ScalpelUserInterface::checkAction(ActionType &action, const char *const mes
if (action._cAnimNum != 99) {
if (action._cAnimSpeed & REVERSE_DIRECTION) {
- pt = anim._teleportPos;
- dir = anim._teleportDir;
+ pt = anim._teleport[0];
+ dir = anim._teleport[0]._facing;
} else {
- pt = anim._goto;
- dir = anim._gotoDir;
+ pt = anim._goto[0];
+ dir = anim._goto[0]._facing;
}
}
} else {
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index a1039d9174..2e80f0789e 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -1070,13 +1070,13 @@ void Scene::transitionToScene() {
// Start any initial animation for the scene
if (cAnimNum != -1) {
CAnim &c = _cAnim[cAnimNum];
- Common::Point pt = c._goto;
+ PositionFacing pt = c._goto[0];
- c._goto = Common::Point(-1, -1);
+ c._goto[0].x = c._goto[0].y = -1;
people[PLAYER]._position = Common::Point(0, 0);
startCAnim(cAnimNum, 1);
- c._goto = pt;
+ c._goto[0] = pt;
}
}
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index 5127d1e93b..65d9d21919 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -1452,7 +1452,7 @@ OpcodeReturn Talk::cmdWalkToCAnimation(const byte *&str) {
++str;
CAnim &animation = scene._cAnim[str[0] - 1];
- people.walkToCoords(animation._goto, animation._gotoDir);
+ people.walkToCoords(animation._goto[0], animation._goto[0]._facing);
return _talkToAbort ? RET_EXIT : RET_SUCCESS;
}
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index 5ebf38b922..ce20f17730 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -820,7 +820,7 @@ void TattooScene::setNPCPath(int npc) {
return;
// Turn off all the NPCs, since the talk script will turn them back on as needed
- for (uint idx = 1; idx < MAX_CHARACTERS; ++idx)
+ for (int idx = 1; idx < MAX_CHARACTERS; ++idx)
people[idx]._type = INVALID;
// Call the path script for the scene