[Scummvm-git-logs] scummvm master -> 73a4f228f6c8c17db4ba9c25b343dc1cf5847cee

dreammaster paulfgilbert at gmail.com
Mon Aug 19 00:19:15 CEST 2019


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
34f842e4b8 GLK: FROTZ: Fix creating text vs buffer windows
1f38a8239f GLK: FROTZ: Whitespace fixes
73a4f228f6 XEEN: Implement autosave support


Commit: 34f842e4b828b1aaf0149a67bf1ad3bc04c26b09
    https://github.com/scummvm/scummvm/commit/34f842e4b828b1aaf0149a67bf1ad3bc04c26b09
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-08-18T15:18:57-07:00

Commit Message:
GLK: FROTZ: Fix creating text vs buffer windows

Changed paths:
    engines/glk/frotz/windows.cpp


diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp
index bb5f804..be65e8e 100644
--- a/engines/glk/frotz/windows.cpp
+++ b/engines/glk/frotz/windows.cpp
@@ -315,6 +315,7 @@ void Window::setStyle(int style) {
 	if (g_vm->gos_linepending && _windows->currWin() == g_vm->gos_linewin)
 		return;
 
+	_currStyle = style;
 	updateStyle();
 }
 
@@ -380,7 +381,7 @@ void Window::createGlkWindow() {
 		_windows->showTextWindows();
 
 	// Create a new window	
-	if (_index == 1) {
+	if (_index != 0 || (_currStyle & FIXED_WIDTH_STYLE)) {
 		// Text grid window
 		_win = g_vm->glk_window_open(g_vm->glk_window_get_root(),
 			winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextGrid, 0);


Commit: 1f38a8239f5fb5b6c9a89b299cd9de1694176df6
    https://github.com/scummvm/scummvm/commit/1f38a8239f5fb5b6c9a89b299cd9de1694176df6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-08-18T15:18:57-07:00

Commit Message:
GLK: FROTZ: Whitespace fixes

Changed paths:
    engines/glk/frotz/processor_screen.cpp
    engines/glk/frotz/processor_streams.cpp
    engines/glk/frotz/processor_text.cpp


diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp
index 0d6023e..1dcd78a 100644
--- a/engines/glk/frotz/processor_screen.cpp
+++ b/engines/glk/frotz/processor_screen.cpp
@@ -451,8 +451,8 @@ void Processor::z_show_status() {
 		brief = true;
 
 	// Print the object description for the global variable 0
-	print_char (' ');
-	print_object (global0);
+	print_char(' ');
+	print_object(global0);
 
 	// A header flag tells us whether we have to display the current
 	// time or the score/moves information
@@ -462,34 +462,34 @@ void Processor::z_show_status() {
 
 		pad_status_line (brief ? 15 : 20);
 
-		print_string ("Time: ");
+		print_string("Time: ");
 
 		if (hours < 10)
-			print_char (' ');
-		print_num (hours);
+			print_char(' ');
+		print_num(hours);
 
-		print_char (':');
+		print_char(':');
 
 		if (global2 < 10)
-			print_char ('0');
-		print_num (global2);
+			print_char('0');
+		print_num(global2);
 
-		print_char (' ');
+		print_char(' ');
 
-		print_char ((global1 >= 12) ? 'p' : 'a');
-		print_char ('m');
+		print_char((global1 >= 12) ? 'p' : 'a');
+		print_char('m');
 
 	} else {
 		// print score and moves
 		pad_status_line (brief ? 15 : 30);
 
-		print_string (brief ? "S: " : "Score: ");
-		print_num (global1);
+		print_string(brief ? "S: " : "Score: ");
+		print_num(global1);
 
 		pad_status_line (brief ? 8 : 14);
 
-		print_string (brief ? "M: " : "Moves: ");
-		print_num (global2);
+		print_string(brief ? "M: " : "Moves: ");
+		print_num(global2);
 	}
 
 	// Pad the end of the status line with spaces
diff --git a/engines/glk/frotz/processor_streams.cpp b/engines/glk/frotz/processor_streams.cpp
index 6809998..3b414af 100644
--- a/engines/glk/frotz/processor_streams.cpp
+++ b/engines/glk/frotz/processor_streams.cpp
@@ -155,7 +155,7 @@ continue_input:
 
 	// Handle timeouts
 	if (key == ZC_TIME_OUT)
-		if (direct_call (routine) == 0)
+		if (direct_call(routine) == 0)
 			goto continue_input;
 
 	// Return key
@@ -490,22 +490,34 @@ void Processor::z_output_stream() {
 	flush_buffer();
 
 	switch ((short) zargs[0]) {
-	case  1: ostream_screen = true;
-		 break;
-	case -1: ostream_screen = false;
-		 break;
-	case  2: if (!ostream_script) script_open();
-		 break;
-	case -2: if (ostream_script) script_close();
-		 break;
-	case  3: memory_open(zargs[1], zargs[2], zargc >= 3);
-		 break;
-	case -3: memory_close();
-		 break;
-	case  4: if (!ostream_record) record_open();
-		 break;
-	case -4: if (ostream_record) record_close();
-		 break;
+	case 1:
+		ostream_screen = true;
+		break;
+	case -1:
+		ostream_screen = false;
+		break;
+	case  2:
+		if (!ostream_script)
+			script_open();
+		break;
+	case -2:
+		if (ostream_script)
+			script_close();
+		break;
+	case 3:
+		memory_open(zargs[1], zargs[2], zargc >= 3);
+		break;
+	case -3:
+		memory_close();
+		break;
+	case 4:
+		if (!ostream_record)
+			record_open();
+		break;
+	case -4:
+		if (ostream_record)
+			record_close();
+		break;
 	default:
 		break;
 	}
diff --git a/engines/glk/frotz/processor_text.cpp b/engines/glk/frotz/processor_text.cpp
index 97957ac..22dc885 100644
--- a/engines/glk/frotz/processor_text.cpp
+++ b/engines/glk/frotz/processor_text.cpp
@@ -253,7 +253,7 @@ void Processor::encode_text(int padding) {
 			// Search character in the alphabet
 			for (set = 0; set < 3; set++)
 				for (index = 0; index < 26; index++)
-					if (c == alphabet (set, index))
+					if (c == alphabet(set, index))
 						goto letter_found;
 
 			// Character not found, store its ZSCII value
@@ -871,7 +871,7 @@ void Processor::z_print_form() {
 }
 
 void Processor::z_print_num() {
-	print_num (zargs[0]);
+	print_num(zargs[0]);
 }
 
 void Processor::z_print_obj() {


Commit: 73a4f228f6c8c17db4ba9c25b343dc1cf5847cee
    https://github.com/scummvm/scummvm/commit/73a4f228f6c8c17db4ba9c25b343dc1cf5847cee
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-08-18T15:18:57-07:00

Commit Message:
XEEN: Implement autosave support

Changed paths:
    engines/xeen/events.cpp
    engines/xeen/events.h
    engines/xeen/saves.cpp
    engines/xeen/saves.h
    engines/xeen/xeen.cpp
    engines/xeen/xeen.h


diff --git a/engines/xeen/events.cpp b/engines/xeen/events.cpp
index 17306a3..5243de6 100644
--- a/engines/xeen/events.cpp
+++ b/engines/xeen/events.cpp
@@ -32,7 +32,7 @@
 namespace Xeen {
 
 EventsManager::EventsManager(XeenEngine *vm) : _vm(vm), _playTime(0), _gameCounter(0),
-		_frameCounter(0), _priorFrameCounterTime(0), _priorScreenRefreshTime(0),
+		_frameCounter(0), _priorFrameCounterTime(0), _priorScreenRefreshTime(0), _lastAutosaveTime(0),
 		_mousePressed(false), _sprites("mouse.icn") {
 	Common::fill(&_gameCounters[0], &_gameCounters[6], 0);
 }
@@ -69,12 +69,19 @@ void EventsManager::pollEvents() {
 		_priorScreenRefreshTime = timer;
 		g_vm->_screen->update();
 	}
+
 	if (timer >= (_priorFrameCounterTime + GAME_FRAME_TIME)) {
 		// Time to build up next game frame
 		_priorFrameCounterTime = timer;
 		nextFrame();
 	}
 
+	// Handle auto saves
+	if (!_lastAutosaveTime)
+		_lastAutosaveTime = timer;
+	g_vm->autoSaveCheck(_lastAutosaveTime);
+
+	// Event handling
 	Common::Event event;
 	while (g_system->getEventManager()->pollEvent(event)) {
 		switch (event.type) {
diff --git a/engines/xeen/events.h b/engines/xeen/events.h
index 9913b2f..768e241 100644
--- a/engines/xeen/events.h
+++ b/engines/xeen/events.h
@@ -63,6 +63,7 @@ private:
 	uint32 _frameCounter;
 	uint32 _priorFrameCounterTime;
 	uint32 _priorScreenRefreshTime;
+	int _lastAutosaveTime;
 	uint32 _gameCounter;
 	uint32 _gameCounters[6];
 	uint32 _playTime;
diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp
index 82e2949..6b88a19 100644
--- a/engines/xeen/saves.cpp
+++ b/engines/xeen/saves.cpp
@@ -263,7 +263,7 @@ bool SavesManager::loadGame() {
 	delete dialog;
 
 	if (slotNum != -1) {
-		loadGameState(slotNum);
+		(void)loadGameState(slotNum);
 		g_vm->_interface->drawParty(true);
 	}
 
@@ -291,4 +291,9 @@ bool SavesManager::saveGame() {
 	}
 }
 
+void SavesManager::doAutosave() {
+	if (saveGameState(kAutoSaveSlot, _("Autosave")).getCode() != Common::kNoError)
+		g_vm->GUIError(_("Failed to autosave"));
+}
+
 } // End of namespace Xeen
diff --git a/engines/xeen/saves.h b/engines/xeen/saves.h
index 9b1bea6..d3352f1 100644
--- a/engines/xeen/saves.h
+++ b/engines/xeen/saves.h
@@ -32,6 +32,10 @@
 
 namespace Xeen {
 
+enum {
+	kAutoSaveSlot = 0
+};
+
 struct XeenSavegameHeader {
 	uint8 _version;
 	Common::String _saveName;
@@ -83,6 +87,11 @@ public:
 	Common::Error saveGameState(int slot, const Common::String &desc);
 
 	/**
+	 * Does an autosave
+	 */
+	void doAutosave();
+
+	/**
 	 * Sets up a new game
 	 */
 	void newGame();
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index 1952dc1..5f72623 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -266,7 +266,7 @@ void XeenEngine::gameLoop() {
 			// Load any pending savegame
 			int saveSlot = _loadSaveSlot;
 			_loadSaveSlot = -1;
-			_saves->loadGameState(saveSlot);
+			(void)_saves->loadGameState(saveSlot);
 			_interface->drawParty(true);
 		}
 
@@ -322,4 +322,16 @@ void XeenEngine::saveSettings() {
 	ConfMan.flushToDisk();
 }
 
+void XeenEngine::GUIError(const Common::String &msg) {
+	GUIErrorMessage(msg);
+}
+
+void XeenEngine::autoSaveCheck(int &lastSaveTime) {
+	if (shouldPerformAutoSave(lastSaveTime) && canSaveGameStateCurrently() &&
+			(_map && !(_map->mazeData()._mazeFlags & RESTRICTION_SAVE))) {
+		_saves->doAutosave();
+		lastSaveTime = g_system->getMillis();
+	}
+}
+
 } // End of namespace Xeen
diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h
index dfe2c79..2ac4ee4 100644
--- a/engines/xeen/xeen.h
+++ b/engines/xeen/xeen.h
@@ -149,11 +149,6 @@ private:
 	 * Plays the actual game
 	 */
 	void play();
-
-	/**
-	 * Shows a please wait dialog
-	 */
-	void pleaseWait();
 protected:
 	int _loadSaveSlot;
 protected:
@@ -275,6 +270,16 @@ public:
 	 * Saves engine settings
 	 */
 	void saveSettings();
+
+	/**
+	 * Show an error message in a GUI dialog
+	 */
+	void GUIError(const Common::String &msg);
+
+	/**
+	 * Checks if an auto save should be done, and if so, takes care of it
+	 */
+	void autoSaveCheck(int &lastSaveTime);
 };
 
 extern XeenEngine *g_vm;





More information about the Scummvm-git-logs mailing list