diff options
author | Nicola Mettifogo | 2010-05-22 17:59:33 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2010-05-22 17:59:33 +0000 |
commit | 2f5cb946bb6faa27efabd9a3914db805c4f3dbb6 (patch) | |
tree | 42876752921a07fb58df24d29397892d4e7456c4 /engines/parallaction/parallaction.cpp | |
parent | b4813f9b182a5034a50412fe5212ba09f9323bfe (diff) | |
download | scummvm-rg350-2f5cb946bb6faa27efabd9a3914db805c4f3dbb6.tar.gz scummvm-rg350-2f5cb946bb6faa27efabd9a3914db805c4f3dbb6.tar.bz2 scummvm-rg350-2f5cb946bb6faa27efabd9a3914db805c4f3dbb6.zip |
Finish implementation of hitZone and related functions as from the original code.
svn-id: r49145
Diffstat (limited to 'engines/parallaction/parallaction.cpp')
-rw-r--r-- | engines/parallaction/parallaction.cpp | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index b21642e7c3..dc06542216 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -690,6 +690,35 @@ bool Parallaction::checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y) { return false; } +bool Parallaction::checkZoneType(ZonePtr z, uint32 type) { + int gameType = getGameType(); + + if (gameType == GType_Nippon) { + if ((type == 0) && (ITEMTYPE(z) == 0)) + return true; + } + + if (gameType == GType_BRA) { + if (type == 0) { + if (ITEMTYPE(z) == 0) { + if (ACTIONTYPE(z) != kZonePath) { + return true; + } + } + if (ACTIONTYPE(z) == kZoneDoor) { + return true; + } + } + } + + if (z->_type == type) + return true; + if (ITEMTYPE(z) == type) + return true; + + return false; +} + bool Parallaction::checkZoneBox(ZonePtr z, uint32 type, uint x, uint y) { if (z->_flags & kFlagsRemove) return false; @@ -719,15 +748,7 @@ bool Parallaction::checkZoneBox(ZonePtr z, uint32 type, uint x, uint y) { // we get here only if (x,y) hits the character and the zone is marked as self-use } - // normal Zone - if ((type == 0) && (ITEMTYPE(z) == 0)) - return true; - if (z->_type == type) - return true; - if (ITEMTYPE(z) == type) - return true; - - return false; + return checkZoneType(z, type); } bool Parallaction::checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y) { @@ -745,16 +766,7 @@ bool Parallaction::checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y) { return false; } - // NOTE: the implementation of the following lines is a different in the - // original... it is working so far, though - if ((type == 0) && (ITEMTYPE(z) == 0)) - return true; - if (z->_type == type) - return true; - if (ITEMTYPE(z) == type) - return true; - - return false; + return checkZoneType(z, type); } /* NOTE: hitZone needs to be passed absolute game coordinates to work. @@ -776,13 +788,22 @@ ZonePtr Parallaction::hitZone(uint32 type, uint16 x, uint16 y) { } + int gameType = getGameType(); + int16 _a, _b, _c, _d; bool _ef; for (AnimationList::iterator ait = _location._animations.begin(); ait != _location._animations.end(); ++ait) { AnimationPtr a = *ait; - _a = (a->_flags & kFlagsActive) ? 1 : 0; // _a: active Animation + _a = (a->_flags & kFlagsActive) ? 1 : 0; // _a: active Animation + + if (!_a) { + if (gameType == GType_BRA && ACTIONTYPE(a) != kZoneTrap) { + continue; + } + } + _ef = a->hitFrameRect(_si, _di); _b = ((type != 0) || (a->_type == kZoneYou)) ? 0 : 1; // _b: (no type specified) AND (Animation is not the character) |