diff --git a/source/director.cpp b/source/director.cpp index b009224..86d970d 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -48,7 +48,7 @@ Director::Director(int argc, char *argv[]) // Carga los parametros para configurar el juego const std::string paramFilePath = paramFileArgument == "--320x240" ? asset->get("param_320x240.txt") : asset->get("param_320x256.txt"); - loadParams(paramFilePath); + loadParams(paramFilePath); // Carga el fichero de configuración loadConfigFile(); @@ -776,6 +776,7 @@ bool Director::saveConfigFile() { const std::string joyIndex = std::to_string(index + 1); file << "controller" + joyIndex + ".name=" + options->controller[index].name + "\n"; + file << "controller" + joyIndex + ".player=" + std::to_string(options->controller[index].playerId) + "\n"; file << "controller" + joyIndex + ".inputs.fire_left=" + std::to_string((int)options->controller[index].buttons[0]) + "\n"; file << "controller" + joyIndex + ".inputs.fire_center=" + std::to_string((int)options->controller[index].buttons[1]) + "\n"; file << "controller" + joyIndex + ".inputs.fire_right=" + std::to_string((int)options->controller[index].buttons[2]) + "\n"; @@ -1065,6 +1066,11 @@ bool Director::setOptions(options_t *options, std::string var, std::string value options->controller[0].name = value; } + else if (var == "controller1.player") + { + options->controller[0].playerId = std::max(1, std::min(2, std::stoi(value))); + } + else if (var == "controller1.inputs.fire_left") { options->controller[0].buttons[0] = (SDL_GameControllerButton)std::stoi(value); @@ -1095,6 +1101,11 @@ bool Director::setOptions(options_t *options, std::string var, std::string value options->controller[1].name = value; } + else if (var == "controller2.player") + { + options->controller[1].playerId = std::max(1, std::min(2, std::stoi(value))); + } + else if (var == "controller2.inputs.fire_left") { options->controller[1].buttons[0] = (SDL_GameControllerButton)std::stoi(value); diff --git a/source/service.cpp b/source/service.cpp index fa6026e..c7439d4 100644 --- a/source/service.cpp +++ b/source/service.cpp @@ -3,39 +3,39 @@ // Comprueba el botón de servicio del controlador "index" int checkServiceButton(Input *input, int index) { - if (input->checkInput(input_service, true, INPUT_USE_GAMECONTROLLER, index)) + if (input->checkInput(input_service, INPUT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index)) { - if (input->checkInput(input_start, false, INPUT_USE_GAMECONTROLLER, index)) + if (input->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index)) { return SERVICE_EXIT; } - else if (input->checkInput(input_fire_left, false, INPUT_USE_GAMECONTROLLER, index)) + else if (input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index)) { return SERVICE_CONFIG; } - else if (input->checkInput(input_fire_center, false, INPUT_USE_GAMECONTROLLER, index)) + else if (input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index)) { return SERVICE_SHADERS; } - else if (input->checkInput(input_fire_right, false, INPUT_USE_GAMECONTROLLER, index)) + else if (input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index)) { return SERVICE_PAUSE; } - else if (input->checkInput(input_up, false, INPUT_USE_GAMECONTROLLER, index)) + else if (input->checkInput(input_up, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index)) { return SERVICE_SWAP_CONTROLLERS; } - else if (input->checkInput(input_down, false, INPUT_USE_GAMECONTROLLER, index)) + else if (input->checkInput(input_down, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index)) { return SERVICE_RESET; } - else if (input->checkInput(input_left, false, INPUT_USE_GAMECONTROLLER, index)) + else if (input->checkInput(input_left, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, index)) { return SERVICE_MUTE; } diff --git a/source/title.cpp b/source/title.cpp index e9ad7d6..a41eced 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -277,6 +277,11 @@ void Title::checkInput() section->options = SECTION_OPTIONS_QUIT_SHUTDOWN; break; + case SERVICE_RESET: + section->name = SECTION_PROG_LOGO; + screen->showNotification("Reset"); + break; + case SERVICE_SHADERS: screen->switchShaders(); break; @@ -287,6 +292,8 @@ void Title::checkInput() case SERVICE_SWAP_CONTROLLERS: defineButtons->swapControllers(); + screen->showNotification("Swap Controllers"); + resetCounter(); break; default: