summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-24 04:26:57 +0300
committerAndrei Karas <akaras@inbox.ru>2012-03-26 21:45:24 +0300
commit36e5d21fe06709ba4d12a8619af07b86a676cf8c (patch)
treea9209e16e6f31cd74047f86ef1e642f467e128e2 /src
parent0921a130f0241a17ffcedf92d602808e18f1614b (diff)
downloadplus-36e5d21fe06709ba4d12a8619af07b86a676cf8c.tar.gz
plus-36e5d21fe06709ba4d12a8619af07b86a676cf8c.tar.bz2
plus-36e5d21fe06709ba4d12a8619af07b86a676cf8c.tar.xz
plus-36e5d21fe06709ba4d12a8619af07b86a676cf8c.zip
Redesign input handling.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/Makefile.am6
-rw-r--r--src/actionmanager.cpp932
-rw-r--r--src/actionmanager.h114
-rw-r--r--src/game.cpp742
-rw-r--r--src/game.h12
-rw-r--r--src/gui/botcheckerwindow.cpp2
-rw-r--r--src/gui/outfitwindow.cpp34
-rw-r--r--src/gui/outfitwindow.h4
-rw-r--r--src/inputevent.cpp29
-rw-r--r--src/inputevent.h33
-rw-r--r--src/inputlistener.cpp38
-rw-r--r--src/inputlistener.h40
-rw-r--r--src/inputmanager.cpp95
-rw-r--r--src/inputmanager.h61
-rw-r--r--src/keyboardconfig.cpp1322
-rw-r--r--src/keyboardconfig.h25
17 files changed, 2417 insertions, 1078 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8653c2ef7..51609d8eb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -483,6 +483,8 @@ SET(SRCS
test/testlauncher.h
test/testmain.cpp
test/testmain.h
+ actionmanager.cpp
+ actionmanager.h
actor.cpp
actor.h
actorsprite.cpp
@@ -556,6 +558,10 @@ SET(SRCS
spellshortcut.h
textcommand.cpp
textcommand.h
+ inputmanager.cpp
+ inputmanager.h
+ inputevent.cpp
+ inputevent.h
joystick.cpp
joystick.h
keyboardconfig.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index abb65f338..31ce74d41 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -490,6 +490,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
test/testlauncher.h \
test/testmain.cpp \
test/testmain.h \
+ actionmanager.cpp \
+ actionmanager.h \
actor.cpp \
actor.h \
actorsprite.cpp \
@@ -563,6 +565,10 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
spellshortcut.h \
textcommand.cpp \
textcommand.h \
+ inputevent.cpp \
+ inputevent.h \
+ inputmanager.cpp \
+ inputmanager.h \
joystick.cpp \
joystick.h \
keyboardconfig.cpp \
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
new file mode 100644
index 000000000..9718ec9dd
--- /dev/null
+++ b/src/actionmanager.cpp
@@ -0,0 +1,932 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "actionmanager.h"
+
+#include "dropshortcut.h"
+#include "emoteshortcut.h"
+#include "game.h"
+#include "inputevent.h"
+#include "itemshortcut.h"
+#include "keyboardconfig.h"
+#include "localplayer.h"
+#include "logger.h"
+#include "playerinfo.h"
+#include "playerrelations.h"
+#include "sound.h"
+
+#include "gui/botcheckerwindow.h"
+#include "gui/buyselldialog.h"
+#include "gui/chatwindow.h"
+#include "gui/debugwindow.h"
+#include "gui/didyouknowwindow.h"
+#include "gui/equipmentwindow.h"
+#include "gui/helpwindow.h"
+#include "gui/inventorywindow.h"
+#include "gui/killstats.h"
+#include "gui/minimap.h"
+#include "gui/ministatuswindow.h"
+#include "gui/npcdialog.h"
+#include "gui/outfitwindow.h"
+#include "gui/setup.h"
+#include "gui/shopwindow.h"
+#include "gui/shortcutwindow.h"
+#include "gui/skilldialog.h"
+#include "gui/socialwindow.h"
+#include "gui/statuswindow.h"
+#include "gui/viewport.h"
+#include "gui/quitdialog.h"
+#include "gui/whoisonline.h"
+
+#include "gui/widgets/chattab.h"
+#include "gui/widgets/window.h"
+
+#include "net/net.h"
+#include "net/playerhandler.h"
+
+#include "utils/gettext.h"
+
+#include <guichan/actionlistener.hpp>
+
+#include "debug.h"
+
+#define impHandler(name) bool name(InputEvent &event)
+#define impHandler0(name) bool name(InputEvent &event A_UNUSED)
+
+extern ShortcutWindow *spellShortcutWindow;
+extern QuitDialog *quitDialog;
+
+namespace ActionManager
+{
+
+void showHideWindow(Window *window);
+
+impHandler0(moveUp)
+{
+ if (NpcDialog *dialog = NpcDialog::getActive())
+ {
+ dialog->refocus();
+ return true;
+ }
+ if (keyboard.isActionActive(keyboard.KEY_EMOTE))
+ return directUp(event);
+ return false;
+}
+
+impHandler0(moveDown)
+{
+ if (NpcDialog *dialog = NpcDialog::getActive())
+ {
+ dialog->refocus();
+ return true;
+ }
+ if (keyboard.isActionActive(keyboard.KEY_EMOTE))
+ return directDown(event);
+ return false;
+}
+
+impHandler0(moveLeft)
+{
+ if (outfitWindow && keyboard.isActionActive(keyboard.KEY_WEAR_OUTFIT))
+ {
+ outfitWindow->wearPreviousOutfit();
+ if (Game::instance())
+ Game::instance()->setValidSpeed();
+ return true;
+ }
+ if (keyboard.isActionActive(keyboard.KEY_EMOTE))
+ return directLeft(event);
+ return false;
+}
+
+impHandler0(moveRight)
+{
+ if (outfitWindow && keyboard.isActionActive(keyboard.KEY_WEAR_OUTFIT))
+ {
+ outfitWindow->wearNextOutfit();
+ if (Game::instance())
+ Game::instance()->setValidSpeed();
+ return true;
+ }
+ if (keyboard.isActionActive(keyboard.KEY_EMOTE))
+ return directRight(event);
+ return false;
+}
+
+impHandler(emote)
+{
+ if (keyboard.isActionActive(keyboard.KEY_EMOTE))
+ {
+ // emote keys
+ int emotion = 1 + event.action - KeyboardConfig::KEY_EMOTE_1;
+ if (emotion > 0)
+ {
+ if (emoteShortcut)
+ emoteShortcut->useEmote(emotion);
+ if (Game::instance())
+ Game::instance()->setValidSpeed();
+ return true;
+ }
+ }
+ else if (keyboard.isActionActive(keyboard.KEY_MOVE_TO_POINT))
+ {
+ // move to point keys
+ int num = event.action - KeyboardConfig::KEY_EMOTE_1;
+ if (socialWindow && num >= 0)
+ {
+ socialWindow->selectPortal(num);
+ return true;
+ }
+ }
+ else if (keyboard.isActionActive(keyboard.KEY_WEAR_OUTFIT))
+ {
+ int num = event.action - KeyboardConfig::KEY_EMOTE_1;
+ if (outfitWindow && num >= 0)
+ {
+ outfitWindow->wearOutfit(num);
+ if (Game::instance())
+ Game::instance()->setValidSpeed();
+ return true;
+ }
+ }
+ else if (keyboard.isActionActive(keyboard.KEY_COPY_OUTFIT))
+ {
+ int num = event.action - KeyboardConfig::KEY_EMOTE_1;
+ if (outfitWindow && num >= 0)
+ {
+ outfitWindow->copyOutfit(num);
+ if (Game::instance())
+ Game::instance()->setValidSpeed();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+impHandler0(mouseClick)
+{
+ if (!viewport)
+ return false;
+
+ int mouseX, mouseY;
+ SDL_GetMouseState(&mouseX, &mouseY);
+
+ gcn::MouseEvent event2(viewport, false, false, false, false,
+ 0, gcn::MouseEvent::RIGHT, mouseX, mouseY, 1);
+
+ viewport->mousePressed(event2);
+ return true;
+}
+
+impHandler0(ok)
+{
+ // Close the Browser if opened
+ if (helpWindow && helpWindow->isVisible())
+ {
+ helpWindow->setVisible(false);
+ return true;
+ }
+ // Close the config window, cancelling changes if opened
+ else if (setupWindow->isVisible())
+ {
+ setupWindow->action(gcn::ActionEvent(nullptr, "cancel"));
+ return true;
+ }
+ else if (NpcDialog *dialog = NpcDialog::getActive())
+ {
+ dialog->action(gcn::ActionEvent(nullptr, "ok"));
+ return true;
+ }
+ return false;
+}
+
+impHandler(shortcut)
+{
+ if (itemShortcutWindow)
+ {
+ int num = itemShortcutWindow->getTabIndex();
+ if (num >= 0 && num < SHORTCUT_TABS)
+ {
+ itemShortcut[num]->useItem(event.action
+ - KeyboardConfig::KEY_SHORTCUT_1);
+ }
+ return true;
+ }
+ return false;
+}
+
+impHandler0(toggleChat)
+{
+ return chatWindow->requestChatFocus();
+}
+
+impHandler0(prevChatTab)
+{
+ if (chatWindow)
+ {
+ chatWindow->prevTab();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(nextChatTab)
+{
+ if (chatWindow)
+ {
+ chatWindow->nextTab();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(closeChatTab)
+{
+ if (chatWindow)
+ {
+ chatWindow->closeTab();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(prevSocialTab)
+{
+ if (socialWindow)
+ {
+ socialWindow->prevTab();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(nextSocialTab)
+{
+ if (socialWindow)
+ {
+ socialWindow->nextTab();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(scrollChatUp)
+{
+ if (chatWindow && chatWindow->isVisible())
+ {
+ chatWindow->scroll(-DEFAULT_CHAT_WINDOW_SCROLL);
+ return true;
+ }
+ return false;
+}
+
+impHandler0(scrollChatDown)
+{
+ if (chatWindow && chatWindow->isVisible())
+ {
+ chatWindow->scroll(DEFAULT_CHAT_WINDOW_SCROLL);
+ return true;
+ }
+ return false;
+}
+
+impHandler0(quit)
+{
+ if (viewport && viewport->isPopupMenuVisible())
+ {
+ viewport->closePopupMenu();
+ return true;
+ }
+ else if (!quitDialog)
+ {
+ quitDialog = new QuitDialog(&quitDialog);
+ quitDialog->requestMoveToTop();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(dropItem0)
+{
+ if (dropShortcut)
+ {
+ dropShortcut->dropFirst();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(dropItem)
+{
+ if (dropShortcut)
+ {
+ dropShortcut->dropItems();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(switchQuickDrop)
+{
+ if (player_node && !player_node->getDisableGameModifiers())
+ {
+ player_node->changeQuickDropCounter();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(heal)
+{
+ if (actorSpriteManager)
+ {
+ actorSpriteManager->healTarget();
+ if (Game::instance())
+ Game::instance()->setValidSpeed();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(crazyMoves)
+{
+ if (player_node)
+ {
+ player_node->crazyMove();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(itenplz)
+{
+ if (actorSpriteManager)
+ {
+ if (Net::getPlayerHandler()->canUseMagic()
+ && PlayerInfo::getAttribute(MP) >= 3)
+ {
+ actorSpriteManager->itenplz();
+ }
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changeCrazyMove)
+{
+ if (player_node)
+ {
+ player_node->changeCrazyMoveType();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changePickupType)
+{
+ if (player_node)
+ {
+ player_node->changePickUpType();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(moveToTarget)
+{
+ if (player_node && !keyboard.isActionActive(keyboard.KEY_TARGET_ATTACK)
+ && !keyboard.isActionActive(keyboard.KEY_ATTACK))
+ {
+ player_node->moveToTarget();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(moveToHome)
+{
+ if (player_node && !keyboard.isActionActive(keyboard.KEY_TARGET_ATTACK)
+ && !keyboard.isActionActive(keyboard.KEY_ATTACK))
+ {
+ player_node->moveToHome();
+ if (Game::instance())
+ Game::instance()->setValidSpeed();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(setHome)
+{
+ if (player_node)
+ {
+ player_node->setHome();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changeMoveType)
+{
+ if (player_node)
+ {
+ player_node->invertDirection();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changeAttackWeaponType)
+{
+ if (player_node)
+ {
+ player_node->changeAttackWeaponType();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changeAttackType)
+{
+ if (player_node)
+ {
+ player_node->changeAttackType();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changeFollowMode)
+{
+ if (player_node)
+ {
+ player_node->changeFollowMode();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changeImitationMode)
+{
+ if (player_node)
+ {
+ player_node->changeImitationMode();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(magicAttack)
+{
+ if (player_node)
+ {
+ player_node->magicAttack();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changeMagicAttack)
+{
+ if (player_node)
+ {
+ player_node->switchMagicAttack();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changePvpMode)
+{
+ if (player_node)
+ {
+ player_node->switchPvpAttack();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changeMoveToTarget)
+{
+ if (player_node)
+ {
+ player_node->changeMoveToTargetType();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(copyEquippedToOutfit)
+{
+ if (outfitWindow)
+ {
+ outfitWindow->copyFromEquiped();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changeGameModifier)
+{
+ if (player_node)
+ {
+ player_node->switchGameModifiers();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(changeAudio)
+{
+ sound.changeAudio();
+ return true;
+}
+
+impHandler0(away)
+{
+ if (player_node)
+ {
+ player_node->changeAwayMode();
+ player_node->updateStatus();
+ if (Game::instance())
+ Game::instance()->setValidSpeed();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(camera)
+{
+ if (viewport)
+ {
+ viewport->toggleCameraMode();
+ if (Game::instance())
+ Game::instance()->setValidSpeed();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(setupWindowShow)
+{
+ if (setupWindow)
+ {
+ if (setupWindow->isVisible())
+ {
+ setupWindow->doCancel();
+ }
+ else
+ {
+ setupWindow->setVisible(true);
+ setupWindow->requestMoveToTop();
+ }
+ return true;
+ }
+ return false;
+}
+
+impHandler0(pickup)
+{
+ if (player_node)
+ {
+ player_node->pickUpItems();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(sit)
+{
+ if (player_node)
+ {
+ if (keyboard.isActionActive(keyboard.KEY_EMOTE))
+ player_node->updateSit();
+ else
+ player_node->toggleSit();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(hideWindows)
+{
+ if (statusWindow)
+ statusWindow->setVisible(false);
+ if (inventoryWindow)
+ inventoryWindow->setVisible(false);
+ if (shopWindow)
+ shopWindow->setVisible(false);
+ if (skillDialog)
+ skillDialog->setVisible(false);
+ if (setupWindow)
+ setupWindow->setVisible(false);
+ if (equipmentWindow)
+ equipmentWindow->setVisible(false);
+ if (helpWindow)
+ helpWindow->setVisible(false);
+ if (debugWindow)
+ debugWindow->setVisible(false);
+ if (outfitWindow)
+ outfitWindow->setVisible(false);
+ if (dropShortcutWindow)
+ dropShortcutWindow->setVisible(false);
+ if (spellShortcutWindow)
+ spellShortcutWindow->setVisible(false);
+ if (botCheckerWindow)
+ botCheckerWindow->setVisible(false);
+ if (socialWindow)
+ socialWindow->setVisible(false);
+ return true;
+}
+
+impHandler0(helpWindowShow)
+{
+ if (helpWindow)
+ {
+ if (helpWindow->isVisible())
+ {
+ helpWindow->setVisible(false);
+ }
+ else
+ {
+ helpWindow->loadHelp("index");
+ helpWindow->requestMoveToTop();
+ }
+ return true;
+ }
+ return false;
+}
+
+void showHideWindow(Window *window)
+{
+ if (window)
+ {
+ window->setVisible(!window->isVisible());
+ if (window->isVisible())
+ window->requestMoveToTop();
+ }
+}
+
+impHandler0(statusWindowShow)
+{
+ showHideWindow(statusWindow);
+ return true;
+}
+
+impHandler0(inventoryWindowShow)
+{
+ showHideWindow(inventoryWindow);
+ return true;
+}
+
+impHandler0(equipmentWindowShow)
+{
+ showHideWindow(equipmentWindow);
+ return true;
+}
+
+impHandler0(skillDialogShow)
+{
+ showHideWindow(skillDialog);
+ return true;
+}
+
+impHandler0(minimapWindowShow)
+{
+ showHideWindow(minimap);
+ return true;
+}
+
+impHandler0(chatWindowShow)
+{
+ showHideWindow(chatWindow);
+ return true;
+}
+
+impHandler0(shortcutWindowShow)
+{
+ showHideWindow(itemShortcutWindow);
+ return true;
+}
+
+impHandler0(debugWindowShow)
+{
+ showHideWindow(debugWindow);
+ return true;
+}
+
+impHandler0(socialWindowShow)
+{
+ showHideWindow(socialWindow);
+ return true;
+}
+
+impHandler0(emoteShortcutWindowShow)
+{
+ showHideWindow(emoteShortcutWindow);
+ return true;
+}
+
+impHandler0(outfitWindowShow)
+{
+ showHideWindow(outfitWindow);
+ return true;
+}
+
+impHandler0(shopWindowShow)
+{
+ showHideWindow(shopWindow);
+ return true;
+}
+
+impHandler0(dropShortcutWindowShow)
+{
+ showHideWindow(dropShortcutWindow);
+ return true;
+}
+
+impHandler0(killStatsWindowShow)
+{
+ showHideWindow(killStats);
+ return true;
+}
+
+impHandler0(spellShortcutWindowShow)
+{
+ showHideWindow(spellShortcutWindow);
+ return true;
+}
+
+impHandler0(botcheckerWindowShow)
+{
+ showHideWindow(botCheckerWindow);
+ return true;
+}
+
+impHandler0(whoIsOnlineWindowShow)
+{
+ showHideWindow(whoIsOnline);
+ return true;
+}
+
+impHandler0(didYouKnowWindowShow)
+{
+ showHideWindow(didYouKnowWindow);
+ return true;
+}
+
+impHandler0(changeMapMode)
+{
+ if (viewport)
+ viewport->toggleDebugPath();
+ if (miniStatusWindow)
+ miniStatusWindow->updateStatus();
+ if (Game::instance())
+ {
+ if (Map *map = Game::instance()->getCurrentMap())
+ map->redrawMap();
+ }
+ return true;
+}
+
+impHandler0(changeTrade)
+{
+ unsigned int deflt = player_relations.getDefault();
+ if (deflt & PlayerRelation::TRADE)
+ {
+ if (localChatTab)
+ {
+ localChatTab->chatLog(_("Ignoring incoming trade requests"),
+ BY_SERVER);
+ }
+ deflt &= ~PlayerRelation::TRADE;
+ }
+ else
+ {
+ if (localChatTab)
+ {
+ localChatTab->chatLog(_("Accepting incoming trade requests"),
+ BY_SERVER);
+ }
+ deflt |= PlayerRelation::TRADE;
+ }
+
+ player_relations.setDefault(deflt);
+ return true;
+}
+
+impHandler0(screenshot)
+{
+ Game::saveScreenshot();
+ return true;
+}
+
+impHandler0(ignoreInput)
+{
+ return true;
+}
+
+impHandler0(directUp)
+{
+ if (player_node)
+ {
+ if (player_node->getDirection() != Being::UP)
+ {
+ if (Client::limitPackets(PACKET_DIRECTION))
+ {
+ player_node->setDirection(Being::UP);
+ Net::getPlayerHandler()->setDirection(Being::UP);
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+impHandler0(directDown)
+{
+ if (player_node)
+ {
+ if (player_node->getDirection() != Being::DOWN)
+ {
+ if (Client::limitPackets(PACKET_DIRECTION))
+ {
+ player_node->setDirection(Being::DOWN);
+ Net::getPlayerHandler()->setDirection(Being::DOWN);
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+impHandler0(directLeft)
+{
+ if (player_node)
+ {
+ if (player_node->getDirection() != Being::LEFT)
+ {
+ if (Client::limitPackets(PACKET_DIRECTION))
+ {
+ player_node->setDirection(Being::LEFT);
+ Net::getPlayerHandler()->setDirection(Being::LEFT);
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+impHandler0(directRight)
+{
+ if (player_node)
+ {
+ if (player_node->getDirection() != Being::RIGHT)
+ {
+ if (Client::limitPackets(PACKET_DIRECTION))
+ {
+ player_node->setDirection(Being::RIGHT);
+ Net::getPlayerHandler()->setDirection(Being::RIGHT);
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+impHandler0(talk)
+{
+ if (player_node)
+ {
+ Being *target = player_node->getTarget();
+ if (target)
+ {
+ if (target->canTalk())
+ target->talkTo();
+ else if (target->getType() == Being::PLAYER)
+ new BuySellDialog(target->getName());
+ }
+ return true;
+ }
+ return false;
+}
+
+}
diff --git a/src/actionmanager.h b/src/actionmanager.h
new file mode 100644
index 000000000..f0dcb9d77
--- /dev/null
+++ b/src/actionmanager.h
@@ -0,0 +1,114 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2010 The Mana Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ACTIONMANAGER_H
+#define ACTIONMANAGER_H
+
+#include <string>
+#include <map>
+
+#define decHandler(name) bool name(InputEvent &event)
+
+struct InputEvent;
+class Window;
+
+namespace ActionManager
+{
+ decHandler(moveUp);
+ decHandler(moveDown);
+ decHandler(moveLeft);
+ decHandler(moveRight);
+ decHandler(emote);
+ decHandler(mouseClick);
+ decHandler(ok);
+ decHandler(shortcut);
+ decHandler(toggleChat);
+ decHandler(prevChatTab);
+ decHandler(nextChatTab);
+ decHandler(closeChatTab);
+ decHandler(prevSocialTab);
+ decHandler(nextSocialTab);
+ decHandler(scrollChatUp);
+ decHandler(scrollChatDown);
+ decHandler(quit);
+ decHandler(dropItem0);
+ decHandler(dropItem);
+ decHandler(switchQuickDrop);
+ decHandler(heal);
+ decHandler(crazyMoves);
+ decHandler(itenplz);
+ decHandler(changeCrazyMove);
+ decHandler(changePickupType);
+ decHandler(moveToTarget);
+ decHandler(moveToHome);
+ decHandler(setHome);
+ decHandler(changeMoveType);
+ decHandler(changeAttackWeaponType);
+ decHandler(changeAttackType);
+ decHandler(changeFollowMode);
+ decHandler(changeImitationMode);
+ decHandler(magicAttack);
+ decHandler(changeMagicAttack);
+ decHandler(changePvpMode);
+ decHandler(changeMoveToTarget);
+ decHandler(copyEquippedToOutfit);
+ decHandler(changeGameModifier);
+ decHandler(changeAudio);
+ decHandler(away);
+ decHandler(camera);
+ decHandler(pickup);
+ decHandler(sit);
+ decHandler(changeMapMode);
+ decHandler(changeTrade);
+ decHandler(screenshot);
+ decHandler(ignoreInput);
+ decHandler(directUp);
+ decHandler(directDown);
+ decHandler(directLeft);
+ decHandler(directRight);
+ decHandler(talk);
+
+ decHandler(hideWindows);
+ decHandler(helpWindowShow);
+ decHandler(setupWindowShow);
+ decHandler(statusWindowShow);
+ decHandler(inventoryWindowShow);
+ decHandler(equipmentWindowShow);
+ decHandler(skillDialogShow);
+ decHandler(minimapWindowShow);
+ decHandler(chatWindowShow);
+ decHandler(shortcutWindowShow);
+ decHandler(debugWindowShow);
+ decHandler(socialWindowShow);
+ decHandler(emoteShortcutWindowShow);
+ decHandler(outfitWindowShow);
+ decHandler(shopWindowShow);
+ decHandler(dropShortcutWindowShow);
+ decHandler(killStatsWindowShow);
+ decHandler(spellShortcutWindowShow);
+ decHandler(botcheckerWindowShow);
+ decHandler(whoIsOnlineWindowShow);
+ decHandler(didYouKnowWindowShow);
+}
+
+typedef bool (*ActionFuncPtr) (InputEvent &event);
+
+#endif
diff --git a/src/game.cpp b/src/game.cpp
index 44ec0ea68..487f55f35 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -22,38 +22,23 @@
#include "game.h"
-#include "gui/npcdialog.h"
-
-#include "actorspritemanager.h"
-#include "actorsprite.h"
#include "auctionmanager.h"
-#include "being.h"
#include "channelmanager.h"
-#include "client.h"
#include "commandhandler.h"
-#include "configuration.h"
-#include "depricatedevent.h"
-#include "dropshortcut.h"
#include "effectmanager.h"
#include "emoteshortcut.h"
#include "guildmanager.h"
-#include "graphics.h"
+#include "inputmanager.h"
#include "itemshortcut.h"
#include "joystick.h"
#include "keyboardconfig.h"
#include "localplayer.h"
#include "logger.h"
-#include "map.h"
#include "particle.h"
-#include "playerrelations.h"
#include "sound.h"
-#include "spellmanager.h"
#include "spellshortcut.h"
#include "gui/botcheckerwindow.h"
-#include "gui/buyselldialog.h"
-#include "gui/chatwindow.h"
-#include "gui/confirmdialog.h"
#include "gui/debugwindow.h"
#include "gui/didyouknowwindow.h"
#include "gui/equipmentwindow.h"
@@ -66,7 +51,6 @@
#include "gui/npcpostdialog.h"
#include "gui/okdialog.h"
#include "gui/outfitwindow.h"
-#include "gui/sdlinput.h"
#include "gui/setup.h"
#include "gui/shopwindow.h"
#include "gui/shortcutwindow.h"
@@ -74,7 +58,6 @@
#include "gui/specialswindow.h"
#include "gui/skilldialog.h"
#include "gui/statuswindow.h"
-#include "gui/quitdialog.h"
#include "gui/textdialog.h"
#include "gui/tradewindow.h"
#include "gui/viewport.h"
@@ -90,7 +73,6 @@
#include "gui/widgets/tradetab.h"
#include "net/gamehandler.h"
-#include "net/generalhandler.h"
#include "net/net.h"
#include "net/packetcounters.h"
#include "net/playerhandler.h"
@@ -175,6 +157,7 @@ const unsigned adjustDelay = 10;
*/
static void initEngines()
{
+
DepricatedEvent::trigger(CHANNEL_GAME,
DepricatedEvent(EVENT_ENGINESINITALIZING));
@@ -461,7 +444,7 @@ Game::~Game()
DepricatedEvent(EVENT_DESTRUCTED));
}
-static bool saveScreenshot()
+bool Game::saveScreenshot()
{
static unsigned int screenshotCount = 0;
SDL_Surface *screenshot = nullptr;
@@ -726,606 +709,10 @@ void Game::resetAdjustLevel()
mAdjustLevel = 0;
}
-bool Game::handleOutfitsKeys(SDL_Event &event, bool &used)
-{
- if (keyboard.isEnabled()
- && !chatWindow->isInputFocused()
- && !setupWindow->isVisible()
- && !player_node->getAway()
- && !NpcDialog::isAnyInputFocused()
- && !InventoryWindow::isAnyInputFocused())
- {
- bool wearOutfit = false;
- bool copyOutfit = false;
- if (keyboard.isActionActive(keyboard.KEY_WEAR_OUTFIT))
- wearOutfit = true;
-
- if (keyboard.isActionActive(keyboard.KEY_COPY_OUTFIT))
- copyOutfit = true;
-
- if (wearOutfit || copyOutfit)
- {
- int outfitNum = outfitWindow->keyToNumber(
- keyboard.getKeyFromEvent(event));
- if (outfitNum >= 0)
- {
- used = true;
- if (wearOutfit)
- outfitWindow->wearOutfit(outfitNum);
- else if (copyOutfit)
- outfitWindow->copyOutfit(outfitNum);
- }
- else
- {
- if (keyboard.isActionActive(keyboard.KEY_MOVE_RIGHT))
- outfitWindow->wearNextOutfit();
- else if (keyboard.isActionActive(keyboard.KEY_MOVE_LEFT))
- outfitWindow->wearPreviousOutfit();
- }
- setValidSpeed();
- return true;
- }
- else if (keyboard.isActionActive(keyboard.KEY_MOVE_TO_POINT))
- {
- int num = outfitWindow->keyToNumber(
- keyboard.getKeyFromEvent(event));
- if (socialWindow && num >= 0)
- {
- socialWindow->selectPortal(num);
- return true;
- }
- }
- }
- return false;
-}
-
-bool Game::handleSwitchKeys(SDL_Event &event, bool &used)
-{
- if ((!chatWindow || !chatWindow->isInputFocused())
- && !gui->getFocusHandler()->getModalFocused()
- && !player_node->getAway())
- {
- NpcDialog *dialog = NpcDialog::getActive();
- if (keyboard.isActionActive(keyboard.KEY_OK)
- && (!dialog || !dialog->isTextInputFocused()))
- {
- // Close the Browser if opened
- if (helpWindow->isVisible())
- helpWindow->setVisible(false);
- // Close the config window, cancelling changes if opened
- else if (setupWindow->isVisible())
- {
- setupWindow->action(gcn::ActionEvent(
- nullptr, "cancel"));
- }
- else if (dialog)
- {
- dialog->action(gcn::ActionEvent(nullptr, "ok"));
- }
- }
- if (chatWindow && keyboard.isActionActive(
- keyboard.KEY_TOGGLE_CHAT))
- {
- if (!InventoryWindow::isAnyInputFocused())
- {
- if (chatWindow->requestChatFocus())
- used = true;
- }
- }
- if (dialog && !dialog->isInputFocused())
- {
- if (keyboard.isActionActive(keyboard.KEY_MOVE_UP)
- || keyboard.isActionActive(keyboard.KEY_MOVE_DOWN))
- {
- dialog->refocus();
- }
- }
- }
-
- if (chatWindow && ((!chatWindow->isInputFocused() &&
- !NpcDialog::isAnyInputFocused() &&
- !InventoryWindow::isAnyInputFocused())
- || (event.key.keysym.mod & KMOD_ALT)))
- {
- if (keyboard.isActionActive(keyboard.KEY_PREV_CHAT_TAB))
- {
- chatWindow->prevTab();
- return true;
- }
- else if (keyboard.isActionActive(keyboard.KEY_NEXT_CHAT_TAB))
- {
- chatWindow->nextTab();
- return true;
- }
- else if (keyboard.isActionActive(keyboard.KEY_PREV_SOCIAL_TAB))
- {
- socialWindow->prevTab();
- return true;
- }
- else if (keyboard.isActionActive(keyboard.KEY_NEXT_SOCIAL_TAB))
- {
- socialWindow->nextTab();
- return true;
- }
- else if (keyboard.isActionActive(keyboard.KEY_CLOSE_CHAT_TAB))
- {
- chatWindow->closeTab();
- return true;
- }
- }
-
- const int tKey = keyboard.getKeyIndex(event);
- switch (tKey)
- {
- case KeyboardConfig::KEY_SCROLL_CHAT_UP:
- if (chatWindow && chatWindow->isVisible())
- {
- chatWindow->scroll(-DEFAULT_CHAT_WINDOW_SCROLL);
- used = true;
- }
- break;
- case KeyboardConfig::KEY_SCROLL_CHAT_DOWN:
- if (chatWindow && chatWindow->isVisible())
- {
- chatWindow->scroll(DEFAULT_CHAT_WINDOW_SCROLL);
- used = true;
- return true;
- }
- break;
- case KeyboardConfig::KEY_WINDOW_HELP:
- // In-game Help
- if (helpWindow)
- {
- if (helpWindow->isVisible())
- {
- helpWindow->setVisible(false);
- }
- else
- {
- helpWindow->loadHelp("index");
- helpWindow->requestMoveToTop();
- }
- }
- used = true;
- break;
- // Quitting confirmation dialog
- case KeyboardConfig::KEY_QUIT:
- if (!chatWindow || !chatWindow->isInputFocused())
- {
- if (viewport && viewport->isPopupMenuVisible())
- {
- viewport->closePopupMenu();
- }
- else
- {
- quitDialog = new QuitDialog(&quitDialog);
- quitDialog->requestMoveToTop();
- }
- return true;
- }
- break;
- default:
- break;
- }
-
- if (keyboard.isEnabled()
- && (!chatWindow || !chatWindow->isInputFocused())
- && !NpcDialog::isAnyInputFocused()
- && (!player_node || !player_node->getAway()))
- {
- if (!gui->getFocusHandler()->getModalFocused()
- && mValidSpeed
- && (!setupWindow || !setupWindow->isVisible())
- && !InventoryWindow::isAnyInputFocused())
- {
- switch (tKey)
- {
- case KeyboardConfig::KEY_QUICK_DROP:
- if (dropShortcut)
- dropShortcut->dropFirst();
- break;
-
- case KeyboardConfig::KEY_QUICK_DROPN:
- if (dropShortcut)
- dropShortcut->dropItems();
- break;
-
- case KeyboardConfig::KEY_SWITCH_QUICK_DROP:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->changeQuickDropCounter();
- }
- break;
-
- case KeyboardConfig::KEY_MAGIC_INMA1:
- if (actorSpriteManager)
- actorSpriteManager->healTarget();
- setValidSpeed();
- break;
-
- case KeyboardConfig::KEY_MAGIC_ITENPLZ:
- if (Net::getPlayerHandler()->canUseMagic()
- && PlayerInfo::getAttribute(MP) >= 3)
- {
- actorSpriteManager->itenplz();
- }
- setValidSpeed();
- break;
-
- case KeyboardConfig::KEY_CRAZY_MOVES:
- if (player_node)
- player_node->crazyMove();
- break;
-
- case KeyboardConfig::KEY_CHANGE_CRAZY_MOVES_TYPE:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->changeCrazyMoveType();
- }
- break;
-
- case KeyboardConfig::KEY_CHANGE_PICKUP_TYPE:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->changePickUpType();
- }
- break;
-
- case KeyboardConfig::KEY_MOVE_TO_TARGET:
- if (player_node)
- {
- if (!keyboard.isActionActive(
- keyboard.KEY_TARGET_ATTACK)
- && !keyboard.isActionActive(keyboard.KEY_ATTACK))
- {
- player_node->moveToTarget();
- }
- }
- break;
-
- case KeyboardConfig::KEY_MOVE_TO_HOME:
- if (player_node)
- {
- if (!keyboard.isActionActive(
- keyboard.KEY_TARGET_ATTACK)
- && !keyboard.isActionActive(keyboard.KEY_ATTACK))
- {
- player_node->moveToHome();
- }
- setValidSpeed();
- }
- break;
-
- case KeyboardConfig::KEY_SET_HOME:
- if (player_node)
- player_node->setHome();
- break;
-
- case KeyboardConfig::KEY_INVERT_DIRECTION:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->invertDirection();
- }
- break;
-
- case KeyboardConfig::KEY_CHANGE_ATTACK_WEAPON_TYPE:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->changeAttackWeaponType();
- }
- break;
-
- case KeyboardConfig::KEY_CHANGE_ATTACK_TYPE:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->changeAttackType();
- }
- break;
-
- case KeyboardConfig::KEY_CHANGE_FOLLOW_MODE:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->changeFollowMode();
- }
- break;
-
- case KeyboardConfig::KEY_CHANGE_IMITATION_MODE:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->changeImitationMode();
- }
- break;
-
- case KeyboardConfig::KEY_MAGIC_ATTACK:
- if (player_node)
- player_node->magicAttack();
- break;
-
- case KeyboardConfig::KEY_SWITCH_MAGIC_ATTACK:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->switchMagicAttack();
- }
- break;
-
- case KeyboardConfig::KEY_SWITCH_PVP_ATTACK:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->switchPvpAttack();
- }
- break;
-
- case KeyboardConfig::KEY_CHANGE_MOVE_TO_TARGET:
- if (player_node)
- {
- if (!player_node->getDisableGameModifiers())
- player_node->changeMoveToTargetType();
- }
- break;
-
- case KeyboardConfig::KEY_COPY_EQUIPED_OUTFIT:
- if (outfitWindow)
- outfitWindow->copyFromEquiped();
- break;
-
- case KeyboardConfig::KEY_DISABLE_GAME_MODIFIERS:
- if (player_node)
- player_node->switchGameModifiers();
- break;
-
- case KeyboardConfig::KEY_CHANGE_AUDIO:
- sound.changeAudio();
- break;
-
- case KeyboardConfig::KEY_AWAY:
- if (player_node)
- {
- player_node->changeAwayMode();
- player_node->updateStatus();
- setValidSpeed();
- }
- break;
-
- case KeyboardConfig::KEY_CAMERA:
- if (player_node && viewport)
- {
- if (!player_node->getDisableGameModifiers())
- viewport->toggleCameraMode();
- setValidSpeed();
- }
- break;
-
- default:
- break;
- }
- }
-
- gcn::Window *requestedWindow = nullptr;
-
- if (!NpcDialog::isAnyInputFocused()
- && !InventoryWindow::isAnyInputFocused()
- && !keyboard.isActionActive(keyboard.KEY_TARGET)
- && !keyboard.isActionActive(keyboard.KEY_UNTARGET))
- {
- if (setupWindow && setupWindow->isVisible())
- {
- if (tKey == KeyboardConfig::KEY_WINDOW_SETUP)
- {
- setupWindow->doCancel();
- used = true;
- }
- }
- else
- {
- // Do not activate shortcuts if tradewindow is visible
- if (itemShortcutWindow && tradeWindow
- && !tradeWindow->isVisible()
- && !setupWindow->isVisible())
- {
- int num = itemShortcutWindow->getTabIndex();
- if (num >= 0 && num < SHORTCUT_TABS)
- {
- // Checks if any item shortcut is pressed.
- for (int i = KeyboardConfig::KEY_SHORTCUT_1;
- i <= KeyboardConfig::KEY_SHORTCUT_20;
- i ++)
- {
- if (tKey == i && !used)
- {
- itemShortcut[num]->useItem(
- i - KeyboardConfig::KEY_SHORTCUT_1);
- break;
- }
- }
- }
- }
-
- switch (tKey)
- {
- case KeyboardConfig::KEY_PICKUP:
- if (player_node)
- player_node->pickUpItems();
- used = true;
- break;
- case KeyboardConfig::KEY_SIT:
- // Player sit action
- if (player_node)
- {
- if (keyboard.isActionActive(keyboard.KEY_EMOTE))
- player_node->updateSit();
- else
- player_node->toggleSit();
- }
- used = true;
- break;
- case KeyboardConfig::KEY_HIDE_WINDOWS:
- // Hide certain windows
- if (!chatWindow || !chatWindow->isInputFocused())
- {
- if (statusWindow)
- statusWindow->setVisible(false);
- if (inventoryWindow)
- inventoryWindow->setVisible(false);
- if (shopWindow)
- shopWindow->setVisible(false);
- if (skillDialog)
- skillDialog->setVisible(false);
- if (setupWindow)
- setupWindow->setVisible(false);
- if (equipmentWindow)
- equipmentWindow->setVisible(false);
- if (helpWindow)
- helpWindow->setVisible(false);
- if (debugWindow)
- debugWindow->setVisible(false);
- if (outfitWindow)
- outfitWindow->setVisible(false);
- if (dropShortcutWindow)
- dropShortcutWindow->setVisible(false);
- if (spellShortcutWindow)
- spellShortcutWindow->setVisible(false);
- if (botCheckerWindow)
- botCheckerWindow->setVisible(false);
- if (socialWindow)
- socialWindow->setVisible(false);
- }
- break;
- case KeyboardConfig::KEY_WINDOW_STATUS:
- requestedWindow = statusWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_INVENTORY:
- requestedWindow = inventoryWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_SHOP:
- requestedWindow = shopWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_EQUIPMENT:
- requestedWindow = equipmentWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_SKILL:
- requestedWindow = skillDialog;
- break;
- case KeyboardConfig::KEY_WINDOW_KILLS:
- requestedWindow = killStats;
- break;
- case KeyboardConfig::KEY_WINDOW_MINIMAP:
- minimap->toggle();
- break;
- case KeyboardConfig::KEY_WINDOW_CHAT:
- requestedWindow = chatWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_SHORTCUT:
- requestedWindow = itemShortcutWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_SETUP:
- requestedWindow = setupWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_DEBUG:
- requestedWindow = debugWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_SOCIAL:
- requestedWindow = socialWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_EMOTE_SHORTCUT:
- requestedWindow = emoteShortcutWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_OUTFIT:
- requestedWindow = outfitWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_DROP:
- requestedWindow = dropShortcutWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_SPELLS:
- requestedWindow = spellShortcutWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_BOT_CHECKER:
- requestedWindow = botCheckerWindow;
- break;
- case KeyboardConfig::KEY_WINDOW_ONLINE:
- requestedWindow = whoIsOnline;
- break;
- case KeyboardConfig::KEY_SCREENSHOT:
- // Screenshot (picture, hence the p)
- saveScreenshot();
- used = true;
- break;
- case KeyboardConfig::KEY_PATHFIND:
- // Find path to mouse (debug purpose)
- if (!player_node || !player_node->
- getDisableGameModifiers())
- {
- if (viewport)
- viewport->toggleDebugPath();
- if (miniStatusWindow)
- miniStatusWindow->updateStatus();
- if (mCurrentMap)
- mCurrentMap->redrawMap();
- used = true;
- }
- break;
- case KeyboardConfig::KEY_TRADE:
- {
- // Toggle accepting of incoming trade requests
- unsigned int deflt = player_relations.getDefault();
- if (deflt & PlayerRelation::TRADE)
- {
- if (localChatTab)
- {
- localChatTab->chatLog(
- _("Ignoring incoming trade requests"),
- BY_SERVER);
- }
- deflt &= ~PlayerRelation::TRADE;
- }
- else
- {
- if (localChatTab)
- {
- localChatTab->chatLog(
- _("Accepting incoming trade requests"),
- BY_SERVER);
- }
- deflt |= PlayerRelation::TRADE;
- }
-
- player_relations.setDefault(deflt);
-
- used = true;
- }
- break;
- default:
- break;
- }
- }
-
- if (requestedWindow)
- {
- requestedWindow->setVisible(!requestedWindow->isVisible());
- if (requestedWindow->isVisible())
- requestedWindow->requestMoveToTop();
- used = true;
- }
- }
- }
- return false;
-}
-
-void Game::handleMoveAndAttack(SDL_Event &event, bool wasDown)
+void Game::handleMoveAndAttack()
{
// Moving player around
- if (player_node->isAlive() && (!Being::isTalking()
- || keyboard.getKeyIndex(event)
- == KeyboardConfig::KEY_TALK)
+ if (player_node->isAlive() && !Being::isTalking()
&& chatWindow && !chatWindow->isInputFocused()
&& !InventoryWindow::isAnyInputFocused() && !quitDialog)
{
@@ -1373,67 +760,8 @@ void Game::handleMoveAndAttack(SDL_Event &event, bool wasDown)
setValidSpeed();
player_node->cancelFollow();
}
- else if (!keyboard.isActionActive(keyboard.KEY_EMOTE))
- {
- if (keyboard.isActionActive(keyboard.KEY_DIRECT_UP))
- {
- if (player_node->getDirection() != Being::UP)
- {
- if (Client::limitPackets(PACKET_DIRECTION))
- {
- player_node->setDirection(Being::UP);
- Net::getPlayerHandler()->setDirection(Being::UP);
- }
- }
- }
- else if (keyboard.isActionActive(keyboard.KEY_DIRECT_DOWN))
- {
- if (player_node->getDirection() != Being::DOWN)
- {
- if (Client::limitPackets(PACKET_DIRECTION))
- {
- player_node->setDirection(Being::DOWN);
- Net::getPlayerHandler()->setDirection(Being::DOWN);
- }
- }
- }
- else if (keyboard.isActionActive(keyboard.KEY_DIRECT_LEFT))
- {
- if (player_node->getDirection() != Being::LEFT)
- {
- if (Client::limitPackets(PACKET_DIRECTION))
- {
- player_node->setDirection(Being::LEFT);
- Net::getPlayerHandler()->setDirection(Being::LEFT);
- }
- }
- }
- else if (keyboard.isActionActive(keyboard.KEY_DIRECT_RIGHT))
- {
- if (player_node->getDirection() != Being::RIGHT)
- {
- if (Client::limitPackets(PACKET_DIRECTION))
- {
- player_node->setDirection(Being::RIGHT);
- Net::getPlayerHandler()->setDirection(Being::RIGHT);
- }
- }
- }
- }
- if (keyboard.isActionActive(keyboard.KEY_EMOTE) && direction != 0)
- {
- if (player_node->getDirection() != direction)
- {
- if (Client::limitPackets(PACKET_DIRECTION))
- {
- player_node->setDirection(direction);
- Net::getPlayerHandler()->setDirection(direction);
- }
- }
-// direction = 0;
- }
- else
+ if (!keyboard.isActionActive(keyboard.KEY_EMOTE) || direction == 0)
{
if (!viewport->getCameraMode())
{
@@ -1460,9 +788,7 @@ void Game::handleMoveAndAttack(SDL_Event &event, bool wasDown)
if (joystick && joystick->buttonPressed(0))
joyAttack = true;
- if ((((player_node->getAttackType() == 0
- && player_node->getFollow().empty()) || wasDown)
- || joyAttack) && mValidSpeed)
+ if ((player_node->getFollow().empty() || joyAttack) && mValidSpeed)
{
// Attacking monsters
if (keyboard.isActionActive(keyboard.KEY_ATTACK))
@@ -1473,7 +799,8 @@ void Game::handleMoveAndAttack(SDL_Event &event, bool wasDown)
if ((keyboard.isActionActive(keyboard.KEY_TARGET_ATTACK)
|| joyAttack)
- && !keyboard.isActionActive(keyboard.KEY_MOVE_TO_TARGET))
+ /*&& !keyboard.isActionActive(keyboard.KEY_MOVE_TO_TARGET)*/
+ )
{
Being *target = nullptr;
@@ -1535,21 +862,6 @@ void Game::handleMoveAndAttack(SDL_Event &event, bool wasDown)
}
}
- // Talk to the nearest NPC if 't' pressed
- if (wasDown && keyboard.getKeyIndex(event) == KeyboardConfig::KEY_TALK
- && !keyboard.isActionActive(keyboard.KEY_EMOTE))
- {
- Being *target = player_node->getTarget();
-
- if (target)
- {
- if (target->canTalk())
- target->talkTo();
- else if (target->getType() == Being::PLAYER)
- new BuySellDialog(target->getName());
- }
- }
-
// Stop attacking if the right key is pressed
if (!keyboard.isActionActive(keyboard.KEY_ATTACK)
&& !keyboard.isActionActive(keyboard.KEY_EMOTE))
@@ -1683,40 +995,8 @@ void Game::handleInput()
return;
}
- if (chatWindow && !chatWindow->isInputFocused()
- && keyboard.isActionActive(keyboard.KEY_RIGHT_CLICK))
- {
- int mouseX, mouseY;
- SDL_GetMouseState(&mouseX, &mouseY);
-
- gcn::MouseEvent event2(viewport, false, false, false, false,
- 0, gcn::MouseEvent::RIGHT, mouseX, mouseY, 1);
- if (viewport)
- viewport->mousePressed(event2);
- continue;
- }
-
- // Mode switch to emotes
- if (keyboard.isActionActive(keyboard.KEY_EMOTE))
- {
- // Emotions
- int emotion = keyboard.getKeyEmoteOffset(event);
- if (emotion)
- {
- if (emoteShortcut)
- emoteShortcut->useEmote(emotion);
-// used = true;
- setValidSpeed();
- return;
- }
- }
-
- if (handleOutfitsKeys(event, used))
- continue;
-
- if (handleSwitchKeys(event, used))
+ if (inputManager.handleKeyEvent(event))
return;
-
}
// Active event
else if (event.type == SDL_ACTIVEEVENT)
@@ -1758,7 +1038,7 @@ void Game::handleInput()
return;
}
- handleMoveAndAttack(event, wasDown);
+ handleMoveAndAttack();
}
/**
diff --git a/src/game.h b/src/game.h
index 4469d3774..637c29c7a 100644
--- a/src/game.h
+++ b/src/game.h
@@ -78,11 +78,7 @@ class Game
void handleInput();
- bool handleOutfitsKeys(SDL_Event &event, bool &used);
-
- bool handleSwitchKeys(SDL_Event &event, bool &used);
-
- void handleMoveAndAttack(SDL_Event &event, bool wasDown);
+ void handleMoveAndAttack();
void handleActive(SDL_Event &event);
@@ -110,8 +106,12 @@ class Game
void videoResized(int width, int height);
- private:
+ bool getValidSpeed()
+ { return mValidSpeed; }
+ static bool saveScreenshot();
+
+ private:
void updateHistory(SDL_Event &event);
void checkKeys();
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp
index 2739978cb..a1ad9cc2a 100644
--- a/src/gui/botcheckerwindow.cpp
+++ b/src/gui/botcheckerwindow.cpp
@@ -20,7 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "botcheckerwindow.h"
+#include "gui/botcheckerwindow.h"
#include <SDL.h>
#include <SDL_thread.h>
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 4f5f07445..009b92e73 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -23,10 +23,12 @@
#include "gui/outfitwindow.h"
#include "configuration.h"
+#include "emoteshortcut.h"
#include "equipment.h"
#include "graphics.h"
#include "inventory.h"
#include "item.h"
+#include "keyboardconfig.h"
#include "localplayer.h"
#include "logger.h"
#include "playerinfo.h"
@@ -497,37 +499,11 @@ void OutfitWindow::unequipNotInOutfit(int outfit)
}
}
-static const SDLKey numsTbl[] =
-{
- SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, SDLK_7, SDLK_8, SDLK_9,
- SDLK_0, SDLK_MINUS, SDLK_EQUALS, SDLK_BACKSPACE, SDLK_INSERT, SDLK_HOME,
- SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y, SDLK_u, SDLK_i, SDLK_o,
- SDLK_p, SDLK_LEFTBRACKET, SDLK_RIGHTBRACKET, SDLK_BACKSLASH, SDLK_a,
- SDLK_s, SDLK_d, SDLK_f, SDLK_g, SDLK_h, SDLK_j, SDLK_k, SDLK_l,
- SDLK_SEMICOLON, SDLK_QUOTE, SDLK_z, SDLK_x, SDLK_c, SDLK_v, SDLK_b, SDLK_n,
- SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH
-};
-
-int OutfitWindow::keyToNumber(SDLKey key) const
-{
- for (unsigned f = 0; f < sizeof(numsTbl) / sizeof(SDLKey); f ++)
- {
- if (numsTbl[f] == key)
- return f;
- }
- return -1;
-}
-
-SDLKey OutfitWindow::numberToKey(unsigned number) const
-{
- if (number >= sizeof(numsTbl) / sizeof(SDLKey))
- return SDLK_UNKNOWN;
- return numsTbl[number];
-}
-
std::string OutfitWindow::keyName(int number)
{
- return SDL_GetKeyName(numberToKey(number));
+ if (number < 0 || number >= SHORTCUT_EMOTES)
+ return "";
+ return keyboard.getKeyStringLong(KeyboardConfig::KEY_EMOTE_1 + number);
}
void OutfitWindow::next()
diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h
index 6f67c472d..6881bdbc6 100644
--- a/src/gui/outfitwindow.h
+++ b/src/gui/outfitwindow.h
@@ -88,10 +88,6 @@ class OutfitWindow : public Window, gcn::ActionListener
void unequipNotInOutfit(int outfit);
- int keyToNumber(SDLKey key) const A_PURE;
-
- SDLKey numberToKey(unsigned number) const A_PURE;
-
void next();
void previous();
diff --git a/src/inputevent.cpp b/src/inputevent.cpp
new file mode 100644
index 000000000..614be71f1
--- /dev/null
+++ b/src/inputevent.cpp
@@ -0,0 +1,29 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "inputevent.h"
+
+#include "debug.h"
+
+InputEvent::InputEvent(int action0, int mask0) :
+ action(action0),
+ mask(mask0)
+{
+}
diff --git a/src/inputevent.h b/src/inputevent.h
new file mode 100644
index 000000000..7b73bba11
--- /dev/null
+++ b/src/inputevent.h
@@ -0,0 +1,33 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef INPUTEVENT_H
+#define INPUTEVENT_H
+
+struct InputEvent
+{
+ InputEvent(int action0, int mask0);
+
+ int action;
+
+ int mask;
+};
+
+#endif
diff --git a/src/inputlistener.cpp b/src/inputlistener.cpp
new file mode 100644
index 000000000..e2660f94b
--- /dev/null
+++ b/src/inputlistener.cpp
@@ -0,0 +1,38 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "inputlistener.h"
+
+#include "debug.h"
+
+InputListener::~InputListener()
+{
+ DepricatedEvent::remove(this);
+}
+
+void InputListener::listen(Channels channel)
+{
+ DepricatedEvent::bind(this, channel);
+}
+
+void InputListener::ignore(Channels channel)
+{
+ DepricatedEvent::unbind(this, channel);
+}
diff --git a/src/inputlistener.h b/src/inputlistener.h
new file mode 100644
index 000000000..7b7c4ff03
--- /dev/null
+++ b/src/inputlistener.h
@@ -0,0 +1,40 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef INPUTLISTENER_H
+#define INPUTLISTENER_H
+
+
+#include <string>
+
+class InputListener
+{
+ public:
+ virtual ~InputListener();
+
+ void listen(Channels channel);
+
+ void ignore(Channels channel);
+
+ virtual void processEvent(Channels channel,
+ const DepricatedEvent &event) = 0;
+};
+
+#endif
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp
new file mode 100644
index 000000000..46a2265c6
--- /dev/null
+++ b/src/inputmanager.cpp
@@ -0,0 +1,95 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "inputmanager.h"
+
+#include "game.h"
+#include "keyboardconfig.h"
+#include "localplayer.h"
+
+#include "gui/chatwindow.h"
+#include "gui/gui.h"
+#include "gui/inventorywindow.h"
+#include "gui/npcdialog.h"
+#include "gui/setup.h"
+
+#include <guichan/focushandler.hpp>
+
+#include "debug.h"
+
+InputManager inputManager;
+
+InputManager::InputManager()
+{
+}
+
+bool InputManager::handleKeyEvent(SDL_Event &event)
+{
+ return keyboard.triggerAction(event);
+}
+
+int InputManager::getInputConditionMask()
+{
+ int mask = 1;
+ if (keyboard.isEnabled())
+ mask += COND_ENABLED;
+ if ((!chatWindow || !chatWindow->isInputFocused()) &&
+ !NpcDialog::isAnyInputFocused() &&
+ !InventoryWindow::isAnyInputFocused())
+ {
+ mask += COND_NOINPUT;
+ }
+
+ if (!player_node || !player_node->getAway())
+ mask += COND_NOAWAY;
+
+ if (!setupWindow || !setupWindow->isVisible())
+ mask += COND_NOSETUP;
+
+ if (Game::instance()->getValidSpeed())
+ mask += COND_VALIDSPEED;
+
+ if (!gui->getFocusHandler()->getModalFocused())
+ mask += COND_NOMODAL;
+
+ NpcDialog *dialog = NpcDialog::getActive();
+ if (!dialog || !dialog->isTextInputFocused())
+ mask += COND_NONPCINPUT;
+
+ if (!player_node || !player_node->getDisableGameModifiers())
+ mask += COND_EMODS;
+
+ if (!keyboard.isActionActive(keyboard.KEY_TARGET)
+ && !keyboard.isActionActive(keyboard.KEY_UNTARGET))
+ {
+ mask += COND_NOTARGET;
+ }
+ return mask;
+}
+
+bool InputManager::checkKey(KeyFunction *key, int mask)
+{
+// logger->log("mask=%d, condition=%d", mask, key->condition);
+ if (!key || (key->condition & mask) != key->condition)
+ return false;
+
+ return (key->modKeyIndex == KeyboardConfig::KEY_NO_VALUE
+ || keyboard.isActionActive(key->modKeyIndex));
+}
diff --git a/src/inputmanager.h b/src/inputmanager.h
new file mode 100644
index 000000000..82def2c33
--- /dev/null
+++ b/src/inputmanager.h
@@ -0,0 +1,61 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * 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
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef INPUTMANAGER_H
+#define INPUTMANAGER_H
+
+#include "gui/sdlinput.h"
+
+#include <string>
+#include <map>
+
+struct KeyFunction;
+
+enum KeyCondition
+{
+ COND_DEFAULT = 1, // default condition
+ COND_ENABLED = 2, // keyboard must be enabled
+ COND_NOINPUT = 4, // input items must be unfocused
+ COND_NOAWAY = 8, // player not in away mode
+ COND_NOSETUP = 16, // setup window is hidde
+ COND_VALIDSPEED = 32, // valid speed
+ COND_NOMODAL = 64, // modal windows inactive
+ COND_NONPCINPUT = 128, // npc input field inactive
+ COND_EMODS = 256, // game modifiers enabled
+ COND_NOTARGET = 512, // no target/untarget keys pressed
+ COND_GAME = 2 + 4 + 8 + 16 + 64, // main game key
+ COND_GAME2 = 2 + 8 + 16 + 64
+};
+
+class InputManager
+{
+ public:
+ InputManager();
+
+ bool handleKeyEvent(SDL_Event &event);
+
+ int getInputConditionMask();
+
+ bool checkKey(KeyFunction *key, int mask);
+};
+
+extern InputManager inputManager;
+
+#endif
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 20a5f2d56..01f9a7ddd 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -20,8 +20,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "configuration.h"
#include "keyboardconfig.h"
+
+#include "configuration.h"
+#include "inputevent.h"
+#include "inputmanager.h"
#include "logger.h"
#include "gui/sdlinput.h"
@@ -32,334 +35,1001 @@
#include <SDL_events.h>
+#include <algorithm>
+
#include "debug.h"
+class KeyFunctor
+{
+ public:
+ bool operator() (int key1, int key2)
+ {
+ return keys[key1].priority >= keys[key2].priority;
+ }
+
+ KeyFunction *keys;
+
+} keySorter;
+
struct KeyData
{
const char *configField;
int defaultValue;
std::string caption;
int grp;
+ ActionFuncPtr action;
+ int modKeyIndex;
+ int priority;
+ int condition;
};
// keyData must be in same order as enum keyAction.
static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
- {"", 0, N_("Basic Keys"), 0},
- {"keyMoveUp", SDLK_UP, N_("Move Up"), KeyboardConfig::GRP_DEFAULT},
- {"keyMoveDown", SDLK_DOWN, N_("Move Down"), KeyboardConfig::GRP_DEFAULT},
- {"keyMoveLeft", SDLK_LEFT, N_("Move Left"), KeyboardConfig::GRP_DEFAULT},
- {"keyMoveRight", SDLK_RIGHT, N_("Move Right"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyAttack", SDLK_LCTRL, N_("Attack"), KeyboardConfig::GRP_DEFAULT},
- {"keyTargetAttack", SDLK_x, N_("Target & Attack"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyMoveToTarget", SDLK_v, N_("Move to Target"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyChangeMoveToTarget", SDLK_PERIOD, N_("Change Move to Target type"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyMoveToHome", SDLK_d, N_("Move to Home location"),
- KeyboardConfig::GRP_DEFAULT},
- {"keySetHome", SDLK_KP5, N_("Set home location"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyMoveToPoint", SDLK_RSHIFT, N_("Move to navigation point"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyTalk", SDLK_t, N_("Talk"), KeyboardConfig::GRP_DEFAULT},
- {"keyTarget", SDLK_LSHIFT, N_("Stop Attack"), KeyboardConfig::GRP_DEFAULT},
+ {"", 0,
+ N_("Basic Keys"),
+ 0,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 0,
+ 0},
+ {"keyMoveUp", SDLK_UP,
+ N_("Move Up"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::moveUp,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME2},
+ {"keyMoveDown", SDLK_DOWN,
+ N_("Move Down"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::moveDown,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME2},
+ {"keyMoveLeft", SDLK_LEFT,
+ N_("Move Left"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::moveLeft,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME},
+ {"keyMoveRight", SDLK_RIGHT,
+ N_("Move Right"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::moveRight,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME},
+ {"keyAttack", SDLK_LCTRL,
+ N_("Attack"),
+ KeyboardConfig::GRP_DEFAULT,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyTargetAttack", SDLK_x,
+ N_("Target & Attack"),
+ KeyboardConfig::GRP_DEFAULT,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyMoveToTarget", SDLK_v,
+ N_("Move to Target"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::moveToTarget,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keyChangeMoveToTarget", SDLK_PERIOD,
+ N_("Change Move to Target type"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeMoveToTarget,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
+ {"keyMoveToHome", SDLK_d,
+ N_("Move to Home location"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::moveToHome,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keySetHome", SDLK_KP5,
+ N_("Set home location"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::setHome,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keyMoveToPoint", SDLK_RSHIFT,
+ N_("Move to navigation point"),
+ KeyboardConfig::GRP_DEFAULT,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyTalk", SDLK_t,
+ N_("Talk"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::talk,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME},
+ {"keyTarget", SDLK_LSHIFT,
+ N_("Stop Attack"),
+ KeyboardConfig::GRP_DEFAULT,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME},
{"keyUnTarget", KeyboardConfig::KEY_NO_VALUE,
- N_("Untarget"), KeyboardConfig::GRP_DEFAULT},
- {"keyTargetClosest", SDLK_a, N_("Target Closest"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyTargetNPC", SDLK_n, N_("Target NPC"), KeyboardConfig::GRP_DEFAULT},
- {"keyTargetPlayer", SDLK_q, N_("Target Player"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyPickup", SDLK_z, N_("Pickup"), KeyboardConfig::GRP_DEFAULT},
- {"keyChangePickupType", SDLK_o, N_("Change Pickup Type"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyHideWindows", SDLK_h, N_("Hide Windows"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyBeingSit", SDLK_s, N_("Sit"), KeyboardConfig::GRP_DEFAULT},
- {"keyScreenshot", SDLK_p, N_("Screenshot"), KeyboardConfig::GRP_DEFAULT},
- {"keyTrade", SDLK_r, N_("Enable/Disable Trading"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyPathfind", SDLK_f, N_("Change Map View Mode"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyOK", SDLK_SPACE, N_("Select OK"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyQuit", SDLK_ESCAPE, N_("Quit"), KeyboardConfig::GRP_DEFAULT},
- {"", 0, N_("Shortcuts Keys"), 0},
- {"keyShortcutsKey", SDLK_MENU, N_("Item Shortcuts Key"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut1", SDLK_1, strprintf(N_("Item Shortcut %d"), 1),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut2", SDLK_2, strprintf(N_("Item Shortcut %d"), 2),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut3", SDLK_3, strprintf(N_("Item Shortcut %d"), 3),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut4", SDLK_4, strprintf(N_("Item Shortcut %d"), 4),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut5", SDLK_5, strprintf(N_("Item Shortcut %d"), 5),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut6", SDLK_6, strprintf(N_("Item Shortcut %d"), 6),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut7", SDLK_7, strprintf(N_("Item Shortcut %d"), 7),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut8", SDLK_8, strprintf(N_("Item Shortcut %d"), 8),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut9", SDLK_9, strprintf(N_("Item Shortcut %d"), 9),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut10", SDLK_0, strprintf(N_("Item Shortcut %d"), 10),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut11", SDLK_MINUS, strprintf(N_("Item Shortcut %d"), 11),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut12", SDLK_EQUALS, strprintf(N_("Item Shortcut %d"), 12),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut13", SDLK_BACKSPACE, strprintf(N_("Item Shortcut %d"), 13),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut14", SDLK_INSERT, strprintf(N_("Item Shortcut %d"), 14),
- KeyboardConfig::GRP_DEFAULT},
- {"keyShortcut15", SDLK_HOME, strprintf(N_("Item Shortcut %d"), 15),
- KeyboardConfig::GRP_DEFAULT},
+ N_("Untarget"),
+ KeyboardConfig::GRP_DEFAULT,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyTargetClosest", SDLK_a,
+ N_("Target Closest"),
+ KeyboardConfig::GRP_DEFAULT,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyTargetNPC", SDLK_n,
+ N_("Target NPC"),
+ KeyboardConfig::GRP_DEFAULT,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyTargetPlayer", SDLK_q,
+ N_("Target Player"),
+ KeyboardConfig::GRP_DEFAULT,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyPickup", SDLK_z,
+ N_("Pickup"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::pickup,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyChangePickupType", SDLK_o,
+ N_("Change Pickup Type"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changePickupType,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
+ {"keyHideWindows", SDLK_h,
+ N_("Hide Windows"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::hideWindows,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyBeingSit", SDLK_s,
+ N_("Sit"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::sit,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyScreenshot", SDLK_p,
+ N_("Screenshot"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::screenshot,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyTrade", SDLK_r,
+ N_("Enable/Disable Trading"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeTrade,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyPathfind", SDLK_f,
+ N_("Change Map View Mode"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeMapMode,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET | COND_EMODS},
+ {"keyOK", SDLK_SPACE,
+ N_("Select OK"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::ok,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOMODAL | COND_NOAWAY | COND_NONPCINPUT},
+ {"keyQuit", SDLK_ESCAPE,
+ N_("Quit"),
+ KeyboardConfig::GRP_DEFAULT,
+// nullptr,
+ &ActionManager::quit,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"", 0,
+ N_("Shortcuts Keys"),
+ 0,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyShortcutsKey", SDLK_MENU,
+ N_("Item Shortcuts Key"),
+ KeyboardConfig::GRP_DEFAULT,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyShortcut1", SDLK_1,
+ strprintf(N_("Item Shortcut %d"), 1),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut2", SDLK_2,
+ strprintf(N_("Item Shortcut %d"), 2),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut3", SDLK_3,
+ strprintf(N_("Item Shortcut %d"), 3),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut4", SDLK_4,
+ strprintf(N_("Item Shortcut %d"), 4),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut5", SDLK_5,
+ strprintf(N_("Item Shortcut %d"), 5),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut6", SDLK_6,
+ strprintf(N_("Item Shortcut %d"), 6),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut7", SDLK_7,
+ strprintf(N_("Item Shortcut %d"), 7),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut8", SDLK_8,
+ strprintf(N_("Item Shortcut %d"), 8),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut9", SDLK_9,
+ strprintf(N_("Item Shortcut %d"), 9),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut10", SDLK_0,
+ strprintf(N_("Item Shortcut %d"), 10),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut11", SDLK_MINUS,
+ strprintf(N_("Item Shortcut %d"), 11),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut12", SDLK_EQUALS,
+ strprintf(N_("Item Shortcut %d"), 12),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut13", SDLK_BACKSPACE,
+ strprintf(N_("Item Shortcut %d"), 13),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut14", SDLK_INSERT,
+ strprintf(N_("Item Shortcut %d"), 14),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyShortcut15", SDLK_HOME,
+ strprintf(N_("Item Shortcut %d"), 15),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
{"keyShortcut16", KeyboardConfig::KEY_NO_VALUE,
- strprintf(N_("Item Shortcut %d"), 16), KeyboardConfig::GRP_DEFAULT},
+ strprintf(N_("Item Shortcut %d"), 16),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
{"keyShortcut17", KeyboardConfig::KEY_NO_VALUE,
- strprintf(N_("Item Shortcut %d"), 17), KeyboardConfig::GRP_DEFAULT},
+ strprintf(N_("Item Shortcut %d"), 17),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
{"keyShortcut18", KeyboardConfig::KEY_NO_VALUE,
- strprintf(N_("Item Shortcut %d"), 18), KeyboardConfig::GRP_DEFAULT},
+ strprintf(N_("Item Shortcut %d"), 18),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
{"keyShortcut19", KeyboardConfig::KEY_NO_VALUE,
- strprintf(N_("Item Shortcut %d"), 19), KeyboardConfig::GRP_DEFAULT},
+ strprintf(N_("Item Shortcut %d"), 19),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
{"keyShortcut20", KeyboardConfig::KEY_NO_VALUE,
- strprintf(N_("Item Shortcut %d"), 20), KeyboardConfig::GRP_DEFAULT},
- {"", 0, N_("Windows Keys"), 0},
- {"keyWindowHelp", SDLK_F1, N_("Help Window"), KeyboardConfig::GRP_DEFAULT
- | KeyboardConfig::GRP_GUI},
- {"keyWindowStatus", SDLK_F2, N_("Status Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowInventory", SDLK_F3, N_("Inventory Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowEquipment", SDLK_F4, N_("Equipment Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowSkill", SDLK_F5, N_("Skill Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowMinimap", SDLK_F6, N_("Minimap Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowChat", SDLK_F7, N_("Chat Window"), KeyboardConfig::GRP_DEFAULT
- | KeyboardConfig::GRP_GUI},
- {"keyWindowShortcut", SDLK_F8, N_("Item Shortcut Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowSetup", SDLK_F9, N_("Setup Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowDebug", SDLK_F10, N_("Debug Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowSocial", SDLK_F11, N_("Social Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowEmoteBar", SDLK_F12, N_("Emote Shortcut Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowOutfit", SDLK_BACKQUOTE, N_("Outfits Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowShop", -1, N_("Shop Window"), KeyboardConfig::GRP_DEFAULT
- | KeyboardConfig::GRP_GUI},
- {"keyWindowDrop", SDLK_w, N_("Quick drop Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowKills", SDLK_e, N_("Kill Stats Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowSpells", SDLK_j, N_("Commands Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyWindowBotChecker", SDLK_LEFTBRACKET, N_("Bot Checker Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
+ strprintf(N_("Item Shortcut %d"), 20),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::shortcut,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"", 0,
+ N_("Windows Keys"),
+ 0,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyWindowHelp", SDLK_F1,
+ N_("Help Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::helpWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowStatus", SDLK_F2,
+ N_("Status Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::statusWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowInventory", SDLK_F3,
+ N_("Inventory Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::inventoryWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowEquipment", SDLK_F4,
+ N_("Equipment Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::equipmentWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowSkill", SDLK_F5,
+ N_("Skill Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::skillDialogShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowMinimap", SDLK_F6,
+ N_("Minimap Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::minimapWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowChat", SDLK_F7,
+ N_("Chat Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::chatWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowShortcut", SDLK_F8,
+ N_("Item Shortcut Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::shortcutWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowSetup", SDLK_F9,
+ N_("Setup Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::setupWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOTARGET | COND_NOINPUT | COND_ENABLED},
+ {"keyWindowDebug", SDLK_F10,
+ N_("Debug Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::debugWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowSocial", SDLK_F11,
+ N_("Social Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::socialWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowEmoteBar", SDLK_F12,
+ N_("Emote Shortcut Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::emoteShortcutWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowOutfit", SDLK_BACKQUOTE,
+ N_("Outfits Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::outfitWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowShop", -1,
+ N_("Shop Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::shopWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowDrop", SDLK_w,
+ N_("Quick drop Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::dropShortcutWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowKills", SDLK_e,
+ N_("Kill Stats Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::killStatsWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowSpells", SDLK_j,
+ N_("Commands Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::spellShortcutWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowBotChecker", SDLK_LEFTBRACKET,
+ N_("Bot Checker Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::botcheckerWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
{"keyWindowOnline", KeyboardConfig::KEY_NO_VALUE,
- _("Who Is Online Window"), KeyboardConfig::GRP_DEFAULT
- | KeyboardConfig::GRP_GUI},
- {"keyWindowDidYouKnow", -1, N_("Did you know Window"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
+ N_("Who Is Online Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::whoIsOnlineWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
+ {"keyWindowDidYouKnow", KeyboardConfig::KEY_NO_VALUE,
+ N_("Did you know Window"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::didYouKnowWindowShow,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
{"keySocialPrevTab", KeyboardConfig::KEY_NO_VALUE,
- _("Previous Social Tab"), KeyboardConfig::GRP_DEFAULT
- | KeyboardConfig::GRP_GUI},
- {"keySocialNextTab", KeyboardConfig::KEY_NO_VALUE, N_("Next Social Tab"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"", 0, N_("Emotes Keys"), 0},
- {"keySmilie", SDLK_LALT, N_("Smilie"), KeyboardConfig::GRP_DEFAULT},
- {"keyEmoteShortcut1", SDLK_1, strprintf(N_("Emote Shortcut %d"), 1),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut2", SDLK_2, strprintf(N_("Emote Shortcut %d"), 2),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut3", SDLK_3, strprintf(N_("Emote Shortcut %d"), 3),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut4", SDLK_4, strprintf(N_("Emote Shortcut %d"), 4),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut5", SDLK_5, strprintf(N_("Emote Shortcut %d"), 5),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut6", SDLK_6, strprintf(N_("Emote Shortcut %d"), 6),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut7", SDLK_7, strprintf(N_("Emote Shortcut %d"), 7),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut8", SDLK_8, strprintf(N_("Emote Shortcut %d"), 8),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut9", SDLK_9, strprintf(N_("Emote Shortcut %d"), 9),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut10", SDLK_0, strprintf(N_("Emote Shortcut %d"), 10),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut11", SDLK_MINUS, strprintf(N_("Emote Shortcut %d"), 11),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut12", SDLK_EQUALS, strprintf(N_("Emote Shortcut %d"), 12),
- KeyboardConfig::GRP_EMOTION},
+ N_("Previous Social Tab"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::prevSocialTab,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOINPUT},
+ {"keySocialNextTab", KeyboardConfig::KEY_NO_VALUE,
+ N_("Next Social Tab"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::nextSocialTab,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOINPUT},
+ {"", 0,
+ N_("Emotes Keys"),
+ 0,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keySmilie", SDLK_LALT,
+ N_("Smilie"),
+ KeyboardConfig::GRP_DEFAULT,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyEmoteShortcut1", SDLK_1,
+ strprintf(N_("Emote Shortcut %d"), 1),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut2", SDLK_2,
+ strprintf(N_("Emote Shortcut %d"), 2),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut3", SDLK_3,
+ strprintf(N_("Emote Shortcut %d"), 3),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut4", SDLK_4,
+ strprintf(N_("Emote Shortcut %d"), 4),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut5", SDLK_5,
+ strprintf(N_("Emote Shortcut %d"), 5),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut6", SDLK_6,
+ strprintf(N_("Emote Shortcut %d"), 6),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut7", SDLK_7,
+ strprintf(N_("Emote Shortcut %d"), 7),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut8", SDLK_8,
+ strprintf(N_("Emote Shortcut %d"), 8),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut9", SDLK_9,
+ strprintf(N_("Emote Shortcut %d"), 9),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut10", SDLK_0,
+ strprintf(N_("Emote Shortcut %d"), 10),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut11", SDLK_MINUS,
+ strprintf(N_("Emote Shortcut %d"), 11),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut12", SDLK_EQUALS,
+ strprintf(N_("Emote Shortcut %d"), 12),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
{"keyEmoteShortcut13", SDLK_BACKSPACE,
strprintf(N_("Emote Shortcut %d"), 13),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut14", SDLK_INSERT, strprintf(N_("Emote Shortcut %d"), 14),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut15", SDLK_HOME, strprintf(N_("Emote Shortcut %d"), 15),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut16", SDLK_q, strprintf(N_("Emote Shortcut %d"), 16),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut17", SDLK_w, strprintf(N_("Emote Shortcut %d"), 17),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut18", SDLK_e, strprintf(N_("Emote Shortcut %d"), 18),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut19", SDLK_r, strprintf(N_("Emote Shortcut %d"), 19),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut20", SDLK_t, strprintf(N_("Emote Shortcut %d"), 20),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut21", SDLK_y, strprintf(N_("Emote Shortcut %d"), 21),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut22", SDLK_u, strprintf(N_("Emote Shortcut %d"), 22),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut23", SDLK_i, strprintf(N_("Emote Shortcut %d"), 23),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut24", SDLK_o, strprintf(N_("Emote Shortcut %d"), 24),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut25", SDLK_p, strprintf(N_("Emote Shortcut %d"), 25),
- KeyboardConfig::GRP_EMOTION},
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut14", SDLK_INSERT,
+ strprintf(N_("Emote Shortcut %d"), 14),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut15", SDLK_HOME,
+ strprintf(N_("Emote Shortcut %d"), 15),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut16", SDLK_q,
+ strprintf(N_("Emote Shortcut %d"), 16),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut17", SDLK_w,
+ strprintf(N_("Emote Shortcut %d"), 17),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut18", SDLK_e,
+ strprintf(N_("Emote Shortcut %d"), 18),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut19", SDLK_r,
+ strprintf(N_("Emote Shortcut %d"), 19),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut20", SDLK_t,
+ strprintf(N_("Emote Shortcut %d"), 20),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut21", SDLK_y,
+ strprintf(N_("Emote Shortcut %d"), 21),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut22", SDLK_u,
+ strprintf(N_("Emote Shortcut %d"), 22),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut23", SDLK_i,
+ strprintf(N_("Emote Shortcut %d"), 23),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut24", SDLK_o,
+ strprintf(N_("Emote Shortcut %d"), 24),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut25", SDLK_p,
+ strprintf(N_("Emote Shortcut %d"), 25),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
{"keyEmoteShortcut26", SDLK_LEFTBRACKET,
strprintf(N_("Emote Shortcut %d"), 26),
- KeyboardConfig::GRP_EMOTION},
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
{"keyEmoteShortcut27", SDLK_RIGHTBRACKET,
strprintf(N_("Emote Shortcut %d"), 27),
- KeyboardConfig::GRP_EMOTION},
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
{"keyEmoteShortcut28", SDLK_BACKSLASH,
strprintf(N_("Emote Shortcut %d"), 28),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut29", SDLK_a, strprintf(N_("Emote Shortcut %d"), 29),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut30", SDLK_s, strprintf(N_("Emote Shortcut %d"), 30),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut31", SDLK_d, strprintf(N_("Emote Shortcut %d"), 31),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut32", SDLK_f, strprintf(N_("Emote Shortcut %d"), 32),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut33", SDLK_g, strprintf(N_("Emote Shortcut %d"), 33),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut34", SDLK_h, strprintf(N_("Emote Shortcut %d"), 34),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut35", SDLK_j, strprintf(N_("Emote Shortcut %d"), 35),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut36", SDLK_k, strprintf(N_("Emote Shortcut %d"), 36),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut37", SDLK_l, strprintf(N_("Emote Shortcut %d"), 37),
- KeyboardConfig::GRP_EMOTION},
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut29", SDLK_a,
+ strprintf(N_("Emote Shortcut %d"), 29),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut30", SDLK_s,
+ strprintf(N_("Emote Shortcut %d"), 30),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut31", SDLK_d,
+ strprintf(N_("Emote Shortcut %d"), 31),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut32", SDLK_f,
+ strprintf(N_("Emote Shortcut %d"), 32),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut33", SDLK_g,
+ strprintf(N_("Emote Shortcut %d"), 33),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut34", SDLK_h,
+ strprintf(N_("Emote Shortcut %d"), 34),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut35", SDLK_j,
+ strprintf(N_("Emote Shortcut %d"), 35),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut36", SDLK_k,
+ strprintf(N_("Emote Shortcut %d"), 36),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut37", SDLK_l,
+ strprintf(N_("Emote Shortcut %d"), 37),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
{"keyEmoteShortcut38", SDLK_SEMICOLON,
strprintf(N_("Emote Shortcut %d"), 38),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut39", SDLK_QUOTE, strprintf(N_("Emote Shortcut %d"), 39),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut40", SDLK_z, strprintf(N_("Emote Shortcut %d"), 40),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut41", SDLK_x, strprintf(N_("Emote Shortcut %d"), 41),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut42", SDLK_c, strprintf(N_("Emote Shortcut %d"), 42),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut43", SDLK_v, strprintf(N_("Emote Shortcut %d"), 43),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut44", SDLK_b, strprintf(N_("Emote Shortcut %d"), 44),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut45", SDLK_n, strprintf(N_("Emote Shortcut %d"), 45),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut46", SDLK_m, strprintf(N_("Emote Shortcut %d"), 46),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut47", SDLK_COMMA, strprintf(N_("Emote Shortcut %d"), 47),
- KeyboardConfig::GRP_EMOTION},
- {"keyEmoteShortcut48", SDLK_PERIOD, strprintf(N_("Emote Shortcut %d"), 48),
- KeyboardConfig::GRP_EMOTION},
- {"", 0, N_("Outfits Keys"), 0},
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut39", SDLK_QUOTE,
+ strprintf(N_("Emote Shortcut %d"), 39),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut40", SDLK_z,
+ strprintf(N_("Emote Shortcut %d"), 40),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut41", SDLK_x,
+ strprintf(N_("Emote Shortcut %d"), 41),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut42", SDLK_c,
+ strprintf(N_("Emote Shortcut %d"), 42),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut43", SDLK_v,
+ strprintf(N_("Emote Shortcut %d"), 43),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut44", SDLK_b,
+ strprintf(N_("Emote Shortcut %d"), 44),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut45", SDLK_n,
+ strprintf(N_("Emote Shortcut %d"), 45),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut46", SDLK_m,
+ strprintf(N_("Emote Shortcut %d"), 46),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut47", SDLK_COMMA,
+ strprintf(N_("Emote Shortcut %d"), 47),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"keyEmoteShortcut48", SDLK_PERIOD,
+ strprintf(N_("Emote Shortcut %d"), 48),
+ KeyboardConfig::GRP_EMOTION,
+ &ActionManager::emote,
+ KeyboardConfig::KEY_NO_VALUE, 100,
+ COND_GAME},
+ {"", 0,
+ N_("Outfits Keys"),
+ 0,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
{"keyWearOutfit", SDLK_RCTRL, N_("Wear Outfit"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_DEFAULT, nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50, COND_DEFAULT},
{"keyCopyOutfit", SDLK_RALT, N_("Copy Outfit"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyCopyEquipedOutfit", SDLK_RIGHTBRACKET, N_("Copy equipped to Outfit"),
- KeyboardConfig::GRP_DEFAULT},
- {"", 0, N_("Chat Keys"), 0},
- {"keyChat", SDLK_RETURN, N_("Toggle Chat"), KeyboardConfig::GRP_DEFAULT
- | KeyboardConfig::GRP_CHAT},
- {"keyChatScrollUp", SDLK_PAGEUP, N_("Scroll Chat Up"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyChatScrollDown", SDLK_PAGEDOWN, N_("Scroll Chat Down"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyChatPrevTab", SDLK_KP7, N_("Previous Chat Tab"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
- {"keyChatNextTab", SDLK_KP9, N_("Next Chat Tab"),
- KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI},
+ KeyboardConfig::GRP_DEFAULT, nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50, COND_DEFAULT},
+ {"keyCopyEquipedOutfit", SDLK_RIGHTBRACKET,
+ N_("Copy equipped to Outfit"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::copyEquippedToOutfit,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"", 0, N_("Chat Keys"), 0, nullptr, KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyChat", SDLK_RETURN,
+ N_("Toggle Chat"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_CHAT,
+ &ActionManager::toggleChat,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME},
+ {"keyChatScrollUp", SDLK_PAGEUP,
+ N_("Scroll Chat Up"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::scrollChatUp,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyChatScrollDown", SDLK_PAGEDOWN,
+ N_("Scroll Chat Down"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::scrollChatDown,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyChatPrevTab", SDLK_KP7,
+ N_("Previous Chat Tab"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::prevChatTab,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOINPUT},
+ {"keyChatNextTab", SDLK_KP9,
+ N_("Next Chat Tab"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::nextChatTab,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOINPUT},
{"keyChatCloseTab", KeyboardConfig::KEY_NO_VALUE,
- N_("Close current Chat Tab"), KeyboardConfig::GRP_DEFAULT
- | KeyboardConfig::GRP_GUI},
+ N_("Close current Chat Tab"),
+ KeyboardConfig::GRP_DEFAULT | KeyboardConfig::GRP_GUI,
+ &ActionManager::closeChatTab,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOINPUT},
{"keyChatPrevHistory", SDLK_KP7, N_("Previous chat line"),
- KeyboardConfig::GRP_CHAT},
+ KeyboardConfig::GRP_CHAT, nullptr, KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
{"keyChatNextHistory", SDLK_KP9, N_("Next chat line"),
- KeyboardConfig::GRP_CHAT},
+ KeyboardConfig::GRP_CHAT, nullptr, KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
{"keyAutoCompleteChat", SDLK_TAB, N_("Chat Auto Complete"),
- KeyboardConfig::GRP_CHAT},
+ KeyboardConfig::GRP_CHAT, nullptr, KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
{"keyDeActivateChat", SDLK_ESCAPE, N_("Deactivate Chat Input"),
- KeyboardConfig::GRP_CHAT},
- {"", 0, N_("Other Keys"), 0},
- {"keyIgnoreInput1", SDLK_LSUPER, N_("Ignore input 1"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyIgnoreInput2", SDLK_RSUPER, N_("Ignore input 2"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyDirectUp", SDLK_l, N_("Direct Up"), KeyboardConfig::GRP_DEFAULT},
- {"keyDirectDown", SDLK_SEMICOLON, N_("Direct Down"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyDirectLeft", SDLK_k, N_("Direct Left"), KeyboardConfig::GRP_DEFAULT},
- {"keyDirectRight", SDLK_QUOTE, N_("Direct Right"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyCrazyMoves", SDLK_SLASH, N_("Crazy moves"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyChangeCrazyMoveType", SDLK_BACKSLASH, N_("Change Crazy Move mode"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyQuickDrop", SDLK_y, N_("Quick Drop N Items from 0 slot"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyQuickDropN", SDLK_u, N_("Quick Drop N Items"),
- KeyboardConfig::GRP_DEFAULT},
- {"keySwitchQuickDrop", SDLK_i, N_("Switch Quick Drop Counter"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyMagicInma1", SDLK_c, N_("Quick heal target or self"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyMagicItenplz", SDLK_m, N_("Use #itenplz spell"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyMagicAttack", SDLK_b, N_("Use magic attack"),
- KeyboardConfig::GRP_DEFAULT},
- {"keySwitchMagicAttack", SDLK_COMMA, N_("Switch magic attack"),
- KeyboardConfig::GRP_DEFAULT},
+ KeyboardConfig::GRP_CHAT, nullptr, KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"", 0, N_("Other Keys"), 0, nullptr, KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyIgnoreInput1", SDLK_LSUPER,
+ N_("Ignore input 1"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::ignoreInput,
+ KeyboardConfig::KEY_NO_VALUE, 500,
+ COND_DEFAULT},
+ {"keyIgnoreInput2", SDLK_RSUPER,
+ N_("Ignore input 2"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::ignoreInput,
+ KeyboardConfig::KEY_NO_VALUE, 500,
+ COND_DEFAULT},
+ {"keyDirectUp", SDLK_l,
+ N_("Direct Up"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::directUp,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyDirectDown", SDLK_SEMICOLON,
+ N_("Direct Down"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::directDown,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyDirectLeft", SDLK_k,
+ N_("Direct Left"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::directLeft,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyDirectRight", SDLK_QUOTE,
+ N_("Direct Right"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::directRight,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT},
+ {"keyCrazyMoves", SDLK_SLASH,
+ N_("Crazy moves"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::crazyMoves,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keyChangeCrazyMoveType", SDLK_BACKSLASH,
+ N_("Change Crazy Move mode"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeCrazyMove,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
+ {"keyQuickDrop", SDLK_y,
+ N_("Quick Drop N Items from 0 slot"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::dropItem0,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keyQuickDropN", SDLK_u,
+ N_("Quick Drop N Items"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::dropItem,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keySwitchQuickDrop", SDLK_i,
+ N_("Switch Quick Drop Counter"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::switchQuickDrop,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keyMagicInma1", SDLK_c,
+ N_("Quick heal target or self"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::heal,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keyMagicItenplz", SDLK_m,
+ N_("Use #itenplz spell"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::itenplz,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keyMagicAttack", SDLK_b,
+ N_("Use magic attack"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::magicAttack,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keySwitchMagicAttack", SDLK_COMMA,
+ N_("Switch magic attack"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeMagicAttack,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
{"keySwitchPvpAttack", KeyboardConfig::KEY_NO_VALUE,
- N_("Switch pvp attack"), KeyboardConfig::GRP_DEFAULT},
- {"keyInvertDirection", SDLK_KP0, N_("Change move type"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyChangeAttackWeaponType", SDLK_g, N_("Change Attack Weapon Type"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyChangeAttackType", SDLK_END, N_("Change Attack Type"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyChangeFollowMode", SDLK_KP1, N_("Change Follow mode"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyChangeImitationMode", SDLK_KP4, N_("Change Imitation mode"),
- KeyboardConfig::GRP_DEFAULT},
+ N_("Switch pvp attack"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changePvpMode,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
+ {"keyInvertDirection", SDLK_KP0,
+ N_("Change move type"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeMoveType,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
+ {"keyChangeAttackWeaponType", SDLK_g,
+ N_("Change Attack Weapon Type"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeAttackWeaponType,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
+ {"keyChangeAttackType", SDLK_END,
+ N_("Change Attack Type"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeAttackType,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
+ {"keyChangeFollowMode", SDLK_KP1,
+ N_("Change Follow mode"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeFollowMode,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
+ {"keyChangeImitationMode", SDLK_KP4,
+ N_("Change Imitation mode"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeImitationMode,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
{"keyDisableGameModifiers", SDLK_KP8,
- _("Disable / Enable Game modifier keys"), KeyboardConfig::GRP_DEFAULT},
- {"keyChangeAudio", SDLK_KP3, N_("On / Off audio"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyAway", SDLK_KP2, N_("Enable / Disable away mode"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyRightClick", SDLK_TAB, N_("Emulate right click from keyboard"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyCameraMode", SDLK_KP_PLUS, N_("Toggle camera mode"),
- KeyboardConfig::GRP_DEFAULT},
- {"keyMod", SDLK_LSHIFT, N_("Modifier key"), KeyboardConfig::GRP_GUI}
+ N_("Disable / Enable Game modifier keys"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeGameModifier,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keyChangeAudio", SDLK_KP3,
+ N_("On / Off audio"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::changeAudio,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keyAway", SDLK_KP2,
+ N_("Enable / Disable away mode"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::away,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED},
+ {"keyRightClick", SDLK_TAB,
+ N_("Emulate right click from keyboard"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::mouseClick,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_NOINPUT | COND_NOAWAY | COND_NOMODAL},
+ {"keyCameraMode", SDLK_KP_PLUS,
+ N_("Toggle camera mode"),
+ KeyboardConfig::GRP_DEFAULT,
+ &ActionManager::camera,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_GAME | COND_VALIDSPEED | COND_EMODS},
+ {"keyMod", SDLK_LSHIFT,
+ N_("Modifier key"),
+ KeyboardConfig::GRP_GUI,
+ nullptr,
+ KeyboardConfig::KEY_NO_VALUE, 50,
+ COND_DEFAULT}
};
void KeyboardConfig::init()
@@ -371,6 +1041,10 @@ void KeyboardConfig::init()
mKey[i].caption = gettext(keyData[i].caption.c_str());
mKey[i].value = KEY_NO_VALUE;
mKey[i].grp = keyData[i].grp;
+ mKey[i].action = keyData[i].action;
+ mKey[i].modKeyIndex = keyData[i].modKeyIndex;
+ mKey[i].priority = keyData[i].priority;
+ mKey[i].condition = keyData[i].condition;
}
for (int i = KEY_EMOTE_1; i <= KEY_EMOTE_48; i ++)
{
@@ -387,6 +1061,7 @@ void KeyboardConfig::init()
mEnabled = true;
retrieve();
+ updateKeyActionMap();
}
void KeyboardConfig::retrieve()
@@ -481,18 +1156,6 @@ int KeyboardConfig::getKeyIndex(const SDL_Event &event, int grp) const
return KEY_NO_VALUE;
}
-
-int KeyboardConfig::getKeyEmoteOffset(const SDL_Event &event) const
-{
- const int keyValue = getKeyValueFromEvent(event);
- for (int i = KEY_EMOTE_1; i <= KEY_EMOTE_48; i++)
- {
- if (keyValue == mKey[i].value)
- return 1 + i - KEY_EMOTE_1;
- }
- return 0;
-}
-
bool KeyboardConfig::isActionActive(int index) const
{
if (!mActiveKeys)
@@ -561,9 +1224,64 @@ SDLKey KeyboardConfig::getKeyFromEvent(const SDL_Event &event) const
void KeyboardConfig::setNewKey(const SDL_Event &event)
{
mKey[mNewKeyIndex].value = getKeyValueFromEvent(event);
+ updateKeyActionMap();
}
void KeyboardConfig::unassignKey()
{
mKey[mNewKeyIndex].value = KEY_NO_VALUE;
+ updateKeyActionMap();
+}
+
+void KeyboardConfig::updateKeyActionMap()
+{
+ mKeyToAction.clear();
+
+ for (int i = 0; i < KEY_TOTAL; i++)
+ {
+ if (mKey[i].value != KEY_NO_VALUE && mKey[i].action)
+ mKeyToAction[mKey[i].value].push_back(i);
+ }
+
+ keySorter.keys = &mKey[0];
+ KeyToActionMapIter it = mKeyToAction.begin();
+ KeyToActionMapIter it_end = mKeyToAction.end();
+ for (; it != it_end; ++ it)
+ {
+ KeysVector *keys = &it->second;
+ if (keys->size() > 1)
+ sort(keys->begin(), keys->end(), keySorter);
+ }
+}
+
+bool KeyboardConfig::triggerAction(const SDL_Event &event)
+{
+ const int i = getKeyValueFromEvent(event);
+// logger->log("key triggerAction: %d", i);
+ if (i != 0 && i < SDLK_LAST && mKeyToAction.find(i) != mKeyToAction.end())
+ {
+ const KeysVector &ptrs = mKeyToAction[i];
+// logger->log("ptrs: %d", (int)ptrs.size());
+ KeysVectorCIter it = ptrs.begin();
+ KeysVectorCIter it_end = ptrs.end();
+
+ int mask = inputManager.getInputConditionMask();
+
+ for (; it != it_end; ++ it)
+ {
+ const int keyNum = *it;
+ if (keyNum < 0 || keyNum >= KEY_TOTAL)
+ continue;
+
+ if (inputManager.checkKey(&mKey[keyNum], mask))
+ {
+ InputEvent evt(keyNum, mask);
+ if ((*(mKey[keyNum].action))(evt))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index 009ede631..a7542f17c 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -27,9 +27,19 @@
#include <SDL_keyboard.h>
#include <string>
+#include <vector>
+
+#include "actionmanager.h"
union SDL_Event;
+typedef std::vector<int> KeysVector;
+typedef KeysVector::iterator KeysVectorIter;
+typedef KeysVector::const_iterator KeysVectorCIter;
+
+typedef std::map<int, KeysVector> KeyToActionMap;
+typedef KeyToActionMap::iterator KeyToActionMapIter;
+
/**
* Each key represents a key function. Such as 'Move up', 'Attack' etc.
*/
@@ -40,6 +50,10 @@ struct KeyFunction
std::string caption; /** The caption value for the key function. */
int value; /** The actual value that is used. */
int grp; /** The key group */
+ ActionFuncPtr action; /** The key action function */
+ int modKeyIndex; /** Modifier what enable this key action */
+ int priority; /** Action priority */
+ int condition; /** Condition for allow use key */
};
class Setup_Keyboard;
@@ -110,11 +124,6 @@ class KeyboardConfig
int getKeyIndex(const SDL_Event &event, int grp = 1) const;
/**
- * Get the key function index for an emote by providing the offset value.
- */
- int getKeyEmoteOffset(const SDL_Event &event) const;
-
- /**
* Set the enable flag, which will stop the user from doing actions.
*/
void setEnabled(bool flag)
@@ -162,6 +171,10 @@ class KeyboardConfig
void unassignKey();
+ void updateKeyActionMap();
+
+ bool triggerAction(const SDL_Event &event);
+
/**
* All the key functions.
* KEY_NO_VALUE is used in initialization, and should be unchanged.
@@ -360,6 +373,8 @@ class KeyboardConfig
Uint8 *mActiveKeys; /**< Stores a list of all the keys */
std::string mBindError;
+
+ KeyToActionMap mKeyToAction;
};
extern KeyboardConfig keyboard;