aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-01-04 15:05:54 +0000
committerTorbjörn Andersson2004-01-04 15:05:54 +0000
commit5607f41e2d842bb753a51105e474a06cb6668f6b (patch)
treecdee8aa6af7b31b976be96fd8068232560fba1b3 /sword2
parent14acddb1678c54425f7425578623e8d7220813eb (diff)
downloadscummvm-rg350-5607f41e2d842bb753a51105e474a06cb6668f6b.tar.gz
scummvm-rg350-5607f41e2d842bb753a51105e474a06cb6668f6b.tar.bz2
scummvm-rg350-5607f41e2d842bb753a51105e474a06cb6668f6b.zip
Some cleanup and Valgrind warning fixes.
svn-id: r12141
Diffstat (limited to 'sword2')
-rw-r--r--sword2/driver/driver96.h2
-rw-r--r--sword2/mouse.cpp42
2 files changed, 17 insertions, 27 deletions
diff --git a/sword2/driver/driver96.h b/sword2/driver/driver96.h
index 2af4808e49..e7f0bec017 100644
--- a/sword2/driver/driver96.h
+++ b/sword2/driver/driver96.h
@@ -265,7 +265,7 @@ public:
Input(Sword2Engine *vm) :
_vm(vm), _mouseBacklog(0), _mouseLogPos(0), _keyBacklog(0),
- _keyLogPos(0) {};
+ _keyLogPos(0), _mouseX(0), _mouseY(0) {};
void parseEvents(void);
diff --git a/sword2/mouse.cpp b/sword2/mouse.cpp
index c43f98f252..9701863e16 100644
--- a/sword2/mouse.cpp
+++ b/sword2/mouse.cpp
@@ -809,46 +809,36 @@ void Sword2Engine::setLuggage(uint32 res) {
}
uint32 Sword2Engine::checkMouseList(void) {
- int32 priority = 0;
- uint32 j = 1;
+ // Number of priorities subject to implementation needs
- if (_curMouse > 1) {
- // Number of priorities subject to implementation needs
-
- while (priority < 10) {
+ for (int priority = 0; priority < 10; priority++) {
+ for (uint i = 1; i < _curMouse; i++) {
// If the mouse pointer is over this
// mouse-detection-box
- if (_mouseList[j].priority == priority &&
- _input->_mouseX + _thisScreen.scroll_offset_x >= _mouseList[j].x1 &&
- _input->_mouseX + _thisScreen.scroll_offset_x <= _mouseList[j].x2 &&
- _input->_mouseY + _thisScreen.scroll_offset_y >= _mouseList[j].y1 &&
- _input->_mouseY + _thisScreen.scroll_offset_y <= _mouseList[j].y2) {
+ if (_mouseList[i].priority == priority &&
+ _input->_mouseX + _thisScreen.scroll_offset_x >= _mouseList[i].x1 &&
+ _input->_mouseX + _thisScreen.scroll_offset_x <= _mouseList[i].x2 &&
+ _input->_mouseY + _thisScreen.scroll_offset_y >= _mouseList[i].y1 &&
+ _input->_mouseY + _thisScreen.scroll_offset_y <= _mouseList[i].y2) {
// Record id
- _mouseTouching = _mouseList[j].id;
+ _mouseTouching = _mouseList[i].id;
// Change all COGS pointers to CROSHAIR
- if (_mouseList[j].pointer == USE)
- _mouseList[j].pointer = CROSHAIR;
+ if (_mouseList[i].pointer == USE)
+ _mouseList[i].pointer = CROSHAIR;
- createPointerText(_mouseList[j].pointer_text, _mouseList[j].pointer);
+ createPointerText(_mouseList[i].pointer_text, _mouseList[i].pointer);
// Return pointer type
- return _mouseList[j].pointer;
- }
-
- j++;
- if (j == _curMouse) {
- j = 0;
- // Next priority - 0 being the highest, 9 the
- // lowest
- priority++;
+ return _mouseList[i].pointer;
}
}
}
- _mouseTouching = 0; // touching nothing
- return 0; // no pointer to return
+ // Touching nothing; no pointer to return
+ _mouseTouching = 0;
+ return 0;
}
#define POINTER_TEXT_WIDTH 640 // just in case!