diff options
author | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2018-12-02 17:34:29 -0500 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2018-12-02 23:34:29 +0100 |
commit | 1b0fd195c614ffa1b04d687e7793fb5bb266c535 (patch) | |
tree | 0cfa304027f325b7bd4609adf6325e4b0b592c77 /src | |
parent | 42166fff7454aad64dfcd60a38bb5fcb75499243 (diff) | |
download | minetest-1b0fd195c614ffa1b04d687e7793fb5bb266c535.tar.gz minetest-1b0fd195c614ffa1b04d687e7793fb5bb266c535.tar.bz2 minetest-1b0fd195c614ffa1b04d687e7793fb5bb266c535.zip |
Raise hotbar limit to 32 slots, add associated keybinding options (#7916)
add associated keybinding options
update docs and settingtypes
Diffstat (limited to 'src')
-rw-r--r-- | src/client/game.cpp | 9 | ||||
-rw-r--r-- | src/client/inputhandler.cpp | 3 | ||||
-rw-r--r-- | src/client/keys.h | 9 | ||||
-rw-r--r-- | src/defaultsettings.cpp | 9 | ||||
-rw-r--r-- | src/hud.h | 2 |
5 files changed, 25 insertions, 7 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp index 418b412fa..bad29aa76 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -68,6 +68,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irrlicht_changes/static_text.h" #include "version.h" #include "script/scripting_client.h" +#include "hud.h" #if USE_SOUND #include "client/sound_openal.h" @@ -2004,12 +2005,10 @@ void Game::processItemSelection(u16 *new_playeritem) /* Item selection using hotbar slot keys */ - for (u16 i = 0; i < 23; i++) { + for (u16 i = 0; i <= max_item; i++) { if (wasKeyDown((GameKeyType) (KeyType::SLOT_1 + i))) { - if (i < PLAYER_INVENTORY_SIZE && i < player->hud_hotbar_itemcount) { - *new_playeritem = i; - infostream << "Selected item: " << new_playeritem << std::endl; - } + *new_playeritem = i; + infostream << "Selected item: " << new_playeritem << std::endl; break; } } diff --git a/src/client/inputhandler.cpp b/src/client/inputhandler.cpp index 29c68cf01..2692e9f1e 100644 --- a/src/client/inputhandler.cpp +++ b/src/client/inputhandler.cpp @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/numeric.h" #include "inputhandler.h" #include "gui/mainmenumanager.h" +#include "hud.h" void KeyCache::populate_nonchanging() { @@ -76,7 +77,7 @@ void KeyCache::populate() key[KeyType::QUICKTUNE_INC] = getKeySetting("keymap_quicktune_inc"); key[KeyType::QUICKTUNE_DEC] = getKeySetting("keymap_quicktune_dec"); - for (int i = 0; i < 23; i++) { + for (int i = 0; i < HUD_HOTBAR_ITEMCOUNT_MAX; i++) { std::string slot_key_name = "keymap_slot" + std::to_string(i + 1); key[KeyType::SLOT_1 + i] = getKeySetting(slot_key_name.c_str()); } diff --git a/src/client/keys.h b/src/client/keys.h index 15e46293c..28c6574ba 100644 --- a/src/client/keys.h +++ b/src/client/keys.h @@ -98,6 +98,15 @@ public: SLOT_21, SLOT_22, SLOT_23, + SLOT_24, + SLOT_25, + SLOT_26, + SLOT_27, + SLOT_28, + SLOT_29, + SLOT_30, + SLOT_31, + SLOT_32, // joystick specific keys MOUSE_L, diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 52b30ae2f..6a924b840 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -127,6 +127,15 @@ void set_default_settings(Settings *settings) settings->setDefault("keymap_slot21", ""); settings->setDefault("keymap_slot22", ""); settings->setDefault("keymap_slot23", ""); + settings->setDefault("keymap_slot24", ""); + settings->setDefault("keymap_slot25", ""); + settings->setDefault("keymap_slot26", ""); + settings->setDefault("keymap_slot27", ""); + settings->setDefault("keymap_slot28", ""); + settings->setDefault("keymap_slot29", ""); + settings->setDefault("keymap_slot30", ""); + settings->setDefault("keymap_slot31", ""); + settings->setDefault("keymap_slot32", ""); // Some (temporary) keys for debugging settings->setDefault("keymap_quicktune_prev", "KEY_HOME"); @@ -50,7 +50,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define HUD_PARAM_HOTBAR_SELECTED_IMAGE 3 #define HUD_HOTBAR_ITEMCOUNT_DEFAULT 8 -#define HUD_HOTBAR_ITEMCOUNT_MAX 23 +#define HUD_HOTBAR_ITEMCOUNT_MAX 32 #define HOTBAR_IMAGE_SIZE 48 |