2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
2007-05-30 21:56:52 +00:00
|
|
|
* 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.
|
2004-04-12 21:40:49 +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.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2004-04-12 21:40:49 +00:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
|
|
|
*/
|
2004-06-05 11:12:51 +00:00
|
|
|
#include "saga/saga.h"
|
|
|
|
|
2004-08-01 11:48:53 +00:00
|
|
|
#include "saga/gfx.h"
|
2004-08-02 15:47:42 +00:00
|
|
|
#include "saga/actor.h"
|
2004-08-10 18:31:33 +00:00
|
|
|
#include "saga/console.h"
|
2004-08-06 01:39:17 +00:00
|
|
|
#include "saga/interface.h"
|
2004-07-31 23:00:48 +00:00
|
|
|
#include "saga/render.h"
|
2004-08-04 20:28:57 +00:00
|
|
|
#include "saga/scene.h"
|
2004-08-12 23:57:45 +00:00
|
|
|
#include "saga/script.h"
|
2005-02-11 20:43:48 +00:00
|
|
|
#include "saga/isomap.h"
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2007-03-17 00:53:21 +00:00
|
|
|
#include "common/events.h"
|
2004-12-27 22:08:20 +00:00
|
|
|
#include "common/system.h"
|
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
namespace Saga {
|
|
|
|
|
2004-08-11 14:04:12 +00:00
|
|
|
int SagaEngine::processInput() {
|
2007-03-17 19:02:05 +00:00
|
|
|
Common::Event event;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2007-04-01 17:36:13 +00:00
|
|
|
while (_eventMan->pollEvent(event)) {
|
2004-12-05 17:42:20 +00:00
|
|
|
switch (event.type) {
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_KEYDOWN:
|
2010-02-21 04:04:13 +00:00
|
|
|
if (event.kbd.hasFlags(Common::KBD_CTRL)) {
|
2007-06-21 19:55:22 +00:00
|
|
|
if (event.kbd.keycode == Common::KEYCODE_d)
|
2004-12-03 19:15:44 +00:00
|
|
|
_console->attach();
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
2005-06-19 14:06:20 +00:00
|
|
|
if (_interface->_textInput || _interface->_statusTextInput) {
|
2007-09-11 09:19:23 +00:00
|
|
|
_interface->processAscii(event.kbd);
|
2005-05-31 23:41:27 +00:00
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 19:41:47 +00:00
|
|
|
switch (event.kbd.keycode) {
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_HASH:
|
|
|
|
case Common::KEYCODE_BACKQUOTE:
|
2010-02-21 04:04:13 +00:00
|
|
|
case Common::KEYCODE_TILDE: // tilde ("~")
|
2004-12-03 19:15:44 +00:00
|
|
|
_console->attach();
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_r:
|
2004-12-03 19:15:44 +00:00
|
|
|
_interface->draw();
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
2005-02-11 20:43:48 +00:00
|
|
|
|
2005-08-11 16:13:10 +00:00
|
|
|
#if 0
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_KP_MINUS:
|
|
|
|
case Common::KEYCODE_KP_PLUS:
|
|
|
|
case Common::KEYCODE_UP:
|
|
|
|
case Common::KEYCODE_DOWN:
|
|
|
|
case Common::KEYCODE_RIGHT:
|
|
|
|
case Common::KEYCODE_LEFT:
|
2005-02-11 20:43:48 +00:00
|
|
|
if (_vm->_scene->getFlags() & kSceneFlagISO) {
|
2007-06-21 19:55:22 +00:00
|
|
|
_vm->_isoMap->_viewDiff += (event.kbd.keycode == Common::KEYCODE_KP_PLUS) - (event.kbd.keycode == Common::KEYCODE_KP_MINUS);
|
|
|
|
_vm->_isoMap->_viewScroll.y += (_vm->_isoMap->_viewDiff * (event.kbd.keycode == Common::KEYCODE_DOWN) - _vm->_isoMap->_viewDiff * (event.kbd.keycode == Common::KEYCODE_UP));
|
|
|
|
_vm->_isoMap->_viewScroll.x += (_vm->_isoMap->_viewDiff * (event.kbd.keycode == Common::KEYCODE_RIGHT) - _vm->_isoMap->_viewDiff * (event.kbd.keycode == Common::KEYCODE_LEFT));
|
2005-02-11 20:43:48 +00:00
|
|
|
}
|
2005-08-11 16:13:10 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2008-12-04 18:38:02 +00:00
|
|
|
|
|
|
|
#ifdef SAGA_DEBUG
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_F1:
|
2004-12-03 19:15:44 +00:00
|
|
|
_render->toggleFlag(RF_SHOW_FPS);
|
2005-07-19 19:05:52 +00:00
|
|
|
_actor->_handleActionDiv = (_actor->_handleActionDiv == 15) ? 50 : 15;
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_F2:
|
2004-12-03 19:15:44 +00:00
|
|
|
_render->toggleFlag(RF_PALETTE_TEST);
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_F3:
|
2004-12-03 19:15:44 +00:00
|
|
|
_render->toggleFlag(RF_TEXT_TEST);
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_F4:
|
2004-12-03 19:15:44 +00:00
|
|
|
_render->toggleFlag(RF_OBJECTMAP_TEST);
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
2008-12-04 18:38:02 +00:00
|
|
|
#endif
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_F5:
|
2005-08-11 16:13:10 +00:00
|
|
|
if (_interface->getSaveReminderState() > 0)
|
|
|
|
_interface->setMode(kPanelOption);
|
|
|
|
break;
|
2008-12-04 18:38:02 +00:00
|
|
|
|
|
|
|
#ifdef SAGA_DEBUG
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_F6:
|
2005-01-06 19:15:01 +00:00
|
|
|
_render->toggleFlag(RF_ACTOR_PATH_TEST);
|
|
|
|
break;
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_F7:
|
2006-01-13 20:20:01 +00:00
|
|
|
//_actor->frameTest();
|
2005-04-21 01:30:07 +00:00
|
|
|
break;
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_F8:
|
2005-04-21 01:30:07 +00:00
|
|
|
break;
|
2008-12-04 18:38:02 +00:00
|
|
|
#endif
|
|
|
|
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_F9:
|
2005-10-09 03:35:45 +00:00
|
|
|
_interface->keyBoss();
|
|
|
|
break;
|
2004-05-01 19:41:47 +00:00
|
|
|
|
|
|
|
// Actual game keys
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_SPACE:
|
2004-12-21 06:49:07 +00:00
|
|
|
_actor->abortSpeech();
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
2007-06-21 19:55:22 +00:00
|
|
|
case Common::KEYCODE_PAUSE:
|
|
|
|
case Common::KEYCODE_z:
|
2004-12-03 19:15:44 +00:00
|
|
|
_render->toggleFlag(RF_RENDERPAUSE);
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
|
|
|
default:
|
2007-09-11 09:19:23 +00:00
|
|
|
_interface->processAscii(event.kbd);
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_LBUTTONUP:
|
2005-04-18 20:03:14 +00:00
|
|
|
_leftMouseButtonPressed = false;
|
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_RBUTTONUP:
|
2005-04-18 20:03:14 +00:00
|
|
|
_rightMouseButtonPressed = false;
|
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_LBUTTONDOWN:
|
2005-04-18 20:03:14 +00:00
|
|
|
_leftMouseButtonPressed = true;
|
2007-03-18 18:45:36 +00:00
|
|
|
_interface->update(event.mouse, UPDATE_LEFTBUTTONCLICK);
|
2005-04-18 20:03:14 +00:00
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_RBUTTONDOWN:
|
2005-04-18 20:03:14 +00:00
|
|
|
_rightMouseButtonPressed = true;
|
2007-03-18 18:45:36 +00:00
|
|
|
_interface->update(event.mouse, UPDATE_RIGHTBUTTONCLICK);
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_WHEELUP:
|
2007-03-18 18:45:36 +00:00
|
|
|
_interface->update(event.mouse, UPDATE_WHEELUP);
|
2005-06-19 23:41:40 +00:00
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_WHEELDOWN:
|
2007-03-18 18:45:36 +00:00
|
|
|
_interface->update(event.mouse, UPDATE_WHEELDOWN);
|
2005-06-19 23:41:40 +00:00
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_MOUSEMOVE:
|
2004-05-01 19:41:47 +00:00
|
|
|
break;
|
2004-04-12 21:40:49 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
return SUCCESS;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2007-03-18 18:45:36 +00:00
|
|
|
Point SagaEngine::mousePos() const {
|
2007-04-01 17:36:13 +00:00
|
|
|
return _eventMan->getMousePos();
|
2007-03-18 18:45:36 +00:00
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
} // End of namespace Saga
|