[Scummvm-git-logs] scummvm master -> 3f61ae5b2b0a33a4e9b9914e0e394f93f7f256e7

elasota noreply at scummvm.org
Thu May 25 04:17:20 UTC 2023


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

Summary:
b6f5134d13 VCRUISE: Add puzzleDone op, implement second circuit puzzle AI
3f61ae5b2b VCRUISE: Document all unused opcodes, fix and add hidePanel opcode


Commit: b6f5134d132521e30dae483fa04d06fbe0dd39ab
    https://github.com/scummvm/scummvm/commit/b6f5134d132521e30dae483fa04d06fbe0dd39ab
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-25T00:16:21-04:00

Commit Message:
VCRUISE: Add puzzleDone op, implement second circuit puzzle AI

Changed paths:
    engines/vcruise/runtime.cpp
    engines/vcruise/runtime.h


diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 845009c4846..a0d2ae3842c 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -188,7 +188,7 @@ const MapScreenDirectionDef *MapDef::getScreenDirection(uint screen, uint direct
 	return screenDirections[screen][direction].get();
 }
 
-ScriptEnvironmentVars::ScriptEnvironmentVars() : lmb(false), lmbDrag(false), esc(false), exitToMenu(false), animChangeSet(false), isEntryScript(false),
+ScriptEnvironmentVars::ScriptEnvironmentVars() : lmb(false), lmbDrag(false), esc(false), exitToMenu(false), animChangeSet(false), isEntryScript(false), puzzleWasSet(false),
 	panInteractionID(0), fpsOverride(0), lastHighlightedItem(0), animChangeFrameOffset(0), animChangeNumFrames(0) {
 }
 
@@ -2268,9 +2268,15 @@ void Runtime::terminateScript() {
 		// This is needed to avoid resetting static animations twice, which causes problems with,
 		// for example, the second screen on Hannah's path resetting the idle animations after
 		// the VO stops.
-		if (_gameID == GID_SCHIZM)
+		if (_gameID == GID_SCHIZM) {
 			_havePendingScreenChange = false;
 
+			// The circuit puzzle doesn't call puzzleDone unless you zoom back into the puzzle,
+			// which can cause the puzzle to leak.  Clean it up here instead.
+			if (!_scriptEnv.puzzleWasSet)
+				_circuitPuzzle.reset();
+		}
+
 		changeToScreen(_roomNumber, _screenNumber);
 	}
 
@@ -7292,12 +7298,14 @@ void Runtime::scriptOpPuzzleInit(ScriptArg_t arg) {
 	if (firstMover != firstMover2 || unknownParam != 0)
 		error("PuzzleInit had a weird parameter");
 
-	if (firstMover == 2)
-		error("AI moving first not implemented yet");
-
 	_circuitPuzzle.reset(new CircuitPuzzle(firstMover));
 	_circuitPuzzleConnectAnimation = animDef1;
 	_circuitPuzzleBlockAnimation = animDef2;
+
+	_scriptEnv.puzzleWasSet = true;
+
+	if (firstMover == 2)
+		scriptOpPuzzleDoMove2(0);
 }
 
 void Runtime::scriptOpPuzzleWhoWon(ScriptArg_t arg) {
@@ -7382,7 +7390,9 @@ void Runtime::scriptOpPuzzleDoMove2(ScriptArg_t arg) {
 	}
 }
 
-OPCODE_STUB(PuzzleDone)
+void Runtime::scriptOpPuzzleDone(ScriptArg_t arg) {
+	_circuitPuzzle.reset();
+}
 
 
 OPCODE_STUB(Fn)
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 37fb3bb88cc..e6cf187bf45 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -167,6 +167,7 @@ struct ScriptEnvironmentVars {
 	bool exitToMenu;
 	bool animChangeSet;
 	bool isEntryScript;
+	bool puzzleWasSet;
 };
 
 struct SfxSound {


Commit: 3f61ae5b2b0a33a4e9b9914e0e394f93f7f256e7
    https://github.com/scummvm/scummvm/commit/3f61ae5b2b0a33a4e9b9914e0e394f93f7f256e7
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-25T00:16:22-04:00

Commit Message:
VCRUISE: Document all unused opcodes, fix and add hidePanel opcode

Changed paths:
    engines/vcruise/runtime.cpp
    engines/vcruise/script.cpp


diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index a0d2ae3842c..d4a22ee08cd 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -6997,11 +6997,6 @@ void Runtime::scriptOpSndStopAll(ScriptArg_t arg) {
 		stopSound(*snd);
 }
 
-OPCODE_STUB(SndAddRandom)
-OPCODE_STUB(SndClearRandom)
-
-
-
 void Runtime::scriptOpVolumeAdd(ScriptArg_t arg) {
 	TAKE_STACK_INT(3);
 
@@ -7084,8 +7079,6 @@ void Runtime::scriptOpString(ScriptArg_t arg) {
 	_scriptStack.push_back(StackValue(_scriptSet->strings[arg]));
 }
 
-OPCODE_STUB(Speech)
-
 void Runtime::scriptOpSpeechEx(ScriptArg_t arg) {
 	TAKE_STACK_INT_NAMED(2, sndParamArgs);
 	TAKE_STACK_STR_NAMED(1, sndNameArgs);
@@ -7123,8 +7116,6 @@ void Runtime::scriptOpSpeechTest(ScriptArg_t arg) {
 	_scriptStack.push_back(StackValue(found ? 1 : 0));
 }
 
-OPCODE_STUB(Say)
-
 void Runtime::scriptOpRandomInclusive(ScriptArg_t arg) {
 	TAKE_STACK_INT(1);
 
@@ -7204,8 +7195,6 @@ void Runtime::scriptOpHeroGet(ScriptArg_t arg) {
 	_scriptStack.push_back(StackValue(_hero));
 }
 
-OPCODE_STUB(Garbage)
-
 void Runtime::scriptOpGetRoom(ScriptArg_t arg) {
 	_scriptStack.push_back(StackValue(_roomNumber));
 }
@@ -7243,7 +7232,11 @@ void Runtime::scriptOpDisc(ScriptArg_t arg) {
 	_scriptStack.push_back(StackValue(1));
 }
 
-OPCODE_STUB(HidePanel)
+void Runtime::scriptOpHidePanel(ScriptArg_t arg) {
+	_isInGame = false;
+
+	clearTray();
+}
 
 void Runtime::scriptOpRotateUpdate(ScriptArg_t arg) {
 	warning("RotateUpdate op not implemented yet");
@@ -7394,7 +7387,17 @@ void Runtime::scriptOpPuzzleDone(ScriptArg_t arg) {
 	_circuitPuzzle.reset();
 }
 
+// Only used in fnRandomBirds and fnRandomMachines in Room 60, both of which are unused
+OPCODE_STUB(SndAddRandom)
+OPCODE_STUB(SndClearRandom)
+
+// Only used in Room 02 (cheat room, which isn't supported)
+OPCODE_STUB(Speech)
+OPCODE_STUB(Say)
+OPCODE_STUB(Garbage)
 
+// Referenced in Room 30 screen 0a4 interaction 0a0, however there is no interaction with that ID,
+// so this is unreachable.
 OPCODE_STUB(Fn)
 
 #undef TAKE_STACK_STR
diff --git a/engines/vcruise/script.cpp b/engines/vcruise/script.cpp
index 22ed8881bef..420dca34160 100644
--- a/engines/vcruise/script.cpp
+++ b/engines/vcruise/script.cpp
@@ -759,7 +759,7 @@ static ScriptNamedInstruction g_schizmNamedInstructions[] = {
 	{"dvd@", ProtoOp::kProtoOpScript, ScriptOps::kIsDVDVersion},
 	{"disc", ProtoOp::kProtoOpScript, ScriptOps::kDisc},
 	{"save0", ProtoOp::kProtoOpNoop, ScriptOps::kSave0},
-	{"hidePanel", ProtoOp::kProtoOpNoop, ScriptOps::kHidePanel},
+	{"hidePanel", ProtoOp::kProtoOpScript, ScriptOps::kHidePanel},
 	{"ItemExist@", ProtoOp::kProtoOpScript, ScriptOps::kItemCheck},
 	{"ItemSelect!", ProtoOp::kProtoOpScript, ScriptOps::kItemHighlightSetTrue},
 	{"ItemPlace@", ProtoOp::kProtoOpScript, ScriptOps::kItemHaveSpace},




More information about the Scummvm-git-logs mailing list