diff options
author | Einar Johan Trøan Sømåen | 2012-07-29 21:35:11 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-07-29 21:37:24 +0200 |
commit | 85ce9340bcb425a6c5e8dbcacff5a7fa2fb4c817 (patch) | |
tree | d78a7c5377ef446e87dac092f9d29377c27cc7ff | |
parent | 80a67a70cdaad254185ffd9b2042a710e4a6e338 (diff) | |
download | scummvm-rg350-85ce9340bcb425a6c5e8dbcacff5a7fa2fb4c817.tar.gz scummvm-rg350-85ce9340bcb425a6c5e8dbcacff5a7fa2fb4c817.tar.bz2 scummvm-rg350-85ce9340bcb425a6c5e8dbcacff5a7fa2fb4c817.zip |
WINTERMUTE: Separate out SaveGame-code from BaseGame
-rw-r--r-- | engines/wintermute/ad/ad_game.cpp | 28 | ||||
-rw-r--r-- | engines/wintermute/ad/ad_game.h | 4 | ||||
-rw-r--r-- | engines/wintermute/base/base_game.cpp | 342 | ||||
-rw-r--r-- | engines/wintermute/base/base_game.h | 36 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_renderer.cpp | 129 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_renderer.h | 30 | ||||
-rw-r--r-- | engines/wintermute/base/saveload.cpp | 198 | ||||
-rw-r--r-- | engines/wintermute/base/saveload.h | 57 | ||||
-rw-r--r-- | engines/wintermute/module.mk | 1 | ||||
-rw-r--r-- | engines/wintermute/system/sys_class_registry.cpp | 8 | ||||
-rw-r--r-- | engines/wintermute/wintermute.cpp | 34 |
11 files changed, 483 insertions, 384 deletions
diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp index e399ba5fcf..3bda534a04 100644 --- a/engines/wintermute/ad/ad_game.cpp +++ b/engines/wintermute/ad/ad_game.cpp @@ -49,6 +49,7 @@ #include "engines/wintermute/base/base_sprite.h"
#include "engines/wintermute/base/base_viewport.h"
#include "engines/wintermute/base/particles/part_emitter.h"
+#include "engines/wintermute/base/saveload.h"
#include "engines/wintermute/base/scriptables/script_engine.h"
#include "engines/wintermute/base/scriptables/script.h"
#include "engines/wintermute/base/scriptables/script_stack.h"
@@ -1453,29 +1454,6 @@ bool AdGame::persist(BasePersistenceManager *persistMgr) { return STATUS_OK;
}
-
-//////////////////////////////////////////////////////////////////////////
-bool AdGame::loadGame(const char *filename) {
- bool ret = BaseGame::loadGame(filename);
- if (DID_SUCCEED(ret)) {
- SystemClassRegistry::getInstance()->enumInstances(afterLoadRegion, "AdRegion", NULL);
- }
- return ret;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool AdGame::initAfterLoad() {
- BaseGame::initAfterLoad();
- SystemClassRegistry::getInstance()->enumInstances(afterLoadScene, "AdScene", NULL);
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void AdGame::afterLoadScene(void *scene, void *data) {
- ((AdScene *)scene)->afterLoad();
-}
-
-
//////////////////////////////////////////////////////////////////////////
void AdGame::setPrevSceneName(const char *name) {
delete[] _prevSceneName;
@@ -1910,9 +1888,7 @@ bool AdGame::displayContent(bool doUpdate, bool displayAll) { if (_stateEx == GAME_WAITING_RESPONSE) {
_responseBox->display();
}
- if (_indicatorDisplay) {
- displayIndicator();
- }
+ _renderer->displayIndicator();
if (doUpdate || displayAll) {
diff --git a/engines/wintermute/ad/ad_game.h b/engines/wintermute/ad/ad_game.h index 7f76b959d4..080aea40aa 100644 --- a/engines/wintermute/ad/ad_game.h +++ b/engines/wintermute/ad/ad_game.h @@ -54,9 +54,6 @@ public: virtual bool displayDebugInfo();
- virtual bool initAfterLoad();
- static void afterLoadScene(void *scene, void *data);
-
bool addSpeechDir(const char *dir);
bool removeSpeechDir(const char *dir);
char *findSpeechFile(char *StringID);
@@ -101,7 +98,6 @@ public: void setPrevSceneName(const char *name);
void setPrevSceneFilename(const char *name);
- virtual bool loadGame(const char *filename);
AdItem *_selectedItem;
bool cleanup();
DECLARE_PERSISTENT(AdGame, BaseGame)
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 0453222e24..b92da4c11b 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -49,10 +49,7 @@ #include "engines/wintermute/base/base_region.h"
#include "engines/wintermute/base/base_save_thumb_helper.h"
#include "engines/wintermute/base/base_surface_storage.h"
-#include "engines/wintermute/utils/crc.h"
-#include "engines/wintermute/utils/path_util.h"
-#include "engines/wintermute/utils/string_util.h"
-#include "engines/wintermute/ui/ui_window.h"
+#include "engines/wintermute/base/saveload.h"
#include "engines/wintermute/base/scriptables/script_value.h"
#include "engines/wintermute/base/scriptables/script_engine.h"
#include "engines/wintermute/base/scriptables/script_stack.h"
@@ -61,6 +58,10 @@ #include "engines/wintermute/video/video_player.h"
#include "engines/wintermute/video/video_theora_player.h"
#include "engines/wintermute/utils/utils.h"
+#include "engines/wintermute/utils/crc.h"
+#include "engines/wintermute/utils/path_util.h"
+#include "engines/wintermute/utils/string_util.h"
+#include "engines/wintermute/ui/ui_window.h"
#include "engines/wintermute/wintermute.h"
#include "engines/wintermute/platform_osystem.h"
#include "common/config-manager.h"
@@ -195,13 +196,6 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam _thumbnailWidth = _thumbnailHeight = 0;
- _indicatorDisplay = false;
- _indicatorColor = BYTETORGBA(255, 0, 0, 128);
- _indicatorProgress = 0;
- _indicatorX = -1;
- _indicatorY = -1;
- _indicatorWidth = -1;
- _indicatorHeight = 8;
_richSavedGames = false;
_savedGameExt = NULL;
BaseUtils::setString(&_savedGameExt, "dsv");
@@ -213,13 +207,6 @@ BaseGame::BaseGame(const Common::String &gameId) : BaseObject(this), _gameId(gam _musicCrossfadeChannel2 = -1;
_musicCrossfadeSwap = false;
- _loadImageName = NULL;
- _saveImageName = NULL;
- _saveLoadImage = NULL;
-
- _saveImageX = _saveImageY = 0;
- _loadImageX = _loadImageY = 0;
-
_localSaveDir = NULL;
BaseUtils::setString(&_localSaveDir, "saves");
_saveDirChecked = false;
@@ -286,7 +273,6 @@ BaseGame::~BaseGame() { delete _cachedThumbnail;
- delete _saveLoadImage;
delete _mathClass;
delete _transMgr;
@@ -307,7 +293,6 @@ BaseGame::~BaseGame() { _cachedThumbnail = NULL;
- _saveLoadImage = NULL;
_mathClass = NULL;
_transMgr = NULL;
@@ -352,11 +337,6 @@ bool BaseGame::cleanup() { _windows.clear(); // refs only
_focusedWindow = NULL; // ref only
- delete[] _saveImageName;
- delete[] _loadImageName;
- _saveImageName = NULL;
- _loadImageName = NULL;
-
delete _cursorNoninteractive;
delete _cursor;
delete _activeCursor;
@@ -488,17 +468,7 @@ bool BaseGame::initialize2() { // we know whether we are going to be accelerated bool BaseGame::initialize3() { // renderer is initialized
_posX = _renderer->_width / 2;
_posY = _renderer->_height / 2;
-
- if (_indicatorY == -1) {
- _indicatorY = _renderer->_height - _indicatorHeight;
- }
- if (_indicatorX == -1) {
- _indicatorX = 0;
- }
- if (_indicatorWidth == -1) {
- _indicatorWidth = _renderer->_width;
- }
-
+ _renderer->initIndicator();
return STATUS_OK;
}
@@ -780,6 +750,20 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE(LOCAL_SAVE_DIR)
TOKEN_TABLE(COMPAT_KILL_METHOD_THREADS)
TOKEN_TABLE_END
+
+ // Declare a few variables necessary for moving data from these settings over to the renderer:
+ // The values are the same as the defaults set in BaseRenderer.
+ int loadImageX = 0;
+ int loadImageY = 0;
+ int saveImageX = 0;
+ int saveImageY = 0;
+ int indicatorX = -1;
+ int indicatorY = -1;
+ int indicatorWidth = -1;
+ int indicatorHeight = 8;
+ uint32 indicatorColor = BYTETORGBA(255, 0, 0, 128);
+ Common::String loadImageName = "";
+ Common::String saveImageName = "";
byte *params;
int cmd;
@@ -896,50 +880,50 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) { break;
case TOKEN_INDICATOR_X:
- parser.scanStr((char *)params, "%d", &_indicatorX);
+ parser.scanStr((char *)params, "%d", &indicatorX);
break;
case TOKEN_INDICATOR_Y:
- parser.scanStr((char *)params, "%d", &_indicatorY);
+ parser.scanStr((char *)params, "%d", &indicatorY);
break;
case TOKEN_INDICATOR_COLOR: {
int r, g, b, a;
parser.scanStr((char *)params, "%d,%d,%d,%d", &r, &g, &b, &a);
- _indicatorColor = BYTETORGBA(r, g, b, a);
+ indicatorColor = BYTETORGBA(r, g, b, a);
}
break;
case TOKEN_INDICATOR_WIDTH:
- parser.scanStr((char *)params, "%d", &_indicatorWidth);
+ parser.scanStr((char *)params, "%d", &indicatorWidth);
break;
case TOKEN_INDICATOR_HEIGHT:
- parser.scanStr((char *)params, "%d", &_indicatorHeight);
+ parser.scanStr((char *)params, "%d", &indicatorHeight);
break;
case TOKEN_SAVE_IMAGE:
- BaseUtils::setString(&_saveImageName, (char *)params);
+ saveImageName = (char *) params;
break;
case TOKEN_SAVE_IMAGE_X:
- parser.scanStr((char *)params, "%d", &_saveImageX);
+ parser.scanStr((char *)params, "%d", &saveImageX);
break;
case TOKEN_SAVE_IMAGE_Y:
- parser.scanStr((char *)params, "%d", &_saveImageY);
+ parser.scanStr((char *)params, "%d", &saveImageY);
break;
case TOKEN_LOAD_IMAGE:
- BaseUtils::setString(&_loadImageName, (char *)params);
+ loadImageName = (char *) params;
break;
case TOKEN_LOAD_IMAGE_X:
- parser.scanStr((char *)params, "%d", &_loadImageX);
+ parser.scanStr((char *)params, "%d", &loadImageX);
break;
case TOKEN_LOAD_IMAGE_Y:
- parser.scanStr((char *)params, "%d", &_loadImageY);
+ parser.scanStr((char *)params, "%d", &loadImageY);
break;
case TOKEN_LOCAL_SAVE_DIR:
@@ -952,6 +936,11 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) { }
}
+ _renderer->setIndicator(indicatorWidth, indicatorHeight, indicatorX, indicatorY, indicatorColor);
+ _renderer->initIndicator(); // In case we just reset the values.
+ _renderer->setSaveImage(saveImageName.c_str(), saveImageX, saveImageY);
+ _renderer->setLoadingScreen(loadImageName.c_str(), loadImageX, loadImageY);
+
if (!_systemFont) {
_systemFont = _gameRef->_fontStorage->addFont("system_font.fnt");
}
@@ -1624,7 +1613,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack else if (strcmp(name, "IsSaveSlotUsed") == 0) {
stack->correctParams(1);
int slot = stack->pop()->getInt();
- stack->pushBool(isSaveSlotUsed(slot));
+ stack->pushBool(SaveLoad::isSaveSlotUsed(slot));
return STATUS_OK;
}
@@ -1636,7 +1625,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack int slot = stack->pop()->getInt();
char desc[512];
desc[0] = '\0';
- getSaveSlotDescription(slot, desc);
+ SaveLoad::getSaveSlotDescription(slot, desc);
stack->pushString(desc);
return STATUS_OK;
}
@@ -1647,7 +1636,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack else if (strcmp(name, "EmptySaveSlot") == 0) {
stack->correctParams(1);
int slot = stack->pop()->getInt();
- emptySaveSlot(slot);
+ SaveLoad::emptySaveSlot(slot);
stack->pushNULL();
return STATUS_OK;
}
@@ -1979,14 +1968,13 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack else if (strcmp(name, "SetLoadingScreen") == 0) {
stack->correctParams(3);
ScValue *val = stack->pop();
- _loadImageX = stack->pop()->getInt();
- _loadImageY = stack->pop()->getInt();
+ int loadImageX = stack->pop()->getInt();
+ int loadImageY = stack->pop()->getInt();
if (val->isNULL()) {
- delete[] _loadImageName;
- _loadImageName = NULL;
+ _renderer->setLoadingScreen(NULL, loadImageX, loadImageY);
} else {
- BaseUtils::setString(&_loadImageName, val->getString());
+ _renderer->setLoadingScreen(val->getString(), loadImageX, loadImageY);
}
stack->pushNULL();
return STATUS_OK;
@@ -1998,14 +1986,13 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack else if (strcmp(name, "SetSavingScreen") == 0) {
stack->correctParams(3);
ScValue *val = stack->pop();
- _saveImageX = stack->pop()->getInt();
- _saveImageY = stack->pop()->getInt();
+ int saveImageX = stack->pop()->getInt();
+ int saveImageY = stack->pop()->getInt();
if (val->isNULL()) {
- delete[] _saveImageName;
- _saveImageName = NULL;
+ _renderer->setSaveImage(NULL, saveImageX, saveImageY);
} else {
- BaseUtils::setString(&_saveImageName, val->getString());
+ _renderer->setSaveImage(NULL, saveImageX, saveImageY);
}
stack->pushNULL();
return STATUS_OK;
@@ -3316,48 +3303,7 @@ bool BaseGame::showCursor() { //////////////////////////////////////////////////////////////////////////
bool BaseGame::saveGame(int slot, const char *desc, bool quickSave) {
- char filename[MAX_PATH_LENGTH + 1];
- getSaveSlotFilename(slot, filename);
-
- LOG(0, "Saving game '%s'...", filename);
-
- _gameRef->applyEvent("BeforeSave", true);
-
- bool ret;
-
- _indicatorDisplay = true;
- _indicatorProgress = 0;
- BasePersistenceManager *pm = new BasePersistenceManager();
- if (DID_SUCCEED(ret = pm->initSave(desc))) {
- if (!quickSave) {
- delete _saveLoadImage;
- _saveLoadImage = NULL;
- if (_saveImageName) {
- _saveLoadImage = _renderer->createSurface();
-
- if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_saveImageName, true, 0, 0, 0))) {
- delete _saveLoadImage;
- _saveLoadImage = NULL;
- }
- }
- }
-
- if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->saveTable(_gameRef, pm, quickSave))) {
- if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->saveInstances(_gameRef, pm, quickSave))) {
- if (DID_SUCCEED(ret = pm->saveFile(filename))) {
- ConfMan.setInt("most_recent_saveslot", slot);
- }
- }
- }
- }
-
- delete pm;
- _indicatorDisplay = false;
-
- delete _saveLoadImage;
- _saveLoadImage = NULL;
-
- return ret;
+ return SaveLoad::saveGame(slot, desc, quickSave, _gameRef);
}
@@ -3368,103 +3314,18 @@ bool BaseGame::loadGame(int slot) { _loading = false;
_scheduledLoadSlot = -1;
- char filename[MAX_PATH_LENGTH + 1];
- getSaveSlotFilename(slot, filename);
+ Common::String filename = SaveLoad::getSaveSlotFilename(slot);
- return loadGame(filename);
+ return loadGame(filename.c_str());
}
//////////////////////////////////////////////////////////////////////////
bool BaseGame::loadGame(const char *filename) {
- LOG(0, "Loading game '%s'...", filename);
-
- bool ret;
-
- delete _saveLoadImage;
- _saveLoadImage = NULL;
- if (_loadImageName) {
- _saveLoadImage = _renderer->createSurface();
-
- if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_loadImageName, true, 0, 0, 0))) {
- delete _saveLoadImage;
- _saveLoadImage = NULL;
- }
- }
-
-
- _loadInProgress = true;
- _indicatorDisplay = true;
- _indicatorProgress = 0;
- BasePersistenceManager *pm = new BasePersistenceManager();
- if (DID_SUCCEED(ret = pm->initLoad(filename))) {
- //if (DID_SUCCEED(ret = cleanup())) {
- if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->loadTable(_gameRef, pm))) {
- if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->loadInstances(_gameRef, pm))) {
- // data initialization after load
- initAfterLoad();
-
- _gameRef->applyEvent("AfterLoad", true);
-
- displayContent(true, false);
- //_renderer->flip();
- }
- }
- }
-
- _indicatorDisplay = false;
- delete pm;
- _loadInProgress = false;
-
- delete _saveLoadImage;
- _saveLoadImage = NULL;
-
- //_gameRef->LOG(0, "Load end %d", BaseUtils::GetUsedMemMB());
-
- return ret;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseGame::initAfterLoad() {
- SystemClassRegistry::getInstance()->enumInstances(afterLoadRegion, "BaseRegion", NULL);
- SystemClassRegistry::getInstance()->enumInstances(afterLoadSubFrame, "BaseSubFrame", NULL);
- SystemClassRegistry::getInstance()->enumInstances(afterLoadSound, "BaseSound", NULL);
- SystemClassRegistry::getInstance()->enumInstances(afterLoadFont, "BaseFontTT", NULL);
- SystemClassRegistry::getInstance()->enumInstances(afterLoadScript, "ScScript", NULL);
-
- return STATUS_OK;
+ return SaveLoad::loadGame(filename, _gameRef);
}
//////////////////////////////////////////////////////////////////////////
-void BaseGame::afterLoadRegion(void *region, void *data) {
- ((BaseRegion *)region)->createRegion();
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-void BaseGame::afterLoadSubFrame(void *subframe, void *data) {
- ((BaseSubFrame *)subframe)->setSurfaceSimple();
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-void BaseGame::afterLoadSound(void *sound, void *data) {
- ((BaseSound *)sound)->setSoundSimple();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void BaseGame::afterLoadFont(void *font, void *data) {
- ((BaseFont *)font)->afterLoad();
-}
-
-//////////////////////////////////////////////////////////////////////////
-void BaseGame::afterLoadScript(void *script, void *data) {
- ((ScScript *)script)->afterLoad();
-}
-
-
-//////////////////////////////////////////////////////////////////////////
bool BaseGame::displayWindows(bool inGame) {
bool res;
@@ -3773,13 +3634,8 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_musicCrossfadeChannel1));
persistMgr->transfer(TMEMBER(_musicCrossfadeChannel2));
persistMgr->transfer(TMEMBER(_musicCrossfadeSwap));
-
- persistMgr->transfer(TMEMBER(_loadImageName));
- persistMgr->transfer(TMEMBER(_saveImageName));
- persistMgr->transfer(TMEMBER(_saveImageX));
- persistMgr->transfer(TMEMBER(_saveImageY));
- persistMgr->transfer(TMEMBER(_loadImageX));
- persistMgr->transfer(TMEMBER(_loadImageY));
+
+ _renderer->persistSaveLoadImages(persistMgr);
persistMgr->transfer(TMEMBER_INT(_textEncoding));
persistMgr->transfer(TMEMBER(_textRTL));
@@ -3907,13 +3763,13 @@ void BaseGame::handleKeyRelease(Common::Event *event) { //////////////////////////////////////////////////////////////////////////
-bool BaseGame::handleMouseWheel(int Delta) {
+bool BaseGame::handleMouseWheel(int delta) {
bool handled = false;
if (_focusedWindow) {
- handled = _gameRef->_focusedWindow->handleMouseWheel(Delta);
+ handled = _gameRef->_focusedWindow->handleMouseWheel(delta);
if (!handled) {
- if (Delta < 0 && _gameRef->_focusedWindow->canHandleEvent("MouseWheelDown")) {
+ if (delta < 0 && _gameRef->_focusedWindow->canHandleEvent("MouseWheelDown")) {
_gameRef->_focusedWindow->applyEvent("MouseWheelDown");
handled = true;
} else if (_gameRef->_focusedWindow->canHandleEvent("MouseWheelUp")) {
@@ -3925,7 +3781,7 @@ bool BaseGame::handleMouseWheel(int Delta) { }
if (!handled) {
- if (Delta < 0) {
+ if (delta < 0) {
applyEvent("MouseWheelDown");
} else {
applyEvent("MouseWheelUp");
@@ -3982,61 +3838,6 @@ void BaseGame::setWindowTitle() { //////////////////////////////////////////////////////////////////////////
-bool BaseGame::getSaveSlotFilename(int slot, char *buffer) {
- BasePersistenceManager *pm = new BasePersistenceManager();
- Common::String filename = pm->getFilenameForSlot(slot);
- delete pm;
- strcpy(buffer, filename.c_str());
- debugC(kWinterMuteDebugSaveGame, "getSaveSlotFileName(%d) = %s", slot, buffer);
- return STATUS_OK;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseGame::getSaveSlotDescription(int slot, char *buffer) {
- buffer[0] = '\0';
-
- char filename[MAX_PATH_LENGTH + 1];
- getSaveSlotFilename(slot, filename);
- BasePersistenceManager *pm = new BasePersistenceManager();
- if (!pm) {
- return STATUS_FAILED;
- }
-
- if (DID_FAIL(pm->initLoad(filename))) {
- delete pm;
- return STATUS_FAILED;
- }
-
- strcpy(buffer, pm->_savedDescription);
- delete pm;
-
- return STATUS_OK;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseGame::isSaveSlotUsed(int slot) {
- char filename[MAX_PATH_LENGTH + 1];
- getSaveSlotFilename(slot, filename);
- BasePersistenceManager *pm = new BasePersistenceManager();
- bool ret = pm->getSaveExists(slot);
- delete pm;
- return ret;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseGame::emptySaveSlot(int slot) {
- char filename[MAX_PATH_LENGTH + 1];
- getSaveSlotFilename(slot, filename);
- BasePersistenceManager *pm = new BasePersistenceManager();
- g_wintermute->getSaveFileMan()->removeSavefile(pm->getFilenameForSlot(slot));
- delete pm;
- return STATUS_OK;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
bool BaseGame::setActiveObject(BaseObject *obj) {
// not-active when game is frozen
if (obj && !_gameRef->_interactive && !obj->_nonIntMouseEvents) {
@@ -4181,35 +3982,8 @@ bool BaseGame::displayContent(bool doUpdate, bool displayAll) { bool BaseGame::displayContentSimple() {
// fill black
_renderer->fill(0, 0, 0);
- if (_indicatorDisplay) {
- displayIndicator();
- }
-
- return STATUS_OK;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-bool BaseGame::displayIndicator() {
- if (_saveLoadImage) {
- Rect32 rc;
- BasePlatform::setRect(&rc, 0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight());
- if (_loadInProgress) {
- _saveLoadImage->displayTrans(_loadImageX, _loadImageY, rc);
- } else {
- _saveLoadImage->displayTrans(_saveImageX, _saveImageY, rc);
- }
- }
-
- if ((!_indicatorDisplay && _indicatorWidth <= 0) || _indicatorHeight <= 0) {
- return STATUS_OK;
- }
- _renderer->setupLines();
- for (int i = 0; i < _indicatorHeight; i++) {
- _renderer->drawLine(_indicatorX, _indicatorY + i, _indicatorX + (int)(_indicatorWidth * (float)((float)_indicatorProgress / 100.0f)), _indicatorY + i, _indicatorColor);
- }
+ _renderer->displayIndicator();
- _renderer->setup2D();
return STATUS_OK;
}
diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index fd20608a42..8a587da3e3 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -109,8 +109,6 @@ public: void DEBUG_DumpClassRegistry();
bool setWaitCursor(const char *filename);
- int _indicatorProgress; // TODO: Hide
-
int _thumbnailWidth;
int _thumbnailHeight;
@@ -204,9 +202,9 @@ public: bool displayWindows(bool inGame = false);
bool _useD3D;
virtual bool cleanup();
- virtual bool loadGame(int slot);
- virtual bool loadGame(const char *filename);
- virtual bool saveGame(int slot, const char *desc, bool quickSave = false);
+ bool loadGame(int slot);
+ bool loadGame(const char *filename);
+ bool saveGame(int slot, const char *desc, bool quickSave = false);
virtual bool showCursor();
BaseObject *_activeObject;
@@ -248,7 +246,6 @@ public: BaseSprite *_lastCursor;
bool drawCursor(BaseSprite *Cursor);
- virtual bool initAfterLoad();
BaseSaveThumbHelper *_cachedThumbnail;
void addMem(int bytes);
bool _touchInterface;
@@ -261,18 +258,10 @@ protected: BaseFader *_fader;
- bool _indicatorDisplay;
- bool displayIndicator();
-
int _freezeLevel;
VideoPlayer *_videoPlayer;
VideoTheoraPlayer *_theoraPlayer;
- static void afterLoadRegion(void *region, void *data);
private:
- static void afterLoadSubFrame(void *subframe, void *data);
- static void afterLoadSound(void *sound, void *data);
- static void afterLoadFont(void *font, void *data);
- static void afterLoadScript(void *script, void *data);
bool _mouseRightDown;
bool _mouseMidlleDown;
bool _settingsRequireAcceleration;
@@ -286,26 +275,11 @@ private: virtual bool invalidateDeviceObjects();
virtual bool restoreDeviceObjects();
- uint32 _indicatorColor;
- int _indicatorX;
- int _indicatorY;
- int _indicatorWidth;
- int _indicatorHeight;
-
char *_localSaveDir;
bool _saveDirChecked;
bool _richSavedGames;
char *_savedGameExt;
- char *_loadImageName;
- char *_saveImageName;
- int _saveImageX;
- int _saveImageY;
- int _loadImageX;
- int _loadImageY;
-
- BaseSurface *_saveLoadImage;
-
bool _reportTextureFormat;
// FPS stuff
@@ -324,10 +298,6 @@ private: bool _personalizedSave;
- bool emptySaveSlot(int slot);
- bool isSaveSlotUsed(int slot);
- bool getSaveSlotDescription(int slot, char *buffer);
- bool getSaveSlotFilename(int slot, char *buffer);
void setWindowTitle();
bool resumeMusic(int channel);
diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index cc6167a749..cd065f3436 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -32,6 +32,7 @@ #include "engines/wintermute/base/base_sub_frame.h"
#include "engines/wintermute/base/base_region.h"
#include "engines/wintermute/platform_osystem.h"
+#include "engines/wintermute/base/base_persistence_manager.h"
namespace WinterMute {
@@ -44,6 +45,22 @@ BaseRenderer::BaseRenderer(BaseGame *inGame) : BaseClass(inGame) { _windowed = true;
_forceAlphaColor = 0x00;
+ _indicatorDisplay = false;
+ _indicatorColor = BYTETORGBA(255, 0, 0, 128);
+ _indicatorProgress = 0;
+ _indicatorX = -1;
+ _indicatorY = -1;
+ _indicatorWidth = -1;
+ _indicatorHeight = 8;
+
+ _loadImageName = "";
+ _saveImageName = "";
+ _saveLoadImage = NULL;
+ _loadInProgress = false;
+
+ _saveImageX = _saveImageY = 0;
+ _loadImageX = _loadImageY = 0;
+
_width = _height = _bPP = 0;
BasePlatform::setRectEmpty(&_monitorRect);
@@ -56,6 +73,7 @@ BaseRenderer::BaseRenderer(BaseGame *inGame) : BaseClass(inGame) { BaseRenderer::~BaseRenderer() {
deleteRectList();
unclipCursor();
+ delete _saveLoadImage;
}
@@ -64,6 +82,90 @@ void BaseRenderer::initLoop() { deleteRectList();
}
+void BaseRenderer::initIndicator() {
+ if (_indicatorY == -1) {
+ _indicatorY = _height - _indicatorHeight;
+ }
+ if (_indicatorX == -1) {
+ _indicatorX = 0;
+ }
+ if (_indicatorWidth == -1) {
+ _indicatorWidth = _width;
+ }
+}
+
+void BaseRenderer::setIndicator(int width, int height, int x, int y, uint32 color) {
+ _indicatorWidth = width;
+ _indicatorHeight = height;
+ _indicatorX = x;
+ _indicatorY = y;
+ _indicatorColor = color;
+}
+
+void BaseRenderer::setIndicatorVal(int value) {
+ _indicatorProgress = value;
+}
+
+void BaseRenderer::setLoadingScreen(const char *filename, int x, int y) {
+ // TODO: Handle NULL
+ _loadImageName = filename;
+ _loadImageX = x;
+ _loadImageY = y;
+}
+
+void BaseRenderer::setSaveImage(const char *filename, int x, int y) {
+ // TODO: Handle NULL
+ _saveImageName = filename;
+ _saveImageX = x;
+ _saveImageY = y;
+}
+
+void BaseRenderer::initSaveLoad(bool isSaving, bool quickSave) {
+ _indicatorDisplay = true;
+ _indicatorProgress = 0;
+
+ if (isSaving && !quickSave) {
+ delete _saveLoadImage;
+ _saveLoadImage = NULL;
+ if (_saveImageName.size()) {
+ _saveLoadImage = createSurface();
+
+ if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_saveImageName, true, 0, 0, 0))) {
+ delete _saveLoadImage;
+ _saveLoadImage = NULL;
+ }
+ }
+ } else {
+ delete _saveLoadImage;
+ _saveLoadImage = NULL;
+ if (_loadImageName.size()) {
+ _saveLoadImage = createSurface();
+
+ if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_loadImageName, true, 0, 0, 0))) {
+ delete _saveLoadImage;
+ _saveLoadImage = NULL;
+ }
+ }
+ _loadInProgress = true;
+ }
+}
+
+void BaseRenderer::endSaveLoad() {
+ _loadInProgress = false;
+ _indicatorDisplay = false;
+
+ delete _saveLoadImage;
+ _saveLoadImage = NULL;
+}
+
+void BaseRenderer::persistSaveLoadImages(BasePersistenceManager *persistMgr) {
+ persistMgr->transfer(TMEMBER(_loadImageName));
+ persistMgr->transfer(TMEMBER(_saveImageName));
+ persistMgr->transfer(TMEMBER(_saveImageX));
+ persistMgr->transfer(TMEMBER(_saveImageY));
+ persistMgr->transfer(TMEMBER(_loadImageX));
+ persistMgr->transfer(TMEMBER(_loadImageY));
+}
//////////////////////////////////////////////////////////////////////
BaseObject *BaseRenderer::getObjectAt(int x, int y) {
@@ -234,4 +336,31 @@ void BaseRenderer::addRectToList(BaseActiveRect *rect) { _rectList.push_back(rect);
}
+//////////////////////////////////////////////////////////////////////////
+bool BaseRenderer::displayIndicator() {
+ if (!_indicatorDisplay) {
+ return STATUS_OK;
+ }
+ if (_saveLoadImage) {
+ Rect32 rc;
+ BasePlatform::setRect(&rc, 0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight());
+ if (_loadInProgress) {
+ _saveLoadImage->displayTrans(_loadImageX, _loadImageY, rc);
+ } else {
+ _saveLoadImage->displayTrans(_saveImageX, _saveImageY, rc);
+ }
+ }
+
+ if ((!_indicatorDisplay && _indicatorWidth <= 0) || _indicatorHeight <= 0) {
+ return STATUS_OK;
+ }
+ setupLines();
+ for (int i = 0; i < _indicatorHeight; i++) {
+ drawLine(_indicatorX, _indicatorY + i, _indicatorX + (int)(_indicatorWidth * (float)((float)_indicatorProgress / 100.0f)), _indicatorY + i, _indicatorColor);
+ }
+
+ setup2D();
+ return STATUS_OK;
+}
+
} // end of namespace WinterMute
diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h index 008db69713..a36a3ca9c0 100644 --- a/engines/wintermute/base/gfx/base_renderer.h +++ b/engines/wintermute/base/gfx/base_renderer.h @@ -40,6 +40,7 @@ class BaseImage; class BaseActiveRect;
class BaseObject;
class BaseSurface;
+class BasePersistenceManager;
/**
* @class BaseRenderer a common interface for the rendering portion of WME
@@ -166,6 +167,35 @@ public: uint32 _forceAlphaColor;
void addRectToList(BaseActiveRect *rect);
+
+ // Indicator & Save/Load-related functions
+ void initIndicator();
+ void setIndicatorVal(int value);
+ void setIndicator(int width, int height, int x, int y, uint32 color);
+ void persistSaveLoadImages(BasePersistenceManager *persistMgr);
+ void initSaveLoad(bool isSaving, bool quickSave = false);
+ void endSaveLoad();
+ void setLoadingScreen(const char *filename, int x, int y);
+ void setSaveImage(const char *filename, int x, int y);
+
+ bool displayIndicator();
+private:
+ Common::String _loadImageName;
+ Common::String _saveImageName;
+ int _saveImageX;
+ int _saveImageY;
+ int _loadImageX;
+ int _loadImageY;
+ BaseSurface *_saveLoadImage;
+
+ uint32 _indicatorColor;
+ int _indicatorX;
+ int _indicatorY;
+ int _indicatorWidth;
+ int _indicatorHeight;
+ bool _loadInProgress;
+ bool _indicatorDisplay;
+ int _indicatorProgress;
protected:
uint32 _clipperWindow;
diff --git a/engines/wintermute/base/saveload.cpp b/engines/wintermute/base/saveload.cpp new file mode 100644 index 0000000000..aea474fd44 --- /dev/null +++ b/engines/wintermute/base/saveload.cpp @@ -0,0 +1,198 @@ +/* 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. + * + */ + +/* + * This file is based on WME Lite. + * http://dead-code.org/redir.php?target=wmelite + * Copyright (c) 2011 Jan Nedoma + */ + +#include "engines/wintermute/base/base_persistence_manager.h" +#include "engines/wintermute/wintermute.h" +#include "engines/wintermute/base/saveload.h" +#include "engines/wintermute/ad/ad_scene.h" +#include "engines/wintermute/base/base_game.h" // Temporary +#include "engines/wintermute/base/base_region.h" +#include "engines/wintermute/base/base_sub_frame.h" +#include "engines/wintermute/base/font/base_font.h" +#include "engines/wintermute/base/sound/base_sound.h" +#include "engines/wintermute/base/scriptables/script.h" +#include "common/savefile.h" +#include "common/config-manager.h" + +namespace WinterMute { + +bool SaveLoad::loadGame(const Common::String &filename, BaseGame *gameRef) { + gameRef->LOG(0, "Loading game '%s'...", filename.c_str()); + + bool ret; + + gameRef->_renderer->initSaveLoad(false); + + gameRef->_loadInProgress = true; + BasePersistenceManager *pm = new BasePersistenceManager(); + if (DID_SUCCEED(ret = pm->initLoad(filename))) { + //if (DID_SUCCEED(ret = cleanup())) { + if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->loadTable(gameRef, pm))) { + if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->loadInstances(gameRef, pm))) { + // data initialization after load + SaveLoad::initAfterLoad(); + + gameRef->applyEvent("AfterLoad", true); + + gameRef->displayContent(true, false); + //_renderer->flip(); + } + } + } + + delete pm; + gameRef->_loadInProgress = false; + + gameRef->_renderer->endSaveLoad(); + + //_gameRef->LOG(0, "Load end %d", BaseUtils::GetUsedMemMB()); + // AdGame: + if (DID_SUCCEED(ret)) { + SystemClassRegistry::getInstance()->enumInstances(SaveLoad::afterLoadRegion, "AdRegion", NULL); + } + return ret; +} + +bool SaveLoad::saveGame(int slot, const char *desc, bool quickSave, BaseGame *gameRef) { + Common::String filename = SaveLoad::getSaveSlotFilename(slot); + + gameRef->LOG(0, "Saving game '%s'...", filename.c_str()); + + gameRef->applyEvent("BeforeSave", true); + + bool ret; + + BasePersistenceManager *pm = new BasePersistenceManager(); + if (DID_SUCCEED(ret = pm->initSave(desc))) { + gameRef->_renderer->initSaveLoad(true, quickSave); // TODO: The original code inited the indicator before the conditionals + if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->saveTable(gameRef, pm, quickSave))) { + if (DID_SUCCEED(ret = SystemClassRegistry::getInstance()->saveInstances(gameRef, pm, quickSave))) { + if (DID_SUCCEED(ret = pm->saveFile(filename))) { + ConfMan.setInt("most_recent_saveslot", slot); + } + } + } + } + + delete pm; + + gameRef->_renderer->endSaveLoad(); + + return ret; +} + +////////////////////////////////////////////////////////////////////////// +bool SaveLoad::initAfterLoad() { + SystemClassRegistry::getInstance()->enumInstances(afterLoadRegion, "BaseRegion", NULL); + SystemClassRegistry::getInstance()->enumInstances(afterLoadSubFrame, "BaseSubFrame", NULL); + SystemClassRegistry::getInstance()->enumInstances(afterLoadSound, "BaseSound", NULL); + SystemClassRegistry::getInstance()->enumInstances(afterLoadFont, "BaseFontTT", NULL); + SystemClassRegistry::getInstance()->enumInstances(afterLoadScript, "ScScript", NULL); + // AdGame: + SystemClassRegistry::getInstance()->enumInstances(afterLoadScene, "AdScene", NULL); + return STATUS_OK; +} + +////////////////////////////////////////////////////////////////////////// +void SaveLoad::afterLoadScene(void *scene, void *data) { + ((AdScene *)scene)->afterLoad(); +} + +////////////////////////////////////////////////////////////////////////// +void SaveLoad::afterLoadRegion(void *region, void *data) { + ((BaseRegion *)region)->createRegion(); +} + + +////////////////////////////////////////////////////////////////////////// +void SaveLoad::afterLoadSubFrame(void *subframe, void *data) { + ((BaseSubFrame *)subframe)->setSurfaceSimple(); +} + + +////////////////////////////////////////////////////////////////////////// +void SaveLoad::afterLoadSound(void *sound, void *data) { + ((BaseSound *)sound)->setSoundSimple(); +} + +////////////////////////////////////////////////////////////////////////// +void SaveLoad::afterLoadFont(void *font, void *data) { + ((BaseFont *)font)->afterLoad(); +} + +////////////////////////////////////////////////////////////////////////// +void SaveLoad::afterLoadScript(void *script, void *data) { + ((ScScript *)script)->afterLoad(); +} + +Common::String SaveLoad::getSaveSlotFilename(int slot) { + BasePersistenceManager *pm = new BasePersistenceManager(); + Common::String filename = pm->getFilenameForSlot(slot); + delete pm; + debugC(kWinterMuteDebugSaveGame, "getSaveSlotFileName(%d) = %s", slot, filename.c_str()); + return filename; +} + +bool SaveLoad::getSaveSlotDescription(int slot, char *buffer) { + buffer[0] = '\0'; + + Common::String filename = getSaveSlotFilename(slot); + BasePersistenceManager *pm = new BasePersistenceManager(); + if (!pm) { + return false; + } + + if (!(pm->initLoad(filename))) { + delete pm; + return false; + } + + strcpy(buffer, pm->_savedDescription); + delete pm; + + return true; +} + +bool SaveLoad::isSaveSlotUsed(int slot) { + Common::String filename = getSaveSlotFilename(slot); + BasePersistenceManager *pm = new BasePersistenceManager(); + bool ret = pm->getSaveExists(slot); + delete pm; + return ret; +} + +bool SaveLoad::emptySaveSlot(int slot) { + Common::String filename = getSaveSlotFilename(slot); + BasePersistenceManager *pm = new BasePersistenceManager(); + g_wintermute->getSaveFileMan()->removeSavefile(pm->getFilenameForSlot(slot)); + delete pm; + return true; +} + + +} // end of namespace WinterMute diff --git a/engines/wintermute/base/saveload.h b/engines/wintermute/base/saveload.h new file mode 100644 index 0000000000..59cdceb038 --- /dev/null +++ b/engines/wintermute/base/saveload.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +/* + * This file is based on WME Lite. + * http://dead-code.org/redir.php?target=wmelite + * Copyright (c) 2011 Jan Nedoma + */ + +#ifndef WINTERMUTE_SAVEGAME_H +#define WINTERMUTE_SAVEGAME_H + +#include "common/str.h" + +namespace WinterMute { +class BaseGame; +class SaveLoad { +public: + static bool emptySaveSlot(int slot); + static bool isSaveSlotUsed(int slot); + static bool getSaveSlotDescription(int slot, char *buffer); + static Common::String getSaveSlotFilename(int slot); + + static bool loadGame(const Common::String &filename, BaseGame *gameRef); + static bool saveGame(int slot, const char *desc, bool quickSave, BaseGame *gameRef); + static bool initAfterLoad(); + static void afterLoadScene(void *scene, void *data); + static void afterLoadRegion(void *region, void *data); +private: + static void afterLoadSubFrame(void *subframe, void *data); + static void afterLoadSound(void *sound, void *data); + static void afterLoadFont(void *font, void *data); + static void afterLoadScript(void *script, void *data); +}; + +} // end of namespace WinterMute + +#endif diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk index 2d253bca84..ee36e4d7a6 100644 --- a/engines/wintermute/module.mk +++ b/engines/wintermute/module.mk @@ -84,6 +84,7 @@ MODULE_OBJS := \ base/base_surface_storage.o \ base/base_transition_manager.o \ base/base_viewport.o \ + base/saveload.o \ detection.o \ graphics/transparent_surface.o \ graphics/tga.o \ diff --git a/engines/wintermute/system/sys_class_registry.cpp b/engines/wintermute/system/sys_class_registry.cpp index 09e43529e3..e991fb3f07 100644 --- a/engines/wintermute/system/sys_class_registry.cpp +++ b/engines/wintermute/system/sys_class_registry.cpp @@ -200,7 +200,7 @@ bool SystemClassRegistry::saveTable(BaseGame *gameRef, BasePersistenceManager *p counter++;
if (!quickSave) {
- gameRef->_indicatorProgress = (int)(50.0f / (float)((float)_classes.size() / (float)counter));
+ gameRef->_renderer->setIndicatorVal((int)(50.0f / (float)((float)_classes.size() / (float)counter)));
gameRef->displayContent(false);
gameRef->_renderer->flip();
}
@@ -234,7 +234,7 @@ bool SystemClassRegistry::loadTable(BaseGame *gameRef, BasePersistenceManager *p uint32 numClasses = persistMgr->getDWORD();
for (uint32 i = 0; i < numClasses; i++) {
- gameRef->_indicatorProgress = (int)(50.0f / (float)((float)numClasses / (float)i));
+ gameRef->_renderer->setIndicatorVal((int)(50.0f / (float)((float)numClasses / (float)i)));
gameRef->displayContentSimple();
gameRef->_renderer->flip();
@@ -270,7 +270,7 @@ bool SystemClassRegistry::saveInstances(BaseGame *gameRef, BasePersistenceManage if (!quickSave) {
if (counter % 20 == 0) {
- gameRef->_indicatorProgress = (int)(50.0f + 50.0f / (float)((float)_classes.size() / (float)counter));
+ gameRef->_renderer->setIndicatorVal((int)(50.0f + 50.0f / (float)((float)_classes.size() / (float)counter)));
gameRef->displayContent(false);
gameRef->_renderer->flip();
}
@@ -290,7 +290,7 @@ bool SystemClassRegistry::loadInstances(BaseGame *gameRef, BasePersistenceManage for (int i = 0; i < numInstances; i++) {
if (i % 20 == 0) {
- gameRef->_indicatorProgress = (int)(50.0f + 50.0f / (float)((float)numInstances / (float)i));
+ gameRef->_renderer->setIndicatorVal((int)(50.0f + 50.0f / (float)((float)numInstances / (float)i)));
gameRef->displayContentSimple();
gameRef->_renderer->flip();
}
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 68a9dd6e13..af0251d01a 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -144,33 +144,6 @@ int WinterMuteEngine::init() { bool windowedMode = !ConfMan.getBool("fullscreen"); - // parse command line - char *saveGame = NULL; - /* for (int i = 0; i < argc; i++) { - strcpy(param, argv[i]); - - if (scumm_stricmp(param, "-project") == 0) { - if (argc > i) strcpy(param, argv[i + 1]); - else param[0] = '\0'; - - if (strcmp(param, "") != 0) { - char *iniDir = BaseUtils::GetPath(param); - char *iniName = BaseUtils::GetFilename(param); - - // switch to ini's dir - warning("TODO: Place ini-files somewhere"); - // chdir(IniDir); - - // set ini name - sprintf(param, "./%s", IniName); - _game->_registry->SetIniName(param); - - delete[] IniDir; - delete[] IniName; - } - } else if (scumm_stricmp(param, "-windowed") == 0) windowedMode = true; - }*/ - if (ConfMan.hasKey("debug_mode")) { if (ConfMan.getBool("debug_mode")) { _game->DEBUG_DebugEnable("./wme.log"); @@ -240,7 +213,7 @@ int WinterMuteEngine::init() { _game = NULL; return false; } - //_game->setWindowTitle(); + _game->_renderer->_ready = true; _game->_miniUpdateEnabled = true; @@ -252,11 +225,6 @@ int WinterMuteEngine::init() { _game->loadGame(slot); } - if (saveGame) { - _game->loadGame(saveGame); - delete[] saveGame; - } - // all set, ready to go return 0; } |