[Scummvm-cvs-logs] CVS: scummvm/common config-file.h,1.2,1.3 engine.cpp,1.5,1.6 gameDetector.cpp,1.9,1.10 main.cpp,1.7,1.8 str.cpp,1.6,1.7 str.h,1.4,1.5

Max Horn fingolfin at users.sourceforge.net
Thu Sep 26 05:30:03 CEST 2002


Update of /cvsroot/scummvm/scummvm/common
In directory usw-pr-cvs1:/tmp/cvs-serv14260/common

Modified Files:
	config-file.h engine.cpp gameDetector.cpp main.cpp str.cpp 
	str.h 
Log Message:
some fixes for the message dialog; added some comments

Index: config-file.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-file.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- config-file.h	8 Sep 2002 01:08:11 -0000	1.2
+++ config-file.h	26 Sep 2002 12:29:10 -0000	1.3
@@ -60,6 +60,6 @@
 };
 
 // The global config object
-extern Config *scummcfg;
+extern Config *g_config;
 
 #endif

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/engine.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- engine.cpp	18 Sep 2002 10:56:23 -0000	1.5
+++ engine.cpp	26 Sep 2002 12:29:10 -0000	1.6
@@ -63,11 +63,11 @@
 
 	// If SCUMMVM_SAVEPATH was not specified, try to use game specific savepath from config
 	if (!dir || dir[0] == 0)
-		dir = scummcfg->get("savepath");
+		dir = g_config->get("savepath");
 
 	// If SCUMMVM_SAVEPATH was not specified, try to use general path from config
 	if (!dir || dir[0] == 0)
-		dir = scummcfg->get("savepath", "scummvm");
+		dir = g_config->get("savepath", "scummvm");
 
 	// If no save path was specified, use no directory prefix
 	if (dir == NULL)

Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- gameDetector.cpp	24 Sep 2002 04:29:54 -0000	1.9
+++ gameDetector.cpp	26 Sep 2002 12:29:10 -0000	1.10
@@ -74,42 +74,42 @@
 {
 	const char * val;
 
-	_amiga = scummcfg->getBool("amiga", _amiga);
+	_amiga = g_config->getBool("amiga", _amiga);
 
-	_save_slot = scummcfg->getInt("save_slot", _save_slot);
+	_save_slot = g_config->getInt("save_slot", _save_slot);
 
-	_cdrom = scummcfg->getInt("cdrom", _cdrom);
+	_cdrom = g_config->getInt("cdrom", _cdrom);
 
-	if ((val = scummcfg->get("music_driver")))
+	if ((val = g_config->get("music_driver")))
 		if (!parseMusicDriver(val)) {
 			printf("Error in the config file: invalid music_driver.\n");
 			printf(USAGE_STRING);
 			exit(-1);
 		}
 
-	_fullScreen = scummcfg->getBool("fullscreen", _fullScreen);
+	_fullScreen = g_config->getBool("fullscreen", _fullScreen);
 
-	if ((val = scummcfg->get("gfx_mode")))
+	if ((val = g_config->get("gfx_mode")))
 		if ((_gfx_mode = parseGraphicsMode(val)) == -1) {
 			printf("Error in the config file: invalid gfx_mode.\n");
 			printf(USAGE_STRING);
 			exit(-1);
 		}
 
-	_music_volume = scummcfg->getInt("music_volume", _music_volume);
+	_music_volume = g_config->getInt("music_volume", _music_volume);
 
-	_noSubtitles = scummcfg->getBool("nosubtitles", _noSubtitles ? true : false);
+	_noSubtitles = g_config->getBool("nosubtitles", _noSubtitles ? true : false);
 
-	if ((val = scummcfg->get("path")))
+	if ((val = g_config->get("path")))
 		_gameDataPath = strdup(val);
 
-	_sfx_volume = scummcfg->getInt("sfx_volume", _sfx_volume);
+	_sfx_volume = g_config->getInt("sfx_volume", _sfx_volume);
 
 	// We use strtol for the tempo to allow it to be specified in hex.
-	if ((val = scummcfg->get("tempo")))
+	if ((val = g_config->get("tempo")))
 		_gameTempo = strtol(val, NULL, 0);
 
-	_talkSpeed = scummcfg->getInt("talkspeed", _talkSpeed);
+	_talkSpeed = g_config->getInt("talkspeed", _talkSpeed);
 }
 
 void GameDetector::parseCommandLine(int argc, char **argv)
@@ -127,7 +127,7 @@
 		//exit(1);
 	}
 
-	scummcfg->set_domain("game-specific");
+	g_config->set_domain("game-specific");
 	/* Parse the arguments */
 	for (i = argc - 1; i >= 1; i--) {
 		s = argv[i];
@@ -139,7 +139,7 @@
 			case 'a':
 				CHECK_OPTION();
 				_amiga = (c == 'a');
-				scummcfg->setBool("amiga", _amiga);
+				g_config->setBool("amiga", _amiga);
 				break;
 			case 'b':
 				HANDLE_OPTION();
@@ -148,7 +148,7 @@
 			case 'c':
 				HANDLE_OPTION();
 				_cdrom = atoi(option);
-				scummcfg->setInt("cdrom", _cdrom);
+				g_config->setInt("cdrom", _cdrom);
 				break;
 			case 'd':
 				_debugMode = true;
@@ -161,25 +161,25 @@
 				HANDLE_OPTION();
 				if (!parseMusicDriver(option))
 					goto ShowHelpAndExit;
-				scummcfg->set("music_driver", option);
+				g_config->set("music_driver", option);
 				break;
 			case 'f':
 				CHECK_OPTION();
 				_fullScreen = (c == 'f');
-				scummcfg->setBool("fullscreen", _fullScreen, "scummvm");
+				g_config->setBool("fullscreen", _fullScreen, "scummvm");
 				break;
 			case 'g':
 				HANDLE_OPTION();
 				_gfx_mode = parseGraphicsMode(option);
 				if (_gfx_mode == -1)
 					goto ShowHelpAndExit;
-				scummcfg->set("gfx_mode", option, "scummvm");
+				g_config->set("gfx_mode", option, "scummvm");
 				break;
 			case 'l':
 				HANDLE_OPTION();
 				{
 					Config * newconfig = new Config(option, "scummvm");
-					scummcfg->merge_config(*newconfig);
+					g_config->merge_config(*newconfig);
 					delete newconfig;
 					updateconfig();
 					break;
@@ -188,17 +188,17 @@
 			case 'm':
 				HANDLE_OPTION();
 				_music_volume = atoi(option);
-				scummcfg->setInt("music_volume", _music_volume);
+				g_config->setInt("music_volume", _music_volume);
 				break;
 			case 'n':
 				CHECK_OPTION();
 				_noSubtitles = (c == 'n');
-				scummcfg->setBool("nosubtitles", _noSubtitles ? true : false);
+				g_config->setBool("nosubtitles", _noSubtitles ? true : false);
 				break;
 			case 'p':
 				HANDLE_OPTION();
 				_gameDataPath = option;
-				scummcfg->set("path", _gameDataPath);
+				g_config->set("path", _gameDataPath);
 				break;
 			case 'r':
 				HANDLE_OPTION();
@@ -207,12 +207,12 @@
 			case 's':
 				HANDLE_OPTION();
 				_sfx_volume = atoi(option);
-				scummcfg->setInt("sfx_volume", _sfx_volume);
+				g_config->setInt("sfx_volume", _sfx_volume);
 				break;
 			case 't':
 				HANDLE_OPTION();
 				_gameTempo = strtol(option, 0, 0);
-				scummcfg->set("tempo", option);
+				g_config->set("tempo", option);
 				break;
 			case 'v':
 				CHECK_OPTION();
@@ -224,23 +224,23 @@
 				exit(1);
 			case 'w':
 				_saveconfig = true;
-				scummcfg->set_writing(true);
+				g_config->set_writing(true);
 				HANDLE_OPT_OPTION();
 				if (option != NULL)
-					scummcfg->set_filename(option);
+					g_config->set_filename(option);
 				break;
 			case 'x':
 				_save_slot = 0;
 				HANDLE_OPT_OPTION();
 				if (option != NULL) {
 					_save_slot = atoi(option);
-					scummcfg->setInt("save_slot", _save_slot);
+					g_config->setInt("save_slot", _save_slot);
 				}
 				break;
 			case 'y':
 				HANDLE_OPTION();
 				_talkSpeed = atoi(option);				
-				scummcfg->setInt("talkspeed", _talkSpeed);
+				g_config->setInt("talkspeed", _talkSpeed);
 				break;
 			default:
 				goto ShowHelpAndExit;
@@ -248,9 +248,9 @@
 		} else {
 			if (i == (argc - 1)) {
 				_exe_name = s;
-				scummcfg->set_domain(s);
-				scummcfg->rename_domain("game-specific");
-				scummcfg->rename_domain(s);
+				g_config->set_domain(s);
+				g_config->rename_domain("game-specific");
+				g_config->rename_domain(s);
 				updateconfig();
 			} else {
 				if (current_option == NULL)
@@ -262,7 +262,7 @@
 	}
 	
 	if (_exe_name)
-		scummcfg->flush();
+		g_config->flush();
 
 	return;
 

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/main.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- main.cpp	20 Sep 2002 00:12:58 -0000	1.7
+++ main.cpp	26 Sep 2002 12:29:10 -0000	1.8
@@ -22,13 +22,15 @@
 
 #include "stdafx.h"
 #include "engine.h"
-#include "sound/mididrv.h"
 #include "gameDetector.h"
 #include "config-file.h"
+#include "gui/newgui.h"
+#include "gui/message.h"
 
 GameDetector detector;
 
-Config *scummcfg = 0;
+Config *g_config = 0;
+NewGui *g_gui = 0;
 
 
 #if defined(QTOPIA)
@@ -122,8 +124,8 @@
 #endif
 
 	// Read the config file
-	scummcfg = new Config(scummhome, "scummvm");
-	scummcfg->set("versioninfo", SCUMMVM_VERSION);
+	g_config = new Config(scummhome, "scummvm");
+	g_config->set("versioninfo", SCUMMVM_VERSION);
 	
 	// Parse the command line information
 	result = detector.detectMain(argc, argv);
@@ -145,6 +147,23 @@
 	prop.caption = (char *)detector.getGameName();
 	system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
 
+	// Create the GUI manager
+	// TODO - move this up for the launcher dialog?
+	g_gui = new NewGui(system);
+
+#if 0
+	// FIXME - we need to be able to do an init_size() call on the system object here
+	// so that we can display stuff. But right now, init_size() can't safely be called
+	// multiple times (at least not for the SDL backend). So either we have to modify
+	// all the backends to allow for this, or come up with some other solution.
+	const char *message = "This dialog is shown before the Engine is even created!\n"
+						  "Wow! Ain't e cool?\n";
+	Dialog *dlg = new MessageDialog(g_gui, message);
+	dlg->open();
+	g_gui->runLoop();
+	delete dlg;
+#endif
+
 	// Create the game engine
 	Engine *engine = Engine::createFromDetector(&detector, system);
 
@@ -153,7 +172,8 @@
 	
 	// Free up memory
 	delete engine;
-	delete scummcfg;
+	delete g_gui;
+	delete g_config;
 	
 	// ...and quit (the return 0 should never be reached)
 	system->quit();

Index: str.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/str.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- str.cpp	26 Sep 2002 11:44:02 -0000	1.6
+++ str.cpp	26 Sep 2002 12:29:10 -0000	1.7
@@ -35,8 +35,8 @@
 String::String(const char *str, int len)
 {
 	_refCount = new int(1);
-	if (str) {
-		if (len)
+	if (str && len != 0) {
+		if (len > 0)
 			_capacity = _len = len;
 		else
 			_capacity = _len = resStrLen(str);

Index: str.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/str.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- str.h	26 Sep 2002 11:44:02 -0000	1.4
+++ str.h	26 Sep 2002 12:29:10 -0000	1.5
@@ -46,7 +46,7 @@
 
 public:
 	ConstString() : _str(0), _len(0) {}
-	ConstString(const char *str, int len = 0) : _str((char*)str) { _len = str ? (len ? len : strlen(str)) : 0; }
+	ConstString(const char *str, int len = -1) : _str((char*)str) { _len = str ? (len >= 0 ? len : strlen(str)) : 0; }
 	virtual ~ConstString() {}
 	
 	bool operator ==(const ConstString& x) const;
@@ -77,7 +77,7 @@
 
 public:
 	String() : _capacity(0) { _refCount = new int(1); }
-	String(const char *str, int len = 0);
+	String(const char *str, int len = -1);
 	String(const ConstString &str);
 	String(const String &str);
 	virtual ~String();





More information about the Scummvm-git-logs mailing list