[Scummvm-cvs-logs] SF.net SVN: scummvm: [24484] scummvm/branches/branch-0-9-0/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Oct 24 02:48:43 CEST 2006


Revision: 24484
          http://svn.sourceforge.net/scummvm/?rev=24484&view=rev
Author:   lordhoto
Date:     2006-10-23 17:48:36 -0700 (Mon, 23 Oct 2006)

Log Message:
-----------
Backport of fixes for bugs #1582149 ("KYRA1: Crash when meeting Malcolm") and #1582726 ("KYRA1: Crash when entering Castle screen").

Modified Paths:
--------------
    scummvm/branches/branch-0-9-0/engines/kyra/animator.cpp
    scummvm/branches/branch-0-9-0/engines/kyra/resource.cpp
    scummvm/branches/branch-0-9-0/engines/kyra/screen.cpp

Modified: scummvm/branches/branch-0-9-0/engines/kyra/animator.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/kyra/animator.cpp	2006-10-24 00:46:36 UTC (rev 24483)
+++ scummvm/branches/branch-0-9-0/engines/kyra/animator.cpp	2006-10-24 00:48:36 UTC (rev 24484)
@@ -389,9 +389,8 @@
 
 void ScreenAnimator::copyChangedObjectsForward(int refreshFlag) {
 	debugC(9, kDebugLevelAnimator, "ScreenAnimator::copyChangedObjectsForward(%d)", refreshFlag);
-	AnimObject *curObject = _objectQueue;
 
-	while (curObject) {
+	for (AnimObject *curObject = _objectQueue; curObject; curObject = curObject->nextAnimObject) {
 		if (curObject->active) {
 			if (curObject->refreshFlag || refreshFlag) {
 				int xpos = 0, ypos = 0, width = 0, height = 0;
@@ -402,23 +401,31 @@
 				
 				if (xpos < 1) {
 					xpos = 1;
-				} else if (xpos + width > 39) {
-					width = width - (xpos + width - 39);
+				} else if (xpos > 39) {
+					continue;
 				}
+
+				if (xpos + width > 39) {
+					width = 39 - xpos;
+				}
 				
 				if (ypos < 8) {
 					ypos = 8;
-				} else if (ypos + height > 135) {
-					height = height - (ypos + height - 136);
+				} else if (ypos > 136) {
+					continue;
 				}
+
+				if (ypos + height > 136) {
+					height = 136 - ypos;
+				}
 				
 				_screen->copyRegion(xpos << 3, ypos, xpos << 3, ypos, width << 3, height, 2, 0, Screen::CR_CLIPPED);
 				curObject->refreshFlag = 0;
 				_updateScreen = true;
 			}
 		}
-		curObject = curObject->nextAnimObject;
 	}
+
 	if (_updateScreen) {
 		_screen->updateScreen();
 		_updateScreen = false;

Modified: scummvm/branches/branch-0-9-0/engines/kyra/resource.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/kyra/resource.cpp	2006-10-24 00:46:36 UTC (rev 24483)
+++ scummvm/branches/branch-0-9-0/engines/kyra/resource.cpp	2006-10-24 00:48:36 UTC (rev 24484)
@@ -66,9 +66,9 @@
 	};*/
 
 	static const char *kyra1CDFilelist[] = {
-		"ADL.PAK", "CHAPTER1.VRM", "COL.PAK", "DRAGON1.APK", "DRAGON2.APK", "FINALE.PAK",
-		"INTRO1.PAK", "INTRO2.PAK", "INTRO3.PAK", "INTRO4.PAK", "MISC.PAK",	"SND.PAK",
-		"STARTUP.PAK", "XMI.PAK", 0
+		"ADL.PAK", "CHAPTER1.VRM", "COL.PAK", "FINALE.PAK", "INTRO1.PAK", "INTRO2.PAK",
+		"INTRO3.PAK", "INTRO4.PAK", "MISC.PAK",	"SND.PAK", "STARTUP.PAK", "XMI.PAK",
+		"CAVE.APK", "DRAGON1.APK", "DRAGON2.APK", "LAGOON.APK", 0
 	};
 
 	/*static const char *kyra2CDFilelist[] = {
@@ -174,6 +174,11 @@
 }
 
 void Resource::unloadPakFile(const Common::String &filename) {
+	// never unload these!
+	if (scumm_stricmp(filename.c_str(), "CAVE.APK") == 0 ||
+		scumm_stricmp(filename.c_str(), "LAGOON.APK") == 0)
+		return;
+
 	Common::List<PakFileEntry>::iterator start = _pakfiles.begin();
 	for (;start != _pakfiles.end(); ++start) {
 		if (scumm_stricmp(start->_filename.c_str(), filename.c_str()) == 0) {
@@ -181,7 +186,6 @@
 			break;
 		}
 	}
-	return;
 }
 
 bool Resource::isInPakList(const Common::String &filename) {

Modified: scummvm/branches/branch-0-9-0/engines/kyra/screen.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/kyra/screen.cpp	2006-10-24 00:46:36 UTC (rev 24483)
+++ scummvm/branches/branch-0-9-0/engines/kyra/screen.cpp	2006-10-24 00:48:36 UTC (rev 24484)
@@ -2275,15 +2275,19 @@
 		return;
 	}
 	
-	if (w == 0 || h == 0)
+	if (w == 0 || h == 0 || x >= SCREEN_W || y >= SCREEN_H || x + w < 0 || y + h < 0)
 		return;
 
-	if (x < 0)
+	if (x < 0) {
+		w += x;
 		x = 0;
+	}
 	if (x + w >= 320)
 		w = 320 - x;
-	if (y < 0)
+	if (y < 0) {
+		h += y;
 		y = 0;
+	}
 	if (y + h >= 200)
 		h = 200 - y;
 	


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