int KyraEngine_v2::o2_trySceneChange(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_trySceneChange(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); _unkHandleSceneChangeFlag = 1; int success = inputSceneChange(stackPos(0), stackPos(1), stackPos(2), stackPos(3)); _unkHandleSceneChangeFlag = 0; if (success) { _emc->init(script, script->dataPtr); _unk4 = 0; _savedMouseState = -1; _unk5 = 1; return 0; } else { return (_unk4 != 0) ? 1 : 0; } }
void KyraEngine_HoF::handleInput(int x, int y) { setNextIdleAnimTimer(); if (_unk5) { _unk5 = 0; return; } if (!_screen->isMouseVisible()) return; if (_savedMouseState == -2) { snd_playSoundEffect(13); return; } setNextIdleAnimTimer(); if (x <= 6 || x >= 312 || y <= 6 || y >= 135) { bool exitOk = false; assert(_savedMouseState + 6 >= 0); switch (_savedMouseState + 6) { case 0: if (_sceneExit1 != 0xFFFF) exitOk = true; break; case 1: if (_sceneExit2 != 0xFFFF) exitOk = true; break; case 2: if (_sceneExit3 != 0xFFFF) exitOk = true; break; case 3: if (_sceneExit4 != 0xFFFF) exitOk = true; break; default: break; } if (exitOk) { inputSceneChange(x, y, 1, 1); return; } } if (checkCharCollision(x, y) && _savedMouseState >= -1) { runSceneScript2(); return; } else if (pickUpItem(x, y)) { return; } else { int skipHandling = 0; if (checkItemCollision(x, y) == -1) { resetGameFlag(0x1EF); skipHandling = handleInputUnkSub(x, y) ? 1 : 0; if (queryGameFlag(0x1EF)) { resetGameFlag(0x1EF); return; } if (_unk5) { _unk5 = 0; return; } } if (_deathHandler > -1) skipHandling = 1; if (skipHandling) return; if (checkCharCollision(x, y)) { runSceneScript2(); return; } if (_itemInHand >= 0) { if (y > 136) return; dropItem(0, _itemInHand, x, y, 1); } else { if (_savedMouseState == -2 || y > 135) return; if (!_unk5) { inputSceneChange(x, y, 1, 1); return; } _unk5 = 0; } } }
void KyraEngine_MR::handleInput(int x, int y) { if (_inventoryState) return; setNextIdleAnimTimer(); if (_unk5) { _unk5 = 0; return; } if (!_screen->isMouseVisible()) return; if (_savedMouseState == -3) { snd_playSoundEffect(0x0D, 0x80); return; } setNextIdleAnimTimer(); int skip = 0; if (checkCharCollision(x, y) && _savedMouseState >= -1 && runSceneScript2()) { return; } else if (_itemInHand != 27 && pickUpItem(x, y, 1)) { return; } else if (checkItemCollision(x, y) == -1) { resetGameFlag(1); skip = runSceneScript1(x, y); if (queryGameFlag(1)) { resetGameFlag(1); return; } else if (_unk5) { _unk5 = 0; return; } } if (_deathHandler >= 0) skip = 1; if (skip) return; if (checkCharCollision(x, y)) { if (runSceneScript2()) return; } else if (_itemInHand >= 0 && _savedMouseState >= 0) { if (_itemInHand == 27) { makeCharFacingMouse(); } else if (y <= 187) { if (_itemInHand == 43) removeHandItem(); else dropItem(0, _itemInHand, x, y, 1); } return; } else if (_savedMouseState == -3) { return; } else { if (y > 187 && _savedMouseState > -4) return; if (_unk5) { _unk5 = 0; return; } } inputSceneChange(x, y, 1, 1); }