[Scummvm-cvs-logs] SF.net SVN: scummvm: [32504] scummvm/branches/gsoc2008-rtl

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Mon Jun 2 23:08:50 CEST 2008


Revision: 32504
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32504&view=rev
Author:   cpage88
Date:     2008-06-02 14:08:49 -0700 (Mon, 02 Jun 2008)

Log Message:
-----------
PARA: Got rid of calls to system->quit() so that the Parallaction engine can return to the launcher.  Also fixed a couple of memory leaks.

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/engines/parallaction/dialogue.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/exec_ns.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/graphics.h
    scummvm/branches/gsoc2008-rtl/engines/parallaction/input.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_br.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_ns.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.h
    scummvm/branches/gsoc2008-rtl/graphics/iff.cpp

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/dialogue.cpp	2008-06-02 20:46:00 UTC (rev 32503)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/dialogue.cpp	2008-06-02 21:08:49 UTC (rev 32504)
@@ -105,10 +105,8 @@
 
 		if (g_system->getEventManager()->pollEvent(e)) {
 			if (e.type == Common::EVENT_QUIT) {
-				// TODO: don't quit() here, just have caller routines to check
-				// on kEngineQuit and exit gracefully to allow the engine to shut down
 				_engineFlags |= kEngineQuit;
-				g_system->quit();
+				break;
 			}
 
 			if ((e.type == Common::EVENT_KEYDOWN) && isdigit(e.kbd.ascii)) {
@@ -231,11 +229,19 @@
 		answer = 0;
 
 		displayQuestion();
+		
+		if (_engineFlags & kEngineQuit)
+			return;
+
 		if (_q->_answers[0] == NULL) break;
 
 		if (scumm_stricmp(_q->_answers[0]->_text, "NULL")) {
 			if (!displayAnswers()) break;
 			answer = getAnswer();
+
+			if (_engineFlags & kEngineQuit)
+				return;
+
 			cmdlist = &_q->_answers[answer]->_commands;
 		}
 
@@ -266,7 +272,7 @@
 
 	uint32 event;
 	Common::Point p;
-	while (true) {
+	while (_engineFlags & kEngineQuit == 0) {
 
 		_vm->_input->readInput();
 		_vm->_input->getCursorPos(p);

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/exec_ns.cpp	2008-06-02 20:46:00 UTC (rev 32503)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/exec_ns.cpp	2008-06-02 21:08:49 UTC (rev 32504)
@@ -518,6 +518,8 @@
 
 	case kZoneSpeak:
 		runDialogue(z->u.speak);
+		if (_engineFlags & kEngineQuit)
+			return 0;
 		break;
 
 	}

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/graphics.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/graphics.h	2008-06-02 20:46:00 UTC (rev 32503)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/graphics.h	2008-06-02 21:08:49 UTC (rev 32504)
@@ -95,6 +95,7 @@
 	}
 
 	~SurfaceToFrames() {
+		_surf->free();
 		delete _surf;
 	}
 

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/input.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/input.cpp	2008-06-02 20:46:00 UTC (rev 32503)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/input.cpp	2008-06-02 21:08:49 UTC (rev 32504)
@@ -80,11 +80,8 @@
 			break;
 
 		case Common::EVENT_QUIT:
-			// TODO: don't quit() here, just have caller routines to check
-			// on kEngineQuit and exit gracefully to allow the engine to shut down
 			_engineFlags |= kEngineQuit;
-			_vm->_system->quit();
-			break;
+			return KeyDown;
 
 		default:
 			break;

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.cpp	2008-06-02 20:46:00 UTC (rev 32503)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.cpp	2008-06-02 21:08:49 UTC (rev 32504)
@@ -89,16 +89,18 @@
 	delete _globalTable;
 
 	delete _callableNames;
-	delete _localFlagNames;
+	//delete _localFlagNames;
 
 	freeLocation();
 
 	freeCharacter();
 	destroyInventory();
 
+	delete _localFlagNames;
 	delete _gfx;
 	delete _soundMan;
 	delete _disk;
+	delete _input;
 }
 
 
@@ -354,12 +356,20 @@
 		processInput(data);
 	}
 
+	if (_engineFlags & kEngineQuit)
+		return;
+
 	runPendingZones();
 
+	if (_engineFlags & kEngineQuit)
+		return;
+
 	if (_engineFlags & kEngineChangeLocation) {
 		changeLocation(_location._name);
 	}
 
+	if (_engineFlags & kEngineQuit)
+		return;
 
 	_gfx->beginFrame();
 
@@ -522,6 +532,7 @@
 	delete _talk;
 	delete _head;
 	delete _objs;
+	delete _ani->gfxobj;
 
 	_ani->gfxobj = NULL;
 	_talk = NULL;

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_br.cpp	2008-06-02 20:46:00 UTC (rev 32503)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_br.cpp	2008-06-02 21:08:49 UTC (rev 32504)
@@ -107,6 +107,9 @@
 
 		guiStart();
 
+		if (_engineFlags & kEngineQuit)
+			return 0;
+
 //		initCharacter();
 
 		_input->_inputMode = Input::kInputModeGame;

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_ns.cpp	2008-06-02 20:46:00 UTC (rev 32503)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_ns.cpp	2008-06-02 21:08:49 UTC (rev 32504)
@@ -241,9 +241,15 @@
 	_globalTable = _disk->loadTable("global");
 
 	guiStart();
-
+	
+	if (_engineFlags & kEngineQuit)
+		return 0;
+	
 	changeLocation(_location._name);
 
+	if (_engineFlags & kEngineQuit)
+		return 0;
+
 	_input->_inputMode = Input::kInputModeGame;
 	while ((_engineFlags & kEngineQuit) == 0) {
 		runGame();

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.cpp	2008-06-02 20:46:00 UTC (rev 32503)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.cpp	2008-06-02 21:08:49 UTC (rev 32504)
@@ -31,6 +31,8 @@
 char			_tokens[20][MAX_TOKEN_LEN];
 
 Script::Script(Common::ReadStream *input, bool disposeSource) : _input(input), _disposeSource(disposeSource), _line(0) {
+
+//	clearAllTokens();
 }
 
 Script::~Script() {
@@ -73,6 +75,17 @@
 
 }
 
+/*
+void Script::clearAllTokens() {
+
+	for (uint16 i = 0; i < 20; i++)
+		for (uint16 j = 0; j < 50; j++)
+			_tokens[i][j] = '\0';
+	
+	return;
+}
+*/
+
 void Script::skip(const char* endToken) {
 
 	while (scumm_stricmp(_tokens[0], endToken)) {

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.h	2008-06-02 20:46:00 UTC (rev 32503)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.h	2008-06-02 21:08:49 UTC (rev 32504)
@@ -44,6 +44,7 @@
 	uint	_line;				// for debug messages
 
 	void clearTokens();
+	//void clearAllTokens();
 	uint16 fillTokens(char* line);
 
 public:
@@ -239,8 +240,12 @@
 	}
 
 	virtual ~LocationParser_ns() {
+		delete _parser;
+		delete _script;
 		delete _commandsNames;
 		delete _locationStmt;
+		delete _locationZoneStmt;
+		delete _locationAnimStmt;
 		delete _zoneTypeNames;
 		delete _zoneFlagNames;
 	}

Modified: scummvm/branches/gsoc2008-rtl/graphics/iff.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/graphics/iff.cpp	2008-06-02 20:46:00 UTC (rev 32503)
+++ scummvm/branches/gsoc2008-rtl/graphics/iff.cpp	2008-06-02 21:08:49 UTC (rev 32504)
@@ -139,6 +139,7 @@
 
 			out += _bitmapHeader.width;
 		}
+		free(scan);
 		break;
 	}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list