[Scummvm-cvs-logs] SF.net SVN: scummvm:[51693] scummvm/trunk/engines/sci/engine/kmisc.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Tue Aug 3 15:17:30 CEST 2010


Revision: 51693
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51693&view=rev
Author:   m_kiewitz
Date:     2010-08-03 13:17:30 +0000 (Tue, 03 Aug 2010)

Log Message:
-----------
SCI: adding workaround for pq3 inside kMemory

fixing plot crimes warnings and bad text on screen

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kmisc.cpp

Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-08-03 13:15:34 UTC (rev 51692)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-08-03 13:17:30 UTC (rev 51693)
@@ -227,12 +227,22 @@
 
 reg_t kMemory(EngineState *s, int argc, reg_t *argv) {
 	switch (argv[0].toUint16()) {
-	case K_MEMORY_ALLOCATE_CRITICAL :
-		if (!s->_segMan->allocDynmem(argv[1].toUint16(), "kMemory() critical", &s->r_acc)) {
+	case K_MEMORY_ALLOCATE_CRITICAL: {
+		int byteCount = argv[1].toUint16();
+		// WORKAROUND: pq3 when plotting crimes - allocates the returned bytes
+		//  from kStrLen on "W" and "E" and wants to put a string in there,
+		//  which doesn't fit of course. That's why we allocate one byte more
+		//  all the time inside that room - maybe only multilingual pq3
+		if (g_sci->getGameId() == GID_PQ3) {
+			if (s->currentRoomNumber() == 202)
+				byteCount++;
+		}
+		if (!s->_segMan->allocDynmem(byteCount, "kMemory() critical", &s->r_acc)) {
 			error("Critical heap allocation failed");
 		}
 		break;
-	case K_MEMORY_ALLOCATE_NONCRITICAL :
+	}
+	case K_MEMORY_ALLOCATE_NONCRITICAL:
 		s->_segMan->allocDynmem(argv[1].toUint16(), "kMemory() non-critical", &s->r_acc);
 		break;
 	case K_MEMORY_FREE :


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