aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKari Salminen2008-08-04 19:32:52 +0000
committerKari Salminen2008-08-04 19:32:52 +0000
commit99addb709cb4982725c685447774021ad2917e59 (patch)
treeebc94272f040f425ebeb56041db99a1b424541b1
parent476e5bbb10743a8d15271363a6ccb2be1bc780e0 (diff)
downloadscummvm-rg350-99addb709cb4982725c685447774021ad2917e59.tar.gz
scummvm-rg350-99addb709cb4982725c685447774021ad2917e59.tar.bz2
scummvm-rg350-99addb709cb4982725c685447774021ad2917e59.zip
Fix for misplaced objects in mouse object selection (Operation Stealth specific).
- Implemented Operation Stealth specific part of getObjectUnderCursor which handles negative frame values. - Fixed a test case (Should test for ydif <= 0 although tested for ydif < 0). - Made part-value be anded with 0x0F in a test case to comply with disassembly. - Added comment about a test case which isn't present in the disassembly. Removing it makes things crash sometimes so letting it be. svn-id: r33620
-rw-r--r--engines/cine/various.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 2fcb015fcd..58b0c9f269 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -189,6 +189,15 @@ int16 getObjectUnderCursor(uint16 x, uint16 y) {
frame = ABS((int16)(objectTable[it->objIdx].frame));
part = objectTable[it->objIdx].part;
+ // Additional case for negative frame values in Operation Stealth
+ if (g_cine->getGameType() == Cine::GType_OS && objectTable[it->objIdx].frame < 0) {
+ if ((it->type == 1) && (x >= objX) && (objX + frame >= x) && (y >= objY) && (objY + part >= y)) {
+ return it->objIdx;
+ } else {
+ continue;
+ }
+ }
+
if (it->type == 0) {
threshold = animDataTable[frame]._var1;
} else {
@@ -201,16 +210,19 @@ int16 getObjectUnderCursor(uint16 x, uint16 y) {
xdif = x - objX;
ydif = y - objY;
- if ((xdif < 0) || ((threshold << 4) <= xdif) || (ydif < 0) || (ydif >= height) || !animDataTable[frame].data()) {
+ if ((xdif < 0) || ((threshold << 4) <= xdif) || (ydif <= 0) || (ydif >= height) || !animDataTable[frame].data()) {
continue;
}
if (g_cine->getGameType() == Cine::GType_OS) {
+ // This test isn't present in Operation Stealth's PC version's disassembly
+ // but removing it makes things crash sometimes (e.g. when selecting a verb
+ // and moving the mouse cursor around the floor in the airport's bathroom).
if (xdif >= width) {
continue;
}
- if (it->type == 0 && animDataTable[frame].getColor(xdif, ydif) != part) {
+ if (it->type == 0 && animDataTable[frame].getColor(xdif, ydif) != (part & 0x0F)) {
return it->objIdx;
} else if (it->type == 1 && gfxGetBit(xdif, ydif, animDataTable[frame].data(), animDataTable[frame]._width * 4)) {
return it->objIdx;