aboutsummaryrefslogtreecommitdiff
path: root/engines/access/amazon
diff options
context:
space:
mode:
Diffstat (limited to 'engines/access/amazon')
-rw-r--r--engines/access/amazon/amazon_game.cpp86
-rw-r--r--engines/access/amazon/amazon_game.h6
-rw-r--r--engines/access/amazon/amazon_room.cpp12
-rw-r--r--engines/access/amazon/amazon_room.h3
4 files changed, 107 insertions, 0 deletions
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