diff options
author | Max Horn | 2003-05-21 23:54:39 +0000 |
---|---|---|
committer | Max Horn | 2003-05-21 23:54:39 +0000 |
commit | b12d741ac118eabbdbe7e38383933e0337fc002a (patch) | |
tree | de59aafa6c5d73ce1ef77178530c083d80f7ff41 /scumm | |
parent | b958c0a0024e449ed897e22d37b670ddfb1f61da (diff) | |
download | scummvm-rg350-b12d741ac118eabbdbe7e38383933e0337fc002a.tar.gz scummvm-rg350-b12d741ac118eabbdbe7e38383933e0337fc002a.tar.bz2 scummvm-rg350-b12d741ac118eabbdbe7e38383933e0337fc002a.zip |
cleaned up V2 input code
svn-id: r7811
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/script.cpp | 12 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 19 | ||||
-rw-r--r-- | scumm/verbs.cpp | 15 |
3 files changed, 22 insertions, 24 deletions
diff --git a/scumm/script.cpp b/scumm/script.cpp index 54e044710b..e5e19f5857 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -869,10 +869,18 @@ void Scumm::runInputScript(int a, int cmd, int mode) { if (_features & GF_AFTER_V2) { verbScript = 4; - if (a == 1) // Verb clicked + _scummVars[VAR_CLICK_AREA] = a; + switch(a) { + case 1: // Verb clicked _scummVars[33] = cmd; - } else + break; + case 3: // Inventory clicked + _scummVars[35] = cmd; + break; + } + } else { verbScript = VAR(VAR_VERB_SCRIPT); + } memset(args, 0, sizeof(args)); args[0] = a; diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 5041e37918..a01fab18e1 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -1859,24 +1859,15 @@ int Scumm::getKeyInput() { VAR(VAR_LEFTBTN_HOLD) = (_leftBtnPressed & msDown) != 0; VAR(VAR_RIGHTBTN_HOLD) = (_rightBtnPressed & msDown) != 0; } else if (_features & GF_AFTER_V2) { - // Store the input type. So far we can't distinguise + // Store the input type. So far we can't distinguish // between 1, 3 and 5. // 1) Verb 2) Scene 3) Inv. 4) Key // 5) Sentence Bar - if (_mouseButStat & MBS_LEFT_CLICK) { - VirtScreen *zone = findVirtScreen(_mouse.y); - - if (zone->number == 0) // Clicked in scene - _scummVars[VAR_CLICK_AREA] = 2; - else if (zone->number == 2) { // Clicked in verb/sentence - if (_mouse.y > zone->topline + 32) - _scummVars[VAR_CLICK_AREA] = 3; // Inventory - else - _scummVars[VAR_CLICK_AREA] = 1; // Verb - } - } else if (_lastKeyHit) // Key Input - _scummVars[VAR_CLICK_AREA] = 4; + if (_lastKeyHit) { // Key Input + VAR(VAR_KEYPRESS) = _lastKeyHit; + runInputScript(4, 0, 0); + } } _leftBtnPressed &= ~msClicked; diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index 5de65a9e3a..cb9885f252 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -39,8 +39,7 @@ void Scumm::checkV2Inventory(int x, int y) { object = findInventory(_scummVars[VAR_EGO], object+1); if (object > 0) { - _scummVars[35] = object; - runScript(4, 0, 0, 0); + runInputScript(3, object, 0); } } @@ -80,14 +79,14 @@ void Scumm::redrawV2Inventory() { if (curInventoryCount > 0) { // Draw Up Arrow _string[1].xpos = 145; _string[1].ypos = virtscr[2].topline + 32; - _messagePtr = (const byte *)"U"; + _messagePtr = (const byte *)"\1\2"; drawString(1); } if (items == 4) { // Draw Down Arrow _string[1].xpos = 145; _string[1].ypos = virtscr[2].topline + 47; - _messagePtr = (const byte *)"D"; + _messagePtr = (const byte *)"\3\4"; drawString(1); } } @@ -124,14 +123,17 @@ void Scumm::checkExecVerbs() { } runInputScript(4, _mouseButStat, 1); } else if (_mouseButStat & MBS_MOUSE_MASK) { + VirtScreen *zone = findVirtScreen(_mouse.y); byte code = _mouseButStat & MBS_LEFT_CLICK ? 1 : 2; - if (_mouse.y >= virtscr[0].topline && _mouse.y < virtscr[0].topline + virtscr[0].height) { + if (zone->number == 0) { over = checkMouseOver(_mouse.x, _mouse.y); if (over != 0) { runInputScript(1, _verbs[over].verbid, code); return; } runInputScript(2, 0, code); + } else if (_features & GF_AFTER_V2 && zone->number == 2 && _mouse.y > zone->topline + 32) { + checkV2Inventory(_mouse.x, _mouse.y); } else { over = checkMouseOver(_mouse.x, _mouse.y); @@ -179,9 +181,6 @@ int Scumm::checkMouseOver(int x, int y) { return i; } while (--vs, --i); - if (_features & GF_AFTER_V2) - checkV2Inventory(x, y); - return 0; } |