From 301c059a268f1816f1ce82165e0113f3c0e1f5af Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 5 Dec 2024 12:24:18 +0100 Subject: [PATCH] =?UTF-8?q?Afegit=20bot=C3=B3=20per=20activar=20o=20desact?= =?UTF-8?q?ivar=20el=20autofire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- source/director.cpp | 5 +++-- source/global_inputs.cpp | 14 ++++++++++++++ source/input.h | 1 + 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bdb7e58..e9ca063 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,9 @@ Les tecles son les següents: - **Tecla F5**: Activa o desactiva l'audio -- **Tecla F6**: Canvia el idioma del joc i reinicia +- **Tecla F6**: Activa o desactiva el dispar automàtic + +- **Tecla F7**: Canvia el idioma del joc i reinicia - **Tecla F10**: Reset diff --git a/source/director.cpp b/source/director.cpp index f18c42b..8e83e35 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -180,8 +180,9 @@ void Director::bindInputs() Input::get()->bindKey(InputType::WINDOW_FULLSCREEN, SDL_SCANCODE_F3); Input::get()->bindKey(InputType::VIDEO_SHADERS, SDL_SCANCODE_F4); Input::get()->bindKey(InputType::MUTE, SDL_SCANCODE_F5); - Input::get()->bindKey(InputType::CHANGE_LANG, SDL_SCANCODE_F6); - Input::get()->bindKey(InputType::SHOWINFO, SDL_SCANCODE_F7); + Input::get()->bindKey(InputType::AUTO_FIRE, SDL_SCANCODE_F6); + Input::get()->bindKey(InputType::CHANGE_LANG, SDL_SCANCODE_F7); + Input::get()->bindKey(InputType::SHOWINFO, SDL_SCANCODE_F8); Input::get()->bindKey(InputType::RESET, SDL_SCANCODE_F10); // Asigna botones a inputs diff --git a/source/global_inputs.cpp b/source/global_inputs.cpp index 05235c4..10b5b67 100644 --- a/source/global_inputs.cpp +++ b/source/global_inputs.cpp @@ -108,6 +108,13 @@ namespace globalInputs Notifier::get()->showText({getLangName(options.game.language)}); } + // Cambia el modo de disparo + void toggleFireMode() + { + options.game.autofire = !options.game.autofire; + Notifier::get()->showText({"Autofire " + boolToOnOff(options.game.autofire)}); + } + // Comprueba los inputs que se pueden introducir en cualquier sección del juego void check() { @@ -162,6 +169,13 @@ namespace globalInputs return; } + // Autofire + if (Input::get()->checkInput(InputType::AUTO_FIRE, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD)) + { + toggleFireMode(); + return; + } + // Idioma if (Input::get()->checkInput(InputType::CHANGE_LANG, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD)) { diff --git a/source/input.h b/source/input.h index 107335e..b058563 100644 --- a/source/input.h +++ b/source/input.h @@ -44,6 +44,7 @@ enum class InputType : int SHOWINFO, CONFIG, SWAP_CONTROLLERS, + AUTO_FIRE, // Input obligatorio NONE,