From 16f09001982bf8ebb853467d45376e38d94340d3 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 24 May 2024 17:58:27 +1000 Subject: [PATCH] Rename keybinds to more general input binds --- src/Camera.c | 8 ++-- src/Entity.c | 12 ++--- src/EntityComponents.h | 2 +- src/Game.c | 2 +- src/Input.c | 105 +++++++++++++++++++++++------------------ src/Input.h | 67 +++++++++++++------------- src/Menus.c | 36 +++++++------- src/Screens.c | 20 ++++---- src/TouchUI.c | 12 ++--- src/Widgets.c | 12 ++--- src/Window_GCWii.c | 6 +-- src/Window_N64.c | 28 +++++------ 12 files changed, 162 insertions(+), 148 deletions(-) diff --git a/src/Camera.c b/src/Camera.c index 2b4a8e698..776fc2f95 100644 --- a/src/Camera.c +++ b/src/Camera.c @@ -27,10 +27,10 @@ void Camera_KeyLookUpdate(float delta) { /* divide by 25 to have reasonable sensitivity for default mouse sens */ float amount = (Camera.Sensitivity / 25.0f) * (1000 * delta); - if (KeyBind_IsPressed(KEYBIND_LOOK_UP)) cam_deltaY -= amount; - if (KeyBind_IsPressed(KEYBIND_LOOK_DOWN)) cam_deltaY += amount; - if (KeyBind_IsPressed(KEYBIND_LOOK_LEFT)) cam_deltaX -= amount; - if (KeyBind_IsPressed(KEYBIND_LOOK_RIGHT)) cam_deltaX += amount; + if (InputBind_IsPressed(BIND_LOOK_UP)) cam_deltaY -= amount; + if (InputBind_IsPressed(BIND_LOOK_DOWN)) cam_deltaY += amount; + if (InputBind_IsPressed(BIND_LOOK_LEFT)) cam_deltaX -= amount; + if (InputBind_IsPressed(BIND_LOOK_RIGHT)) cam_deltaX += amount; } /*########################################################################################################################* diff --git a/src/Entity.c b/src/Entity.c index 165414f4a..309303c6a 100644 --- a/src/Entity.c +++ b/src/Entity.c @@ -655,16 +655,16 @@ static void LocalPlayer_HandleInput(struct LocalPlayer* p, float* xMoving, float *xMoving *= 0.98f; *zMoving *= 0.98f; - p->Physics.Jumping = KeyBind_IsPressed(KEYBIND_JUMP); - hacks->FlyingUp = KeyBind_IsPressed(KEYBIND_FLY_UP); - hacks->FlyingDown = KeyBind_IsPressed(KEYBIND_FLY_DOWN); + p->Physics.Jumping = InputBind_IsPressed(BIND_JUMP); + hacks->FlyingUp = InputBind_IsPressed(BIND_FLY_UP); + hacks->FlyingDown = InputBind_IsPressed(BIND_FLY_DOWN); if (hacks->WOMStyleHacks && hacks->Enabled && hacks->CanNoclip) { if (hacks->Noclip) { /* need a { } block because it's a macro */ Vec3_Set(p->Base.Velocity, 0,0,0); } - HacksComp_SetNoclip(hacks, KeyBind_IsPressed(KEYBIND_NOCLIP)); + HacksComp_SetNoclip(hacks, InputBind_IsPressed(BIND_NOCLIP)); } } @@ -672,8 +672,8 @@ static void LocalPlayer_InputSet(int key, cc_bool pressed) { struct HacksComp* hacks = &LocalPlayer_Instances[0].Hacks; if (pressed && !hacks->Enabled) return; - if (KeyBind_Claims(KEYBIND_SPEED, key)) hacks->Speeding = pressed; - if (KeyBind_Claims(KEYBIND_HALF_SPEED, key)) hacks->HalfSpeeding = pressed; + if (InputBind_Claims(BIND_SPEED, key)) hacks->Speeding = pressed; + if (InputBind_Claims(BIND_HALF_SPEED, key)) hacks->HalfSpeeding = pressed; } static void LocalPlayer_InputDown(void* obj, int key, cc_bool was) { diff --git a/src/EntityComponents.h b/src/EntityComponents.h index 1fd394c2d..d196f0b4a 100644 --- a/src/EntityComponents.h +++ b/src/EntityComponents.h @@ -38,7 +38,7 @@ void TiltComp_GetCurrent(struct LocalPlayer* p, struct TiltComp* anim, float t); struct HacksComp { cc_bool IsOp; cc_bool Floating; /* true if NoClip or Flying */ - /* Speed player move at, relative to normal speed, when the 'speeding' key binding is held down */ + /* Speed player move at, relative to normal speed, when the 'speeding' input binding is active */ float SpeedMultiplier; /* Whether blocks that the player places that intersect themselves, should cause the player to be pushed back in the opposite direction of the placed block */ diff --git a/src/Game.c b/src/Game.c index 1ee4a4cb5..194a18337 100644 --- a/src/Game.c +++ b/src/Game.c @@ -675,7 +675,7 @@ static CC_INLINE void Game_RenderFrame(double delta) { if (!Window_Main.Focused && !Gui.InputGrab) Gui_ShowPauseMenu(); - if (KeyBind_IsPressed(KEYBIND_ZOOM_SCROLL) && !Gui.InputGrab) { + if (InputBind_IsPressed(BIND_ZOOM_SCROLL) && !Gui.InputGrab) { InputHandler_SetFOV(Camera.ZoomFov); } diff --git a/src/Input.c b/src/Input.c index 9373e8a9a..b49aa89bb 100644 --- a/src/Input.c +++ b/src/Input.c @@ -377,10 +377,10 @@ void Pointer_SetPosition(int idx, int x, int y) { /*########################################################################################################################* *---------------------------------------------------------Keybinds--------------------------------------------------------* *#########################################################################################################################*/ -cc_uint8 KeyBinds_Gamepad[KEYBIND_COUNT]; -cc_uint8 KeyBinds_Normal[KEYBIND_COUNT]; +cc_uint8 PadBind_Mappings[BIND_COUNT]; +cc_uint8 KeyBind_Mappings[BIND_COUNT]; -const cc_uint8 KeyBind_GamepadDefaults[KEYBIND_COUNT] = { +const cc_uint8 PadBind_Defaults[BIND_COUNT] = { CCPAD_UP, CCPAD_DOWN, CCPAD_LEFT, CCPAD_RIGHT, /* Movement */ CCPAD_A, 0, CCPAD_START, CCPAD_Y, /* Jump, SetSpawn, OpenChat */ CCPAD_X, 0, CCPAD_START, 0, /* Inventory, EnterChat */ @@ -393,7 +393,7 @@ const cc_uint8 KeyBind_GamepadDefaults[KEYBIND_COUNT] = { 0,0,0, 0,0,0, 0,0,0, /* Hotbar slots */ CCPAD_ZL, CCPAD_ZR }; -const cc_uint8 KeyBind_NormalDefaults[KEYBIND_COUNT] = { +const cc_uint8 KeyBind_Defaults[BIND_COUNT] = { 'W', 'S', 'A', 'D', CCKEY_SPACE, 'R', CCKEY_ENTER, 'T', 'B', 'F', CCKEY_ENTER, CCKEY_TAB, @@ -408,7 +408,7 @@ const cc_uint8 KeyBind_NormalDefaults[KEYBIND_COUNT] = { 0, 0 }; -static const char* const keybindNames[KEYBIND_COUNT] = { +static const char* const keybindNames[BIND_COUNT] = { "Forward", "Back", "Left", "Right", "Jump", "Respawn", "SetSpawn", "Chat", "Inventory", "ToggleFog", "SendChat", "PlayerList", @@ -425,9 +425,13 @@ static const char* const keybindNames[KEYBIND_COUNT] = { "HotbarLeft", "HotbarRight" }; -cc_bool KeyBind_IsPressed(KeyBind binding) { - return Input.Pressed[KeyBinds_Normal[binding]] || - Input.Pressed[KeyBinds_Gamepad[binding]]; +cc_bool InputBind_Claims(InputBind binding, int btn) { + return KeyBind_Mappings[binding] == btn || PadBind_Mappings[binding] == btn; +} + +cc_bool InputBind_IsPressed(InputBind binding) { + return Input.Pressed[KeyBind_Mappings[binding]] || + Input.Pressed[PadBind_Mappings[binding]]; } static void KeyBind_Load(const char* prefix, cc_uint8* keybinds, const cc_uint8* defaults) { @@ -435,7 +439,7 @@ static void KeyBind_Load(const char* prefix, cc_uint8* keybinds, const cc_uint8* int mapping, i; String_InitArray_NT(name, nameBuffer); - for (i = 0; i < KEYBIND_COUNT; i++) + for (i = 0; i < BIND_COUNT; i++) { name.length = 0; String_Format1(&name, prefix, keybindNames[i]); @@ -448,22 +452,29 @@ static void KeyBind_Load(const char* prefix, cc_uint8* keybinds, const cc_uint8* } } -void KeyBind_Set(KeyBind binding, int key, cc_uint8* binds) { +static void InputBind_Set(InputBind binding, int key, cc_uint8* binds, const char* fmt) { cc_string name; char nameBuffer[STRING_SIZE]; cc_string value; String_InitArray(name, nameBuffer); - String_Format1(&name, binds == KeyBinds_Gamepad ? "pad-%c" : "key-%c", - keybindNames[binding]); + String_Format1(&name, fmt, keybindNames[binding]); value = String_FromReadonly(storageNames[key]); Options_SetString(&name, &value); binds[binding] = key; } -/* Initialises and loads key bindings from options */ +void KeyBind_Set(InputBind binding, int key) { + InputBind_Set(binding, key, KeyBind_Mappings, "key-%c"); +} + +void PadBind_Set(InputBind binding, int key) { + InputBind_Set(binding, key, PadBind_Mappings, "pad-%c"); +} + +/* Initialises and loads input bindings from options */ static void KeyBind_Init(void) { - KeyBind_Load("key-%c", KeyBinds_Normal, KeyBind_NormalDefaults); - KeyBind_Load("pad-%c", KeyBinds_Gamepad, KeyBind_GamepadDefaults); + KeyBind_Load("key-%c", KeyBind_Mappings, KeyBind_Defaults); + KeyBind_Load("pad-%c", PadBind_Mappings, PadBind_Defaults); } @@ -972,9 +983,9 @@ void InputHandler_Tick(void) { /* elapsed time using DateTime_CurrentUTC_MS() instead */ input_lastClick = now; - left = KeyBind_IsPressed(KEYBIND_DELETE_BLOCK); - middle = KeyBind_IsPressed(KEYBIND_PICK_BLOCK); - right = KeyBind_IsPressed(KEYBIND_PLACE_BLOCK); + left = InputBind_IsPressed(BIND_DELETE_BLOCK); + middle = InputBind_IsPressed(BIND_PICK_BLOCK); + right = InputBind_IsPressed(BIND_PLACE_BLOCK); #ifdef CC_BUILD_TOUCH if (Input_TouchMode) { @@ -1039,7 +1050,7 @@ cc_bool Input_HandleMouseWheel(float delta) { hotbar = Input_IsAltPressed() || Input_IsCtrlPressed() || Input_IsShiftPressed(); if (!hotbar && Camera.Active->Zoom(delta)) return true; - if (!KeyBind_IsPressed(KEYBIND_ZOOM_SCROLL)) return false; + if (!InputBind_IsPressed(BIND_ZOOM_SCROLL)) return false; h = &Entities.CurPlayer->Hacks; if (!h->Enabled || !h->CanUseThirdPerson) return false; @@ -1059,13 +1070,13 @@ static void InputHandler_CheckZoomFov(void* obj) { static cc_bool HandleBlockKey(int key) { if (Gui.InputGrab) return false; - if (KeyBind_Claims(KEYBIND_DELETE_BLOCK, key)) { + if (InputBind_Claims(BIND_DELETE_BLOCK, key)) { MouseStatePress(MOUSE_LEFT); InputHandler_DeleteBlock(); - } else if (KeyBind_Claims(KEYBIND_PLACE_BLOCK, key)) { + } else if (InputBind_Claims(BIND_PLACE_BLOCK, key)) { MouseStatePress(MOUSE_RIGHT); InputHandler_PlaceBlock(); - } else if (KeyBind_Claims(KEYBIND_PICK_BLOCK, key)) { + } else if (InputBind_Claims(BIND_PICK_BLOCK, key)) { MouseStatePress(MOUSE_MIDDLE); InputHandler_PickBlock(); } else { @@ -1075,32 +1086,32 @@ static cc_bool HandleBlockKey(int key) { } static cc_bool HandleNonClassicKey(int key) { - if (KeyBind_Claims(KEYBIND_HIDE_GUI, key)) { + if (InputBind_Claims(BIND_HIDE_GUI, key)) { Game_HideGui = !Game_HideGui; - } else if (KeyBind_Claims(KEYBIND_SMOOTH_CAMERA, key)) { + } else if (InputBind_Claims(BIND_SMOOTH_CAMERA, key)) { InputHandler_Toggle(key, &Camera.Smooth, " &eSmooth camera is &aenabled", " &eSmooth camera is &cdisabled"); - } else if (KeyBind_Claims(KEYBIND_AXIS_LINES, key)) { + } else if (InputBind_Claims(BIND_AXIS_LINES, key)) { InputHandler_Toggle(key, &AxisLinesRenderer_Enabled, " &eAxis lines (&4X&e, &2Y&e, &1Z&e) now show", " &eAxis lines no longer show"); - } else if (KeyBind_Claims(KEYBIND_AUTOROTATE, key)) { + } else if (InputBind_Claims(BIND_AUTOROTATE, key)) { InputHandler_Toggle(key, &AutoRotate_Enabled, " &eAuto rotate is &aenabled", " &eAuto rotate is &cdisabled"); - } else if (KeyBind_Claims(KEYBIND_THIRD_PERSON, key)) { + } else if (InputBind_Claims(BIND_THIRD_PERSON, key)) { Camera_CycleActive(); - } else if (KeyBind_Claims(KEYBIND_DROP_BLOCK, key)) { + } else if (InputBind_Claims(BIND_DROP_BLOCK, key)) { if (Inventory_CheckChangeSelected() && Inventory_SelectedBlock != BLOCK_AIR) { /* Don't assign SelectedIndex directly, because we don't want held block switching positions if they already have air in their inventory hotbar. */ Inventory_Set(Inventory.SelectedIndex, BLOCK_AIR); Event_RaiseVoid(&UserEvents.HeldBlockChanged); } - } else if (KeyBind_Claims(KEYBIND_IDOVERLAY, key)) { + } else if (InputBind_Claims(BIND_IDOVERLAY, key)) { TexIdsOverlay_Show(); - } else if (KeyBind_Claims(KEYBIND_BREAK_LIQUIDS, key)) { + } else if (InputBind_Claims(BIND_BREAK_LIQUIDS, key)) { InputHandler_Toggle(key, &Game_BreakableLiquids, " &eBreakable liquids is &aenabled", " &eBreakable liquids is &cdisabled"); @@ -1111,11 +1122,11 @@ static cc_bool HandleNonClassicKey(int key) { } static cc_bool HandleCoreKey(int key) { - if (KeyBind_Claims(KEYBIND_HIDE_FPS, key)) { + if (InputBind_Claims(BIND_HIDE_FPS, key)) { Gui.ShowFPS = !Gui.ShowFPS; - } else if (KeyBind_Claims(KEYBIND_FULLSCREEN, key)) { + } else if (InputBind_Claims(BIND_FULLSCREEN, key)) { Game_ToggleFullscreen(); - } else if (KeyBind_Claims(KEYBIND_FOG, key)) { + } else if (InputBind_Claims(BIND_FOG, key)) { Game_CycleViewDistance(); } else if (key == CCKEY_F5 && Game_ClassicMode) { int weather = Env.Weather == WEATHER_SUNNY ? WEATHER_RAINY : WEATHER_SUNNY; @@ -1146,15 +1157,15 @@ static void HandleHotkeyDown(int key) { static cc_bool HandleLocalPlayerKey(int key) { struct LocalPlayer* p = Entities.CurPlayer; - if (KeyBind_Claims(KEYBIND_RESPAWN, key)) { + if (InputBind_Claims(BIND_RESPAWN, key)) { return LocalPlayer_HandleRespawn(p); - } else if (KeyBind_Claims(KEYBIND_SET_SPAWN, key)) { + } else if (InputBind_Claims(BIND_SET_SPAWN, key)) { return LocalPlayer_HandleSetSpawn(p); - } else if (KeyBind_Claims(KEYBIND_FLY, key)) { + } else if (InputBind_Claims(BIND_FLY, key)) { return LocalPlayer_HandleFly(p); - } else if (KeyBind_Claims(KEYBIND_NOCLIP, key)) { + } else if (InputBind_Claims(BIND_NOCLIP, key)) { return LocalPlayer_HandleNoclip(p); - } else if (KeyBind_Claims(KEYBIND_JUMP, key)) { + } else if (InputBind_Claims(BIND_JUMP, key)) { return LocalPlayer_HandleJump(p); } return false; @@ -1227,7 +1238,7 @@ static void OnInputDown(void* obj, int key, cc_bool was) { if (InputHandler_IsShutdown(key)) { /* TODO: Do we need a separate exit function in Game class? */ Window_RequestClose(); return; - } else if (KeyBind_Claims(KEYBIND_SCREENSHOT, key) && !was) { + } else if (InputBind_Claims(BIND_SCREENSHOT, key) && !was) { Game_ScreenshotRequested = true; return; } @@ -1261,7 +1272,7 @@ static void OnInputUp(void* obj, int key) { struct Screen* s; int i; - if (KeyBind_Claims(KEYBIND_ZOOM_SCROLL, key)) Camera_SetFov(Camera.DefaultFov); + if (InputBind_Claims(BIND_ZOOM_SCROLL, key)) Camera_SetFov(Camera.DefaultFov); #ifdef CC_BUILD_WEB /* When closing menus (which reacquires mouse focus) in key down, */ /* this still leaves the cursor visible. But if this is instead */ @@ -1279,18 +1290,18 @@ static void OnInputUp(void* obj, int key) { } if (Gui.InputGrab) return; - if (KeyBind_Claims(KEYBIND_DELETE_BLOCK, key)) MouseStateRelease(MOUSE_LEFT); - if (KeyBind_Claims(KEYBIND_PLACE_BLOCK, key)) MouseStateRelease(MOUSE_RIGHT); - if (KeyBind_Claims(KEYBIND_PICK_BLOCK, key)) MouseStateRelease(MOUSE_MIDDLE); + if (InputBind_Claims(BIND_DELETE_BLOCK, key)) MouseStateRelease(MOUSE_LEFT); + if (InputBind_Claims(BIND_PLACE_BLOCK, key)) MouseStateRelease(MOUSE_RIGHT); + if (InputBind_Claims(BIND_PICK_BLOCK, key)) MouseStateRelease(MOUSE_MIDDLE); } static void OnFocusChanged(void* obj) { if (!Window_Main.Focused) Input_Clear(); } static void PlayerInputNormal(struct LocalPlayer* p, float* xMoving, float* zMoving) { - if (KeyBind_IsPressed(KEYBIND_FORWARD)) *zMoving -= 1; - if (KeyBind_IsPressed(KEYBIND_BACK)) *zMoving += 1; - if (KeyBind_IsPressed(KEYBIND_LEFT)) *xMoving -= 1; - if (KeyBind_IsPressed(KEYBIND_RIGHT)) *xMoving += 1; + if (InputBind_IsPressed(BIND_FORWARD)) *zMoving -= 1; + if (InputBind_IsPressed(BIND_BACK)) *zMoving += 1; + if (InputBind_IsPressed(BIND_LEFT)) *xMoving -= 1; + if (InputBind_IsPressed(BIND_RIGHT)) *xMoving += 1; } static struct LocalPlayerInput normalInput = { PlayerInputNormal }; diff --git a/src/Input.h b/src/Input.h index 8afd58282..9aabf09ca 100644 --- a/src/Input.h +++ b/src/Input.h @@ -155,42 +155,43 @@ void Mouse_ScrollHWheel(float delta); void Pointer_SetPosition(int idx, int x, int y); -/* Enumeration of all key bindings. */ -enum KeyBind_ { - KEYBIND_FORWARD, KEYBIND_BACK, KEYBIND_LEFT, KEYBIND_RIGHT, - KEYBIND_JUMP, KEYBIND_RESPAWN, KEYBIND_SET_SPAWN, KEYBIND_CHAT, - KEYBIND_INVENTORY, KEYBIND_FOG, KEYBIND_SEND_CHAT, KEYBIND_TABLIST, - KEYBIND_SPEED, KEYBIND_NOCLIP, KEYBIND_FLY, KEYBIND_FLY_UP, KEYBIND_FLY_DOWN, - KEYBIND_EXT_INPUT, KEYBIND_HIDE_FPS, KEYBIND_SCREENSHOT, KEYBIND_FULLSCREEN, - KEYBIND_THIRD_PERSON, KEYBIND_HIDE_GUI, KEYBIND_AXIS_LINES, KEYBIND_ZOOM_SCROLL, - KEYBIND_HALF_SPEED, KEYBIND_DELETE_BLOCK, KEYBIND_PICK_BLOCK, KEYBIND_PLACE_BLOCK, - KEYBIND_AUTOROTATE, KEYBIND_HOTBAR_SWITCH, KEYBIND_SMOOTH_CAMERA, - KEYBIND_DROP_BLOCK, KEYBIND_IDOVERLAY, KEYBIND_BREAK_LIQUIDS, - KEYBIND_LOOK_UP, KEYBIND_LOOK_DOWN, KEYBIND_LOOK_RIGHT, KEYBIND_LOOK_LEFT, - KEYBIND_HOTBAR_1, KEYBIND_HOTBAR_2, KEYBIND_HOTBAR_3, - KEYBIND_HOTBAR_4, KEYBIND_HOTBAR_5, KEYBIND_HOTBAR_6, - KEYBIND_HOTBAR_7, KEYBIND_HOTBAR_8, KEYBIND_HOTBAR_9, - KEYBIND_HOTBAR_LEFT, KEYBIND_HOTBAR_RIGHT, - KEYBIND_COUNT +/* Enumeration of all input bindings. */ +enum InputBind_ { + BIND_FORWARD, BIND_BACK, BIND_LEFT, BIND_RIGHT, + BIND_JUMP, BIND_RESPAWN, BIND_SET_SPAWN, BIND_CHAT, + BIND_INVENTORY, BIND_FOG, BIND_SEND_CHAT, BIND_TABLIST, + BIND_SPEED, BIND_NOCLIP, BIND_FLY, BIND_FLY_UP, BIND_FLY_DOWN, + BIND_EXT_INPUT, BIND_HIDE_FPS, BIND_SCREENSHOT, BIND_FULLSCREEN, + BIND_THIRD_PERSON, BIND_HIDE_GUI, BIND_AXIS_LINES, BIND_ZOOM_SCROLL, + BIND_HALF_SPEED, BIND_DELETE_BLOCK, BIND_PICK_BLOCK, BIND_PLACE_BLOCK, + BIND_AUTOROTATE, BIND_HOTBAR_SWITCH, BIND_SMOOTH_CAMERA, + BIND_DROP_BLOCK, BIND_IDOVERLAY, BIND_BREAK_LIQUIDS, + BIND_LOOK_UP, BIND_LOOK_DOWN, BIND_LOOK_RIGHT, BIND_LOOK_LEFT, + BIND_HOTBAR_1, BIND_HOTBAR_2, BIND_HOTBAR_3, + BIND_HOTBAR_4, BIND_HOTBAR_5, BIND_HOTBAR_6, + BIND_HOTBAR_7, BIND_HOTBAR_8, BIND_HOTBAR_9, + BIND_HOTBAR_LEFT, BIND_HOTBAR_RIGHT, + BIND_COUNT }; -typedef int KeyBind; +typedef int InputBind; -/* The keyboard/mouse buttons that are bound to each key binding */ -extern cc_uint8 KeyBinds_Normal[KEYBIND_COUNT]; -/* The gamepad buttons that are bound to each key binding */ -extern cc_uint8 KeyBinds_Gamepad[KEYBIND_COUNT]; -/* Default keyboard/mouse button that each key binding is bound to */ -extern const cc_uint8 KeyBind_NormalDefaults[KEYBIND_COUNT]; -/* Default gamepad button that each key binding is bound to */ -extern const cc_uint8 KeyBind_GamepadDefaults[KEYBIND_COUNT]; -#define KeyBind_GetDefaults() (Input.GamepadSource ? KeyBind_GamepadDefaults : KeyBind_NormalDefaults) +/* The keyboard/mouse buttons that are bound to each input binding */ +extern cc_uint8 KeyBind_Mappings[BIND_COUNT]; +/* The gamepad buttons that are bound to each input binding */ +extern cc_uint8 PadBind_Mappings[BIND_COUNT]; +/* Default keyboard/mouse button that each input binding is bound to */ +extern const cc_uint8 KeyBind_Defaults[BIND_COUNT]; +/* Default gamepad button that each input binding is bound to */ +extern const cc_uint8 PadBind_Defaults[BIND_COUNT]; -/* Whether the given keyboard/mouse or gamepad button is bound to the given keybinding */ -#define KeyBind_Claims(binding, btn) (KeyBinds_Normal[binding] == (btn) || KeyBinds_Gamepad[binding] == (btn)) -/* Gets whether the key bound to the given key binding is pressed. */ -CC_API cc_bool KeyBind_IsPressed(KeyBind binding); -/* Set the key that the given key binding is bound to. (also updates options list) */ -void KeyBind_Set(KeyBind binding, int key, cc_uint8* binds); +/* Whether the given binding should be triggered in response to given input button being pressed */ +CC_API cc_bool InputBind_Claims(InputBind binding, int btn); +/* Gets whether the given input binding is currently being triggered */ +CC_API cc_bool InputBind_IsPressed(InputBind binding); +/* Sets the key/mouse button that the given input binding is bound to (Also updates options list) */ +void KeyBind_Set(InputBind binding, int key); +/* Sets the gamepad button that the given input binding is bound to (Also updates options list) */ +void PadBind_Set(InputBind binding, int key); /* Gamepad axes. Default behaviour is: */ diff --git a/src/Menus.c b/src/Menus.c index 88e3f1cb1..baa8238d6 100644 --- a/src/Menus.c +++ b/src/Menus.c @@ -654,7 +654,7 @@ static const char* const optsGroup_descs[8] = { "&eMusic/Sound, view bobbing, and more", "&eGui scale, font settings, and more", "&eFPS limit, view distance, entity names/shadows", - "&eSet key bindings, bind keys to act as mouse clicks", + "&eSet key and mouse bindings", "&eChat options", "&eHacks allowed, jump settings, and more", "&eEnv colours, water level, weather, and more", @@ -1948,7 +1948,7 @@ static void KeyBindsScreen_Update(struct KeyBindsScreen* s, int i) { const cc_uint8* curBinds; String_InitArray(text, textBuffer); - curBinds = binds_gamepad ? KeyBinds_Gamepad : KeyBinds_Normal; + curBinds = binds_gamepad ? PadBind_Mappings : KeyBind_Mappings; String_Format2(&text, s->curI == i ? "> %c: %c <" : "%c: %c", s->descs[i], Input_DisplayNames[curBinds[s->binds[i]]]); @@ -1972,17 +1972,19 @@ static void KeyBindsScreen_OnBindingClick(void* screen, void* widget) { static int KeyBindsScreen_KeyDown(void* screen, int key) { struct KeyBindsScreen* s = (struct KeyBindsScreen*)screen; const cc_uint8* defaults; - cc_uint8* curBinds; - KeyBind bind; + InputBind bind; int idx; if (s->curI == -1) return Menu_InputDown(s, key); - curBinds = binds_gamepad ? KeyBinds_Gamepad : KeyBinds_Normal; - defaults = binds_gamepad ? KeyBind_GamepadDefaults : KeyBind_NormalDefaults; - + defaults = binds_gamepad ? PadBind_Defaults : KeyBind_Defaults; bind = s->binds[s->curI]; if (Input_IsEscapeButton(key)) key = defaults[bind]; - KeyBind_Set(bind, key, curBinds); + + if (binds_gamepad) { + PadBind_Set(bind, key); + } else { + KeyBind_Set(bind, key); + } idx = s->curI; s->curI = -1; @@ -2108,7 +2110,7 @@ static void KeyBindsScreen_Show(int bindsCount, const cc_uint8* binds, const cha *------------------------------------------------ClassicBindingsScreen----------------------------------------------------* *#########################################################################################################################*/ void ClassicBindingsScreen_Show(void) { - static const cc_uint8 binds[] = { KEYBIND_FORWARD, KEYBIND_BACK, KEYBIND_JUMP, KEYBIND_CHAT, KEYBIND_SET_SPAWN, KEYBIND_LEFT, KEYBIND_RIGHT, KEYBIND_INVENTORY, KEYBIND_FOG, KEYBIND_RESPAWN }; + static const cc_uint8 binds[] = { BIND_FORWARD, BIND_BACK, BIND_JUMP, BIND_CHAT, BIND_SET_SPAWN, BIND_LEFT, BIND_RIGHT, BIND_INVENTORY, BIND_FOG, BIND_RESPAWN }; static const char* const descs[] = { "Forward", "Back", "Jump", "Chat", "Save location", "Left", "Right", "Build", "Toggle fog", "Load location" }; binds_gamepad = false; @@ -2127,7 +2129,7 @@ void ClassicBindingsScreen_Show(void) { *----------------------------------------------ClassicHacksBindingsScreen-------------------------------------------------* *#########################################################################################################################*/ void ClassicHacksBindingsScreen_Show(void) { - static const cc_uint8 binds[6] = { KEYBIND_SPEED, KEYBIND_NOCLIP, KEYBIND_HALF_SPEED, KEYBIND_FLY, KEYBIND_FLY_UP, KEYBIND_FLY_DOWN }; + static const cc_uint8 binds[6] = { BIND_SPEED, BIND_NOCLIP, BIND_HALF_SPEED, BIND_FLY, BIND_FLY_UP, BIND_FLY_DOWN }; static const char* const descs[6] = { "Speed", "Noclip", "Half speed", "Fly", "Fly up", "Fly down" }; binds_gamepad = false; @@ -2141,7 +2143,7 @@ void ClassicHacksBindingsScreen_Show(void) { *-------------------------------------------------NormalBindingsScreen----------------------------------------------------* *#########################################################################################################################*/ void NormalBindingsScreen_Show(void) { - static const cc_uint8 binds[] = { KEYBIND_FORWARD, KEYBIND_BACK, KEYBIND_JUMP, KEYBIND_CHAT, KEYBIND_SET_SPAWN, KEYBIND_TABLIST, KEYBIND_LEFT, KEYBIND_RIGHT, KEYBIND_INVENTORY, KEYBIND_FOG, KEYBIND_RESPAWN, KEYBIND_SEND_CHAT }; + static const cc_uint8 binds[] = { BIND_FORWARD, BIND_BACK, BIND_JUMP, BIND_CHAT, BIND_SET_SPAWN, BIND_TABLIST, BIND_LEFT, BIND_RIGHT, BIND_INVENTORY, BIND_FOG, BIND_RESPAWN, BIND_SEND_CHAT }; static const char* const descs[] = { "Forward", "Back", "Jump", "Chat", "Set spawn", "Player list", "Left", "Right", "Inventory", "Toggle fog", "Respawn", "Send chat" }; KeyBindsScreen_Reset(NULL, Menu_SwitchBindsHacks, 250); @@ -2154,7 +2156,7 @@ void NormalBindingsScreen_Show(void) { *--------------------------------------------------HacksBindingsScreen----------------------------------------------------* *#########################################################################################################################*/ void HacksBindingsScreen_Show(void) { - static const cc_uint8 binds[] = { KEYBIND_SPEED, KEYBIND_NOCLIP, KEYBIND_HALF_SPEED, KEYBIND_ZOOM_SCROLL, KEYBIND_FLY, KEYBIND_FLY_UP, KEYBIND_FLY_DOWN, KEYBIND_THIRD_PERSON }; + static const cc_uint8 binds[] = { BIND_SPEED, BIND_NOCLIP, BIND_HALF_SPEED, BIND_ZOOM_SCROLL, BIND_FLY, BIND_FLY_UP, BIND_FLY_DOWN, BIND_THIRD_PERSON }; static const char* const descs[] = { "Speed", "Noclip", "Half speed", "Scroll zoom", "Fly", "Fly up", "Fly down", "Third person" }; KeyBindsScreen_Reset(Menu_SwitchBindsNormal, Menu_SwitchBindsOther, 260); @@ -2167,7 +2169,7 @@ void HacksBindingsScreen_Show(void) { *--------------------------------------------------OtherBindingsScreen----------------------------------------------------* *#########################################################################################################################*/ void OtherBindingsScreen_Show(void) { - static const cc_uint8 binds[] = { KEYBIND_EXT_INPUT, KEYBIND_HIDE_FPS, KEYBIND_HIDE_GUI, KEYBIND_HOTBAR_SWITCH, KEYBIND_DROP_BLOCK,KEYBIND_SCREENSHOT, KEYBIND_FULLSCREEN, KEYBIND_AXIS_LINES, KEYBIND_AUTOROTATE, KEYBIND_SMOOTH_CAMERA, KEYBIND_IDOVERLAY, KEYBIND_BREAK_LIQUIDS }; + static const cc_uint8 binds[] = { BIND_EXT_INPUT, BIND_HIDE_FPS, BIND_HIDE_GUI, BIND_HOTBAR_SWITCH, BIND_DROP_BLOCK,BIND_SCREENSHOT, BIND_FULLSCREEN, BIND_AXIS_LINES, BIND_AUTOROTATE, BIND_SMOOTH_CAMERA, BIND_IDOVERLAY, BIND_BREAK_LIQUIDS }; static const char* const descs[] = { "Show ext input", "Hide FPS", "Hide gui", "Hotbar switching", "Drop block", "Screenshot", "Fullscreen", "Show axis lines", "Auto-rotate", "Smooth camera", "ID overlay", "Breakable liquids" }; KeyBindsScreen_Reset(Menu_SwitchBindsHacks, Menu_SwitchBindsMouse, 260); @@ -2180,7 +2182,7 @@ void OtherBindingsScreen_Show(void) { *--------------------------------------------------MouseBindingsScreen----------------------------------------------------* *#########################################################################################################################*/ void MouseBindingsScreen_Show(void) { - static const cc_uint8 binds[] = { KEYBIND_DELETE_BLOCK, KEYBIND_PICK_BLOCK, KEYBIND_PLACE_BLOCK, KEYBIND_LOOK_UP, KEYBIND_LOOK_DOWN, KEYBIND_LOOK_LEFT, KEYBIND_LOOK_RIGHT }; + static const cc_uint8 binds[] = { BIND_DELETE_BLOCK, BIND_PICK_BLOCK, BIND_PLACE_BLOCK, BIND_LOOK_UP, BIND_LOOK_DOWN, BIND_LOOK_LEFT, BIND_LOOK_RIGHT }; static const char* const descs[] = { "Delete block", "Pick block", "Place block", "Look Up", "Look Down", "Look Left", "Look Right" }; KeyBindsScreen_Reset(Menu_SwitchBindsOther, Menu_SwitchBindsHotbar, 260); @@ -2194,8 +2196,8 @@ void MouseBindingsScreen_Show(void) { *-------------------------------------------------HotbarBindingsScreen----------------------------------------------------* *#########################################################################################################################*/ void HotbarBindingsScreen_Show(void) { - static const cc_uint8 binds[] = { KEYBIND_HOTBAR_1,KEYBIND_HOTBAR_2,KEYBIND_HOTBAR_3, KEYBIND_HOTBAR_4,KEYBIND_HOTBAR_5,KEYBIND_HOTBAR_6, KEYBIND_HOTBAR_7,KEYBIND_HOTBAR_8,KEYBIND_HOTBAR_9, - KEYBIND_HOTBAR_LEFT, KEYBIND_HOTBAR_RIGHT }; + static const cc_uint8 binds[] = { BIND_HOTBAR_1,BIND_HOTBAR_2,BIND_HOTBAR_3, BIND_HOTBAR_4,BIND_HOTBAR_5,BIND_HOTBAR_6, BIND_HOTBAR_7,BIND_HOTBAR_8,BIND_HOTBAR_9, + BIND_HOTBAR_LEFT, BIND_HOTBAR_RIGHT }; static const char* const descs[] = { "Slot #1","Slot #2","Slot #3", "Slot #4","Slot #5","Slot #6", "Slot #7","Slot #8","Slot #9", "Slot left","Slot right" }; KeyBindsScreen_Reset(Menu_SwitchBindsMouse, NULL, 260); @@ -3731,7 +3733,7 @@ static void TexIdsOverlay_Render(void* screen, float delta) { static int TexIdsOverlay_KeyDown(void* screen, int key) { struct Screen* s = (struct Screen*)screen; - if (KeyBind_Claims(KEYBIND_IDOVERLAY, key)) { Gui_Remove(s); return true; } + if (InputBind_Claims(BIND_IDOVERLAY, key)) { Gui_Remove(s); return true; } return false; } diff --git a/src/Screens.c b/src/Screens.c index af7a71589..828ada995 100644 --- a/src/Screens.c +++ b/src/Screens.c @@ -753,7 +753,7 @@ static int TabListOverlay_PointerDown(void* screen, int id, int x, int y) { static void TabListOverlay_KeyUp(void* screen, int key) { struct TabListOverlay* s = (struct TabListOverlay*)screen; - if (!KeyBind_Claims(KEYBIND_TABLIST, key) || s->staysOpen) return; + if (!InputBind_Claims(BIND_TABLIST, key) || s->staysOpen) return; Gui_Remove((struct Screen*)s); } @@ -1313,10 +1313,10 @@ static int ChatScreen_TextChanged(void* screen, const cc_string* str) { static int ChatScreen_KeyDown(void* screen, int key) { static const cc_string slash = String_FromConst("/"); struct ChatScreen* s = (struct ChatScreen*)screen; - int playerListKey = KeyBinds_Normal[KEYBIND_TABLIST]; + int playerListKey = KeyBind_Mappings[BIND_TABLIST]; cc_bool handlesList = playerListKey != CCKEY_TAB || !Gui.TabAutocomplete || !s->grabsInput; - if (KeyBind_Claims(KEYBIND_TABLIST, key) && handlesList) { + if (InputBind_Claims(BIND_TABLIST, key) && handlesList) { if (!tablist_active && !Server.IsSinglePlayer) { TabListOverlay_Show(false); } @@ -1328,10 +1328,10 @@ static int ChatScreen_KeyDown(void* screen, int key) { if (s->grabsInput) { #ifdef CC_BUILD_WEB /* See reason for this in HandleInputUp */ - if (KeyBind_Claims(KEYBIND_SEND_CHAT, key) || key == CCKEY_KP_ENTER) { + if (InputBind_Claims(BIND_SEND_CHAT, key) || key == CCKEY_KP_ENTER) { ChatScreen_EnterChatInput(s, false); #else - if (KeyBind_Claims(KEYBIND_SEND_CHAT, key) || key == CCKEY_KP_ENTER || Input_IsEscapeButton(key)) { + if (InputBind_Claims(BIND_SEND_CHAT, key) || key == CCKEY_KP_ENTER || Input_IsEscapeButton(key)) { ChatScreen_EnterChatInput(s, Input_IsEscapeButton(key)); #endif } else if (key == CCKEY_PAGEUP) { @@ -1344,11 +1344,11 @@ static int ChatScreen_KeyDown(void* screen, int key) { return key < CCKEY_F1 || key > CCKEY_F24; } - if (KeyBind_Claims(KEYBIND_CHAT, key)) { + if (InputBind_Claims(BIND_CHAT, key)) { ChatScreen_OpenInput(&String_Empty); } else if (key == CCKEY_SLASH) { ChatScreen_OpenInput(&slash); - } else if (KeyBind_Claims(KEYBIND_INVENTORY, key)) { + } else if (InputBind_Claims(BIND_INVENTORY, key)) { InventoryScreen_Show(); } else { return false; @@ -1370,7 +1370,7 @@ static void ChatScreen_KeyUp(void* screen, int key) { if (key == CCKEY_ESCAPE) ChatScreen_EnterChatInput(s, true); #endif - if (Server.SupportsFullCP437 && KeyBind_Claims(KEYBIND_EXT_INPUT, key)) { + if (Server.SupportsFullCP437 && InputBind_Claims(BIND_EXT_INPUT, key)) { if (!Window_Main.Focused) return; ChatScreen_ToggleAltInput(s); } @@ -1719,7 +1719,7 @@ static int InventoryScreen_KeyDown(void* screen, int key) { struct TableWidget* table = &s->table; /* Accuracy: Original classic doesn't close inventory menu when B is pressed */ - if (KeyBind_Claims(KEYBIND_INVENTORY, key) && s->releasedInv && !Game_ClassicMode) { + if (InputBind_Claims(BIND_INVENTORY, key) && s->releasedInv && !Game_ClassicMode) { Gui_Remove((struct Screen*)s); } else if (Input_IsEnterButton(key) && table->selectedIndex != -1) { Inventory_SetSelectedBlock(table->blocks[table->selectedIndex]); @@ -1739,7 +1739,7 @@ static cc_bool InventoryScreen_IsHotbarActive(void) { static void InventoryScreen_KeyUp(void* screen, int key) { struct InventoryScreen* s = (struct InventoryScreen*)screen; - if (KeyBind_Claims(KEYBIND_INVENTORY, key)) s->releasedInv = true; + if (InputBind_Claims(BIND_INVENTORY, key)) s->releasedInv = true; } static int InventoryScreen_PointerDown(void* screen, int id, int x, int y) { diff --git a/src/TouchUI.c b/src/TouchUI.c index 7f359f710..3e1406312 100644 --- a/src/TouchUI.c +++ b/src/TouchUI.c @@ -553,7 +553,7 @@ static void TouchScreen_BindClick(void* screen, void* widget) { struct ButtonWidget* btn = (struct ButtonWidget*)widget; int i = btn->meta.val; - Input_Set(KeyBinds_Normal[s->descs[i].bind], true); + Input_Set(KeyBind_Mappings[s->descs[i].bind], true); } static const struct TouchButtonDesc onscreenDescs[ONSCREEN_MAX_BTNS] = { @@ -572,11 +572,11 @@ static const struct TouchButtonDesc onscreenDescs[ONSCREEN_MAX_BTNS] = { { "Hotbar", 0,0,0, TouchScreen_SwitchClick } }; static const struct TouchButtonDesc normDescs[1] = { - { "\x1E", KEYBIND_JUMP, 50, 10, TouchScreen_BindClick } + { "\x1E", BIND_JUMP, 50, 10, TouchScreen_BindClick } }; static const struct TouchButtonDesc hackDescs[2] = { - { "\x1E", KEYBIND_FLY_UP, 50, 70, TouchScreen_BindClick }, - { "\x1F", KEYBIND_FLY_DOWN, 50, 10, TouchScreen_BindClick } + { "\x1E", BIND_FLY_UP, 50, 70, TouchScreen_BindClick }, + { "\x1F", BIND_FLY_DOWN, 50, 10, TouchScreen_BindClick } }; #define TOUCHSCREEN_BTN_COLOR PackedCol_Make(255, 255, 255, 200) @@ -693,8 +693,8 @@ static void TouchScreen_PointerUp(void* screen, int id, int x, int y) { { if (!(s->btns[i].active & id)) continue; - if (s->descs[i].bind < KEYBIND_COUNT) { - Input_Set(KeyBinds_Normal[s->descs[i].bind], false); + if (s->descs[i].bind < BIND_COUNT) { + Input_Set(KeyBind_Mappings[s->descs[i].bind], false); } s->btns[i].active &= ~id; return; diff --git a/src/Widgets.c b/src/Widgets.c index 85e66bede..d5eb9bbb8 100644 --- a/src/Widgets.c +++ b/src/Widgets.c @@ -540,7 +540,7 @@ static int HotbarWidget_MapKey(int key) { int i; for (i = 0; i < INVENTORY_BLOCKS_PER_HOTBAR; i++) { - if (KeyBind_Claims(KEYBIND_HOTBAR_1 + i, key)) return i; + if (InputBind_Claims(BIND_HOTBAR_1 + i, key)) return i; } return -1; } @@ -560,14 +560,14 @@ static int HotbarWidget_KeyDown(void* widget, int key) { int index = HotbarWidget_MapKey(key); if (index == -1) { - if (KeyBind_Claims(KEYBIND_HOTBAR_LEFT, key)) + if (InputBind_Claims(BIND_HOTBAR_LEFT, key)) return HotbarWidget_CycleIndex(-1); - if (KeyBind_Claims(KEYBIND_HOTBAR_RIGHT, key)) + if (InputBind_Claims(BIND_HOTBAR_RIGHT, key)) return HotbarWidget_CycleIndex(+1); return false; } - if (KeyBind_IsPressed(KEYBIND_HOTBAR_SWITCH)) { + if (InputBind_IsPressed(BIND_HOTBAR_SWITCH)) { /* Pick from first to ninth row */ Inventory_SetHotbarIndex(index); w->altHandled = true; @@ -583,7 +583,7 @@ static void HotbarWidget_InputUp(void* widget, int key) { a) user presses alt then number b) user presses alt We only do case b) if case a) did not happen */ - if (!KeyBind_Claims(KEYBIND_HOTBAR_SWITCH, key)) return; + if (!InputBind_Claims(BIND_HOTBAR_SWITCH, key)) return; if (w->altHandled) { w->altHandled = false; return; } /* handled already */ /* Don't switch hotbar when alt+tabbing to another window */ @@ -656,7 +656,7 @@ static int HotbarWidget_MouseScroll(void* widget, float delta) { struct HotbarWidget* w = (struct HotbarWidget*)widget; int index; - if (KeyBind_IsPressed(KEYBIND_HOTBAR_SWITCH)) { + if (InputBind_IsPressed(BIND_HOTBAR_SWITCH)) { index = Inventory.Offset / INVENTORY_BLOCKS_PER_HOTBAR; index = HotbarWidget_ScrolledIndex(w, delta, index, 1); Inventory_SetHotbarIndex(index); diff --git a/src/Window_GCWii.c b/src/Window_GCWii.c index c39ba1e5b..5ae884141 100644 --- a/src/Window_GCWii.c +++ b/src/Window_GCWii.c @@ -333,14 +333,14 @@ static void ProcessNunchuck_Game(int port, int mods, float delta) { Gamepad_SetButton(port, CCPAD_START, mods & WPAD_BUTTON_HOME); Gamepad_SetButton(port, CCPAD_SELECT, mods & WPAD_BUTTON_MINUS); - Input_SetNonRepeatable(KeyBinds_Normal[KEYBIND_FLY], mods & WPAD_BUTTON_LEFT); + Input_SetNonRepeatable(KeyBind_Mappings[BIND_FLY], mods & WPAD_BUTTON_LEFT); if (mods & WPAD_BUTTON_RIGHT) { Mouse_ScrollVWheel(1.0*delta); } - Input_SetNonRepeatable(KeyBinds_Normal[KEYBIND_THIRD_PERSON], mods & WPAD_BUTTON_UP); - Input_SetNonRepeatable(KeyBinds_Normal[KEYBIND_FLY_DOWN], mods & WPAD_BUTTON_DOWN); + Input_SetNonRepeatable(KeyBind_Mappings[BIND_THIRD_PERSON], mods & WPAD_BUTTON_UP); + Input_SetNonRepeatable(KeyBind_Mappings[BIND_FLY_DOWN], mods & WPAD_BUTTON_DOWN); const float ANGLE_DELTA = 50; bool nunchuckUp = (analog.ang > -ANGLE_DELTA) && (analog.ang < ANGLE_DELTA) && (analog.mag > 0.5); diff --git a/src/Window_N64.c b/src/Window_N64.c index d42f41d17..2f0d385fb 100644 --- a/src/Window_N64.c +++ b/src/Window_N64.c @@ -37,22 +37,22 @@ void Window_Init(void) { joypad_init(); // change defaults to make more sense for N64 - cc_uint8* binds = (cc_uint8*)KeyBind_GamepadDefaults; - binds[KEYBIND_JUMP] = CCPAD_A; - binds[KEYBIND_INVENTORY] = CCPAD_B; - binds[KEYBIND_PLACE_BLOCK] = CCPAD_Z; - binds[KEYBIND_HOTBAR_RIGHT] = CCPAD_L; - binds[KEYBIND_DELETE_BLOCK] = CCPAD_R; + cc_uint8* binds = (cc_uint8*)PadBind_Defaults; + binds[BIND_JUMP] = CCPAD_A; + binds[BIND_INVENTORY] = CCPAD_B; + binds[BIND_PLACE_BLOCK] = CCPAD_Z; + binds[BIND_HOTBAR_RIGHT] = CCPAD_L; + binds[BIND_DELETE_BLOCK] = CCPAD_R; - binds[KEYBIND_FORWARD] = CCPAD_CUP; - binds[KEYBIND_BACK] = CCPAD_CDOWN; - binds[KEYBIND_LEFT] = CCPAD_CLEFT; - binds[KEYBIND_RIGHT] = CCPAD_CRIGHT; + binds[BIND_FORWARD] = CCPAD_CUP; + binds[BIND_BACK] = CCPAD_CDOWN; + binds[BIND_LEFT] = CCPAD_CLEFT; + binds[BIND_RIGHT] = CCPAD_CRIGHT; - binds[KEYBIND_FLY_UP] = CCPAD_UP; - binds[KEYBIND_FLY_DOWN] = CCPAD_DOWN; - binds[KEYBIND_SPEED] = CCPAD_LEFT; - binds[KEYBIND_FLY] = CCPAD_RIGHT; + binds[BIND_FLY_UP] = CCPAD_UP; + binds[BIND_FLY_DOWN] = CCPAD_DOWN; + binds[BIND_SPEED] = CCPAD_LEFT; + binds[BIND_FLY] = CCPAD_RIGHT; } void Window_Free(void) { }