2014-09-21 18:19:07 +02:00
|
|
|
/* ResidualVM - A 3D game interpreter
|
2009-09-07 23:51:12 +09:30
|
|
|
*
|
2014-09-21 18:19:07 +02:00
|
|
|
* ResidualVM is the legal property of its developers, whose names
|
2009-09-07 23:51:12 +09:30
|
|
|
* are too numerous to list here. Please refer to the AUTHORS
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2014-09-21 18:19:07 +02:00
|
|
|
* 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,
|
2009-09-07 23:51:12 +09:30
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2014-09-21 18:19:07 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2009-09-07 23:51:12 +09:30
|
|
|
*
|
2014-09-21 18:19:07 +02:00
|
|
|
* 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-09-07 23:51:12 +09:30
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "engines/stark/stark.h"
|
2015-01-02 17:32:44 +01:00
|
|
|
|
2014-09-21 17:09:55 +02:00
|
|
|
#include "engines/stark/console.h"
|
2010-01-27 19:14:07 +01:00
|
|
|
#include "engines/stark/debug.h"
|
2014-12-28 11:50:12 +01:00
|
|
|
#include "engines/stark/resources/level.h"
|
|
|
|
#include "engines/stark/resources/location.h"
|
2014-09-21 17:26:20 +02:00
|
|
|
#include "engines/stark/scene.h"
|
2015-07-14 13:43:44 +02:00
|
|
|
#include "engines/stark/services/userinterface.h"
|
2015-01-11 10:39:24 +01:00
|
|
|
#include "engines/stark/services/archiveloader.h"
|
2015-01-11 15:25:43 +01:00
|
|
|
#include "engines/stark/services/dialogplayer.h"
|
2015-11-22 20:50:15 +01:00
|
|
|
#include "engines/stark/services/fontprovider.h"
|
|
|
|
#include "engines/stark/services/gameinterface.h"
|
2015-01-11 10:47:52 +01:00
|
|
|
#include "engines/stark/services/global.h"
|
2015-01-11 10:39:24 +01:00
|
|
|
#include "engines/stark/services/resourceprovider.h"
|
2015-01-11 11:01:01 +01:00
|
|
|
#include "engines/stark/services/services.h"
|
2015-01-11 10:39:24 +01:00
|
|
|
#include "engines/stark/services/stateprovider.h"
|
2015-02-22 11:26:31 +01:00
|
|
|
#include "engines/stark/services/staticprovider.h"
|
2014-09-21 17:26:20 +02:00
|
|
|
#include "engines/stark/gfx/driver.h"
|
2009-09-07 23:51:12 +09:30
|
|
|
|
2010-01-24 23:23:39 +08:00
|
|
|
#include "common/config-manager.h"
|
2015-07-21 08:21:33 +02:00
|
|
|
#include "common/debug-channels.h"
|
2010-01-24 23:23:39 +08:00
|
|
|
#include "common/events.h"
|
2015-01-02 10:33:42 +01:00
|
|
|
#include "common/random.h"
|
2014-12-29 23:11:22 +01:00
|
|
|
#include "common/savefile.h"
|
2011-09-14 02:09:51 +02:00
|
|
|
#include "common/system.h"
|
|
|
|
#include "audio/mixer.h"
|
2009-09-07 23:51:12 +09:30
|
|
|
|
|
|
|
namespace Stark {
|
|
|
|
|
2014-09-21 17:09:55 +02:00
|
|
|
StarkEngine::StarkEngine(OSystem *syst, const ADGameDescription *gameDesc) :
|
2014-12-27 19:48:17 +01:00
|
|
|
Engine(syst),
|
|
|
|
_gameDescription(gameDesc),
|
|
|
|
_gfx(nullptr),
|
|
|
|
_scene(nullptr),
|
|
|
|
_console(nullptr),
|
|
|
|
_global(nullptr),
|
2015-07-13 09:26:57 +02:00
|
|
|
_gameInterface(nullptr),
|
2014-12-27 19:48:17 +01:00
|
|
|
_archiveLoader(nullptr),
|
2014-12-28 18:22:25 +01:00
|
|
|
_stateProvider(nullptr),
|
2015-02-22 11:26:31 +01:00
|
|
|
_staticProvider(nullptr),
|
2015-01-02 10:33:42 +01:00
|
|
|
_resourceProvider(nullptr),
|
2015-01-11 15:25:43 +01:00
|
|
|
_randomSource(nullptr),
|
2015-07-14 13:43:44 +02:00
|
|
|
_dialogPlayer(nullptr),
|
2015-08-15 13:55:00 +02:00
|
|
|
_userInterface(nullptr),
|
2015-11-22 20:50:15 +01:00
|
|
|
_fontProvider(nullptr),
|
2015-08-15 13:55:00 +02:00
|
|
|
_lastClickTime(0) {
|
2009-09-07 23:51:12 +09:30
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, 127);
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
|
2010-01-27 19:14:07 +01:00
|
|
|
|
|
|
|
// Add the available debug channels
|
2011-09-14 02:09:51 +02:00
|
|
|
DebugMan.addDebugChannel(kDebugArchive, "Archive", "Debug the archive loading");
|
|
|
|
DebugMan.addDebugChannel(kDebugXMG, "XMG", "Debug the loading of XMG images");
|
|
|
|
DebugMan.addDebugChannel(kDebugXRC, "XRC", "Debug the loading of XRC resource trees");
|
|
|
|
DebugMan.addDebugChannel(kDebugUnknown, "Unknown", "Debug unknown values on the data");
|
2009-09-07 23:51:12 +09:30
|
|
|
}
|
|
|
|
|
|
|
|
StarkEngine::~StarkEngine() {
|
2015-07-13 09:26:57 +02:00
|
|
|
delete _gameInterface;
|
2015-01-11 15:25:43 +01:00
|
|
|
delete _dialogPlayer;
|
2015-01-02 10:33:42 +01:00
|
|
|
delete _randomSource;
|
2010-01-27 19:14:07 +01:00
|
|
|
delete _scene;
|
2014-09-21 17:09:55 +02:00
|
|
|
delete _console;
|
2014-12-27 19:48:17 +01:00
|
|
|
delete _gfx;
|
2015-02-22 11:26:31 +01:00
|
|
|
delete _staticProvider;
|
2014-12-27 19:48:17 +01:00
|
|
|
delete _resourceProvider;
|
|
|
|
delete _global;
|
2014-12-28 18:22:25 +01:00
|
|
|
delete _stateProvider;
|
2014-12-27 19:48:17 +01:00
|
|
|
delete _archiveLoader;
|
2015-07-14 13:43:44 +02:00
|
|
|
delete _userInterface;
|
2015-11-22 20:50:15 +01:00
|
|
|
delete _fontProvider;
|
2015-01-01 21:13:33 +01:00
|
|
|
|
|
|
|
StarkServices::destroy();
|
2009-09-07 23:51:12 +09:30
|
|
|
}
|
|
|
|
|
|
|
|
Common::Error StarkEngine::run() {
|
2015-01-11 11:01:01 +01:00
|
|
|
_console = new Console();
|
2015-02-13 20:35:52 +01:00
|
|
|
_gfx = Gfx::Driver::create();
|
2010-01-21 20:29:34 +10:30
|
|
|
|
2010-01-21 21:26:06 +10:30
|
|
|
// Get the screen prepared
|
2015-02-22 09:06:02 +01:00
|
|
|
_gfx->init();
|
2010-01-21 20:29:34 +10:30
|
|
|
|
2014-12-27 19:48:17 +01:00
|
|
|
_archiveLoader = new ArchiveLoader();
|
2014-12-28 18:22:25 +01:00
|
|
|
_stateProvider = new StateProvider();
|
2014-12-27 19:48:17 +01:00
|
|
|
_global = new Global();
|
2014-12-28 18:22:25 +01:00
|
|
|
_resourceProvider = new ResourceProvider(_archiveLoader, _stateProvider, _global);
|
2015-02-22 11:26:31 +01:00
|
|
|
_staticProvider = new StaticProvider(_archiveLoader, _global);
|
2015-01-02 10:33:42 +01:00
|
|
|
_randomSource = new Common::RandomSource("stark");
|
2015-11-22 20:50:15 +01:00
|
|
|
_fontProvider = new FontProvider();
|
2015-01-03 19:18:15 +01:00
|
|
|
_scene = new Scene(_gfx);
|
2015-01-11 15:25:43 +01:00
|
|
|
_dialogPlayer = new DialogPlayer();
|
2015-07-13 09:26:57 +02:00
|
|
|
_gameInterface = new GameInterface();
|
2015-12-25 09:35:50 +01:00
|
|
|
_userInterface = new UserInterface(_gfx);
|
2014-12-27 19:48:17 +01:00
|
|
|
|
2015-01-01 21:13:33 +01:00
|
|
|
// Setup the public services
|
|
|
|
StarkServices &services = StarkServices::instance();
|
|
|
|
services.archiveLoader = _archiveLoader;
|
2015-01-11 15:25:43 +01:00
|
|
|
services.dialogPlayer = _dialogPlayer;
|
2015-02-13 17:07:24 +01:00
|
|
|
services.gfx = _gfx;
|
2015-01-01 21:13:33 +01:00
|
|
|
services.global = _global;
|
2015-01-11 15:25:43 +01:00
|
|
|
services.resourceProvider = _resourceProvider;
|
2015-01-02 10:33:42 +01:00
|
|
|
services.randomSource = _randomSource;
|
2015-01-03 19:18:15 +01:00
|
|
|
services.scene = _scene;
|
2015-02-22 11:26:31 +01:00
|
|
|
services.staticProvider = _staticProvider;
|
2015-07-13 09:26:57 +02:00
|
|
|
services.gameInterface = _gameInterface;
|
2015-07-14 13:43:44 +02:00
|
|
|
services.userInterface = _userInterface;
|
2015-11-22 20:50:15 +01:00
|
|
|
services.fontProvider = _fontProvider;
|
2015-01-01 21:13:33 +01:00
|
|
|
|
2014-12-28 11:50:12 +01:00
|
|
|
// Load global resources
|
2014-12-27 19:48:17 +01:00
|
|
|
_resourceProvider->initGlobal();
|
2015-02-22 11:26:31 +01:00
|
|
|
_staticProvider->init();
|
2015-11-29 20:43:43 +01:00
|
|
|
_fontProvider->initFonts();
|
2015-02-24 21:31:56 +01:00
|
|
|
// Initialize the UI
|
2015-07-14 13:43:44 +02:00
|
|
|
_userInterface->init();
|
2014-12-27 19:48:17 +01:00
|
|
|
|
2015-09-05 16:01:58 +02:00
|
|
|
if (ConfMan.hasKey("save_slot")) {
|
|
|
|
// Load game from specified slot, if any
|
|
|
|
loadGameState(ConfMan.getInt("save_slot"));
|
|
|
|
} else {
|
|
|
|
// Otherwise, set the startup location, ie the House of All Worlds by default
|
|
|
|
setStartupLocation();
|
|
|
|
}
|
2014-12-28 11:50:12 +01:00
|
|
|
|
2010-01-21 21:26:06 +10:30
|
|
|
// Start running
|
2010-01-24 23:23:39 +08:00
|
|
|
mainLoop();
|
2009-09-07 23:51:12 +09:30
|
|
|
|
2015-02-22 11:26:31 +01:00
|
|
|
_staticProvider->shutdown();
|
2014-12-27 19:48:17 +01:00
|
|
|
_resourceProvider->shutdown();
|
|
|
|
|
2009-09-07 23:51:12 +09:30
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
2015-07-16 19:32:10 +02:00
|
|
|
void StarkEngine::setStartupLocation() {
|
|
|
|
if (ConfMan.hasKey("startup_chapter")) {
|
|
|
|
_global->setCurrentChapter(ConfMan.getInt("startup_chapter"));
|
|
|
|
} else {
|
|
|
|
_global->setCurrentChapter(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ConfMan.hasKey("startup_level") && ConfMan.hasKey("startup_location")) {
|
|
|
|
uint levelIndex = strtol(ConfMan.get("startup_level").c_str(), nullptr, 16);
|
|
|
|
uint locationIndex = strtol(ConfMan.get("startup_location").c_str(), nullptr, 16);
|
|
|
|
_resourceProvider->requestLocationChange(levelIndex, locationIndex);
|
|
|
|
} else {
|
|
|
|
if (isDemo()) {
|
|
|
|
_resourceProvider->requestLocationChange(0x4f, 0x00);
|
|
|
|
} else {
|
|
|
|
// Start us up at the house of all worlds
|
|
|
|
_resourceProvider->requestLocationChange(0x45, 0x00);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:23:39 +08:00
|
|
|
void StarkEngine::mainLoop() {
|
2010-01-27 01:28:41 +01:00
|
|
|
while (!shouldQuit()) {
|
2010-01-21 20:29:34 +10:30
|
|
|
// Process events
|
|
|
|
Common::Event e;
|
|
|
|
while (g_system->getEventManager()->pollEvent(e)) {
|
|
|
|
// Handle any buttons, keys and joystick operations
|
|
|
|
if (e.type == Common::EVENT_KEYDOWN) {
|
|
|
|
if (e.kbd.ascii == 'q') {
|
2010-01-27 01:28:41 +01:00
|
|
|
quitGame();
|
2010-01-21 20:29:34 +10:30
|
|
|
break;
|
2014-09-21 17:09:55 +02:00
|
|
|
} else if (e.kbd.keycode == Common::KEYCODE_d) {
|
|
|
|
if (e.kbd.flags & Common::KBD_CTRL) {
|
|
|
|
_console->attach();
|
|
|
|
_console->onFrame();
|
|
|
|
}
|
2015-02-28 17:16:33 +01:00
|
|
|
} else if (e.kbd.keycode == Common::KEYCODE_ESCAPE) {
|
2015-07-13 09:26:57 +02:00
|
|
|
_gameInterface->skipCurrentSpeeches();
|
2015-02-28 17:16:33 +01:00
|
|
|
// Quick-hack for now.
|
2015-07-19 17:07:23 +02:00
|
|
|
_userInterface->skipFMV();
|
2010-01-21 20:29:34 +10:30
|
|
|
} else {
|
|
|
|
//handleChars(event.type, event.kbd.keycode, event.kbd.flags, event.kbd.ascii);
|
|
|
|
}
|
2014-09-21 17:09:55 +02:00
|
|
|
|
2015-01-15 18:50:40 +01:00
|
|
|
} else if (e.type == Common::EVENT_LBUTTONUP) {
|
2015-02-28 17:16:33 +01:00
|
|
|
// Do nothing for now
|
2015-02-08 09:17:51 +01:00
|
|
|
} else if (e.type == Common::EVENT_MOUSEMOVE) {
|
2015-12-25 09:35:50 +01:00
|
|
|
_userInterface->handleMouseMove(e.mouse);
|
2015-02-23 13:56:22 +01:00
|
|
|
} else if (e.type == Common::EVENT_LBUTTONDOWN) {
|
2015-07-14 13:43:44 +02:00
|
|
|
_userInterface->handleClick();
|
2015-08-15 13:55:00 +02:00
|
|
|
if (_system->getMillis() - _lastClickTime < _doubleClickDelay) {
|
|
|
|
_userInterface->handleDoubleClick();
|
|
|
|
}
|
|
|
|
_lastClickTime = _system->getMillis();
|
2015-07-11 16:35:54 +02:00
|
|
|
} else if (e.type == Common::EVENT_RBUTTONDOWN) {
|
2015-07-14 13:43:44 +02:00
|
|
|
_userInterface->handleRightClick();
|
2010-01-21 20:29:34 +10:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-29 23:11:22 +01:00
|
|
|
if (_resourceProvider->hasLocationChangeRequest()) {
|
|
|
|
_resourceProvider->performLocationChange();
|
|
|
|
}
|
|
|
|
|
2010-01-21 20:29:34 +10:30
|
|
|
updateDisplayScene();
|
|
|
|
g_system->delayMillis(50);
|
2015-02-24 22:54:03 +01:00
|
|
|
|
2015-07-14 13:43:44 +02:00
|
|
|
if (_userInterface->shouldExit()) {
|
2015-02-24 22:54:03 +01:00
|
|
|
quitGame();
|
|
|
|
break;
|
|
|
|
}
|
2010-01-21 20:29:34 +10:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:23:39 +08:00
|
|
|
void StarkEngine::updateDisplayScene() {
|
2010-09-04 22:31:13 +09:30
|
|
|
// Get frame delay
|
|
|
|
static uint32 lastFrame = g_system->getMillis();
|
2015-01-10 10:27:32 +01:00
|
|
|
_global->setMillisecondsPerGameloop(g_system->getMillis() - lastFrame);
|
|
|
|
lastFrame += _global->getMillisecondsPerGameloop();
|
2010-09-04 22:31:13 +09:30
|
|
|
|
2010-01-27 19:14:07 +01:00
|
|
|
// Clear the screen
|
2010-01-25 17:42:19 +01:00
|
|
|
_gfx->clearScreen();
|
2010-01-21 20:29:34 +10:30
|
|
|
|
2015-07-19 17:07:23 +02:00
|
|
|
// Only update the world resources when on the game screen
|
|
|
|
if (_userInterface->isInGameScreen()) {
|
2015-02-26 18:03:12 +01:00
|
|
|
// Update the game resources
|
|
|
|
_global->getLevel()->onGameLoop();
|
|
|
|
_global->getCurrent()->getLevel()->onGameLoop();
|
|
|
|
_global->getCurrent()->getLocation()->onGameLoop();
|
|
|
|
}
|
2015-07-19 17:07:23 +02:00
|
|
|
|
|
|
|
// Render the current scene
|
|
|
|
// Update the UI state before displaying the scene
|
|
|
|
_userInterface->update();
|
|
|
|
|
2015-02-23 23:44:32 +01:00
|
|
|
// Tell the UI to render, and update implicitly, if this leads to new mouse-over events.
|
2015-07-14 13:43:44 +02:00
|
|
|
_userInterface->render();
|
2015-02-23 23:44:32 +01:00
|
|
|
|
2010-01-25 17:42:19 +01:00
|
|
|
// Swap buffers
|
|
|
|
_gfx->flipBuffer();
|
2010-01-21 20:29:34 +10:30
|
|
|
}
|
2010-01-24 23:23:39 +08:00
|
|
|
|
2014-12-29 23:11:22 +01:00
|
|
|
bool StarkEngine::hasFeature(EngineFeature f) const {
|
|
|
|
return
|
|
|
|
(f == kSupportsLoadingDuringRuntime) ||
|
2015-02-22 09:06:02 +01:00
|
|
|
(f == kSupportsSavingDuringRuntime) ||
|
2015-12-25 09:40:16 +01:00
|
|
|
(f == kSupportsArbitraryResolutions) ||
|
|
|
|
(f == kSupportsRTL);
|
2014-12-29 23:11:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool StarkEngine::canLoadGameStateCurrently() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::Error StarkEngine::loadGameState(int slot) {
|
|
|
|
// Open the save file
|
|
|
|
Common::String filename = Common::String::format("Save%02d.tlj", slot);
|
2014-12-30 21:10:36 +01:00
|
|
|
Common::InSaveFile *save = _saveFileMan->openForLoading(filename);
|
|
|
|
if (!save) {
|
|
|
|
return _saveFileMan->getError();
|
|
|
|
}
|
|
|
|
|
2015-09-05 13:26:01 +02:00
|
|
|
// 0. Clear the previous world resources
|
|
|
|
_resourceProvider->shutdown();
|
|
|
|
|
2014-12-30 21:10:36 +01:00
|
|
|
StateReadStream *stream = new StateReadStream(save);
|
|
|
|
|
|
|
|
// 1. Read the header
|
|
|
|
// Save description
|
|
|
|
Common::String desc = stream->readString();
|
2014-12-29 23:11:22 +01:00
|
|
|
|
2014-12-30 21:10:36 +01:00
|
|
|
// Level
|
|
|
|
Common::String level = stream->readString();
|
|
|
|
uint levelIndex = strtol(level.c_str(), nullptr, 16);
|
2014-12-29 23:11:22 +01:00
|
|
|
|
2014-12-30 21:10:36 +01:00
|
|
|
// Location
|
|
|
|
Common::String location = stream->readString();
|
|
|
|
uint locationIndex = strtol(location.c_str(), nullptr, 16);
|
|
|
|
|
|
|
|
// Version
|
|
|
|
Common::String version = stream->readString();
|
|
|
|
//TODO: Check the version
|
|
|
|
|
|
|
|
// 2. Read the resource trees state
|
|
|
|
_stateProvider->readStateFromStream(stream);
|
2014-12-29 23:11:22 +01:00
|
|
|
|
|
|
|
//TODO: Read the rest of the state
|
|
|
|
|
2014-12-30 21:10:36 +01:00
|
|
|
delete stream;
|
2014-12-29 23:11:22 +01:00
|
|
|
|
2015-09-05 13:26:01 +02:00
|
|
|
// 3. Initialize the world resources with the loaded state
|
2014-12-29 23:11:22 +01:00
|
|
|
_resourceProvider->initGlobal();
|
2015-12-05 10:30:01 +01:00
|
|
|
_resourceProvider->setShouldRestoreCurrentState();
|
2014-12-30 21:10:36 +01:00
|
|
|
_resourceProvider->requestLocationChange(levelIndex, locationIndex);
|
2014-12-29 23:11:22 +01:00
|
|
|
|
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool StarkEngine::canSaveGameStateCurrently() {
|
2015-12-25 10:35:06 +01:00
|
|
|
return _userInterface->isInteractive();
|
2014-12-29 23:11:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Common::Error StarkEngine::saveGameState(int slot, const Common::String &desc) {
|
|
|
|
// Ensure the state store is up to date
|
|
|
|
_resourceProvider->commitActiveLocationsState();
|
|
|
|
|
|
|
|
// Open the save file
|
|
|
|
Common::String filename = Common::String::format("Save%02d.tlj", slot);
|
2014-12-30 21:10:36 +01:00
|
|
|
Common::OutSaveFile *save = _saveFileMan->openForSaving(filename);
|
|
|
|
if (!save) {
|
|
|
|
return _saveFileMan->getError();
|
|
|
|
}
|
|
|
|
|
|
|
|
// 1. Write the header
|
|
|
|
// Save description
|
|
|
|
save->writeUint32LE(desc.size());
|
|
|
|
save->writeString(desc);
|
|
|
|
|
|
|
|
// Level
|
|
|
|
Common::String level = _global->getCurrent()->getLevel()->getIndexAsString();
|
|
|
|
save->writeUint32LE(level.size());
|
|
|
|
save->writeString(level);
|
|
|
|
|
|
|
|
// Location
|
|
|
|
Common::String location = _global->getCurrent()->getLocation()->getIndexAsString();
|
|
|
|
save->writeUint32LE(location.size());
|
|
|
|
save->writeString(location);
|
2014-12-29 23:11:22 +01:00
|
|
|
|
2014-12-30 21:10:36 +01:00
|
|
|
// Version
|
|
|
|
Common::String version = "Version:\t06";
|
|
|
|
save->writeUint32LE(version.size());
|
|
|
|
save->writeString(version);
|
2014-12-29 23:11:22 +01:00
|
|
|
|
2014-12-30 21:10:36 +01:00
|
|
|
// 2. Write the resource trees state
|
2014-12-29 23:11:22 +01:00
|
|
|
_stateProvider->writeStateToStream(save);
|
|
|
|
|
|
|
|
//TODO: Write the rest of the state
|
|
|
|
//TODO: Write a screenshot
|
|
|
|
|
|
|
|
delete save;
|
|
|
|
|
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
2015-02-28 16:50:06 +01:00
|
|
|
bool StarkEngine::isDemo() {
|
|
|
|
return _gameDescription->flags & ADGF_DEMO;
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:23:39 +08:00
|
|
|
} // End of namespace Stark
|