[Scummvm-git-logs] scummvm master -> d60d38e5422f96cea5b748965e3d2a045ccfbfe6

elasota noreply at scummvm.org
Thu May 4 13:38:26 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:
0cf056afd0 VCRUISE: Add SpeechEx and SndWait opcodes.
d60d38e542 VCRUISE: Add "Improved click sensitivity" option.


Commit: 0cf056afd0c6e3c623cf1e409bcc6a1a1d7a7977
    https://github.com/scummvm/scummvm/commit/0cf056afd0c6e3c623cf1e409bcc6a1a1d7a7977
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-04T09:36:23-04:00

Commit Message:
VCRUISE: Add SpeechEx and SndWait opcodes.

Changed paths:
    engines/vcruise/runtime.cpp


diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index b21a33cb0eb..fc4b5492bf0 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -6122,7 +6122,17 @@ void Runtime::scriptOpSndPlay(ScriptArg_t arg) {
 OPCODE_STUB(SndPlayEx)
 OPCODE_STUB(SndPlay3D)
 OPCODE_STUB(SndPlaying)
-OPCODE_STUB(SndWait)
+
+void Runtime::scriptOpSndWait(ScriptArg_t arg) {
+	TAKE_STACK_INT(1);
+
+	SoundInstance *snd = resolveSoundByID(stackArgs[0]);
+	if (snd) {
+		_delayCompletionTime = snd->endTime;
+		_gameState = kGameStateDelay;
+	}
+}
+
 OPCODE_STUB(SndHalt)
 OPCODE_STUB(SndToBack)
 OPCODE_STUB(SndStop)
@@ -6186,7 +6196,29 @@ void Runtime::scriptOpString(ScriptArg_t arg) {
 }
 
 OPCODE_STUB(Speech)
-OPCODE_STUB(SpeechEx)
+
+void Runtime::scriptOpSpeechEx(ScriptArg_t arg) {
+	TAKE_STACK_INT_NAMED(2, sndParamArgs);
+	TAKE_STACK_STR_NAMED(1, sndNameArgs);
+
+	StackInt_t soundID = 0;
+	SoundInstance *cachedSound = nullptr;
+	resolveSoundByName(sndNameArgs[0], true, soundID, cachedSound);
+
+	if (cachedSound) {
+		TriggeredOneShot oneShot;
+		oneShot.soundID = soundID;
+		oneShot.uniqueSlot = sndParamArgs[0];
+
+		if (Common::find(_triggeredOneShots.begin(), _triggeredOneShots.end(), oneShot) == _triggeredOneShots.end()) {
+			triggerSound(false, *cachedSound, sndParamArgs[1], 0, false, true);
+			_triggeredOneShots.push_back(oneShot);
+
+			triggerWaveSubtitles(*cachedSound, sndNameArgs[0]);
+		}
+	}
+}
+
 OPCODE_STUB(SpeechTest)
 OPCODE_STUB(Say)
 


Commit: d60d38e5422f96cea5b748965e3d2a045ccfbfe6
    https://github.com/scummvm/scummvm/commit/d60d38e5422f96cea5b748965e3d2a045ccfbfe6
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-04T09:36:23-04:00

Commit Message:
VCRUISE: Add "Improved click sensitivity" option.

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


diff --git a/engines/vcruise/detection.cpp b/engines/vcruise/detection.cpp
index 454560ba017..b42a723838a 100644
--- a/engines/vcruise/detection.cpp
+++ b/engines/vcruise/detection.cpp
@@ -39,7 +39,7 @@ static const PlainGameDescriptor vCruiseGames[] = {
 class VCruiseMetaEngineDetection : public AdvancedMetaEngineDetection {
 public:
 	VCruiseMetaEngineDetection() : AdvancedMetaEngineDetection(VCruise::gameDescriptions, sizeof(VCruise::VCruiseGameDescription), vCruiseGames) {
-		_guiOptions = GUIO3(GAMEOPTION_LAUNCH_DEBUG, GAMEOPTION_FAST_ANIMATIONS, GAMEOPTION_SKIP_MENU);
+		_guiOptions = GUIO4(GAMEOPTION_FAST_ANIMATIONS, GAMEOPTION_INCREASE_DRAG_DISTANCE, GAMEOPTION_LAUNCH_DEBUG, GAMEOPTION_SKIP_MENU);
 		_maxScanDepth = 1;
 		_directoryGlobs = nullptr;
 		_flags = kADFlagCanPlayUnknownVariants;
diff --git a/engines/vcruise/detection.h b/engines/vcruise/detection.h
index 510455e9cfa..b8b1e875a85 100644
--- a/engines/vcruise/detection.h
+++ b/engines/vcruise/detection.h
@@ -51,6 +51,7 @@ struct VCruiseGameDescription {
 #define GAMEOPTION_LAUNCH_DEBUG					GUIO_GAMEOPTIONS1
 #define GAMEOPTION_FAST_ANIMATIONS				GUIO_GAMEOPTIONS2
 #define GAMEOPTION_SKIP_MENU					GUIO_GAMEOPTIONS3
+#define GAMEOPTION_INCREASE_DRAG_DISTANCE		GUIO_GAMEOPTIONS4
 
 
 } // End of namespace VCruise
diff --git a/engines/vcruise/metaengine.cpp b/engines/vcruise/metaengine.cpp
index 031638c690c..49d7e3938d3 100644
--- a/engines/vcruise/metaengine.cpp
+++ b/engines/vcruise/metaengine.cpp
@@ -37,12 +37,12 @@ namespace VCruise {
 
 static const ADExtraGuiOptionsMap optionsList[] = {
 	{
-		GAMEOPTION_LAUNCH_DEBUG,
+		GAMEOPTION_INCREASE_DRAG_DISTANCE,
 		{
-			_s("Start with debugger"),
-			_s("Starts with the debugger dashboard active."),
-			"vcruise_debug",
-			false,
+			_s("Improved click sensitivity"),
+			_s("Allows the mouse to be moved a short distance without cancelling click interactions.  If this is off, any mouse movement while the mouse button is held cancels a click interaction."),
+			"vcruise_increase_drag_distance",
+			true,
 			0,
 			0
 		}
@@ -58,6 +58,17 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 			0
 		}
 	},
+	{
+		GAMEOPTION_LAUNCH_DEBUG,
+		{
+			_s("Start with debugger"),
+			_s("Starts with the debugger dashboard active."),
+			"vcruise_debug",
+			false,
+			0,
+			0
+		}
+	},
 	{
 		GAMEOPTION_SKIP_MENU,
 		{
diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index fc4b5492bf0..5f50ef2064f 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -925,7 +925,7 @@ Runtime::Runtime(OSystem *system, Audio::Mixer *mixer, const Common::FSNode &roo
 	  _animStartTime(0), _animFramesDecoded(0), _animDecoderState(kAnimDecoderStateStopped),
 	  _animPlayWhileIdle(false), _idleLockInteractions(false), _idleIsOnInteraction(false), _idleHaveClickInteraction(false), _idleHaveDragInteraction(false), _idleInteractionID(0), _haveIdleStaticAnimation(false),
 	  _inGameMenuState(kInGameMenuStateInvisible), _inGameMenuActiveElement(0), _inGameMenuButtonActive {false, false, false, false, false},
-	  /*_loadedArea(0), */_lmbDown(false), _lmbDragging(false), _lmbReleaseWasClick(false), _lmbDownTime(0),
+	  _lmbDown(false), _lmbDragging(false), _lmbReleaseWasClick(false), _lmbDownTime(0), _lmbDragTolerance(0),
 	  _delayCompletionTime(0),
 	  _panoramaState(kPanoramaStateInactive),
 	  _listenerX(0), _listenerY(0), _listenerAngle(0), _soundCacheIndex(0),
@@ -1122,6 +1122,9 @@ bool Runtime::runFrame() {
 bool Runtime::bootGame(bool newGame) {
 	assert(_gameState == kGameStateBoot);
 
+	if (!ConfMan.hasKey("vcruise_increase_drag_distance") || ConfMan.hasKey("vcruise_increase_drag_distance"))
+		_lmbDragTolerance = 3;
+
 	debug(1, "Booting V-Cruise game...");
 	loadIndex();
 	debug(1, "Index loaded OK");
@@ -2164,8 +2167,19 @@ bool Runtime::popOSEvent(OSEvent &evt) {
 			if (_mousePos == tempEvent.pos)
 				continue;
 
-			if (_lmbDown && tempEvent.pos != _lmbDownPos)
-				_lmbDragging = true;
+			if (_lmbDown && tempEvent.pos != _lmbDownPos) {
+				bool isDrag = true;
+
+				if (_lmbDragTolerance > 0) {
+					int xDelta = tempEvent.pos.x - _lmbDownPos.x;
+					int yDelta = tempEvent.pos.y - _lmbDownPos.y;
+
+					if (xDelta >= -_lmbDragTolerance && xDelta <= _lmbDragTolerance && yDelta >= -_lmbDragTolerance && yDelta <= _lmbDragTolerance)
+						isDrag = false;
+				}
+
+				_lmbDragging = isDrag;
+			}
 
 			_mousePos = tempEvent.pos;
 		} else if (tempEvent.type == kOSEventTypeLButtonDown) {
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index ce9a7787244..5c89eadc5ce 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -1153,6 +1153,7 @@ private:
 	Common::Point _mousePos;
 	Common::Point _lmbDownPos;
 	uint32 _lmbDownTime;
+	int _lmbDragTolerance;
 	bool _lmbDown;
 	bool _lmbDragging;
 	bool _lmbReleaseWasClick;	// If true, then the mouse didn't move at all since the LMB down




More information about the Scummvm-git-logs mailing list