aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD G Turner2012-02-24 04:44:26 +0000
committerD G Turner2012-02-24 15:04:09 +0000
commit542014c309cb713ee5f550f344065fa9124f17bd (patch)
tree587c8f898f58477e8eb9dc73e843d1ec3cabd77b
parent14e6a5f8f7c7e3ac0d70ca4d59032954353fc823 (diff)
downloadscummvm-rg350-542014c309cb713ee5f550f344065fa9124f17bd.tar.gz
scummvm-rg350-542014c309cb713ee5f550f344065fa9124f17bd.tar.bz2
scummvm-rg350-542014c309cb713ee5f550f344065fa9124f17bd.zip
DREAMWEB: Add datafile name prefix to engine and modify showPCX() to it.
This new variable removes the need for duplicates strings of the form "DREAMWEB.*" spread throughout the dreamweb engine, replacing them with a common const string on the engine holding the datafile name prefix. This will reduce binary size and it should also simplify adding support for foreign language variants, where the datafile name prefix is changed. To demostrate usage and prove this, showPCX() is migrated to using this.
-rw-r--r--engines/dreamweb/dreamweb.cpp2
-rw-r--r--engines/dreamweb/dreamweb.h5
-rw-r--r--engines/dreamweb/titles.cpp14
-rw-r--r--engines/dreamweb/vgagrafx.cpp3
4 files changed, 15 insertions, 9 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 2ee20210ba..4ed6ef7c15 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -62,6 +62,8 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_channel0 = 0;
_channel1 = 0;
+ _datafilePrefix = Common::String("DREAMWEB.");
+
_openChangeSize = kInventx+(4*kItempicsize);
_quitRequested = false;
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 6d7253da65..1ea16c24ed 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -152,6 +152,8 @@ public:
void stopSound(uint8 channel);
+ const Common::String& getDatafilePrefix() { return _datafilePrefix; };
+
private:
void keyPressed(uint16 ascii);
void setSpeed(uint speed);
@@ -160,6 +162,7 @@ private:
const DreamWebGameDescription *_gameDescription;
Common::RandomSource _rnd;
+ Common::String _datafilePrefix;
uint _speed;
bool _turbo;
@@ -1133,7 +1136,7 @@ public:
void doShake();
void vSync();
void setMode();
- void showPCX(const Common::String &name);
+ void showPCX(const Common::String &suffix);
void showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, uint8 effectsFlag, uint8 width, uint8 height);
void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height);
void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag);
diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp
index f4112f71f6..0059b19605 100644
--- a/engines/dreamweb/titles.cpp
+++ b/engines/dreamweb/titles.cpp
@@ -104,7 +104,7 @@ void DreamWebEngine::gettingShot() {
void DreamWebEngine::bibleQuote() {
initGraphics(640, 480, true);
- showPCX("DREAMWEB.I00");
+ showPCX("I00");
fadeScreenUps();
hangOne(80);
@@ -292,7 +292,7 @@ void DreamWebEngine::realCredits() {
initGraphics(640, 480, true);
hangOn(35);
- showPCX("DREAMWEB.I01");
+ showPCX("I01");
playChannel0(12, 0);
hangOne(2);
@@ -318,7 +318,7 @@ void DreamWebEngine::realCredits() {
return; // "realcreditsearly"
}
- showPCX("DREAMWEB.I02");
+ showPCX("I02");
playChannel0(12, 0);
hangOne(2);
@@ -343,7 +343,7 @@ void DreamWebEngine::realCredits() {
return; // "realcreditsearly"
}
- showPCX("DREAMWEB.I03");
+ showPCX("I03");
playChannel0(12, 0);
hangOne(2);
@@ -368,7 +368,7 @@ void DreamWebEngine::realCredits() {
return; // "realcreditsearly"
}
- showPCX("DREAMWEB.I04");
+ showPCX("I04");
playChannel0(12, 0);
hangOne(2);
@@ -393,7 +393,7 @@ void DreamWebEngine::realCredits() {
return; // "realcreditsearly"
}
- showPCX("DREAMWEB.I05");
+ showPCX("I05");
playChannel0(12, 0);
hangOne(2);
@@ -418,7 +418,7 @@ void DreamWebEngine::realCredits() {
return; // "realcreditsearly"
}
- showPCX("DREAMWEB.I06");
+ showPCX("I06");
fadeScreenUps();
hangOne(60);
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index 26b5e60b9d..61f3977710 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -153,7 +153,8 @@ void DreamWebEngine::setMode() {
initGraphics(320, 200, false);
}
-void DreamWebEngine::showPCX(const Common::String &name) {
+void DreamWebEngine::showPCX(const Common::String &suffix) {
+ Common::String name = getDatafilePrefix() + suffix;
Common::File pcxFile;
if (!pcxFile.open(name)) {