From 542014c309cb713ee5f550f344065fa9124f17bd Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 24 Feb 2012 04:44:26 +0000 Subject: 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. --- engines/dreamweb/dreamweb.cpp | 2 ++ engines/dreamweb/dreamweb.h | 5 ++++- engines/dreamweb/titles.cpp | 14 +++++++------- engines/dreamweb/vgagrafx.cpp | 3 ++- 4 files changed, 15 insertions(+), 9 deletions(-) (limited to 'engines') 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)) { -- cgit v1.2.3 From 31bf535a83682d6ad1616b8862119edbb95429c1 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 24 Feb 2012 05:19:29 +0000 Subject: DREAMWEB: Migrate loadTempText() to using datafile prefix variable. --- engines/dreamweb/dreamweb.h | 2 +- engines/dreamweb/keypad.cpp | 4 ++-- engines/dreamweb/people.cpp | 2 +- engines/dreamweb/stubs.cpp | 7 ++++--- engines/dreamweb/titles.cpp | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 1ea16c24ed..40ae05bd8a 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -813,7 +813,7 @@ public: void loadGraphicsSegment(GraphicsFile &file, Common::File &inFile, unsigned int len); void loadTextSegment(TextFile &file, Common::File &inFile, unsigned int len); void loadTravelText(); - void loadTempText(const char *fileName); + void loadTempText(const char *suffix); void sortOutMap(); void loadRoomData(const Room &room, bool skipDat); void useTempCharset(GraphicsFile *charset); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 172e85104f..16729275c1 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -398,7 +398,7 @@ void DreamWebEngine::loadFolder() { loadGraphicsFile(_folderGraphics2, "DREAMWEB.G10"); // folder graphics 2 loadGraphicsFile(_folderGraphics3, "DREAMWEB.G11"); // folder graphics 3 loadGraphicsFile(_folderCharset, "DREAMWEB.C02"); // character set 3 - loadTempText("DREAMWEB.T50"); // folder text + loadTempText("T50"); // folder text } void DreamWebEngine::showFolder() { @@ -717,7 +717,7 @@ void DreamWebEngine::updateSymbolBot() { void DreamWebEngine::useDiary() { getRidOfReels(); loadGraphicsFile(_diaryGraphics, "DREAMWEB.G14"); - loadTempText("DREAMWEB.T51"); + loadTempText("T51"); loadGraphicsFile(_diaryCharset, "DREAMWEB.C02"); createPanel(); showIcon(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 1b8ee1b4de..316a1689c9 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -178,7 +178,7 @@ void DreamWebEngine::madman(ReelRoutine &routine) { return; } if (newReelPointer == 10) { - loadTempText("DREAMWEB.T82"); + loadTempText("T82"); _vars._combatCount = (uint8)-1; _speechCount = 0; } diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 763bcb88fe..89c9aa8d38 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -2238,8 +2238,9 @@ void DreamWebEngine::loadTravelText() { loadTextFile(_travelText, "DREAMWEB.T81"); // location descs } -void DreamWebEngine::loadTempText(const char *fileName) { - loadTextFile(_textFile1, fileName); +void DreamWebEngine::loadTempText(const char *suffix) { + Common::String fileName = getDatafilePrefix() + suffix; + loadTextFile(_textFile1, fileName.c_str()); } void DreamWebEngine::drawFloor() { @@ -2789,7 +2790,7 @@ void DreamWebEngine::showGun() { fadeScreenUp(); hangOn(160); playChannel0(12, 0); - loadTempText("DREAMWEB.T83"); + loadTempText("T83"); rollEndCreditsGameLost(); getRidOfTempText(); } diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp index 0059b19605..146503dcdf 100644 --- a/engines/dreamweb/titles.cpp +++ b/engines/dreamweb/titles.cpp @@ -26,7 +26,7 @@ namespace DreamWeb { void DreamWebEngine::endGame() { - loadTempText("DREAMWEB.T83"); + loadTempText("T83"); monkSpeaking(); if (_quitRequested) return; @@ -141,7 +141,7 @@ void DreamWebEngine::hangOne(uint16 delay) { } void DreamWebEngine::intro() { - loadTempText("DREAMWEB.T82"); + loadTempText("T82"); loadPalFromIFF(); setMode(); _newLocation = 50; -- cgit v1.2.3 From e3c5f9180ce48a7a43d13baa4b91a17deb50782a Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 24 Feb 2012 05:29:01 +0000 Subject: DREAMWEB: Migrate loadSounds() to using datafile prefix variable. --- engines/dreamweb/dreamweb.h | 2 +- engines/dreamweb/sound.cpp | 7 ++++--- engines/dreamweb/stubs.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 40ae05bd8a..54646ba702 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -142,7 +142,7 @@ public: void quit(); - void loadSounds(uint bank, const Common::String &file); + void loadSounds(uint bank, const Common::String &suffix); bool loadSpeech(const Common::String &filename); void enableSavingOrLoading(bool enable = true) { _enableSavingOrLoading = enable; } diff --git a/engines/dreamweb/sound.cpp b/engines/dreamweb/sound.cpp index b79be28cea..b51527a8cd 100644 --- a/engines/dreamweb/sound.cpp +++ b/engines/dreamweb/sound.cpp @@ -89,7 +89,7 @@ void DreamWebEngine::loadRoomsSample() { return; // loaded already assert(sample < 100); - Common::String sampleName = Common::String::format("DREAMWEB.V%02d", sample); + Common::String sampleSuffix = Common::String::format("V%02d", sample); _currentSample = sample; uint8 ch0 = _channel0Playing; @@ -98,7 +98,7 @@ void DreamWebEngine::loadRoomsSample() { uint8 ch1 = _channel1Playing; if (ch1 >= 12) cancelCh1(); - loadSounds(1, sampleName.c_str()); + loadSounds(1, sampleSuffix.c_str()); } } // End of namespace DreamWeb @@ -240,7 +240,8 @@ void DreamWebEngine::soundHandler() { } -void DreamWebEngine::loadSounds(uint bank, const Common::String &filename) { +void DreamWebEngine::loadSounds(uint bank, const Common::String &suffix) { + Common::String filename = getDatafilePrefix() + suffix; debug(1, "loadSounds(%u, %s)", bank, filename.c_str()); Common::File file; if (!file.open(filename)) { diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 89c9aa8d38..caa5fc8f7f 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -579,7 +579,7 @@ void DreamWebEngine::dreamweb() { readSetData(); _wonGame = false; - loadSounds(0, "DREAMWEB.V99"); // basic sample + loadSounds(0, "V99"); // basic sample bool firstLoop = true; -- cgit v1.2.3 From bca22d4bee654a64fc1de9735dc45c1819e1d445 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 24 Feb 2012 05:46:00 +0000 Subject: DREAMWEB: Migrate loadGraphicsFile() to using datafile prefix variable. --- engines/dreamweb/dreamweb.h | 2 +- engines/dreamweb/keypad.cpp | 20 ++++++++++---------- engines/dreamweb/monitor.cpp | 4 ++-- engines/dreamweb/newplace.cpp | 8 ++++---- engines/dreamweb/saveload.cpp | 2 +- engines/dreamweb/stubs.cpp | 13 +++++++------ engines/dreamweb/titles.cpp | 2 +- 7 files changed, 26 insertions(+), 25 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 54646ba702..762d6387a6 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -809,7 +809,7 @@ public: uint8 findNextColon(const uint8 **string); void allocateBuffers(); void loadTextFile(TextFile &file, const char *fileName); - void loadGraphicsFile(GraphicsFile &file, const char *fileName); + void loadGraphicsFile(GraphicsFile &file, const char *suffix); void loadGraphicsSegment(GraphicsFile &file, Common::File &inFile, unsigned int len); void loadTextSegment(TextFile &file, Common::File &inFile, unsigned int len); void loadTravelText(); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 16729275c1..2ab5835997 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -108,7 +108,7 @@ bool DreamWebEngine::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 d } void DreamWebEngine::loadKeypad() { - loadGraphicsFile(_keypadGraphics, "DREAMWEB.G02"); + loadGraphicsFile(_keypadGraphics, "G02"); } void DreamWebEngine::quitKey() { @@ -293,8 +293,8 @@ void DreamWebEngine::showMenu() { } void DreamWebEngine::loadMenu() { - loadGraphicsFile(_menuGraphics, "DREAMWEB.S02"); // sprite name 3 - loadGraphicsFile(_menuGraphics2, "DREAMWEB.G07"); // mon. graphics 2 + loadGraphicsFile(_menuGraphics, "S02"); // sprite name 3 + loadGraphicsFile(_menuGraphics2, "G07"); // mon. graphics 2 } void DreamWebEngine::viewFolder() { @@ -394,10 +394,10 @@ void DreamWebEngine::checkFolderCoords() { } void DreamWebEngine::loadFolder() { - loadGraphicsFile(_folderGraphics, "DREAMWEB.G09"); // folder graphics 1 - loadGraphicsFile(_folderGraphics2, "DREAMWEB.G10"); // folder graphics 2 - loadGraphicsFile(_folderGraphics3, "DREAMWEB.G11"); // folder graphics 3 - loadGraphicsFile(_folderCharset, "DREAMWEB.C02"); // character set 3 + loadGraphicsFile(_folderGraphics, "G09"); // folder graphics 1 + loadGraphicsFile(_folderGraphics2, "G10"); // folder graphics 2 + loadGraphicsFile(_folderGraphics3, "G11"); // folder graphics 3 + loadGraphicsFile(_folderCharset, "C02"); // character set 3 loadTempText("T50"); // folder text } @@ -491,7 +491,7 @@ void DreamWebEngine::showRightPage() { void DreamWebEngine::enterSymbol() { _manIsOffScreen = 1; getRidOfReels(); - loadGraphicsFile(_symbolGraphics, "DREAMWEB.G12"); // symbol graphics + loadGraphicsFile(_symbolGraphics, "G12"); // symbol graphics _symbolTopX = 24; _symbolTopDir = 0; _symbolBotX = 24; @@ -716,9 +716,9 @@ void DreamWebEngine::updateSymbolBot() { void DreamWebEngine::useDiary() { getRidOfReels(); - loadGraphicsFile(_diaryGraphics, "DREAMWEB.G14"); + loadGraphicsFile(_diaryGraphics, "G14"); loadTempText("T51"); - loadGraphicsFile(_diaryCharset, "DREAMWEB.C02"); + loadGraphicsFile(_diaryCharset, "C02"); createPanel(); showIcon(); showDiary(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index f5f064f855..61c23cda0e 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -54,11 +54,11 @@ void DreamWebEngine::useMon() { showIcon(); drawFloor(); getRidOfAll(); - loadGraphicsFile(_monitorGraphics, "DREAMWEB.G03"); // mon. graphic name + loadGraphicsFile(_monitorGraphics, "G03"); // mon. graphic name loadPersonal(); loadNews(); loadCart(); - loadGraphicsFile(_monitorCharset, "DREAMWEB.C01"); // character set 2 + loadGraphicsFile(_monitorCharset, "C01"); // character set 2 printOuterMon(); initialMonCols(); printLogo(); diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index c484855da4..529c45bd4a 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -259,13 +259,13 @@ void DreamWebEngine::resetLocation(uint8 index) { } void DreamWebEngine::readDestIcon() { - loadGraphicsFile(_newplaceGraphics, "DREAMWEB.G05"); - loadGraphicsFile(_newplaceGraphics2, "DREAMWEB.G06"); - loadGraphicsFile(_newplaceGraphics3, "DREAMWEB.G08"); + loadGraphicsFile(_newplaceGraphics, "G05"); + loadGraphicsFile(_newplaceGraphics2, "G06"); + loadGraphicsFile(_newplaceGraphics3, "G08"); } void DreamWebEngine::readCityPic() { - loadGraphicsFile(_cityGraphics, "DREAMWEB.G04"); + loadGraphicsFile(_cityGraphics, "G04"); } } // End of namespace DreamWeb diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index acc76572ef..a526c8a3bc 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -708,7 +708,7 @@ void DreamWebEngine::showDecisions() { } void DreamWebEngine::loadSaveBox() { - loadGraphicsFile(_saveGraphics, "DREAMWEB.G08"); + loadGraphicsFile(_saveGraphics, "G08"); } // show savegame names (original interface), and set kCursorpos diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index caa5fc8f7f..e195ef3726 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -834,7 +834,8 @@ void DreamWebEngine::switchRyanOff() { _vars._ryanOn = 1; } -void DreamWebEngine::loadGraphicsFile(GraphicsFile &file, const char *fileName) { +void DreamWebEngine::loadGraphicsFile(GraphicsFile &file, const char *suffix) { + Common::String fileName = getDatafilePrefix() + suffix; FileHeader header; Common::File f; @@ -1991,10 +1992,10 @@ void DreamWebEngine::loadRoom() { } void DreamWebEngine::readSetData() { - loadGraphicsFile(_charset1, "DREAMWEB.C00"); - loadGraphicsFile(_icons1, "DREAMWEB.G00"); - loadGraphicsFile(_icons2, "DREAMWEB.G01"); - loadGraphicsFile(_mainSprites, "DREAMWEB.S00"); + loadGraphicsFile(_charset1, "C00"); + loadGraphicsFile(_icons1, "G00"); + loadGraphicsFile(_icons2, "G01"); + loadGraphicsFile(_mainSprites, "S00"); loadTextFile(_puzzleText, "DREAMWEB.T80"); loadTextFile(_commandText, "DREAMWEB.T84"); useCharset1(); @@ -2781,7 +2782,7 @@ void DreamWebEngine::showGun() { loadRoomsSample(); _volume = 0; GraphicsFile graphics; - loadGraphicsFile(graphics, "DREAMWEB.G13"); + loadGraphicsFile(graphics, "G13"); createPanel2(); showFrame(graphics, 100, 4, 0, 0); showFrame(graphics, 158, 106, 1, 0); diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp index 146503dcdf..f7486ce687 100644 --- a/engines/dreamweb/titles.cpp +++ b/engines/dreamweb/titles.cpp @@ -41,7 +41,7 @@ void DreamWebEngine::monkSpeaking() { _roomsSample = 35; loadRoomsSample(); GraphicsFile graphics; - loadGraphicsFile(graphics, "DREAMWEB.G15"); + loadGraphicsFile(graphics, "G15"); clearWork(); showFrame(graphics, 160, 72, 0, 128); // show monk workToScreen(); -- cgit v1.2.3 From a397748aceab258ccfe36cb6719bdbbda1dee730 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 24 Feb 2012 06:02:03 +0000 Subject: DREAMWEB: Migrate loadTextFile() to using datafile prefix variable. --- engines/dreamweb/dreamweb.h | 2 +- engines/dreamweb/monitor.cpp | 22 +++++++++++----------- engines/dreamweb/stubs.cpp | 13 ++++++------- 3 files changed, 18 insertions(+), 19 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 762d6387a6..e80b5538ad 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -808,7 +808,7 @@ public: const uint8 *getTextInFile1(uint16 index); uint8 findNextColon(const uint8 **string); void allocateBuffers(); - void loadTextFile(TextFile &file, const char *fileName); + void loadTextFile(TextFile &file, const char *suffix); void loadGraphicsFile(GraphicsFile &file, const char *suffix); void loadGraphicsSegment(GraphicsFile &file, Common::File &inFile, unsigned int len); void loadTextSegment(TextFile &file, Common::File &inFile, unsigned int len); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 61c23cda0e..cdef60e94d 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -383,21 +383,21 @@ void DreamWebEngine::printOuterMon() { void DreamWebEngine::loadPersonal() { if (_vars._location == 0 || _vars._location == 42) - loadTextFile(_textFile1, "DREAMWEB.T01"); // monitor file 1 + loadTextFile(_textFile1, "T01"); // monitor file 1 else - loadTextFile(_textFile1, "DREAMWEB.T02"); // monitor file 2 + loadTextFile(_textFile1, "T02"); // monitor file 2 } void DreamWebEngine::loadNews() { // textfile2 holds information accessible by anyone if (_vars._newsItem == 0) - loadTextFile(_textFile2, "DREAMWEB.T10"); // monitor file 10 + loadTextFile(_textFile2, "T10"); // monitor file 10 else if (_vars._newsItem == 1) - loadTextFile(_textFile2, "DREAMWEB.T11"); // monitor file 11 + loadTextFile(_textFile2, "T11"); // monitor file 11 else if (_vars._newsItem == 2) - loadTextFile(_textFile2, "DREAMWEB.T12"); // monitor file 12 + loadTextFile(_textFile2, "T12"); // monitor file 12 else - loadTextFile(_textFile2, "DREAMWEB.T13"); // monitor file 13 + loadTextFile(_textFile2, "T13"); // monitor file 13 } void DreamWebEngine::loadCart() { @@ -408,15 +408,15 @@ void DreamWebEngine::loadCart() { cartridgeId = getExAd(cartridgeIndex)->objId[3] + 1; if (cartridgeId == 0) - loadTextFile(_textFile3, "DREAMWEB.T20"); // monitor file 20 + loadTextFile(_textFile3, "T20"); // monitor file 20 else if (cartridgeId == 1) - loadTextFile(_textFile3, "DREAMWEB.T21"); // monitor file 21 + loadTextFile(_textFile3, "T21"); // monitor file 21 else if (cartridgeId == 2) - loadTextFile(_textFile3, "DREAMWEB.T22"); // monitor file 22 + loadTextFile(_textFile3, "T22"); // monitor file 22 else if (cartridgeId == 3) - loadTextFile(_textFile3, "DREAMWEB.T23"); // monitor file 23 + loadTextFile(_textFile3, "T23"); // monitor file 23 else - loadTextFile(_textFile3, "DREAMWEB.T24"); // monitor file 24 + loadTextFile(_textFile3, "T24"); // monitor file 24 } void DreamWebEngine::showKeys() { diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index e195ef3726..a542173e1d 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -728,8 +728,8 @@ void DreamWebEngine::dreamweb() { } } -void DreamWebEngine::loadTextFile(TextFile &file, const char *fileName) -{ +void DreamWebEngine::loadTextFile(TextFile &file, const char *suffix) { + Common::String fileName = getDatafilePrefix() + suffix; FileHeader header; Common::File f; @@ -1996,8 +1996,8 @@ void DreamWebEngine::readSetData() { loadGraphicsFile(_icons1, "G00"); loadGraphicsFile(_icons2, "G01"); loadGraphicsFile(_mainSprites, "S00"); - loadTextFile(_puzzleText, "DREAMWEB.T80"); - loadTextFile(_commandText, "DREAMWEB.T84"); + loadTextFile(_puzzleText, "T80"); + loadTextFile(_commandText, "T84"); useCharset1(); // FIXME: Why is this commented out? @@ -2236,12 +2236,11 @@ const uint8 *DreamWebEngine::getTextInFile1(uint16 index) { } void DreamWebEngine::loadTravelText() { - loadTextFile(_travelText, "DREAMWEB.T81"); // location descs + loadTextFile(_travelText, "T81"); // location descs } void DreamWebEngine::loadTempText(const char *suffix) { - Common::String fileName = getDatafilePrefix() + suffix; - loadTextFile(_textFile1, fileName.c_str()); + loadTextFile(_textFile1, suffix); } void DreamWebEngine::drawFloor() { -- cgit v1.2.3 From 966210b56dbe9a37ffde1fb0b46cc794ffed0562 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 24 Feb 2012 06:15:17 +0000 Subject: DREAMWEB: Migrate remaining minor functions to using datafile prefix variable. Currently, the usages associated with savegames have been omitted. These will probably need a different prefix constant as it is likely foreign variants still use "DREAMWEB.*" for savegames, while using a different prefix for the datafiles. We may even migrate away from this naming convention as this causes savegame collisions when multiple language variants are present, which could cause issues. The usages in the Room members of the constant g_roomData structure have also been omitted, as the members are copied into the savegame format, thus replacing these and fixing other accesses is not trivial. --- engines/dreamweb/stubs.cpp | 2 +- engines/dreamweb/vgagrafx.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index a542173e1d..8e63774317 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -2001,7 +2001,7 @@ void DreamWebEngine::readSetData() { useCharset1(); // FIXME: Why is this commented out? - //openFile("DREAMWEB.VOL"); + //openFile(getDatafilePrefix() + "VOL"); //uint8 *volumeTab = getSegment(data.word(kSoundbuffer)).ptr(16384, 0); //readFromFile(volumeTab, 2048-256); //closeFile(); diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index 61f3977710..be7d210999 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -409,7 +409,7 @@ bool DreamWebEngine::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) { void DreamWebEngine::loadPalFromIFF() { Common::File palFile; uint8* buf = new uint8[2000]; - palFile.open("DREAMWEB.PAL"); + palFile.open(getDatafilePrefix() + "PAL"); palFile.read(buf, 2000); palFile.close(); -- cgit v1.2.3