[Scummvm-cvs-logs] scummvm master -> 8ac4ab484c588ce37e551e94d691c83864f0fe02
dreammaster
dreammaster at scummvm.org
Sat Jun 13 02:02:22 CEST 2015
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:
8ac4ab484c SHERLOCK: Split up loadWalk into descendent classes
Commit: 8ac4ab484c588ce37e551e94d691c83864f0fe02
https://github.com/scummvm/scummvm/commit/8ac4ab484c588ce37e551e94d691c83864f0fe02
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-12T20:01:27-04:00
Commit Message:
SHERLOCK: Split up loadWalk into descendent classes
Changed paths:
engines/sherlock/people.cpp
engines/sherlock/people.h
engines/sherlock/scalpel/scalpel_people.cpp
engines/sherlock/scalpel/scalpel_people.h
engines/sherlock/tattoo/tattoo_people.cpp
engines/sherlock/tattoo/tattoo_people.h
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index de0e6ae..2945d37 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 27b7dc4..d9cb8de 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 e3cd1e5..b2aa4dc 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 eec6eeb..9d1214b 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 bea105f..f70b079 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 83821fa..110063d 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
More information about the Scummvm-git-logs
mailing list