[Scummvm-git-logs] scummvm master -> 55112bf242b0739e5759c95ae80df571a88983bf

tag2015 noreply at scummvm.org
Sat Sep 23 15:10:28 UTC 2023


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:
c3589db569 AGS: Engine: don't Poll non-clickable GUIs
12e4bb39fa AGS: Engine: force clear event queue in processallevents()
55112bf242 AGS: Engine: fixed DCMD_NEWROOM cmd may prevent "First Time enter room" evt


Commit: c3589db5695eeeec8a2c4da35ef5607ca0b6ae3e
    https://github.com/scummvm/scummvm/commit/c3589db5695eeeec8a2c4da35ef5607ca0b6ae3e
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-09-23T17:10:08+02:00

Commit Message:
AGS: Engine: don't Poll non-clickable GUIs

>From upstream 95a2ef2c0d6a4c04e3985d78920bfc4a70a641c0

Changed paths:
    engines/ags/engine/main/game_run.cpp
    engines/ags/shared/gui/gui_main.cpp


diff --git a/engines/ags/engine/main/game_run.cpp b/engines/ags/engine/main/game_run.cpp
index d1d64425fc8..7844ab4e854 100644
--- a/engines/ags/engine/main/game_run.cpp
+++ b/engines/ags/engine/main/game_run.cpp
@@ -626,6 +626,8 @@ static void update_cursor_over_gui() {
 	for (auto &gui : _GP(guis)) {
 		if (!gui.IsDisplayed())
 			continue; // not on screen
+		if (!gui.IsClickable())
+			continue; // don't update non-clickable
 		// Don't touch GUI if "GUIs Turn Off When Disabled"
 		if ((_GP(game).options[OPT_DISABLEOFF] == kGuiDis_Off) &&
 			(_G(all_buttons_disabled) >= 0) &&
diff --git a/engines/ags/shared/gui/gui_main.cpp b/engines/ags/shared/gui/gui_main.cpp
index 44217c0cc44..a95c7388670 100644
--- a/engines/ags/shared/gui/gui_main.cpp
+++ b/engines/ags/shared/gui/gui_main.cpp
@@ -416,6 +416,9 @@ void GUIMain::SetClickable(bool on) {
 		_flags |= kGUIMain_Clickable;
 	else
 		_flags &= ~kGUIMain_Clickable;
+
+	if (!on)
+		ResetOverControl();
 }
 
 void GUIMain::SetConceal(bool on) {


Commit: 12e4bb39fae73b8ca44a49b2d92acbf819e79d9f
    https://github.com/scummvm/scummvm/commit/12e4bb39fae73b8ca44a49b2d92acbf819e79d9f
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-09-23T17:10:08+02:00

Commit Message:
AGS: Engine: force clear event queue in processallevents()

Was broken by a2f9a5b, then tried to fix by 6a71d85, but not fully fixed still.
>From upstream cbaeff15229bb81828d418ed71a11dfe0b30e6fd

Changed paths:
    engines/ags/engine/ac/event.cpp


diff --git a/engines/ags/engine/ac/event.cpp b/engines/ags/engine/ac/event.cpp
index 2f94521e166..45cbe6ec8d0 100644
--- a/engines/ags/engine/ac/event.cpp
+++ b/engines/ags/engine/ac/event.cpp
@@ -351,25 +351,25 @@ void processallevents() {
 		return;
 	}
 
-	// Take ownership of the pending events
-	// Note: upstream AGS used std::move, which I haven't been able
-	// to properly implement in ScummVM. Luckily, our events are
-	// a pointer, so I could get the same result swapping them
-	std::vector<EventHappened> *evtCopy = new std::vector<EventHappened>();
-	SWAP(evtCopy, _G(events));
+	// Make a copy of the events to process them safely.
+	// WARNING: engine may actually add more events to the global events array,
+	// and they must NOT be processed here, but instead discarded at the end
+	// of this function; otherwise game may glitch.
+	// TODO: need to redesign engine events system?
+	std::vector<EventHappened> evtCopy = _GP(events);
 
 	int room_was = _GP(play).room_changes;
 
 	_G(inside_processevent)++;
 
-	for (size_t i = 0; i < evtCopy->size() && !_G(abort_engine); ++i) {
-		process_event(&(*evtCopy)[i]);
+	for (size_t i = 0; i < evtCopy.size() && !_G(abort_engine); ++i) {
+		process_event(&evtCopy[i]);
 
 		if (room_was != _GP(play).room_changes)
 			break;  // changed room, so discard other events
 	}
 
-	delete evtCopy;
+	_GP(events).clear();
 	_G(inside_processevent)--;
 }
 


Commit: 55112bf242b0739e5759c95ae80df571a88983bf
    https://github.com/scummvm/scummvm/commit/55112bf242b0739e5759c95ae80df571a88983bf
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-09-23T17:10:08+02:00

Commit Message:
AGS: Engine: fixed DCMD_NEWROOM cmd may prevent "First Time enter room" evt

This is a backwards compatibility fix. It seems like "new room" dialog command was
resetting a `in_new_room` variable, disregarding its value set by `load_new_room`
function. Changed to only set it in case it was not set inside a NewRoom call.
>From upstream 45927bf23ea4ca051f74154fa4d0561a7df379ed (branch 3.6.1)

Changed paths:
    engines/ags/engine/ac/dialog.cpp


diff --git a/engines/ags/engine/ac/dialog.cpp b/engines/ags/engine/ac/dialog.cpp
index 249507b80ad..36ecd2469e0 100644
--- a/engines/ags/engine/ac/dialog.cpp
+++ b/engines/ags/engine/ac/dialog.cpp
@@ -258,7 +258,8 @@ int run_dialog_script(int dialogID, int offse, int optionIndex) {
 			case DCMD_NEWROOM:
 				get_dialog_script_parameters(script, &param1, nullptr);
 				NewRoom(param1);
-				_G(in_new_room) = 1;
+				if (_G(in_new_room) <= 0)
+					_G(in_new_room) = 1; // set only in case NewRoom was scheduled
 				result = RUN_DIALOG_STOP_DIALOG;
 				script_running = false;
 				break;




More information about the Scummvm-git-logs mailing list