[Scummvm-git-logs] scummvm master -> 407d38e7e95c648f392005e1717b94fa8059ec52
dreammaster
dreammaster at scummvm.org
Sat Apr 17 03:49:23 UTC 2021
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:
8d01a3f6ad AGS: Change quitprintf to call ScummVM error method
cc12d75846 AGS: Add IsFinished as an alias in agscreditz plugin
407d38e7e9 AGS: Add a lot of abort_engine checks to break out of scripts
Commit: 8d01a3f6ad5a869305b902b3b9904db2ef524772
https://github.com/scummvm/scummvm/commit/8d01a3f6ad5a869305b902b3b9904db2ef524772
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-04-16T20:16:52-07:00
Commit Message:
AGS: Change quitprintf to call ScummVM error method
Changed paths:
engines/ags/shared/ac/common.cpp
diff --git a/engines/ags/shared/ac/common.cpp b/engines/ags/shared/ac/common.cpp
index bf5cdbdd77..e7be3e80bf 100644
--- a/engines/ags/shared/ac/common.cpp
+++ b/engines/ags/shared/ac/common.cpp
@@ -35,7 +35,10 @@ void quitprintf(const char *fmt, ...) {
String text = String::FromFormatV(fmt, ap);
va_end(ap);
- quit(text);
+ // WORKAROUND: In ScummVM we have to make this an error, because
+ // too many places calling it presume it doesn't return,
+ // and will throw a wobbly if does
+ error(text);
}
} // namespace AGS3
Commit: cc12d75846c42fd14f21a8a1c9a96f9f563f2224
https://github.com/scummvm/scummvm/commit/cc12d75846c42fd14f21a8a1c9a96f9f563f2224
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-04-16T20:26:12-07:00
Commit Message:
AGS: Add IsFinished as an alias in agscreditz plugin
Changed paths:
engines/ags/plugins/ags_creditz/ags_creditz1.cpp
diff --git a/engines/ags/plugins/ags_creditz/ags_creditz1.cpp b/engines/ags/plugins/ags_creditz/ags_creditz1.cpp
index f393af6a6d..a7427fe1c4 100644
--- a/engines/ags/plugins/ags_creditz/ags_creditz1.cpp
+++ b/engines/ags/plugins/ags_creditz/ags_creditz1.cpp
@@ -51,6 +51,7 @@ void AGSCreditz1::AGS_EngineStartup(IAGSEngine *engine) {
SCRIPT_METHOD(ScrollCredits);
SCRIPT_METHOD(GetCredit);
SCRIPT_METHOD(IsCreditScrollingFinished);
+ SCRIPT_METHOD_EXT(IsFinished, IsCreditScrollingFinished);
SCRIPT_METHOD(SetCreditImage);
SCRIPT_METHOD(PauseScroll);
SCRIPT_METHOD(ScrollReset);
Commit: 407d38e7e95c648f392005e1717b94fa8059ec52
https://github.com/scummvm/scummvm/commit/407d38e7e95c648f392005e1717b94fa8059ec52
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-04-16T20:44:41-07:00
Commit Message:
AGS: Add a lot of abort_engine checks to break out of scripts
Previously, quitting could generate spurious error messages
between the point abort_engine was set, and the outer game
loop where game execution was aborted. It just wasn't visible,
because abort_engine was set. Now that we're immediately
generating a ScummVM error for any error generated, I needed
to add extra abort_engine break checks to avoid any errors
Changed paths:
engines/ags/engine/ac/event.cpp
engines/ags/engine/main/game_run.cpp
engines/ags/engine/script/cc_instance.cpp
engines/ags/engine/script/script.cpp
diff --git a/engines/ags/engine/ac/event.cpp b/engines/ags/engine/ac/event.cpp
index 8277f49d41..6767945847 100644
--- a/engines/ags/engine/ac/event.cpp
+++ b/engines/ags/engine/ac/event.cpp
@@ -178,6 +178,9 @@ void process_event(EventHappened *evp) {
} else
quit("process_event: RunEvBlock: unknown evb type");
+ if (_G(abort_engine))
+ return;
+
_G(evblockbasename) = oldbasename;
_G(evblocknum) = oldblocknum;
@@ -355,10 +358,9 @@ void processallevents(int numev, EventHappened *evlist) {
_G(inside_processevent)++;
for (dd = 0; dd < numev; dd++) {
-
process_event(©OfList[dd]);
- if (room_was != _GP(play).room_changes)
+ if (room_was != _GP(play).room_changes || _G(abort_engine))
break; // changed room, so discard other events
}
diff --git a/engines/ags/engine/main/game_run.cpp b/engines/ags/engine/main/game_run.cpp
index d6961c8a88..35df3cc073 100644
--- a/engines/ags/engine/main/game_run.cpp
+++ b/engines/ags/engine/main/game_run.cpp
@@ -620,7 +620,7 @@ static void game_loop_update_events() {
setevent(EV_FADEIN, 0, 0, 0);
_G(in_new_room) = 0;
update_events();
- if ((_G(new_room_was) > 0) && (_G(in_new_room) == 0)) {
+ if (!_G(abort_engine) && (_G(new_room_was) > 0) && (_G(in_new_room) == 0)) {
// if in a new room, and the room wasn't just changed again in update_events,
// then queue the Enters Screen scripts
// run these next time round, when it's faded in
@@ -742,6 +742,9 @@ void UpdateGameOnce(bool checkControls, IDriverDependantBitmap *extraBitmap, int
game_loop_update_events();
+ if (_G(abort_engine))
+ return;
+
_G(our_eip) = 7;
// if (ags_mgetbutton()>NONE) break;
@@ -860,6 +863,10 @@ static int GameTick() {
quit("!A blocking function was called before the first room has been loaded");
UpdateGameOnce(true);
+
+ if (_G(abort_engine))
+ return -1;
+
UpdateMouseOverLocation();
_G(our_eip) = 76;
diff --git a/engines/ags/engine/script/cc_instance.cpp b/engines/ags/engine/script/cc_instance.cpp
index 78ba82f0f9..f4d36da6a3 100644
--- a/engines/ags/engine/script/cc_instance.cpp
+++ b/engines/ags/engine/script/cc_instance.cpp
@@ -343,6 +343,9 @@ int ccInstance::CallScriptFunction(const char *funcname, int32_t numargs, const
pc = 0;
_G(current_instance) = currentInstanceWas;
+ if (_G(abort_engine))
+ return -1;
+
// NOTE that if proper multithreading is added this will need
// to be reconsidered, since the GC could be run in the middle
// of a RET from a function or something where there is an
@@ -1027,7 +1030,7 @@ int ccInstance::Run(int32_t curpc) {
cc_error("invalid pointer type for function call: %d", reg1.Type);
}
- if (_G(ccError)) {
+ if (_G(ccError) || _G(abort_engine)) {
return -1;
}
diff --git a/engines/ags/engine/script/script.cpp b/engines/ags/engine/script/script.cpp
index cac973ce12..2977fdd0e6 100644
--- a/engines/ags/engine/script/script.cpp
+++ b/engines/ags/engine/script/script.cpp
@@ -141,6 +141,9 @@ int run_interaction_event(Interaction *nint, int evnt, int chkAny, int isInv) {
// Right, so there were some commands defined in response to the event.
retval = run_interaction_commandlist(nint->Events[evnt].Response.get(), &nint->Events[evnt].TimesRun, &cmdsrun);
+ if (_G(abort_engine))
+ return -1;
+
// An inventory interaction, but the wrong item was used
if ((isInv) && (cmdsrun == 0))
run_unhandled_event(evnt);
@@ -356,6 +359,9 @@ int RunScriptFunctionIfExists(ccInstance *sci, const char *tsname, int numParam,
} else
quit("Too many parameters to RunScriptFunctionIfExists");
+ if (_G(abort_engine))
+ return -1;
+
// 100 is if Aborted (eg. because we are LoadAGSGame'ing)
if ((toret != 0) && (toret != -2) && (toret != 100)) {
quit_with_script_error(tsname);
@@ -827,6 +833,9 @@ int run_interaction_commandlist(InteractionCommandList *nicl, int *timesrun, int
break;
}
+ if (_G(abort_engine))
+ return -1;
+
// if the room changed within the action, nicl is no longer valid
if (room_was != _GP(play).room_changes)
return -1;
More information about the Scummvm-git-logs
mailing list