Add native restart menu button
It should replace Simply Love restart hack. Now it is possible to assign any button to restart.
This commit is contained in:
committed by
teejusb
parent
7cf2501214
commit
705cd55a04
@@ -133,6 +133,7 @@ EffectDown=EffectDown
|
|||||||
Right=Right
|
Right=Right
|
||||||
Select=Select
|
Select=Select
|
||||||
Start=Start
|
Start=Start
|
||||||
|
Restart=Restart
|
||||||
Up=Up
|
Up=Up
|
||||||
UpLeft=UpLeft
|
UpLeft=UpLeft
|
||||||
UpRight=UpRight
|
UpRight=UpRight
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ static const Game::PerButtonInfo g_CommonButtonInfo[] =
|
|||||||
{ GameButtonType_Menu }, // GAME_BUTTON_START
|
{ GameButtonType_Menu }, // GAME_BUTTON_START
|
||||||
{ GameButtonType_Menu }, // GAME_BUTTON_SELECT
|
{ GameButtonType_Menu }, // GAME_BUTTON_SELECT
|
||||||
{ GameButtonType_Menu }, // GAME_BUTTON_BACK
|
{ GameButtonType_Menu }, // GAME_BUTTON_BACK
|
||||||
|
{ GameButtonType_Menu }, // GAME_BUTTON_RESTART
|
||||||
{ GameButtonType_Menu }, // GAME_BUTTON_COIN
|
{ GameButtonType_Menu }, // GAME_BUTTON_COIN
|
||||||
{ GameButtonType_Menu }, // GAME_BUTTON_OPERATOR
|
{ GameButtonType_Menu }, // GAME_BUTTON_OPERATOR
|
||||||
{ GameButtonType_Menu }, // GAME_BUTTON_EFFECT_UP
|
{ GameButtonType_Menu }, // GAME_BUTTON_EFFECT_UP
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ enum GameButton
|
|||||||
GAME_BUTTON_START,
|
GAME_BUTTON_START,
|
||||||
GAME_BUTTON_SELECT,
|
GAME_BUTTON_SELECT,
|
||||||
GAME_BUTTON_BACK,
|
GAME_BUTTON_BACK,
|
||||||
|
GAME_BUTTON_RESTART,
|
||||||
GAME_BUTTON_COIN, /**< Insert a coin to play. */
|
GAME_BUTTON_COIN, /**< Insert a coin to play. */
|
||||||
GAME_BUTTON_OPERATOR, /**< Access the operator menu. */
|
GAME_BUTTON_OPERATOR, /**< Access the operator menu. */
|
||||||
GAME_BUTTON_EFFECT_UP,
|
GAME_BUTTON_EFFECT_UP,
|
||||||
|
|||||||
@@ -1208,6 +1208,7 @@ static const InputScheme::GameButtonInfo g_CommonGameButtonInfo[] =
|
|||||||
{ "Start", GAME_BUTTON_START },
|
{ "Start", GAME_BUTTON_START },
|
||||||
{ "Select", GAME_BUTTON_SELECT },
|
{ "Select", GAME_BUTTON_SELECT },
|
||||||
{ "Back", GAME_BUTTON_BACK },
|
{ "Back", GAME_BUTTON_BACK },
|
||||||
|
{ "Restart", GAME_BUTTON_RESTART },
|
||||||
{ "Coin", GAME_BUTTON_COIN },
|
{ "Coin", GAME_BUTTON_COIN },
|
||||||
{ "Operator", GAME_BUTTON_OPERATOR },
|
{ "Operator", GAME_BUTTON_OPERATOR },
|
||||||
{ "EffectUp", GAME_BUTTON_EFFECT_UP },
|
{ "EffectUp", GAME_BUTTON_EFFECT_UP },
|
||||||
|
|||||||
+2
-1
@@ -229,7 +229,8 @@ bool Screen::Input( const InputEventPlus &input )
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case GAME_BUTTON_START: return this->MenuStart ( input );
|
case GAME_BUTTON_START: return this->MenuStart ( input );
|
||||||
case GAME_BUTTON_SELECT: return this->MenuSelect( input );
|
case GAME_BUTTON_SELECT: return this->MenuSelect ( input );
|
||||||
|
case GAME_BUTTON_RESTART: return this->MenuRestart( input );
|
||||||
case GAME_BUTTON_COIN: return this->MenuCoin ( input );
|
case GAME_BUTTON_COIN: return this->MenuCoin ( input );
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ public:
|
|||||||
virtual bool MenuRight(const InputEventPlus &) { return false; }
|
virtual bool MenuRight(const InputEventPlus &) { return false; }
|
||||||
virtual bool MenuStart(const InputEventPlus &) { return false; }
|
virtual bool MenuStart(const InputEventPlus &) { return false; }
|
||||||
virtual bool MenuSelect(const InputEventPlus &) { return false; }
|
virtual bool MenuSelect(const InputEventPlus &) { return false; }
|
||||||
|
virtual bool MenuRestart(const InputEventPlus &) { return false; }
|
||||||
virtual bool MenuBack(const InputEventPlus &) { return false; }
|
virtual bool MenuBack(const InputEventPlus &) { return false; }
|
||||||
virtual bool MenuCoin(const InputEventPlus &) { return false; }
|
virtual bool MenuCoin(const InputEventPlus &) { return false; }
|
||||||
// todo? -aj
|
// todo? -aj
|
||||||
|
|||||||
@@ -729,6 +729,13 @@ bool ScreenEvaluation::Input( const InputEventPlus &input )
|
|||||||
if( IsTransitioning() )
|
if( IsTransitioning() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (input.MenuI == GAME_BUTTON_RESTART && input.type == IET_FIRST_PRESS &&
|
||||||
|
GAMESTATE->IsEventMode() && !GAMESTATE->IsCourseMode())
|
||||||
|
{
|
||||||
|
return MenuRestart(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if( input.GameI.IsValid() )
|
if( input.GameI.IsValid() )
|
||||||
{
|
{
|
||||||
if( CodeDetector::EnteredCode(input.GameI.controller, CODE_SAVE_SCREENSHOT1) ||
|
if( CodeDetector::EnteredCode(input.GameI.controller, CODE_SAVE_SCREENSHOT1) ||
|
||||||
@@ -795,6 +802,16 @@ bool ScreenEvaluation::MenuStart( const InputEventPlus &input )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScreenEvaluation::MenuRestart( const InputEventPlus &input )
|
||||||
|
{
|
||||||
|
if( IsTransitioning() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SCREENMAN->GetTopScreen()->SetNextScreenName("ScreenGameplay");
|
||||||
|
StartTransitioningScreen( SM_GoToNextScreen );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenEvaluation::HandleMenuStart()
|
void ScreenEvaluation::HandleMenuStart()
|
||||||
{
|
{
|
||||||
StartTransitioningScreen( SM_GoToNextScreen );
|
StartTransitioningScreen( SM_GoToNextScreen );
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public:
|
|||||||
|
|
||||||
virtual bool MenuBack( const InputEventPlus &input );
|
virtual bool MenuBack( const InputEventPlus &input );
|
||||||
virtual bool MenuStart( const InputEventPlus &input );
|
virtual bool MenuStart( const InputEventPlus &input );
|
||||||
|
virtual bool MenuRestart( const InputEventPlus &input );
|
||||||
virtual void PushSelf( lua_State *L );
|
virtual void PushSelf( lua_State *L );
|
||||||
StageStats *GetStageStats() { return m_pStageStats; }
|
StageStats *GetStageStats() { return m_pStageStats; }
|
||||||
|
|
||||||
|
|||||||
@@ -890,6 +890,20 @@ bool ScreenGameplay::Center1Player() const
|
|||||||
GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StyleType == StyleType_OnePlayerOneSide;
|
GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StyleType == StyleType_OnePlayerOneSide;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScreenGameplay::MenuRestart( const InputEventPlus &input )
|
||||||
|
{
|
||||||
|
if( IsTransitioning() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_DancingState = STATE_OUTRO;
|
||||||
|
m_pSoundMusic->StopPlaying();
|
||||||
|
m_GameplayAssist.StopPlaying(); // Stop any queued assist ticks.
|
||||||
|
|
||||||
|
SCREENMAN->GetTopScreen()->SetNextScreenName("ScreenGameplay");
|
||||||
|
m_Cancel.StartTransitioning( SM_GoToNextScreen );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// fill in m_apSongsQueue, m_vpStepsQueue, m_asModifiersQueue
|
// fill in m_apSongsQueue, m_vpStepsQueue, m_asModifiersQueue
|
||||||
void ScreenGameplay::InitSongQueues()
|
void ScreenGameplay::InitSongQueues()
|
||||||
{
|
{
|
||||||
@@ -2404,6 +2418,12 @@ bool ScreenGameplay::Input( const InputEventPlus &input )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input.MenuI == GAME_BUTTON_RESTART && input.type == IET_FIRST_PRESS &&
|
||||||
|
GAMESTATE->IsEventMode() && !GAMESTATE->IsCourseMode())
|
||||||
|
{
|
||||||
|
return MenuRestart(input);
|
||||||
|
}
|
||||||
|
|
||||||
if(m_DancingState != STATE_OUTRO &&
|
if(m_DancingState != STATE_OUTRO &&
|
||||||
GAMESTATE->IsHumanPlayer(input.pn) &&
|
GAMESTATE->IsHumanPlayer(input.pn) &&
|
||||||
!m_Cancel.IsTransitioning() )
|
!m_Cancel.IsTransitioning() )
|
||||||
|
|||||||
@@ -165,6 +165,8 @@ public:
|
|||||||
* @return true if we center the solo player, false otherwise. */
|
* @return true if we center the solo player, false otherwise. */
|
||||||
bool Center1Player() const;
|
bool Center1Player() const;
|
||||||
|
|
||||||
|
bool MenuRestart( const InputEventPlus &input );
|
||||||
|
|
||||||
// Lua
|
// Lua
|
||||||
virtual void PushSelf( lua_State *L );
|
virtual void PushSelf( lua_State *L );
|
||||||
Song *GetNextCourseSong() const;
|
Song *GetNextCourseSong() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user