aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-06-12 20:01:27 -0400
committerPaul Gilbert2015-06-12 20:01:27 -0400
commit8ac4ab484c588ce37e551e94d691c83864f0fe02 (patch)
treeb21e509333b0723e6783fb2d381f4f0bdd25ef68
parented29691b2facecdfac934f90841f69e81c12e697 (diff)
downloadscummvm-rg350-8ac4ab484c588ce37e551e94d691c83864f0fe02.tar.gz
scummvm-rg350-8ac4ab484c588ce37e551e94d691c83864f0fe02.tar.bz2
scummvm-rg350-8ac4ab484c588ce37e551e94d691c83864f0fe02.zip
SHERLOCK: Split up loadWalk into descendent classes
-rw-r--r--engines/sherlock/people.cpp78
-rw-r--r--engines/sherlock/people.h11
-rw-r--r--engines/sherlock/scalpel/scalpel_people.cpp24
-rw-r--r--engines/sherlock/scalpel/scalpel_people.h5
-rw-r--r--engines/sherlock/tattoo/tattoo_people.cpp61
-rw-r--r--engines/sherlock/tattoo/tattoo_people.h5
6 files changed, 101 insertions, 83 deletions
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index de0e6ae116..2945d37a25 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -254,84 +254,6 @@ void People::reset() {
}
}
-bool People::loadWalk() {
- Resources &res = *_vm->_res;
- bool result = false;
-
- if (IS_SERRATED_SCALPEL) {
- if (_data[PLAYER]->_walkLoaded) {
- return false;
- } else {
- if (_vm->getPlatform() != Common::kPlatform3DO) {
- _data[PLAYER]->_images = new ImageFile("walk.vgs");
- } else {
- // Load walk.anim on 3DO, which is a cel animation file
- _data[PLAYER]->_images = new ImageFile3DO("walk.anim", kImageFile3DOType_CelAnimation);
- }
- _data[PLAYER]->setImageFrame();
- _data[PLAYER]->_walkLoaded = true;
-
- result = true;
- }
- } else {
- for (int idx = 0; idx < MAX_CHARACTERS; ++idx) {
- if (!_data[idx]->_walkLoaded && (_data[idx]->_type == CHARACTER || _data[idx]->_type == HIDDEN_CHARACTER)) {
- if (_data[idx]->_type == HIDDEN_CHARACTER)
- _data[idx]->_type = INVALID;
-
- // See if this is one of the more used Walk Graphics stored in WALK.LIB
- for (int libNum = 0; libNum < NUM_IN_WALK_LIB; ++libNum) {
- if (!_data[idx]->_walkVGSName.compareToIgnoreCase(WALK_LIB_NAMES[libNum])) {
- _useWalkLib = true;
- break;
- }
- }
-
- // Load the images for the character
- _data[idx]->_images = new ImageFile(_data[idx]->_walkVGSName, false);
- _data[idx]->_numFrames = _data[idx]->_images->size();
-
- // Load walk sequence data
- Common::String fname = Common::String(_data[idx]->_walkVGSName.c_str(), strchr(_data[idx]->_walkVGSName.c_str(), '.'));
- fname += ".SEQ";
-
- // Load the walk sequence data
- Common::SeekableReadStream *stream = res.load(fname, _useWalkLib ? "walk.lib" : "vgs.lib");
-
- _data[idx]->_walkSequences.resize(stream->readByte());
-
- for (uint seqNum = 0; seqNum < _data[idx]->_walkSequences.size(); ++seqNum)
- _data[idx]->_walkSequences[seqNum].load(*stream);
-
- // Close the sequences resource
- delete stream;
- _useWalkLib = false;
-
- _data[idx]->_frameNumber = 0;
- _data[idx]->setImageFrame();
-
- // Set the stop Frames pointers
- for (int dirNum = 0; dirNum < 8; ++dirNum) {
- int count = 0;
- while (_data[idx]->_walkSequences[dirNum + 8][count] != 0)
- ++count;
- count += 2;
- count = _data[idx]->_walkSequences[dirNum + 8][count] - 1;
- _data[idx]->_stopFrames[dirNum] = &(*_data[idx]->_images)[count];
- }
-
- result = true;
- _data[idx]->_walkLoaded = true;
- } else if (_data[idx]->_type != CHARACTER) {
- _data[idx]->_walkLoaded = false;
- }
- }
- }
-
- _forceWalkReload = false;
- return result;
-}
-
bool People::freeWalk() {
bool result = false;
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 27b7dc41cf..d9cb8de393 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -118,11 +118,6 @@ public:
void reset();
/**
- * Load the walking images for Sherlock
- */
- bool loadWalk();
-
- /**
* If the walk data has been loaded, then it will be freed
*/
bool freeWalk();
@@ -151,6 +146,12 @@ public:
* Change the sequence of the scene background object associated with the current speaker.
*/
virtual void setTalkSequence(int speaker, int sequenceNum = 1) = 0;
+
+ /**
+ * Load the walking images for Sherlock
+ */
+ virtual bool loadWalk() = 0;
+
};
} // End of namespace Sherlock
diff --git a/engines/sherlock/scalpel/scalpel_people.cpp b/engines/sherlock/scalpel/scalpel_people.cpp
index e3cd1e5a6c..b2aa4dcbb1 100644
--- a/engines/sherlock/scalpel/scalpel_people.cpp
+++ b/engines/sherlock/scalpel/scalpel_people.cpp
@@ -442,6 +442,30 @@ void ScalpelPeople::setTalkSequence(int speaker, int sequenceNum) {
}
}
+
+bool ScalpelPeople::loadWalk() {
+ Resources &res = *_vm->_res;
+ bool result = false;
+
+ if (_data[PLAYER]->_walkLoaded) {
+ return false;
+ } else {
+ if (_vm->getPlatform() != Common::kPlatform3DO) {
+ _data[PLAYER]->_images = new ImageFile("walk.vgs");
+ } else {
+ // Load walk.anim on 3DO, which is a cel animation file
+ _data[PLAYER]->_images = new ImageFile3DO("walk.anim", kImageFile3DOType_CelAnimation);
+ }
+ _data[PLAYER]->setImageFrame();
+ _data[PLAYER]->_walkLoaded = true;
+
+ result = true;
+ }
+
+ _forceWalkReload = false;
+ return result;
+}
+
} // End of namespace Scalpel
} // End of namespace Sherlock
diff --git a/engines/sherlock/scalpel/scalpel_people.h b/engines/sherlock/scalpel/scalpel_people.h
index eec6eeb3a3..9d1214bc68 100644
--- a/engines/sherlock/scalpel/scalpel_people.h
+++ b/engines/sherlock/scalpel/scalpel_people.h
@@ -85,6 +85,11 @@ public:
* Change the sequence of the scene background object associated with the specified speaker.
*/
virtual void setTalkSequence(int speaker, int sequenceNum = 1);
+
+ /**
+ * Load the walking images for Sherlock
+ */
+ virtual bool loadWalk();
};
} // End of namespace Scalpel
diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index bea105fee0..f70b079760 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -486,6 +486,67 @@ void TattooPeople::synchronize(Serializer &s) {
}
}
+bool TattooPeople::loadWalk() {
+ Resources &res = *_vm->_res;
+ bool result = false;
+
+ for (int idx = 0; idx < MAX_CHARACTERS; ++idx) {
+ if (!_data[idx]->_walkLoaded && (_data[idx]->_type == CHARACTER || _data[idx]->_type == HIDDEN_CHARACTER)) {
+ if (_data[idx]->_type == HIDDEN_CHARACTER)
+ _data[idx]->_type = INVALID;
+
+ // See if this is one of the more used Walk Graphics stored in WALK.LIB
+ for (int libNum = 0; libNum < NUM_IN_WALK_LIB; ++libNum) {
+ if (!_data[idx]->_walkVGSName.compareToIgnoreCase(WALK_LIB_NAMES[libNum])) {
+ _useWalkLib = true;
+ break;
+ }
+ }
+
+ // Load the images for the character
+ _data[idx]->_images = new ImageFile(_data[idx]->_walkVGSName, false);
+ _data[idx]->_numFrames = _data[idx]->_images->size();
+
+ // Load walk sequence data
+ Common::String fname = Common::String(_data[idx]->_walkVGSName.c_str(), strchr(_data[idx]->_walkVGSName.c_str(), '.'));
+ fname += ".SEQ";
+
+ // Load the walk sequence data
+ Common::SeekableReadStream *stream = res.load(fname, _useWalkLib ? "walk.lib" : "vgs.lib");
+
+ _data[idx]->_walkSequences.resize(stream->readByte());
+
+ for (uint seqNum = 0; seqNum < _data[idx]->_walkSequences.size(); ++seqNum)
+ _data[idx]->_walkSequences[seqNum].load(*stream);
+
+ // Close the sequences resource
+ delete stream;
+ _useWalkLib = false;
+
+ _data[idx]->_frameNumber = 0;
+ _data[idx]->setImageFrame();
+
+ // Set the stop Frames pointers
+ for (int dirNum = 0; dirNum < 8; ++dirNum) {
+ int count = 0;
+ while (_data[idx]->_walkSequences[dirNum + 8][count] != 0)
+ ++count;
+ count += 2;
+ count = _data[idx]->_walkSequences[dirNum + 8][count] - 1;
+ _data[idx]->_stopFrames[dirNum] = &(*_data[idx]->_images)[count];
+ }
+
+ result = true;
+ _data[idx]->_walkLoaded = true;
+ } else if (_data[idx]->_type != CHARACTER) {
+ _data[idx]->_walkLoaded = false;
+ }
+ }
+
+ _forceWalkReload = false;
+ return result;
+}
+
} // End of namespace Tattoo
} // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/tattoo_people.h b/engines/sherlock/tattoo/tattoo_people.h
index 83821fa6ca..110063dd15 100644
--- a/engines/sherlock/tattoo/tattoo_people.h
+++ b/engines/sherlock/tattoo/tattoo_people.h
@@ -153,6 +153,11 @@ public:
* Change the sequence of the scene background object associated with the specified speaker.
*/
virtual void setTalkSequence(int speaker, int sequenceNum = 1);
+
+ /**
+ * Load the walking images for Sherlock
+ */
+ virtual bool loadWalk();
};
} // End of namespace Scalpel