aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter van Niftrik2017-02-27 22:12:46 +0100
committerWalter van Niftrik2017-03-05 21:16:58 +0100
commit19b07a7c125b40d42996e1c943131504649b97eb (patch)
tree9f5f79fdd5aa07f5dc619b553e418b4fe3162085
parentc88d30d8d3bbe02eca5b09ae9061ade3184d96ef (diff)
downloadscummvm-rg350-19b07a7c125b40d42996e1c943131504649b97eb.tar.gz
scummvm-rg350-19b07a7c125b40d42996e1c943131504649b97eb.tar.bz2
scummvm-rg350-19b07a7c125b40d42996e1c943131504649b97eb.zip
ADL: Move multi-disk handling into v2
-rw-r--r--engines/adl/adl_v2.cpp22
-rw-r--r--engines/adl/adl_v2.h3
-rw-r--r--engines/adl/adl_v4.cpp24
-rw-r--r--engines/adl/adl_v4.h3
4 files changed, 27 insertions, 25 deletions
diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp
index 23294391ab..dfc2df6ef4 100644
--- a/engines/adl/adl_v2.cpp
+++ b/engines/adl/adl_v2.cpp
@@ -26,6 +26,7 @@
#include "adl/adl_v2.h"
#include "adl/display.h"
#include "adl/graphics.h"
+#include "adl/detection.h"
namespace Adl {
@@ -38,6 +39,7 @@ AdlEngine_v2::AdlEngine_v2(OSystem *syst, const AdlGameDescription *gd) :
AdlEngine(syst, gd),
_maxLines(4),
_disk(nullptr),
+ _currentVolume(0),
_itemRemoved(false),
_roomOnScreen(0),
_picOnScreen(0),
@@ -45,6 +47,26 @@ AdlEngine_v2::AdlEngine_v2(OSystem *syst, const AdlGameDescription *gd) :
_random = new Common::RandomSource("adl");
}
+Common::String AdlEngine_v2::getDiskImageName(byte volume) const {
+ const ADGameFileDescription *ag;
+
+ for (ag = _gameDescription->desc.filesDescriptions; ag->fileName; ag++)
+ if (ag->fileType == volume)
+ return ag->fileName;
+
+ error("Disk volume %d not found", volume);
+}
+
+void AdlEngine_v2::insertDisk(byte volume) {
+ delete _disk;
+ _disk = new DiskImage();
+
+ if (!_disk->open(getDiskImageName(volume)))
+ error("Failed to open disk volume %d", volume);
+
+ _currentVolume = volume;
+}
+
typedef Common::Functor1Mem<ScriptEnv &, int, AdlEngine_v2> OpcodeV2;
#define SetOpcodeTable(x) table = &x;
#define Opcode(x) table->push_back(new OpcodeV2(this, &AdlEngine_v2::x))
diff --git a/engines/adl/adl_v2.h b/engines/adl/adl_v2.h
index 9d4d5fa600..889b03c90f 100644
--- a/engines/adl/adl_v2.h
+++ b/engines/adl/adl_v2.h
@@ -54,6 +54,8 @@ protected:
// Engine
bool canSaveGameStateCurrently();
+ Common::String getDiskImageName(byte volume) const;
+ void insertDisk(byte volume);
virtual DataBlockPtr readDataBlockPtr(Common::ReadStream &f) const;
virtual void adjustDataBlockPtr(byte &track, byte &sector, byte &offset, byte &size) const { }
void loadItems(Common::ReadStream &stream);
@@ -91,6 +93,7 @@ protected:
uint _maxLines;
DiskImage *_disk;
+ byte _currentVolume;
Common::Array<DataBlockPtr> _itemPics;
bool _itemRemoved;
byte _roomOnScreen, _picOnScreen, _itemsOnScreen;
diff --git a/engines/adl/adl_v4.cpp b/engines/adl/adl_v4.cpp
index e8ee798199..c06099b98d 100644
--- a/engines/adl/adl_v4.cpp
+++ b/engines/adl/adl_v4.cpp
@@ -20,15 +20,15 @@
*
*/
+#include "common/error.h"
+
#include "adl/adl_v4.h"
#include "adl/display.h"
-#include "adl/detection.h"
namespace Adl {
AdlEngine_v4::AdlEngine_v4(OSystem *syst, const AdlGameDescription *gd) :
AdlEngine_v3(syst, gd),
- _currentVolume(0),
_itemPicIndex(nullptr) {
}
@@ -190,26 +190,6 @@ Common::String AdlEngine_v4::getItemDescription(const Item &item) const {
return _itemDesc[item.id - 1];
}
-Common::String AdlEngine_v4::getDiskImageName(byte volume) const {
- const ADGameFileDescription *ag;
-
- for (ag = _gameDescription->desc.filesDescriptions; ag->fileName; ag++)
- if (ag->fileType == volume)
- return ag->fileName;
-
- error("Disk volume %d not found", volume);
-}
-
-void AdlEngine_v4::insertDisk(byte volume) {
- delete _disk;
- _disk = new DiskImage();
-
- if (!_disk->open(getDiskImageName(volume)))
- error("Failed to open disk volume %d", volume);
-
- _currentVolume = volume;
-}
-
void AdlEngine_v4::loadRegionLocations(Common::ReadStream &stream, uint regions) {
for (uint r = 0; r < regions; ++r) {
RegionLocation loc;
diff --git a/engines/adl/adl_v4.h b/engines/adl/adl_v4.h
index ca9aeff492..efb58b250b 100644
--- a/engines/adl/adl_v4.h
+++ b/engines/adl/adl_v4.h
@@ -71,8 +71,6 @@ protected:
kRegionChunkGlobalCmds
};
- Common::String getDiskImageName(byte volume) const;
- void insertDisk(byte volume);
void loadRegionLocations(Common::ReadStream &stream, uint regions);
void loadRegionInitDataOffsets(Common::ReadStream &stream, uint regions);
void initRegions(const byte *roomsPerRegion, uint regions);
@@ -98,7 +96,6 @@ protected:
int o4_setRegionRoom(ScriptEnv &e);
int o4_setRoomPic(ScriptEnv &e);
- byte _currentVolume;
Common::Array<RegionLocation> _regionLocations;
Common::Array<RegionInitDataOffset> _regionInitDataOffsets;
Common::SeekableReadStream *_itemPicIndex;