aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Boutonné2010-11-26 23:17:16 +0000
committerArnaud Boutonné2010-11-26 23:17:16 +0000
commitbab5aa433bb4319edfddfde7ed03cfeed337a884 (patch)
tree6309f99541eb9f6061f90c1f807ebc938c8ae91c
parenta0cc07268d53a369ae180c8eddeb29e3f8b94889 (diff)
downloadscummvm-rg350-bab5aa433bb4319edfddfde7ed03cfeed337a884.tar.gz
scummvm-rg350-bab5aa433bb4319edfddfde7ed03cfeed337a884.tar.bz2
scummvm-rg350-bab5aa433bb4319edfddfde7ed03cfeed337a884.zip
HUGO: Get rid of initial savegame
svn-id: r54503
-rw-r--r--engines/hugo/detection.cpp3
-rw-r--r--engines/hugo/file.cpp52
-rw-r--r--engines/hugo/file.h1
-rw-r--r--engines/hugo/game.h6
-rw-r--r--engines/hugo/hugo.cpp20
-rw-r--r--engines/hugo/hugo.h2
-rw-r--r--engines/hugo/intro_v1w.cpp1
7 files changed, 16 insertions, 69 deletions
diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp
index d10b50d0b7..a4bc5a4c1c 100644
--- a/engines/hugo/detection.cpp
+++ b/engines/hugo/detection.cpp
@@ -194,8 +194,7 @@ void HugoEngine::initGame(const HugoGameDescription *gd) {
_packedFl = (getFeatures() & GF_PACKED);
_gameVariant = _gameType - 1 + ((_platform == Common::kPlatformWindows) ? 0 : 3);
- // Generate filenames
- _initFilename = _targetName + "-00.SAV";
+ // Generate filename
_saveFilename = _targetName + "-%d.SAV";
}
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index 0c2baffcae..78bcc46e85 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -297,19 +297,13 @@ bool FileManager::fileExists(char *filename) {
}
/**
-* Save game to supplied slot (-1 is INITFILE)
+* Save game to supplied slot
*/
void FileManager::saveGame(int16 slot, const char *descrip) {
debugC(1, kDebugFile, "saveGame(%d, %s)", slot, descrip);
// Get full path of saved game file - note test for INITFILE
- Common::String path; // Full path of saved game
-
- if (slot == -1)
- path = _vm->_initFilename;
- else
- path = Common::String::format(_vm->_saveFilename.c_str(), slot);
-
+ Common::String path = Common::String::format(_vm->_saveFilename.c_str(), slot);
Common::WriteStream *out = _vm->getSaveFileManager()->openForSaving(path);
if (!out) {
warning("Can't create file '%s', game not saved", path.c_str());
@@ -374,7 +368,7 @@ void FileManager::saveGame(int16 slot, const char *descrip) {
}
/**
-* Restore game from supplied slot number (-1 is INITFILE)
+* Restore game from supplied slot number
*/
void FileManager::restoreGame(int16 slot) {
debugC(1, kDebugFile, "restoreGame(%d)", slot);
@@ -385,10 +379,7 @@ void FileManager::restoreGame(int16 slot) {
// Get full path of saved game file - note test for INITFILE
Common::String path; // Full path of saved game
- if (slot == -1)
- path = _vm->_initFilename;
- else
- path = Common::String::format(_vm->_saveFilename.c_str(), slot);
+ path = Common::String::format(_vm->_saveFilename.c_str(), slot);
Common::SeekableReadStream *in = _vm->getSaveFileManager()->openForLoading(path);
if (!in)
@@ -458,41 +449,6 @@ void FileManager::restoreGame(int16 slot) {
}
/**
-* Initialize the size of a saved game (from the fixed initial game).
-* If status.initsave is TRUE, or the initial saved game is not found,
-* force a save to create one. Normally the game will be shipped with
-* the initial game file but useful to force a write during development
-* when the size is changeable.
-* The net result is a valid INITFILE, with status.savesize initialized.
-*/
-void FileManager::initSavedGame() {
- debugC(1, kDebugFile, "initSavedGame");
-
- // Force save of initial game
- if (_vm->getGameStatus().initSaveFl)
- saveGame(-1, "");
-
- // If initial game doesn't exist, create it
- Common::SeekableReadStream *in = _vm->getSaveFileManager()->openForLoading(_vm->_initFilename);
- if (!in) {
- saveGame(-1, "");
- in = _vm->getSaveFileManager()->openForLoading(_vm->_initFilename);
- if (!in) {
- warning("Unable to write file: %s", _vm->_initFilename.c_str());
- return;
- }
- }
-
- // Must have an open saved game now
- _vm->getGameStatus().saveSize = in->size();
- delete in;
-
- // Check sanity - maybe disk full or path set to read-only drive?
- if (_vm->getGameStatus().saveSize <= 0)
- warning("Unable to write file: %s", _vm->_initFilename.c_str());
-}
-
-/**
* Read the encrypted text from the boot file and print it
*/
void FileManager::printBootText() {
diff --git a/engines/hugo/file.h b/engines/hugo/file.h
index 6f0dbb0c98..94b51e68ef 100644
--- a/engines/hugo/file.h
+++ b/engines/hugo/file.h
@@ -58,7 +58,6 @@ public:
bool fileExists(char *filename);
sound_pt getSound(short sound, uint16 *size);
- void initSavedGame();
void instructions();
void readBootFile();
void readImage(int objNum, object_t *objPtr);
diff --git a/engines/hugo/game.h b/engines/hugo/game.h
index 44831a8d30..01e3788ad0 100644
--- a/engines/hugo/game.h
+++ b/engines/hugo/game.h
@@ -818,11 +818,9 @@ struct hotspot_t {
};
struct status_t { // Game status (not saved)
- bool initSaveFl; // Force save of initial game
bool storyModeFl; // Game is telling story - no commands
bool gameOverFl; // Game is over - hero knobbled
bool demoFl; // Game is in demo mode
- bool debugFl; // Game is in debug mode
bool textBoxFl; // Game is (halted) in text box
bool lookFl; // Toolbar "look" button pressed
bool recallFl; // Toolbar "recall" button pressed
@@ -842,16 +840,16 @@ struct status_t { // Game status (not saved)
go_t go_for; // Purpose of an automatic route
int16 go_id; // Index of exit of object walking to
fpath_t path; // Alternate path for saved files
- long saveSize; // Size of a saved game
int16 saveSlot; // Current slot to save/restore game
- int16 screenWidth; // Desktop screen width
int16 song; // Current song
int16 cx, cy; // Cursor position (dib coords)
+
// Strangerke - Suppress as related to playback
// bool playbackFl; // Game is in playback mode
// bool recordFl; // Game is in record mode
// Strangerke - Not used ?
// bool mmtimeFl; // Multimedia timer supported
+// int16 screenWidth; // Desktop screen width
// uint32 saveTick; // Time of last save in ticks
};
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 388c6bbf6c..06cd7db62b 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -254,8 +254,6 @@ Common::Error HugoEngine::run() {
initialize();
initConfig(RESET); // Reset user's config
- _file->restoreGame(-1);
-
initMachine();
// Start the state machine
@@ -903,16 +901,10 @@ void HugoEngine::initPlaylist(bool playlist[MAX_TUNES]) {
*/
void HugoEngine::initStatus() {
debugC(1, kDebugEngine, "initStatus");
- _status.initSaveFl = true; // Force initial save
_status.storyModeFl = false; // Not in story mode
_status.gameOverFl = false; // Hero not knobbled yet
-// Strangerke - Suppress as related to playback
-// _status.recordFl = false; // Not record mode
-// _status.playbackFl = false; // Not playback mode
_status.demoFl = false; // Not demo mode
_status.textBoxFl = false; // Not processing a text box
-// Strangerke - Not used ?
-// _status.mmtime = false; // Multimedia timer support
_status.lookFl = false; // Toolbar "look" button
_status.recallFl = false; // Toolbar "recall" button
_status.leftButtonFl = false; // Left mouse button pressed
@@ -924,11 +916,9 @@ void HugoEngine::initStatus() {
_status.doQuitFl = false;
_status.path[0] = 0; // Path to write files
_status.saveSlot = 0; // Slot to save/restore game
- _status.screenWidth = 0; // Desktop screen width
// Initialize every start of new game
_status.tick = 0; // Tick count
-// _status.saveTick = 0; // Time of last save
_status.viewState = V_IDLE; // View state
_status.inventoryState = I_OFF; // Inventory icon bar state
_status.inventoryHeight = 0; // Inventory icon bar pos
@@ -936,6 +926,14 @@ void HugoEngine::initStatus() {
_status.routeIndex = -1; // Hero not following a route
_status.go_for = GO_SPACE; // Hero walking to space
_status.go_id = -1; // Hero not walking to anything
+
+// Strangerke - Suppress as related to playback
+// _status.recordFl = false; // Not record mode
+// _status.playbackFl = false; // Not playback mode
+// Strangerke - Not used ?
+// _status.mmtime = false; // Multimedia timer support
+// _status.screenWidth = 0; // Desktop screen width
+// _status.saveTick = 0; // Time of last save
}
/**
@@ -965,8 +963,6 @@ void HugoEngine::initConfig(inst_t action) {
break;
}
}
-
- _file->initSavedGame(); // Initialize saved game
break;
case RESTORE:
warning("Unhandled action RESTORE");
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index 197fc52458..24cb4145cc 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -165,7 +165,7 @@ public:
const char *_episode;
const char *_picDir;
- Common::String _initFilename, _saveFilename;
+ Common::String _saveFilename;
command_t _statusLine;
command_t _scoreLine;
diff --git a/engines/hugo/intro_v1w.cpp b/engines/hugo/intro_v1w.cpp
index bdea2837b1..923cd3658f 100644
--- a/engines/hugo/intro_v1w.cpp
+++ b/engines/hugo/intro_v1w.cpp
@@ -49,7 +49,6 @@ intro_v1w::~intro_v1w() {
* Auto-start a new game
*/
void intro_v1w::preNewGame() {
- _vm->_file->restoreGame(-1);
_vm->getGameStatus().viewState = V_INTROINIT;
}