Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,792 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "access/resources.h"
#include "access/amazon/amazon_game.h"
#include "access/amazon/amazon_resources.h"
#include "access/amazon/amazon_room.h"
#include "access/amazon/amazon_scripts.h"
namespace Access {
namespace Amazon {
AmazonEngine::AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc)
: AccessEngine(syst, gameDesc), _guardLocation(_flags[122]), _guardFind(_flags[128]),
_helpLevel(_flags[167]), _jasMayaFlag(_flags[168]), _moreHelp(_flags[169]),
_flashbackFlag(_flags[171]), _riverFlag(_flags[185]), _aniOutFlag(_flags[195]),
_badEnd(_flags[218]), _noHints(_flags[219]), _aniFlag(_flags[229]),
_allenFlag(_flags[237]), _noSound(_flags[239]) {
_ant = nullptr;
_cast = nullptr;
_guard = nullptr;
_jungle = nullptr;
_opening = nullptr;
_plane = nullptr;
_river = nullptr;
_charSegSwitch = false;
_oldTitleChapter = _chapter = 0;
_updateChapter = -1;
_rawInactiveX = 0;
_rawInactiveY = 0;
_inactiveYOff = 0;
_hintLevel = 0;
Common::fill(&_tileData[0], &_tileData[0] + sizeof(_tileData), 0);
Common::fill(&_help1[0], &_help1[0] + sizeof(_help1), 0);
Common::fill(&_help2[0], &_help2[0] + sizeof(_help2), 0);
Common::fill(&_help3[0], &_help3[0] + sizeof(_help3), 0);
_helpTbl[0] = _help1;
_helpTbl[1] = _help2;
_helpTbl[2] = _help3;
_chapter = 0;
_rawInactiveX = _rawInactiveY = 0;
_inactiveYOff = 0;
_hintLevel = 0;
_updateChapter = 0;
_oldTitleChapter = 0;
_iqValue = 0;
_chapterCells.push_back(CellIdent(0, 96, 17));
_inactive._spritesPtr = nullptr;
_inactive._flags = _inactive._frameNumber = _inactive._offsetY = 0;
_inactive._position = Common::Point(0, 0);
}
AmazonEngine::~AmazonEngine() {
delete _inactive._altSpritesPtr;
delete _ant;
delete _cast;
delete _guard;
delete _jungle;
delete _opening;
delete _plane;
delete _river;
}
void AmazonEngine::freeInactivePlayer() {
delete _inactive._altSpritesPtr;
_inactive._altSpritesPtr = nullptr;
}
void AmazonEngine::configSelect() {
// Initialize fields contained in the config file.
_hintLevel = 3;
}
void AmazonEngine::initObjects() {
_room = new AmazonRoom(this);
_scripts = new AmazonScripts(this);
_ant = new Ant(this);
_cast = new Cast(this);
_guard = new Guard(this);
_jungle = new Jungle(this);
_opening = new Opening(this);
_plane = new Plane(this);
_river = new River(this);
}
void AmazonEngine::playGame() {
// Initialize Amazon game-specific objects
initObjects();
// Setup the game
setupGame();
configSelect();
if (_loadSaveSlot == -1) {
// Do introduction
_opening->doIntroduction();
if (shouldQuit())
return;
}
do {
_restartFl = false;
_screen->clearScreen();
_screen->setPanel(0);
_screen->forceFadeOut();
_events->showCursor();
initVariables();
// If there's a pending savegame to load, load it
if (_loadSaveSlot != -1) {
loadGameState(_loadSaveSlot);
_loadSaveSlot = -1;
}
// Execute the room
_room->doRoom();
} while (_restartFl);
}
void AmazonEngine::setupGame() {
Amazon::AmazonResources &res = *((Amazon::AmazonResources *)_res);
// Load death list
_deaths.resize(_res->DEATHS.size());
for (uint idx = 0; idx < _deaths.size(); ++idx) {
_deaths[idx]._screenId = res.DEATHS[idx]._screenId;
_deaths[idx]._msg = res.DEATHS[idx]._msg;
}
// Load the deaths cells
_deaths._cells.resize(13);
for (int i = 0; i < 13; ++i)
_deaths._cells[i] = CellIdent(DEATH_CELLS[i][0], DEATH_CELLS[i][1], DEATH_CELLS[i][2]);
// Miscellaneous
_fonts.load(res._font6x6, res._font3x5, nullptr);
initVariables();
}
void AmazonEngine::initVariables() {
_chapter = 1;
// Set player room and position
if (isDemo())
_player->_roomNumber = 33;
else
_player->_roomNumber = 4;
_converseMode = 0;
_inventory->_startInvItem = 0;
_inventory->_startInvBox = 0;
Common::fill(&_objectsTable[0], &_objectsTable[100], (SpriteResource *)nullptr);
_player->_playerOff = false;
// Setup timers
static 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 = 1;
_timers.push_back(te);
}
_player->_playerX = _player->_rawPlayer.x = _res->ROOMTBL[_player->_roomNumber]._travelPos.x;
_player->_playerY = _player->_rawPlayer.y = _res->ROOMTBL[_player->_roomNumber]._travelPos.y;
_room->_selectCommand = -1;
_events->setNormalCursor(CURSOR_CROSSHAIRS);
_mouseMode = 0;
_animation->clearTimers();
}
void AmazonEngine::establish(int screenId, int esatabIndex) {
_establishMode = 0;
_establishGroup = 0;
doEstablish(screenId, esatabIndex);
}
void AmazonEngine::establishCenter(int screenId, int esatabIndex) {
_establishMode = 1;
doEstablish(screenId, esatabIndex);
}
static const char *const EST_TABLE[] = { "ETEXT0.DAT", "ETEXT1.DAT", "ETEXT2.DAT", "ETEXT3.DAT" };
void AmazonEngine::loadEstablish(int estabIndex) {
if (!_files->existFile("ETEXT.DAT")) {
int oldGroup = _establishGroup;
_establishGroup = 0;
_establish = _files->loadFile(EST_TABLE[oldGroup]);
_establishCtrlTblOfs = READ_LE_UINT16(_establish->data());
int ofs = _establishCtrlTblOfs + (estabIndex * 2);
int idx = READ_LE_UINT16(_establish->data() + ofs);
_narateFile = READ_LE_UINT16(_establish->data() + idx);
_txtPages = READ_LE_UINT16(_establish->data() + idx + 2);
if (!_txtPages)
return;
_sndSubFile = READ_LE_UINT16(_establish->data() + idx + 4);
for (int i = 0; i < _txtPages; ++i)
_countTbl[i] = READ_LE_UINT16(_establish->data() + idx + 6 + (2 * i));
} else {
_establishGroup = 0;
_narateFile = 0;
_txtPages = 0;
_sndSubFile = 0;
_establish = _files->loadFile("ETEXT.DAT");
}
}
void AmazonEngine::doEstablish(int screenId, int estabIndex) {
_establishMode = 1;
_events->clearEvents();
_screen->forceFadeOut();
_screen->clearScreen();
_screen->setPanel(3);
if (screenId != -1) {
_files->loadScreen(95, screenId);
_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(estabIndex);
uint16 msgOffset;
if (!isCD())
msgOffset = READ_LE_UINT16(_establish->data() + (estabIndex * 2));
else
msgOffset = READ_LE_UINT16(_establish->data() + (estabIndex * 2) + 2);
_printEnd = 155;
Common::String msg((const char *)_establish->data() + msgOffset);
if ((_txtPages == 0) || !isCD()) {
printText(_screen, msg);
} else {
speakText(_screen, msg);
}
_screen->forceFadeOut();
_screen->clearScreen();
delete _establish;
_establish = nullptr;
if (_establishMode == 0)
_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() {
if (!_screen->_vesaMode)
return;
if (!_clearSummaryFlag && (_oldTitleChapter == _chapter))
return;
_oldTitleChapter = _chapter;
int idx = _chapter - 1;
if (!_files->existFile(_tileFiles[idx]))
return;
Resource *res = _files->loadFile(_tileFiles[idx]);
int x = res->_stream->readSint16LE();
int y = res->_stream->readSint16LE();
int size = ((x + 2) * y) + 10;
for (int i = 0; i < size; ++i)
_tileData[i] = res->_stream->readByte();
// CHECKME: Depending on the Vesa mode during initialization, 400 or 480
Common::Point tilePos;
for (tilePos.y = 0; tilePos.y < 480; tilePos.y += y) {
for (tilePos.x = 0; tilePos.x < 640; tilePos.x += x)
warning("TODO: DRAWOBJECT");
}
delete res;
}
void AmazonEngine::updateSummary(int chap) {
if (!_screen->_vesaMode)
return;
int chapter = chap;
if (chapter > 16)
chapter = 16;
if (!_clearSummaryFlag && (chapter == _updateChapter))
return;
_clearSummaryFlag = false;
int celSubFile = 0;
_updateChapter = chapter;
Common::Array<CellIdent> summaryCells;
loadCells(summaryCells);
for (int i = celSubFile; i < 16; ++i) {
if (i > 7)
warning("TODO: DRAWOBJECT (i > 7)");
else
warning("TODO: DRAWOBJECT (i <= 7)");
}
delete _objectsTable[93];
_objectsTable[93] = nullptr;
for (int i = 1; i <= _updateChapter; ++i) {
celSubFile = i;
loadCells(summaryCells);
if (i > 8)
warning("TODO: DRAWOBJECT (i > 8)");
else
warning("TODO: DRAWOBJECT (i <= 8)");
delete _objectsTable[93];
_objectsTable[93] = nullptr;
}
}
void AmazonEngine::calcIQ() {
int tmpIQ = 170;
for (int i = 0; i < 256; i++) {
if (_help1[i] == 1)
tmpIQ -= 3;
}
for (int i = 0; i < 256; i++) {
if (_help2[i] == 1)
tmpIQ -= 5;
}
for (int i = 0; i < 256; i++) {
if (_help3[i] == 1)
tmpIQ -= 10;
}
if (tmpIQ < 0)
tmpIQ = 0;
_iqValue = tmpIQ;
if (_iqValue <= 100)
_badEnd = 1;
if (_iqValue <= 0)
_noHints = 1;
}
void AmazonEngine::helpTitle() {
AmazonResources &res = *(AmazonResources *)_res;
int width = _fonts._font2->stringWidth(_bubbleBox->_bubbleTitle);
int posX = 160 - (width / 2);
_fonts._font2->_fontColors[0] = 0;
_fonts._font2->_fontColors[1] = 33;
_fonts._font2->_fontColors[2] = 34;
_fonts._font2->_fontColors[3] = 35;
_fonts._font2->drawString(_screen, _bubbleBox->_bubbleTitle, Common::Point(posX, 24));
width = _fonts._font2->stringWidth(res.HELPLVLTXT[_helpLevel]);
posX = 160 - (width / 2);
_fonts._font2->_fontColors[0] = 0;
_fonts._font2->_fontColors[1] = 10;
_fonts._font2->_fontColors[2] = 11;
_fonts._font2->_fontColors[3] = 12;
_fonts._font2->drawString(_screen, res.HELPLVLTXT[_helpLevel], Common::Point(posX, 36));
Common::String iqText = "IQ: ";
calcIQ();
Common::String scoreIQ = Common::String::format("%d", _iqValue);
while (scoreIQ.size() < 4)
scoreIQ = " " + scoreIQ;
iqText += scoreIQ;
int index = _iqValue;
if (index == 170)
index = 169;
index /= 20;
iqText += " ";
iqText += res.IQLABELS[index];
width = _fonts._font2->stringWidth(iqText);
posX = 160 - (width / 2);
_fonts._font2->_fontColors[0] = 0;
_fonts._font2->_fontColors[1] = 10;
_fonts._font2->_fontColors[2] = 11;
_fonts._font2->_fontColors[3] = 12;
_fonts._font2->drawString(_screen, iqText, Common::Point(posX, 44));
}
void AmazonEngine::drawHelpText(const Common::String &msg) {
_screen->_maxChars = 39;
_screen->_printOrg = Common::Point(26, 58);
_screen->_printStart = Common::Point(26, 58);
Common::String lines = msg;
Common::String line;
int width = 0;
bool lastLine = false;
do {
lastLine = _fonts._font2->getLine(lines, _screen->_maxChars * 6, line, width);
// Set font colors
_fonts._font2->_fontColors[0] = 0;
_fonts._font2->_fontColors[1] = 27;
_fonts._font2->_fontColors[2] = 28;
_fonts._font2->_fontColors[3] = 29;
_fonts._font2->drawString(_screen, line, _screen->_printOrg);
_screen->_printOrg = Common::Point(_screen->_printStart.x, _screen->_printOrg.y + 8);
} while (!lastLine);
_events->showCursor();
}
void AmazonEngine::drawHelp(const Common::String &str) {
_events->hideCursor();
if (_useItem == 0) {
_buffer2.copyBuffer(_screen);
if (_screen->_vesaMode) {
_screen->setPanel(2);
_screen->saveScreen();
}
_screen->savePalette();
_screen->fadeOut();
_screen->clearBuffer();
if (_moreHelp == 1) {
// Set cells
Common::Array<CellIdent> cells;
cells.push_back(CellIdent(95, 95, 3));
loadCells(cells);
}
}
_files->loadScreen(95, 2);
if (_moreHelp == 1) {
BaseSurface *oldDest = _destIn;
_destIn = _screen;
int oldClip = _screen->_clipHeight;
_screen->_clipHeight = 200;
_screen->plotImage(_objectsTable[95], 0, Common::Point(76, 168));
_destIn = oldDest;
_screen->_clipHeight = oldClip;
}
if ((_useItem == 0) && (_screen->_vesaMode == 0))
_screen->fadeIn();
helpTitle();
drawHelpText(str);
}
void AmazonEngine::startChapter(int chapter) {
_chapter = chapter;
assert(_chapter <= 14);
if (chapter != 1) {
_room->clearRoom();
freeChar();
_midi->newMusic(32, 0);
playVideo(0, Common::Point());
if (shouldQuit())
return;
_events->debounceLeft();
_events->zeroKeysActions();
playVideo(_chapter, Common::Point(4, 113));
if (shouldQuit())
return;
_timers[20]._timer = 500;
_timers[20]._initTm = 500;
_timers[20]._flag++;
_sound->freeSounds();
if (isCD()) {
_sound->loadSoundTable(0, 115, 0);
_sound->loadSoundTable(1, 115, 1);
_sound->playSound(0);
_sound->playSound(1);
_sound->freeSounds();
}
// Wait loop
while (!shouldQuit() && !_events->isKeyActionMousePressed() && _timers[20]._flag) {
_events->pollEventsAndWait();
}
}
_screen->forceFadeOut();
_events->debounceLeft();
_events->zeroKeysActions();
_screen->clearScreen();
_screen->setPanel(3);
// Set up cells for the chapter display
Common::Array<CellIdent> chapterCells;
chapterCells.push_back(CellIdent(0, 96, 17));
const int *chapCell = &CHAPTER_CELLS[_chapter - 1][0];
chapterCells.push_back(CellIdent(chapCell[0], chapCell[1], chapCell[2]));
loadCells(chapterCells);
// Show chapter screen
_files->loadScreen(96, 15);
_buffer2.blitFrom(*_screen);
const int *chapImg = &CHAPTER_TABLE[_chapter - 1][0];
_screen->plotImage(_objectsTable[0], _chapter - 1,
Common::Point(chapImg[1], chapImg[2]));
_screen->plotImage(_objectsTable[_chapter], 0,
Common::Point(chapImg[3], chapImg[4]));
if (chapter == 14)
_screen->plotImage(_objectsTable[_chapter], 1, Common::Point(169, 76));
_midi->newMusic(chapImg[4], 1);
_midi->newMusic(33, 0);
_screen->forceFadeIn();
_timers[20]._timer = 950;
_timers[20]._initTm = 950;
_timers[20]._flag++;
// Wait loop
while (!shouldQuit() && !_events->isKeyActionMousePressed() && _timers[20]._flag) {
_events->pollEventsAndWait();
}
if (shouldQuit())
return;
_screen->forceFadeOut();
_events->debounceLeft();
_events->zeroKeysActions();
_screen->clearBuffer();
_files->loadScreen(96, 16);
_buffer2.blitFrom(*_screen);
_screen->plotImage(_objectsTable[0], chapImg[0], Common::Point(90, 7));
_midi->newMusic(7, 1);
_midi->newMusic(34, 0);
_screen->forceFadeIn();
_buffer2.blitFrom(*_screen);
_fonts._charSet._lo = 1;
_fonts._charSet._hi = 10;
_fonts._charFor._lo = 55;
_fonts._charFor._hi = 0xFF;
_screen->_maxChars = 43;
_screen->_printOrg = Common::Point(31, 77);
_screen->_printStart = Common::Point(31, 77);
_establishGroup = 1;
loadEstablish(0x40 + _chapter);
const byte *entryOffset = _establish->data() + ((0x40 + _chapter) * 2);
if (isCD())
entryOffset += 2;
uint16 msgOffset = READ_LE_UINT16(entryOffset);
_printEnd = 170;
Common::String msg((const char *)_establish->data() + msgOffset);
if ((_txtPages == 0) || !isCD()) {
printText(_screen, msg);
} else {
speakText(_screen, msg);
}
if (shouldQuit())
return;
_screen->forceFadeOut();
_screen->clearBuffer();
freeCells();
_midi->newMusic(_chapter * 2, 1);
if (chapter != 1 && chapter != 14) {
_room->init4Quads();
}
if (isCD()) {
if (chapter == 14) {
_conversation = 31;
_char->loadChar(_conversation);
_events->setCursor(CURSOR_ARROW);
_images.clear();
_oldRects.clear();
_scripts->_sequence = 0;
_scripts->searchForSequence();
if (_screen->_vesaMode) {
_converseMode = 1;
}
} else if (chapter != 1) {
_player->_roomNumber = CHAPTER_JUMP[_chapter - 1];
_room->_function = FN_CLEAR1;
_converseMode = 0;
_scripts->cmdRetPos();
}
}
delete _establish;
_establish = nullptr;
}
void AmazonEngine::dead(int deathId) {
_events->hideCursor();
_screen->forceFadeOut();
_scripts->cmdFreeSound();
_events->debounceLeft();
_events->zeroKeysActions();
_sound->_soundTable.push_back(SoundEntry(_files->loadFile(98, 44), 1));
_screen->clearScreen();
_screen->setPanel(3);
if ((deathId == 10) && !isDemo()) {
quitGame();
_events->pollEvents();
return;
} else {
if (!isDemo())
_midi->newMusic(62, 0);
_files->_setPaletteFlag = false;
_files->loadScreen(94, 0);
_files->_setPaletteFlag = true;
_buffer2.blitFrom(*_screen);
if (!isDemo() || deathId != 10) {
for (int i = 0; i < 3; ++i) {
_sound->playSound(0);
_screen->forceFadeIn();
_sound->playSound(0);
_screen->forceFadeOut();
_events->pollEvents();
if (shouldQuit())
return;
}
}
if (!isDemo()) {
freeCells();
// Load the cell list for the death screen
DeathEntry &de = _deaths[deathId];
Common::Array<CellIdent> cells;
cells.push_back(_deaths._cells[de._screenId]);
loadCells(cells);
_screen->setDisplayScan();
_files->_setPaletteFlag = false;
_files->loadScreen(&_buffer2, 94, 1);
_screen->setIconPalette();
_buffer2.plotImage(_objectsTable[0], 0, Common::Point(105, 25));
_buffer2.copyTo(_screen);
_screen->forceFadeIn();
_fonts._charSet._hi = 10;
_fonts._charSet._lo = 1;
_fonts._charFor._lo = 55;
_fonts._charFor._hi = 255;
_screen->_maxChars = 46;
_screen->_printOrg = Common::Point(20, 155);
_screen->_printStart = Common::Point(20, 155);
const Common::String &msg = de._msg;
_printEnd = 180;
printText(_screen, msg);
_screen->forceFadeOut();
_midi->newMusic(0, 1);
_events->showCursor();
_room->clearRoom();
freeChar();
_currentManOld = 1;
_player->removeSprite1();
} else {
_files->loadScreen(_screen, 94, _deaths[deathId]._screenId);
_screen->forceFadeIn();
_fonts._charSet._hi = 10;
_fonts._charSet._lo = 1;
_fonts._charFor._lo = 55;
_fonts._charFor._hi = 255;
_screen->_maxChars = 49;
_screen->_printOrg = Common::Point(15, 165);
_screen->_printStart = Common::Point(15, 165);
const Common::String &msg = _deaths[deathId]._msg;
_printEnd = 200;
printText(_screen, msg);
_screen->fadeOut();
_events->showCursor();
_room->clearRoom();
freeChar();
_currentManOld = 1;
_player->removeSprite1();
}
// The original was jumping to the restart label in main
_restartFl = true;
_events->pollEvents();
}
}
void AmazonEngine::synchronize(Common::Serializer &s) {
AccessEngine::synchronize(s);
s.syncAsSint16LE(_chapter);
s.syncAsSint16LE(_rawInactiveX);
s.syncAsSint16LE(_rawInactiveY);
s.syncAsSint16LE(_inactiveYOff);
for (int i = 0; i < 366; ++i) {
s.syncAsByte(_help1[i]);
s.syncAsByte(_help2[i]);
s.syncAsByte(_help3[i]);
}
_river->synchronize(s);
_ant->synchronize(s);
}
} // End of namespace Amazon
} // End of namespace Access

View File

@@ -0,0 +1,138 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACCESS_AMAZON_GAME_H
#define ACCESS_AMAZON_GAME_H
#include "access/access.h"
#include "access/amazon/amazon_logic.h"
namespace Access {
namespace Amazon {
class AmazonEngine;
class AmazonEngine : public AccessEngine {
private:
byte _tileData[1455];
Common::Array<CellIdent> _chapterCells;
/**
* Setup variables for the game
*/
void setupGame();
/**
* Initialize variables found in the config file
*/
void configSelect();
void initVariables();
void initObjects();
void calcIQ();
void helpTitle();
void drawHelpText(const Common::String &msg);
void loadEstablish(int estabIndex);
void doEstablish(int screenId, int estabIndex);
protected:
/**
* Play the game
*/
void playGame() override;
/**
* Synchronize savegame data
*/
void synchronize(Common::Serializer &s) override;
public:
InactivePlayer _inactive;
bool _charSegSwitch;
byte _help1[366];
byte _help2[366];
byte _help3[366];
byte *_helpTbl[3];
// Fields that are mapped to flags
int &_guardLocation;
int &_guardFind;
int &_helpLevel;
int &_jasMayaFlag;
int &_moreHelp;
int &_flashbackFlag;
int &_riverFlag;
int &_aniOutFlag;
int &_badEnd;
int &_noHints;
int &_aniFlag;
int &_allenFlag;
int &_noSound;
// Saved fields
int _chapter;
int _rawInactiveX;
int _rawInactiveY;
int _inactiveYOff;
// Other game specific fields
Ant *_ant;
Cast *_cast;
Guard *_guard;
Jungle *_jungle;
Opening *_opening;
Plane *_plane;
River *_river;
int _hintLevel;
int _updateChapter;
int _oldTitleChapter;
int _iqValue;
public:
AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc);
~AmazonEngine() override;
void dead(int deathId) override;
/**
* Free the inactive player data
*/
void freeInactivePlayer();
void drawHelp(const Common::String &str);
void establish(int esatabIndex, int sub) override;
void tileScreen();
void updateSummary(int chap);
void establishCenter(int screenId, int esatabIndex);
/**
* Show the start of a chapter
*/
void startChapter(int chapter);
};
} // End of namespace Amazon
} // End of namespace Access
#endif /* ACCESS_ACCESS_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,252 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACCESS_AMAZON_LOGIC_H
#define ACCESS_AMAZON_LOGIC_H
#include "common/scummsys.h"
#include "access/scripts.h"
#include "access/asurface.h"
#include "access/amazon/amazon_resources.h"
namespace Access {
namespace Amazon {
class AmazonEngine;
#define PAN_SIZE 32
class AmazonManager {
protected:
AmazonEngine *_vm;
public:
AmazonManager(AmazonEngine *vm) : _vm(vm) {}
};
class PannedScene : public AmazonManager {
struct PanEntry {
SpriteResource *_pObject;
int _pImgNum;
int _pObjX;
int _pObjY;
int _pObjZ;
int _pObjXl;
int _pObjYl;
};
protected:
int _xCount;
int _xTrack;
int _yTrack;
int _zTrack;
int _xCam;
int _yCam;
int _zCam;
int _pNumObj;
PanEntry _pan[PAN_SIZE];
public:
PannedScene(AmazonEngine *vm);
void pan();
};
class CampScene : public PannedScene {
protected:
bool _skipStart;
public:
CampScene(AmazonEngine *vm);
void mWhileDoOpen();
};
class Opening : public CampScene {
private:
int _pCount;
void doTitle();
void doCredit();
void doCreditDemo();
void scrollTitle();
void doTent();
public:
Opening(AmazonEngine *vm);
void doIntroduction();
};
class Plane : public PannedScene {
public:
int _pCount;
Common::Point _position;
int _planeCount;
int _propCount;
void doFlyCell();
void doFallCell();
void scrollFly();
void scrollFall();
void mWhileFly();
void mWhileFall();
public:
Plane(AmazonEngine *vm);
};
#define JUNGLE_SIZE 3
class Jungle : public CampScene {
private:
void initJWalk2();
void jungleMove();
void scrollJWalk();
int _jCnt[JUNGLE_SIZE];
int _jungleX[JUNGLE_SIZE];
public:
Jungle(AmazonEngine *vm);
void mWhileJWalk();
void mWhileJWalk2();
};
class Guard : public PannedScene {
private:
int _guardCel;
Common::Point _position;
int _gCode1;
int _gCode2;
Common::Point _topLeft;
Common::Point _bottomRight;
int _xMid, _yMid;
void chkVLine();
void chkHLine();
void setVerticalCode();
void setHorizontalCode();
void guardSee();
void setGuardFrame();
public:
Guard(AmazonEngine *vm);
void doGuard();
void setPosition(const Common::Point &pt);
};
class Cast : public PannedScene {
public:
Cast(AmazonEngine *vm);
void doCast(int param1);
};
class River : public PannedScene {
private:
bool _chickenOutFl;
const byte *_mapPtr;
int _canoeVXPos;
int _canoeMoveCount;
int _canoeFrame;
RiverStruct *_topList;
RiverStruct *_botList;
int _canoeDir;
bool _saveRiver;
bool _deathFlag;
int _deathCount;
int _deathType;
int _maxHits;
// Saved fields
int _canoeLane;
int _canoeYPos;
int _hitCount;
int _riverIndex;
int _hitSafe;
int _rScrollRow;
int _rScrollCol;
int _rScrollX;
int _rScrollY;
int _mapOffset;
int _screenVertX;
int _oldScrollCol;
void initRiver();
void resetPositions();
void checkRiverPan();
bool riverJumpTest();
void riverSound();
void moveCanoe();
void moveCanoe2();
void updateObstacles();
void riverSetPhysX();
bool checkRiverCollide();
void plotRiver();
void scrollRiver();
void scrollRiver1();
void setRiverPan();
public:
River(AmazonEngine *vm);
void doRiver();
void mWhileDownRiver();
void synchronize(Common::Serializer &s);
};
enum AntDirection { ANT_RIGHT = 0, ANT_LEFT = 1 };
class Ant : public AmazonManager {
private:
AntDirection _antDirection;
AntDirection _pitDirection;
int _antCel;
int _torchCel;
int _pitCel;
int _stabCel;
Common::Point _antPos;
bool _antDieFl;
bool _antEatFl;
bool _stabFl;
Common::Point _pitPos;
void plotTorchSpear(int indx, const int *&buf);
void plotPit(int indx, const int *&buf);
int antHandleRight(int indx, const int *&buf);
int antHandleLeft(int indx, const int *&buf);
int antHandleStab(int indx, const int *&buf);
public:
Ant(AmazonEngine *vm);
void doAnt();
void synchronize(Common::Serializer &s);
};
class InactivePlayer : public ImageEntry {
public:
SpriteResource *_altSpritesPtr;
InactivePlayer() { _altSpritesPtr = nullptr; }
};
} // End of namespace Amazon
} // End of namespace Access
#endif /* ACCESS_AMAZON_LOGIC_H */

View File

@@ -0,0 +1,101 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/scummsys.h"
#include "access/access.h"
#include "access/room.h"
#include "access/amazon/amazon_game.h"
#include "access/amazon/amazon_player.h"
#include "access/amazon/amazon_resources.h"
namespace Access {
namespace Amazon {
AmazonPlayer::AmazonPlayer(AccessEngine *vm) : Player(vm) {
_game = (AmazonEngine *)vm;
}
void AmazonPlayer::load() {
Player::load();
// Special scene setup for the top-down view when on the Slaver ship
if (_vm->_room->_roomFlag == 3) {
_playerOffset.x = _vm->_screen->_scaleTable1[8];
_playerOffset.y = _vm->_screen->_scaleTable1[11];
_leftDelta = 0;
_rightDelta = 8;
_upDelta = 2;
_downDelta = -2;
_scrollConst = 2;
for (uint8 i = 0; i < _vm->_playerDataCount; ++i) {
_walkOffRight[i] = OVEROFFR[i];
_walkOffLeft[i] = OVEROFFL[i];
_walkOffUp[i] = OVEROFFU[i];
_walkOffDown[i] = OVEROFFD[i];
_walkOffUR[i].x = OVEROFFURX[i];
_walkOffUR[i].y = OVEROFFURY[i];
_walkOffDR[i].x = OVEROFFDRX[i];
_walkOffDR[i].y = OVEROFFDRY[i];
_walkOffUL[i].x = OVEROFFULX[i];
_walkOffUL[i].y = OVEROFFULY[i];
_walkOffDL[i].x = OVEROFFDLX[i];
_walkOffDL[i].y = OVEROFFDLY[i];
}
_vm->_timers[8]._initTm = 7;
_vm->_timers[8]._timer = 7;
++_vm->_timers[8]._flag;
_sideWalkMin = 0;
_sideWalkMax = 5;
_upWalkMin = 12;
_upWalkMax = 17;
_downWalkMin = 6;
_downWalkMax = 11;
_diagUpWalkMin = 0;
_diagUpWalkMax = 5;
_diagDownWalkMin = 0;
_diagDownWalkMax = 5;
_game->_guard->setPosition(Common::Point(56, 190));
} else {
for (uint8 i = 0; i < _vm->_playerDataCount; ++i) {
_walkOffRight[i] = SIDEOFFR[i];
_walkOffLeft[i] = SIDEOFFL[i];
_walkOffUp[i] = SIDEOFFU[i];
_walkOffDown[i] = SIDEOFFD[i];
_walkOffUR[i].x = DIAGOFFURX[i];
_walkOffUR[i].y = DIAGOFFURY[i];
_walkOffDR[i].x = DIAGOFFDRX[i];
_walkOffDR[i].y = DIAGOFFDRY[i];
_walkOffUL[i].x = DIAGOFFULX[i];
_walkOffUL[i].y = DIAGOFFULY[i];
_walkOffDL[i].x = DIAGOFFDLX[i];
_walkOffDL[i].y = DIAGOFFDLY[i];
}
}
}
} // End of namespace Amazon
} // End of namespace Access

View File

@@ -0,0 +1,47 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACCESS_AMAZON_PLAYER_H
#define ACCESS_AMAZON_PLAYER_H
#include "common/scummsys.h"
#include "access/player.h"
namespace Access {
namespace Amazon {
class AmazonEngine;
class AmazonPlayer : public Player {
private:
AmazonEngine *_game;
public:
AmazonPlayer(AccessEngine *vm);
void load() override;
};
} // End of namespace Amazon
} // End of namespace Access
#endif /* ACCESS_AMAZON_PLAYER_H */

View File

@@ -0,0 +1,548 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "access/amazon/amazon_resources.h"
#include "access/access.h"
namespace Access {
namespace Amazon {
static const int BTN_RANGES[6][2] = {
{ 0, 76 }, { 77, 154 }, { 155, 232 }, { 233, 276 }, { 0, 0 }, { 277, 319 }
};
static const int RMOUSE[10][2] = {
{ 0, 35 }, { 0, 0 }, { 36, 70 }, { 71, 106 }, { 107, 141 },
{ 142, 177 }, { 178, 212 }, { 213, 248 }, { 249, 283 }, { 284, 318 }
};
AmazonResources::~AmazonResources() {
delete _font3x5;
delete _font6x6;
}
void AmazonResources::load(Common::SeekableReadStream &s) {
Resources::load(s);
uint count;
// Load the version specific data
NO_HELP_MESSAGE = s.readString();
NO_HINTS_MESSAGE = s.readString();
RIVER_HIT1 = s.readString();
RIVER_HIT2 = s.readString();
BAR_MESSAGE = s.readString();
for (int idx = 0; idx < 3; ++idx)
HELPLVLTXT[idx] = s.readString();
for (int idx = 0; idx < 9; ++idx)
IQLABELS[idx] = s.readString();
CANT_GET_THERE = s.readString();
// Get the offset of the general shared data for the game
uint entryOffset = findEntry(_vm->getGameID(), 2, 0, (Common::Language)0);
s.seek(entryOffset);
// Read in the cursor list
count = s.readUint16LE();
CURSORS.resize(count);
for (uint idx = 0; idx < count; ++idx) {
uint count2 = s.readUint16LE();
CURSORS[idx].resize(count2);
s.read(&CURSORS[idx][0], count2);
}
// Load font data
count = s.readUint16LE();
Common::Array<int> index;
Common::Array<byte> data;
index.resize(count);
for (uint idx = 0; idx < count; ++idx)
index[idx] = s.readSint16LE();
count = s.readUint16LE();
data.resize(count);
for (uint idx = 0; idx < count; ++idx)
data[idx] = s.readByte();
_font3x5 = new AmazonFont(&index[0], &data[0]);
count = s.readUint16LE();
index.resize(count);
for (uint idx = 0; idx < count; ++idx)
index[idx] = s.readSint16LE();
count = s.readUint16LE();
data.resize(count);
for (uint idx = 0; idx < count; ++idx)
data[idx] = s.readByte();
_font6x6 = new AmazonFont(&index[0], &data[0]);
}
const byte *AmazonResources::getCursor(int num) const {
return CURSORS[num].data();
}
int AmazonResources::getRMouse(int i, int j) const {
return RMOUSE[i][j];
}
int AmazonResources::inButtonXRange(int x) const {
for (int i = 0; i < ARRAYSIZE(BTN_RANGES); i++) {
if ((x >= BTN_RANGES[i][0]) && (x < BTN_RANGES[i][1]))
return i;
}
return -1;
}
/*------------------------------------------------------------------------*/
const int SIDEOFFR[] = { 5, 5, 5, 5, 5, 5, 5, 5, 0 };
const int SIDEOFFL[] = { 5, 5, 5, 5, 5, 5, 5, 5, 0 };
const int SIDEOFFU[] = { 2, 2, 2, 2, 2, 2, 2, 2, 0 };
const int SIDEOFFD[] = { 2, 2, 2, 2, 2, 2, 2, 2, 0 };
const int DIAGOFFURX[] = { 4, 5, 2, 2, 3, 4, 2, 2, 0 };
const int DIAGOFFURY[] = { 2, 3, 2, 2, 2, 3, 1, 1, 0 };
const int DIAGOFFDRX[] = { 4, 5, 4, 3, 5, 4, 5, 1, 0 };
const int DIAGOFFDRY[] = { 3, 2, 1, 2, 2, 1, 2, 1, 0 };
const int DIAGOFFULX[] = { 4, 5, 4, 3, 3, 2, 2, 2, 0 };
const int DIAGOFFULY[] = { 3, 3, 1, 2, 2, 1, 1, 1, 0 };
const int DIAGOFFDLX[] = { 4, 5, 3, 3, 5, 4, 6, 1, 0 };
const int DIAGOFFDLY[] = { 2, 2, 1, 2, 3, 1, 2, 1, 0 };
const int OVEROFFR[] = { 2, 2, 1, 2, 2, 1, 0, 0, 0 };
const int OVEROFFL[] = { 2, 2, 1, 2, 2, 1, 0, 0, 0 };
const int OVEROFFU[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0 };
const int OVEROFFD[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0 };
const int OVEROFFURX[] = { 3, 1, 1, 2, 2, 1, 0, 0, 0 };
const int OVEROFFURY[] = { 1, 0, 0, 1, 1, 0, 0, 0, 0 };
const int OVEROFFDRX[] = { 1, 2, 1, 1, 2, 1, 0, 0, 0 };
const int OVEROFFDRY[] = { 0, 1, 0, 0, 1, 1, 0, 0, 0 };
const int OVEROFFULX[] = { 2, 1, 1, 1, 2, 1, 0, 0, 0 };
const int OVEROFFULY[] = { 1, 0, 0, 2, 1, 0, 0, 0, 0 };
const int OVEROFFDLX[] = { 1, 2, 1, 1, 2, 1, 0, 0, 0 };
const int OVEROFFDLY[] = { 0, 1, 0, 0, 1, 1, 0, 0, 0 };
const int DEATH_CELLS[13][3] = {
{ 0, 94, 2 },
{ 0, 94, 3 },
{ 0, 94, 4 },
{ 0, 94, 5 },
{ 0, 94, 6 },
{ 0, 94, 7 },
{ 0, 94, 8 },
{ 0, 94, 9 },
{ 0, 94, 10 },
{ 0, 94, 11 },
{ 0, 94, 12 },
{ 0, 94, 13 },
{ 0, 94, 14 }
};
const int CHAPTER_CELLS[17][3] = {
{ 1, 96, 18 },
{ 2, 96, 19 },
{ 3, 96, 20 },
{ 4, 96, 21 },
{ 5, 96, 22 },
{ 6, 96, 23 },
{ 7, 96, 24 },
{ 8, 96, 25 },
{ 9, 96, 26 },
{ 10, 96, 27 },
{ 11, 96, 28 },
{ 12, 96, 29 },
{ 13, 96, 30 },
{ 14, 96, 31 }
};
const int CHAPTER_TABLE[14][5] = {
{ 18, 136, 27, 76, 49 },
{ 16, 134, 27, 53, 74 },
{ 16, 136, 27, 52, 56 },
{ 16, 135, 26, 46, 75 },
{ 16, 135, 27, 54, 66 },
{ 16, 137, 27, 67, 79 },
{ 14, 136, 27, 82, 52 },
{ 15, 136, 26, 65, 73 },
{ 15, 137, 26, 48, 75 },
{ 17, 135, 27, 52, 66 },
{ 15, 135, 27, 62, 65 },
{ 16, 135, 28, 45, 66 },
{ 16, 135, 28, 36, 67 },
{ 15, 135, 27, 34, 63 }
};
const int CHAPTER_JUMP[14] = {
0, 12, 10, 15, 19, 25, 31, 36, 45, 46, 29, 55, 61, 0
};
const int ANTWALK[24] = {
0, 3, 0,
1, 5, 0,
2, 4, 0,
3, 2, 0,
4, 4, 0,
5, 3, 0,
6, 4, 0,
-1, -1, -1
};
const int ANTEAT[33] = {
7, 0, -1,
8, 0, -5,
9, 0, -11,
10, 0, 7,
11, 0, -3,
12, 0, 3,
13, 0, -1,
9, 0, -6,
8, 0, 11,
7, 0, 6,
-1, -1, -1
};
const int ANTDIE[21] = {
14, 4, 8,
15, 7, 6,
16, 6, 7,
17, 8, 2,
18, 0, 0,
19, 0, 0,
-1, -1, -1
};
const int PITWALK[27] = {
18, 0, -1,
19, -2, 1,
20, -2, 1,
21, -2, 1,
22, -2, 0,
23, -3, 0,
24, -3, -1,
25, -2, -1,
-1, -1, -1
};
const int PITSTAB[21] = {
14, -2, 0,
15, -4, 0,
16, 3, -13,
16, 0, 0,
15, -3, 13,
14, 4, 0,
-1, -1, -1
};
const int TORCH[12] = {
26, -11, -7,
27, -12, -2,
28, -15, -4,
-1, -1, -1
};
const int SPEAR[3] = {30, -13, 1};
const int OPENING_OBJS[10][4] = {
{8, -80, 120, 30},
{13, 229, 0, 50},
{12, 78, 0, 50},
{11, 10, 0, 50},
{10, 178, 97, 50},
{9, 92, 192, 50},
{14, 38, 0, 100},
{15, 132, 76, 100},
{16, 142, 0, 100},
{4, -280, 40, 120},
};
const byte MAP0[26] = {
0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 4, 0,
0, 0, 1, 0, 2, 0, 0, 1, 1, 3, 0, 0,
0, 0xFF
};
const byte MAP1[27] = {
0, 0, 1, 0, 3, 0, 0, 1, 1, 2, 0, 0,
0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 4, 0,
0, 0, 0xFF
};
const byte MAP2[32] = {
0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 1, 0,
3, 0, 0, 1, 0, 4, 0, 0, 1, 1, 2, 0,
0, 1, 0, 1, 0, 0, 0, 0xFF
};
const byte *const MAPTBL[3] = {MAP0, MAP1, MAP2};
const int DOWNRIVEROBJ[14][4] = {
{ 3, 77, 0, 40 },
{ 2, 30, 0, 30 },
{ 2, 290, 0, 50 },
{ 1, 210, 0, 70 },
{ 2, 350, 0, 30 },
{ 1, 370, 0, 20 },
{ 2, 480, 0, 60 },
{ 3, 395, 0, 10 },
{ 1, 550, 0, 30 },
{ 2, 620, 0, 50 },
{ 1, 690, 0, 10 },
{ 2, 715, 0, 40 },
{ 1, 770, 0, 30 },
{ 3, 700, 0, 20 }
};
RiverStruct RIVER0OBJECTS[46] = {
{16, 31, 6400, 0, 4, 12},
{16, 31, 6200, 0, 2, 12},
{17, 30, 6100, 0, 3, 15},
{16, 31, 5970, 0, 7, 12},
{17, 30, 5910, 0, 5, 15},
{17, 30, 5730, 0, 3, 15},
{16, 31, 5700, 0, 7, 12},
{-1, 314, 5392, 0, 4, 0},
{17, 30, 5155, 0, 1, 15},
{16, 31, 5150, 0, 5, 12},
{16, 31, 5056, 0, 7, 12},
{17, 30, 4900, 0, 2, 15},
{17, 30, 4785, 0, 7, 15},
{16, 31, 4690, 0, 4, 12},
{16, 31, 4660, 0, 1, 12},
{17, 30, 4560, 0, 5, 15},
{16, 31, 4465, 0, 2, 12},
{-1, 314, 4112, 0, 4, 0},
{17, 30, 4005, 0, 3, 15},
{16, 31, 3865, 0, 6, 12},
{17, 30, 3605, 0, 4, 15},
{16, 31, 3360, 0, 1, 12},
{17, 30, 3105, 0, 0, 15},
{16, 31, 3080, 0, 7, 12},
{17, 30, 3014, 0, 4, 15},
{16, 31, 2992, 0, 3, 12},
{16, 31, 2976, 0, 2, 12},
{17, 30, 2880, 0, 7, 15},
{17, 30, 2860, 0, 0, 15},
{-1, 314, 2512, 0, 4, 0},
{17, 30, 2270, 0, 4, 15},
{16, 31, 2195, 0, 6, 12},
{17, 30, 1824, 0, 1, 15},
{16, 31, 1776, 0, 4, 12},
{17, 30, 1650, 0, 3, 15},
{16, 31, 1616, 0, 7, 12},
{17, 30, 1585, 0, 2, 15},
{-1, 314, 1232, 0, 4, 0},
{17, 30, 1190, 0, 2, 15},
{16, 31, 1120, 0, 4, 12},
{17, 30, 970, 0, 7, 15},
{16, 31, 910, 0, 5, 12},
{17, 30, 705, 0, 0, 15},
{16, 31, 550, 0, 4, 12},
{17, 30, 305, 0, 2, 15},
{16, 31, 260, 0, 7, 12}
};
RiverStruct RIVER1OBJECTS[50] = {
{16, 31, 6920, 0, 1, 12},
{16, 31, 6740, 0, 4, 12},
{17, 30, 6699, 0, 1, 15},
{16, 31, 6610, 0, 2, 12},
{17, 30, 6495, 0, 6, 15},
{17, 30, 6385, 0, 4, 15},
{16, 31, 6350, 0, 1, 12},
{17, 30, 6180, 0, 0, 15},
{-1, 314, 6032, 0, 4, 0},
{16, 31, 5800, 0, 3, 12},
{17, 30, 5790, 0, 6, 15},
{16, 31, 5530, 0, 4, 12},
{16, 31, 5500, 0, 7, 12},
{17, 30, 5495, 0, 1, 15},
{17, 30, 5376, 0, 0, 15},
{16, 31, 5328, 0, 7, 12},
{17, 30, 5248, 0, 2, 15},
{16, 31, 5248, 0, 6, 12},
{-1, 314, 4752, 0, 4, 0},
{17, 30, 4432, 0, 2, 15},
{16, 31, 4432, 0, 7, 12},
{16, 31, 4384, 0, 2, 12},
{17, 30, 4368, 0, 5, 15},
{16, 31, 4336, 0, 4, 12},
{17, 30, 4185, 0, 1, 15},
{16, 31, 4125, 0, 3, 12},
{17, 30, 3817, 0, 7, 15},
{16, 31, 3612, 0, 4, 12},
{16, 31, 3360, 0, 5, 12},
{16, 31, 3265, 0, 7, 12},
{17, 30, 3200, 0, 1, 15},
{17, 30, 3056, 0, 6, 15},
{-1, 314, 2832, 0, 4, 0},
{16, 31, 2740, 0, 3, 12},
{17, 30, 2694, 0, 6, 15},
{16, 31, 2455, 0, 0, 12},
{17, 30, 2285, 0, 5, 15},
{16, 31, 2260, 0, 2, 12},
{16, 31, 1904, 0, 5, 12},
{17, 30, 1808, 0, 1, 15},
{16, 31, 1744, 0, 7, 12},
{17, 30, 1696, 0, 4, 15},
{16, 31, 1568, 0, 2, 12},
{-1, 314, 1232, 0, 4, 0},
{17, 30, 970, 0, 4, 15},
{16, 31, 910, 0, 7, 12},
{17, 30, 705, 0, 0, 15},
{16, 31, 550, 0, 6, 12},
{17, 30, 305, 0, 3, 15},
{ 16, 31, 260, 0, 1, 12 }
};
RiverStruct RIVER2OBJECTS[54] = {
{16, 31, 8230, 0, 6, 12},
{16, 31, 8115, 0, 7, 12},
{17, 30, 7955, 0, 4, 15},
{16, 31, 7890, 0, 0, 12},
{16, 31, 7616, 0, 2, 12},
{17, 30, 7472, 0, 5, 15},
{16, 31, 7425, 0, 4, 12},
{17, 30, 7360, 0, 1, 15},
{16, 31, 7328, 0, 6, 12},
{-1, 314, 6992, 0, 4, 0},
{16, 31, 6720, 0, 3, 12},
{17, 30, 6700, 0, 6, 15},
{16, 31, 6518, 0, 2, 12},
{17, 30, 6225, 0, 5, 15},
{16, 31, 6200, 0, 2, 12},
{17, 30, 5990, 0, 1, 15},
{16, 31, 5960, 0, 7, 12},
{16, 31, 5700, 0, 2, 12},
{17, 30, 5650, 0, 4, 15},
{16, 31, 5568, 0, 5, 12},
{17, 30, 5488, 0, 6, 15},
{-1, 314, 5072, 0, 4, 0},
{17, 30, 4825, 0, 4, 15},
{16, 31, 4782, 0, 2, 12},
{17, 30, 4660, 0, 5, 15},
{16, 31, 4510, 0, 7, 12},
{16, 31, 4495, 0, 1, 12},
{17, 30, 4250, 0, 2, 15},
{16, 31, 4195, 0, 4, 12},
{-1, 314, 3792, 0, 4, 0},
{17, 30, 3600, 0, 3, 15},
{16, 31, 3470, 0, 5, 12},
{16, 31, 3422, 0, 2, 12},
{17, 30, 3170, 0, 6, 15},
{16, 31, 2960, 0, 4, 12},
{17, 30, 2955, 0, 7, 15},
{-1, 314, 2512, 0, 4, 0},
{17, 30, 2415, 0, 1, 15},
{16, 31, 2318, 0, 0, 12},
{17, 30, 2275, 0, 2, 15},
{16, 31, 2270, 0, 6, 12},
{17, 30, 2026, 0, 3, 15},
{16, 31, 2000, 0, 0, 12},
{16, 31, 1840, 0, 3, 12},
{17, 30, 1795, 0, 7, 15},
{16, 31, 1634, 0, 5, 12},
{17, 30, 1630, 0, 1, 15},
{-1, 314, 1232, 0, 4, 0},
{17, 30, 970, 0, 2, 15},
{16, 31, 910, 0, 5, 12},
{17, 30, 705, 0, 0, 15},
{16, 31, 550, 0, 4, 12},
{17, 30, 305, 0, 3, 15},
{16, 31, 260, 0, 6, 12}
};
RiverStruct *RIVER_OBJECTS[3][2] = {
{ RIVER0OBJECTS, RIVER0OBJECTS + 46 - 1},
{ RIVER1OBJECTS, RIVER1OBJECTS + 50 - 1 },
{ RIVER2OBJECTS, RIVER2OBJECTS + 54 - 1 }
};
const int HELP1COORDS[2][4] = {
{ 76, 129, 168, 183 }, { 187, 240, 168, 183 }
};
const int RIVER1OBJ[23][4] = {
{ 18, -77, 0, 30 },
{ 18, -325, 0, 20 },
{ 18, -450, 0, 15 },
{ 18, -1250, 0, 25 },
{ 19, -130, 0, 20 },
{ 19, -410, 0, 15 },
{ 19, -710, 0, 25 },
{ 19, -1510, 0, 20 },
{ 20, -350, 0, 30 },
{ 20, -695, 0, 25 },
{ 20, -990, 0, 20 },
{ 20, -1300, 0, 25 },
{ 20, -1600, 0, 30 },
{ 21, -370, 0, 20 },
{ 21, -650, 0, 30 },
{ 21, -1215, 0, 40 },
{ 21, -1815, 0, 35 },
{ 22, -380, 0, 25 },
{ 22, -720, 0, 35 },
{ 22, -1020, 0, 30 },
{ 22, -1170, 0, 25 },
{ 22, -1770, 0, 35 },
{ 23, -500, 63, 20 }
};
const int CAST_END_OBJ[26][4] = {
{ 0, 118, 210, 10 },
{ 1, 38, 250, 10 },
{ 2, 38, 280, 10 },
{ 3, 38, 310, 10 },
{ 4, 38, 340, 10 },
{ 5, 38, 370, 10 },
{ 6, 38, 400, 10 },
{ 7, 38, 430, 10 },
{ 8, 38, 460, 10 },
{ 9, 38, 490, 10 },
{ 10, 38, 520, 10 },
{ 11, 38, 550, 10 },
{ 12, 38, 580, 10 },
{ 13, 38, 610, 10 },
{ 14, 38, 640, 10 },
{ 15, 38, 670, 10 },
{ 16, 38, 700, 10 },
{ 17, 38, 730, 10 },
{ 18, 38, 760, 10 },
{ 19, 38, 790, 10 },
{ 20, 95, 820, 10 },
{ 21, 94, 850, 10 },
{ 22, 96, 880, 10 },
{ 23, 114, 910, 10 },
{ 24, 114, 940, 10 },
{ 25, 110, 970, 10 }
};
const int CAST_END_OBJ1[4][4] = {
{ 0, 40, 1100, 10 },
{ 2, 11, 1180, 10 },
{ 1, 154, 1180, 10 },
{ 3, 103, 1300, 10 }
};
} // End of namespace Amazon
} // End of namespace Access

View File

@@ -0,0 +1,156 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACCESS_AMAZON_RESOURCES_H
#define ACCESS_AMAZON_RESOURCES_H
#include "common/scummsys.h"
#include "common/array.h"
#include "access/resources.h"
#include "access/font.h"
namespace Access {
namespace Amazon {
enum InventoryEnum {
INV_BAITED_POLE = 67, INV_TORCH = 76, INV_KNIFE_SPEAR = 78
};
struct RiverStruct {
int _id;
int _width;
int _riverX;
int _xp;
int _lane;
int _offsetY;
};
extern const int SIDEOFFR[];
extern const int SIDEOFFL[];
extern const int SIDEOFFU[];
extern const int SIDEOFFD[];
extern const int DIAGOFFURX[];
extern const int DIAGOFFURY[];
extern const int DIAGOFFDRX[];
extern const int DIAGOFFDRY[];
extern const int DIAGOFFULX[];
extern const int DIAGOFFULY[];
extern const int DIAGOFFDLX[];
extern const int DIAGOFFDLY[];
extern const int _travelPos[][2];
extern const int OVEROFFR[];
extern const int OVEROFFL[];
extern const int OVEROFFU[];
extern const int OVEROFFD[];
extern const int OVEROFFURX[];
extern const int OVEROFFURY[];
extern const int OVEROFFDRX[];
extern const int OVEROFFDRY[];
extern const int OVEROFFULX[];
extern const int OVEROFFULY[];
extern const int OVEROFFDLX[];
extern const int OVEROFFDLY[];
extern const int DEATH_CELLS[13][3];
extern const int CHAPTER_CELLS[17][3];
extern const int CHAPTER_TABLE[14][5];
extern const int CHAPTER_JUMP[14];
extern const int COMBO_TABLE[85][4];
extern const int ANTWALK[24];
extern const int ANTEAT[33];
extern const int ANTDIE[21];
extern const int PITWALK[27];
extern const int PITSTAB[21];
extern const int TORCH[12];
extern const int SPEAR[3];
extern const int OPENING_OBJS[10][4];
extern const byte MAP0[26];
extern const byte MAP1[27];
extern const byte MAP2[32];
extern const byte *const MAPTBL[3];
extern const int DOWNRIVEROBJ[14][4];
extern RiverStruct RIVER0OBJECTS[46];
extern RiverStruct RIVER1OBJECTS[50];
extern RiverStruct RIVER2OBJECTS[54];
extern RiverStruct *RIVER_OBJECTS[3][2];
enum { RIVER_START = 0, RIVER_END = 1 };
extern const int HELP1COORDS[2][4];
extern const int RIVER1OBJ[23][4];
extern const int CAST_END_OBJ[26][4];
extern const int CAST_END_OBJ1[4][4];
class AmazonResources: public Resources {
protected:
/**
* Load data from the access.dat file
*/
void load(Common::SeekableReadStream &s) override;
public:
AmazonFont *_font3x5, *_font6x6;
Common::String NO_HELP_MESSAGE;
Common::String NO_HINTS_MESSAGE;
Common::String RIVER_HIT1;
Common::String RIVER_HIT2;
Common::String BAR_MESSAGE;
Common::String HELPLVLTXT[3];
Common::String IQLABELS[9];
private:
Common::Array< Common::Array<byte> > CURSORS;
public:
AmazonResources(AccessEngine *vm) : Resources(vm), _font3x5(nullptr), _font6x6(nullptr) {}
~AmazonResources() override;
const byte *getCursor(int num) const override;
const char *getEgoName() const override { return "JASON"; }
int getRMouse(int i, int j) const override;
int inButtonXRange(int x) const override;
};
#define AMRES (*((Amazon::AmazonResources *)_vm->_res))
} // End of namespace Amazon
} // End of namespace Access
#endif /* ACCESS_AMAZON_RESOURCES_H */

View File

@@ -0,0 +1,227 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/scummsys.h"
#include "access/access.h"
#include "access/resources.h"
#include "access/amazon/amazon_game.h"
#include "access/amazon/amazon_resources.h"
#include "access/amazon/amazon_room.h"
namespace Access {
namespace Amazon {
AmazonRoom::AmazonRoom(AccessEngine *vm) : Room(vm) {
_game = (AmazonEngine *)vm;
_antOutFlag = false;
_icon = nullptr;
}
AmazonRoom::~AmazonRoom() {
}
void AmazonRoom::loadRoom(int roomNumber) {
loadRoomData(&AMRES.ROOMTBL[roomNumber]._data[0]);
}
void AmazonRoom::reloadRoom() {
loadRoom(_vm->_player->_roomNumber);
if (_roomFlag != 1) {
_vm->_currentMan = _roomFlag;
_vm->_currentManOld = _roomFlag;
_vm->_manScaleOff = 0;
switch (_vm->_currentMan) {
case 0:
_vm->_player->loadSprites("MAN.LZ");
break;
case 2:
_vm->_player->loadSprites("JMAN.LZ");
break;
case 3:
_vm->_player->loadSprites("OVERHEAD.LZ");
_vm->_manScaleOff = 1;
break;
default:
break;
}
}
reloadRoom1();
}
void AmazonRoom::reloadRoom1() {
if (_vm->_player->_roomNumber == 29 || _vm->_player->_roomNumber == 31
|| _vm->_player->_roomNumber == 42 || _vm->_player->_roomNumber == 44) {
Resource *spriteData = _vm->_files->loadFile("MAYA.LZ");
_game->_inactive._altSpritesPtr = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_currentCharFlag = false;
}
_selectCommand = -1;
_vm->_events->setNormalCursor(CURSOR_CROSSHAIRS);
_vm->_mouseMode = 0;
_vm->_boxSelect = true;
_vm->_player->_playerOff = false;
_vm->_screen->fadeOut();
_vm->_screen->clearScreen();
roomInit();
if (_roomFlag != 1 && (_vm->_player->_roomNumber != 61 || !_antOutFlag)) {
_vm->_player->load();
_vm->_player->calcManScale();
}
if (_vm->_player->_roomNumber != 20 && _vm->_player->_roomNumber != 24
&& _vm->_player->_roomNumber != 33 && _vm->_player->_roomNumber != 45) {
roomMenu();
}
_vm->_screen->setBufferScan();
setupRoom();
setWallCodes();
buildScreen();
if (!_vm->_screen->_vesaMode) {
_vm->copyBF2Vid();
} else if (_vm->_player->_roomNumber != 20 && _vm->_player->_roomNumber != 24
&& _vm->_player->_roomNumber != 33) {
_vm->_screen->setPalette();
_vm->copyBF2Vid();
}
// Stop player moving
_vm->_player->_playerMove = false;
_vm->_player->_frame = 0;
// Clear any dirty rects from the old scene
_vm->_oldRects.clear();
_vm->_newRects.clear();
}
void AmazonRoom::setupRoom() {
Room::setupRoom();
// WORKAROUND: The original engine doesn't handle vertical scrolling rooms
Screen &screen = *_vm->_screen;
if (screen._vWindowHeight == (_playFieldHeight - 1)) {
_vm->_scrollRow = 1;
_vm->_scrollY = 0;
}
}
void AmazonRoom::roomMenu() {
const SpriteResource *icons = _vm->getIcons();
Screen &screen = *_vm->_screen;
screen.saveScreen();
screen.setDisplayScan();
_vm->_destIn = &screen; // TODO: Redundant
screen.plotImage(icons, 0, Common::Point(0, 177));
screen.plotImage(icons, 1, Common::Point(143, 177));
screen.restoreScreen();
}
void AmazonRoom::mainAreaClick() {
Common::Point &mousePos = _vm->_events->_mousePos;
Common::Point pt = _vm->_events->calcRawMouse();
Screen &screen = *_vm->_screen;
Player &player = *_vm->_player;
if (_selectCommand == -1) {
if (player._roomNumber == 42 || player._roomNumber == 44 ||
player._roomNumber == 31 || player._roomNumber == 29) {
switch (checkBoxes1(pt)) {
case 0:
// Make Jason the active player
_game->_jasMayaFlag = 0;
return;
case 1:
// Make Maya the active player
_game->_jasMayaFlag = 1;
return;
default:
break;
}
}
// WORKAROUND: In Amazon room 9, you can't leave the screen to the south due
// to not being able to click a Y position that's high enough
if (_vm->_scrollRow == 0 && pt.y > 178)
pt.y = 200;
player._moveTo = pt;
player._playerMove = true;
} else if (mousePos.x >= screen._windowXAdd &&
mousePos.x <= (screen._windowXAdd + screen._vWindowBytesWide) &&
mousePos.y >= screen._windowYAdd &&
mousePos.y <= (screen._windowYAdd + screen._vWindowLinesTall)) {
if (checkBoxes1(pt) >= 0) {
checkBoxes3();
}
}
}
void AmazonRoom::walkCursor() {
// WORKAROUND: For scene 29, which is a normal walkable scene, but yet can be
// 'exited'. This workaround ensures the scene will only be left if you click
// the Exit icon when the cursor is already a walk cursor
EventsManager &events = *_vm->_events;
if (_vm->_events->_middleButton || (_vm->_player->_roomNumber == 29 &&
events._normalMouse != CURSOR_CROSSHAIRS)) {
events.forceSetCursor(CURSOR_CROSSHAIRS);
_selectCommand = -1;
_vm->_boxSelect = true;
} else {
Room::walkCursor();
}
}
void AmazonRoom::init4Quads() {
if (!_vm->_screen->_vesaMode)
return;
// CHECKME: in the original, this call of tileScreen uses an useless parameter, "TILES.BLK"
_game->tileScreen();
_vm->_inventory->refreshInventory();
_game->updateSummary(_game->_chapter);
_vm->_screen->setPanel(0);
_vm->_screen->clearScreen();
}
void AmazonRoom::clearRoom() {
_game->freeInactivePlayer();
Room::clearRoom();
}
} // End of namespace Amazon
} // End of namespace Access

View File

@@ -0,0 +1,70 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACCESS_AMAZON_ROOM_H
#define ACCESS_AMAZON_ROOM_H
#include "common/scummsys.h"
#include "access/room.h"
namespace Access {
class AccessEngine;
namespace Amazon {
class AmazonEngine;
class AmazonRoom : public Room {
private:
AmazonEngine *_game;
bool _antOutFlag;
const byte *_icon;
protected:
void loadRoom(int roomNumber) override;
void reloadRoom() override;
void reloadRoom1() override;
void setupRoom() override;
void mainAreaClick() override;
void clearRoom() override;
void walkCursor() override;
public:
AmazonRoom(AccessEngine *vm);
~AmazonRoom() override;
void init4Quads() override;
void roomMenu() override;
};
} // End of namespace Amazon
} // End of namespace Access
#endif /* ACCESS_AMAZON_ROOM_H */

View File

@@ -0,0 +1,535 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/scummsys.h"
#include "access/access.h"
#include "access/resources.h"
#include "access/amazon/amazon_game.h"
#include "access/amazon/amazon_resources.h"
#include "access/amazon/amazon_scripts.h"
namespace Access {
namespace Amazon {
AmazonScripts::AmazonScripts(AccessEngine *vm) : Scripts(vm) {
_game = (AmazonEngine *)_vm;
setOpcodes_v2();
}
void AmazonScripts::cLoop() {
searchForSequence();
_vm->_images.clear();
_vm->_buffer2.blitFrom(_vm->_buffer1);
_vm->_oldRects.clear();
_vm->_scripts->executeScript();
_vm->plotList1();
_vm->copyBlocks();
}
void AmazonScripts::mWhile1() {
_vm->_screen->setDisplayScan();
_vm->_screen->fadeOut();
_vm->_events->hideCursor();
_vm->_files->loadScreen(14, 0);
_vm->_buffer2.blitFrom(*_vm->_screen);
_vm->_buffer1.blitFrom(*_vm->_screen);
_vm->_events->showCursor();
_vm->_screen->setIconPalette();
_vm->_screen->forceFadeIn();
Resource *spriteData = _vm->_files->loadFile(14, 6);
_vm->_objectsTable[0] = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_images.clear();
_vm->_oldRects.clear();
_sequence = 2100;
do {
cLoop();
_sequence = 2100;
} while (_vm->_flags[52] == 1);
_vm->_buffer1.copyTo(_vm->_screen);
_vm->_buffer2.copyTo(&_vm->_buffer1);
_game->establish(-1, 14);
spriteData = _vm->_files->loadFile(14, 7);
_vm->_objectsTable[1] = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_sound->playSound(0);
_vm->_screen->setDisplayScan();
_vm->_events->hideCursor();
_vm->_files->loadScreen(14, 1);
_vm->_screen->setPalette();
_vm->_buffer2.blitFrom(*_vm->_screen);
_vm->_buffer1.blitFrom(*_vm->_screen);
_vm->_events->showCursor();
_vm->_screen->setIconPalette();
_vm->_images.clear();
_vm->_oldRects.clear();
_sequence = 2200;
_vm->_sound->loadSoundTable(0, 14, 15);
do {
cLoop();
_sequence = 2200;
} while (_vm->_flags[52] == 2);
_vm->_screen->setDisplayScan();
_vm->_events->hideCursor();
_vm->_files->loadScreen(14, 2);
_vm->_screen->setPalette();
_vm->_buffer2.blitFrom(*_vm->_screen);
_vm->_buffer1.blitFrom(*_vm->_screen);
_vm->_events->showCursor();
_vm->_screen->setIconPalette();
_vm->freeCells();
spriteData = _vm->_files->loadFile(14, 8);
_vm->_objectsTable[2] = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_images.clear();
_vm->_oldRects.clear();
_sequence = 2300;
_vm->_sound->playSound(0);
do {
cLoop();
_sequence = 2300;
} while (_vm->_flags[52] == 3);
_vm->freeCells();
spriteData = _vm->_files->loadFile(14, 9);
_vm->_objectsTable[3] = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_screen->setDisplayScan();
_vm->_events->hideCursor();
_vm->_files->loadScreen(14, 3);
_vm->_screen->setPalette();
_vm->_buffer2.blitFrom(*_vm->_screen);
_vm->_buffer1.blitFrom(*_vm->_screen);
_vm->_events->showCursor();
_vm->_screen->setIconPalette();
_vm->_images.clear();
_vm->_oldRects.clear();
_sequence = 2400;
do {
cLoop();
_sequence = 2400;
} while (_vm->_flags[52] == 4);
}
void AmazonScripts::mWhile2() {
_vm->_screen->setDisplayScan();
_vm->_screen->fadeOut();
_vm->_events->hideCursor();
_vm->_files->loadScreen(14, 0);
_vm->_buffer2.blitFrom(*_vm->_screen);
_vm->_buffer1.blitFrom(*_vm->_screen);
_vm->_events->showCursor();
_vm->_screen->setIconPalette();
_vm->_screen->forceFadeIn();
Resource *spriteData = _vm->_files->loadFile(14, 6);
_vm->_objectsTable[0] = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_images.clear();
_vm->_oldRects.clear();
_sequence = 2100;
do {
cLoop();
_sequence = 2100;
} while (_vm->_flags[52] == 1);
_vm->_screen->fadeOut();
_vm->freeCells();
spriteData = _vm->_files->loadFile(14, 9);
_vm->_objectsTable[3] = new SpriteResource(_vm, spriteData);
delete spriteData;
_vm->_screen->setDisplayScan();
_vm->_events->hideCursor();
_vm->_files->loadScreen(14, 3);
_vm->_screen->setPalette();
_vm->_buffer2.blitFrom(*_vm->_screen);
_vm->_buffer1.blitFrom(*_vm->_screen);
_vm->_events->showCursor();
_vm->_screen->setIconPalette();
_vm->_images.clear();
_vm->_oldRects.clear();
_sequence = 2400;
do {
cLoop();
_sequence = 2400;
} while (_vm->_flags[52] == 4);
}
void AmazonScripts::mWhile(int param1) {
switch(param1) {
case 1:
mWhile1();
break;
case 2:
_game->_plane->mWhileFly();
break;
case 3:
_game->_plane->mWhileFall();
break;
case 4:
_game->_jungle->mWhileJWalk();
break;
case 5:
_game->_jungle->mWhileDoOpen();
break;
case 6:
_game->_river->mWhileDownRiver();
break;
case 7:
mWhile2();
break;
case 8:
_game->_jungle->mWhileJWalk2();
break;
default:
break;
}
}
void AmazonScripts::loadBackground(int param1, int param2) {
_vm->_files->_setPaletteFlag = false;
_vm->_files->loadScreen(param1, param2);
_vm->_buffer2.blitFrom(*_vm->_screen);
_vm->_buffer1.blitFrom(*_vm->_screen);
_vm->_screen->forceFadeIn();
}
void AmazonScripts::loadNSound(int param1, int param2) {
Resource *sound = _vm->_files->loadFile(param1, param2);
_vm->_sound->_soundTable.push_back(SoundEntry(sound, 1));
}
void AmazonScripts::setInactive() {
_game->_rawInactiveX = _vm->_player->_rawPlayer.x;
_game->_rawInactiveY = _vm->_player->_rawPlayer.y;
_game->_charSegSwitch = false;
mWhile(_game->_rawInactiveY);
}
void AmazonScripts::boatWalls(int param1, int param2) {
if (param1 == 1)
_vm->_room->_plotter._walls[42] = Common::Rect(96, 27, 96 + 87, 27 + 42);
else {
_vm->_room->_plotter._walls[39].bottom = _vm->_room->_plotter._walls[41].bottom = 106;
_vm->_room->_plotter._walls[40].left = 94;
}
}
void AmazonScripts::plotInactive() {
Player &player = *_vm->_player;
InactivePlayer &inactive = _game->_inactive;
if (_game->_charSegSwitch) {
_game->_currentCharFlag = true;
SWAP(inactive._altSpritesPtr, player._playerSprites);
_game->_charSegSwitch = false;
} else if (_game->_jasMayaFlag != (_game->_currentCharFlag ? 1 : 0)) {
if (player._playerOff) {
_game->_jasMayaFlag = (_game->_currentCharFlag ? 1 : 0);
} else {
_game->_currentCharFlag = (_game->_jasMayaFlag == 1);
int tmpX = _game->_rawInactiveX;
int tmpY = _game->_rawInactiveY;
_game->_rawInactiveX = player._rawPlayer.x;
_game->_rawInactiveY = player._rawPlayer.y;
player._rawPlayer.x = tmpX;
player._rawPlayer.y = tmpY;
_game->_inactiveYOff = player._playerOffset.y;
player.calcManScale();
SWAP(inactive._altSpritesPtr, player._playerSprites);
_vm->_room->setWallCodes();
}
}
_game->_flags[155] = 0;
if (_game->_rawInactiveX >= 152 && _game->_rawInactiveX <= 167 &&
_game->_rawInactiveY >= 158 && _game->_rawInactiveY <= 173) {
_game->_flags[155] = 1;
} else {
_game->_flags[160] = 0;
if (!_game->_jasMayaFlag && _game->_rawInactiveX >= 266 && _game->_rawInactiveX <= 290
&& _game->_rawInactiveY >= 70 && _game->_rawInactiveY <= 87) {
_game->_flags[160] = 1;
}
}
inactive._flags &= ~IMGFLAG_UNSCALED;
inactive._flags &= ~IMGFLAG_BACKWARDS;
inactive._position.x = _game->_rawInactiveX;
inactive._position.y = _game->_rawInactiveY - _game->_inactiveYOff;
inactive._offsetY = _game->_inactiveYOff;
inactive._spritesPtr = inactive._altSpritesPtr;
_vm->_images.addToList(_game->_inactive);
}
void AmazonScripts::executeSpecial(int commandIndex, int param1, int param2) {
switch (commandIndex) {
case 0:
warning("TODO: DEMO - RESETAN");
break;
case 1:
_vm->establish(param1, param2);
break;
case 2:
loadBackground(param1, param2);
break;
case 3:
if (_vm->isDemo())
warning("TODO: DEMO - LOADCELLSET");
else
_game->_cast->doCast(param1);
break;
case 4:
if (_vm->isDemo())
loadNSound(param1, param2);
else
setInactive();
break;
case 5:
warning("TODO: DEMO - UNLOADCELLSET");
break;
case 6:
mWhile(param1);
break;
case 7:
warning("TODO: DEMO - ADDMONEY");
break;
case 8:
warning("TODO: DEMO - CHKMONEY");
break;
case 9:
_game->_guard->doGuard();
break;
case 10:
_vm->_midi->newMusic(param1, param2);
break;
case 11:
plotInactive();
break;
case 13:
_game->_river->doRiver();
break;
case 14:
_game->_ant->doAnt();
break;
case 15:
boatWalls(param1, param2);
break;
default:
warning("Unexpected Special code %d - Skipped", commandIndex);
}
}
typedef void(AmazonScripts::*AmazonScriptMethodPtr)();
void AmazonScripts::executeCommand(int commandIndex) {
static const AmazonScriptMethodPtr AMAZON_COMMAND_LIST[] = {
&AmazonScripts::cmdHelp_v2, &AmazonScripts::cmdCycleBack,
&AmazonScripts::cmdChapter, &AmazonScripts::cmdSetHelp,
&AmazonScripts::cmdCenterPanel, &AmazonScripts::cmdMainPanel,
&AmazonScripts::CMDRETFLASH
};
if (commandIndex >= 73)
(this->*AMAZON_COMMAND_LIST[commandIndex - 73])();
else
Scripts::executeCommand(commandIndex);
}
void AmazonScripts::cmdHelp_v2() {
Common::String helpMessage = _data->readString();
if (_game->_helpLevel == 0) {
_game->_timers.saveTimers();
_game->_useItem = 0;
if (_game->_noHints) {
printString(AMRES.NO_HELP_MESSAGE);
return;
} else if (_game->_hintLevel == 0) {
printString(AMRES.NO_HINTS_MESSAGE);
return;
}
}
int level = _game->_hintLevel - 1;
if (level < _game->_helpLevel)
_game->_moreHelp = 0;
_game->drawHelp(helpMessage);
const Common::Rect butn1 = Common::Rect(HELP1COORDS[0][0], HELP1COORDS[0][2], HELP1COORDS[0][1], HELP1COORDS[0][3]);
const Common::Rect butn2 = Common::Rect(HELP1COORDS[1][0], HELP1COORDS[1][2], HELP1COORDS[1][1], HELP1COORDS[1][3]);
while (!_vm->shouldQuit()) {
while (!_vm->shouldQuit() && !_vm->_events->_leftButton)
_vm->_events->pollEventsAndWait();
_vm->_events->debounceLeft();
const Common::Point pt = _vm->_events->_mousePos;
int choice = -1;
if (butn1.contains(pt))
choice = 0;
else if (butn2.contains(pt))
choice = 1;
if (choice < 0)
continue;
if (choice == 1) {
// Done button selected
_game->_helpLevel = 0;
_game->_moreHelp = 1;
_game->_useItem = 0;
_vm->_events->hideCursor();
if (_vm->_screen->_vesaMode) {
_vm->_screen->restoreScreen();
_vm->_screen->setPanel(0);
} else {
_vm->_screen->fadeOut();
_vm->_screen->clearBuffer();
}
_vm->_buffer2.copyTo(_vm->_screen);
_vm->_screen->restorePalette();
_vm->_screen->setPalette();
_vm->_events->showCursor();
delete _vm->_objectsTable[45];
_vm->_objectsTable[45] = nullptr;
_vm->_timers.restoreTimers();
break;
} else {
// More button selected
if (_game->_moreHelp == 0)
continue;
++_game->_helpLevel;
_game->_useItem = 1;
break;
}
}
findNull();
}
void AmazonScripts::cmdCycleBack() {
if (_vm->_startup == -1)
_vm->_screen->cyclePaletteBackwards();
}
void AmazonScripts::cmdChapter() {
Resource *activeScript = nullptr;
if (_vm->isDemo()) {
cmdSetHelp();
} else {
int chapter = _data->readByte();
if (!_vm->isCD()) {
// For floppy version, the current script remains active even
// after the end of the chapter start, so we need to save it
activeScript = _resource;
_resource = nullptr;
_data = nullptr;
}
_game->startChapter(chapter);
if (!_vm->isCD()) {
assert(!_resource);
setScript(activeScript, false);
}
}
}
void AmazonScripts::cmdSetHelp() {
int arrayId = (_data->readUint16LE() & 0xFF) - 1;
int helpId = _data->readUint16LE() & 0xFF;
byte *help = _game->_helpTbl[arrayId];
help[helpId] = 1;
if (_vm->_useItem == 0) {
_sequence = 11000;
searchForSequence();
}
}
void AmazonScripts::cmdCenterPanel() {
if (_vm->_screen->_vesaMode) {
_vm->_screen->clearScreen();
_vm->_screen->setPanel(3);
}
}
void AmazonScripts::cmdMainPanel() {
if (_vm->_screen->_vesaMode) {
_vm->_room->init4Quads();
_vm->_screen->setPanel(0);
}
}
void AmazonScripts::CMDRETFLASH() {
error("TODO CMDRETFLASH");
}
} // End of namespace Amazon
} // End of namespace Access

View File

@@ -0,0 +1,66 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACCESS_AMAZON_SCRIPTS_H
#define ACCESS_AMAZON_SCRIPTS_H
#include "common/scummsys.h"
#include "access/scripts.h"
namespace Access {
namespace Amazon {
class AmazonEngine;
class AmazonScripts : public Scripts {
private:
AmazonEngine *_game;
protected:
void executeSpecial(int commandIndex, int param1, int param2) override;
void executeCommand(int commandIndex) override;
void cLoop();
void mWhile1();
void mWhile2();
void mWhile(int param1);
void loadBackground(int param1, int param2);
void plotInactive();
void loadNSound(int param1, int param2);
void setInactive();
void boatWalls(int param1, int param2);
void cmdHelp_v2();
void cmdCycleBack();
void cmdChapter();
void cmdSetHelp();
void cmdCenterPanel();
void cmdMainPanel();
void CMDRETFLASH();
public:
AmazonScripts(AccessEngine *vm);
};
} // End of namespace Amazon
} // End of namespace Access
#endif /* ACCESS_AMAZON_SCRIPTS_H */