aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorPaul Gilbert2014-04-05 22:41:25 -0400
committerPaul Gilbert2014-04-05 22:41:25 -0400
commitff7d2e2dbf60202cc24b26b1ac61c0e76e802191 (patch)
treec54249ca263e20ec7e2221ef9b7e2bcfc9f73d45 /engines/mads
parent11403c5db6eac282e0e1f28623ac25ab95517792 (diff)
downloadscummvm-rg350-ff7d2e2dbf60202cc24b26b1ac61c0e76e802191.tar.gz
scummvm-rg350-ff7d2e2dbf60202cc24b26b1ac61c0e76e802191.tar.bz2
scummvm-rg350-ff7d2e2dbf60202cc24b26b1ac61c0e76e802191.zip
MADS: Add missing scene codes variant handling
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/nebular/nebular_scenes.cpp4
-rw-r--r--engines/mads/nebular/nebular_scenes.h2
-rw-r--r--engines/mads/nebular/nebular_scenes1.cpp6
-rw-r--r--engines/mads/nebular/nebular_scenes2.cpp4
-rw-r--r--engines/mads/scene.cpp10
-rw-r--r--engines/mads/scene.h7
-rw-r--r--engines/mads/scene_data.cpp4
-rw-r--r--engines/mads/scene_data.h16
8 files changed, 30 insertions, 23 deletions
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp
index 3a6e6a609f..0538f1b10e 100644
--- a/engines/mads/nebular/nebular_scenes.cpp
+++ b/engines/mads/nebular/nebular_scenes.cpp
@@ -90,10 +90,10 @@ Common::String NebularScene::formAnimName(char sepChar, int suffixNum) {
/*------------------------------------------------------------------------*/
-void SceneInfoNebular::loadCodes(MSurface &depthSurface) {
+void SceneInfoNebular::loadCodes(MSurface &depthSurface, int variant) {
File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT"));
MadsPack codesPack(&f);
- Common::SeekableReadStream *stream = codesPack.getItemStream(0);
+ Common::SeekableReadStream *stream = codesPack.getItemStream(variant + 1);
loadCodes(depthSurface, stream);
diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h
index 895ee51cfa..8e5bc05348 100644
--- a/engines/mads/nebular/nebular_scenes.h
+++ b/engines/mads/nebular/nebular_scenes.h
@@ -131,7 +131,7 @@ public:
class SceneInfoNebular : public SceneInfo {
friend class SceneInfo;
protected:
- virtual void loadCodes(MSurface &depthSurface);
+ virtual void loadCodes(MSurface &depthSurface, int variant);
virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream);
diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp
index f7a2a6031e..2a9b3c64ee 100644
--- a/engines/mads/nebular/nebular_scenes1.cpp
+++ b/engines/mads/nebular/nebular_scenes1.cpp
@@ -266,7 +266,7 @@ void Scene103::actions() {
} else if (_action.isAction(VERB_TAKE, 371) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) {
switch (_vm->_game->_trigger) {
case 0:
- _scene->changeDepthSurface(1);
+ _scene->changeVariant(1);
_globals._spriteIndexes[28] = _scene->_sequences.startReverseCycle(
_globals._spriteIndexes[13], false, 3, 2);
_scene->_sequences.setMsgLayout(_globals._spriteIndexes[28]);
@@ -284,7 +284,7 @@ void Scene103::actions() {
case 2:
_vm->_sound->command(22);
_game._objects.addToInventory(OBJ_TIMER_MODULE);
- _scene->changeDepthSurface(0);
+ _scene->changeVariant(0);
_scene->drawElements(kTransitionNone, false);
_scene->_hotspots.activate(371, false);
_vm->_game->_player._visible = true;
@@ -298,7 +298,7 @@ void Scene103::actions() {
} else if (_action.isAction(VERB_TAKE, 289, 0) && _game._objects.isInRoom(OBJ_REBREATHER)) {
switch (_vm->_game->_trigger) {
case 0:
- _scene->changeDepthSurface(1);
+ _scene->changeVariant(1);
_globals._spriteIndexes[27] = _scene->_sequences.startReverseCycle(
_globals._spriteIndexes[12], false, 3, 2);
_scene->_sequences.setMsgLayout(_globals._spriteIndexes[27]);
diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp
index 0bf5c21e59..9e4edc0bca 100644
--- a/engines/mads/nebular/nebular_scenes2.cpp
+++ b/engines/mads/nebular/nebular_scenes2.cpp
@@ -381,7 +381,7 @@ void Scene202::enter() {
}
if (_globals[kBone202Status])
- _scene->changeDepthSurface(_globals[kBone202Status]);
+ _scene->changeVariant(_globals[kBone202Status]);
if (_scene->_priorSceneId == 201) {
_game._player._playerPos = Common::Point(190, 91);
@@ -789,7 +789,7 @@ void Scene202::actions() {
_game._objects.addToInventory(OBJ_BONE);
_vm->_dialogs->showPicture(OBJ_BONE, 0x4EFA, 0);
}
- _scene->changeDepthSurface(_globals[kBone202Status]);
+ _scene->changeVariant(_globals[kBone202Status]);
_game._player._stepEnabled = true;
_game._player._visible = true;
} else {
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index 140077418b..9ef7d0b245 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -114,7 +114,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
_priorSceneId = _currentSceneId;
_currentSceneId = sceneId;
- _v1 = 0;
+ _variant = 0;
if (palFlag)
_vm->_palette->resetGamePalette(18, 10);
@@ -124,7 +124,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
// TODO: palletteUsage reset? setPalette(_nullPalette);
_sceneInfo = SceneInfo::init(_vm);
- _sceneInfo->load(_currentSceneId, _v1, Common::String(), _vm->_game->_v2 ? 17 : 16,
+ _sceneInfo->load(_currentSceneId, _variant, Common::String(), _vm->_game->_v2 ? 17 : 16,
_depthSurface, _backgroundSurface);
// Initialise palette animation for the scene
@@ -570,9 +570,9 @@ void Scene::free() {
_sceneInfo = nullptr;
}
-void Scene::changeDepthSurface(int arg1) {
- _v1 = arg1;
- _sceneInfo->loadCodes(_depthSurface, nullptr);
+void Scene::changeVariant(int variant) {
+ _variant = variant;
+ _sceneInfo->loadCodes(_depthSurface, variant);
_spriteSlots.fullRefresh();
}
diff --git a/engines/mads/scene.h b/engines/mads/scene.h
index 4e3829b838..dbb218842b 100644
--- a/engines/mads/scene.h
+++ b/engines/mads/scene.h
@@ -98,7 +98,7 @@ public:
int _textSpacing;
Hotspots _hotspots;
DirtyAreas _dirtyAreas;
- int _v1;
+ int _variant;
SceneInfo *_sceneInfo;
MSurface _backgroundSurface;
DepthSurface _depthSurface;
@@ -206,7 +206,10 @@ public:
*/
void free();
- void changeDepthSurface(int arg1);
+ /**
+ * Set the walk surface for a scene to a different variant
+ */
+ void changeVariant(int variant);
void resetScene();
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
index 4c19202f4b..f92ff86798 100644
--- a/engines/mads/scene_data.cpp
+++ b/engines/mads/scene_data.cpp
@@ -98,7 +98,7 @@ SceneInfo *SceneInfo::init(MADSEngine *vm) {
}
}
-void SceneInfo::load(int sceneId, int v1, const Common::String &resName,
+void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
int flags, MSurface &depthSurface, MSurface &bgSurface) {
bool sceneFlag = sceneId >= 0;
@@ -180,7 +180,7 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName,
}
// Load the depth surface with the scene codes
- Common::SeekableReadStream *depthStream = infoPack.getItemStream(1);
+ Common::SeekableReadStream *depthStream = infoPack.getItemStream(variant + 1);
loadCodes(depthSurface, depthStream);
delete depthStream;
diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h
index 81c24ed8ab..2a6032a507 100644
--- a/engines/mads/scene_data.h
+++ b/engines/mads/scene_data.h
@@ -137,11 +137,6 @@ protected:
* Constructor
*/
SceneInfo(MADSEngine *vm) : _vm(vm) {}
-
- /**
- * Loads the given surface with depth information of a given scene
- */
- virtual void loadCodes(MSurface &depthSurface) = 0;
public:
int _sceneId;
int _artFileNum;
@@ -173,11 +168,20 @@ public:
/**
loads the data
*/
- void load(int sceneId, int flags, const Common::String &resName, int v3,
+ void load(int sceneId, int variant, const Common::String &resName, int flags,
MSurface &depthSurface, MSurface &bgSurface);
/**
* Loads the given surface with depth information of a given scene
+ * @param depthSurface Depth/walk surface
+ * @param variant Variant number to load
+ */
+ virtual void loadCodes(MSurface &depthSurface, int variant) = 0;
+
+ /**
+ * Loads the given surface with depth information of a given scene
+ * @param depthSurface Depth/walk surface
+ * @param stream Stream to load the data from
*/
virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) = 0;
};