MCPcopy Create free account
hub / github.com/EasyRPG/Player / RefreshInputEmergencyReset

Method RefreshInputEmergencyReset

src/scene_settings.cpp:604–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604bool Scene_Settings::RefreshInputEmergencyReset() {
605 if (Input::GetAllRawPressed().count() >= 4) {
606 if (input_reset_counter == 0) {
607 Output::InfoStr("Input emergency reset started");
608 Output::InfoStr("Hold the keys for 3 seconds");
609 }
610 input_reset_counter++;
611
612 if (input_reset_counter == Game_Clock::GetTargetGameFps() * 3) {
613 if (input_window->GetInputButton() == Input::InputButton::BUTTON_COUNT) {
614 // No last button yet: reset everything
615 Output::InfoStr("All buttons reset to default");
616 if (input_window->GetActive()) {
617 input_window->SetIndex(0);
618 }
619 Input::ResetAllMappings();
620 } else {
621 Output::Info("Button {} reset to default", Input::kInputButtonNames.tag(input_window->GetInputButton()));
622 Output::Info("To reset all buttons hold 3 seconds longer");
623 if (input_window->GetActive()) {
624 input_window->SetIndex(0);
625 }
626 input_window->ResetMapping();
627 }
628 } else if (input_reset_counter == Game_Clock::GetTargetGameFps() * 6) {
629 Output::InfoStr("All buttons reset to default");
630 if (input_window->GetActive()) {
631 input_window->SetIndex(0);
632 }
633 Input::ResetAllMappings();
634 }
635 } else {
636 if (input_reset_counter > 0) {
637 Output::InfoStr("Input emergency reset ended");
638 input_reset_counter = 0;
639 }
640 }
641
642 return input_reset_counter > 0;
643}
644
645void Scene_Settings::RefreshInputActionAllowed() {
646 auto button = static_cast<Input::InputButton>(options_window->GetFrame().arg);

Callers

nothing calls this directly

Calls 4

GetInputButtonMethod · 0.80
GetActiveMethod · 0.80
ResetMappingMethod · 0.80
SetIndexMethod · 0.45

Tested by

no test coverage detected