From 610644c4a1fd386d6fde2c4c52b5aa9c1bdacc48 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 27 Aug 2014 01:25:18 +0200 Subject: [PATCH] ACCESS: Implement tileScreen --- engines/access/amazon/amazon_game.cpp | 40 ++++++++++++++++++++++++++- engines/access/amazon/amazon_game.h | 5 ++++ engines/access/amazon/amazon_room.cpp | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index f7ed4146d855..608db5d5733e 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -44,15 +44,18 @@ AmazonEngine::AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc) _hitCount = 0; _saveRiver = 0; _hitSafe = 0; - _chapter = 0; + _oldTitleChap = _chapter = 0; _topList = 0; _botList = 0; _riverIndex = 0; _rawInactiveX = 0; _rawInactiveY = 0; _inactiveYOff = 0; + _tilePos = Common::Point(0, 0); Common::fill(&_esTabTable[0], &_esTabTable[100], 0); + memset(_tileData, 0, sizeof(_tileData)); + _hintLevel = 0; } @@ -270,6 +273,41 @@ void AmazonEngine::doEstablish(int esatabIndex, int sub) { _room->init4Quads(); } +const char *const _tileFiles[] = { + "GRAY.BLK", "RED.BLK", "LTBROWN.BLK", "DKBROWN.BLK", "VIOLET.BLK", "LITEBLUE.BLK", + "DARKBLUE.BLK", "CYAN.BLK", "GREEN.BLK", "OLIVE.BLK", "GRAY.BLK", "RED.BLK", + "LTBROWN.BLK", "DKBROWN.BLK", "VIOLET.BLK", "OLIVE.BLK" +}; + +void AmazonEngine::tileScreen(Common::String filename) { + if (!_screen->_vesaMode) + return; + + if (!_clearSummaryFlag && (_oldTitleChap == _chapter)) + return; + + _oldTitleChap = _chapter; + int idx = _chapter - 1; + + if (!_files->existFile(_tileFiles[idx])) + return; + + byte *data = _files->loadFile(_tileFiles[idx]); + int x = READ_LE_UINT16(data); + int y = READ_LE_UINT16(data + 2); + int size = ((x + 2) * y) + 10; + + for (int i = 0; i < size; ++i) + _tileData[i] = data[i + 4]; + + // CHECKME: Depending on the Vesa mode during initialization, 400 or 480 + for (_tilePos.y = 0; _tilePos.y < 480; _tilePos.y += y) { + for (_tilePos.x = 0; _tilePos.x < 640; _tilePos.x += x) + warning("TODO: DRAWOBJECT"); + } + +} + void AmazonEngine::drawHelp() { error("TODO: drawHelp"); } diff --git a/engines/access/amazon/amazon_game.h b/engines/access/amazon/amazon_game.h index 5c4c472fb766..5192e208d703 100644 --- a/engines/access/amazon/amazon_game.h +++ b/engines/access/amazon/amazon_game.h @@ -39,6 +39,7 @@ class AmazonEngine : public AccessEngine { int _hitCount; int _saveRiver; int _hitSafe; + int _oldTitleChap; int _chapter; int _topList; int _botList; @@ -47,6 +48,8 @@ class AmazonEngine : public AccessEngine { int _rawInactiveY; int _inactiveYOff; int _esTabTable[100]; + Common::Point _tilePos; + byte _tileData[1455]; /** * Do the game introduction @@ -108,6 +111,8 @@ class AmazonEngine : public AccessEngine { void drawHelp(); virtual void establish(int esatabIndex, int sub); + + void tileScreen(Common::String filename); }; } // End of namespace Amazon diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp index 3666de5e094e..f8c8bc45a811 100644 --- a/engines/access/amazon/amazon_room.cpp +++ b/engines/access/amazon/amazon_room.cpp @@ -180,7 +180,7 @@ void AmazonRoom::init4Quads() { if (!_vm->_screen->_vesaMode) return; - warning("TILESCREEN(TILE.BLK);"); + _game->tileScreen(Common::String("TILE.BLK")); _vm->_inventory->refreshInventory(); warning("TODO: UPDATESUMMARY(chapter)");