diff options
| author | Travis Howell | 2003-12-11 03:50:25 +0000 | 
|---|---|---|
| committer | Travis Howell | 2003-12-11 03:50:25 +0000 | 
| commit | 324da16de276806239697c2846b862e18567da49 (patch) | |
| tree | d4cd1d9936ee7412314a6e127708694a02bad935 | |
| parent | 46f00d079c63d58b4d59e922bfdd3049a4ec6caa (diff) | |
| download | scummvm-rg350-324da16de276806239697c2846b862e18567da49.tar.gz scummvm-rg350-324da16de276806239697c2846b862e18567da49.tar.bz2 scummvm-rg350-324da16de276806239697c2846b862e18567da49.zip | |
Add dialog for quick load/save in simon1/2.
svn-id: r11564
| -rw-r--r-- | simon/simon.cpp | 63 | ||||
| -rw-r--r-- | simon/simon.h | 1 | 
2 files changed, 44 insertions, 20 deletions
| diff --git a/simon/simon.cpp b/simon/simon.cpp index 49306c9b98..7d9bf67912 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -4761,6 +4761,46 @@ void SimonEngine::shutdown() {  	_system->quit();  } +void SimonEngine::quick_load_or_save() { +	bool success; +	char buf[256]; + +	if (_saveLoadFlag == 2) { +		Subroutine *sub; +		success = load_game(_saveLoadSlot); +		if (!success) { +			sprintf(buf, "Failed to save game state to file:\n\n%s", _saveLoadName); +		} else { +			// Redraw Inventory +			lock(); +			fcs_unk_proc_1(2, getItem1Ptr(), 0, 0); +			unlock(); +			// Reset engine? +			vc_set_bit_to(97, true); +			sub = getSubroutineByID(100); +			startSubroutine(sub); +		} +	} else { +		success = save_game(_saveLoadSlot, _saveLoadName); +		if (!success) +			sprintf(buf, "Failed to load game state to file:\n\n%s", _saveLoadName); +	} + +	if (!success) { +		GUI::MessageDialog dialog(buf, "OK"); +		dialog.runModal(); + +	} else if (_saveLoadFlag == 1) { +		sprintf(buf, "Successfully saved game state in file:\n\n%s", _saveLoadName); +		GUI::TimedMessageDialog dialog(buf, 1500); +		dialog.runModal(); + +	} + +	_saveLoadFlag = 0; +} + +  void SimonEngine::delay(uint amount) {  	OSystem::Event event; @@ -4797,7 +4837,6 @@ void SimonEngine::delay(uint amount) {  					&& (event.kbd.flags == OSystem::KBD_ALT ||  						event.kbd.flags == OSystem::KBD_CTRL)) {  					_saveLoadSlot = event.kbd.keycode - '0'; -  					sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);  					_saveLoadFlag = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2; @@ -4805,25 +4844,9 @@ void SimonEngine::delay(uint amount) {  					// This stops load/save during cutscenes  					// But can still load/save during converstation  					// TODO: Add dialog to confirm game was saved. -					if (!_lock_counter) { -						if (_saveLoadFlag == 2) { -							Subroutine *sub; -							load_game(_saveLoadSlot); -							// Redraw Inventory -							lock(); -							fcs_unk_proc_1(2, getItem1Ptr(), 0, 0); -							unlock(); -							// Reset engine? -							vc_set_bit_to(97, true); -							sub = getSubroutineByID(100); -							startSubroutine(sub); -						} else { -							save_game(_saveLoadSlot, _saveLoadName); -						} -						_saveLoadFlag = 0; -					} -				} -				if (event.kbd.flags == OSystem::KBD_CTRL) { +					if (!_lock_counter) +						quick_load_or_save(); +				} else if (event.kbd.flags == OSystem::KBD_CTRL) {  					if (event.kbd.keycode == 'f')  						_fast_mode ^= 1;  				} diff --git a/simon/simon.h b/simon/simon.h index d276e0c857..9b6e55a9f6 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -763,6 +763,7 @@ protected:  	void print_char_helper_1(const byte *src, uint len);  	void print_char_helper_5(FillOrCopyStruct *fcs); +	void quick_load_or_save();  	void shutdown();  	byte *vc_10_depack_swap(byte *src, uint w, uint h); | 
