diff options
author | Eugene Sandulenko | 2009-06-06 17:47:29 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2009-06-06 17:47:29 +0000 |
commit | d6a4dbeb1d41d7d51e58822db9e4036fd1fbeeae (patch) | |
tree | 22b1d8595e0f90e7f3ebc22b212fcd87b07ef61b | |
parent | 8792628a465b56c1a11e24867c5a6979a0c7cc1f (diff) | |
download | scummvm-rg350-d6a4dbeb1d41d7d51e58822db9e4036fd1fbeeae.tar.gz scummvm-rg350-d6a4dbeb1d41d7d51e58822db9e4036fd1fbeeae.tar.bz2 scummvm-rg350-d6a4dbeb1d41d7d51e58822db9e4036fd1fbeeae.zip |
Implement fence.mouse opcode
svn-id: r41258
-rw-r--r-- | engines/agi/agi.cpp | 16 | ||||
-rw-r--r-- | engines/agi/agi.h | 10 | ||||
-rw-r--r-- | engines/agi/menu.cpp | 4 | ||||
-rw-r--r-- | engines/agi/menu.h | 2 | ||||
-rw-r--r-- | engines/agi/op_cmd.cpp | 19 |
5 files changed, 39 insertions, 12 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index cb49824f81..4431f5d0c4 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -103,6 +103,20 @@ void AgiEngine::processEvents() { case Common::EVENT_MOUSEMOVE: g_mouse.x = event.mouse.x; g_mouse.y = event.mouse.y; + + if (!_game.mouseFence.isEmpty()) { + if (g_mouse.x < _game.mouseFence.left) + g_mouse.x = _game.mouseFence.left; + if (g_mouse.x > _game.mouseFence.right) + g_mouse.x = _game.mouseFence.right; + if (g_mouse.y < _game.mouseFence.top) + g_mouse.y = _game.mouseFence.top; + if (g_mouse.y > _game.mouseFence.bottom) + g_mouse.y = _game.mouseFence.bottom; + + g_system->warpMouse(g_mouse.x, g_mouse.y); + } + break; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: @@ -473,6 +487,8 @@ int AgiEngine::agiInit() { _egoHoldKey = false; + _game.mouseFence.setWidth(0); // Reset + return ec; } diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 0f213e619e..09f732d980 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -211,8 +211,8 @@ struct gameIdList { struct Mouse { int button; - unsigned int x; - unsigned int y; + int x; + int y; }; // Used by AGI Mouse protocol 1.0 for v27 (i.e. button pressed -variable). @@ -591,9 +591,11 @@ struct AgiGame { // view table VtEntry viewTable[MAX_VIEWTABLE]; - int32 ver; /**< detected game version */ + int32 ver; /**< detected game version */ + + int simpleSave; /**< select simple savegames */ - int simpleSave; /**< select simple savegames */ + Common::Rect mouseFence; /**< rectangle set by fence.mouse command */ }; class AgiLoader { diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp index 8e7a59746b..fb39fb5a35 100644 --- a/engines/agi/menu.cpp +++ b/engines/agi/menu.cpp @@ -131,11 +131,11 @@ void Menu::newMenuSelected(int i) { drawMenuOption(i); } -bool Menu::mouseOverText(unsigned int line, unsigned int col, char *s) { +bool Menu::mouseOverText(int line, int col, char *s) { if (g_mouse.x < col * CHAR_COLS) return false; - if (g_mouse.x > (col + strlen(s)) * CHAR_COLS) + if (g_mouse.x > (int)(col + strlen(s)) * CHAR_COLS) return false; if (g_mouse.y < line * CHAR_LINES) diff --git a/engines/agi/menu.h b/engines/agi/menu.h index 69c7f7f3a8..43f6dd2bbd 100644 --- a/engines/agi/menu.h +++ b/engines/agi/menu.h @@ -80,7 +80,7 @@ private: void drawMenuOption(int hMenu); void drawMenuOptionHilite(int hMenu, int vMenu); void newMenuSelected(int i); - bool mouseOverText(unsigned int line, unsigned int col, char *s); + bool mouseOverText(int line, int col, char *s); }; diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index 8cd5a0d9ab..fdcc76826d 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -632,7 +632,9 @@ cmd(set_simple) { } cmd(pop_script) { - report("pop.script\n"); + if (g_agi->getVersion() >= 0x2915) { + report("pop.script\n"); + } } cmd(hold_key) { @@ -642,7 +644,9 @@ cmd(hold_key) { } cmd(discard_sound) { - report("discard.sound\n"); + if (g_agi->getVersion() >= 0x2936) { + report("discard.sound\n"); + } } cmd(hide_mouse) { @@ -669,7 +673,9 @@ cmd(show_mouse) { } cmd(fence_mouse) { - report("fence.mouse\n"); + g_agi->_game.mouseFence.moveTo(p0, p1); + g_agi->_game.mouseFence.setWidth(p2 - p0); + g_agi->_game.mouseFence.setHeight(p3 - p1); } cmd(release_key) { @@ -1512,8 +1518,11 @@ cmd(push_script) { game.vars[27] = g_mouse.button; game.vars[28] = g_mouse.x / 2; game.vars[29] = g_mouse.y; - } else - report("push.script\n"); + } else { + if (g_agi->getVersion() >= 0x2915) { + report("push.script\n"); + } + } } cmd(set_pri_base) { |