/* ScummVM - Scumm Interpreter * Copyright (C) 2001-2004 The ScummVM project * * 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 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 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 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Header$ * */ #include "stdafx.h" #include "CEActions.h" #include "KeysBuffer.h" #include "gui/message.h" #include "scumm/scumm.h" #include "common/config-manager.h" const String actionNames[] = { "none", "Pause", "Save", "Quit", "Skip", "Hide", "Keyboard", "Sound", "Right click", "Cursor", "Free look" }; CEActions* CEActions::Instance() { return _instance; } String CEActions::actionName(ActionType action) { return actionNames[action]; } int CEActions::size() { return ACTION_LAST - 1; } CEActions::CEActions(OSystem_WINCE3 *mainSystem, GameDetector &detector) : _mainSystem(mainSystem), _mapping_active(false), _right_click_needed(false), _hide_toolbar_needed(false) { int i; bool is_simon = (strncmp(detector._targetName.c_str(), "simon", 5) == 0); bool is_sword1 = (detector._targetName == "sword1"); bool is_sword2 = (strcmp(detector._targetName.c_str(), "sword2") == 0); bool is_queen = (detector._targetName == "queen"); bool is_sky = (detector._targetName == "sky"); for (i=0; isimulate(&_key_action[action]); return true; case ACTION_KEYBOARD: _mainSystem->swap_panel(); return true; case ACTION_HIDE: _mainSystem->swap_panel_visibility(); return true; case ACTION_SOUND: _mainSystem->swap_sound_master(); return true; case ACTION_RIGHTCLICK: _mainSystem->add_right_click(); return true; case ACTION_CURSOR: _mainSystem->swap_mouse_visibility(); return true; case ACTION_QUIT: GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No"); if (alert.runModal() == 1) _mainSystem->quit(); return true; } return false; } bool CEActions::isActive(ActionType action) { return false; } bool CEActions::isEnabled(ActionType action) { return _action_enabled[action]; } void CEActions::beginMapping(bool start) { _mapping_active = start; } bool CEActions::mappingActive() { return _mapping_active; } bool CEActions::performMapped(unsigned int keyCode, bool pushed) { int i; for (i=0; i