Ticket #9175: check-kFlagsYourself.patch

File check-kFlagsYourself.patch, 2.7 KB (added by peres, 14 years ago)
  • engines/parallaction/input.cpp

    diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
    index d61d1bf..f4b2254 100644
    a b bool Input::translateGameInput() {  
    326326
    327327        if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || (ACTIONTYPE(z) == kZoneCommand))) {
    328328
    329                 if (z->_flags & kFlagsNoWalk) {
    330                         // character doesn't need to walk to take specified action
     329                bool noWalk = z->_flags & kFlagsNoWalk; // check the explicit no-walk flag
     330                if (_gameType == GType_BRA) {
     331                        // action performed on object marked for self-use do not need walk in BRA
     332                        noWalk |= z->_flags & kFlagsYourself;
     333                }
     334
     335                if (noWalk) {
    331336                        takeAction(z);
    332337                } else {
    333338                        // action delayed: if Zone defined a moveto position the character is programmed to move there,
  • engines/parallaction/objects.h

    diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
    index 50a7892..36231cf 100644
    a b enum ZoneFlags {  
    8888        kFlagsNoWalk            = 0x800,                        // Zone: character doesn't need to walk towards object to interact
    8989
    9090        // BRA specific
    91         kFlagsYourself          = 0x1000,
     91        kFlagsYourself          = 0x1000,                       // BRA: marks zones used by the character on him/herself
    9292        kFlagsScaled            = 0x2000,
    93         kFlagsSelfuse           = 0x4000,
     93        kFlagsSelfuse           = 0x4000,                       // BRA: marks zones to be preserved across location changes (see Parallaction::freeZones)
    9494        kFlagsIsAnimation       = 0x1000000,            // BRA: used in walk code (trap check), to tell is a Zone is an Animation
    9595        kFlagsAnimLinked        = 0x2000000
    9696};
  • engines/parallaction/parallaction.cpp

    diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
    index 9b5bd0d..80e2ac2 100644
    a b bool Parallaction::checkZoneBox(ZonePtr z, uint32 type, uint x, uint y) {  
    687687        debugC(5, kDebugExec, "checkZoneBox for %s (type = %x, x = %i, y = %i)", z->_name, type, x, y);
    688688
    689689        if (!z->hitRect(x, y)) {
    690 
    691690                // check for special zones (items defined in common.loc)
    692691                if (checkSpecialZoneBox(z, type, x, y))
    693692                        return true;
    694693
    695                 if (z->getX() != -1)
    696                         return false;
    697                 if (!_char._ani->hitFrameRect(x, y))
     694                // check if self-use zone (nothing to do with kFlagsSelfuse)
     695                int gameType = getGameType();
     696                if (gameType == GType_Nippon) {
     697                        if (z->getX() != -1) {  // no explicit self-use flag in NS
     698                                return false;
     699                        }
     700                }
     701                if (gameType == GType_BRA) {
     702                        if (!(z->_flags & kFlagsYourself)) {
     703                                return false;
     704                        }
     705                }
     706                if (!_char._ani->hitFrameRect(x, y)) {
    698707                        return false;
     708                }
     709                // we get here only if (x,y) hits the character and the zone is marked as self-use
    699710        }
    700711
    701712        // normal Zone