2014-07-29 21:02:28 -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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/config-manager.h"
|
|
|
|
#include "common/debug-channels.h"
|
|
|
|
#include "common/events.h"
|
|
|
|
#include "engines/util.h"
|
|
|
|
#include "access/access.h"
|
|
|
|
|
|
|
|
namespace Access {
|
|
|
|
|
|
|
|
AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) :
|
|
|
|
_gameDescription(gameDesc), Engine(syst), _randomSource("Access") {
|
|
|
|
_debugger = nullptr;
|
2014-07-29 22:49:45 -04:00
|
|
|
_events = nullptr;
|
2014-08-02 15:14:42 -04:00
|
|
|
_files = nullptr;
|
2014-08-05 22:17:30 -04:00
|
|
|
_player = nullptr;
|
|
|
|
_room = nullptr;
|
2014-08-02 10:07:54 -04:00
|
|
|
_screen = nullptr;
|
2014-08-05 23:23:49 -04:00
|
|
|
_scripts = nullptr;
|
2014-08-02 15:14:42 -04:00
|
|
|
_sound = nullptr;
|
2014-08-04 09:21:39 -04:00
|
|
|
|
|
|
|
_destIn = nullptr;
|
2014-08-05 20:59:44 -04:00
|
|
|
clearCellTable();
|
2014-08-04 22:38:50 -04:00
|
|
|
_pCount = 0;
|
2014-08-05 20:59:44 -04:00
|
|
|
_selectCommand = 0;
|
|
|
|
_normalMouse = true;
|
|
|
|
_mouseMode = 0;
|
2014-08-04 22:38:50 -04:00
|
|
|
_currentMan = 0;
|
|
|
|
_currentManOld = -1;
|
|
|
|
_man1 = nullptr;
|
2014-08-05 23:23:49 -04:00
|
|
|
_inactive = nullptr;
|
2014-08-04 22:38:50 -04:00
|
|
|
_manPal1 = nullptr;
|
|
|
|
_music = nullptr;
|
|
|
|
_playField = nullptr;
|
|
|
|
_anim = nullptr;
|
|
|
|
_title = nullptr;
|
|
|
|
_converseMode = 0;
|
|
|
|
_startInvItem = 0;
|
|
|
|
_startAboutItem = 0;
|
|
|
|
_startTravelItem = 0;
|
|
|
|
_startInvBox = 0;
|
|
|
|
_startAboutBox = 0;
|
|
|
|
_startTravelBox = 0;
|
2014-08-05 22:17:30 -04:00
|
|
|
_numImages = 0;
|
|
|
|
_nextImage = 0;
|
|
|
|
_numAnimTimers = 0;
|
|
|
|
_startup = 0;
|
2014-08-05 23:23:49 -04:00
|
|
|
_currentCharFlag = false;
|
|
|
|
_boxSelect = false;
|
2014-08-04 22:38:50 -04:00
|
|
|
|
2014-08-05 20:59:44 -04:00
|
|
|
_roomNumber = 0;
|
2014-08-05 20:04:41 -04:00
|
|
|
_rawPlayerXLow = 0;
|
|
|
|
_rawPlayerX = 0;
|
|
|
|
_rawPlayerYLow = 0;
|
|
|
|
_rawPlayerY = 0;
|
|
|
|
_conversation = 0;
|
|
|
|
_currentMan = 0;
|
|
|
|
_newTime = 0;
|
|
|
|
_newDate = 0;
|
|
|
|
_intTim[3] = 0;
|
|
|
|
_timer[3] = 0;
|
|
|
|
_timerFlag = false;
|
|
|
|
Common::fill(&_flags[0], &_flags[99], 0);
|
|
|
|
Common::fill(&_useItem[0], &_useItem[23], 0);
|
|
|
|
_guardLoc = 0;
|
|
|
|
_guardFind = 0;
|
|
|
|
_helpLevel = 0;
|
|
|
|
_jasMayaFlag = 0;
|
|
|
|
_moreHelp = 0;
|
|
|
|
_startup = 0;
|
|
|
|
_flashbackFlag = false;
|
|
|
|
_manScaleOff = 0;
|
|
|
|
_riverFlag = false;
|
|
|
|
_antOutFlag = false;
|
|
|
|
_badEnd = 0;
|
|
|
|
_noHints = false;
|
|
|
|
_antFlag = false;
|
|
|
|
_allenFlag = false;
|
|
|
|
_noSound = false;
|
|
|
|
Common::fill(&inv[0], &inv[85], 0);
|
|
|
|
Common::fill(&_help1[0], &_help1[366], 0);
|
|
|
|
Common::fill(&_help2[0], &_help2[366], 0);
|
|
|
|
Common::fill(&_help1[0], &_help3[366], 0);
|
|
|
|
_travel = 0;
|
|
|
|
_ask = 0;
|
|
|
|
_rScrollRow = 0;
|
|
|
|
_rScrollCol = 0;
|
|
|
|
_rSrcollX = 0;
|
|
|
|
_rScrollY = 0;
|
|
|
|
_rOldRectCount = 0;
|
|
|
|
_rNewRectCount = 0;
|
|
|
|
_rKeyFlag = 0;
|
|
|
|
_mapOffset = 0;
|
|
|
|
_screenVirtX = 0;
|
2014-07-29 21:02:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
AccessEngine::~AccessEngine() {
|
|
|
|
delete _debugger;
|
2014-07-29 22:49:45 -04:00
|
|
|
delete _events;
|
2014-08-02 15:14:42 -04:00
|
|
|
delete _files;
|
2014-08-05 22:17:30 -04:00
|
|
|
delete _player;
|
|
|
|
delete _room;
|
2014-08-02 10:07:54 -04:00
|
|
|
delete _screen;
|
2014-08-05 23:23:49 -04:00
|
|
|
delete _scripts;
|
2014-08-02 15:14:42 -04:00
|
|
|
delete _sound;
|
2014-08-04 09:21:39 -04:00
|
|
|
|
|
|
|
_buffer1.free();
|
|
|
|
_buffer2.free();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessEngine::setVGA() {
|
|
|
|
initGraphics(320, 200, false);
|
2014-07-29 21:02:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void AccessEngine::initialize() {
|
|
|
|
// Set up debug channels
|
|
|
|
DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
|
|
|
|
DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");
|
|
|
|
|
|
|
|
_debugger = new Debugger(this);
|
2014-07-29 22:49:45 -04:00
|
|
|
_events = new EventsManager(this);
|
2014-08-02 15:14:42 -04:00
|
|
|
_files = new FileManager(this);
|
2014-08-05 22:17:30 -04:00
|
|
|
_player = new Player(this);
|
2014-08-02 10:07:54 -04:00
|
|
|
_screen = new Screen(this);
|
2014-08-04 09:21:39 -04:00
|
|
|
_sound = new SoundManager(this, _mixer);
|
|
|
|
|
|
|
|
_buffer1.create(g_system->getWidth(), g_system->getHeight(), Graphics::PixelFormat::createFormatCLUT8());
|
|
|
|
_buffer2.create(g_system->getWidth(), g_system->getHeight(), Graphics::PixelFormat::createFormatCLUT8());
|
2014-07-29 21:02:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Common::Error AccessEngine::run() {
|
2014-08-04 09:21:39 -04:00
|
|
|
setVGA();
|
2014-07-29 21:02:28 -04:00
|
|
|
initialize();
|
|
|
|
|
2014-08-04 21:35:49 -04:00
|
|
|
playGame();
|
2014-08-01 21:32:05 -04:00
|
|
|
|
|
|
|
dummyLoop();
|
2014-07-29 21:02:28 -04:00
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
2014-08-01 21:32:05 -04:00
|
|
|
void AccessEngine::dummyLoop() {
|
|
|
|
// Dummy game loop
|
|
|
|
while (!shouldQuit()) {
|
|
|
|
_events->pollEvents();
|
|
|
|
g_system->delayMillis(50);
|
|
|
|
g_system->updateScreen();
|
|
|
|
|
|
|
|
if (_events->_leftButton) {
|
|
|
|
CursorType cursorId = _events->getCursor();
|
|
|
|
_events->setCursor((cursorId == CURSOR_HELP) ? CURSOR_0 : (CursorType)(cursorId + 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-07-29 21:02:28 -04:00
|
|
|
int AccessEngine::getRandomNumber(int maxNumber) {
|
|
|
|
return _randomSource.getRandomNumber(maxNumber);
|
|
|
|
}
|
|
|
|
|
2014-08-05 20:59:44 -04:00
|
|
|
void AccessEngine::clearCellTable() {
|
|
|
|
Common::fill(&_objectsTable[0], &_objectsTable[100], (byte *)nullptr);
|
|
|
|
}
|
|
|
|
|
2014-07-29 21:02:28 -04:00
|
|
|
} // End of namespace Access
|