[Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.358,1.359 simon.h,1.106,1.107
Travis Howell
kirben at users.sourceforge.net
Wed Dec 10 19:51:03 CET 2003
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv5359/simon
Modified Files:
simon.cpp simon.h
Log Message:
Add dialog for quick load/save in simon1/2.
Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.358
retrieving revision 1.359
diff -u -d -r1.358 -r1.359
--- simon.cpp 11 Dec 2003 03:23:07 -0000 1.358
+++ simon.cpp 11 Dec 2003 03:50:25 -0000 1.359
@@ -4761,6 +4761,46 @@
_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 @@
&& (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 @@
// 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;
}
Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- simon.h 11 Dec 2003 02:09:18 -0000 1.106
+++ simon.h 11 Dec 2003 03:50:25 -0000 1.107
@@ -763,6 +763,7 @@
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);
More information about the Scummvm-git-logs
mailing list