[Scummvm-cvs-logs] CVS: scummvm/sword1 control.cpp,1.38,1.39 control.h,1.16,1.17 logic.cpp,1.39,1.40 memman.cpp,1.6,1.7 menu.cpp,1.21,1.22 menu.h,1.9,1.10 mouse.cpp,1.25,1.26 mouse.h,1.14,1.15 resman.cpp,1.22,1.23 router.h,1.7,1.8 screen.cpp,1.45,1.46 screen.h,1.17,1.18 sound.cpp,1.33,1.34 sword1.cpp,1.56,1.57 sword1.h,1.15,1.16 text.cpp,1.9,1.10 text.h,1.4,1.5

Robert Göffringmann lavosspawn at users.sourceforge.net
Mon Nov 8 20:07:04 CET 2004


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25194/sword1

Modified Files:
	control.cpp control.h logic.cpp memman.cpp menu.cpp menu.h 
	mouse.cpp mouse.h resman.cpp router.h screen.cpp screen.h 
	sound.cpp sword1.cpp sword1.h text.cpp text.h 
Log Message:
free memory on quit.
Still leaks some, though

Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- control.cpp	21 Oct 2004 08:47:13 -0000	1.38
+++ control.cpp	9 Nov 2004 04:06:09 -0000	1.39
@@ -216,7 +216,7 @@
 				notAccepted = false;
 			}
 		}
-	} while (notAccepted);
+	} while (notAccepted && (!SwordEngine::_systemVars.engineQuit));
 
 	_resMan->resClose(fontId);
 	free(_screenBuf);
@@ -303,7 +303,7 @@
 		_system->updateScreen();
 		delay(1000 / 12);
 		newMode = getClicks(mode, &retVal);
-	} while ((newMode != 1) && (retVal == 0));
+	} while ((newMode != 1) && (retVal == 0) && (!SwordEngine::_systemVars.engineQuit));
 	destroyButtons();
 	_resMan->resClose(fontId);
 	_resMan->resClose(redFontId);
@@ -366,7 +366,7 @@
 	switch(mode) {
 		case BUTTON_MAIN_PANEL:
 			if (id == BUTTON_RESTART) {
-				if (SwordEngine::_systemVars.deathScreenFlag) // if player is dead or has just started, don't ask for confirmation
+				if (SwordEngine::_systemVars.controlPanelMode) // if player is dead or has just started, don't ask for confirmation
 					*retVal |= CONTROL_RESTART_GAME;
 				else if (getConfirm(_lStrings[STR_RESTART]))
 					*retVal |= CONTROL_RESTART_GAME;
@@ -380,9 +380,8 @@
 				_buttons[5]->setSelected(SwordEngine::_systemVars.showText);
 			} else if (id == BUTTON_QUIT) {
 				if (getConfirm(_lStrings[STR_QUIT]))
-					_system->quit();
-				else
-					return mode;
+					SwordEngine::_systemVars.engineQuit = true;
+				return mode;
 			}
 			break;
 		case BUTTON_SAVE_PANEL:
@@ -421,7 +420,7 @@
 void Control::setupMainPanel(void) {
 	uint32 panelId;
 	
-	if (SwordEngine::_systemVars.deathScreenFlag == 1)
+	if (SwordEngine::_systemVars.controlPanelMode == CP_DEATHSCREEN)
 		panelId = SR_DEATHPANEL;
 	else {
 		if (SwordEngine::_systemVars.language <= BS1_SPANISH)
@@ -434,17 +433,17 @@
 	panel->draw();
 	delete panel;
 
-	if (SwordEngine::_systemVars.deathScreenFlag)
+	if (SwordEngine::_systemVars.controlPanelMode != CP_NORMAL)
 		createButtons(_deathButtons, 3);		
 	else {
 		createButtons(_panelButtons, 7);
 		_buttons[5]->setSelected(SwordEngine::_systemVars.showText);
 	}
 
-	if (SwordEngine::_systemVars.deathScreenFlag == 2) // end of game
+	if (SwordEngine::_systemVars.controlPanelMode == CP_THEEND) // end of game
 		renderText(_lStrings[STR_THE_END], 480, 188 + 40, TEXT_RIGHT_ALIGN);
 
-	if (SwordEngine::_systemVars.deathScreenFlag == 0) { // normal panel
+	if (SwordEngine::_systemVars.controlPanelMode == CP_NORMAL) { // normal panel
 		renderText(_lStrings[STR_SAVE], 180, 188 + 40, TEXT_LEFT_ALIGN);
 		renderText(_lStrings[STR_DONE], 460, 332 + 40, TEXT_RIGHT_ALIGN);
 		renderText(_lStrings[STR_RESTORE], 180, 224 + 40, TEXT_LEFT_ALIGN);
@@ -455,7 +454,7 @@
 		renderText(_lStrings[STR_TEXT], 460, 224 + 40, TEXT_RIGHT_ALIGN);
 	} else {
 		renderText(_lStrings[STR_RESTORE], 285, 224 + 40, TEXT_LEFT_ALIGN);
-		if (SwordEngine::_systemVars.deathScreenFlag == 3) // just started game
+		if (SwordEngine::_systemVars.controlPanelMode == CP_NEWGAME) // just started game
 			renderText(_lStrings[STR_START], 285, 260 + 40, TEXT_LEFT_ALIGN);
 		else
 			renderText(_lStrings[STR_RESTART], 285, 260 + 40, TEXT_LEFT_ALIGN);
@@ -1031,7 +1030,7 @@
 				_mouseState |= BS1_WHEEL_DOWN;
 				break;
 			case OSystem::EVENT_QUIT:
-				_system->quit();
+				SwordEngine::_systemVars.engineQuit = true;
 				break;
 			default:
 				break;

Index: control.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- control.h	21 Oct 2004 12:43:48 -0000	1.16
+++ control.h	9 Nov 2004 04:06:09 -0000	1.17
@@ -69,7 +69,6 @@
 class Control {
 public:
 	Control(SaveFileManager *saveFileMan, ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic, const char *savePath);
-	~Control(void);
 	uint8 runPanel(void);
 	void doRestore(void);
 	void askForCd(void);

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/logic.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- logic.cpp	21 Oct 2004 12:43:48 -0000	1.39
+++ logic.cpp	9 Nov 2004 04:06:09 -0000	1.40
@@ -61,6 +61,12 @@
 	_mixer = mixer;
 }
 
+Logic::~Logic(void) {
+	delete _textMan;
+	delete _router;
+	delete _eventMan;
+}
+
 void Logic::initialize(void) {
 	memset(_scriptVars, 0, NUM_SCRIPT_VARS * sizeof(uint32));
 	for (uint8 cnt = 0; cnt < NON_ZERO_SCRIPT_VARS; cnt++)
@@ -1616,9 +1622,9 @@
 int Logic::fnDeathScreen(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
 
 	if (_scriptVars[FINALE_OPTION_FLAG] == 4) // successful end of game!
-		SwordEngine::_systemVars.deathScreenFlag = 2;
+		SwordEngine::_systemVars.controlPanelMode = CP_THEEND;
 	else
-		SwordEngine::_systemVars.deathScreenFlag = 1;
+		SwordEngine::_systemVars.controlPanelMode = CP_DEATHSCREEN;
 
 	cpt->o_logic = LOGIC_quit;
 	return SCRIPT_STOP;

Index: memman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/memman.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- memman.cpp	21 Oct 2004 12:43:48 -0000	1.6
+++ memman.cpp	9 Nov 2004 04:06:09 -0000	1.7
@@ -31,6 +31,9 @@
 }
 
 MemMan::~MemMan(void) {
+	flush();
+	if (_alloced)
+		warning("deleting MemMan, still %d bytes alloced\n", _alloced);
 }
 
 void MemMan::alloc(MemHandle *bsMem, uint32 pSize, uint16 pCond) {

Index: menu.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/menu.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- menu.cpp	21 Oct 2004 12:43:48 -0000	1.21
+++ menu.cpp	9 Nov 2004 04:06:09 -0000	1.22
@@ -103,6 +103,18 @@
 	_inMenu = 0;
 }
 
+Menu::~Menu(void) {
+	// the menu may be open, so delete the icons
+	for (int i = 0; i < TOTAL_pockets; i++) {
+		delete _objects[i];
+		_objects[i] = NULL;
+	}
+	for (int i = 0; i < TOTAL_subjects; i++) {
+		delete _subjects[i];
+		_subjects[i] = NULL;
+	}
+}
+
 void Menu::refreshMenus() {
 	if (_objectBarStatus == MENU_OPEN) {
 		buildMenu();

Index: menu.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/menu.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- menu.h	21 Oct 2004 12:43:48 -0000	1.9
+++ menu.h	9 Nov 2004 04:06:09 -0000	1.10
@@ -64,6 +64,7 @@
 class Menu {
 public:
 	Menu(Screen *pScreen, Mouse *pMouse);
+	~Menu(void);
 	void fnChooser(Object *compact);
 	void fnEndChooser(void);
 	void fnAddSubject(int32 sub);

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/mouse.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- mouse.cpp	21 Oct 2004 12:43:48 -0000	1.25
+++ mouse.cpp	9 Nov 2004 04:06:09 -0000	1.26
@@ -40,6 +40,14 @@
 	_currentPtr = NULL;
 }
 
+Mouse::~Mouse(void) {
+	setLuggage(0, 0);
+	setPointer(0, 0);
+
+	for (uint8 cnt = 0; cnt < 17; cnt++)	 // force res manager to keep mouse 
+		_resMan->resClose(MSE_POINTER + cnt); // cursors in memory all the time
+}
+
 void Mouse::initialize(void) {
 	_numObjs = 0;
 	Logic::_scriptVars[MOUSE_STATUS] = 0; // mouse off and unlocked

Index: mouse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/mouse.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- mouse.h	21 Oct 2004 12:43:48 -0000	1.14
+++ mouse.h	9 Nov 2004 04:06:09 -0000	1.15
@@ -72,6 +72,7 @@
 class Mouse {
 public:
 	Mouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan);
+	~Mouse(void);
 	void initialize(void);
 	void addToList(int id, Object *compact);
 	void useLogicAndMenu(Logic *pLogic, Menu *pMenu);

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- resman.cpp	21 Oct 2004 13:23:52 -0000	1.22
+++ resman.cpp	9 Nov 2004 04:06:09 -0000	1.23
@@ -52,6 +52,25 @@
 }
 
 ResMan::~ResMan(void) {
+#if 0
+	for (uint32 clusCnt = 0; clusCnt < _prj.noClu; clusCnt++) {
+		Clu *cluster = _prj.clu[clusCnt];
+		if (cluster) {
+			for (uint32 grpCnt = 0; grpCnt < cluster->noGrp; grpCnt++) {
+				Grp *group = cluster->grp[grpCnt];
+				if (group) {
+					for (uint32 resCnt = 0; resCnt < group->noRes; resCnt++) {
+						if (group->resHandle[resCnt].cond == MEM_DONT_FREE) {
+							warning("ResMan::~ResMan: Resource %02X.%04X.%02X is still open",
+								clusCnt + 1, grpCnt, resCnt);
+						}
+					}
+				}
+			}
+		}
+	}
+	debug(0, "ResMan closed\n");
+#endif
 	freeCluDescript();
 }
 

Index: router.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/router.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- router.h	21 Oct 2004 12:43:48 -0000	1.7
+++ router.h	9 Nov 2004 04:06:09 -0000	1.8
@@ -96,7 +96,6 @@
 class Router {
 public:
 	Router(ObjectMan *pObjMan, ResMan *pResMan);
-	~Router(void);
 	int32 routeFinder(int32 id, Object *mega, int32 x, int32 y, int32 dir);
 	void setPlayerTarget(int32 x, int32 y, int32 dir, int32 stance);
 	void resetExtraData(void);

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- screen.cpp	21 Oct 2004 12:37:13 -0000	1.45
+++ screen.cpp	9 Nov 2004 04:06:09 -0000	1.46
@@ -47,6 +47,16 @@
 	_screenBuf = _screenGrid = NULL;
 	_backLength = _foreLength = _sortLength = 0;
 	_fadingStep = 0;
+	_currentScreen = 0xFFFF;
+}
+
+Screen::~Screen(void) {
+	if (_screenBuf)
+		free(_screenBuf);
+	if (_screenGrid)
+		free(_screenGrid);
+	if (_currentScreen != 0xFFFF)
+		quitScreen();
 }
 
 void Screen::useTextManager(Text *pTextMan) {
@@ -309,6 +319,7 @@
 		_resMan->resClose(_roomDefTable[_currentScreen].parallax[0]);
 	if (_roomDefTable[_currentScreen].parallax[1])
 		_resMan->resClose(_roomDefTable[_currentScreen].parallax[1]);
+	_currentScreen = 0xFFFF;
 }
 
 void Screen::draw(void) {

Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- screen.h	21 Oct 2004 12:43:48 -0000	1.17
+++ screen.h	9 Nov 2004 04:06:10 -0000	1.18
@@ -67,8 +67,8 @@
 class Screen {
 public:
 	Screen(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan);
-	void useTextManager(Text *pTextMan);
 	~Screen(void);
+	void useTextManager(Text *pTextMan);
 	void draw(void);
 
 	void quitScreen(void);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sound.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- sound.cpp	30 Oct 2004 10:35:39 -0000	1.33
+++ sound.cpp	9 Nov 2004 04:06:10 -0000	1.34
@@ -41,6 +41,16 @@
 	_speechVolL = _speechVolR = _sfxVolL = _sfxVolR = 192;
 }
 
+Sound::~Sound(void) {
+	// clean up fx queue
+	_mixer->stopAll();
+	for (uint8 cnt = 0; cnt < _endOfQueue; cnt++)
+		if (_fxQueue[cnt].delay == 0)
+			_resMan->resClose(_fxList[_fxQueue[cnt].id].sampleId);
+	_endOfQueue = 0;
+	closeCowSystem();
+}
+
 int Sound::addToQueue(int32 fxNo) {
 	bool alreadyInQueue = false;
 	for (uint8 cnt = 0; (cnt < _endOfQueue) && (!alreadyInQueue); cnt++)

Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- sword1.cpp	21 Oct 2004 12:43:48 -0000	1.56
+++ sword1.cpp	9 Nov 2004 04:06:10 -0000	1.57
@@ -113,6 +113,17 @@
 }
 
 SwordEngine::~SwordEngine() {
+	delete _control;
+	delete _logic;
+	delete _menu;
+	delete _sound;
+	delete _music;
+	delete _screen;
+	delete _mouse;
+	delete _objectMan;
+	_resMan->flush(); // free all memory
+	delete _resMan;
+	delete _memMan;
 }
 
 void SwordEngine::initialize(void) {
@@ -155,10 +166,10 @@
 
 	_systemVars.justRestoredGame = 0;
 	_systemVars.currentCD = 0;
-	_systemVars.gamePaused = 0;
-	_systemVars.deathScreenFlag = 3;
+	_systemVars.controlPanelMode = CP_NEWGAME;
 	_systemVars.forceRestart = false;
 	_systemVars.wantFade = true;
+	_systemVars.engineQuit = false;
 
 	switch (Common::parseLanguage(ConfMan.get("language"))) {
 	case Common::DE_DEU:
@@ -1065,7 +1076,7 @@
 
 	compact = (Object*)_objectMan->fetchObject(PLAYER);
 	_logic->fnEnterSection(compact, PLAYER, startNumber, 0, 0, 0, 0, 0);	// (automatically opens the compact resource for that section)
-	_systemVars.deathScreenFlag = 0;
+	_systemVars.controlPanelMode = CP_NORMAL;
 	_systemVars.wantFade = true;
 }
 
@@ -1079,7 +1090,7 @@
 #endif
 		"SPEECH%d.CLU"
 	};
-	int numFiles = 0;
+	bool fileFound[2] = { false, false };
 	File test;
 
 	_systemVars.playSpeech = true;
@@ -1090,13 +1101,13 @@
 			sprintf(fileName, speechFiles[j], i);
 			if (test.open(fileName)) {
 				test.close();
-				numFiles++;
+				fileFound[i - 1] = true;
 				break;
 			}
 		}
 	}
 
-	if (numFiles == 2) {
+	if (fileFound[0] && fileFound[1]) {
 		// both files exist, assume running from HDD and everything's fine.
 		_systemVars.runningFromCd = false;
 		_systemVars.playSpeech = true;
@@ -1128,28 +1139,30 @@
 		startPositions(startPos);
 	else {
 		if (_control->savegamesExist()) {
-			_systemVars.deathScreenFlag = 3;
+			_systemVars.controlPanelMode = CP_NEWGAME;
 			if (_control->runPanel() == CONTROL_GAME_RESTORED)
 				_control->doRestore();
-			else
+			else if (!_systemVars.engineQuit)
 				startPositions(0);
 		} else // no savegames, start new game.
 			startPositions(0);
 	}
-	_systemVars.deathScreenFlag = 0;
+	_systemVars.controlPanelMode = CP_NORMAL;
 
-	do {
+	while (!_systemVars.engineQuit) {
 		uint8 action = mainLoop();
 
-		// the mainloop was left, we have to reinitialize.
-		reinitialize();
-		if (action == CONTROL_GAME_RESTORED)
-			_control->doRestore();
-		else if (action == CONTROL_RESTART_GAME)
-			startPositions(1);
-		_systemVars.forceRestart = false;
-		_systemVars.deathScreenFlag = 0;
-	} while (true);
+		if (!_systemVars.engineQuit) {
+			// the mainloop was left, we have to reinitialize.
+			reinitialize();
+			if (action == CONTROL_GAME_RESTORED)
+				_control->doRestore();
+			else if (action == CONTROL_RESTART_GAME)
+				startPositions(1);
+			_systemVars.forceRestart = false;
+			_systemVars.controlPanelMode = CP_NORMAL;
+		}
+	}
 }
 
 void SwordEngine::checkCd(void) {
@@ -1178,7 +1191,7 @@
 	uint8 retCode = 0;
 	_keyPressed = 0;
 
-	while (retCode == 0) {
+	while ((retCode == 0) && (!_systemVars.engineQuit)) {
 		// do we need the section45-hack from sword.c here?
 		checkCd();
 
@@ -1221,28 +1234,29 @@
 				delay(0);
 
 			_mouse->engine( _mouseX, _mouseY, _mouseState);
-			_mouseState = 0;
 
 			if (_systemVars.forceRestart)
 				retCode = CONTROL_RESTART_GAME;
 
 			// The control panel is triggered by F5 or ESC.
 			// FIXME: This is a very strange way of detecting F5...
-			else if (((_keyPressed == 63 || _keyPressed == 27) && (Logic::_scriptVars[MOUSE_STATUS] & 1)) || (_systemVars.deathScreenFlag)) {
+			else if (((_keyPressed == 63 || _keyPressed == 27) && (Logic::_scriptVars[MOUSE_STATUS] & 1)) || (_systemVars.controlPanelMode)) {
 				retCode = _control->runPanel();
 				if (!retCode)
 					_screen->fullRefresh();
 			}
-			_keyPressed = 0;
-
-			// do something smart here to implement pausing the game. If we even want that, that is.
-		} while ((Logic::_scriptVars[SCREEN] == Logic::_scriptVars[NEW_SCREEN]) && (retCode == 0));
+			_mouseState = _keyPressed = 0;
+		} while ((Logic::_scriptVars[SCREEN] == Logic::_scriptVars[NEW_SCREEN]) && (retCode == 0) && (!_systemVars.engineQuit));
 
-		if ((retCode == 0) && (Logic::_scriptVars[SCREEN] != 53) && _systemVars.wantFade) {
+		if ((retCode == 0) && (Logic::_scriptVars[SCREEN] != 53) && _systemVars.wantFade && (!_systemVars.engineQuit)) {
 			_screen->fadeDownPalette();
 			while (_screen->stillFading()) {
+				int32 relDelay = (int32)_system->getMillis() + (1000 / FRAME_RATE);
 				_screen->updateScreen();
-				delay(1000/12);
+				relDelay -= (int32)_system->getMillis();
+				relDelay = (relDelay > 0) ? relDelay : 0; 
+
+				delay(relDelay);
 			}
 		}
 
@@ -1258,7 +1272,6 @@
 	OSystem::Event event;
 
 	uint32 start = _system->getMillis();
-	uint32 cur = start;
 
 	do {
 		while (_system->pollEvent(event)) {
@@ -1296,27 +1309,18 @@
 				_mouseState |= BS1R_BUTTON_UP;
 				break;
 			case OSystem::EVENT_QUIT:
-				_system->quit();
+				//_system->quit();
+				_systemVars.engineQuit = true;
 				break;
 			default:
 				break;
 			}
 		}
 
-		if (amount == 0)
-			break;
+		if (amount > 0)
+			_system->delayMillis(10);
 
-		{
-			uint this_delay = 20; // 1?
-#ifdef _WIN32_WCE
-			this_delay = 10;
-#endif
-			if (this_delay > amount)
-				this_delay = amount;
-			_system->delayMillis(this_delay);
-		}
-		cur = _system->getMillis();
-	} while (cur < start + amount);
+	} while (_system->getMillis() < start + amount);
 }
 
 } // End of namespace Sword1

Index: sword1.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- sword1.h	21 Oct 2004 12:43:49 -0000	1.15
+++ sword1.h	9 Nov 2004 04:06:10 -0000	1.16
@@ -33,6 +33,13 @@
 	GF_DEMO = 1 << 0
 };
 
+enum ControlPanelMode {
+	CP_NORMAL = 0,
+	CP_DEATHSCREEN,
+	CP_THEEND,
+	CP_NEWGAME
+};
+
 class Screen;
 class Sound;
 class Logic;
@@ -48,9 +55,9 @@
 	bool	runningFromCd;
 	uint32	currentCD;			// starts at zero, then either 1 or 2 depending on section being played
 	uint32	justRestoredGame;	// see main() in sword.c & New_screen() in gtm_core.c
-	uint32	gamePaused;			// 1 when paused
+	bool	engineQuit;
 
-	uint8	deathScreenFlag;	// 1 death screen version of the control panel, 2 = successful end of game, 3 = force restart
+	uint8	controlPanelMode;	// 1 death screen version of the control panel, 2 = successful end of game, 3 = force restart
 	bool	forceRestart;
 	bool	wantFade;			// when true => fade during scene change, else cut.
 	uint8	playSpeech;

Index: text.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/text.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- text.cpp	21 Oct 2004 12:43:49 -0000	1.9
+++ text.cpp	9 Nov 2004 04:06:10 -0000	1.10
@@ -41,10 +41,9 @@
 	_objMan = pObjMan;
 	_resMan = pResMan;
 	_textCount = 0;
-	if (czechVersion)
-		_font = (uint8*)_resMan->openFetchRes(CZECH_GAME_FONT);
-	else
-		_font = (uint8*)_resMan->openFetchRes(GAME_FONT);
+	_fontId = (czechVersion) ? CZECH_GAME_FONT : GAME_FONT;
+	_font = (uint8*)_resMan->openFetchRes(_fontId);
+
 	_joinWidth = charWidth( SPACE ) - 2 * OVERLAP;
 	_charHeight = FROM_LE_16(_resMan->fetchFrame(_font, 0)->height); // all chars have the same height
 	_textBlocks[0] = _textBlocks[1] = NULL;
@@ -55,6 +54,7 @@
 		free(_textBlocks[0]);
 	if (_textBlocks[1])
 		free(_textBlocks[1]);
+	//_resMan->resClose(_fontId); => wiped automatically by _resMan->flush();
 }
 
 uint32 Text::lowTextManager(uint8 *ascii, int32 width, uint8 pen) {

Index: text.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/text.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- text.h	21 Oct 2004 12:43:49 -0000	1.4
+++ text.h	9 Nov 2004 04:06:10 -0000	1.5
@@ -56,6 +56,7 @@
 	ObjectMan *_objMan;
 	ResMan *_resMan;
 	FrameHeader *_textBlocks[MAX_TEXT_OBS];
+	uint32 _fontId;
 };
 
 } // End of namespace Sword1 





More information about the Scummvm-git-logs mailing list