aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-10-22 13:04:34 +0000
committerTravis Howell2006-10-22 13:04:34 +0000
commit25c38db499c34807f6b277b8f9a8f1b3d32dbc6d (patch)
tree906ad45afc2871d9da399348d79683817c34cd7a /engines
parent16ee6236078a07cfc3326e13a1ad9880c703386f (diff)
downloadscummvm-rg350-25c38db499c34807f6b277b8f9a8f1b3d32dbc6d.tar.gz
scummvm-rg350-25c38db499c34807f6b277b8f9a8f1b3d32dbc6d.tar.bz2
scummvm-rg350-25c38db499c34807f6b277b8f9a8f1b3d32dbc6d.zip
Add drag support for items in Elvira 1/2 and WW
svn-id: r24436
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.cpp13
-rw-r--r--engines/agos/agos.h11
-rw-r--r--engines/agos/cursor.cpp34
-rw-r--r--engines/agos/event.cpp8
-rw-r--r--engines/agos/input.cpp57
-rw-r--r--engines/agos/oracle.cpp4
-rw-r--r--engines/agos/verb.cpp49
7 files changed, 148 insertions, 28 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index ad7884e31a..e9d748458b 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -203,7 +203,6 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_objectItem = 0;
_currentPlayer = 0;
- _currentBoxNumber = 0;
_iOverflow = 0;
_nameLocked = 0;
_hitAreaObjectItem = 0;
@@ -211,6 +210,7 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_lastNameOn = 0;
_lastHitArea3 = 0;
_hitAreaSubjectItem = 0;
+ _currentBox = 0;
_currentVerbBox = 0;
_lastVerbOn = 0;
_needHitAreaRecalc = 0;
@@ -218,6 +218,13 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_defaultVerb = 0;
_mouseHideCount = 0;
+ _dragAccept = 0;
+ _dragFlag = 0;
+ _dragMode = 0;
+ _dragCount = 0;
+ _dragEnd = 0;
+ _lastClickRem = 0;
+
_windowNum = 0;
_printCharCurPos = 0;
@@ -245,6 +252,10 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_rightButtonDown = 0;
_noRightClick = false;
+ _leftButton = 0;
+ _leftButtonCount = 0;
+ _leftButtonOld = 0;
+
_dummyItem1 = new Item();
_dummyItem2 = new Item();
_dummyItem3 = new Item();
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 87b2102214..363a72242b 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -338,14 +338,20 @@ protected:
HitArea *_lastNameOn;
HitArea *_lastHitArea3;
Item *_hitAreaSubjectItem;
- HitArea *_currentVerbBox, *_lastVerbOn;
+ HitArea *_currentBox, *_currentVerbBox, *_lastVerbOn;
uint _needHitAreaRecalc;
uint _verbHitArea;
uint16 _defaultVerb;
- uint _currentBoxNumber;
uint _iOverflow;
uint _nameLocked;
+ uint _dragAccept;
+ uint _dragFlag;
+ uint _dragMode;
+ uint _dragCount;
+ uint _dragEnd;
+ HitArea *_lastClickRem;
+
uint16 _windowNum;
uint _printCharCurPos, _printCharMaxPos, _printCharPixelCount;
@@ -373,6 +379,7 @@ protected:
bool _mouseToggle;
byte _leftButtonDown;
+ byte _leftButton, _leftButtonCount, _leftButtonOld;
byte _rightButtonDown;
bool _noRightClick;
diff --git a/engines/agos/cursor.cpp b/engines/agos/cursor.cpp
index 012308b3a4..5c97d008b9 100644
--- a/engines/agos/cursor.cpp
+++ b/engines/agos/cursor.cpp
@@ -344,6 +344,13 @@ void AGOSEngine::handleMouseMoved() {
resetVerbs();
}
+ if (_leftButton == 0) {
+ if (_dragMode != 0) {
+ _dragEnd = 1;
+ }
+ _dragCount = 0;
+ }
+
if (getGameType() == GType_FF) {
if (getBitFlag(99)) { // Oracle
if (_mouseX >= 10 && _mouseX <= 635 && _mouseY >= 5 && _mouseY <= 475) {
@@ -398,6 +405,29 @@ void AGOSEngine::handleMouseMoved() {
if (_mouseX != _mouseXOld || _mouseY != _mouseYOld)
_needHitAreaRecalc++;
+ if (_leftButtonOld == 0 && _leftButtonCount != 0) {
+ _lastClickRem = 0;
+ boxController(_mouseX, _mouseY, 3);
+ }
+ _leftButtonOld = _leftButton;
+
+ if (_dragMode != 0 || _lastHitArea3 != 0) {
+ x = 0;
+ if (_needHitAreaRecalc == 0)
+ goto get_out;
+ else
+ goto boxstuff;
+ }
+
+ if (_leftButton != 0 && _dragAccept != 0 && _lastClickRem != NULL) {
+ _dragCount++;
+ if (_dragCount == 2) {
+ _dragMode = 1;
+ _dragFlag = 1;
+ _needHitAreaRecalc++;
+ }
+ }
+
x = 0;
if (_lastHitArea3 == 0 && _leftButtonDown != 0) {
if (getGameType() == GType_PP)
@@ -413,6 +443,7 @@ void AGOSEngine::handleMouseMoved() {
goto get_out;
}
+boxstuff:
boxController(_mouseX, _mouseY, x);
_lastHitArea3 = _lastHitArea;
if (x == 1 && _lastHitArea == NULL)
@@ -483,6 +514,9 @@ void AGOSEngine::drawMousePointer() {
memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
uint cursor = (_mouseCursor == 0) ? _mouseCursor : _mouseCursor - 1;
+ if (_dragFlag != 0)
+ cursor = 1;
+
src = _common_cursors[cursor];
for (i = 0; i < 16; i++) {
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index f5a03ea9e1..68cd77425f 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -404,6 +404,8 @@ void AGOSEngine::delay(uint amount) {
if (getGameType() == GType_FF)
setBitFlag(89, true);
_leftButtonDown++;
+ _leftButton = 1;
+
#if defined (_WIN32_WCE) || defined(PALMOS_MODE)
_sdlMouseX = event.mouse.x;
_sdlMouseY = event.mouse.y;
@@ -412,6 +414,9 @@ void AGOSEngine::delay(uint amount) {
case OSystem::EVENT_LBUTTONUP:
if (getGameType() == GType_FF)
setBitFlag(89, false);
+
+ _leftButton = 0;
+ _leftButtonCount = 0;
break;
case OSystem::EVENT_RBUTTONDOWN:
if (getGameType() == GType_FF)
@@ -426,6 +431,9 @@ void AGOSEngine::delay(uint amount) {
}
}
+ if (_leftButton == 1)
+ _leftButtonCount++;
+
_system->updateScreen();
if (amount == 0)
diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp
index 76562977d5..ab812b9675 100644
--- a/engines/agos/input.cpp
+++ b/engines/agos/input.cpp
@@ -187,6 +187,7 @@ startOver:
for (;;) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
+ _dragAccept = 1;
for (;;) {
if (getGameType() != GType_FF && getGameType() != GType_PP && _keyPressed == 35)
@@ -199,6 +200,8 @@ startOver:
goto startOver;
if (_lastHitArea3 != 0)
break;
+ if (_dragMode != 0)
+ goto dragMode;
hitarea_stuff_helper();
delay(100);
}
@@ -302,6 +305,60 @@ out_of_here:
_nameLocked = 0;
_needHitAreaRecalc++;
+ _dragAccept = 0;
+
+ if (getGameType() == GType_WW && _mouseCursor < 3)
+ _mouseCursor = 0;
+
+ return;
+
+resetDrag:
+
+ _dragFlag = 0;
+ _dragMode = 0;
+ _dragCount = 0;
+ _dragEnd = 0;
+ goto startOver;
+
+dragMode:
+ if (_lastClickRem == 0)
+ goto resetDrag;
+
+ ha = _lastClickRem;
+ if (!(ha->flags & kBFDragBox))
+ goto resetDrag;
+
+ if (ha->item_ptr == NULL)
+ goto resetDrag;
+
+ _hitAreaSubjectItem = ha->item_ptr;
+ _verbHitArea = 500;
+
+ for (;;) {
+ processSpecialKeys();
+ hitarea_stuff_helper();
+ delay(100);
+
+ if (_dragFlag == 0)
+ goto resetDrag;
+
+ if (_dragEnd != 0)
+ break;
+ }
+
+ _dragFlag = 0;
+ _dragMode = 0;
+ _dragCount = 0;
+ _dragEnd = 0;
+
+ boxController(_mouseX, _mouseY, 1);
+
+ if (_currentBox != NULL) {
+ _hitAreaObjectItem = _currentBox->item_ptr;
+ setVerbText(ha);
+ }
+
+ goto out_of_here;
}
void AGOSEngine::hitarea_stuff_helper() {
diff --git a/engines/agos/oracle.cpp b/engines/agos/oracle.cpp
index a3804367a6..efed6c8d5b 100644
--- a/engines/agos/oracle.cpp
+++ b/engines/agos/oracle.cpp
@@ -112,7 +112,7 @@ void AGOSEngine::oracleTextUp() {
startSubroutineEx(sub);
setBitFlag(94, false);
}
- if (_currentBoxNumber != 601 || !getBitFlag(89))
+ if (_currentBox->id != 601 || !getBitFlag(89))
break;
delay(100);
}
@@ -146,7 +146,7 @@ void AGOSEngine::oracleTextDown() {
startSubroutineEx(sub);
setBitFlag(93, false);
}
- if (_currentBoxNumber != 600 || !getBitFlag(89))
+ if (_currentBox->id != 600 || !getBitFlag(89))
break;
delay(100);
}
diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp
index 188f0ead96..337a9accc7 100644
--- a/engines/agos/verb.cpp
+++ b/engines/agos/verb.cpp
@@ -657,7 +657,7 @@ void AGOSEngine::inventoryUp(WindowBlock *window) {
checkUp(window);
animate(4, 9, 21, 0 ,0, 0);
while (1) {
- if (_currentBoxNumber != 0x7FFB || !getBitFlag(89))
+ if (_currentBox->id != 0x7FFB || !getBitFlag(89))
break;
checkUp(window);
delay(1);
@@ -684,7 +684,7 @@ void AGOSEngine::inventoryDown(WindowBlock *window) {
checkDown(window);
animate(4, 9, 23, 0, 0, 0);
while (1) {
- if (_currentBoxNumber != 0x7FFC || !getBitFlag(89))
+ if (_currentBox->id != 0x7FFC || !getBitFlag(89))
break;
checkDown(window);
delay(1);
@@ -740,8 +740,7 @@ void AGOSEngine::boxController(uint x, uint y, uint mode) {
}
} while (ha++, --count);
- _currentBoxNumber = 0;
-
+ _currentBox = best_ha;
if (best_ha == NULL) {
clearName();
if (getGameType() == GType_WW && _mouseCursor >= 4) {
@@ -751,26 +750,32 @@ void AGOSEngine::boxController(uint x, uint y, uint mode) {
return;
}
- _currentBoxNumber = best_ha->id;
-
- if (mode != 0 && mode != 3) {
- _lastHitArea = best_ha;
- if (getGameType() == GType_PP) {
- _variableArray[400] = x;
- _variableArray[401] = y;
- } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2 ||
- getGameType() == GType_FF) {
- _variableArray[1] = x;
- _variableArray[2] = y;
- } else if (getGameType() == GType_ELVIRA1) {
- if (best_ha->verb & 0x4000) {
- if (_variableArray[500] == 0) {
- _variableArray[500] = best_ha->verb & 0xBFFF;
+ if (mode != 0) {
+ if (mode == 3) {
+ if (getGameType() == GType_ELVIRA1) {
+ if (best_ha->verb & 0x4000) {
+ if (_variableArray[500] == 0) {
+ _variableArray[500] = best_ha->verb & 0xBFFF;
+ }
}
+ }
+
+ if (best_ha->flags & kBFDragBox) {
+ _lastClickRem = best_ha;
+ }
+ } else {
+ _lastHitArea = best_ha;
+ if (getGameType() == GType_PP) {
+ _variableArray[400] = x;
+ _variableArray[401] = y;
+ } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2 ||
+ getGameType() == GType_FF) {
+ _variableArray[1] = x;
+ _variableArray[2] = y;
}
- }
+ }
}
-
+
if ((getGameType() == GType_WW) && (_mouseCursor == 0 || _mouseCursor >= 4)) {
uint verb = best_ha->verb & 0x3FFF;
if (verb >= 239 && verb <= 242) {
@@ -794,8 +799,6 @@ void AGOSEngine::boxController(uint x, uint y, uint mode) {
hitarea_leave(best_ha, false);
best_ha->flags |= kBFBoxSelected;
}
-
- return;
}
void AGOSEngine::displayName(HitArea *ha) {