aboutsummaryrefslogtreecommitdiff
path: root/scumm/object.cpp
diff options
context:
space:
mode:
authorMax Horn2003-05-15 17:57:52 +0000
committerMax Horn2003-05-15 17:57:52 +0000
commitc1c9510ae8521691f19d5c187d9580e7d9803672 (patch)
tree3fb78738b1a9412b5dbf0c6408a706811e4dfd01 /scumm/object.cpp
parent6fa0114eee817b0ac9ad5f3c7388830b63fb0643 (diff)
downloadscummvm-rg350-c1c9510ae8521691f19d5c187d9580e7d9803672.tar.gz
scummvm-rg350-c1c9510ae8521691f19d5c187d9580e7d9803672.tar.bz2
scummvm-rg350-c1c9510ae8521691f19d5c187d9580e7d9803672.zip
fixed the evil, evil COMI crash on Mac OS X (and memory corrupter elsewhere, maybe?). The last part of this change is the crucial one, computing the correct value for right_strip
svn-id: r7527
Diffstat (limited to 'scumm/object.cpp')
-rw-r--r--scumm/object.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index b9bb01ab0b..1034427b48 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -1328,27 +1328,29 @@ void Scumm::nukeFlObjects(int min, int max) {
}
void Scumm::enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth,
- int objectHeight, int scaleX, int scaleY, int image, int mode) {
+ int objectHeight, int scaleX, int scaleY, int image, int mode) {
BlastObject *eo;
ObjectData *od;
- if (_blastObjectQueuePos == sizeof(_blastObjectQueue) / sizeof(_blastObjectQueue[0])) {
+ if (_blastObjectQueuePos >= (int)ARRAYSIZE(_blastObjectQueue)) {
warning("enqueueObject: overflow");
return;
}
+
+ int idx = getObjectIndex(objectNumber);
eo = &_blastObjectQueue[_blastObjectQueuePos++];
eo->number = objectNumber;
eo->posX = objectX + (camera._cur.x & 7);
eo->posY = objectY + (camera._cur.y - (_screenHeight / 2));
if (objectWidth == 0) {
- od = &_objs[getObjectIndex(objectNumber)];
+ od = &_objs[idx];
eo->width = od->width;
} else {
eo->width = objectWidth;
}
if (objectHeight == 0) {
- od = &_objs[getObjectIndex(objectNumber)];
+ od = &_objs[idx];
eo->height = od->height;
} else {
eo->height = objectHeight;
@@ -1662,7 +1664,7 @@ void Scumm::removeBlastObject(BlastObject *eo) {
right = vs->width;
left_strip = left >> 3;
- right_strip = (right >> 3) + 1;
+ right_strip = (right - 1) >> 3;
if (left_strip < 0)
left_strip = 0;