2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-10-20 02:10:51 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 01:34:17 +00:00
|
|
|
*
|
2006-10-20 02:10:51 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-02-18 01:34:17 +00:00
|
|
|
*
|
2006-10-20 02:10:51 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-06-10 05:43:56 +00:00
|
|
|
#include "common/config-manager.h"
|
2006-10-20 02:10:51 +00:00
|
|
|
#include "common/file.h"
|
|
|
|
|
|
|
|
#include "agos/intern.h"
|
|
|
|
#include "agos/agos.h"
|
2011-08-05 10:16:03 +00:00
|
|
|
#include "agos/midi.h"
|
2006-10-20 02:10:51 +00:00
|
|
|
#include "agos/vga.h"
|
|
|
|
|
|
|
|
namespace AGOS {
|
|
|
|
|
2006-10-22 07:43:11 +00:00
|
|
|
uint AGOSEngine::setVerbText(HitArea *ha) {
|
|
|
|
uint id = 0xFFFF;
|
|
|
|
|
|
|
|
if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
|
|
|
|
return id;
|
|
|
|
|
|
|
|
if (ha->flags & kBFTextBox) {
|
|
|
|
if (getGameType() == GType_PP)
|
|
|
|
id = ha->id;
|
2007-05-17 09:00:14 +00:00
|
|
|
else if (getGameType() == GType_FF && (ha->flags & kBFHyperBox))
|
2006-10-22 07:43:11 +00:00
|
|
|
id = ha->data;
|
|
|
|
else
|
|
|
|
id = ha->flags / 256;
|
|
|
|
}
|
|
|
|
if (getGameType() == GType_PP)
|
|
|
|
_variableArray[199] = id;
|
|
|
|
else if (getGameType() == GType_WW)
|
|
|
|
_variableArray[10] = id;
|
|
|
|
else
|
|
|
|
_variableArray[60] = id;
|
|
|
|
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2006-10-20 02:10:51 +00:00
|
|
|
void AGOSEngine::setup_cond_c_helper() {
|
|
|
|
HitArea *last;
|
|
|
|
|
|
|
|
_noRightClick = 1;
|
|
|
|
|
|
|
|
if (getGameType() == GType_WW)
|
|
|
|
clearMenuStrip();
|
|
|
|
|
|
|
|
if (getGameType() == GType_FF) {
|
|
|
|
int cursor = 5;
|
|
|
|
int animMax = 16;
|
|
|
|
|
|
|
|
if (getBitFlag(200)) {
|
|
|
|
cursor = 11;
|
|
|
|
animMax = 5;
|
|
|
|
} else if (getBitFlag(201)) {
|
|
|
|
cursor = 12;
|
|
|
|
animMax = 5;
|
|
|
|
} else if (getBitFlag(202)) {
|
|
|
|
cursor = 13;
|
|
|
|
animMax = 5;
|
|
|
|
} else if (getBitFlag(203)) {
|
|
|
|
cursor = 14;
|
|
|
|
animMax = 9;
|
|
|
|
} else if (getBitFlag(205)) {
|
|
|
|
cursor = 17;
|
|
|
|
animMax = 11;
|
|
|
|
} else if (getBitFlag(206)) {
|
|
|
|
cursor = 16;
|
|
|
|
animMax = 2;
|
|
|
|
} else if (getBitFlag(208)) {
|
|
|
|
cursor = 26;
|
|
|
|
animMax = 2;
|
|
|
|
} else if (getBitFlag(209)) {
|
|
|
|
cursor = 27;
|
|
|
|
animMax = 9;
|
|
|
|
} else if (getBitFlag(210)) {
|
|
|
|
cursor = 28;
|
|
|
|
animMax = 9;
|
|
|
|
}
|
|
|
|
|
2010-07-04 07:32:12 +00:00
|
|
|
_animatePointer = false;
|
2006-10-20 02:10:51 +00:00
|
|
|
_mouseCursor = cursor;
|
|
|
|
_mouseAnimMax = animMax;
|
|
|
|
_mouseAnim = 1;
|
|
|
|
_needHitAreaRecalc++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (getGameType() == GType_SIMON2) {
|
|
|
|
_mouseCursor = 0;
|
|
|
|
if (_defaultVerb != 999) {
|
|
|
|
_mouseCursor = 9;
|
|
|
|
_needHitAreaRecalc++;
|
|
|
|
_defaultVerb = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_lastHitArea = 0;
|
|
|
|
_hitAreaObjectItem = NULL;
|
2009-03-09 04:16:27 +00:00
|
|
|
_nameLocked = false;
|
2006-10-20 02:10:51 +00:00
|
|
|
|
|
|
|
last = _lastNameOn;
|
|
|
|
clearName();
|
|
|
|
_lastNameOn = last;
|
|
|
|
|
2008-09-30 12:27:38 +00:00
|
|
|
while (!shouldQuit()) {
|
2006-10-20 02:10:51 +00:00
|
|
|
_lastHitArea = NULL;
|
|
|
|
_lastHitArea3 = 0;
|
2009-03-09 03:45:33 +00:00
|
|
|
_leftButtonDown = false;
|
2006-10-20 02:10:51 +00:00
|
|
|
|
|
|
|
do {
|
|
|
|
if (_exitCutscene && getBitFlag(9)) {
|
|
|
|
endCutscene();
|
|
|
|
goto out_of_here;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (getGameType() == GType_FF) {
|
|
|
|
if (_variableArray[254] == 63) {
|
|
|
|
hitarea_stuff_helper_2();
|
|
|
|
} else if (_variableArray[254] == 75) {
|
|
|
|
hitarea_stuff_helper_2();
|
|
|
|
_variableArray[60] = 9999;
|
|
|
|
goto out_of_here;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delay(100);
|
2008-09-30 12:27:38 +00:00
|
|
|
} while ((_lastHitArea3 == (HitArea *) -1 || _lastHitArea3 == 0) && !shouldQuit());
|
2006-10-20 02:10:51 +00:00
|
|
|
|
|
|
|
if (_lastHitArea == NULL) {
|
|
|
|
} else if (_lastHitArea->id == 0x7FFB) {
|
|
|
|
inventoryUp(_lastHitArea->window);
|
|
|
|
} else if (_lastHitArea->id == 0x7FFC) {
|
|
|
|
inventoryDown(_lastHitArea->window);
|
2009-02-07 01:11:51 +00:00
|
|
|
} else if (_lastHitArea->itemPtr != NULL) {
|
|
|
|
_hitAreaObjectItem = _lastHitArea->itemPtr;
|
2006-10-22 07:43:11 +00:00
|
|
|
setVerbText(_lastHitArea);
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out_of_here:
|
|
|
|
_lastHitArea3 = 0;
|
|
|
|
_lastHitArea = 0;
|
|
|
|
_lastNameOn = NULL;
|
2007-05-17 09:00:14 +00:00
|
|
|
|
2006-10-20 02:10:51 +00:00
|
|
|
_mouseCursor = 0;
|
|
|
|
_noRightClick = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::waitForInput() {
|
|
|
|
HitArea *ha;
|
|
|
|
uint id;
|
|
|
|
|
2009-03-09 03:45:33 +00:00
|
|
|
_leftButtonDown = false;
|
2006-10-20 02:10:51 +00:00
|
|
|
_lastHitArea = 0;
|
2006-10-24 07:44:37 +00:00
|
|
|
//_lastClickRem = 0;
|
2006-10-20 02:10:51 +00:00
|
|
|
_verbHitArea = 0;
|
|
|
|
_hitAreaSubjectItem = NULL;
|
|
|
|
_hitAreaObjectItem = NULL;
|
2009-03-09 04:16:27 +00:00
|
|
|
_clickOnly = false;
|
|
|
|
_nameLocked = false;
|
2006-10-20 02:10:51 +00:00
|
|
|
|
|
|
|
if (getGameType() == GType_WW) {
|
|
|
|
_mouseCursor = 0;
|
|
|
|
_needHitAreaRecalc++;
|
|
|
|
clearMenuStrip();
|
|
|
|
} else {
|
|
|
|
resetVerbs();
|
|
|
|
}
|
|
|
|
|
2008-09-30 12:27:38 +00:00
|
|
|
while (!shouldQuit()) {
|
2006-10-20 02:10:51 +00:00
|
|
|
_lastHitArea = NULL;
|
|
|
|
_lastHitArea3 = NULL;
|
2009-03-09 04:16:27 +00:00
|
|
|
_dragAccept = true;
|
2006-10-20 02:10:51 +00:00
|
|
|
|
2008-09-30 12:27:38 +00:00
|
|
|
while (!shouldQuit()) {
|
2007-06-30 22:21:29 +00:00
|
|
|
if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
|
2007-07-23 12:32:08 +00:00
|
|
|
_keyPressed.keycode == Common::KEYCODE_F10)
|
2006-10-20 02:10:51 +00:00
|
|
|
displayBoxStars();
|
2007-05-17 09:00:14 +00:00
|
|
|
if (processSpecialKeys()) {
|
2009-04-20 10:07:18 +00:00
|
|
|
if (getGameId() != GID_DIMP)
|
2006-10-22 00:55:17 +00:00
|
|
|
goto out_of_here;
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
2007-03-18 17:55:11 +00:00
|
|
|
if (_lastHitArea3 == (HitArea *) -1) {
|
|
|
|
_lastHitArea = NULL;
|
|
|
|
_lastHitArea3 = NULL;
|
2009-03-09 04:16:27 +00:00
|
|
|
_dragAccept = true;
|
2007-03-18 17:55:11 +00:00
|
|
|
} else {
|
2007-05-17 09:00:14 +00:00
|
|
|
if (_lastHitArea3 || _dragMode)
|
2007-03-18 17:55:11 +00:00
|
|
|
break;
|
|
|
|
hitarea_stuff_helper();
|
|
|
|
delay(100);
|
|
|
|
}
|
2007-03-18 14:33:13 +00:00
|
|
|
}
|
|
|
|
|
2007-05-17 09:00:14 +00:00
|
|
|
if (!_lastHitArea3 && _dragMode) {
|
2007-03-18 14:33:13 +00:00
|
|
|
ha = _lastClickRem;
|
2007-03-18 13:53:51 +00:00
|
|
|
|
2009-02-07 01:11:51 +00:00
|
|
|
if (ha == 0 || ha->itemPtr == NULL || !(ha->flags & kBFDragBox)) {
|
2009-03-09 04:16:27 +00:00
|
|
|
_dragFlag = false;
|
|
|
|
_dragMode = false;
|
2007-03-18 14:33:13 +00:00
|
|
|
_dragCount = 0;
|
2009-03-09 04:16:27 +00:00
|
|
|
_dragEnd = false;
|
2007-03-18 17:55:11 +00:00
|
|
|
continue;
|
2007-03-18 14:33:13 +00:00
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2009-02-07 01:11:51 +00:00
|
|
|
_hitAreaSubjectItem = ha->itemPtr;
|
2007-03-18 14:33:13 +00:00
|
|
|
_verbHitArea = 500;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-03-18 14:33:13 +00:00
|
|
|
do {
|
|
|
|
processSpecialKeys();
|
|
|
|
hitarea_stuff_helper();
|
|
|
|
delay(100);
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2009-03-09 04:16:27 +00:00
|
|
|
if (!_dragFlag) {
|
|
|
|
_dragFlag = false;
|
|
|
|
_dragMode = false;
|
2007-03-18 13:53:51 +00:00
|
|
|
_dragCount = 0;
|
2009-03-09 04:16:27 +00:00
|
|
|
_dragEnd = false;
|
2007-03-18 13:53:51 +00:00
|
|
|
}
|
2007-03-18 14:33:13 +00:00
|
|
|
} while (!_dragEnd);
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2009-03-09 04:16:27 +00:00
|
|
|
_dragFlag = false;
|
|
|
|
_dragMode = false;
|
2007-03-18 14:33:13 +00:00
|
|
|
_dragCount = 0;
|
2009-03-09 04:16:27 +00:00
|
|
|
_dragEnd = false;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-03-18 14:33:13 +00:00
|
|
|
boxController(_mouse.x, _mouse.y, 1);
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-03-18 14:33:13 +00:00
|
|
|
if (_currentBox != NULL) {
|
2009-02-07 01:11:51 +00:00
|
|
|
_hitAreaObjectItem = _currentBox->itemPtr;
|
2009-02-11 12:24:38 +00:00
|
|
|
setVerbText(_currentBox);
|
2007-03-18 13:53:51 +00:00
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-03-18 17:55:11 +00:00
|
|
|
break;
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ha = _lastHitArea;
|
2007-05-17 09:00:14 +00:00
|
|
|
if (ha == NULL) {
|
|
|
|
} else if (ha->id == 0x7FFB) {
|
2006-10-20 02:10:51 +00:00
|
|
|
inventoryUp(ha->window);
|
|
|
|
} else if (ha->id == 0x7FFC) {
|
|
|
|
inventoryDown(ha->window);
|
|
|
|
} else if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
|
|
|
|
(ha->id >= 101 && ha->id < 113)) {
|
|
|
|
_verbHitArea = ha->verb;
|
|
|
|
setVerb(ha);
|
|
|
|
_defaultVerb = 0;
|
|
|
|
} else {
|
|
|
|
if (getGameType() == GType_WW) {
|
|
|
|
if (_mouseCursor == 3)
|
|
|
|
_verbHitArea = 236;
|
|
|
|
|
|
|
|
if (ha->id == 98) {
|
2007-06-19 11:50:22 +00:00
|
|
|
animate(2, 1, 110, 0, 0, 0);
|
2006-10-20 02:10:51 +00:00
|
|
|
waitForSync(34);
|
|
|
|
} else if (ha->id == 108) {
|
2007-06-19 11:50:22 +00:00
|
|
|
animate(2, 1, 106, 0, 0, 0);
|
2006-10-20 02:10:51 +00:00
|
|
|
waitForSync(34);
|
|
|
|
} else if (ha->id == 109) {
|
2007-06-19 11:50:22 +00:00
|
|
|
animate(2, 1, 107, 0, 0, 0);
|
2006-10-20 02:10:51 +00:00
|
|
|
waitForSync(34);
|
|
|
|
} else if (ha->id == 115) {
|
2007-06-19 11:50:22 +00:00
|
|
|
animate(2, 1, 109, 0, 0, 0);
|
2006-10-20 02:10:51 +00:00
|
|
|
waitForSync(34);
|
|
|
|
} else if (ha->id == 116) {
|
2007-06-19 11:50:22 +00:00
|
|
|
animate(2, 1, 113, 0, 0, 0);
|
2006-10-20 02:10:51 +00:00
|
|
|
waitForSync(34);
|
|
|
|
} else if (ha->id == 117) {
|
2007-06-19 11:50:22 +00:00
|
|
|
animate(2, 1, 112, 0, 0, 0);
|
2006-10-20 02:10:51 +00:00
|
|
|
waitForSync(34);
|
|
|
|
} else if (ha->id == 118) {
|
2007-06-19 11:50:22 +00:00
|
|
|
animate(2, 1, 108, 0, 0, 0);
|
2006-10-20 02:10:51 +00:00
|
|
|
waitForSync(34);
|
|
|
|
} else if (ha->id == 119) {
|
2007-06-19 11:50:22 +00:00
|
|
|
animate(2, 1, 111, 0, 0, 0);
|
2006-10-20 02:10:51 +00:00
|
|
|
waitForSync(34);
|
|
|
|
}
|
|
|
|
}
|
2009-02-07 01:11:51 +00:00
|
|
|
if (ha->itemPtr && (!ha->verb || _verbHitArea ||
|
|
|
|
(_hitAreaSubjectItem != ha->itemPtr && (ha->flags & kBFBoxItem)))
|
2007-03-18 17:55:11 +00:00
|
|
|
) {
|
2009-02-07 01:11:51 +00:00
|
|
|
_hitAreaSubjectItem = ha->itemPtr;
|
2006-10-22 07:43:11 +00:00
|
|
|
id = setVerbText(ha);
|
2009-03-09 04:16:27 +00:00
|
|
|
_nameLocked = false;
|
2006-10-20 02:10:51 +00:00
|
|
|
displayName(ha);
|
2009-03-09 04:16:27 +00:00
|
|
|
_nameLocked = true;
|
2006-10-20 02:10:51 +00:00
|
|
|
|
2007-05-17 09:00:14 +00:00
|
|
|
if (_verbHitArea) {
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-10-24 07:44:37 +00:00
|
|
|
if (getGameType() == GType_WW)
|
2009-02-07 01:11:51 +00:00
|
|
|
doMenuStrip(menuFor_ww(ha->itemPtr, id));
|
2006-10-24 07:44:37 +00:00
|
|
|
else if (getGameType() == GType_ELVIRA2)
|
2009-02-07 01:11:51 +00:00
|
|
|
doMenuStrip(menuFor_e2(ha->itemPtr));
|
2006-10-24 07:44:37 +00:00
|
|
|
else if (getGameType() == GType_ELVIRA1)
|
2009-02-07 01:11:51 +00:00
|
|
|
lightMenuStrip(getUserFlag1(ha->itemPtr, 6));
|
2006-10-20 02:10:51 +00:00
|
|
|
} else {
|
2007-05-17 09:00:14 +00:00
|
|
|
if (ha->verb) {
|
|
|
|
if (getGameType() == GType_WW && _mouseCursor && _mouseCursor < 4) {
|
2009-02-07 01:11:51 +00:00
|
|
|
_hitAreaSubjectItem = ha->itemPtr;
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
_verbHitArea = ha->verb & 0xBFFF;
|
|
|
|
if (ha->verb & 0x4000) {
|
2009-02-07 01:11:51 +00:00
|
|
|
_hitAreaSubjectItem = ha->itemPtr;
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (_hitAreaSubjectItem != NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (getGameType() == GType_WW) {
|
|
|
|
if (ha->id == 109) {
|
|
|
|
_mouseCursor = 2;
|
|
|
|
_needHitAreaRecalc++;
|
|
|
|
} else if (ha->id == 117) {
|
|
|
|
_mouseCursor = 3;
|
|
|
|
_needHitAreaRecalc++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out_of_here:
|
|
|
|
if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
|
|
|
|
clearMenuStrip();
|
2006-10-24 07:44:37 +00:00
|
|
|
else if (getGameType() == GType_ELVIRA1)
|
|
|
|
unlightMenuStrip();
|
2006-10-20 02:10:51 +00:00
|
|
|
|
2009-03-09 04:16:27 +00:00
|
|
|
_nameLocked = false;
|
2006-10-20 02:10:51 +00:00
|
|
|
_needHitAreaRecalc++;
|
2009-03-09 04:16:27 +00:00
|
|
|
_dragAccept = false;
|
2006-10-22 13:04:34 +00:00
|
|
|
|
|
|
|
if (getGameType() == GType_WW && _mouseCursor < 3)
|
|
|
|
_mouseCursor = 0;
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::hitarea_stuff_helper() {
|
|
|
|
if (getGameType() == GType_SIMON2 || getGameType() == GType_FF ||
|
|
|
|
getGameType() == GType_PP) {
|
|
|
|
if (_variableArray[254] || _variableArray[249]) {
|
|
|
|
hitarea_stuff_helper_2();
|
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
} else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW ||
|
2006-10-20 02:10:51 +00:00
|
|
|
getGameType() == GType_SIMON1) {
|
|
|
|
uint subr_id = (uint16)_variableArray[254];
|
2007-05-17 09:00:14 +00:00
|
|
|
if (subr_id) {
|
2006-10-20 02:10:51 +00:00
|
|
|
Subroutine *sub = getSubroutineByID(subr_id);
|
|
|
|
if (sub != NULL) {
|
|
|
|
startSubroutineEx(sub);
|
|
|
|
permitInput();
|
|
|
|
}
|
|
|
|
_variableArray[254] = 0;
|
|
|
|
_runScriptReturn1 = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-20 09:43:46 +00:00
|
|
|
uint32 cur_time = getTime();
|
|
|
|
if (cur_time != _lastTime) {
|
2006-10-20 02:10:51 +00:00
|
|
|
_lastTime = cur_time;
|
|
|
|
if (kickoffTimeEvents())
|
|
|
|
permitInput();
|
|
|
|
}
|
2007-05-17 07:23:56 +00:00
|
|
|
|
|
|
|
if (getGameId() == GID_DIMP)
|
|
|
|
delay(200);
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::hitarea_stuff_helper_2() {
|
|
|
|
uint subr_id;
|
|
|
|
Subroutine *sub;
|
|
|
|
|
|
|
|
subr_id = (uint16)_variableArray[249];
|
2007-05-17 09:00:14 +00:00
|
|
|
if (subr_id) {
|
2006-10-20 02:10:51 +00:00
|
|
|
sub = getSubroutineByID(subr_id);
|
|
|
|
if (sub != NULL) {
|
|
|
|
_variableArray[249] = 0;
|
|
|
|
startSubroutineEx(sub);
|
|
|
|
permitInput();
|
|
|
|
}
|
|
|
|
_variableArray[249] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
subr_id = (uint16)_variableArray[254];
|
2007-05-17 09:00:14 +00:00
|
|
|
if (subr_id) {
|
2006-10-20 02:10:51 +00:00
|
|
|
sub = getSubroutineByID(subr_id);
|
|
|
|
if (sub != NULL) {
|
|
|
|
_variableArray[254] = 0;
|
|
|
|
startSubroutineEx(sub);
|
|
|
|
permitInput();
|
|
|
|
}
|
|
|
|
_variableArray[254] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
_runScriptReturn1 = false;
|
|
|
|
}
|
|
|
|
|
2014-03-02 11:19:32 +00:00
|
|
|
#ifdef ENABLE_AGOS2
|
|
|
|
void AGOSEngine_Feeble::handleMouseWheelUp() {
|
2014-03-04 00:20:01 +00:00
|
|
|
if (!(getBitFlag(99)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (_mouse.x >= 128 && _mouse.x <= 515 && _mouse.y >= 102 && _mouse.y <= 206) {
|
|
|
|
oracleTextDown();
|
|
|
|
} else if (_mouse.x >= 172 && _mouse.x <= 469 && _mouse.y >= 287 && _mouse.y <= 382) {
|
|
|
|
HitArea *ha = findBox(0x7FFB);
|
|
|
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
|
|
|
if (!isSpriteLoaded(21, 9))
|
|
|
|
inventoryUp(ha->window);
|
|
|
|
}
|
|
|
|
}
|
2014-03-02 11:19:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine_Feeble::handleMouseWheelDown() {
|
2014-03-04 00:20:01 +00:00
|
|
|
if (!(getBitFlag(99)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (_mouse.x >= 128 && _mouse.x <= 515 && _mouse.y >= 102 && _mouse.y <= 206) {
|
|
|
|
oracleTextUp();
|
|
|
|
} else if (_mouse.x >= 172 && _mouse.x <= 469 && _mouse.y >= 287 && _mouse.y <= 382) {
|
|
|
|
HitArea *ha = findBox(0x7FFC);
|
|
|
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
|
|
|
if (!isSpriteLoaded(23, 9))
|
|
|
|
inventoryDown(ha->window);
|
|
|
|
}
|
|
|
|
}
|
2014-03-02 11:19:32 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void AGOSEngine_Simon1::handleMouseWheelUp() {
|
|
|
|
HitArea *ha = findBox(206);
|
|
|
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
|
|
|
if (_saveLoadRowCurPos != 1) {
|
|
|
|
if (_saveLoadRowCurPos < 7)
|
|
|
|
_saveLoadRowCurPos = 1;
|
|
|
|
else
|
|
|
|
_saveLoadRowCurPos -= 1;
|
|
|
|
|
|
|
|
_saveLoadEdit = false;
|
|
|
|
listSaveGames();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
AGOSEngine::handleMouseWheelUp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine_Simon1::handleMouseWheelDown() {
|
|
|
|
HitArea *ha = findBox(207);
|
|
|
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
|
|
|
if (_saveDialogFlag) {
|
|
|
|
_saveLoadRowCurPos += 1;
|
|
|
|
if (_saveLoadRowCurPos >= _numSaveGameRows)
|
|
|
|
_saveLoadRowCurPos = _numSaveGameRows;
|
|
|
|
|
|
|
|
_saveLoadEdit = false;
|
|
|
|
listSaveGames();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
AGOSEngine::handleMouseWheelDown();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine_Elvira2::handleMouseWheelUp() {
|
|
|
|
HitArea *ha = findBox(224);
|
|
|
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
|
|
|
_saveGameNameLen = 0;
|
|
|
|
|
|
|
|
if (_saveLoadRowCurPos < 3)
|
|
|
|
_saveLoadRowCurPos = 1;
|
|
|
|
else
|
|
|
|
_saveLoadRowCurPos -= 3;
|
|
|
|
|
|
|
|
listSaveGames();
|
|
|
|
} else {
|
|
|
|
AGOSEngine::handleMouseWheelUp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine_Elvira2::handleMouseWheelDown() {
|
|
|
|
HitArea *ha = findBox(224);
|
|
|
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
|
|
|
_saveGameNameLen = 0;
|
|
|
|
_saveLoadRowCurPos += 3;
|
|
|
|
if (_saveLoadRowCurPos >= _numSaveGameRows)
|
|
|
|
_saveLoadRowCurPos = 1;
|
|
|
|
|
|
|
|
listSaveGames();
|
|
|
|
} else {
|
|
|
|
AGOSEngine::handleMouseWheelDown();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::handleMouseWheelUp() {
|
|
|
|
HitArea *ha = findBox(0x7FFB);
|
|
|
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
|
|
|
inventoryUp(ha->window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::handleMouseWheelDown() {
|
|
|
|
HitArea *ha = findBox(0x7FFC);
|
|
|
|
if (ha != NULL && (ha->flags & kBFBoxInUse)) {
|
|
|
|
inventoryDown(ha->window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-20 02:10:51 +00:00
|
|
|
void AGOSEngine::permitInput() {
|
2008-12-13 04:52:51 +00:00
|
|
|
if (_mortalFlag)
|
2006-11-15 13:11:53 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
_mortalFlag = true;
|
|
|
|
justifyOutPut(0);
|
|
|
|
|
|
|
|
if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
|
|
|
|
int n = 0;
|
|
|
|
while (n < 8) {
|
|
|
|
if ((_fcsData1[n]) && (_windowArray[n]) && (_windowArray[n]->flags & 128)) {
|
|
|
|
_textWindow = _windowArray[n];
|
|
|
|
waitWindow(_textWindow);
|
|
|
|
clsCheck(_textWindow);
|
|
|
|
}
|
|
|
|
_fcsData1[n]=0;
|
|
|
|
n++;
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
2006-11-15 13:11:53 +00:00
|
|
|
|
|
|
|
restartAnimation();
|
|
|
|
}
|
|
|
|
|
|
|
|
_curWindow = 0;
|
2007-05-17 09:00:14 +00:00
|
|
|
if (_windowArray[0]) {
|
2006-11-15 13:11:53 +00:00
|
|
|
_textWindow = _windowArray[0];
|
|
|
|
justifyStart();
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
2006-11-15 13:11:53 +00:00
|
|
|
_mortalFlag = false;
|
|
|
|
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool AGOSEngine::processSpecialKeys() {
|
2007-01-03 11:40:39 +00:00
|
|
|
bool verbCode = false;
|
|
|
|
|
2007-05-17 07:23:56 +00:00
|
|
|
if (getGameId() == GID_DIMP) {
|
2007-12-20 09:43:46 +00:00
|
|
|
uint32 t1 = getTime() / 30;
|
|
|
|
if (!_lastMinute)
|
|
|
|
_lastMinute = t1;
|
|
|
|
if (t1 - _lastMinute) {
|
|
|
|
_variableArray[120] += (t1 - _lastMinute);
|
|
|
|
_lastMinute = t1;
|
2007-05-17 07:23:56 +00:00
|
|
|
}
|
|
|
|
}
|
2009-05-24 15:17:42 +00:00
|
|
|
|
2009-01-27 00:38:56 +00:00
|
|
|
if (shouldQuit())
|
2009-05-24 15:17:42 +00:00
|
|
|
_exitCutscene = true;
|
2007-05-17 07:23:56 +00:00
|
|
|
|
2007-06-30 22:21:29 +00:00
|
|
|
switch (_keyPressed.keycode) {
|
|
|
|
case Common::KEYCODE_UP:
|
2006-10-20 02:10:51 +00:00
|
|
|
if (getGameType() == GType_PP)
|
|
|
|
_verbHitArea = 302;
|
|
|
|
else if (getGameType() == GType_WW)
|
|
|
|
_verbHitArea = 239;
|
2009-04-20 10:07:18 +00:00
|
|
|
else if (getGameType() == GType_ELVIRA2 && isBoxDead(101))
|
|
|
|
_verbHitArea = 200;
|
|
|
|
else if (getGameType() == GType_ELVIRA1 && isBoxDead(101))
|
|
|
|
_verbHitArea = 214;
|
2007-01-03 11:40:39 +00:00
|
|
|
verbCode = true;
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_DOWN:
|
2006-10-20 02:10:51 +00:00
|
|
|
if (getGameType() == GType_PP)
|
|
|
|
_verbHitArea = 304;
|
|
|
|
else if (getGameType() == GType_WW)
|
|
|
|
_verbHitArea = 241;
|
2009-04-20 10:07:18 +00:00
|
|
|
else if (getGameType() == GType_ELVIRA2 && isBoxDead(107))
|
|
|
|
_verbHitArea = 202;
|
|
|
|
else if (getGameType() == GType_ELVIRA1 && isBoxDead(105))
|
|
|
|
_verbHitArea = 215;
|
2007-01-03 11:40:39 +00:00
|
|
|
verbCode = true;
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_RIGHT:
|
2006-10-20 02:10:51 +00:00
|
|
|
if (getGameType() == GType_PP)
|
|
|
|
_verbHitArea = 303;
|
|
|
|
else if (getGameType() == GType_WW)
|
|
|
|
_verbHitArea = 240;
|
2009-04-20 10:07:18 +00:00
|
|
|
else if (getGameType() == GType_ELVIRA2 && isBoxDead(102))
|
|
|
|
_verbHitArea = 201;
|
|
|
|
else if (getGameType() == GType_ELVIRA1 && isBoxDead(103))
|
|
|
|
_verbHitArea = 216;
|
2007-01-03 11:40:39 +00:00
|
|
|
verbCode = true;
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_LEFT:
|
2006-10-20 02:10:51 +00:00
|
|
|
if (getGameType() == GType_PP)
|
|
|
|
_verbHitArea = 301;
|
|
|
|
else if (getGameType() == GType_WW)
|
|
|
|
_verbHitArea = 242;
|
2009-04-20 10:07:18 +00:00
|
|
|
else if (getGameType() == GType_ELVIRA2 && isBoxDead(104))
|
|
|
|
_verbHitArea = 203;
|
|
|
|
else if (getGameType() == GType_ELVIRA1 && isBoxDead(107))
|
|
|
|
_verbHitArea = 217;
|
2007-01-03 11:40:39 +00:00
|
|
|
verbCode = true;
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_ESCAPE:
|
2006-10-20 02:10:51 +00:00
|
|
|
_exitCutscene = true;
|
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_F1:
|
2006-10-27 01:36:15 +00:00
|
|
|
if (getGameType() == GType_SIMON2) {
|
2006-10-20 02:10:51 +00:00
|
|
|
vcWriteVar(5, 50);
|
2006-10-27 01:36:15 +00:00
|
|
|
vcWriteVar(86, 0);
|
|
|
|
} else if (getGameType() == GType_SIMON1) {
|
|
|
|
vcWriteVar(5, 40);
|
|
|
|
vcWriteVar(86, 0);
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_F2:
|
2006-10-27 01:36:15 +00:00
|
|
|
if (getGameType() == GType_SIMON2) {
|
2006-10-20 02:10:51 +00:00
|
|
|
vcWriteVar(5, 75);
|
2006-10-27 01:36:15 +00:00
|
|
|
vcWriteVar(86, 1);
|
|
|
|
} else if (getGameType() == GType_SIMON1) {
|
|
|
|
vcWriteVar(5, 60);
|
|
|
|
vcWriteVar(86, 1);
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_F3:
|
2006-10-27 01:36:15 +00:00
|
|
|
if (getGameType() == GType_SIMON2) {
|
2006-10-20 02:10:51 +00:00
|
|
|
vcWriteVar(5, 125);
|
2006-10-27 01:36:15 +00:00
|
|
|
vcWriteVar(86, 2);
|
|
|
|
} else if (getGameType() == GType_SIMON1) {
|
|
|
|
vcWriteVar(5, 100);
|
|
|
|
vcWriteVar(86, 2);
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_F5:
|
2006-10-20 02:10:51 +00:00
|
|
|
if (getGameType() == GType_SIMON2 || getGameType() == GType_FF)
|
|
|
|
_exitCutscene = true;
|
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_F7:
|
2006-10-20 02:10:51 +00:00
|
|
|
if (getGameType() == GType_FF && getBitFlag(76))
|
|
|
|
_variableArray[254] = 70;
|
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_F9:
|
2006-10-20 02:10:51 +00:00
|
|
|
if (getGameType() == GType_FF)
|
|
|
|
setBitFlag(73, !getBitFlag(73));
|
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
case Common::KEYCODE_F12:
|
2007-06-10 04:14:53 +00:00
|
|
|
if (getGameType() == GType_PP && getGameId() != GID_DIMP) {
|
|
|
|
if (!getBitFlag(110)) {
|
|
|
|
setBitFlag(107, !getBitFlag(107));
|
|
|
|
_vgaPeriod = (getBitFlag(107) != 0) ? 15 : 30;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2009-03-06 09:22:03 +00:00
|
|
|
case Common::KEYCODE_PAUSE:
|
2006-10-20 02:10:51 +00:00
|
|
|
pause();
|
|
|
|
break;
|
2009-04-24 13:59:21 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (_keyPressed.ascii) {
|
|
|
|
case 't':
|
2006-10-20 02:10:51 +00:00
|
|
|
if (getGameType() == GType_FF || (getGameType() == GType_SIMON2 && (getFeatures() & GF_TALKIE)) ||
|
|
|
|
((getFeatures() & GF_TALKIE) && _language != Common::EN_ANY && _language != Common::DE_DEU)) {
|
|
|
|
if (_speech)
|
2010-07-04 07:32:12 +00:00
|
|
|
_subtitles = !_subtitles;
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-04-24 13:59:21 +00:00
|
|
|
case 'v':
|
2006-10-20 02:10:51 +00:00
|
|
|
if (getGameType() == GType_FF || (getGameType() == GType_SIMON2 && (getFeatures() & GF_TALKIE))) {
|
|
|
|
if (_subtitles)
|
2010-07-04 07:32:12 +00:00
|
|
|
_speech = !_speech;
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
2008-10-23 00:26:45 +00:00
|
|
|
break;
|
2009-04-24 13:59:21 +00:00
|
|
|
case '+':
|
2007-06-07 02:43:03 +00:00
|
|
|
if (_midiEnabled) {
|
2011-08-05 10:16:03 +00:00
|
|
|
_midi->setVolume(_midi->getMusicVolume() + 16, _midi->getSFXVolume() + 16);
|
2007-06-04 14:25:02 +00:00
|
|
|
}
|
2008-08-16 22:42:19 +00:00
|
|
|
ConfMan.setInt("music_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) + 16);
|
|
|
|
syncSoundSettings();
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
2009-04-24 13:59:21 +00:00
|
|
|
case '-':
|
2007-06-07 02:43:03 +00:00
|
|
|
if (_midiEnabled) {
|
2011-08-05 10:16:03 +00:00
|
|
|
_midi->setVolume(_midi->getMusicVolume() - 16, _midi->getSFXVolume() - 16);
|
2007-06-04 14:25:02 +00:00
|
|
|
}
|
2008-08-16 22:42:19 +00:00
|
|
|
ConfMan.setInt("music_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) - 16);
|
|
|
|
syncSoundSettings();
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
2009-04-24 13:59:21 +00:00
|
|
|
case 'm':
|
2010-07-04 07:32:12 +00:00
|
|
|
_musicPaused = !_musicPaused;
|
2007-06-07 02:43:03 +00:00
|
|
|
if (_midiEnabled) {
|
2011-08-05 10:16:03 +00:00
|
|
|
_midi->pause(_musicPaused);
|
2007-06-04 14:25:02 +00:00
|
|
|
}
|
2010-07-21 20:12:57 +00:00
|
|
|
syncSoundSettings();
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
2009-04-24 13:59:21 +00:00
|
|
|
case 's':
|
2007-06-04 14:25:02 +00:00
|
|
|
if (getGameId() == GID_SIMON1DOS) {
|
2011-08-05 10:16:03 +00:00
|
|
|
_midi->_enable_sfx = !_midi->_enable_sfx;
|
2007-06-04 14:25:02 +00:00
|
|
|
} else {
|
2010-07-04 07:32:12 +00:00
|
|
|
_effectsPaused = !_effectsPaused;
|
|
|
|
_sound->effectsPause(_effectsPaused);
|
2007-06-04 14:25:02 +00:00
|
|
|
}
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
2009-04-24 13:59:21 +00:00
|
|
|
case 'b':
|
2009-02-19 00:08:35 +00:00
|
|
|
if (getGameType() == GType_SIMON2) {
|
2010-07-04 07:32:12 +00:00
|
|
|
_ambientPaused = !_ambientPaused;
|
|
|
|
_sound->ambientPause(_ambientPaused);
|
2009-02-19 00:08:35 +00:00
|
|
|
}
|
2006-10-20 02:10:51 +00:00
|
|
|
break;
|
2007-06-30 22:21:29 +00:00
|
|
|
default:
|
|
|
|
break;
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-06-30 22:21:29 +00:00
|
|
|
_keyPressed.reset();
|
2007-01-03 11:40:39 +00:00
|
|
|
return verbCode;
|
2006-10-20 02:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-03-08 08:45:21 +00:00
|
|
|
} // End of namespace AGOS
|