diff options
author | Sven Hesse | 2008-12-15 01:45:16 +0000 |
---|---|---|
committer | Sven Hesse | 2008-12-15 01:45:16 +0000 |
commit | 123c26675f5b5843b00df13ba7daa8a8236758a0 (patch) | |
tree | 220691b00900a368e39fdc66ebde57e26be6ea54 /engines | |
parent | f785068dc3fc0a485a78439d386c1bdf72d5d7e4 (diff) | |
download | scummvm-rg350-123c26675f5b5843b00df13ba7daa8a8236758a0.tar.gz scummvm-rg350-123c26675f5b5843b00df13ba7daa8a8236758a0.tar.bz2 scummvm-rg350-123c26675f5b5843b00df13ba7daa8a8236758a0.zip |
Another collision stuff change for Urban Runner. Now you can actually move! :)
svn-id: r35372
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/game.h | 2 | ||||
-rw-r--r-- | engines/gob/game_v6.cpp | 64 |
2 files changed, 66 insertions, 0 deletions
diff --git a/engines/gob/game.h b/engines/gob/game.h index 421f7c1de5..8a7c483bc0 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -324,6 +324,8 @@ protected: virtual int16 adjustKey(int16 key); + virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex); + void sub_1BA78(); }; diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index df5795fd20..0ba232677a 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -1059,6 +1059,70 @@ int16 Game_v6::adjustKey(int16 key) { return key & 0xFF; } +int16 Game_v6::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { + Collision *ptr; + int16 i; + + if (resId != 0) + *resId = 0; + + *resIndex = 0; + + ptr = _collisionAreas; + for (i = 0; ptr->left != 0xFFFF; ptr++, i++) { + if (ptr->id & 0x4000) + continue; + + if (all) { + if ((ptr->flags & 0xF) > 1) + continue; + + if ((ptr->flags & 0xF00) != 0) + continue; + + if ((_vm->_global->_inter_mouseX < ptr->left) || + (_vm->_global->_inter_mouseX > ptr->right) || + (_vm->_global->_inter_mouseY < ptr->top) || + (_vm->_global->_inter_mouseY > ptr->bottom)) + continue; + + if (resId != 0) + *resId = ptr->id; + + *resIndex = i; + return ptr->key; + } else { + if ((ptr->flags & 0xF00) != 0) + continue; + + if ((ptr->flags & 0xF) < 1) + continue; + + if ((((ptr->flags & 0x70) >> 4) != (_mouseButtons - 1)) && + (((ptr->flags & 0x70) >> 4) != 2)) + continue; + + if ((_vm->_global->_inter_mouseX < ptr->left) || + (_vm->_global->_inter_mouseX > ptr->right) || + (_vm->_global->_inter_mouseY < ptr->top) || + (_vm->_global->_inter_mouseY > ptr->bottom)) + continue; + + if (resId != 0) + *resId = ptr->id; + *resIndex = i; + if (((ptr->flags & 0xF) == 1) || ((ptr->flags & 0xF) == 2)) + return ptr->key; + return 0; + } + } + + if ((_mouseButtons != 1) && (all == 0)) + return 0x11B; + + return 0; +} + void Game_v6::sub_1BA78() { int16 lastCollAreaIndex = _lastCollAreaIndex; int16 lastCollId = _lastCollId; |