From fb07691790debfd094b0c08be334b4c3ba860009 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 14 Dec 2014 17:05:28 +0100 Subject: [PATCH] New speed keybindings --- src/app/input.cpp | 8 ++++++-- src/common/key.h | 16 +++++++++------- src/common/restext.cpp | 4 +++- src/object/robotmain.cpp | 12 ++++++++++++ src/ui/studio.cpp | 11 ----------- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/app/input.cpp b/src/app/input.cpp index d793c32d..999a5746 100644 --- a/src/app/input.cpp +++ b/src/app/input.cpp @@ -206,11 +206,13 @@ void CInput::SetDefaultInputBindings() m_inputBindings[INPUT_SLOT_QUIT ].primary = KEY(ESCAPE); m_inputBindings[INPUT_SLOT_HELP ].primary = KEY(F1); m_inputBindings[INPUT_SLOT_PROG ].primary = KEY(F2); - m_inputBindings[INPUT_SLOT_CBOT ].primary = KEY(F3); m_inputBindings[INPUT_SLOT_VISIT ].primary = KEY(KP_PERIOD); + m_inputBindings[INPUT_SLOT_SPEED05].primary = KEY(F3); m_inputBindings[INPUT_SLOT_SPEED10].primary = KEY(F4); m_inputBindings[INPUT_SLOT_SPEED15].primary = KEY(F5); m_inputBindings[INPUT_SLOT_SPEED20].primary = KEY(F6); + m_inputBindings[INPUT_SLOT_SPEED30].primary = KEY(F7); + m_inputBindings[INPUT_SLOT_SPEED40].primary = KEY(F8); m_inputBindings[INPUT_SLOT_CAMERA_UP].primary = KEY(PAGEUP); m_inputBindings[INPUT_SLOT_CAMERA_DOWN].primary = KEY(PAGEDOWN); m_inputBindings[INPUT_SLOT_PAUSE].primary = KEY(PAUSE); @@ -311,11 +313,13 @@ static std::map keyTable = { INPUT_SLOT_QUIT, "quit" }, { INPUT_SLOT_HELP, "help" }, { INPUT_SLOT_PROG, "prog" }, - { INPUT_SLOT_CBOT, "cbot" }, { INPUT_SLOT_VISIT, "visit" }, + { INPUT_SLOT_SPEED05, "speed05" }, { INPUT_SLOT_SPEED10, "speed10" }, { INPUT_SLOT_SPEED15, "speed15" }, { INPUT_SLOT_SPEED20, "speed20" }, + { INPUT_SLOT_SPEED30, "speed30" }, + { INPUT_SLOT_SPEED40, "speed40" }, { INPUT_SLOT_CAMERA_UP, "camup" }, { INPUT_SLOT_CAMERA_DOWN, "camdown" }, }; diff --git a/src/common/key.h b/src/common/key.h index 6317506a..c16bfe0c 100644 --- a/src/common/key.h +++ b/src/common/key.h @@ -89,13 +89,15 @@ enum InputSlot INPUT_SLOT_HELP = 14, INPUT_SLOT_PROG = 15, INPUT_SLOT_VISIT = 16, - INPUT_SLOT_SPEED10 = 17, - INPUT_SLOT_SPEED15 = 18, - INPUT_SLOT_SPEED20 = 19, - INPUT_SLOT_CBOT = 20, - INPUT_SLOT_CAMERA_UP = 21, - INPUT_SLOT_CAMERA_DOWN = 22, - INPUT_SLOT_PAUSE = 23, + INPUT_SLOT_SPEED05 = 17, + INPUT_SLOT_SPEED10 = 18, + INPUT_SLOT_SPEED15 = 19, + INPUT_SLOT_SPEED20 = 20, + INPUT_SLOT_SPEED30 = 21, + INPUT_SLOT_SPEED40 = 22, + INPUT_SLOT_CAMERA_UP = 23, + INPUT_SLOT_CAMERA_DOWN = 24, + INPUT_SLOT_PAUSE = 25, INPUT_SLOT_MAX }; diff --git a/src/common/restext.cpp b/src/common/restext.cpp index d04d4621..e52a26eb 100644 --- a/src/common/restext.cpp +++ b/src/common/restext.cpp @@ -229,11 +229,13 @@ void InitializeRestext() stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_QUIT] = TR("Quit\\Quit the current mission or exercise"); stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_HELP] = TR("Instructions\\Shows the instructions for the current mission"); stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_PROG] = TR("Programming help\\Gives more detailed help with programming"); - stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_CBOT] = TR("Key word help\\More detailed help about key words"); stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_VISIT] = TR("Origin of last message\\Shows where the last message was sent from"); + stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_SPEED05] = TR("Speed 0.5x\\Half speed"); stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_SPEED10] = TR("Speed 1.0x\\Normal speed"); stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_SPEED15] = TR("Speed 1.5x\\1.5 times faster"); stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_SPEED20] = TR("Speed 2.0x\\Double speed"); + stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_SPEED30] = TR("Speed 3.0x\\Triple speed"); + stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_SPEED40] = TR("Speed 4.0x\\Quadruple speed"); stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_CAMERA_UP] = TR("Camera up\\Increase camera angle while visiting message origin"); stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_CAMERA_DOWN] = TR("Camera down\\Decrease camera angle while visiting message origin"); stringsEvent[EVENT_INTERFACE_KEY+INPUT_SLOT_PAUSE] = TR("Pause\\Pause the game without opening menu"); diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 697a53a9..f0967f8e 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -1461,6 +1461,10 @@ bool CRobotMain::ProcessEvent(Event &event) { StartDisplayVisit(EVENT_NULL); } + if (event.key.slot == INPUT_SLOT_SPEED05) + { + SetSpeed(0.5f); + } if (event.key.slot == INPUT_SLOT_SPEED10) { SetSpeed(1.0f); @@ -1473,6 +1477,14 @@ bool CRobotMain::ProcessEvent(Event &event) { SetSpeed(2.0f); } + if (event.key.slot == INPUT_SLOT_SPEED30) + { + SetSpeed(3.0f); + } + if (event.key.slot == INPUT_SLOT_SPEED40) + { + SetSpeed(4.0f); + } break; case EVENT_KEY_UP: diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 63f89f59..11fb62fc 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -253,17 +253,6 @@ bool CStudio::EventProcess(const Event &event) m_script->Step(event); } - if ( event.type == EVENT_KEY_DOWN ) - { - if ( event.key.slot == INPUT_SLOT_CBOT ) - { - if ( m_helpFilename.length() > 0 ) - { - m_main->StartDisplayInfo(const_cast(m_helpFilename.c_str()), -1); // TODO change to std::string when RobotMain changes - } - } - } - if ( event.type == EVENT_WINDOW3 ) // window is moved? { m_editActualPos = m_editFinalPos = pw->GetPos();