Skip to content

Commit

Permalink
Enable Remapping RestartGameplay
Browse files Browse the repository at this point in the history
Moved the key binding and so on from the theme to the game code. This allows for rebinding through the game options in a way that is less breakable/editable by the end user but still customizable to an extent.
The way to disable the button now would be to rebind the default key ( ` ) to something else like Coin instead of ripping out the theme code.
  • Loading branch information
poco0317 authored Aug 8, 2018
1 parent 7994e13 commit 2139a45
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,14 @@ local enabledTargetTracker = playerConfig:get_data(pn_to_profile_slot(PLAYER_1))
local enabledDisplayPercent = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).DisplayPercent
local enabledJudgeCounter = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).JudgeCounter

-- restart button
-- restart button (MOVED OUT OF THEME IN FAVOR OF REMAPPING)
--[[
local function froot(loop)
if loop.DeviceInput.button == "DeviceButton_`" then
SCREENMAN:GetTopScreen():SetPrevScreenName("ScreenStageInformation"):begin_backing_out()
end
end

]]
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Main listener that moves and resizes things**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1604,4 +1605,4 @@ t[#t+1] = Def.ActorFrame{
}
end

return t
return t
1 change: 1 addition & 0 deletions Themes/_fallback/Languages/de.ini
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ MenuUp=MenuHoch
Operator=Operator
EffectUp=EffektHoch
EffectDown=EffektRunter
RestartGameplay=NeustartGameplay
Right=Rechts
Select=Auswählen
Start=Start
Expand Down
1 change: 1 addition & 0 deletions Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ MenuUp=MenuUp
Operator=Operator
EffectUp=EffectUp
EffectDown=EffectDown
RestartGameplay=RestartGameplay
Right=Right
Select=Select
Start=Start
Expand Down
1 change: 1 addition & 0 deletions Themes/_fallback/Languages/es.ini
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ MenuUp=MenúArriba
Operator=Operador
EffectUp=EfectoPositivo
EffectDown=EfectoNegativo
RestartGameplay=ReiniciarJuego
Right=Derecha
Select=Select
Start=Start
Expand Down
1 change: 1 addition & 0 deletions Themes/_fallback/Languages/fr.ini
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ MenuUp=MenuHaut
Operator=Opérateur
EffectUp=EffectUp
EffectDown=EffectDown
RestartGameplay=RedémarrerGameplay
Right=Droite
Select=Select
Start=Start
Expand Down
1 change: 1 addition & 0 deletions Themes/_fallback/Languages/ja.ini
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ MenuUp=MenuUp
Operator=Operator
EffectUp=EffectUp
EffectDown=EffectDown
RestartGameplay=RestartGameplay
Right=Right
Select=Select
Start=Start
Expand Down
1 change: 1 addition & 0 deletions Themes/_fallback/Languages/nl.ini
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ MenuUp=MenuOmhoog
Operator=Operator
EffectUp=EffectOmhoog
EffectDown=EffectOmlaag
RestartGamepaly=HerstartGameplay
Right=Rechts
Select=Selecteer
Start=Start
Expand Down
3 changes: 2 additions & 1 deletion Themes/_fallback/Languages/pl.ini
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ MenuUp=MenuGóra
Operator=Operator
EffectUp=EffectGóra
EffectDown=EffectDół
RestartGameplay=WznowićRozgrywkę
Right=Prawo
Select=Wybierz
Start=Start
Expand Down Expand Up @@ -2726,4 +2727,4 @@ UnknownPreference=Nieznane ustawienie "%s"
ChoicesSizeMismatch=Opcje i Wartości mają różne rozmiary (%d, %d)
NoDefaultInValues=Ustawienie "%s" nie posiada wartości odpowiadającej domyślnej.
TypeMismatch=Niezgodność typów pomiędzy domyślną (%s) i wartością %d (%s)
>>>>>>> inne
>>>>>>> inne
1 change: 1 addition & 0 deletions Themes/_fallback/Languages/zh.ini
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ MenuUp=選單上
Operator=系統設定
EffectUp=效果上
EffectDown=效果下
RestartGameplay=重启游戏
Right=右
Select=選擇
Start=開始
Expand Down
1 change: 1 addition & 0 deletions src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static const Game::PerButtonInfo g_CommonButtonInfo[] =
{ GameButtonType_Menu }, // GAME_BUTTON_OPERATOR
{ GameButtonType_Menu }, // GAME_BUTTON_EFFECT_UP
{ GameButtonType_Menu }, // GAME_BUTTON_EFFECT_DOWN
{ GameButtonType_Menu }, // GAME_BUTTON_RESTART
};

const Game::PerButtonInfo *Game::GetPerButtonInfo( GameButton gb ) const
Expand Down
2 changes: 2 additions & 0 deletions src/GameInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ enum GameButton
GAME_BUTTON_OPERATOR, /**< Access the operator menu. */
GAME_BUTTON_EFFECT_UP,
GAME_BUTTON_EFFECT_DOWN,
GAME_BUTTON_RESTART,
GAME_BUTTON_CUSTOM_01,
GAME_BUTTON_CUSTOM_02,
GAME_BUTTON_CUSTOM_03,
Expand Down Expand Up @@ -180,6 +181,7 @@ GameButton StringToGameButton( const InputScheme* pInputs, const RString& s );
#define GAME_BUTTON_DOWN GAME_BUTTON_MENUDOWN
#define GAME_BUTTON_START GAME_BUTTON_START
#define GAME_BUTTON_BACK GAME_BUTTON_BACK
#define GAME_BUTTON_RESTART GAME_BUTTON_RESTART
/** @brief An input event specific to an InputScheme defined by a logical controller and button. */
struct GameInput
{
Expand Down
1 change: 1 addition & 0 deletions src/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static const AutoMappings g_AutoKeyMappings_Dance = AutoMappings (
AutoMappingEntry( 0, KEY_Cx, DANCE_BUTTON_DOWN, false ),
AutoMappingEntry( 0, KEY_EQUAL, GAME_BUTTON_EFFECT_UP, false),
AutoMappingEntry( 0, KEY_HYPHEN, GAME_BUTTON_EFFECT_DOWN, false),
AutoMappingEntry( 0, KEY_ACCENT, GAME_BUTTON_RESTART, false),
AutoMappingEntry( 0, KEY_KP_SLASH, GAME_BUTTON_MENULEFT, true ),
AutoMappingEntry( 0, KEY_KP_ASTERISK, GAME_BUTTON_MENURIGHT, true ),
AutoMappingEntry( 0, KEY_KP_HYPHEN, GAME_BUTTON_MENUUP, true ),
Expand Down
4 changes: 3 additions & 1 deletion src/InputMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ static const AutoMappings g_DefaultKeyMappings = AutoMappings(
AutoMappingEntry( 0, KEY_KP_C0, GAME_BUTTON_SELECT, true ),
AutoMappingEntry( 0, KEY_HYPHEN, GAME_BUTTON_BACK, true ), // laptop keyboards.
AutoMappingEntry( 0, KEY_F1, GAME_BUTTON_COIN, false ),
AutoMappingEntry( 0, KEY_SCRLLOCK, GAME_BUTTON_OPERATOR, false )
AutoMappingEntry( 0, KEY_SCRLLOCK, GAME_BUTTON_OPERATOR, false ),
AutoMappingEntry( 0, KEY_ACCENT, GAME_BUTTON_RESTART, false)
);

void InputMapper::AddDefaultMappingsForCurrentGameIfUnmapped()
Expand Down Expand Up @@ -1151,6 +1152,7 @@ static const InputScheme::GameButtonInfo g_CommonGameButtonInfo[] =
{ "Operator", GAME_BUTTON_OPERATOR },
{ "EffectUp", GAME_BUTTON_EFFECT_UP },
{ "EffectDown", GAME_BUTTON_EFFECT_DOWN },
{ "RestartGameplay", GAME_BUTTON_RESTART },
};

const InputScheme::GameButtonInfo *InputScheme::GetGameButtonInfo( GameButton gb ) const
Expand Down
14 changes: 14 additions & 0 deletions src/ScreenGameplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,20 @@ bool ScreenGameplay::Input( const InputEventPlus &input )

return true;
}

/* Restart gameplay button moved from theme to allow for rebinding for people who
* dont want to edit lua files :)
*/
bool bHoldingRestart = false;
if (GAMESTATE->GetCurrentStyle(input.pn)->GameInputToColumn(input.GameI) == Column_Invalid)
{
bHoldingRestart |= input.MenuI == GAME_BUTTON_RESTART;
}
if (bHoldingRestart)
{
SCREENMAN->GetTopScreen()->SetPrevScreenName("ScreenStageInformation");
BeginBackingOutFromGameplay();
}
}

bool bRelease = input.type == IET_RELEASE;
Expand Down

0 comments on commit 2139a45

Please sign in to comment.