From 4c7a6ac2d56e9fa136663028d6be45c01d53d321 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Tue, 3 Aug 2010 13:17:30 +0000 Subject: SCI: adding workaround for pq3 inside kMemory fixing plot crimes warnings and bad text on screen svn-id: r51693 --- engines/sci/engine/kmisc.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 5ef4157119..47d86f920a 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -227,12 +227,22 @@ enum { 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 : -- cgit v1.2.3