2009-06-12 12:40:18 +00: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.
|
2009-06-12 14:19:33 +00:00
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
2009-06-12 12:40:18 +00:00
|
|
|
*/
|
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
#include "asylum/asylum.h"
|
|
|
|
|
2010-11-04 22:19:02 +00:00
|
|
|
#include "asylum/resources/actionlist.h"
|
2010-11-03 04:29:08 +00:00
|
|
|
#include "asylum/resources/encounters.h"
|
|
|
|
|
2010-11-27 00:04:43 +00:00
|
|
|
#include "asylum/puzzles/vcr.h"
|
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
#include "asylum/system/config.h"
|
2010-11-08 21:09:13 +00:00
|
|
|
#include "asylum/system/cursor.h"
|
2010-12-01 19:21:10 +00:00
|
|
|
#include "asylum/system/savegame.h"
|
2010-11-03 04:27:47 +00:00
|
|
|
#include "asylum/system/screen.h"
|
|
|
|
#include "asylum/system/sound.h"
|
|
|
|
#include "asylum/system/text.h"
|
2010-11-05 04:14:46 +00:00
|
|
|
#include "asylum/system/video.h"
|
2010-11-03 04:27:47 +00:00
|
|
|
|
|
|
|
#include "asylum/views/scene.h"
|
|
|
|
#include "asylum/views/menu.h"
|
|
|
|
|
|
|
|
#include "asylum/console.h"
|
|
|
|
#include "asylum/respack.h"
|
|
|
|
|
2009-06-12 12:40:18 +00:00
|
|
|
#include "common/config-manager.h"
|
2010-05-12 10:24:37 +00:00
|
|
|
#include "common/debug-channels.h"
|
2009-06-12 12:40:18 +00:00
|
|
|
#include "common/events.h"
|
2009-08-05 05:41:32 +00:00
|
|
|
#include "common/EventRecorder.h"
|
2009-06-12 12:40:18 +00:00
|
|
|
|
2010-05-12 10:24:37 +00:00
|
|
|
#include "engines/util.h"
|
|
|
|
|
2009-06-12 12:40:18 +00:00
|
|
|
namespace Asylum {
|
|
|
|
|
2010-11-08 21:09:02 +00:00
|
|
|
AsylumEngine::AsylumEngine(OSystem *system, const ADGameDescription *gd) : Engine(system), _gameDescription(gd),
|
2010-12-01 19:21:10 +00:00
|
|
|
_console(NULL), _cursor(NULL), _encounter(NULL), _mainMenu(NULL), _resource(NULL), _savegame(NULL),
|
2010-12-01 19:21:21 +00:00
|
|
|
_scene(NULL), _screen(NULL), _sound(NULL), _text(NULL), _video(NULL), _handler(NULL) {
|
2010-11-03 04:27:47 +00:00
|
|
|
|
2010-11-09 00:58:34 +00:00
|
|
|
// Init data
|
2010-11-16 14:24:17 +00:00
|
|
|
memset(&_gameFlags, 0, sizeof(_gameFlags));
|
2010-11-27 00:04:43 +00:00
|
|
|
memset(&_puzzles, 0, sizeof(_puzzles));
|
2010-11-08 21:09:13 +00:00
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
// Add default search directories
|
|
|
|
const Common::FSNode gameDataDir(ConfMan.get("path"));
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "vids");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "music");
|
2009-09-21 19:11:49 +00:00
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
// Initialize custom debug levels
|
2010-11-08 21:09:02 +00:00
|
|
|
DebugMan.addDebugChannel(kDebugLevelMain, "Main", "Generic debug level");
|
2010-04-28 03:42:53 +00:00
|
|
|
DebugMan.addDebugChannel(kDebugLevelResources, "Resources", "Resources debugging");
|
2010-11-08 21:09:02 +00:00
|
|
|
DebugMan.addDebugChannel(kDebugLevelSprites, "Sprites", "Sprites debugging");
|
|
|
|
DebugMan.addDebugChannel(kDebugLevelInput, "Input", "Input events debugging");
|
|
|
|
DebugMan.addDebugChannel(kDebugLevelMenu, "Menu", "Menu debugging");
|
|
|
|
DebugMan.addDebugChannel(kDebugLevelScripts, "Scripts", "Scripts debugging");
|
|
|
|
DebugMan.addDebugChannel(kDebugLevelSound, "Sound", "Sound debugging");
|
|
|
|
DebugMan.addDebugChannel(kDebugLevelSavegame, "Savegame", "Saving & restoring game debugging");
|
|
|
|
DebugMan.addDebugChannel(kDebugLevelScene, "Scene", "Scene process and draw debugging");
|
|
|
|
DebugMan.addDebugChannel(kDebugLevelObjects, "Objects", "Debug Object Objects");
|
2009-09-21 19:11:49 +00:00
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
// Initialize random number source
|
2009-08-05 05:41:32 +00:00
|
|
|
g_eventRec.registerRandomSource(_rnd, "asylum");
|
2009-06-12 12:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AsylumEngine::~AsylumEngine() {
|
2010-11-16 14:24:17 +00:00
|
|
|
delete _cursor;
|
2010-11-03 04:27:47 +00:00
|
|
|
delete _scene;
|
2010-11-09 03:10:09 +00:00
|
|
|
delete _encounter;
|
2010-12-01 19:21:10 +00:00
|
|
|
delete _savegame;
|
2009-06-13 23:03:37 +00:00
|
|
|
delete _screen;
|
2010-11-03 04:27:47 +00:00
|
|
|
delete _sound;
|
2009-09-25 01:05:23 +00:00
|
|
|
delete _text;
|
2010-11-03 04:27:47 +00:00
|
|
|
delete _video;
|
2010-11-09 03:10:09 +00:00
|
|
|
delete _mainMenu;
|
|
|
|
delete _resource;
|
|
|
|
delete _console;
|
2009-09-25 13:19:46 +00:00
|
|
|
|
2010-11-27 00:04:43 +00:00
|
|
|
// Cleanup puzzles
|
|
|
|
for (uint i = 0; i < ARRAYSIZE(_puzzles); i++)
|
|
|
|
delete _puzzles[i];
|
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
// Zero passed pointers
|
|
|
|
_gameDescription = NULL;
|
2009-06-12 12:40:18 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
Common::Error AsylumEngine::run() {
|
|
|
|
// Initialize the graphics
|
2009-06-12 20:07:11 +00:00
|
|
|
initGraphics(640, 480, true);
|
2009-06-12 20:38:38 +00:00
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
// Create debugger. It requires GFX to be initialized
|
|
|
|
_console = new Console(this);
|
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
// Create resource manager
|
2010-11-08 21:09:02 +00:00
|
|
|
_resource = new ResourceManager();
|
2010-11-10 12:08:43 +00:00
|
|
|
_resource->setCdNumber(1);
|
2010-11-08 21:09:13 +00:00
|
|
|
|
|
|
|
// Create all game classes
|
|
|
|
_encounter = new Encounter(this);
|
|
|
|
_cursor = new Cursor(this);
|
2010-12-01 19:21:10 +00:00
|
|
|
_savegame = new Savegame(this);
|
2009-12-03 21:05:50 +00:00
|
|
|
_screen = new Screen(this);
|
2010-11-08 21:09:02 +00:00
|
|
|
_sound = new Sound(this, _mixer);
|
|
|
|
_text = new Text(this);
|
2010-11-08 21:09:13 +00:00
|
|
|
_video = new Video(this, _mixer);
|
2010-11-27 00:04:43 +00:00
|
|
|
initPuzzles();
|
2009-08-09 22:56:13 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
// Create main menu
|
|
|
|
_mainMenu = new MainMenu(this);
|
2010-12-01 19:21:10 +00:00
|
|
|
_handler = _mainMenu;
|
2009-11-27 02:02:00 +00:00
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
// Load config
|
2009-12-01 22:42:11 +00:00
|
|
|
Config.read();
|
2009-08-01 17:51:26 +00:00
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
// Send init event to our default event handler
|
|
|
|
AsylumEvent initEvt(EVENT_ASYLUM_INIT);
|
|
|
|
_handler->handleEvent(initEvt);
|
2009-06-12 12:40:18 +00:00
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
// Start running event loop
|
2009-06-12 12:40:18 +00:00
|
|
|
while (!shouldQuit()) {
|
2010-12-01 19:21:21 +00:00
|
|
|
handleEvents();
|
2009-06-13 13:40:48 +00:00
|
|
|
|
|
|
|
_system->updateScreen();
|
2009-06-12 12:40:18 +00:00
|
|
|
}
|
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
return Common::kNoError;
|
2010-12-01 19:20:53 +00:00
|
|
|
}
|
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
void AsylumEngine::startGame(ResourcePackId sceneId, StartGameType type) {
|
2010-11-16 14:24:17 +00:00
|
|
|
if (!_cursor || !_screen)
|
|
|
|
error("[AsylumEngine::startGame] Subsystems not initialized properly!");
|
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
// Load the default mouse cursor
|
|
|
|
_cursor->set(MAKE_RESOURCE(kResourcePackSound, 14));
|
|
|
|
_cursor->hide();
|
2010-10-05 19:50:24 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
// Clear the graphic list
|
|
|
|
_screen->clearGraphicsInQueue();
|
|
|
|
|
|
|
|
// Reset scene
|
|
|
|
delete _scene;
|
|
|
|
_scene = new Scene(this);
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
default:
|
|
|
|
error("[AsylumEngine::startGame] Invalid start game type!");
|
|
|
|
|
|
|
|
case kStartGamePlayIntro:
|
2010-11-03 04:29:37 +00:00
|
|
|
playIntro();
|
|
|
|
|
2010-11-10 20:45:19 +00:00
|
|
|
_scene->enter(sceneId);
|
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
_cursor->show();
|
|
|
|
break;
|
2009-12-01 22:42:11 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
case kStartGameLoad:
|
|
|
|
error("[AsylumEngine::startGame] kStartGameLoad not implemented!");
|
|
|
|
break;
|
2009-12-01 22:42:11 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
case kStartGameScene:
|
|
|
|
_scene->enter(sceneId);
|
2009-12-01 22:42:11 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
_cursor->show();
|
|
|
|
break;
|
2010-10-05 19:50:24 +00:00
|
|
|
}
|
2009-12-01 22:42:11 +00:00
|
|
|
}
|
|
|
|
|
2010-12-01 19:20:53 +00:00
|
|
|
void AsylumEngine::restart() {
|
|
|
|
error("[AsylumEngine::restart] Not implemented!");
|
|
|
|
}
|
|
|
|
|
2009-08-09 13:24:36 +00:00
|
|
|
void AsylumEngine::playIntro() {
|
2010-11-16 14:24:17 +00:00
|
|
|
if (!_video || !_screen)
|
|
|
|
error("[AsylumEngine::playIntro] Subsystems not initialized properly!");
|
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
_cursor->hide();
|
2009-12-01 00:37:12 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
if (Config.showIntro)
|
2010-11-28 19:25:03 +00:00
|
|
|
_video->playVideo(1);
|
2010-11-03 04:29:37 +00:00
|
|
|
/*if (_scene->worldstats()->musicCurrentResourceId != kResourceMusic_FFFFFD66)
|
|
|
|
_sound->playMusic(_scene->getResourcePack(), _scene->worldstats()->musicCurrentResourceId);*/
|
2009-08-09 13:24:36 +00:00
|
|
|
|
2010-11-16 14:24:54 +00:00
|
|
|
_screen->clear();
|
2009-08-09 13:24:36 +00:00
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
setGameFlag(kGameFlag4);
|
|
|
|
setGameFlag(kGameFlag12);
|
2009-08-09 13:24:36 +00:00
|
|
|
|
2009-09-20 21:10:43 +00:00
|
|
|
// Play the intro sound sample (the screen is blacked out, you hear
|
|
|
|
// an alarm sounding and men talking about.
|
2010-11-08 21:09:02 +00:00
|
|
|
_sound->playSound(MAKE_RESOURCE(kResourcePackSound, 7));
|
2009-08-09 13:24:36 +00:00
|
|
|
}
|
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
void AsylumEngine::handleEvents() {
|
2010-11-16 14:24:17 +00:00
|
|
|
if (!_console || !_video || !_screen || !_sound || !_mainMenu)
|
|
|
|
error("[AsylumEngine::handleEvents] Subsystems not initialized properly!");
|
2010-11-03 04:27:47 +00:00
|
|
|
|
|
|
|
// Show the debugger if required
|
|
|
|
_console->onFrame();
|
2009-08-09 22:56:13 +00:00
|
|
|
|
2010-12-01 19:20:53 +00:00
|
|
|
AsylumEvent ev;
|
2010-11-03 04:27:47 +00:00
|
|
|
if (_eventMan->pollEvent(ev)) {
|
|
|
|
switch (ev.type) {
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Common::EVENT_KEYDOWN:
|
2010-12-01 19:21:21 +00:00
|
|
|
if ((ev.kbd.flags & Common::KBD_CTRL) && ev.kbd.keycode == Common::KEYCODE_d) {
|
2010-11-03 04:27:47 +00:00
|
|
|
_console->attach();
|
2010-12-01 19:21:21 +00:00
|
|
|
break;
|
2009-06-13 13:40:48 +00:00
|
|
|
}
|
2009-06-21 12:09:44 +00:00
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
// Handle key events
|
|
|
|
_handler->handleEvent(ev);
|
2010-11-03 04:27:47 +00:00
|
|
|
break;
|
2009-06-13 19:38:25 +00:00
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
case Common::EVENT_MOUSEMOVE:
|
|
|
|
case Common::EVENT_LBUTTONDOWN:
|
|
|
|
case Common::EVENT_LBUTTONUP:
|
|
|
|
case Common::EVENT_RBUTTONDOWN:
|
|
|
|
case Common::EVENT_RBUTTONUP:
|
|
|
|
// Handle mouse events
|
|
|
|
_handler->handleEvent(ev);
|
|
|
|
break;
|
2010-12-01 19:20:53 +00:00
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
case Common::EVENT_QUIT:
|
|
|
|
quitGame();
|
|
|
|
break;
|
2009-06-15 12:28:19 +00:00
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
// TODO handle cases where we receive a midi or music event
|
|
|
|
}
|
|
|
|
}
|
2010-10-05 19:50:24 +00:00
|
|
|
|
2010-12-01 19:21:21 +00:00
|
|
|
// Send update event to our event handler
|
|
|
|
AsylumEvent updateEvt = AsylumEvent(EVENT_ASYLUM_UPDATE);
|
|
|
|
_handler->handleEvent(updateEvt);
|
2009-06-13 13:29:56 +00:00
|
|
|
}
|
|
|
|
|
2009-07-09 11:23:42 +00:00
|
|
|
void AsylumEngine::processDelayedEvents() {
|
2010-11-16 14:24:17 +00:00
|
|
|
if (!_video || !_sound || !_scene || !_mainMenu)
|
|
|
|
error("[AsylumEngine::processDelayedEvents] Subsystems not initialized properly!");
|
|
|
|
|
2009-07-09 11:23:42 +00:00
|
|
|
// check for a delayed video
|
2010-11-03 04:27:41 +00:00
|
|
|
int videoIdx = _scene->actions()->getDelayedVideoIndex();
|
2009-07-09 02:14:07 +00:00
|
|
|
if (videoIdx >= 0) {
|
2009-06-21 12:09:44 +00:00
|
|
|
_sound->stopMusic();
|
2010-11-10 12:08:50 +00:00
|
|
|
_sound->stopAll();
|
2010-11-28 19:25:03 +00:00
|
|
|
_video->playVideo(videoIdx);
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->actions()->setDelayedVideoIndex(-1);
|
2009-06-21 12:09:44 +00:00
|
|
|
|
2010-12-01 19:20:53 +00:00
|
|
|
//if (_mainMenu->isActive())
|
|
|
|
// _mainMenu->openMenu();
|
|
|
|
if (_scene->isActive())
|
2010-11-10 20:45:19 +00:00
|
|
|
_scene->activate();
|
2009-06-21 12:09:44 +00:00
|
|
|
}
|
2009-07-07 13:59:11 +00:00
|
|
|
|
2009-07-09 11:23:42 +00:00
|
|
|
// check for a delayed scene change
|
2010-11-08 21:08:56 +00:00
|
|
|
ResourcePackId packId = _scene->actions()->getDelayedSceneIndex();
|
2009-11-28 12:30:02 +00:00
|
|
|
// XXX Flag 183 indicates whether the actionlist is currently
|
|
|
|
// processing
|
2010-11-16 14:24:27 +00:00
|
|
|
if (packId != kResourcePackInvalid && isGameFlagNotSet(kGameFlagScriptProcessing)) {
|
2010-11-05 00:35:45 +00:00
|
|
|
|
|
|
|
// Reset delayed scene
|
2010-11-08 21:08:56 +00:00
|
|
|
_scene->actions()->setDelayedSceneIndex(kResourcePackInvalid);
|
2010-11-05 00:35:45 +00:00
|
|
|
|
2009-07-07 13:59:11 +00:00
|
|
|
_sound->stopMusic();
|
2010-11-10 12:08:50 +00:00
|
|
|
_sound->stopAll();
|
2009-09-21 19:11:49 +00:00
|
|
|
|
2009-07-08 19:17:47 +00:00
|
|
|
if (_scene)
|
|
|
|
delete _scene;
|
2009-07-07 13:59:11 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
_scene = new Scene(this);
|
|
|
|
_scene->enter(packId);
|
2009-07-07 13:59:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:29:08 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Message handlers
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2010-11-27 00:04:43 +00:00
|
|
|
void AsylumEngine::switchEventHandler(EventHandler *handler) {
|
2010-11-27 00:03:41 +00:00
|
|
|
if (handler == NULL)
|
|
|
|
error("[AsylumEngine::switchMessageHandler] Invalid handler parameter (cannot be NULL)!");
|
|
|
|
|
|
|
|
// De-init previous handler
|
|
|
|
if (_handler != NULL) {
|
2010-11-27 00:03:53 +00:00
|
|
|
AsylumEvent deinit(EVENT_ASYLUM_DEINIT);
|
2010-11-27 00:04:43 +00:00
|
|
|
_handler->handleEvent(deinit);
|
2010-11-27 00:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// replace message handler
|
|
|
|
_handler = handler;
|
|
|
|
|
|
|
|
// Init new handler
|
2010-11-27 00:03:53 +00:00
|
|
|
AsylumEvent init(EVENT_ASYLUM_INIT);
|
2010-11-27 00:04:43 +00:00
|
|
|
_handler->handleEvent(init);
|
|
|
|
}
|
|
|
|
|
|
|
|
EventHandler *AsylumEngine::getPuzzle(uint32 index) {
|
|
|
|
if (index >= ARRAYSIZE(_puzzles))
|
|
|
|
error("[AsylumEngine::getPuzzleEventHandler] Invalid index (was: %d - max: %d)", index, ARRAYSIZE(_puzzles));
|
|
|
|
|
|
|
|
if (_puzzles[index] == NULL)
|
|
|
|
error("[AsylumEngine::getPuzzleEventHandler] This puzzle doesn't have an event handler! (index: %d)", index);
|
|
|
|
|
2010-11-27 00:04:47 +00:00
|
|
|
_puzzles[index]->init();
|
|
|
|
|
|
|
|
return (EventHandler *)_puzzles[index];
|
2010-11-03 04:29:08 +00:00
|
|
|
}
|
|
|
|
|
2010-11-27 00:04:43 +00:00
|
|
|
void AsylumEngine::initPuzzles() {
|
|
|
|
_puzzles[0] = new BlowUpPuzzleVCR(this);
|
|
|
|
_puzzles[1] = NULL;
|
|
|
|
_puzzles[2] = NULL;
|
|
|
|
_puzzles[3] = NULL;
|
|
|
|
_puzzles[4] = NULL;
|
|
|
|
_puzzles[5] = NULL;
|
|
|
|
_puzzles[6] = NULL;
|
|
|
|
_puzzles[7] = NULL;
|
|
|
|
_puzzles[8] = NULL;
|
|
|
|
_puzzles[9] = NULL;
|
|
|
|
_puzzles[10] = NULL;
|
|
|
|
_puzzles[11] = NULL;
|
|
|
|
_puzzles[12] = NULL;
|
|
|
|
_puzzles[13] = NULL;
|
|
|
|
_puzzles[14] = NULL;
|
|
|
|
_puzzles[15] = NULL;
|
|
|
|
_puzzles[16] = NULL;
|
|
|
|
|
|
|
|
warning("[AsylumEngine::initPuzzles] Add missing puzzles");
|
2010-11-03 04:29:08 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Game flags
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2010-11-16 14:24:17 +00:00
|
|
|
#define FLAG_MASK 0xFFFFFFE0
|
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
void AsylumEngine::setGameFlag(GameFlag flag) {
|
2010-11-16 14:24:17 +00:00
|
|
|
_gameFlags[flag / 32] |= 1 << (flag % FLAG_MASK);
|
2009-09-19 14:25:43 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
void AsylumEngine::clearGameFlag(GameFlag flag) {
|
2010-11-16 14:24:17 +00:00
|
|
|
_gameFlags[flag / 32] &= ~(1 << (uint32)(flag % FLAG_MASK));
|
2009-09-19 14:25:43 +00:00
|
|
|
}
|
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
void AsylumEngine::toggleGameFlag(GameFlag flag) {
|
2010-11-16 14:24:17 +00:00
|
|
|
_gameFlags[flag / 32] ^= 1 << (uint32)(flag % FLAG_MASK);
|
2009-09-19 14:25:43 +00:00
|
|
|
}
|
|
|
|
|
2010-11-16 14:24:17 +00:00
|
|
|
bool AsylumEngine::isGameFlagSet(GameFlag flag) const {
|
|
|
|
return ((1 << (flag % FLAG_MASK)) & (unsigned int)_gameFlags[flag / 32]) >> (flag % FLAG_MASK) != 0;
|
2009-09-19 14:25:43 +00:00
|
|
|
}
|
|
|
|
|
2010-11-16 14:24:17 +00:00
|
|
|
bool AsylumEngine::isGameFlagNotSet(GameFlag flag) const {
|
|
|
|
return ((1 << (flag % FLAG_MASK)) & (unsigned int)_gameFlags[flag / 32]) >> (flag % FLAG_MASK) == 0;
|
2009-09-19 14:25:43 +00:00
|
|
|
}
|
|
|
|
|
2009-06-12 12:40:18 +00:00
|
|
|
} // namespace Asylum
|