diff options
author | Strangerke | 2014-08-26 23:55:17 +0200 |
---|---|---|
committer | Strangerke | 2014-08-26 23:55:17 +0200 |
commit | 1568b4a433f8efc0b4e670d8e9714885aa8831c0 (patch) | |
tree | cc0028a720f5116a54639f37dd52f317ee19815d /engines | |
parent | a47b10c1c01d6ff332a11dfb61bef3e0bb8e2672 (diff) | |
download | scummvm-rg350-1568b4a433f8efc0b4e670d8e9714885aa8831c0.tar.gz scummvm-rg350-1568b4a433f8efc0b4e670d8e9714885aa8831c0.tar.bz2 scummvm-rg350-1568b4a433f8efc0b4e670d8e9714885aa8831c0.zip |
ACCESS: Move Establish functions to Amazon engine, start implementing init4Quads
Diffstat (limited to 'engines')
-rw-r--r-- | engines/access/access.cpp | 87 | ||||
-rw-r--r-- | engines/access/access.h | 14 | ||||
-rw-r--r-- | engines/access/amazon/amazon_game.cpp | 86 | ||||
-rw-r--r-- | engines/access/amazon/amazon_game.h | 6 | ||||
-rw-r--r-- | engines/access/amazon/amazon_room.cpp | 12 | ||||
-rw-r--r-- | engines/access/amazon/amazon_room.h | 3 | ||||
-rw-r--r-- | engines/access/martian/martian_game.h | 2 | ||||
-rw-r--r-- | engines/access/martian/martian_room.h | 5 | ||||
-rw-r--r-- | engines/access/room.cpp | 4 | ||||
-rw-r--r-- | engines/access/room.h | 2 | ||||
-rw-r--r-- | engines/access/screen.cpp | 6 | ||||
-rw-r--r-- | engines/access/screen.h | 2 |
12 files changed, 126 insertions, 103 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 361b8b3577..c19a37cdc3 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -225,44 +225,6 @@ void AccessEngine::freeInactiveData() { _inactive = nullptr; } -void AccessEngine::establish(int esatabIndex, int sub) { - _establishMode = 0; - _establishGroup = 0; - doEstablish(esatabIndex, sub); -} - -void AccessEngine::establishCenter(int esatabIndex, int sub) { - _establishMode = 1; - doEstablish(esatabIndex, sub); -} - -const char *const _estTable[] = { "ETEXT0.DAT", "ETEXT1.DAT", "ETEXT2.DAT", "ETEXT3.DAT" }; - -void AccessEngine::loadEstablish(int sub) { - if (!_files->existFile("ETEXT.DAT")) { - int oldGroup = _establishGroup; - _establishGroup = 0; - - _eseg = _files->loadFile(_estTable[oldGroup]); - } else { - _eseg = _files->loadFile("ETEXT.DAT"); - } - - _establishCtrlTblOfs = READ_LE_UINT16(_eseg); - - int ofs = _establishCtrlTblOfs + (sub * 2); - int idx = READ_LE_UINT16(_eseg + ofs); - _narateFile = READ_LE_UINT16(_eseg + idx); - _txtPages = READ_LE_UINT16(_eseg + idx + 2); - - if (!_txtPages) - return; - - _sndSubFile = READ_LE_UINT16(_eseg + idx + 4); - for (int i = 0; i < _txtPages; ++i) - _countTbl[i] = READ_LE_UINT16(_eseg + idx + 6 + (2 * i)); -} - void AccessEngine::speakText(ASurface *s, Common::Array<Common::String> msgArr) { int curPage = 0; int soundsLeft = 0; @@ -343,55 +305,6 @@ void AccessEngine::speakText(ASurface *s, Common::Array<Common::String> msgArr) } } -void AccessEngine::doEstablish(int esatabIndex, int sub) { - _establishMode = 1; - - _screen->forceFadeOut(); - _screen->clearScreen(); - _screen->setPanel(3); - - if (esatabIndex != -1) { - _files->loadScreen(95, esatabIndex); - _buffer2.copyBuffer(_screen); - } - - _screen->setIconPalette(); - _screen->forceFadeIn(); - - _fonts._charSet._lo = 1; - _fonts._charSet._hi = 10; - _fonts._charFor._lo = 29; - _fonts._charFor._hi = 32; - - _screen->_maxChars = 37; - _screen->_printOrg = _screen->_printStart = Common::Point(48, 35); - loadEstablish(sub); - _et = sub; - uint16 msgOffset = READ_LE_UINT16(_eseg + (sub * 2) + 2); - - _printEnd = 155; - if (_txtPages == 0) { - Common::String msg((const char *)_eseg + msgOffset); - _fonts._font2.printText(_screen, msg); - } else { - Common::Array<Common::String> msgArr; - for (int i = 0; i < _txtPages; ++i) { - Common::String msg((const char *)_eseg + msgOffset); - msgOffset += msg.size() + 1; - msgArr.push_back(msg); - } - speakText(_screen, msgArr); - } - - _screen->forceFadeOut(); - _screen->clearScreen(); - - free(_eseg); - if (_establishMode == 0) { - warning("TODO: init4Quads();"); - } -} - void AccessEngine::plotList() { _player->calcPlayer(); plotList1(); diff --git a/engines/access/access.h b/engines/access/access.h index fb73b1fb9b..f25effef06 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -91,10 +91,6 @@ private: void setVGA(); void dummyLoop(); - - void speakText(ASurface *s, Common::Array<Common::String>msgArr); - - void doEstablish(int esatabIndex, int sub); protected: const AccessGameDescription *_gameDescription; Common::RandomSource _randomSource; @@ -104,6 +100,8 @@ protected: */ void doRoom(); + void speakText(ASurface *s, Common::Array<Common::String>msgArr); + // Engine APIs virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; @@ -198,6 +196,8 @@ public: int _mapOffset; int _screenVirtX; + bool _clearSummaryFlag; + // Fields mapped into the flags array int &_useItem; int &_startup; @@ -229,11 +229,7 @@ public: */ void freeInactiveData(); - void AccessEngine::loadEstablish(int sub); - - void establish(int esatabIndex, int sub); - - void establishCenter(int esatabIndex, int sub); + virtual void establish(int esatabIndex, int sub) = 0; void plotList(); void plotList1(); diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index 286a7126bc..f7ed4146d8 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -184,6 +184,92 @@ void AmazonEngine::setupGame() { _player->_playerY = _player->_rawPlayer.y = TRAVEL_POS[_player->_roomNumber][1]; } +void AmazonEngine::establish(int esatabIndex, int sub) { + _establishMode = 0; + _establishGroup = 0; + doEstablish(esatabIndex, sub); +} + +void AmazonEngine::establishCenter(int esatabIndex, int sub) { + _establishMode = 1; + doEstablish(esatabIndex, sub); +} + +const char *const _estTable[] = { "ETEXT0.DAT", "ETEXT1.DAT", "ETEXT2.DAT", "ETEXT3.DAT" }; + +void AmazonEngine::loadEstablish(int sub) { + if (!_files->existFile("ETEXT.DAT")) { + int oldGroup = _establishGroup; + _establishGroup = 0; + + _eseg = _files->loadFile(_estTable[oldGroup]); + } else { + _eseg = _files->loadFile("ETEXT.DAT"); + } + + _establishCtrlTblOfs = READ_LE_UINT16(_eseg); + + int ofs = _establishCtrlTblOfs + (sub * 2); + int idx = READ_LE_UINT16(_eseg + ofs); + _narateFile = READ_LE_UINT16(_eseg + idx); + _txtPages = READ_LE_UINT16(_eseg + idx + 2); + + if (!_txtPages) + return; + + _sndSubFile = READ_LE_UINT16(_eseg + idx + 4); + for (int i = 0; i < _txtPages; ++i) + _countTbl[i] = READ_LE_UINT16(_eseg + idx + 6 + (2 * i)); +} + +void AmazonEngine::doEstablish(int esatabIndex, int sub) { + _establishMode = 1; + + _screen->forceFadeOut(); + _screen->clearScreen(); + _screen->setPanel(3); + + if (esatabIndex != -1) { + _files->loadScreen(95, esatabIndex); + _buffer2.copyBuffer(_screen); + } + + _screen->setIconPalette(); + _screen->forceFadeIn(); + + _fonts._charSet._lo = 1; + _fonts._charSet._hi = 10; + _fonts._charFor._lo = 29; + _fonts._charFor._hi = 32; + + _screen->_maxChars = 37; + _screen->_printOrg = _screen->_printStart = Common::Point(48, 35); + loadEstablish(sub); + _et = sub; + uint16 msgOffset = READ_LE_UINT16(_eseg + (sub * 2) + 2); + + _printEnd = 155; + if (_txtPages == 0) { + Common::String msg((const char *)_eseg + msgOffset); + _fonts._font2.printText(_screen, msg); + } else { + Common::Array<Common::String> msgArr; + for (int i = 0; i < _txtPages; ++i) { + Common::String msg((const char *)_eseg + msgOffset); + msgOffset += msg.size() + 1; + msgArr.push_back(msg); + } + speakText(_screen, msgArr); + } + + _screen->forceFadeOut(); + _screen->clearScreen(); + + free(_eseg); + if (_establishMode == 0) + _room->init4Quads(); +} + void AmazonEngine::drawHelp() { error("TODO: drawHelp"); } diff --git a/engines/access/amazon/amazon_game.h b/engines/access/amazon/amazon_game.h index c331830501..5c4c472fb7 100644 --- a/engines/access/amazon/amazon_game.h +++ b/engines/access/amazon/amazon_game.h @@ -73,6 +73,10 @@ private: */ void setupGame(); + void loadEstablish(int sub); + void doEstablish(int esatabIndex, int sub); + void establishCenter(int esatabIndex, int sub); + protected: /** * Play the game @@ -102,6 +106,8 @@ public: virtual ~AmazonEngine(); void drawHelp(); + + virtual void establish(int esatabIndex, int sub); }; } // End of namespace Amazon diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp index c0076fd78a..3666de5e09 100644 --- a/engines/access/amazon/amazon_room.cpp +++ b/engines/access/amazon/amazon_room.cpp @@ -176,6 +176,18 @@ void AmazonRoom::mainAreaClick() { } } +void AmazonRoom::init4Quads() { + if (!_vm->_screen->_vesaMode) + return; + + warning("TILESCREEN(TILE.BLK);"); + _vm->_inventory->refreshInventory(); + warning("TODO: UPDATESUMMARY(chapter)"); + + _vm->_screen->setPanel(0); + _vm->_screen->clearScreen(); +} + } // End of namespace Amazon } // End of namespace Access diff --git a/engines/access/amazon/amazon_room.h b/engines/access/amazon/amazon_room.h index c7d8e0c0ae..122eed991e 100644 --- a/engines/access/amazon/amazon_room.h +++ b/engines/access/amazon/amazon_room.h @@ -51,10 +51,13 @@ protected: virtual void roomMenu(); virtual void mainAreaClick(); + public: AmazonRoom(AccessEngine *vm); virtual ~AmazonRoom(); + + virtual void init4Quads(); }; } // End of namespace Amazon diff --git a/engines/access/martian/martian_game.h b/engines/access/martian/martian_game.h index 29fdd1b2ce..a99ece67cf 100644 --- a/engines/access/martian/martian_game.h +++ b/engines/access/martian/martian_game.h @@ -64,12 +64,12 @@ protected: */ virtual void playGame(); public: -public: MartianEngine(OSystem *syst, const AccessGameDescription *gameDesc); virtual ~MartianEngine(); void drawHelp(); + virtual void establish(int esatabIndex, int sub) {}; }; } // End of namespace Martian diff --git a/engines/access/martian/martian_room.h b/engines/access/martian/martian_room.h index 526de56240..14744f5311 100644 --- a/engines/access/martian/martian_room.h +++ b/engines/access/martian/martian_room.h @@ -53,6 +53,11 @@ public: MartianRoom(AccessEngine *vm); virtual ~MartianRoom(); + + virtual void loadRoomData(const byte *roomData) { warning("TODO - loadRoomData"); } + + virtual void init4Quads() { } + }; } // End of namespace Martian diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 29d9eef624..10146ff6c3 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -324,10 +324,6 @@ void Room::buildRow(int playY, int screenY) { error("TODO: buildRow"); } -void Room::init4Quads() { - error("TODO: init4Quads"); -} - void Room::loadPlayField(int fileNum, int subfile) { byte *playData = _vm->_files->loadFile(fileNum, subfile); Common::MemoryReadStream stream(playData + 0x10, _vm->_files->_filesize - 0x10); diff --git a/engines/access/room.h b/engines/access/room.h index 6cd3b8cad0..1d540840e3 100644 --- a/engines/access/room.h +++ b/engines/access/room.h @@ -155,7 +155,7 @@ public: */ void buildRow(int playY, int screenY); - void init4Quads(); + virtual void init4Quads() = 0; void setWallCodes(); diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp index 57002c0f7c..025172464a 100644 --- a/engines/access/screen.cpp +++ b/engines/access/screen.cpp @@ -58,6 +58,12 @@ Screen::Screen(AccessEngine *vm) : _vm(vm) { _clipHeight = _vWindowLinesTall - 1; } +void Screen::clearScreen() { + clearBuffer(); + if (_vesaMode) + _vm->_clearSummaryFlag = true; +} + void Screen::setDisplayScan() { _clipWidth = this->w - 1; _clipHeight = this->h - 1; diff --git a/engines/access/screen.h b/engines/access/screen.h index 3935f2c149..a166fded5e 100644 --- a/engines/access/screen.h +++ b/engines/access/screen.h @@ -107,7 +107,7 @@ public: void fadeOut() { forceFadeOut(); } void fadeIn() { forceFadeIn(); } - void clearScreen() { clearBuffer(); } + void clearScreen(); /** * Set the initial palette |