[Scummvm-cvs-logs] SF.net SVN: scummvm: [24436] scummvm/trunk/engines/agos
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Sun Oct 22 15:04:43 CEST 2006
Revision: 24436
http://svn.sourceforge.net/scummvm/?rev=24436&view=rev
Author: kirben
Date: 2006-10-22 06:04:34 -0700 (Sun, 22 Oct 2006)
Log Message:
-----------
Add drag support for items in Elvira 1/2 and WW
Modified Paths:
--------------
scummvm/trunk/engines/agos/agos.cpp
scummvm/trunk/engines/agos/agos.h
scummvm/trunk/engines/agos/cursor.cpp
scummvm/trunk/engines/agos/event.cpp
scummvm/trunk/engines/agos/input.cpp
scummvm/trunk/engines/agos/oracle.cpp
scummvm/trunk/engines/agos/verb.cpp
Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp 2006-10-22 11:13:42 UTC (rev 24435)
+++ scummvm/trunk/engines/agos/agos.cpp 2006-10-22 13:04:34 UTC (rev 24436)
@@ -203,7 +203,6 @@
_objectItem = 0;
_currentPlayer = 0;
- _currentBoxNumber = 0;
_iOverflow = 0;
_nameLocked = 0;
_hitAreaObjectItem = 0;
@@ -211,6 +210,7 @@
_lastNameOn = 0;
_lastHitArea3 = 0;
_hitAreaSubjectItem = 0;
+ _currentBox = 0;
_currentVerbBox = 0;
_lastVerbOn = 0;
_needHitAreaRecalc = 0;
@@ -218,6 +218,13 @@
_defaultVerb = 0;
_mouseHideCount = 0;
+ _dragAccept = 0;
+ _dragFlag = 0;
+ _dragMode = 0;
+ _dragCount = 0;
+ _dragEnd = 0;
+ _lastClickRem = 0;
+
_windowNum = 0;
_printCharCurPos = 0;
@@ -245,6 +252,10 @@
_rightButtonDown = 0;
_noRightClick = false;
+ _leftButton = 0;
+ _leftButtonCount = 0;
+ _leftButtonOld = 0;
+
_dummyItem1 = new Item();
_dummyItem2 = new Item();
_dummyItem3 = new Item();
Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h 2006-10-22 11:13:42 UTC (rev 24435)
+++ scummvm/trunk/engines/agos/agos.h 2006-10-22 13:04:34 UTC (rev 24436)
@@ -338,14 +338,20 @@
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 @@
bool _mouseToggle;
byte _leftButtonDown;
+ byte _leftButton, _leftButtonCount, _leftButtonOld;
byte _rightButtonDown;
bool _noRightClick;
Modified: scummvm/trunk/engines/agos/cursor.cpp
===================================================================
--- scummvm/trunk/engines/agos/cursor.cpp 2006-10-22 11:13:42 UTC (rev 24435)
+++ scummvm/trunk/engines/agos/cursor.cpp 2006-10-22 13:04:34 UTC (rev 24436)
@@ -344,6 +344,13 @@
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 @@
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 @@
goto get_out;
}
+boxstuff:
boxController(_mouseX, _mouseY, x);
_lastHitArea3 = _lastHitArea;
if (x == 1 && _lastHitArea == NULL)
@@ -483,6 +514,9 @@
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++) {
Modified: scummvm/trunk/engines/agos/event.cpp
===================================================================
--- scummvm/trunk/engines/agos/event.cpp 2006-10-22 11:13:42 UTC (rev 24435)
+++ scummvm/trunk/engines/agos/event.cpp 2006-10-22 13:04:34 UTC (rev 24436)
@@ -404,6 +404,8 @@
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 @@
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 @@
}
}
+ if (_leftButton == 1)
+ _leftButtonCount++;
+
_system->updateScreen();
if (amount == 0)
Modified: scummvm/trunk/engines/agos/input.cpp
===================================================================
--- scummvm/trunk/engines/agos/input.cpp 2006-10-22 11:13:42 UTC (rev 24435)
+++ scummvm/trunk/engines/agos/input.cpp 2006-10-22 13:04:34 UTC (rev 24436)
@@ -187,6 +187,7 @@
for (;;) {
_lastHitArea = NULL;
_lastHitArea3 = NULL;
+ _dragAccept = 1;
for (;;) {
if (getGameType() != GType_FF && getGameType() != GType_PP && _keyPressed == 35)
@@ -199,6 +200,8 @@
goto startOver;
if (_lastHitArea3 != 0)
break;
+ if (_dragMode != 0)
+ goto dragMode;
hitarea_stuff_helper();
delay(100);
}
@@ -302,6 +305,60 @@
_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() {
Modified: scummvm/trunk/engines/agos/oracle.cpp
===================================================================
--- scummvm/trunk/engines/agos/oracle.cpp 2006-10-22 11:13:42 UTC (rev 24435)
+++ scummvm/trunk/engines/agos/oracle.cpp 2006-10-22 13:04:34 UTC (rev 24436)
@@ -112,7 +112,7 @@
startSubroutineEx(sub);
setBitFlag(94, false);
}
- if (_currentBoxNumber != 601 || !getBitFlag(89))
+ if (_currentBox->id != 601 || !getBitFlag(89))
break;
delay(100);
}
@@ -146,7 +146,7 @@
startSubroutineEx(sub);
setBitFlag(93, false);
}
- if (_currentBoxNumber != 600 || !getBitFlag(89))
+ if (_currentBox->id != 600 || !getBitFlag(89))
break;
delay(100);
}
Modified: scummvm/trunk/engines/agos/verb.cpp
===================================================================
--- scummvm/trunk/engines/agos/verb.cpp 2006-10-22 11:13:42 UTC (rev 24435)
+++ scummvm/trunk/engines/agos/verb.cpp 2006-10-22 13:04:34 UTC (rev 24436)
@@ -657,7 +657,7 @@
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 @@
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 @@
}
} while (ha++, --count);
- _currentBoxNumber = 0;
-
+ _currentBox = best_ha;
if (best_ha == NULL) {
clearName();
if (getGameType() == GType_WW && _mouseCursor >= 4) {
@@ -751,26 +750,32 @@
return;
}
- _currentBoxNumber = best_ha->id;
+ 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 (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 (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 @@
hitarea_leave(best_ha, false);
best_ha->flags |= kBFBoxSelected;
}
-
- return;
}
void AGOSEngine::displayName(HitArea *ha) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list