[Scummvm-cvs-logs] SF.net SVN: scummvm: [26813] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat May 12 21:33:00 CEST 2007


Revision: 26813
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26813&view=rev
Author:   peres001
Date:     2007-05-12 12:33:00 -0700 (Sat, 12 May 2007)

Log Message:
-----------
Fixed crashes when changing location in the introduction and removed useless code from the original engine.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/location.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-05-12 19:29:20 UTC (rev 26812)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-05-12 19:33:00 UTC (rev 26813)
@@ -315,7 +315,7 @@
 		  is commented out, and would definitely crash the current implementation.
 */
 void Parallaction::changeLocation(char *location) {
-	debugC(1, kDebugLocation, "changeLocation to '%s'", location);
+	debugC(1, kDebugLocation, "changeLocation(%s)", location);
 
 	_soundMan->playLocationMusic(location);
 
@@ -333,15 +333,11 @@
 	_hoverZone = NULL;
 	if (_engineFlags & kEngineMouse) {
 		changeCursor( kCursorArrow );
-		debugC(2, kDebugLocation, "changeLocation: changed cursor");
 	}
 
 	_animations.remove(&_char._ani);
-	debugC(2, kDebugLocation, "changeLocation: removed character from the animation list");
 
 	freeLocation();
-	debugC(1, kDebugLocation, "changeLocation: old location free'd");
-
 	char buf[100];
 	strcpy(buf, location);
 
@@ -370,14 +366,10 @@
 	}
 
 	_animations.push_front(&_char._ani);
-	debugC(2, kDebugLocation, "changeLocation: new character added to the animation list");
 
 	strcpy(_saveData1, list[0].c_str());
 	parseLocation(list[0].c_str());
 
-	_gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2);
-	debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", _saveData1);
-
 	_char._ani._oldPos.x = -1000;
 	_char._ani._oldPos.y = -1000;
 
@@ -388,40 +380,28 @@
 		_char._ani._frame = _location._startFrame;
 		_location._startPosition.y = -1000;
 		_location._startPosition.x = -1000;
-
-		debugC(2, kDebugLocation, "changeLocation: initial position set to x: %i, y: %i, f: %i", _location._startPosition.x, _location._startPosition.y, _location._startFrame);
 	}
 
 	byte palette[PALETTE_SIZE];
 	for (uint16 _si = 0; _si < PALETTE_SIZE; _si++) palette[_si] = 0;
 	_gfx->setPalette(palette);
-	_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
 
+	_gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2);
+
 	if (_location._commands.size() > 0) {
 		runCommands(_location._commands);
-		runJobs();
-		_gfx->swapBuffers();
-		runJobs();
-		_gfx->swapBuffers();
 	}
 
-	if (_location._comment) {
-		doLocationEnterTransition();
-		debugC(2, kDebugLocation, "changeLocation: shown location comment");
-	}
+	_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
 
-	runJobs();
-	_gfx->swapBuffers();
-
 	_gfx->setPalette(_gfx->_palette);
 	if (_location._aCommands.size() > 0) {
 		runCommands(_location._aCommands);
-		debugC(1, kDebugLocation, "changeLocation: location acommands run");
 	}
 
 //	_soundMan->playSfx(0);
 
-	debugC(1, kDebugLocation, "changeLocation completed");
+	debugC(1, kDebugLocation, "changeLocation() done");
 
 	return;
 
@@ -462,7 +442,6 @@
 	r.grow(-1);
 	_gfx->floodFill(Gfx::kBitFront, r, 1);
 	_gfx->displayWrappedString(_location._comment, 3, 5, 130, 0);
-
 	// FIXME: ???
 #if 0
 	do {

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-05-12 19:29:20 UTC (rev 26812)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-05-12 19:33:00 UTC (rev 26813)
@@ -362,8 +362,6 @@
 	if (_location._commands.size() > 0)
 		runCommands(_location._commands);
 
-	runJobs();
-
 	_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront);
 
 	if (_location._comment)
@@ -707,6 +705,7 @@
 
 
 void Parallaction::freeCharacter() {
+	debugC(3, kDebugLocation, "freeCharacter()");
 
 	if (!IS_DUMMY_CHARACTER(_vm->_characterName)) {
 		if (_objectsNames)
@@ -715,22 +714,27 @@
 
 		if (_vm->_char._ani._cnv)
 			delete _vm->_char._ani._cnv;
+		_vm->_char._ani._cnv = NULL;
 
 		if (_vm->_char._talk)
 			delete _vm->_char._talk;
+		_vm->_char._talk = NULL;
 
 		_vm->_gfx->freeStaticCnv(_vm->_char._head);
 		if (_vm->_char._head)
 			delete _vm->_char._head;
+		_vm->_char._head = NULL;
 
 		if (_vm->_char._objs)
 			delete _vm->_char._objs;
+		_vm->_char._objs = NULL;
 	}
 
 	return;
 }
 
 void Parallaction::changeCharacter(const char *name) {
+	debugC(1, kDebugLocation, "changeCharacter(%s)", name);
 
 	char baseName[20];
 	if (IS_MINI_CHARACTER(name)) {
@@ -751,6 +755,7 @@
 		freeCharacter();
 
 		_disk->selectArchive((_vm->getPlatform() == Common::kPlatformPC) ? "disk1" : "disk0");
+		_vm->_char._ani._cnv = _disk->loadFrames(fullName);
 
 		if (!IS_DUMMY_CHARACTER(name)) {
 			_vm->_char._head = _disk->loadHead(baseName);
@@ -759,17 +764,17 @@
 			_objectsNames = _disk->loadTable(baseName);
 			refreshInventory(baseName);
 
-			_vm->_char._ani._cnv = _disk->loadFrames(fullName);
+			_soundMan->playCharacterMusic(name);
 
-			_soundMan->playCharacterMusic(name);
+			if ((getFeatures() & GF_DEMO) == 0)
+				parseLocation("common");
 		}
 	}
 
-	if (!(getFeatures() & GF_DEMO))
-		parseLocation("common");
-
 	strcpy(_characterName1, fullName);
 
+	debugC(1, kDebugLocation, "changeCharacter() done");
+
 	return;
 }
 


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