mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-29 14:42:26 +00:00
HUGO: Get rid of initial savegame
svn-id: r54503
This commit is contained in:
parent
a0cc07268d
commit
bab5aa433b
@ -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";
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
@ -457,41 +448,6 @@ void FileManager::restoreGame(int16 slot) {
|
||||
delete in;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
@ -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");
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
const char *_episode;
|
||||
const char *_picDir;
|
||||
|
||||
Common::String _initFilename, _saveFilename;
|
||||
Common::String _saveFilename;
|
||||
|
||||
command_t _statusLine;
|
||||
command_t _scoreLine;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user