2014-08-01 16:20:24 -04:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-08-05 20:59:44 -04:00
|
|
|
#include "access/resources.h"
|
2014-08-05 23:23:49 -04:00
|
|
|
#include "access/amazon/amazon_game.h"
|
2014-08-06 08:55:56 -04:00
|
|
|
#include "access/amazon/amazon_resources.h"
|
2014-08-05 23:23:49 -04:00
|
|
|
#include "access/amazon/amazon_room.h"
|
|
|
|
#include "access/amazon/amazon_scripts.h"
|
2014-08-01 16:20:24 -04:00
|
|
|
|
|
|
|
namespace Access {
|
|
|
|
|
|
|
|
namespace Amazon {
|
|
|
|
|
|
|
|
AmazonEngine::AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc) :
|
|
|
|
AccessEngine(syst, gameDesc) {
|
2014-08-04 21:35:49 -04:00
|
|
|
_skipStart = false;
|
2014-08-05 20:04:41 -04:00
|
|
|
|
|
|
|
_canoeLane = 0;
|
|
|
|
_canoeYPos = 0;
|
|
|
|
_hitCount = 0;
|
|
|
|
_saveRiver = 0;
|
|
|
|
_hitSafe = 0;
|
|
|
|
_chapter = 0;
|
|
|
|
_topList = 0;
|
|
|
|
_botList = 0;
|
|
|
|
_riverIndex = 0;
|
|
|
|
_rawInactiveX = 0;
|
|
|
|
_rawInactiveY = 0;
|
|
|
|
_inactiveYOff = 0;
|
|
|
|
Common::fill(&_esTabTable[0], &_esTabTable[100], 0);
|
2014-08-01 16:20:24 -04:00
|
|
|
}
|
|
|
|
|
2014-08-04 09:21:39 -04:00
|
|
|
AmazonEngine::~AmazonEngine() {
|
|
|
|
}
|
|
|
|
|
2014-08-04 21:35:49 -04:00
|
|
|
void AmazonEngine::playGame() {
|
2014-08-05 23:23:49 -04:00
|
|
|
// Do introduction
|
2014-08-05 20:59:44 -04:00
|
|
|
doIntroduction();
|
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Setup the game
|
|
|
|
setupGame();
|
|
|
|
|
|
|
|
_screen->clearScreen();
|
|
|
|
_screen->setPanel(0);
|
|
|
|
_screen->forceFadeOut();
|
|
|
|
|
|
|
|
_events->showCursor();
|
2014-08-05 23:23:49 -04:00
|
|
|
|
|
|
|
// Setup and execute the room
|
|
|
|
_room = new AmazonRoom(this);
|
|
|
|
_scripts = new AmazonScripts(this);
|
2014-08-05 22:17:30 -04:00
|
|
|
_room->doRoom();
|
2014-08-05 20:59:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void AmazonEngine::doIntroduction() {
|
2014-08-04 21:35:49 -04:00
|
|
|
_screen->setInitialPalettte();
|
|
|
|
_events->setCursor(CURSOR_0);
|
|
|
|
_events->showCursor();
|
|
|
|
_screen->setPanel(0);
|
2014-08-05 20:59:44 -04:00
|
|
|
|
|
|
|
// TODO: Worry about implementing full intro sequence later
|
|
|
|
return;
|
|
|
|
|
2014-08-04 21:35:49 -04:00
|
|
|
doTitle();
|
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!_skipStart) {
|
|
|
|
_screen->setPanel(3);
|
|
|
|
doOpening();
|
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!_skipStart) {
|
|
|
|
doTent();
|
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
doTitle();
|
|
|
|
}
|
2014-08-04 09:21:39 -04:00
|
|
|
|
2014-08-02 10:07:54 -04:00
|
|
|
void AmazonEngine::doTitle() {
|
|
|
|
_screen->setDisplayScan();
|
2014-08-04 09:21:39 -04:00
|
|
|
_destIn = (byte *)_buffer2.getPixels();
|
|
|
|
|
2014-08-02 10:07:54 -04:00
|
|
|
_screen->forceFadeOut();
|
|
|
|
_events->hideCursor();
|
|
|
|
|
2014-08-04 09:21:39 -04:00
|
|
|
_sound->queueSound(0, 98, 30);
|
2014-08-02 17:09:28 -04:00
|
|
|
_sound->_soundPriority[0] = 1;
|
|
|
|
|
|
|
|
_screen->_loadPalFlag = false;
|
2014-08-04 09:21:39 -04:00
|
|
|
_files->loadScreen(0, 3);
|
|
|
|
|
|
|
|
_buffer2.copyFrom(*_screen);
|
|
|
|
_buffer1.copyFrom(*_screen);
|
|
|
|
_screen->forceFadeIn();
|
|
|
|
_sound->playSound(1);
|
|
|
|
|
2014-08-05 20:59:44 -04:00
|
|
|
_objectsTable[0] = _files->loadFile(0, 2);
|
2014-08-04 09:21:39 -04:00
|
|
|
_sound->playSound(1);
|
|
|
|
|
|
|
|
_screen->_loadPalFlag = false;
|
|
|
|
_files->loadScreen(0, 4);
|
|
|
|
_sound->playSound(1);
|
|
|
|
|
|
|
|
_buffer2.copyFrom(*_screen);
|
|
|
|
_buffer1.copyFrom(*_screen);
|
|
|
|
_sound->playSound(1);
|
|
|
|
|
|
|
|
const int COUNTDOWN[6] = { 2, 0x80, 1, 0x7d, 0, 0x87 };
|
|
|
|
for (int _pCount = 0; _pCount < 3; ++_pCount) {
|
|
|
|
_buffer2.copyFrom(_buffer1);
|
|
|
|
int id = READ_LE_UINT16(COUNTDOWN + _pCount * 4);
|
|
|
|
int xp = READ_LE_UINT16(COUNTDOWN + _pCount * 4 + 2);
|
2014-08-05 20:59:44 -04:00
|
|
|
_screen->plotImage(_objectsTable[0], id, Common::Point(xp, 71));
|
2014-08-04 09:21:39 -04:00
|
|
|
}
|
2014-08-04 21:35:49 -04:00
|
|
|
// TODO: More to do
|
|
|
|
}
|
|
|
|
|
|
|
|
void AmazonEngine::doOpening() {
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void AmazonEngine::doTent() {
|
|
|
|
// TODO
|
2014-08-02 10:07:54 -04:00
|
|
|
}
|
|
|
|
|
2014-08-05 20:59:44 -04:00
|
|
|
void AmazonEngine::setupGame() {
|
|
|
|
_chapter = 1;
|
|
|
|
clearCellTable();
|
|
|
|
|
|
|
|
// Setup timers
|
|
|
|
const int TIMER_DEFAULTS[] = { 3, 10, 8, 1, 1, 1, 1, 2 };
|
|
|
|
for (int i = 0; i < 32; ++i) {
|
|
|
|
TimerEntry te;
|
|
|
|
te._initTm = te._timer = (i < 8) ? TIMER_DEFAULTS[i] : 1;
|
|
|
|
te._flag = true;
|
|
|
|
|
|
|
|
_timers.push_back(te);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set miscellaneous fields
|
|
|
|
_roomNumber = 4;
|
2014-08-05 22:17:30 -04:00
|
|
|
_player->_playerX = _rawPlayerX = TRAVEL_POS[_roomNumber][0];
|
|
|
|
_player->_playerY = _rawPlayerY = TRAVEL_POS[_roomNumber][1];
|
2014-08-05 20:59:44 -04:00
|
|
|
_selectCommand = -1;
|
|
|
|
}
|
2014-08-04 22:38:50 -04:00
|
|
|
|
2014-08-01 16:20:24 -04:00
|
|
|
} // End of namespace Amazon
|
|
|
|
|
|
|
|
} // End of namespace Access
|