diff options
author | Travis Howell | 2009-03-05 21:38:17 +0000 |
---|---|---|
committer | Travis Howell | 2009-03-05 21:38:17 +0000 |
commit | e75178f383edd20ad8ab1b74dead78b2199f9476 (patch) | |
tree | a2527fe4740043845bb789d0890b5b8bf0cdb46c /engines | |
parent | 05b4370c21b3abf7a1ff6aa83194cf95ab73579c (diff) | |
download | scummvm-rg350-e75178f383edd20ad8ab1b74dead78b2199f9476.tar.gz scummvm-rg350-e75178f383edd20ad8ab1b74dead78b2199f9476.tar.bz2 scummvm-rg350-e75178f383edd20ad8ab1b74dead78b2199f9476.zip |
Add minor verb code differences in Elvira 1/2.
svn-id: r39136
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agos/agos.h | 5 | ||||
-rw-r--r-- | engines/agos/intern.h | 8 | ||||
-rw-r--r-- | engines/agos/script_e1.cpp | 36 | ||||
-rw-r--r-- | engines/agos/verb.cpp | 103 |
4 files changed, 129 insertions, 23 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 29793b1ca2..f503730b53 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -798,7 +798,7 @@ protected: void waitWindow(WindowBlock *window); HitArea *findBox(uint hitarea_id); - void boxController(uint x, uint y, uint mode); + virtual void boxController(uint x, uint y, uint mode); void handleVerbClicked(uint verb); virtual void clearName(); void displayName(HitArea * ha); @@ -1297,6 +1297,7 @@ public: void oe1_animate(); void oe1_stopAnimate(); void oe1_menu(); + void oe1_addBox(); void oe1_enableInput(); void oe1_setTime(); void oe1_ifTime(); @@ -1462,6 +1463,8 @@ protected: virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y); + virtual void boxController(uint x, uint y, uint mode); + virtual void addArrows(WindowBlock *window, uint8 num); virtual void removeArrows(WindowBlock *window, uint num); diff --git a/engines/agos/intern.h b/engines/agos/intern.h index 6ad09cae88..823a9ed345 100644 --- a/engines/agos/intern.h +++ b/engines/agos/intern.h @@ -201,12 +201,14 @@ struct GameSpecificSettings { }; enum BoxFlags { - kBFTextBox = 0x1, + kBFToggleBox = 0x1, // Elvira 1/2 + kBFTextBox = 0x1, // Others kBFBoxSelected = 0x2, - kBFNoTouchName = 0x4, + kBFInvertSelect = 0x4, // Elvira 1/2 + kBFNoTouchName = 0x4, // Others kBFInvertTouch = 0x8, - kBFDragBox = 0x10, // Simon 1/2 kBFHyperBox = 0x10, // Feeble Files + kBFDragBox = 0x10, // Others kBFBoxInUse = 0x20, kBFBoxDead = 0x40, kBFBoxItem = 0x80 diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp index 15fea99a93..ddc57bac45 100644 --- a/engines/agos/script_e1.cpp +++ b/engines/agos/script_e1.cpp @@ -327,7 +327,7 @@ void AGOSEngine_Elvira1::setupOpcodes() { OPCODE(o_closeWindow), OPCODE(oe1_menu), OPCODE(o_invalid), - OPCODE(o_addBox), + OPCODE(oe1_addBox), /* 236 */ OPCODE(o_delBox), OPCODE(o_enableBox), @@ -755,6 +755,40 @@ void AGOSEngine_Elvira1::oe1_menu() { drawMenuStrip(a, b); } +void AGOSEngine_Elvira1::oe1_addBox() { + // 235: add item box + uint flags = 0; + uint id = getVarOrWord(); + uint params = id / 1000; + uint x, y, w, h, verb; + Item *item; + + id = id % 1000; + + if (params & 1) + flags |= kBFInvertTouch; + if (params & 2) + flags |= kBFInvertSelect; + if (params & 4) + flags |= kBFBoxItem; + if (params & 8) + flags |= kBFToggleBox; + if (params & 16) + flags |= kBFDragBox; + + x = getVarOrWord(); + y = getVarOrWord(); + w = getVarOrWord(); + h = getVarOrWord(); + item = getNextItemPtrStrange(); + verb = getVarOrWord(); + if (x >= 1000) { + verb += 0x4000; + x -= 1000; + } + defineBox(id, x, y, w, h, flags, verb, item); +} + void AGOSEngine_Elvira1::oe1_bitClear() { // 251: set bit off int var = getVarOrWord(); diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp index 1dfdfb9359..5d33056f60 100644 --- a/engines/agos/verb.cpp +++ b/engines/agos/verb.cpp @@ -685,6 +685,91 @@ void AGOSEngine::boxController(uint x, uint y, uint mode) { HitArea *ha = _hitAreas; uint count = ARRAYSIZE(_hitAreas); uint16 priority = 0; + + best_ha = NULL; + + do { + if (ha->flags & kBFBoxInUse) { + if (!(ha->flags & kBFBoxDead)) { + if (x >= ha->x && y >= ha->y && + x - ha->x < ha->width && y - ha->y < ha->height && priority <= ha->priority) { + priority = ha->priority; + best_ha = ha; + } else { + if (ha->flags & kBFBoxSelected) { + hitarea_leave(ha , true); + ha->flags &= ~kBFBoxSelected; + } + } + } else { + ha->flags &= ~kBFBoxSelected; + } + } + } while (ha++, --count); + + _currentBoxNum = 0; + _currentBox = best_ha; + + if (best_ha == NULL) + return; + + _currentBoxNum = best_ha->id; + + if (mode != 0) { + if (mode == 3) { + if (best_ha->verb & 0x4000) { + if (getGameType() == GType_ELVIRA1 && _variableArray[500] == 0) { + _variableArray[500] = best_ha->verb & 0xBFFF; + } + + if (_clickOnly != 0 && best_ha->id < 8) { + uint id = best_ha->id; + if (id >= 4) + id -= 4; + + invertBox(findBox(id), 0, 0, 0, 0); + _clickOnly = 0; + return; + } + } + + if (best_ha->flags & kBFDragBox) + _lastClickRem = best_ha; + } else { + _lastHitArea = best_ha; + } + } + + if (_clickOnly != 0) + return; + + if (best_ha->flags & kBFInvertTouch) { + if (!(best_ha->flags & kBFBoxSelected)) { + hitarea_leave(best_ha, false); + best_ha->flags |= kBFBoxSelected; + } + } else { + if (mode == 0) + return; + + if (!(best_ha->flags & kBFInvertSelect)) + return; + + if (best_ha->flags & kBFToggleBox) { + hitarea_leave(best_ha, false); + best_ha->flags ^= kBFInvertSelect; + } else if (!(best_ha->flags & kBFBoxSelected)) { + hitarea_leave(best_ha, false); + best_ha->flags |= kBFBoxSelected; + } + } +} + +void AGOSEngine_Waxworks::boxController(uint x, uint y, uint mode) { + HitArea *best_ha; + HitArea *ha = _hitAreas; + uint count = ARRAYSIZE(_hitAreas); + uint16 priority = 0; uint16 x_ = x; uint16 y_ = y; @@ -734,24 +819,6 @@ void AGOSEngine::boxController(uint x, uint y, uint mode) { if (mode != 0) { if (mode == 3) { - if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2) { - if (best_ha->verb & 0x4000) { - if (getGameType() == GType_ELVIRA1 && _variableArray[500] == 0) { - _variableArray[500] = best_ha->verb & 0xBFFF; - } - - if (_clickOnly != 0 && best_ha->id < 8) { - uint id = best_ha->id; - if (id >= 4) - id -= 4; - - invertBox(findBox(id), 0, 0, 0, 0); - _clickOnly = 0; - return; - } - } - } - if (best_ha->flags & kBFDragBox) { _lastClickRem = best_ha; } |