From c393144b19dc5bd5e7e1c4d28ab56bc0b0affa38 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 6 Jun 2009 17:46:19 +0000 Subject: [PATCH] Implement hold.key and release.key opcodes svn-id: r41255 --- engines/agi/agi.cpp | 7 +++++++ engines/agi/agi.h | 3 +++ engines/agi/op_cmd.cpp | 8 ++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 7a4c489554e..cb49824f816 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -246,6 +246,11 @@ void AgiEngine::processEvents() { if (key) keyEnqueue(key); break; + + case Common::EVENT_KEYUP: + if (_egoHoldKey) + _game.viewTable[0].direction = 0; + default: break; } @@ -466,6 +471,8 @@ int AgiEngine::agiInit() { loadDict(); #endif + _egoHoldKey = false; + return ec; } diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 6b52151a56f..0f213e619e0 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -940,6 +940,7 @@ private: void motionFollowEgo(VtEntry *v); void motionMoveObj(VtEntry *v); void checkMotion(VtEntry *v); + public: void checkAllMotions(); void moveObj(VtEntry *); @@ -948,6 +949,8 @@ public: void updatePosition(); int getDirection(int x0, int y0, int x, int y, int s); + bool _egoHoldKey; + // Keyboard void initWords(); void cleanInput(); diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index 5c04eb3c846..826caff60c1 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -636,7 +636,9 @@ cmd(pop_script) { } cmd(hold_key) { - report("hold.key\n"); + if (g_agi->getVersion() >= 0x3098) { + g_agi->_egoHoldKey = true; + } } cmd(discard_sound) { @@ -671,7 +673,9 @@ cmd(fence_mouse) { } cmd(release_key) { - report("release.key\n"); + if (g_agi->getVersion() >= 0x3098) { + g_agi->_egoHoldKey = false; + } } cmd(adj_ego_move_to_x_y) {