Skip to content

Commit

Permalink
Merge pull request #3107 from MikuChan03/master
Browse files Browse the repository at this point in the history
Update key descwiptions
  • Loading branch information
Ghabry authored Nov 2, 2023
2 parents 45bcf6f + 52e9869 commit f686945
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 42 deletions.
8 changes: 4 additions & 4 deletions src/game_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ void Game_Config::LoadFromStream(Filesystem_Stream::InputStream& is) {
input.gamepad_swap_analog.FromIni(ini);
input.gamepad_swap_dpad_with_buttons.FromIni(ini);
input.gamepad_swap_ab_and_xy.FromIni(ini);
input.speed_modifier.FromIni(ini);
input.speed_modifier_plus.FromIni(ini);
input.speed_modifier_a.FromIni(ini);
input.speed_modifier_b.FromIni(ini);

/** PLAYER SECTION */
player.settings_autosave.FromIni(ini);
Expand Down Expand Up @@ -487,8 +487,8 @@ void Game_Config::WriteToStream(Filesystem_Stream::OutputStream& os) const {
input.gamepad_swap_analog.ToIni(os);
input.gamepad_swap_dpad_with_buttons.ToIni(os);
input.gamepad_swap_ab_and_xy.ToIni(os);
input.speed_modifier.ToIni(os);
input.speed_modifier_plus.ToIni(os);
input.speed_modifier_a.ToIni(os);
input.speed_modifier_b.ToIni(os);

os << "\n";

Expand Down
4 changes: 2 additions & 2 deletions src/game_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ struct Game_ConfigAudio {
};

struct Game_ConfigInput {
RangeConfigParam<int> speed_modifier{ "Fast Forward: Speed", "Set fast forward speed", "Input", "SpeedModifier", 3, 2, 100 };
RangeConfigParam<int> speed_modifier_plus{ "Fast Forward Plus: Speed", "Set fast forward plus speed", "Input", "SpeedModifierPlus", 10, 2, 100 };
RangeConfigParam<int> speed_modifier_a{ "Fast Forward A: Speed", "Set fast forward A speed", "Input", "SpeedModifierA", 3, 2, 100 };
RangeConfigParam<int> speed_modifier_b{ "Fast Forward B: Speed", "Set fast forward B speed", "Input", "SpeedModifierB", 10, 2, 100 };
BoolConfigParam gamepad_swap_analog{ "Gamepad: Swap Analog Sticks", "Swap left and right stick", "Input", "GamepadSwapAnalog", false };
BoolConfigParam gamepad_swap_dpad_with_buttons{ "Gamepad: Swap D-Pad with buttons", "Swap D-Pad with ABXY-Buttons", "Input", "GamepadSwapDpad", false };
BoolConfigParam gamepad_swap_ab_and_xy{ "Gamepad: Swap AB and XY", "Swap A and B with X and Y", "Input", "GamepadSwapAbxy", false };
Expand Down
18 changes: 8 additions & 10 deletions src/input_buttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ namespace Input {
MOUSE_MIDDLE,
SCROLL_UP,
SCROLL_DOWN,
FAST_FORWARD,
FAST_FORWARD_PLUS,
FAST_FORWARD_A,
FAST_FORWARD_B,
TOGGLE_FULLSCREEN,
TOGGLE_ZOOM,
BUTTON_COUNT
Expand Down Expand Up @@ -127,8 +127,8 @@ namespace Input {
"MOUSE_MIDDLE",
"SCROLL_UP",
"SCROLL_DOWN",
"FAST_FORWARD",
"FAST_FORWARD_PLUS",
"FAST_FORWARD_A",
"FAST_FORWARD_B",
"TOGGLE_FULLSCREEN",
"TOGGLE_ZOOM",
"BUTTON_COUNT");
Expand Down Expand Up @@ -167,15 +167,13 @@ namespace Input {
"Reset to the title screen",
"Move up one page in menus",
"Move down one page in menus",
"Page up key",
"Page down key",
"Left mouse key",
"Right mouse key",
"Middle mouse key",
"Scroll up key",
"Scroll down key",
"Fast forward the game (x3)",
"Fast forward the game even more (x10)",
"PLACEHOLDER",
"PLACEHOLDER",
"Toggle Fullscreen mode",
"Toggle Window Zoom level",
"Total Button Count");
Expand All @@ -191,8 +189,8 @@ namespace Input {
case TAKE_SCREENSHOT:
case SHOW_LOG:
case TOGGLE_ZOOM:
case FAST_FORWARD:
case FAST_FORWARD_PLUS:
case FAST_FORWARD_A:
case FAST_FORWARD_B:
return true;
default:
return false;
Expand Down
8 changes: 4 additions & 4 deletions src/input_buttons_desktop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
{PAGE_UP, Keys::PGUP},
{PAGE_DOWN, Keys::PGDN},
{RESET, Keys::F12},
{FAST_FORWARD, Keys::F},
{FAST_FORWARD_PLUS, Keys::G},
{FAST_FORWARD_A, Keys::F},
{FAST_FORWARD_B, Keys::G},

#if defined(USE_MOUSE) && defined(SUPPORT_MOUSE)
{MOUSE_LEFT, Keys::MOUSE_LEFT},
Expand Down Expand Up @@ -155,8 +155,8 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
{N7, Keys::JOY_RSTICK_UP_LEFT},
{N8, Keys::JOY_RSTICK_UP},
{N9, Keys::JOY_RSTICK_UP_RIGHT},
{FAST_FORWARD, Keys::JOY_RTRIGGER_SOFT},
{FAST_FORWARD_PLUS, Keys::JOY_RTRIGGER_FULL},
{FAST_FORWARD_A, Keys::JOY_RTRIGGER_SOFT},
{FAST_FORWARD_B, Keys::JOY_RTRIGGER_FULL},
{DEBUG_THROUGH, Keys::JOY_LTRIGGER_SOFT},
{DEBUG_MENU, Keys::JOY_LTRIGGER_FULL},
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/platform/3ds/input_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
{CANCEL, Keys::JOY_X},
{SHIFT, Keys::JOY_Y},
{TOGGLE_FPS, Keys::JOY_SHOULDER_LEFT},
{FAST_FORWARD, Keys::JOY_SHOULDER_RIGHT},
{FAST_FORWARD_A, Keys::JOY_SHOULDER_RIGHT},
{SETTINGS_MENU, Keys::JOY_START},
{RESET, Keys::JOY_BACK},
// Touchscreen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ JNIEXPORT void JNICALL Java_org_easyrpg_player_player_EasyRpgPlayerActivity_endG
JNIEXPORT void JNICALL Java_org_easyrpg_player_player_EasyRpgPlayerActivity_setFastForwardMultiplier
(JNIEnv *, jclass, jint ji)
{
Player::speed_modifier = ji;
Player::speed_modifier_a = ji;
}

JNIEXPORT void JNICALL
Expand Down
4 changes: 2 additions & 2 deletions src/platform/libretro/input_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
{N7, Keys::JOY_RSTICK_UP_LEFT},
{N8, Keys::JOY_RSTICK_UP},
{N9, Keys::JOY_RSTICK_UP_RIGHT},
{FAST_FORWARD, Keys::JOY_RTRIGGER_SOFT},
{FAST_FORWARD_PLUS, Keys::JOY_RTRIGGER_FULL},
{FAST_FORWARD_A, Keys::JOY_RTRIGGER_SOFT},
{FAST_FORWARD_B, Keys::JOY_RTRIGGER_FULL},
{DEBUG_THROUGH, Keys::JOY_LTRIGGER_SOFT},
{DEBUG_MENU, Keys::JOY_LTRIGGER_FULL},
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/platform/psp/psp_input_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
return {
{CANCEL, Keys::JOY_A}, // Cross
{DECISION, Keys::JOY_B}, // Circle
{FAST_FORWARD, Keys::JOY_X}, // Square
{FAST_FORWARD_A, Keys::JOY_X}, // Square
{SHIFT, Keys::JOY_Y}, // Triangle

{N1, Keys::JOY_SHOULDER_LEFT}, // Left trigger
Expand Down
2 changes: 1 addition & 1 deletion src/platform/psvita/input_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
{CANCEL, Keys::JOY_X},
{SHIFT, Keys::JOY_Y},
{TOGGLE_FPS, Keys::JOY_SHOULDER_LEFT},
{FAST_FORWARD, Keys::JOY_SHOULDER_RIGHT},
{FAST_FORWARD_A, Keys::JOY_SHOULDER_RIGHT},
{SETTINGS_MENU, Keys::JOY_START},
{RESET, Keys::JOY_BACK},
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/platform/switch/input_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
{TOGGLE_FPS, Keys::JOY_SHOULDER_RIGHT},
{SETTINGS_MENU, Keys::JOY_START},
{RESET, Keys::JOY_BACK},
{FAST_FORWARD, Keys::JOY_RTRIGGER_FULL},
{FAST_FORWARD_A, Keys::JOY_RTRIGGER_FULL},
{DEBUG_MENU, Keys::JOY_LTRIGGER_FULL},
#endif
// Touchscreen
Expand Down
4 changes: 2 additions & 2 deletions src/platform/wii/input_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
{CANCEL, Keys::JOY_OTHER_2}, // 1
{DECISION, Keys::JOY_OTHER_3}, // 2
{RESET, Keys::JOY_OTHER_4}, // -, shared with CC
{FAST_FORWARD, Keys::JOY_OTHER_5}, // +, shared with CC
{FAST_FORWARD_A, Keys::JOY_OTHER_5}, // +, shared with CC
{SETTINGS_MENU, Keys::JOY_OTHER_6}, // Home, shared with CC

// Nunchuck
Expand All @@ -40,7 +40,7 @@ Input::ButtonMappingArray Input::GetDefaultButtonMappings() {
{SHIFT, Keys::JOY_OTHER_9}, // X
{CANCEL, Keys::JOY_OTHER_10}, // Y
{N0, Keys::JOY_OTHER_11}, // L
{FAST_FORWARD_PLUS, Keys::JOY_OTHER_12}, // R
{FAST_FORWARD_B, Keys::JOY_OTHER_12}, // R
{N5, Keys::JOY_OTHER_13}, // ZL
{TOGGLE_FPS, Keys::JOY_OTHER_14}, // ZR

Expand Down
16 changes: 8 additions & 8 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ namespace Player {
std::string replay_input_path;
std::string record_input_path;
std::string command_line;
int speed_modifier;
int speed_modifier_plus;
int speed_modifier_a;
int speed_modifier_b;
int rng_seed = -1;
Game_ConfigPlayer player_config;
Game_ConfigGame game_config;
Expand Down Expand Up @@ -199,8 +199,8 @@ void Player::Init(std::vector<std::string> args) {
Input::AddRecordingData(Input::RecordingData::CommandLine, command_line);

player_config = std::move(cfg.player);
speed_modifier = cfg.input.speed_modifier.Get();
speed_modifier_plus = cfg.input.speed_modifier_plus.Get();
speed_modifier_a = cfg.input.speed_modifier_a.Get();
speed_modifier_b = cfg.input.speed_modifier_b.Get();
}

void Player::Run() {
Expand Down Expand Up @@ -304,11 +304,11 @@ void Player::UpdateInput() {
DisplayUi->ToggleZoom();
}
float speed = 1.0;
if (Input::IsSystemPressed(Input::FAST_FORWARD)) {
speed = speed_modifier;
if (Input::IsSystemPressed(Input::FAST_FORWARD_A)) {
speed = speed_modifier_a;
}
if (Input::IsSystemPressed(Input::FAST_FORWARD_PLUS)) {
speed = speed_modifier_plus;
if (Input::IsSystemPressed(Input::FAST_FORWARD_B)) {
speed = speed_modifier_b;
}
Game_Clock::SetGameSpeedFactor(speed);

Expand Down
4 changes: 2 additions & 2 deletions src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ namespace Player {
* Only used for configuring the speedup, don't read this var directly use
* GetSpeedModifier() instead.
*/
extern int speed_modifier;
extern int speed_modifier_plus;
extern int speed_modifier_a;
extern int speed_modifier_b;

/**
* The engine game logic configuration
Expand Down
26 changes: 23 additions & 3 deletions src/window_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ void Window_Settings::RefreshInput() {
AddOption(cfg.gamepad_swap_ab_and_xy, [&cfg](){ cfg.gamepad_swap_ab_and_xy.Toggle(); Input::ResetTriggerKeys(); });
AddOption(cfg.gamepad_swap_analog, [&cfg](){ cfg.gamepad_swap_analog.Toggle(); Input::ResetTriggerKeys(); });
AddOption(cfg.gamepad_swap_dpad_with_buttons, [&cfg](){ cfg.gamepad_swap_dpad_with_buttons.Toggle(); Input::ResetTriggerKeys(); });
AddOption(cfg.speed_modifier, [this, &cfg](){ auto tmp = GetCurrentOption().current_value; Player::speed_modifier = tmp; cfg.speed_modifier.Set(tmp); });
AddOption(cfg.speed_modifier_plus, [this, &cfg](){ auto tmp = GetCurrentOption().current_value; Player::speed_modifier_plus = tmp; cfg.speed_modifier_plus.Set(tmp); });
AddOption(cfg.speed_modifier_a, [this, &cfg](){ auto tmp = GetCurrentOption().current_value; Player::speed_modifier_a = tmp; cfg.speed_modifier_a.Set(tmp); });
AddOption(cfg.speed_modifier_b, [this, &cfg](){ auto tmp = GetCurrentOption().current_value; Player::speed_modifier_b = tmp; cfg.speed_modifier_b.Set(tmp); });
}

void Window_Settings::RefreshButtonCategory() {
Expand All @@ -391,6 +391,15 @@ void Window_Settings::RefreshButtonCategory() {
[this]() { Push(eInputListButtonsDeveloper, 2); });
}

const char * GetFastForwardDescription(int index){
Game_ConfigInput& cfg = Input::GetInputSource()->GetConfig();
RangeConfigParam<int> config_arr[] = {cfg.speed_modifier_a, cfg.speed_modifier_b};
static char fast_forward_strs[2][64];

snprintf(fast_forward_strs[index], sizeof(fast_forward_strs[index]), "Run the game at x%i speed", config_arr[index].Get());
return fast_forward_strs[index];
}

void Window_Settings::RefreshButtonList() {
auto& mappings = Input::GetInputSource()->GetButtonMappings();
auto custom_names = Input::GetInputKeyNames();
Expand All @@ -405,7 +414,7 @@ void Window_Settings::RefreshButtonList() {
break;
case 1:
buttons = {Input::SETTINGS_MENU, Input::TOGGLE_FPS, Input::TOGGLE_FULLSCREEN, Input::TOGGLE_ZOOM,
Input::TAKE_SCREENSHOT, Input::RESET, Input::FAST_FORWARD, Input::FAST_FORWARD_PLUS,
Input::TAKE_SCREENSHOT, Input::RESET, Input::FAST_FORWARD_A, Input::FAST_FORWARD_B,
Input::PAGE_UP, Input::PAGE_DOWN };
break;
case 2:
Expand Down Expand Up @@ -468,6 +477,17 @@ void Window_Settings::RefreshButtonList() {
value_size += cur_value_size;
}

switch(button){
case Input::FAST_FORWARD_A:
help = GetFastForwardDescription(0);
break;
case Input::FAST_FORWARD_B:
help = GetFastForwardDescription(1);
break;
default:
break;
}

auto param = MenuItem(name, help, value);
AddOption(param,
[this, button](){
Expand Down

0 comments on commit f686945

Please sign in to comment.