aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Menshakov2011-06-13 22:42:12 +0400
committerAlyssa Milburn2011-06-15 17:34:55 +0200
commit78b1a6061147b4f47d5ac61d1b50a83784e58ea7 (patch)
tree23aabad7725b140bb92dc3875e0b10c53ecba565
parent8c9d00966fa061f44db6ceb3b14bed931157f46c (diff)
downloadscummvm-rg350-78b1a6061147b4f47d5ac61d1b50a83784e58ea7.tar.gz
scummvm-rg350-78b1a6061147b4f47d5ac61d1b50a83784e58ea7.tar.bz2
scummvm-rg350-78b1a6061147b4f47d5ac61d1b50a83784e58ea7.zip
DREAMWEB: patch sprite table after deallocating segment with sprites.
-rw-r--r--engines/dreamweb/dreamweb.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 01bedbf077..eea3b725db 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -681,9 +681,25 @@ void allocatemem(Context &context) {
}
void deallocatemem(Context &context) {
- debug(1, "deallocating segment %04x", (uint16)context.es);
- context.deallocateSegment(context.es);
+ uint16 id = (uint16)context.es;
+ debug(1, "deallocating segment %04x", id);
+ context.deallocateSegment(id);
+
+ //fixing invalid entries in the sprite table
context.es = context.data;
+ uint tsize = 16 * 32;
+ uint16 bseg = context.data.word(kBuffers);
+ if (!bseg)
+ return;
+ SegmentRef buffers(&context);
+ buffers = bseg;
+ uint8 *ptr = buffers.ptr(kSpritetable, tsize);
+ for(uint i = 0; i < tsize; i += 32) {
+ uint16 seg = READ_LE_UINT16(ptr + i + 6);
+ //debug(1, "sprite segment = %04x", seg);
+ if (seg == id)
+ memset(ptr + i, 0xff, 32);
+ }
}
void removeemm(Context &context) {