[Scummvm-git-logs] scummvm master -> 6155dbde7f2af2c987f0d3421f7bab6a22075f2b

sev- noreply at scummvm.org
Fri Jul 15 20:37:46 UTC 2022


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

Summary:
6155dbde7f SLUDGE: Reimplement builtin launch for webpages


Commit: 6155dbde7f2af2c987f0d3421f7bab6a22075f2b
    https://github.com/scummvm/scummvm/commit/6155dbde7f2af2c987f0d3421f7bab6a22075f2b
Author: Henrik "Henke37" Andersson (henke at henke37.cjb.net)
Date: 2022-07-15T22:37:44+02:00

Commit Message:
SLUDGE: Reimplement builtin launch for webpages

Changed paths:
    engines/sludge/builtin.cpp
    engines/sludge/event.cpp
    engines/sludge/sludge.cpp
    engines/sludge/sludge.h
    engines/sludge/sludger.cpp


diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index 3a5d1aea2a3..936c801b80d 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -47,8 +47,6 @@
 
 namespace Sludge {
 
-Variable *launchResult = NULL;
-
 extern bool allowAnyFilename;
 extern VariableStack *noStack;
 extern int numBIFNames, numUserFunc;
@@ -879,20 +877,23 @@ builtIn(launch) {
 		(newTextA[4] == ':' || (newTextA[4] == 's' && newTextA[5] == ':'))) {
 
 		// IT'S A WEBSITE!
-		g_sludge->launchMe.clear();
-		g_sludge->launchMe = newTextA;
+		bool success = g_sludge->_system->openUrl(newText);
+		fun->reg.setVariable(SVT_INT, success);
+		return BR_CONTINUE;
+	}
+
+	Common::String gameDir = ConfMan.get("path");
+	newText = gameDir + newText;
+
+	// local webpage?
+	if (newText.hasSuffixIgnoreCase(".htm") || newText.hasSuffixIgnoreCase(".html")) {
+		bool success = g_sludge->_system->openUrl("file:///" + newText);
+		fun->reg.setVariable(SVT_INT, success);
 	} else {
-		Common::String gameDir = g_sludge->gamePath;
-		gameDir += "/";
-		g_sludge->launchMe.clear();
-		g_sludge->launchMe = gameDir + newText;
-		if (g_sludge->launchMe.empty())
-			return BR_ERROR;
+		fun->reg.setVariable(SVT_INT, 0);
 	}
-	fun->reg.setVariable(SVT_INT, 1);
-	launchResult = &fun->reg;
 
-	return BR_KEEP_AND_PAUSE;
+	return BR_CONTINUE;
 }
 
 builtIn(pause) {
diff --git a/engines/sludge/event.cpp b/engines/sludge/event.cpp
index b747ba1960d..84cf64bceae 100644
--- a/engines/sludge/event.cpp
+++ b/engines/sludge/event.cpp
@@ -34,7 +34,6 @@
 
 namespace Sludge {
 
-extern Variable *launchResult;
 extern VariableStack *noStack;
 
 EventManager::EventManager(SludgeEngine *vm) {
@@ -147,23 +146,6 @@ void EventManager::checkInput() {
 }
 
 bool EventManager::handleInput() {
-	static int l = 0;
-
-	if (!_vm->launchMe.empty()) {
-		if (l) {
-			// Still paused because of spawned thingy...
-		} else {
-			l = 1;
-
-			launchResult->setVariable(SVT_INT, 0/*launch(launchMe) > 31*/); //TODO:false value
-			_vm->launchMe.clear();
-			launchResult = nullptr;
-		}
-		return true;
-	} else {
-		l = 0;
-	}
-
 	if (!_vm->_regionMan->getOverRegion())
 		_vm->_regionMan->updateOverRegion();
 
diff --git a/engines/sludge/sludge.cpp b/engines/sludge/sludge.cpp
index 61c0dfb0c96..2b8ac3e18f7 100644
--- a/engines/sludge/sludge.cpp
+++ b/engines/sludge/sludge.cpp
@@ -64,7 +64,6 @@ SludgeEngine::SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc)
 	_pixelFormat = new Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
 
 	// Init Strings
-	launchMe = "";
 	launchNext = "";
 	loadNow = "";
 	gamePath = "";
diff --git a/engines/sludge/sludge.h b/engines/sludge/sludge.h
index c07f470fc8c..27f3f103efe 100644
--- a/engines/sludge/sludge.h
+++ b/engines/sludge/sludge.h
@@ -72,7 +72,6 @@ protected:
 
 public:
 	// global String variables
-	Common::String launchMe;
 	Common::String launchNext;
 	Common::String loadNow;
 	Common::String gamePath;
diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp
index b26aa8f7d43..01cf5880dbf 100644
--- a/engines/sludge/sludger.cpp
+++ b/engines/sludge/sludger.cpp
@@ -59,7 +59,6 @@ FILETIME fileTime;
 
 int numGlobals = 0;
 
-extern Variable *launchResult;
 extern Variable *globalVars;
 extern VariableStack *noStack;
 
@@ -137,7 +136,6 @@ void initSludge() {
 
 	// global variables
 	numGlobals = 0;
-	launchResult = nullptr;
 
 	allowAnyFilename = true;
 	noStack = nullptr;




More information about the Scummvm-git-logs mailing list