aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-18 17:22:07 +0000
committerNicola Mettifogo2007-03-18 17:22:07 +0000
commitc1f84742f908dacc446b28852554188a0d525593 (patch)
tree76e126e00a39236406d5c237809cae2b3968b5a2 /engines/parallaction
parent0e370a41625d3bcbbf8b3d770323003765c11824 (diff)
downloadscummvm-rg350-c1f84742f908dacc446b28852554188a0d525593.tar.gz
scummvm-rg350-c1f84742f908dacc446b28852554188a0d525593.tar.bz2
scummvm-rg350-c1f84742f908dacc446b28852554188a0d525593.zip
changed remaining stuff to Common::Point and got rid of custom Point and Rect
svn-id: r26216
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/defs.h12
-rw-r--r--engines/parallaction/dialogue.cpp2
-rw-r--r--engines/parallaction/graphics.cpp8
-rw-r--r--engines/parallaction/inventory.cpp4
-rw-r--r--engines/parallaction/menu.cpp18
-rw-r--r--engines/parallaction/parallaction.cpp18
-rw-r--r--engines/parallaction/parallaction.h3
7 files changed, 23 insertions, 42 deletions
diff --git a/engines/parallaction/defs.h b/engines/parallaction/defs.h
index d58dbd64b4..6f864215b6 100644
--- a/engines/parallaction/defs.h
+++ b/engines/parallaction/defs.h
@@ -55,18 +55,6 @@ public:
}
};
-struct Point {
- int16 _x;
- int16 _y;
-};
-
-struct Rect {
- int16 _left;
- int16 _top;
- int16 _right;
- int16 _bottom;
-};
-
struct SpeakData;
struct Question;
typedef Question Dialogue;
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index fccf61a4c2..73567f3ca1 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -486,7 +486,7 @@ int16 selectAnswer(Question *q, StaticCnv *cnv) {
while (_mouseButtons != kMouseLeftUp) {
_vm->updateInput();
- _si = getHoverAnswer(_mousePos._x, _mousePos._y, q);
+ _si = getHoverAnswer(_vm->_mousePos.x, _vm->_mousePos.y, q);
if (_si != v2) {
if (v2 != -1)
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index def57c5d6a..6067a329fc 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -429,11 +429,11 @@ void jobEraseLabel(void *parm, Job *j) {
int16 _si, _di;
if (_vm->_activeItem._id != 0) {
- _si = _mousePos._x + 16 - label->_cnv._width/2;
- _di = _mousePos._y + 34;
+ _si = _vm->_mousePos.x + 16 - label->_cnv._width/2;
+ _di = _vm->_mousePos.y + 34;
} else {
- _si = _mousePos._x + 8 - label->_cnv._width/2;
- _di = _mousePos._y + 21;
+ _si = _vm->_mousePos.x + 8 - label->_cnv._width/2;
+ _di = _vm->_mousePos.y + 21;
}
if (_si < 0) _si = 0;
diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index d2386fa0f3..0a70df12db 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -316,14 +316,14 @@ void openInventory() {
uint16 _LOCALinventory_lines = (_si + 4) / INVENTORY_ITEMS_PER_LINE;
- _invPosition.x = _mousePos._x - (INVENTORY_WIDTH / 2);
+ _invPosition.x = _vm->_mousePos.x - (INVENTORY_WIDTH / 2);
if (_invPosition.x < 0)
_invPosition.x = 0;
if ((_invPosition.x + INVENTORY_WIDTH) > SCREEN_WIDTH)
_invPosition.x = SCREEN_WIDTH - INVENTORY_WIDTH;
- _invPosition.y = _mousePos._y - 2 - (_LOCALinventory_lines * INVENTORYITEM_HEIGHT);
+ _invPosition.y = _vm->_mousePos.y - 2 - (_LOCALinventory_lines * INVENTORYITEM_HEIGHT);
if (_invPosition.y < 0)
_invPosition.y = 0;
diff --git a/engines/parallaction/menu.cpp b/engines/parallaction/menu.cpp
index 5c883da8b1..aa62bc55ad 100644
--- a/engines/parallaction/menu.cpp
+++ b/engines/parallaction/menu.cpp
@@ -191,17 +191,14 @@ uint16 Menu::chooseLanguage() {
_engine->updateInput();
_vm->_gfx->swapBuffers();
- uint16 _di = _mousePos._x;
- uint16 v2 = _mousePos._y;
-
if (_mouseButtons == kMouseLeftUp) {
for (uint16 _si = 0; _si < 4; _si++) {
- if (80 + _si*49 >= _di) continue;
- if (110 - _si*25 >= v2) continue;
+ if (80 + _si*49 >= _vm->_mousePos.x) continue;
+ if (110 - _si*25 >= _vm->_mousePos.y) continue;
- if (128 + _si*49 <= _di) continue;
- if (180 - _si*25 <= v2) continue;
+ if (128 + _si*49 <= _vm->_mousePos.x) continue;
+ if (180 - _si*25 <=_vm->_mousePos.y) continue;
beep();
return _si;
@@ -232,7 +229,7 @@ uint16 Menu::selectGame() {
_engine->waitTime( 1 );
_si = 0;
- if (_mousePos._x > 160)
+ if (_vm->_mousePos.x > 160)
_si = 1;
if (_si == _di) continue;
@@ -313,9 +310,6 @@ void Menu::selectCharacter() {
_engine->waitTime(1);
} while (_mouseButtons != kMouseLeftUp); // waits for left click
- uint16 x = _mousePos._x;
- uint16 y = _mousePos._y;
-
for (uint16 _si = 0; _si < 9; _si++) {
Common::Rect r(
@@ -325,7 +319,7 @@ void Menu::selectCharacter() {
BLOCK_SELECTION_Y + BLOCK_HEIGHT - _si * BLOCK_Y_OFFSET
);
- if (!r.contains(x, y)) continue;
+ if (!r.contains(_vm->_mousePos)) continue;
r.setWidth(BLOCK_WIDTH);
r.setHeight(BLOCK_HEIGHT);
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 325ee132e2..a73f48598b 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -47,7 +47,7 @@ namespace Parallaction {
Parallaction *_vm = NULL;
// public stuff
-Point _mousePos = { 0, 0 };
+
uint16 _mouseButtons = 0;
@@ -314,8 +314,7 @@ uint16 Parallaction::updateInput() {
break;
case Common::EVENT_MOUSEMOVE:
- _mousePos._x = e.mouse.x;
- _mousePos._y = e.mouse.y;
+ _mousePos = e.mouse;
break;
case Common::EVENT_QUIT:
@@ -477,7 +476,7 @@ void Parallaction::processInput(InputData *data) {
_jDrawLabel = NULL;
addJob(&jobWaitRemoveJob, _jEraseLabel, kPriority2);
}
- if (hitZone(kZoneYou, _mousePos._x, _mousePos._y) == 0)
+ if (hitZone(kZoneYou, _mousePos.x, _mousePos.y) == 0)
changeCursor(kCursorArrow);
removeJob(_jRunScripts);
_jDrawInventory = addJob(&jobShowInventory, 0, kPriority2);
@@ -552,8 +551,7 @@ Parallaction::InputData *Parallaction::translateInput() {
return &_input;
}
- _input._mousePos.x = _mousePos._x;
- _input._mousePos.y = _mousePos._y;
+ _input._mousePos = _mousePos;
if (((_engineFlags & kEnginePauseJobs) == 0) && ((_engineFlags & kEngineInventory) == 0)) {
@@ -564,12 +562,12 @@ Parallaction::InputData *Parallaction::translateInput() {
return &_input;
}
- Zone *z = hitZone(_activeItem._id, _mousePos._x, _mousePos._y);
+ Zone *z = hitZone(_activeItem._id, _mousePos.x, _mousePos.y);
if (_mouseButtons == kMouseRightDown) {
// right button down shows inventory
- if (hitZone(kZoneYou, _mousePos._x, _mousePos._y) && (_activeItem._id != 0)) {
+ if (hitZone(kZoneYou, _mousePos.x, _mousePos.y) && (_activeItem._id != 0)) {
_activeItem._index = (_activeItem._id >> 16) & 0xFFFF;
_engineFlags |= kEngineDragging;
}
@@ -629,13 +627,13 @@ Parallaction::InputData *Parallaction::translateInput() {
if ((_engineFlags & kEngineInventory) == 0) return NULL;
// in inventory
- int16 _si = getHoverInventoryItem(_mousePos._x, _mousePos._y);
+ int16 _si = getHoverInventoryItem(_mousePos.x, _mousePos.y);
if (_mouseButtons == kMouseRightUp) {
// right up hides inventory
_input._event = kEvCloseInventory;
- _input._inventoryIndex = getHoverInventoryItem(_mousePos._x, _mousePos._y);
+ _input._inventoryIndex = getHoverInventoryItem(_mousePos.x, _mousePos.y);
highlightInventoryItem(_transCurrentHoverItem, 12); // disable
if ((_engineFlags & kEngineDragging) == 0) return &_input;
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 5efa287eea..fd7d6d77e5 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -99,7 +99,6 @@ public:
}
};
-extern Point _mousePos;
extern uint16 _mouseButtons;
extern uint16 _score;
@@ -338,6 +337,8 @@ public:
Script *_locationScript;
+ Common::Point _mousePos;
+
protected: // data
struct InputData {