2011-12-31 22:53:24 +11: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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-03-29 16:39:18 +02:00
|
|
|
/*
|
|
|
|
* This code is based on original Mortville Manor DOS source code
|
|
|
|
* Copyright (c) 1987-1989 Lankhor
|
|
|
|
*/
|
|
|
|
|
2012-01-05 07:56:45 +11:00
|
|
|
#include "common/system.h"
|
2012-02-12 12:34:51 +11:00
|
|
|
#include "common/config-manager.h"
|
2012-01-17 01:09:11 +11:00
|
|
|
#include "common/debug-channels.h"
|
2012-01-03 20:47:05 +11:00
|
|
|
#include "engines/util.h"
|
2012-01-05 07:56:45 +11:00
|
|
|
#include "engines/engine.h"
|
|
|
|
#include "graphics/palette.h"
|
|
|
|
#include "graphics/pixelformat.h"
|
2011-12-31 22:53:24 +11:00
|
|
|
#include "mortevielle/mortevielle.h"
|
2012-02-13 20:51:36 +11:00
|
|
|
#include "mortevielle/dialogs.h"
|
2012-02-12 12:34:51 +11:00
|
|
|
#include "mortevielle/menu.h"
|
2012-01-17 23:52:36 +11:00
|
|
|
#include "mortevielle/mouse.h"
|
2012-02-26 02:04:25 +01:00
|
|
|
#include "mortevielle/outtext.h"
|
2012-02-12 12:34:51 +11:00
|
|
|
#include "mortevielle/saveload.h"
|
2012-03-10 09:46:51 +01:00
|
|
|
#include "mortevielle/outtext.h"
|
2011-12-31 22:53:24 +11:00
|
|
|
|
|
|
|
namespace Mortevielle {
|
|
|
|
|
2012-01-05 07:56:45 +11:00
|
|
|
MortevielleEngine *g_vm;
|
|
|
|
|
2011-12-31 22:53:24 +11:00
|
|
|
MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc):
|
2012-02-05 11:02:29 +11:00
|
|
|
Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle"),
|
|
|
|
_soundManager(_mixer) {
|
2012-01-05 07:56:45 +11:00
|
|
|
g_vm = this;
|
2013-02-21 00:53:52 +01:00
|
|
|
_debugger.setParent(this);
|
2013-06-26 08:29:09 +02:00
|
|
|
_dialogManager.setParent(this);
|
2013-06-25 20:40:06 +02:00
|
|
|
_screenSurface.setParent(this);
|
2013-06-25 21:01:49 +02:00
|
|
|
_mouse.setParent(this);
|
2013-06-25 21:49:30 +02:00
|
|
|
_text.setParent(this);
|
2013-06-26 01:06:22 +02:00
|
|
|
_soundManager.setParent(this);
|
2013-06-26 07:42:49 +02:00
|
|
|
_speechManager.setParent(this);
|
2013-06-25 20:40:06 +02:00
|
|
|
|
2012-01-17 23:52:36 +11:00
|
|
|
_lastGameFrame = 0;
|
2012-01-21 20:06:08 +11:00
|
|
|
_mouseClick = false;
|
2012-02-12 12:34:51 +11:00
|
|
|
_inMainGameLoop = false;
|
2012-02-12 14:22:56 +11:00
|
|
|
_quitGame = false;
|
2012-03-09 22:25:28 +01:00
|
|
|
|
|
|
|
_roomPresenceLuc = false;
|
|
|
|
_roomPresenceIda = false;
|
|
|
|
_purpleRoomPresenceLeo = false;
|
|
|
|
_roomPresenceGuy = false;
|
|
|
|
_roomPresenceEva = false;
|
|
|
|
_roomPresenceMax = false;
|
|
|
|
_roomPresenceBob = false;
|
|
|
|
_roomPresencePat = false;
|
|
|
|
_toiletsPresenceBobMax = false;
|
|
|
|
_bathRoomPresenceBobMax = false;
|
|
|
|
_room9PresenceLeo = false;
|
2012-03-27 22:54:50 +02:00
|
|
|
|
2012-03-09 22:25:28 +01:00
|
|
|
_soundOff = false;
|
|
|
|
_largestClearScreen = false;
|
|
|
|
_hiddenHero = false;
|
|
|
|
_heroSearching = false;
|
|
|
|
_keyPressedEsc = false;
|
|
|
|
_reloadCFIEC = false;
|
|
|
|
|
|
|
|
_blo = false;
|
|
|
|
_col = false;
|
|
|
|
_syn = false;
|
|
|
|
_obpart = false;
|
2012-10-12 07:31:30 +02:00
|
|
|
_destinationOk = false;
|
2012-03-09 22:25:28 +01:00
|
|
|
_anyone = false;
|
2012-10-12 07:31:30 +02:00
|
|
|
_uptodatePresence = false;
|
2012-03-10 08:21:09 +01:00
|
|
|
|
|
|
|
_textColor = 0;
|
|
|
|
_currGraphicalDevice = -1;
|
|
|
|
_newGraphicalDevice = -1;
|
2012-03-13 00:06:15 +01:00
|
|
|
_place = -1;
|
2012-03-10 08:21:09 +01:00
|
|
|
|
2012-10-10 08:19:54 +02:00
|
|
|
_x26KeyCount = -1;
|
2012-06-14 18:47:03 +02:00
|
|
|
_caff = -1;
|
2012-06-15 20:39:03 +02:00
|
|
|
_day = 0;
|
2012-06-15 00:27:59 +02:00
|
|
|
|
|
|
|
memset(_mem, 0, sizeof(_mem));
|
2011-12-31 22:53:24 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
MortevielleEngine::~MortevielleEngine() {
|
2013-06-30 13:26:07 -06:00
|
|
|
// Allocated from run() > initialise() > loadCFIPH()
|
|
|
|
free(_speechManager._cfiphBuffer);
|
|
|
|
// Allocated from run() > initialise() > loadCFIEC()
|
|
|
|
free(_cfiecBuffer);
|
2011-12-31 22:53:24 +11:00
|
|
|
}
|
|
|
|
|
2012-02-12 12:34:51 +11:00
|
|
|
/**
|
|
|
|
* Specifies whether the engine supports given features
|
|
|
|
*/
|
2011-12-31 22:53:24 +11:00
|
|
|
bool MortevielleEngine::hasFeature(EngineFeature f) const {
|
2012-02-12 12:34:51 +11:00
|
|
|
return
|
|
|
|
(f == kSupportsRTL) ||
|
|
|
|
(f == kSupportsLoadingDuringRuntime) ||
|
|
|
|
(f == kSupportsSavingDuringRuntime);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if a game can currently be loaded
|
|
|
|
*/
|
|
|
|
bool MortevielleEngine::canLoadGameStateCurrently() {
|
|
|
|
// Saving is only allowed in the main game event loop
|
|
|
|
return _inMainGameLoop;
|
2011-12-31 22:53:24 +11:00
|
|
|
}
|
|
|
|
|
2012-02-12 12:34:51 +11:00
|
|
|
/**
|
|
|
|
* Return true if a game can currently be saved
|
|
|
|
*/
|
|
|
|
bool MortevielleEngine::canSaveGameStateCurrently() {
|
|
|
|
// Loading is only allowed in the main game event loop
|
|
|
|
return _inMainGameLoop;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load in a savegame at the specified slot number
|
|
|
|
*/
|
|
|
|
Common::Error MortevielleEngine::loadGameState(int slot) {
|
2012-03-27 22:54:50 +02:00
|
|
|
return _savegameManager.loadGame(slot);
|
2012-02-12 12:34:51 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the current game
|
|
|
|
*/
|
|
|
|
Common::Error MortevielleEngine::saveGameState(int slot, const Common::String &desc) {
|
|
|
|
if (slot == 0)
|
|
|
|
return Common::kWritingFailed;
|
2012-03-27 22:54:50 +02:00
|
|
|
|
2012-02-12 12:34:51 +11:00
|
|
|
return _savegameManager.saveGame(slot, desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialise the game state
|
|
|
|
*/
|
2012-01-05 07:56:45 +11:00
|
|
|
Common::ErrorCode MortevielleEngine::initialise() {
|
2012-01-03 20:47:05 +11:00
|
|
|
// Initialise graphics mode
|
|
|
|
initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, true);
|
|
|
|
|
2012-01-17 01:09:11 +11:00
|
|
|
// Set debug channels
|
|
|
|
DebugMan.addDebugChannel(kMortevielleCore, "core", "Core debugging");
|
|
|
|
DebugMan.addDebugChannel(kMortevielleGraphics, "graphics", "Graphics debugging");
|
|
|
|
|
2012-01-05 07:56:45 +11:00
|
|
|
// Set up an intermediate screen surface
|
|
|
|
_screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
|
|
|
|
|
|
|
|
// Set the screen mode
|
2012-03-11 23:21:34 +01:00
|
|
|
_currGraphicalDevice = MODE_EGA;
|
2012-10-14 21:59:27 +02:00
|
|
|
_resolutionScaler = 2;
|
2012-01-05 07:56:45 +11:00
|
|
|
|
2012-02-26 02:04:25 +01:00
|
|
|
_txxFileFl = false;
|
|
|
|
// Load texts from TXX files
|
2012-03-22 00:13:11 +01:00
|
|
|
loadTexts();
|
2012-02-26 02:04:25 +01:00
|
|
|
|
2012-01-05 07:56:45 +11:00
|
|
|
// Load the mort.dat resource
|
2012-01-20 16:31:15 +11:00
|
|
|
Common::ErrorCode result = loadMortDat();
|
|
|
|
if (result != Common::kNoError)
|
|
|
|
return result;
|
|
|
|
|
2012-02-26 02:04:25 +01:00
|
|
|
// Load some error messages (was previously in chartex())
|
2012-03-21 08:32:36 +01:00
|
|
|
_hintPctMessage = getString(580); // You should have noticed %d hints
|
2012-02-26 02:04:25 +01:00
|
|
|
|
2012-01-20 16:31:15 +11:00
|
|
|
// Set default EGA palette
|
|
|
|
_paletteManager.setDefaultPalette();
|
|
|
|
|
|
|
|
// Setup the mouse cursor
|
|
|
|
initMouse();
|
|
|
|
|
2012-03-11 23:21:34 +01:00
|
|
|
_currGraphicalDevice = MODE_EGA;
|
|
|
|
_newGraphicalDevice = _currGraphicalDevice;
|
2012-03-22 00:13:11 +01:00
|
|
|
loadPalette();
|
2012-03-09 22:25:28 +01:00
|
|
|
loadCFIPH();
|
|
|
|
loadCFIEC();
|
2012-03-29 12:49:25 +02:00
|
|
|
decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64);
|
2012-10-10 08:19:54 +02:00
|
|
|
_x26KeyCount = 1;
|
2012-02-07 22:40:06 +11:00
|
|
|
init_nbrepm();
|
2012-02-19 21:15:57 +01:00
|
|
|
initMouse();
|
2012-02-07 22:40:06 +11:00
|
|
|
|
2012-03-11 23:06:33 +01:00
|
|
|
loadPlaces();
|
2012-03-08 08:24:54 +01:00
|
|
|
_soundOff = false;
|
|
|
|
_largestClearScreen = false;
|
2012-02-12 22:54:41 +11:00
|
|
|
|
2012-03-24 22:00:28 +01:00
|
|
|
testKeyboard();
|
2012-03-22 00:13:11 +01:00
|
|
|
showConfigScreen();
|
2012-03-11 23:21:34 +01:00
|
|
|
_newGraphicalDevice = _currGraphicalDevice;
|
2012-03-24 22:00:28 +01:00
|
|
|
testKeyboard();
|
2012-03-11 23:21:34 +01:00
|
|
|
if (_newGraphicalDevice != _currGraphicalDevice)
|
|
|
|
_currGraphicalDevice = _newGraphicalDevice;
|
2012-02-07 22:40:06 +11:00
|
|
|
hirs();
|
|
|
|
|
2012-01-20 16:31:15 +11:00
|
|
|
return Common::kNoError;
|
2012-01-05 07:56:45 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads the contents of the Mort.dat data file
|
|
|
|
*/
|
|
|
|
Common::ErrorCode MortevielleEngine::loadMortDat() {
|
|
|
|
Common::File f;
|
|
|
|
|
|
|
|
// Open the mort.dat file
|
|
|
|
if (!f.open(MORT_DAT)) {
|
|
|
|
GUIErrorMessage("Could not locate Mort.dat file");
|
|
|
|
return Common::kReadingFailed;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Validate the data file header
|
|
|
|
char fileId[4];
|
|
|
|
f.read(fileId, 4);
|
|
|
|
if (strncmp(fileId, "MORT", 4) != 0) {
|
|
|
|
GUIErrorMessage("The located mort.dat data file is invalid");
|
|
|
|
return Common::kReadingFailed;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check the version
|
|
|
|
if (f.readByte() < MORT_DAT_REQUIRED_VERSION) {
|
|
|
|
GUIErrorMessage("The located mort.dat data file is too a version");
|
|
|
|
return Common::kReadingFailed;
|
|
|
|
}
|
|
|
|
f.readByte(); // Minor version
|
|
|
|
|
|
|
|
// Loop to load resources from the data file
|
|
|
|
while (f.pos() < f.size()) {
|
|
|
|
// Get the Id and size of the next resource
|
|
|
|
char dataType[4];
|
|
|
|
int dataSize;
|
|
|
|
f.read(dataType, 4);
|
|
|
|
dataSize = f.readUint16LE();
|
|
|
|
|
|
|
|
if (!strncmp(dataType, "FONT", 4)) {
|
|
|
|
// Font resource
|
2012-01-16 09:19:50 +11:00
|
|
|
_screenSurface.readFontData(f, dataSize);
|
2012-02-12 19:40:03 +11:00
|
|
|
} else if (!strncmp(dataType, "SSTR", 4)) {
|
2012-02-26 02:04:25 +01:00
|
|
|
readStaticStrings(f, dataSize, kStaticStrings);
|
|
|
|
} else if ((!strncmp(dataType, "GSTR", 4)) && (!_txxFileFl)) {
|
|
|
|
readStaticStrings(f, dataSize, kGameStrings);
|
2012-01-05 07:56:45 +11:00
|
|
|
} else {
|
|
|
|
// Unknown section
|
|
|
|
f.skip(dataSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-12 19:40:03 +11:00
|
|
|
// Close the file
|
2012-01-05 07:56:45 +11:00
|
|
|
f.close();
|
2012-02-12 19:40:03 +11:00
|
|
|
|
2012-02-25 21:13:24 +01:00
|
|
|
assert(_engineStrings.size() > 0);
|
2012-01-05 07:56:45 +11:00
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
2012-02-12 19:40:03 +11:00
|
|
|
/**
|
|
|
|
* Read in a static strings block, and if the language matches, load up the static strings
|
|
|
|
*/
|
2012-02-26 02:04:25 +01:00
|
|
|
void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize, DataType dataType) {
|
2012-02-12 19:40:03 +11:00
|
|
|
// Figure out what language Id is needed
|
2012-03-29 12:40:49 +02:00
|
|
|
byte desiredLanguageId;
|
|
|
|
switch(getLanguage()) {
|
|
|
|
case Common::EN_ANY:
|
|
|
|
desiredLanguageId = LANG_ENGLISH;
|
|
|
|
break;
|
|
|
|
case Common::FR_FRA:
|
|
|
|
desiredLanguageId = LANG_FRENCH;
|
|
|
|
break;
|
|
|
|
case Common::DE_DEU:
|
|
|
|
desiredLanguageId = LANG_GERMAN;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
warning("Language not supported, switching to English");
|
|
|
|
desiredLanguageId = LANG_ENGLISH;
|
|
|
|
break;
|
|
|
|
}
|
2012-02-12 19:40:03 +11:00
|
|
|
|
|
|
|
// Read in the language
|
|
|
|
byte languageId = f.readByte();
|
|
|
|
--dataSize;
|
|
|
|
|
|
|
|
// If the language isn't correct, then skip the entire block
|
|
|
|
if (languageId != desiredLanguageId) {
|
|
|
|
f.skip(dataSize);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Load in each of the strings
|
|
|
|
while (dataSize > 0) {
|
|
|
|
Common::String s;
|
|
|
|
char ch;
|
|
|
|
while ((ch = (char)f.readByte()) != '\0')
|
|
|
|
s += ch;
|
2012-03-27 22:54:50 +02:00
|
|
|
|
2012-02-26 02:04:25 +01:00
|
|
|
if (dataType == kStaticStrings)
|
|
|
|
_engineStrings.push_back(s);
|
|
|
|
else if (dataType == kGameStrings)
|
|
|
|
_gameStrings.push_back(s);
|
|
|
|
|
2012-02-12 19:40:03 +11:00
|
|
|
dataSize -= s.size() + 1;
|
|
|
|
}
|
|
|
|
assert(dataSize == 0);
|
|
|
|
}
|
|
|
|
|
2012-01-05 07:56:45 +11:00
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
Common::Error MortevielleEngine::run() {
|
|
|
|
// Initialise the game
|
|
|
|
Common::ErrorCode err = initialise();
|
|
|
|
if (err != Common::kNoError)
|
|
|
|
return err;
|
|
|
|
|
2012-02-12 12:34:51 +11:00
|
|
|
// Check for a savegame
|
|
|
|
int loadSlot = 0;
|
|
|
|
if (ConfMan.hasKey("save_slot")) {
|
|
|
|
int gameToLoad = ConfMan.getInt("save_slot");
|
2012-02-21 22:36:45 +01:00
|
|
|
if ((gameToLoad >= 1) && (gameToLoad <= 999))
|
2012-02-12 12:34:51 +11:00
|
|
|
loadSlot = gameToLoad;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (loadSlot == 0)
|
|
|
|
// Show the game introduction
|
|
|
|
showIntroduction();
|
2012-02-07 22:40:06 +11:00
|
|
|
|
2012-02-12 12:34:51 +11:00
|
|
|
// Either load the initial game state savegame, or the specified savegame number
|
2012-02-07 22:40:06 +11:00
|
|
|
adzon();
|
2012-03-18 09:44:05 +01:00
|
|
|
_savegameManager.loadSavegame(loadSlot);
|
2012-02-07 22:40:06 +11:00
|
|
|
|
2012-02-12 12:34:51 +11:00
|
|
|
// Run the main game loop
|
2012-02-07 22:40:06 +11:00
|
|
|
mainGame();
|
2011-12-31 22:53:24 +11:00
|
|
|
|
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
2012-02-07 22:40:06 +11:00
|
|
|
/**
|
|
|
|
* Show the game introduction
|
|
|
|
*/
|
|
|
|
void MortevielleEngine::showIntroduction() {
|
2013-06-26 08:29:09 +02:00
|
|
|
_dialogManager.aff50(false);
|
2012-03-23 07:44:04 +01:00
|
|
|
_speechManager._mlec = 0;
|
2013-06-26 08:29:09 +02:00
|
|
|
_dialogManager.checkForF8(142, false);
|
2013-06-26 07:51:11 +02:00
|
|
|
if (shouldQuit())
|
2013-06-24 23:48:00 +02:00
|
|
|
return;
|
2012-02-07 22:40:06 +11:00
|
|
|
|
2013-06-26 08:29:09 +02:00
|
|
|
_dialogManager.ani50();
|
|
|
|
_dialogManager.checkForF8(143, true);
|
2013-06-26 07:51:11 +02:00
|
|
|
if (shouldQuit())
|
2013-06-24 23:48:00 +02:00
|
|
|
return;
|
2012-02-07 22:40:06 +11:00
|
|
|
|
2013-06-24 23:48:00 +02:00
|
|
|
// TODO: Once music (Amiga/Atari ports) is implemented, only use the below delay if music is turned off
|
2012-03-22 00:13:11 +01:00
|
|
|
showTitleScreen();
|
2012-02-12 20:04:16 +11:00
|
|
|
delay(3000);
|
2012-02-07 22:40:06 +11:00
|
|
|
music();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-02-12 14:22:56 +11:00
|
|
|
* Main game loop. Handles potentially playing the game multiple times, such as if the player
|
|
|
|
* loses, and chooses to start playing the game again.
|
2012-02-07 22:40:06 +11:00
|
|
|
*/
|
|
|
|
void MortevielleEngine::mainGame() {
|
2012-03-09 22:25:28 +01:00
|
|
|
if (_reloadCFIEC)
|
|
|
|
loadCFIEC();
|
2012-02-21 22:36:45 +01:00
|
|
|
|
2012-10-10 08:19:54 +02:00
|
|
|
for (_crep = 1; _crep <= _x26KeyCount; ++_crep)
|
2013-02-25 23:22:07 +01:00
|
|
|
decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64);
|
2012-02-21 22:36:45 +01:00
|
|
|
|
2012-03-09 22:25:28 +01:00
|
|
|
loadBRUIT5();
|
2013-06-25 08:00:11 +02:00
|
|
|
_menu.initMenu(this);
|
2012-02-07 22:40:06 +11:00
|
|
|
|
2012-03-18 09:44:05 +01:00
|
|
|
charToHour();
|
2012-03-13 00:06:15 +01:00
|
|
|
initGame();
|
2012-02-07 22:40:06 +11:00
|
|
|
hirs();
|
2012-03-12 01:26:02 +01:00
|
|
|
drawRightFrame();
|
2012-03-20 22:52:59 +01:00
|
|
|
_mouse.showMouse();
|
2012-02-12 14:22:56 +11:00
|
|
|
|
|
|
|
// Loop to play the game
|
2012-02-07 22:40:06 +11:00
|
|
|
do {
|
2012-02-12 14:22:56 +11:00
|
|
|
playGame();
|
2013-06-26 07:51:11 +02:00
|
|
|
if (shouldQuit())
|
2013-06-24 23:48:00 +02:00
|
|
|
return;
|
2012-02-12 14:22:56 +11:00
|
|
|
} while (!_quitGame);
|
2012-02-07 22:40:06 +11:00
|
|
|
}
|
|
|
|
|
2012-02-12 12:34:51 +11:00
|
|
|
/**
|
2012-02-12 14:22:56 +11:00
|
|
|
* This method handles playing a loaded game
|
2012-03-10 14:17:05 +01:00
|
|
|
* @remarks Originally called tjouer
|
2012-02-12 12:34:51 +11:00
|
|
|
*/
|
2012-02-12 14:22:56 +11:00
|
|
|
void MortevielleEngine::playGame() {
|
|
|
|
gameLoaded();
|
|
|
|
|
|
|
|
// Loop handling actions until the game has to be quit, or show the lose or end sequence
|
2012-02-12 12:34:51 +11:00
|
|
|
do {
|
2012-02-12 14:22:56 +11:00
|
|
|
handleAction();
|
2013-06-26 07:51:11 +02:00
|
|
|
if (shouldQuit())
|
2013-06-24 23:48:00 +02:00
|
|
|
return;
|
2012-02-12 14:22:56 +11:00
|
|
|
} while (!((_quitGame) || (_endGame) || (_loseGame)));
|
2012-02-21 22:36:45 +01:00
|
|
|
|
2012-02-12 14:22:56 +11:00
|
|
|
if (_endGame)
|
|
|
|
endGame();
|
|
|
|
else if (_loseGame)
|
2012-03-14 18:25:17 +01:00
|
|
|
askRestart();
|
2012-02-12 12:34:51 +11:00
|
|
|
}
|
|
|
|
|
2011-12-31 22:53:24 +11:00
|
|
|
} // End of namespace Mortevielle
|