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-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-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),
|
|
|
|
_console(NULL), _encounter(NULL), _resource(NULL), _mainMenu(NULL), _scene(NULL), _screen(NULL),
|
|
|
|
_sound(NULL), _text(NULL), _video(NULL) {
|
2010-11-03 04:27:47 +00:00
|
|
|
|
2010-11-09 00:58:34 +00:00
|
|
|
// Init data
|
2010-11-08 21:09:13 +00:00
|
|
|
memset(_gameFlags, 0, 1512);
|
2010-11-09 00:58:34 +00:00
|
|
|
memset(_gameFlags, 0, sizeof(_gameFlags));
|
|
|
|
screenUpdatesCount = 0;
|
|
|
|
globalTickValue_2 = 0;
|
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-03 04:27:47 +00:00
|
|
|
delete _scene;
|
2010-11-09 03:10:09 +00:00
|
|
|
delete _encounter;
|
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-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);
|
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);
|
2009-08-09 22:56:13 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
// Create main menu
|
|
|
|
_mainMenu = new MainMenu(this);
|
2009-11-27 02:02:00 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
// FIXME: remove
|
|
|
|
_introPlaying = false;
|
2009-06-12 12:40:18 +00:00
|
|
|
|
2009-12-01 22:42:11 +00:00
|
|
|
// TODO: save dialogue key codes into sntrm_k.txt (need to figure out why they use such thing) (address 00411CD0)
|
|
|
|
// load startup configurations (.text:0041A970)
|
|
|
|
Config.read();
|
|
|
|
// TODO: init unknown game stuffs (.text:0040F430)
|
2009-08-01 17:51:26 +00:00
|
|
|
|
2009-12-01 22:42:11 +00:00
|
|
|
// TODO: if savegame not exists on folder, than start game()
|
2010-10-05 19:50:24 +00:00
|
|
|
//if(0) { //SearchMan.hasArchive
|
2010-11-08 21:09:13 +00:00
|
|
|
startGame(kResourcePackTowerCells, kStartGamePlayIntro);
|
2010-10-05 19:50:24 +00:00
|
|
|
//} else {
|
|
|
|
// _mainMenu->openMenu();
|
|
|
|
//}
|
2010-11-09 00:58:34 +00:00
|
|
|
//
|
2009-06-12 12:40:18 +00:00
|
|
|
|
|
|
|
while (!shouldQuit()) {
|
2010-11-03 04:27:47 +00:00
|
|
|
handleEvents(true);
|
2009-06-28 11:59:25 +00:00
|
|
|
waitForTimer(55);
|
2009-06-13 13:40:48 +00:00
|
|
|
}
|
|
|
|
|
2009-07-08 19:17:47 +00:00
|
|
|
return Common::kNoError;
|
2009-06-13 13:40:48 +00:00
|
|
|
}
|
2009-06-12 21:09:17 +00:00
|
|
|
|
2009-06-13 13:40:48 +00:00
|
|
|
void AsylumEngine::waitForTimer(int msec_delay) {
|
|
|
|
uint32 start_time = _system->getMillis();
|
|
|
|
|
|
|
|
while (_system->getMillis() < start_time + msec_delay) {
|
2010-11-03 04:27:47 +00:00
|
|
|
handleEvents(false);
|
2010-10-05 19:50:24 +00:00
|
|
|
if (_scene) {
|
|
|
|
processDelayedEvents();
|
|
|
|
}
|
2009-06-13 13:40:48 +00:00
|
|
|
_system->updateScreen();
|
2009-06-12 12:40:18 +00:00
|
|
|
}
|
2009-06-13 13:40:48 +00:00
|
|
|
}
|
2009-06-12 12:40:18 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
void AsylumEngine::startGame(ResourcePackId sceneId, StartGameType type) {
|
|
|
|
// 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
|
|
|
}
|
|
|
|
|
2009-08-09 13:24:36 +00:00
|
|
|
void AsylumEngine::playIntro() {
|
2010-10-05 19:50:24 +00:00
|
|
|
_introPlaying = true;
|
|
|
|
g_system->showMouse(false);
|
2009-12-01 00:37:12 +00:00
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
if (Config.showIntro)
|
|
|
|
_video->playVideo(1, Config.showMovieSubtitles);
|
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
|
|
|
|
|
|
|
_screen->clearScreen();
|
|
|
|
|
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-11-03 04:27:47 +00:00
|
|
|
void AsylumEngine::handleEvents(bool doUpdate) { // k_sub_40AE30 (0040AE30)
|
|
|
|
// Make sure the debugger is present
|
|
|
|
if (!_console)
|
|
|
|
error("AsylumEngine::handleEvents: called before the required subsystems have been initialized!");
|
|
|
|
|
|
|
|
// Show the debugger if required
|
|
|
|
_console->onFrame();
|
2009-08-09 22:56:13 +00:00
|
|
|
|
|
|
|
// NOTE
|
|
|
|
// In the original version of Sanitarium, the control loop for the sound
|
|
|
|
// effect that played after the intro video involved a while loop that
|
|
|
|
// executed until the sound handle was released.
|
|
|
|
// This caused the application to be locked until the while loop's execution
|
|
|
|
// completed successfully. Our implementation circumvents this issue
|
|
|
|
// by moving the logic to the event loop and checking whether a flag is
|
|
|
|
// set to determine if control should be returned to the engine.
|
|
|
|
if (_introPlaying) {
|
2010-11-08 21:09:02 +00:00
|
|
|
if (!_sound->isPlaying(MAKE_RESOURCE(kResourcePackSound, 7))) {
|
2009-08-09 22:56:13 +00:00
|
|
|
_introPlaying = false;
|
|
|
|
|
|
|
|
// TODO Since we've currently only got one sfx handle to play with in
|
|
|
|
// the sound class, entering the scene overwrites the "alarm" loop.
|
|
|
|
// This sound is technically supposed to play until the actor disables
|
|
|
|
// the alarm by flipping the switch. The sound class needs to be extended
|
|
|
|
// to be able to handle multiple handles.
|
|
|
|
// The currently active sound resources can probably also be buffered into
|
2010-11-03 04:28:42 +00:00
|
|
|
// the scene's soundResourceId[] array (seems that's the way the original worked,
|
2009-08-09 22:56:13 +00:00
|
|
|
// especially when you examine isSoundinList() or isSoundPlaying())
|
|
|
|
|
2010-11-08 21:09:13 +00:00
|
|
|
//_scene->enterScene();
|
2009-08-09 22:56:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-13 13:40:48 +00:00
|
|
|
Common::Event ev;
|
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
if (_eventMan->pollEvent(ev)) {
|
|
|
|
switch (ev.type) {
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Common::EVENT_KEYDOWN:
|
|
|
|
if ((ev.kbd.flags & Common::KBD_CTRL) && ev.kbd.keycode == Common::KEYCODE_d)
|
|
|
|
_console->attach();
|
|
|
|
|
2009-06-13 13:40:48 +00:00
|
|
|
if (ev.kbd.keycode == Common::KEYCODE_ESCAPE) {
|
2009-06-15 12:28:19 +00:00
|
|
|
// Toggle menu
|
|
|
|
if (_mainMenu->isActive()) {
|
2010-10-05 19:50:24 +00:00
|
|
|
if (_scene) {
|
|
|
|
_mainMenu->closeMenu();
|
2010-11-10 20:45:19 +00:00
|
|
|
_scene->activate();
|
2010-10-05 19:50:24 +00:00
|
|
|
}
|
2009-12-01 22:42:11 +00:00
|
|
|
} else if (_scene && _scene->isActive()) {
|
2009-06-15 12:28:19 +00:00
|
|
|
_mainMenu->openMenu();
|
2010-10-05 19:50:24 +00:00
|
|
|
}
|
|
|
|
/* FIXME
|
2009-12-01 22:42:11 +00:00
|
|
|
} else if (_scene && _scene->getBlowUpPuzzle()->isActive()) {
|
2009-09-21 19:11:49 +00:00
|
|
|
_scene->getBlowUpPuzzle()->closeBlowUp();
|
|
|
|
_scene->enterScene();
|
2009-06-15 12:28:19 +00:00
|
|
|
}
|
2010-01-13 11:53:51 +00:00
|
|
|
*/
|
2009-06-15 12:28:19 +00:00
|
|
|
return;
|
2009-06-13 13:40:48 +00:00
|
|
|
}
|
2009-06-21 12:09:44 +00:00
|
|
|
|
2009-09-21 19:11:49 +00:00
|
|
|
// XXX: TEST ONLY
|
2010-01-13 11:53:51 +00:00
|
|
|
/*
|
2009-09-21 19:11:49 +00:00
|
|
|
if (ev.kbd.keycode == Common::KEYCODE_b) {
|
2010-10-05 19:50:24 +00:00
|
|
|
if (_scene) {
|
|
|
|
_scene->getBlowUpPuzzle()->openBlowUp();
|
|
|
|
}
|
2009-09-21 19:11:49 +00:00
|
|
|
}
|
2010-01-13 11:53:51 +00:00
|
|
|
*/
|
2010-11-03 04:27:47 +00:00
|
|
|
break;
|
2009-06-13 13:29:56 +00:00
|
|
|
}
|
|
|
|
}
|
2009-06-13 19:38:25 +00:00
|
|
|
|
|
|
|
if (doUpdate) {
|
2010-10-05 19:50:24 +00:00
|
|
|
if (_mainMenu->isActive() ||
|
|
|
|
(_scene && _scene->isActive())) //|| (_scene && _scene->getBlowUpPuzzle()->isActive()))
|
2009-06-21 12:09:44 +00:00
|
|
|
// Copy background image
|
|
|
|
_screen->copyBackBufferToScreen();
|
2009-06-13 19:38:25 +00:00
|
|
|
}
|
2009-06-15 12:28:19 +00:00
|
|
|
|
2010-10-05 19:50:24 +00:00
|
|
|
|
2009-08-09 13:28:49 +00:00
|
|
|
if (_mainMenu->isActive())
|
2009-06-15 12:28:19 +00:00
|
|
|
// Main menu active, pass events to it
|
|
|
|
_mainMenu->handleEvent(&ev, doUpdate);
|
2009-12-01 22:42:11 +00:00
|
|
|
else if (_scene && _scene->isActive())
|
2009-06-15 12:28:19 +00:00
|
|
|
// Pass events to the game
|
2009-06-15 14:15:12 +00:00
|
|
|
_scene->handleEvent(&ev, doUpdate);
|
2010-10-05 19:50:24 +00:00
|
|
|
/* FIXME reimplement
|
2009-12-01 22:42:11 +00:00
|
|
|
else if (_scene && _scene->getBlowUpPuzzle()->isActive())
|
2009-08-01 17:51:26 +00:00
|
|
|
// Pass events to BlowUp Puzzles
|
2009-08-06 00:04:09 +00:00
|
|
|
_scene->getBlowUpPuzzle()->handleEvent(&ev, doUpdate);
|
2010-01-13 11:53:51 +00:00
|
|
|
*/
|
2009-06-13 13:29:56 +00:00
|
|
|
}
|
|
|
|
|
2009-07-09 11:23:42 +00:00
|
|
|
void AsylumEngine::processDelayedEvents() {
|
|
|
|
// 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-03 04:29:37 +00:00
|
|
|
_video->playVideo(videoIdx, true);
|
2010-11-03 04:27:41 +00:00
|
|
|
_scene->actions()->setDelayedVideoIndex(-1);
|
2009-06-21 12:09:44 +00:00
|
|
|
|
2009-08-09 13:28:49 +00:00
|
|
|
if (_mainMenu->isActive())
|
2009-06-21 12:09:44 +00:00
|
|
|
_mainMenu->openMenu();
|
2010-11-10 20:45:19 +00:00
|
|
|
else if (_scene->isActive())
|
|
|
|
_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-08 21:08:56 +00:00
|
|
|
if (packId >= 0 && 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
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
void AsylumEngine::switchMessageHandler(MessageHandler *handler) {
|
|
|
|
error("[AsylumEngine::switchMessageHandler] not implemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
AsylumEngine::MessageHandler *AsylumEngine::getMessageHandler(uint32 index) {
|
|
|
|
error("[AsylumEngine::getMessageHandler] not implemented");
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:27:47 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Game flags
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2010-11-03 04:28:19 +00:00
|
|
|
void AsylumEngine::setGameFlag(GameFlag flag) {
|
2009-09-19 14:25:43 +00:00
|
|
|
_gameFlags[flag / 32] |= 1 << flag % -32;
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
void AsylumEngine::clearGameFlag(GameFlag flag) {
|
2009-09-19 14:25:43 +00:00
|
|
|
_gameFlags[flag / 32] &= ~(1 << flag % -32);
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
void AsylumEngine::toggleGameFlag(GameFlag flag) {
|
2009-09-19 14:25:43 +00:00
|
|
|
_gameFlags[flag / 32] ^= 1 << flag % -32;
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
bool AsylumEngine::isGameFlagSet(GameFlag flag) {
|
2009-09-19 14:25:43 +00:00
|
|
|
return ((1 << flag % -32) & (unsigned int)_gameFlags[flag / 32]) >> flag % -32 != 0;
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:28:19 +00:00
|
|
|
bool AsylumEngine::isGameFlagNotSet(GameFlag flag) {
|
2009-09-19 14:25:43 +00:00
|
|
|
return ((1 << flag % -32) & (unsigned int)_gameFlags[flag / 32]) >> flag % -32 == 0;
|
|
|
|
}
|
|
|
|
|
2010-11-03 04:28:02 +00:00
|
|
|
void AsylumEngine::setFlag(FlagType flag, bool isSet) {
|
|
|
|
if (flag > ARRAYSIZE(_flags))
|
|
|
|
error("[AsylumEngine::setFlag] Invalid flag type (was: %d, max: %d", flag, ARRAYSIZE(_flags));
|
|
|
|
|
|
|
|
_flags[flag] = isSet;
|
|
|
|
}
|
|
|
|
|
2009-06-12 12:40:18 +00:00
|
|
|
} // namespace Asylum
|