[Scummvm-cvs-logs] CVS: scummvm/sword2 console.cpp,1.28,1.29 controls.cpp,1.46,1.47 debug.cpp,1.24,1.25 events.cpp,1.15,1.16 icons.cpp,1.21,1.22 logic.cpp,1.27,1.28 logic.h,1.14,1.15 mouse.cpp,1.36,1.37 resman.cpp,1.61,1.62 save_rest.cpp,1.34,1.35 startup.cpp,1.28,1.29 startup.h,1.4,1.5 sword2.cpp,1.76,1.77

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Tue Nov 4 10:04:12 CET 2003


Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1:/tmp/cvs-serv16123

Modified Files:
	console.cpp controls.cpp debug.cpp events.cpp icons.cpp 
	logic.cpp logic.h mouse.cpp resman.cpp save_rest.cpp 
	startup.cpp startup.h sword2.cpp 
Log Message:
Create g_logic dynamically. More moving of stuff into classes.


Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/console.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- console.cpp	3 Nov 2003 07:47:41 -0000	1.28
+++ console.cpp	4 Nov 2003 18:02:49 -0000	1.29
@@ -197,7 +197,7 @@
 }
 
 bool Debugger::Cmd_Starts(int argc, const char **argv) {
-	Con_print_start_menu();
+	g_logic->conPrintStartMenu();
 	return true;
 }
 
@@ -209,7 +209,7 @@
 		return true;
 	}
 
-	Con_start(atoi(argv[1]));
+	g_logic->conStart(atoi(argv[1]));
 	g_display->setPalette(187, 1, pal, RDPAL_INSTANT);
 	return true;
 }
@@ -272,7 +272,7 @@
 }
 
 bool Debugger::Cmd_RunList(int argc, const char **argv) {
-	g_logic.examineRunList();
+	g_logic->examineRunList();
 	return true;
 }
 
@@ -612,7 +612,7 @@
 	}
 
 	// Automatically do "s 32" to run the animation testing start script
-	Con_start(32);
+	g_logic->conStart(32);
 
 	// Same as typing "VAR 912 <value>" at the console
 	varSet(912, atoi(argv[1]));
@@ -628,7 +628,7 @@
 	}
 
 	// Automatically do "s 33" to run the text/speech testing start script
-	Con_start(33);
+	g_logic->conStart(33);
 
 	// Same as typing "VAR 1230 <value>" at the console
 	varSet(1230, atoi(argv[1]));
@@ -647,7 +647,7 @@
 	}
 
 	// Automatically do "s 33" to run the text/speech testing start script
-	Con_start(33);
+	g_logic->conStart(33);
 
 	// Same as typing "VAR 1230 <value>" at the console
 	varSet(1230, atoi(argv[1]));

Index: controls.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/controls.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- controls.cpp	3 Nov 2003 07:47:41 -0000	1.46
+++ controls.cpp	4 Nov 2003 18:02:49 -0000	1.47
@@ -1295,7 +1295,7 @@
 				// fnRegisterMouse and fnRegisterFrame)
 				g_sword2->resetMouseList();
 
-				if (g_logic.processSession())
+				if (g_logic->processSession())
 					error("restore 1st cycle failed??");
 			}
 		}
@@ -1446,7 +1446,7 @@
 
 	// reopen global variables resource & send address to interpreter -
 	// it won't be moving
-	g_logic.setGlobalInterpreterVariables((int32 *) (res_man->openResource(1) + sizeof(_standardHeader)));
+	g_logic->setGlobalInterpreterVariables((int32 *) (res_man->openResource(1) + sizeof(_standardHeader)));
 	res_man->closeResource(1);
 
 	DEMO = temp_demo_flag;
@@ -1475,7 +1475,7 @@
 
 	g_sword2->_thisScreen.scroll_flag = 2;
 
-	if (g_logic.processSession())
+	if (g_logic->processSession())
 		error("restart 1st cycle failed??");
 
 	// So palette not restored immediately after control panel - we want

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/debug.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- debug.cpp	4 Nov 2003 17:26:59 -0000	1.24
+++ debug.cpp	4 Nov 2003 18:02:49 -0000	1.25
@@ -152,7 +152,7 @@
 			sprintf(buf, "pos: %d", _textNumber & 0xffff);
 			makeDebugTextBlock(buf, 0, 370);
 
- 			sprintf(buf, "TEXT: %d", g_logic._officialTextNumber);
+ 			sprintf(buf, "TEXT: %d", g_logic->_officialTextNumber);
 			makeDebugTextBlock(buf, 0, 385);
 		}
 	}
@@ -269,10 +269,10 @@
 		// "waiting for person" indicator - set form fnTheyDo and
 		// fnTheyDoWeWait
 
-		if (g_logic._speechScriptWaiting) {
+		if (g_logic->_speechScriptWaiting) {
 			sprintf(buf, "script waiting for %s (%d)",
-				g_sword2->fetchObjectName(g_logic._speechScriptWaiting),
-				g_logic._speechScriptWaiting);
+				g_sword2->fetchObjectName(g_logic->_speechScriptWaiting),
+				g_logic->_speechScriptWaiting);
 			makeDebugTextBlock(buf, 0, 90);
 		}
 
@@ -360,7 +360,7 @@
 		Debug_Printf("%d wide, %d high\n", g_sword2->_thisScreen.screen_wide, g_sword2->_thisScreen.screen_deep);
 		Debug_Printf("%d normal layers\n", g_sword2->_thisScreen.number_of_layers);
 
-		g_logic.examineRunList();
+		g_logic->examineRunList();
 	} else
 		Debug_Printf("No screen\n");
 }

Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/events.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- events.cpp	2 Nov 2003 15:58:45 -0000	1.15
+++ events.cpp	4 Nov 2003 18:02:49 -0000	1.16
@@ -87,7 +87,7 @@
 	for (int i = 0; i < MAX_events; i++) {
 		if (_eventList[i].id == ID) {
 			// run 3rd script of target object on level 1
-			g_logic.logicOne(_eventList[i].interact_id);
+			g_logic->logicOne(_eventList[i].interact_id);
 
 			// clear the slot
 			_eventList[i].id = 0;

Index: icons.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/icons.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- icons.cpp	3 Nov 2003 07:47:41 -0000	1.21
+++ icons.cpp	4 Nov 2003 18:02:49 -0000	1.22
@@ -88,7 +88,7 @@
 	// objects. Run the 'build_menu' script in the 'menu_master' object
 
 	head = res_man->openResource(MENU_MASTER_OBJECT);
-	g_logic.runScript((char*) head, (char*) head, &null_pc);
+	g_logic->runScript((char*) head, (char*) head, &null_pc);
 	res_man->closeResource(MENU_MASTER_OBJECT);
 
 	// Compare new with old. Anything in master thats not in new gets

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/logic.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- logic.cpp	3 Nov 2003 07:47:41 -0000	1.27
+++ logic.cpp	4 Nov 2003 18:02:49 -0000	1.28
@@ -31,7 +31,7 @@
 
 namespace Sword2 {
 
-Logic g_logic;
+Logic *g_logic;
 
 #define LEVEL (_curObjectHub->logic_level)
 

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/logic.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- logic.h	4 Nov 2003 17:26:59 -0000	1.14
+++ logic.h	4 Nov 2003 18:02:49 -0000	1.15
@@ -25,6 +25,7 @@
 #include "sword2/header.h"
 #include "sword2/memory.h"
 #include "sword2/speech.h"
+#include "sword2/startup.h"
 #include "sword2/driver/driver96.h"
 
 namespace Sword2 {
@@ -140,14 +141,36 @@
 	void getCorrectCdForSpeech(int32 wavId);
 #endif
 
+	uint32 _totalStartups;
+	uint32 _totalScreenManagers;
+	uint32 _startRes;
+
+	struct _startup {
+		char description[MAX_description];
+
+		// id of screen manager object
+		uint32 start_res_id;
+
+		//tell the manager which startup you want (if there are more
+		// than 1) (i.e more than 1 entrance to a screen and/or
+		// seperate game boots)
+		uint32 key;
+	};
+
+	_startup _startList[MAX_starts];
+
+	uint32 initStartMenu(void);
+
 public:
 	Logic() : _globals(NULL), _kills(0), _debugFlag(false),
 		  _smackerLeadOut(0), _sequenceTextLines(0), _speechTime(0),
 		  _animId(0), _leftClickDelay(0), _rightClickDelay(0),
-		  _defaultResponseId(0), _officialTextNumber(0),
+		  _defaultResponseId(0), _totalStartups(0),
+		  _totalScreenManagers(0), _officialTextNumber(0),
 		  _speechScriptWaiting(0), _speechTextBlocNo(0),
 		  _choosing(false), _unpauseZone(0) {
 		memset(_subjectList, 0, sizeof(_subjectList));
+		initStartMenu();
 		setupOpcodes();
 	}
 
@@ -171,6 +194,9 @@
 
 	uint32 _unpauseZone;
 
+	void conPrintStartMenu(void);
+	void conStart(int start);
+
 	void setGlobalInterpreterVariables(int32 *vars);
 	int runScript(char *scriptData, char *objectData, uint32 *offset);
 
@@ -316,7 +342,7 @@
 
 };
 
-extern Logic g_logic;
+extern Logic *g_logic;
 
 } // End of namespace Sword2
 

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/mouse.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- mouse.cpp	3 Nov 2003 07:47:41 -0000	1.36
+++ mouse.cpp	4 Nov 2003 18:02:49 -0000	1.37
@@ -181,7 +181,7 @@
 
 				pars[0] = 221;	// SystemM234 (M234.wav)
 				pars[1] = FX_LOOP;
-				g_logic.fnPlayMusic(pars);
+				g_logic->fnPlayMusic(pars);
 
 				// restore proper looping_music_id
 				_loopingMusicId = safe_looping_music_id;
@@ -254,7 +254,7 @@
 				if (_loopingMusicId) {
 					pars[0] = _loopingMusicId;
 					pars[1] = FX_LOOP;
-					g_logic.fnPlayMusic(pars);
+					g_logic->fnPlayMusic(pars);
 
 					// cross-fades into the required music:
 					// - either a restored game tune
@@ -262,7 +262,7 @@
 					// entering control panels
 				} else {
 					// stop the control panel music
-					g_logic.fnStopMusic(NULL);
+					g_logic->fnStopMusic(NULL);
 				}
 			}
 		}
@@ -604,8 +604,8 @@
 				// let the existing interaction continue and
 				// start fading down - switch the human off too
 
-				g_logic.fnNoHuman(NULL);
-				g_logic.fnFadeDown(NULL);
+				g_logic->fnNoHuman(NULL);
+				g_logic->fnFadeDown(NULL);
 				EXIT_FADING = 1;	// tell the walker
 			} else if (_oldButton == _buttonClick && _mouseTouching == CLICKED_ID && _mousePointerRes != NORMAL_MOUSE_ID) {
 				// re-click - do nothing - except on floors

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/resman.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- resman.cpp	3 Nov 2003 07:47:41 -0000	1.61
+++ resman.cpp	4 Nov 2003 18:02:49 -0000	1.62
@@ -979,7 +979,7 @@
 	// down - but if we restored to a different CD the music is stopped
 	// in getCd() when it asks for the CD
 
-	g_logic.fnStopMusic(NULL);
+	g_logic->fnStopMusic(NULL);
 
 	g_sword2->clearFxQueue();	// stops all fx & clears the queue (James22july97)
 	getCd(_cdTab[newCluster] & 3);
@@ -1282,7 +1282,7 @@
 	// current CD - otherwise when we take out the CD, Windows will
 	// complain!
 
-	g_logic.fnStopMusic(NULL);
+	g_logic->fnStopMusic(NULL);
 
 	textRes = openResource(2283);
 	g_sword2->displayMsg(g_sword2->fetchTextLine(textRes, 5 + cd) + 2, 0);

Index: save_rest.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/save_rest.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- save_rest.cpp	3 Nov 2003 17:46:55 -0000	1.34
+++ save_rest.cpp	4 Nov 2003 18:02:49 -0000	1.35
@@ -148,7 +148,7 @@
 	g_header.screenId = _thisScreen.background_layer_id;
 
 	// resource id of current run-list
-	g_header.runListId = g_logic.getRunList();
+	g_header.runListId = g_logic->getRunList();
 
 	// those scroll position control things
 	g_header.feet_x = _thisScreen.feet_x;
@@ -346,7 +346,7 @@
 	res_man->killAll(false);
 
 	// clean out the system kill list (no more objects to kill)
-	g_logic.resetKillList();
+	g_logic->resetKillList();
 	
 	// get player character data from savegame buffer
 
@@ -383,7 +383,7 @@
 
 	pars[0] = g_header.screenId;
 	pars[1] = 1;
-	g_logic.fnInitBackground(pars);
+	g_logic->fnInitBackground(pars);
 
 	// So palette not restored immediately after control panel - we want to
 	// fade up instead!
@@ -396,7 +396,7 @@
 	_thisScreen.feet_y = g_header.feet_y;
 
 	// start the new run list
-	g_logic.expressChangeSession(g_header.runListId);
+	g_logic->expressChangeSession(g_header.runListId);
 
 	// Force in the new scroll position, so unsightly scroll-catch-up does
 	// not occur when screen first draws after returning from restore panel
@@ -484,7 +484,7 @@
 		error("incorrect CUR_PLAYER_ID=%d", CUR_PLAYER_ID);
 
 	raw_script_ad = (char *) head;
-	g_logic.runScript(raw_script_ad, raw_script_ad, &null_pc);
+	g_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
 	res_man->closeResource(CUR_PLAYER_ID);
 }
 
@@ -507,12 +507,12 @@
 	// script no. 8 - 'george_savedata_return' calls fnGetPlayerSaveData
 
 	null_pc = 8;
-	g_logic.runScript(raw_script_ad, raw_script_ad, &null_pc);
+	g_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 	// script no. 14 - 'set_up_nico_anim_tables'
 
 	null_pc = 14;
-	g_logic.runScript(raw_script_ad, raw_script_ad, &null_pc);
+	g_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 	// which megaset was the player at the time of saving?
 
@@ -534,7 +534,7 @@
 		break;
 	}
 
-	g_logic.runScript(raw_script_ad, raw_script_ad, &null_pc);
+	g_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
 	res_man->closeResource(CUR_PLAYER_ID);
 }
 

Index: startup.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/startup.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- startup.cpp	4 Nov 2003 17:26:59 -0000	1.28
+++ startup.cpp	4 Nov 2003 18:02:49 -0000	1.29
@@ -40,13 +40,7 @@
 
 namespace Sword2 {
 
-uint32 total_startups = 0;
-uint32 total_screen_managers = 0;
-uint32 res;
-
-_startup start_list[MAX_starts];
-
-uint32 Init_start_menu(void) {
+uint32 Logic::initStartMenu(void) {
 	// Print out a list of all the start points available.
 	// There should be a linc produced file called startup.txt.
 	// This file should contain ascii numbers of all the resource game
@@ -65,7 +59,7 @@
 
 	// ok, load in the master screen manager file
 
-	total_startups = 0;	// no starts
+	_totalStartups = 0;	// no starts
 
 	debug(5, "initialising start menu");
 
@@ -79,13 +73,13 @@
 
 	do {
 		while (temp->ad[j] != 13) {	// item must have an #0d0a
-			ascii_start_ids[total_screen_managers][pos] = temp->ad[j];
+			ascii_start_ids[_totalScreenManagers][pos] = temp->ad[j];
 			j++;
 			pos++;
 		}
 
 		// NULL terminate our extracted string
-		ascii_start_ids[total_screen_managers][pos] = 0;
+		ascii_start_ids[_totalScreenManagers][pos] = 0;
 
 		// reset position in current slot between entries
 		pos = 0;
@@ -94,9 +88,9 @@
 		j += 2;
 
 		// done another
-		total_screen_managers++;
+		_totalScreenManagers++;
 
-		if (total_screen_managers == MAX_starts) {
+		if (_totalScreenManagers == MAX_starts) {
 			debug(5, "WARNING MAX_starts exceeded!");
 			break;
 		}
@@ -105,34 +99,34 @@
 	// using this method the Gode generated resource.inf must have #0d0a
 	// on the last entry
 
-	debug(5, "%d screen manager objects", total_screen_managers);
+	debug(5, "%d screen manager objects", _totalScreenManagers);
 
 	// Open each object and make a query call. The object must fill in a
 	// startup structure. It may fill in several if it wishes - for
 	// instance a startup could be set for later in the game where
 	// specific vars are set
 
-	for (j = 0; j < total_screen_managers; j++) {
-		res = atoi(ascii_start_ids[j]);
+	for (j = 0; j < _totalScreenManagers; j++) {
+		_startRes = atoi(ascii_start_ids[j]);
 
-		debug(5, "+querying screen manager %d", res);
+		debug(5, "+querying screen manager %d", _startRes);
 
 		// resopen each one and run through the interpretter
 		// script 0 is the query request script
 
 		// if the resource number is within range & it's not a null
-		// resource (James 12mar97)
+		// resource
 		// - need to check in case un-built sections included in
 		// start list
 
-		if (res_man->checkValid(res)) {
-			debug(5, "- resource %d ok", res);
-			raw_script = (char*) res_man->openResource(res);
+		if (res_man->checkValid(_startRes)) {
+			debug(5, "- resource %d ok", _startRes);
+			raw_script = (char*) res_man->openResource(_startRes);
 			null_pc = 0;
-			g_logic.runScript(raw_script, raw_script, &null_pc);
-			res_man->closeResource(res);
+			runScript(raw_script, raw_script, &null_pc);
+			res_man->closeResource(_startRes);
 		} else
-			debug(5, "- resource %d invalid", res);
+			debug(5, "- resource %d invalid", _startRes);
 	}
 
 	memory->freeMemory(temp);
@@ -145,8 +139,8 @@
 	// 		1 pointer to ascii message
 
 #ifdef _SWORD2_DEBUG
-	if (total_startups == MAX_starts)
-		error("ERROR: start_list full");
+	if (_totalStartups == MAX_starts)
+		error("ERROR: _startList full");
 
 	// +1 to allow for NULL terminator
 	if (strlen((char*) params[1]) + 1 > MAX_description)
@@ -154,45 +148,45 @@
 #endif
 
 	// this objects id
-	start_list[total_startups].start_res_id	= res;
+	_startList[_totalStartups].start_res_id	= _startRes;
 
 	// a key code to be passed to a script via a script var to SWITCH in
 	// the correct start
-	start_list[total_startups].key = params[0];
+	_startList[_totalStartups].key = params[0];
 
-	strcpy(start_list[total_startups].description, (char*) params[1]);
+	strcpy(_startList[_totalStartups].description, (char*) params[1]);
 
 	// point to next
-	total_startups++;
+	_totalStartups++;
 
 	return 1;
 }
 
-void Con_print_start_menu(void) {
+void Logic::conPrintStartMenu(void) {
 	// the console 'starts' (or 's') command which lists out all the
 	// registered start points in the game
 
-	if (!total_startups) {
+	if (!_totalStartups) {
 		Debug_Printf("Sorry - no startup positions registered?\n");
 
-		if (!total_screen_managers)
+		if (!_totalScreenManagers)
 			Debug_Printf("There is a problem with startup.inf\n");
 		else
-			Debug_Printf(" (%d screen managers found in startup.inf)\n", total_screen_managers);
+			Debug_Printf(" (%d screen managers found in startup.inf)\n", _totalScreenManagers);
 	} else {
-		for (uint i = 0; i < total_startups; i++)
-			Debug_Printf("%d  (%s)\n", i, start_list[i].description);
+		for (uint i = 0; i < _totalStartups; i++)
+			Debug_Printf("%d  (%s)\n", i, _startList[i].description);
 	}
 }
 
-void Con_start(int start) {
+void Logic::conStart(int start) {
 	char *raw_script;
 	char *raw_data_ad;
 	uint32 null_pc;
 
-	if (!total_startups)
+	if (!_totalStartups)
 		Debug_Printf("Sorry - there are no startups!\n");
-	else if (start >= 0 && start < (int) total_startups) {
+	else if (start >= 0 && start < (int) _totalStartups) {
 		// do the startup as we've specified a legal start
 
 		// restarting - stop sfx, music & speech!
@@ -200,14 +194,14 @@
 		g_sword2->clearFxQueue();
 
 		// fade out any music that is currently playing
-		g_logic.fnStopMusic(NULL);
+		fnStopMusic(NULL);
 
 		// halt the sample prematurely
 		g_sound->unpauseSpeech();
 		g_sound->stopSpeech();
 
 		// clean out all resources & flags, ready for a total
-		// restart (James24mar97)
+		// restart
 
 		// remove all resources from memory, including player
 		// object & global variables
@@ -216,38 +210,38 @@
 
 		// reopen global variables resource & send address to
 		// interpreter - it won't be moving
-		g_logic.setGlobalInterpreterVariables((int32 *) (res_man->openResource(1) + sizeof(_standardHeader)));
+		setGlobalInterpreterVariables((int32 *) (res_man->openResource(1) + sizeof(_standardHeader)));
 		res_man->closeResource(1);
 
 		// free all the route memory blocks from previous game
 		router.freeAllRouteMem();
 
 		// if there was speech text, kill the text block
-		if (g_logic._speechTextBlocNo) {
-			fontRenderer.killTextBloc(g_logic._speechTextBlocNo);
-			g_logic._speechTextBlocNo = 0;
+		if (_speechTextBlocNo) {
+			fontRenderer.killTextBloc(_speechTextBlocNo);
+			_speechTextBlocNo = 0;
 		}
 
 		// set the key
 
 		// Open George
 		raw_data_ad = (char *) res_man->openResource(8);
-		raw_script = (char *) res_man->openResource(start_list[start].start_res_id);
+		raw_script = (char *) res_man->openResource(_startList[start].start_res_id);
 
 		// denotes script to run
-		null_pc = start_list[start].key & 0xffff;
+		null_pc = _startList[start].key & 0xffff;
 
 		Debug_Printf("Running start %d\n", start);
-		g_logic.runScript(raw_script, raw_data_ad, &null_pc);
+		runScript(raw_script, raw_data_ad, &null_pc);
 
-		res_man->closeResource(start_list[start].start_res_id);
+		res_man->closeResource(_startList[start].start_res_id);
 
 		// Close George
 		res_man->closeResource(8);
 
 		// make sure thre's a mouse, in case restarting while
 		// mouse not available
-		g_logic.fnAddHuman(NULL);
+		fnAddHuman(NULL);
 	} else
 		Debug_Printf("Not a legal start position\n");
 }

Index: startup.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/startup.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- startup.h	26 Oct 2003 15:42:49 -0000	1.4
+++ startup.h	4 Nov 2003 18:02:49 -0000	1.5
@@ -20,28 +20,10 @@
 #ifndef	_STARTUP
 #define	_STARTUP
 
-namespace Sword2 {
-
 #define	MAX_starts	100
 #define	MAX_description	100
 
-typedef	struct {
-	char description[MAX_description];
-
-	// id of screen manager object
-	uint32 start_res_id;
-
-	//tell the manager which startup you want (if there are more than 1)
-	// (i.e more than 1 entrance to a screen and/or seperate game boots)
-	uint32 key;
-} _startup;
-
-extern _startup start_list[MAX_starts];
-
-uint32 Init_start_menu(void);
-void Con_print_start_menu(void);
-void Con_start(int start);
-
+namespace Sword2 {
 } // End of namespace Sword2
 
 #endif

Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- sword2.cpp	4 Nov 2003 17:26:59 -0000	1.76
+++ sword2.cpp	4 Nov 2003 18:02:49 -0000	1.77
@@ -138,6 +138,7 @@
 
 	memory = new MemoryManager();
 	res_man = new ResourceManager();
+	g_logic = new Logic();
 	g_sound = _sound = new Sound(_mixer);
 	g_display = _display = new Display(640, 480);
 	gui = new Gui();
@@ -196,6 +197,7 @@
 	delete _display;
 	delete _debugger;
 	delete gui;
+	delete g_logic;
 	delete res_man;
 	delete memory;
 }
@@ -226,7 +228,7 @@
 	// res 1 is the globals list
 	file = res_man->openResource(1);
 	debug(5, "CALLING: SetGlobalInterpreterVariables");
-	g_logic.setGlobalInterpreterVariables((int32 * ) (file + sizeof(_standardHeader)));
+	g_logic->setGlobalInterpreterVariables((int32 * ) (file + sizeof(_standardHeader)));
 
 	// DON'T CLOSE VARIABLES RESOURCE - KEEP IT OPEN AT VERY START OF
 	// MEMORY SO IT CAN'T MOVE!
@@ -241,11 +243,6 @@
 	debug(5, "CALLING: initialiseFontResourceFlags");
 	initialiseFontResourceFlags();
 
-	// read in all the startup information
-
-	debug(5, "CALLING: Init_start_menu");
-	Init_start_menu();
-
 	debug(5, "CALLING: Init_sync_system");
 	Init_sync_system();
 
@@ -279,7 +276,7 @@
 	// do one game cycle
 
 	// got a screen to run?
-	if (g_logic.getRunList()) {
+	if (g_logic->getRunList()) {
 		//run the logic session UNTIL a full loop has been performed
 		do {
 			// reset the graphic 'buildit' list before a new
@@ -292,7 +289,7 @@
 
 			// keep going as long as new lists keep getting put in
 			// - i.e. screen changes
-		} while (g_logic.processSession());
+		} while (g_logic->processSession());
 	} else {
 		// start the console and print the start options perhaps?
 		g_sword2->_debugger->attach("AWAITING START COMMAND: (Enter 's 1' then 'q' to start from beginning)");
@@ -413,7 +410,7 @@
 				// 'P' while not paused = pause!
 				PauseGame();
 			} else if (c == 'C' && !(_features & GF_DEMO)) {
-				g_logic.fnPlayCredits(NULL);
+				g_logic->fnPlayCredits(NULL);
 			}
 #ifdef _SWORD2_DEBUG
 			else if (c == 'S') {
@@ -490,7 +487,7 @@
 	raw_script = (char *) res_man->openResource(screen_manager_id);
 
 	// run the start script now (because no console)
-	g_logic.runScript(raw_script, raw_data_ad, &null_pc);
+	g_logic->runScript(raw_script, raw_data_ad, &null_pc);
 
 	// close the ScreenManager object
 	res_man->closeResource(screen_manager_id);
@@ -580,10 +577,10 @@
 	}
 
 	gamePaused = 0;
-	g_logic._unpauseZone = 2;
+	g_logic->_unpauseZone = 2;
 
 	// if mouse is about or we're in a chooser menu
-	if (!g_sword2->_mouseStatus || g_logic._choosing)
+	if (!g_sword2->_mouseStatus || g_logic->_choosing)
 		g_sword2->setMouse(NORMAL_MOUSE_ID);
 }
 





More information about the Scummvm-git-logs mailing list