[Scummvm-cvs-logs] CVS: scummvm/sword2 anims.cpp,1.44,1.45 console.cpp,1.33,1.34 controls.cpp,1.49,1.50 debug.cpp,1.29,1.30 events.cpp,1.20,1.21 icons.cpp,1.25,1.26 logic.cpp,1.31,1.32 logic.h,1.19,1.20 mouse.cpp,1.42,1.43 resman.cpp,1.70,1.71 save_rest.cpp,1.38,1.39 startup.cpp,1.32,1.33 sword2.cpp,1.84,1.85 sword2.h,1.40,1.41

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sat Nov 15 01:39:10 CET 2003


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

Modified Files:
	anims.cpp console.cpp controls.cpp debug.cpp events.cpp 
	icons.cpp logic.cpp logic.h mouse.cpp resman.cpp save_rest.cpp 
	startup.cpp sword2.cpp sword2.h 
Log Message:
Mostly cleanup. Also prevented what would probably have been an infinite
loop if ScummVM failed to find a file in the demo. (Now it should error out
instead, which is marginally preferable.)


Index: anims.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/anims.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- anims.cpp	11 Nov 2003 07:43:02 -0000	1.44
+++ anims.cpp	15 Nov 2003 09:37:59 -0000	1.45
@@ -174,7 +174,7 @@
 			ob_graphic->anim_pc = anim_head->noAnimFrames - 1;
 		else
 			ob_graphic->anim_pc = 0;
- 	} else if (g_logic->getSync()) {
+ 	} else if (getSync()) {
 		// We've received a sync - return to script immediately
 		debug(5, "**sync stopped %d**", ID);
 

Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/console.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- console.cpp	11 Nov 2003 10:30:20 -0000	1.33
+++ console.cpp	15 Nov 2003 09:37:59 -0000	1.34
@@ -196,7 +196,7 @@
 }
 
 bool Debugger::Cmd_Starts(int argc, const char **argv) {
-	g_logic->conPrintStartMenu();
+	_vm->_logic->conPrintStartMenu();
 	return true;
 }
 
@@ -208,7 +208,7 @@
 		return true;
 	}
 
-	g_logic->conStart(atoi(argv[1]));
+	_vm->_logic->conStart(atoi(argv[1]));
 	g_graphics->setPalette(187, 1, pal, RDPAL_INSTANT);
 	return true;
 }
@@ -271,7 +271,7 @@
 }
 
 bool Debugger::Cmd_RunList(int argc, const char **argv) {
-	g_logic->examineRunList();
+	_vm->_logic->examineRunList();
 	return true;
 }
 
@@ -611,7 +611,7 @@
 	}
 
 	// Automatically do "s 32" to run the animation testing start script
-	g_logic->conStart(32);
+	_vm->_logic->conStart(32);
 
 	// Same as typing "VAR 912 <value>" at the console
 	varSet(912, atoi(argv[1]));
@@ -627,7 +627,7 @@
 	}
 
 	// Automatically do "s 33" to run the text/speech testing start script
-	g_logic->conStart(33);
+	_vm->_logic->conStart(33);
 
 	// Same as typing "VAR 1230 <value>" at the console
 	varSet(1230, atoi(argv[1]));
@@ -646,7 +646,7 @@
 	}
 
 	// Automatically do "s 33" to run the text/speech testing start script
-	g_logic->conStart(33);
+	_vm->_logic->conStart(33);
 
 	// Same as typing "VAR 1230 <value>" at the console
 	varSet(1230, atoi(argv[1]));
@@ -681,9 +681,9 @@
 	DebugPrintf("EVENT LIST:\n");
 
 	for (uint32 i = 0; i < MAX_events; i++) {
-		if (g_logic->_eventList[i].id) {
-			uint32 target = g_logic->_eventList[i].id;
-			uint32 script = g_logic->_eventList[i].interact_id;
+		if (_vm->_logic->_eventList[i].id) {
+			uint32 target = _vm->_logic->_eventList[i].id;
+			uint32 script = _vm->_logic->_eventList[i].interact_id;
 
 			DebugPrintf("slot %d: id = %s (%d)\n", i, _vm->fetchObjectName(target), target);
 			DebugPrintf("         script = %s (%d) pos %d\n", _vm->fetchObjectName(script / 65536), script / 65536, script % 65536);

Index: controls.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/controls.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- controls.cpp	11 Nov 2003 07:43:02 -0000	1.49
+++ controls.cpp	15 Nov 2003 09:37:59 -0000	1.50
@@ -656,6 +656,7 @@
 
 class MiniDialog : public Dialog {
 private:
+	Sword2Engine *_vm;
 	int _textId;
 	FontRendererGui *_fr;
 	Widget *_panel;
@@ -663,8 +664,8 @@
 	Button *_cancelButton;
 
 public:
-	MiniDialog(uint32 textId) : _textId(textId) {
-		_fr = new FontRendererGui(g_sword2->_controlsFontId);
+	MiniDialog(int fontId, uint32 textId) : _textId(textId) {
+		_fr = new FontRendererGui(fontId);
 
 		_panel = new Widget(this, 1);
 		_panel->createSurfaceImages(1996, 203, 104);
@@ -987,6 +988,8 @@
 
 class SaveLoadDialog : public Dialog {
 private:
+	Sword2Engine *_vm;
+
 	int _mode, _selectedSlot;
 	char _editBuffer[SAVE_DESCRIPTION_LEN];
 	int _editPos, _firstPos;
@@ -1006,14 +1009,15 @@
 	void saveLoadError(char *text);
 
 public:
-	SaveLoadDialog(int mode) : _mode(mode), _selectedSlot(-1) {
+	SaveLoadDialog(Sword2Engine *vm, int mode)
+		: _vm(vm), _mode(mode), _selectedSlot(-1) {
 		int i;
 
 		// FIXME: The "control font" and the "red font" are currently
 		// always the same font, so one should be eliminated.
 
-		_fr1 = new FontRendererGui(g_sword2->_controlsFontId);
-		_fr2 = new FontRendererGui(g_sword2->_redFontId);
+		_fr1 = new FontRendererGui(_vm->_controlsFontId);
+		_fr2 = new FontRendererGui(_vm->_redFontId);
 
 		_panel = new Widget(this, 1);
 		_panel->createSurfaceImages(2016, 0, 40);
@@ -1086,7 +1090,7 @@
 				fr = _fr1;
 			}
 
-			if (g_sword2->getSaveDescription(gui->_baseSlot + i, description) == SR_OK) {
+			if (_vm->getSaveDescription(gui->_baseSlot + i, description) == SR_OK) {
 				slot->setText(fr, gui->_baseSlot + i, (char *) description);
 				slot->setClickable(true);
 			} else {
@@ -1247,7 +1251,7 @@
 
 			_editBuffer[_editPos] = 0;
 
-			uint32 rv = g_sword2->saveGame(_selectedSlot, (uint8 *) &_editBuffer[_firstPos]);
+			uint32 rv = _vm->saveGame(_selectedSlot, (uint8 *) &_editBuffer[_firstPos]);
 
 			if (rv != SR_OK) {
 				uint32 textId;
@@ -1265,7 +1269,7 @@
 				result = 0;
 			}
 		} else {
-			uint32 rv = g_sword2->restoreGame(_selectedSlot);
+			uint32 rv = _vm->restoreGame(_selectedSlot);
 
 			if (rv != SR_OK) {
 				uint32 textId;
@@ -1289,13 +1293,13 @@
 
 				// Reset the graphic 'buildit' list before a
 				// new logic list (see fnRegisterFrame)
-				g_sword2->resetRenderLists();
+				_vm->resetRenderLists();
 
 				// Reset the mouse hot-spot list (see
 				// fnRegisterMouse and fnRegisterFrame)
-				g_sword2->resetMouseList();
+				_vm->resetMouseList();
 
-				if (g_logic->processSession())
+				if (_vm->_logic->processSession())
 					error("restore 1st cycle failed??");
 			}
 		}
@@ -1395,74 +1399,67 @@
 	// returns 0 for no restore
 	//         1 for restored ok
 
-	SaveLoadDialog loadDialog(kLoadDialog);
+	SaveLoadDialog loadDialog(_vm, kLoadDialog);
 	return loadDialog.run();
 }
 
 void Gui::saveControl(void) {
-	SaveLoadDialog saveDialog(kSaveDialog);
+	SaveLoadDialog saveDialog(_vm, kSaveDialog);
 	saveDialog.run();
 }
 
 void Gui::quitControl(void) {
-	MiniDialog quitDialog(149618692);	// quit text
-
-	if (!quitDialog.run()) {
-		// just return to game
-		return;
-	}
+	MiniDialog quitDialog(_vm->_controlsFontId, 149618692);
 
-	// close engine systems down
-	_vm->closeGame();
+	if (quitDialog.run())
+		_vm->closeGame();
 }
 
 void Gui::restartControl(void) {
 	uint32 temp_demo_flag;
 
-	MiniDialog restartDialog(149618693);	// restart text
+	MiniDialog restartDialog(_vm->_controlsFontId, 149618693);
 
-	if (!restartDialog.run()) {
-		// just return to game
+	if (!restartDialog.run())
 		return;
-	}
+
+	// Restart the game. To do this, we must...
 
 	// Stop music instantly!
 	_vm->killMusic();
 
-	//in case we were dead - well we're not anymore!
+	// In case we were dead - well we're not anymore!
 	DEAD = 0;
 
 	g_graphics->clearScene();
 
-	// restart the game
-	// clear all memory and reset the globals
-
+	// Restart the game. Clear all memory and reset the globals
 	temp_demo_flag = DEMO;
 
-	// remove all resources from memory, including player object and
+	// Remove all resources from memory, including player object and
 	// global variables
 	res_man->removeAll();
 
-	// reopen global variables resource & send address to interpreter -
+	// Reopen global variables resource & send address to interpreter -
 	// it won't be moving
-	g_logic->setGlobalInterpreterVariables((int32 *) (res_man->openResource(1) + sizeof(_standardHeader)));
+	_vm->_logic->setGlobalInterpreterVariables((int32 *) (res_man->openResource(1) + sizeof(_standardHeader)));
 	res_man->closeResource(1);
 
 	DEMO = temp_demo_flag;
 
-	// free all the route memory blocks from previous game
-	g_logic->_router->freeAllRouteMem();
+	// Rree all the route memory blocks from previous game
+	_vm->_logic->_router->freeAllRouteMem();
 
-	// call the same function that first started us up
+	// Call the same function that first started us up
 	_vm->startGame();
 
-	// prime system with a game cycle
+	// Prime system with a game cycle
 
-	// reset the graphic 'buildit' list before a new logic list
+	// Reset the graphic 'buildit' list before a new logic list
 	// (see fnRegisterFrame)
 	_vm->resetRenderLists();
 
-	// reset the mouse hot-spot list (see fnRegisterMouse and
+	// Reset the mouse hot-spot list (see fnRegisterMouse and
 	// fnRegisterFrame)
 	_vm->resetMouseList();
 
@@ -1471,15 +1468,13 @@
 	// FOR THE DEMO - FORCE THE SCROLLING TO BE RESET!
 	// - this is taken from fnInitBackground
 	// switch on scrolling (2 means first time on screen)
-
 	_vm->_thisScreen.scroll_flag = 2;
 
-	if (g_logic->processSession())
+	if (_vm->_logic->processSession())
 		error("restart 1st cycle failed??");
 
 	// So palette not restored immediately after control panel - we want
 	// to fade up instead!
-
 	_vm->_thisScreen.new_palette = 99;
 }
 

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/debug.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- debug.cpp	11 Nov 2003 10:30:20 -0000	1.29
+++ debug.cpp	15 Nov 2003 09:37:59 -0000	1.30
@@ -151,7 +151,7 @@
 			sprintf(buf, "pos: %d", _textNumber & 0xffff);
 			makeDebugTextBlock(buf, 0, 370);
 
- 			sprintf(buf, "TEXT: %d", g_logic->_officialTextNumber);
+ 			sprintf(buf, "TEXT: %d", _vm->_logic->_officialTextNumber);
 			makeDebugTextBlock(buf, 0, 385);
 		}
 	}
@@ -233,7 +233,7 @@
 
  		// no. of events in event list
 
-		sprintf(buf, "events=%d", g_logic->countEvents());
+		sprintf(buf, "events=%d", _vm->_logic->countEvents());
 		makeDebugTextBlock(buf, 440, 45);
 
 		// sprite list usage
@@ -268,10 +268,10 @@
 		// "waiting for person" indicator - set form fnTheyDo and
 		// fnTheyDoWeWait
 
-		if (g_logic->_speechScriptWaiting) {
+		if (_vm->_logic->_speechScriptWaiting) {
 			sprintf(buf, "script waiting for %s (%d)",
-				_vm->fetchObjectName(g_logic->_speechScriptWaiting),
-				g_logic->_speechScriptWaiting);
+				_vm->fetchObjectName(_vm->_logic->_speechScriptWaiting),
+				_vm->_logic->_speechScriptWaiting);
 			makeDebugTextBlock(buf, 0, 90);
 		}
 
@@ -309,7 +309,7 @@
 	// walk-grid
 
 	if (_displayWalkGrid)
-		g_logic->_router->plotWalkGrid(); 
+		_vm->_logic->_router->plotWalkGrid(); 
 
 	// player feet coord marker
 
@@ -359,7 +359,7 @@
 		Debug_Printf("%d wide, %d high\n", _vm->_thisScreen.screen_wide, _vm->_thisScreen.screen_deep);
 		Debug_Printf("%d normal layers\n", _vm->_thisScreen.number_of_layers);
 
-		g_logic->examineRunList();
+		_vm->_logic->examineRunList();
 	} else
 		Debug_Printf("No screen\n");
 }

Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/events.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- events.cpp	10 Nov 2003 07:52:15 -0000	1.20
+++ events.cpp	15 Nov 2003 09:37:59 -0000	1.21
@@ -82,7 +82,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);
+			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.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- icons.cpp	11 Nov 2003 07:43:02 -0000	1.25
+++ icons.cpp	15 Nov 2003 09:37:59 -0000	1.26
@@ -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);
+	_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.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- logic.cpp	11 Nov 2003 07:43:02 -0000	1.31
+++ logic.cpp	15 Nov 2003 09:37:59 -0000	1.32
@@ -30,8 +30,6 @@
 
 namespace Sword2 {
 
-Logic *g_logic = NULL;
-
 #define LEVEL (_curObjectHub->logic_level)
 
 /**

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/logic.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- logic.h	8 Nov 2003 18:15:33 -0000	1.19
+++ logic.h	15 Nov 2003 09:37:59 -0000	1.20
@@ -389,8 +389,6 @@
 	void resetKillList(void);
 };
 
-extern Logic *g_logic;
-
 } // End of namespace Sword2
 
 #endif

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/mouse.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- mouse.cpp	12 Nov 2003 08:21:17 -0000	1.42
+++ mouse.cpp	15 Nov 2003 09:37:59 -0000	1.43
@@ -196,7 +196,7 @@
 
 	pars[0] = 221;
 	pars[1] = FX_LOOP;
-	g_logic->fnPlayMusic(pars);
+	_logic->fnPlayMusic(pars);
 
 	// restore proper looping_music_id
 	_loopingMusicId = safe_looping_music_id;
@@ -263,13 +263,13 @@
 	if (_loopingMusicId) {
 		pars[0] = _loopingMusicId;
 		pars[1] = FX_LOOP;
-		g_logic->fnPlayMusic(pars);
+		_logic->fnPlayMusic(pars);
 
 		// cross-fades into the required music: either a restored game
 		// tune, or music playing prior to entering control panels
 	} else {
 		// stop the control panel music
-		g_logic->fnStopMusic(NULL);
+		_logic->fnStopMusic(NULL);
 	}
 }
 
@@ -342,7 +342,7 @@
 
 		CLICKED_ID = _mouseTouching;
 
-		g_logic->setPlayerActionEvent(CUR_PLAYER_ID, _mouseTouching);
+		_logic->setPlayerActionEvent(CUR_PLAYER_ID, _mouseTouching);
 
 		debug(5, "Used \"%s\" on \"%s\"", fetchObjectName(OBJECT_HELD), fetchObjectName(CLICKED_ID));
 
@@ -376,7 +376,7 @@
 		// Otherwise, combine the two icons
 
 		COMBINE_BASE = _masterMenuList[hit].icon_resource;
-		g_logic->setPlayerActionEvent(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
+		_logic->setPlayerActionEvent(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
 
 		// Turn off mouse now, to prevent player trying to click
 		// elsewhere BUT leave the bottom menu open
@@ -427,7 +427,7 @@
 
 		EXIT_CLICK_ID = 0;
 
-		g_logic->setPlayerActionEvent(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
+		_logic->setPlayerActionEvent(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
 
 		// Refresh the menu
 
@@ -636,8 +636,8 @@
 		// interaction continue and start fading down. Switch the human
 		// off too
 
-		g_logic->fnNoHuman(NULL);
-		g_logic->fnFadeDown(NULL);
+		_logic->fnNoHuman(NULL);
+		_logic->fnFadeDown(NULL);
 
 		// Tell the walker
 
@@ -660,7 +660,7 @@
 		EXIT_CLICK_ID = 0;
 		EXIT_FADING = 0;
 
-		g_logic->setPlayerActionEvent(CUR_PLAYER_ID, _mouseTouching);
+		_logic->setPlayerActionEvent(CUR_PLAYER_ID, _mouseTouching);
 
 		if (OBJECT_HELD)
 			debug(2, "Used \"%s\" on \"%s\"", fetchObjectName(OBJECT_HELD), fetchObjectName(CLICKED_ID));

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/resman.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- resman.cpp	14 Nov 2003 07:41:22 -0000	1.70
+++ resman.cpp	15 Nov 2003 09:37:59 -0000	1.71
@@ -458,10 +458,11 @@
 		// for the CD until we do.
 
 		while (!file.open(_resourceFiles[parent_res_file])) {
-			// Is the file supposed to be on the hard disk? Then
-			// we're in trouble if we can't find it!
+			// If the file is supposed to be on hard disk, or we're
+			// playing a demo, then we're in trouble if the file
+			// can't be found!
 
-			if (_cdTab[parent_res_file] & LOCAL_PERM)
+			if ((_vm->_features & GF_DEMO) || (_cdTab[parent_res_file] & LOCAL_PERM))
 				error("Could not find '%s'", _resourceFiles[parent_res_file]);
 
 			getCd(_cdTab[parent_res_file] & 3);
@@ -948,21 +949,11 @@
 void ResourceManager::getCd(int cd) {
 	uint8 *textRes;
 
-	// don't ask for CD's in the playable demo downloaded from our
-	// web-site!
-	if (_vm->_features & GF_DEMO)
-		return;
-
-#ifdef _PCGUIDE
-	// don't ask for CD in the patch for the demo on "PC Guide" magazine
-	return;
-#endif
-
 	// stop any music from playing - so the system no longer needs the
 	// current CD - otherwise when we take out the CD, Windows will
 	// complain!
 
-	g_logic->fnStopMusic(NULL);
+	_vm->_logic->fnStopMusic(NULL);
 
 	textRes = openResource(2283);
 	_vm->displayMsg(_vm->fetchTextLine(textRes, 5 + cd) + 2, 0);

Index: save_rest.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/save_rest.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- save_rest.cpp	10 Nov 2003 07:52:15 -0000	1.38
+++ save_rest.cpp	15 Nov 2003 09:37:59 -0000	1.39
@@ -145,7 +145,7 @@
 	g_header.screenId = _thisScreen.background_layer_id;
 
 	// resource id of current run-list
-	g_header.runListId = g_logic->getRunList();
+	g_header.runListId = _logic->getRunList();
 
 	// those scroll position control things
 	g_header.feet_x = _thisScreen.feet_x;
@@ -343,7 +343,7 @@
 	res_man->killAll(false);
 
 	// clean out the system kill list (no more objects to kill)
-	g_logic->resetKillList();
+	_logic->resetKillList();
 	
 	// get player character data from savegame buffer
 
@@ -380,7 +380,7 @@
 
 	pars[0] = g_header.screenId;
 	pars[1] = 1;
-	g_logic->fnInitBackground(pars);
+	_logic->fnInitBackground(pars);
 
 	// So palette not restored immediately after control panel - we want to
 	// fade up instead!
@@ -393,7 +393,7 @@
 	_thisScreen.feet_y = g_header.feet_y;
 
 	// start the new run list
-	g_logic->expressChangeSession(g_header.runListId);
+	_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
@@ -481,7 +481,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);
+	_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
 	res_man->closeResource(CUR_PLAYER_ID);
 }
 
@@ -504,12 +504,12 @@
 	// script no. 8 - 'george_savedata_return' calls fnGetPlayerSaveData
 
 	null_pc = 8;
-	g_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
+	_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);
+	_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
 
 	// which megaset was the player at the time of saving?
 
@@ -531,7 +531,7 @@
 		break;
 	}
 
-	g_logic->runScript(raw_script_ad, raw_script_ad, &null_pc);
+	_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.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- startup.cpp	10 Nov 2003 07:52:15 -0000	1.32
+++ startup.cpp	15 Nov 2003 09:38:00 -0000	1.33
@@ -212,7 +212,7 @@
 		res_man->closeResource(1);
 
 		// free all the route memory blocks from previous game
-		g_logic->_router->freeAllRouteMem();
+		_router->freeAllRouteMem();
 
 		// if there was speech text, kill the text block
 		if (_speechTextBlocNo) {

Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.cpp,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- sword2.cpp	13 Nov 2003 07:59:52 -0000	1.84
+++ sword2.cpp	15 Nov 2003 09:38:00 -0000	1.85
@@ -128,7 +128,7 @@
 
 	memory = new MemoryManager();
 	res_man = new ResourceManager(this);
-	g_logic = new Logic(this);
+	_logic = new Logic(this);
 	fontRenderer = new FontRenderer();
 	gui = new Gui(this);
 	g_input = _input = new Input();
@@ -194,7 +194,7 @@
 	delete _input;
 	delete gui;
 	delete fontRenderer;
-	delete g_logic;
+	delete _logic;
 	delete res_man;
 	delete memory;
 }
@@ -225,7 +225,7 @@
 	// res 1 is the globals list
 	file = res_man->openResource(1);
 	debug(5, "CALLING: SetGlobalInterpreterVariables");
-	g_logic->setGlobalInterpreterVariables((int32 * ) (file + sizeof(_standardHeader)));
+	_logic->setGlobalInterpreterVariables((int32 * ) (file + sizeof(_standardHeader)));
 
 	// DON'T CLOSE VARIABLES RESOURCE - KEEP IT OPEN AT VERY START OF
 	// MEMORY SO IT CAN'T MOVE!
@@ -264,7 +264,7 @@
 	// do one game cycle
 
 	// got a screen to run?
-	if (g_logic->getRunList()) {
+	if (_logic->getRunList()) {
 		//run the logic session UNTIL a full loop has been performed
 		do {
 			// reset the graphic 'buildit' list before a new
@@ -277,7 +277,7 @@
 
 			// keep going as long as new lists keep getting put in
 			// - i.e. screen changes
-		} while (g_logic->processSession());
+		} while (_logic->processSession());
 	} else {
 		// start the console and print the start options perhaps?
 		_debugger->attach("AWAITING START COMMAND: (Enter 's 1' then 'q' to start from beginning)");
@@ -393,7 +393,7 @@
 				// 'P' while not paused = pause!
 				pauseGame();
 			} else if (c == 'C' && !(_features & GF_DEMO)) {
-				g_logic->fnPlayCredits(NULL);
+				_logic->fnPlayCredits(NULL);
 			}
 #ifdef _SWORD2_DEBUG
 			else if (c == 'S') {
@@ -464,7 +464,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);
+	_logic->runScript(raw_script, raw_data_ad, &null_pc);
 
 	// close the ScreenManager object
 	res_man->closeResource(screen_manager_id);
@@ -552,10 +552,10 @@
 	}
 
 	_gamePaused = false;
-	g_logic->_unpauseZone = 2;
+	_logic->_unpauseZone = 2;
 
 	// if mouse is about or we're in a chooser menu
-	if (!_mouseStatus || g_logic->_choosing)
+	if (!_mouseStatus || _logic->_choosing)
 		setMouse(NORMAL_MOUSE_ID);
 }
 

Index: sword2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- sword2.h	14 Nov 2003 07:41:22 -0000	1.40
+++ sword2.h	15 Nov 2003 09:38:00 -0000	1.41
@@ -30,6 +30,7 @@
 #include "sword2/header.h"
 #include "sword2/icons.h"
 #include "sword2/layers.h"
+#include "sword2/logic.h"
 #include "sword2/memory.h"
 #include "sword2/mouse.h"
 #include "sword2/object.h"
@@ -139,6 +140,7 @@
 	Input *_input;
 	Sound *_sound;
 	Graphics *_graphics;
+	Logic *_logic;
 
 	Debugger *_debugger;
 





More information about the Scummvm-git-logs mailing list