From efbb6cfe5297a20f5f1dc7e7ebc3fa9feb6812ab Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 28 Mar 2006 20:44:27 +0000 Subject: [PATCH] allow control from P2, fix P2 input doesn't work after exiting the screen --- stepmania/src/ScreenGameplaySyncMachine.cpp | 24 ++++++++++++++++----- stepmania/src/ScreenGameplaySyncMachine.h | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/stepmania/src/ScreenGameplaySyncMachine.cpp b/stepmania/src/ScreenGameplaySyncMachine.cpp index 59328e5d38..baa64972d3 100644 --- a/stepmania/src/ScreenGameplaySyncMachine.cpp +++ b/stepmania/src/ScreenGameplaySyncMachine.cpp @@ -6,6 +6,7 @@ #include "PrefsManager.h" #include "AdjustSync.h" #include "ScreenDimensions.h" +#include "InputEventPlus.h" REGISTER_SCREEN_CLASS( ScreenGameplaySyncMachine ); @@ -53,6 +54,21 @@ void ScreenGameplaySyncMachine::Update( float fDelta ) RefreshText(); } +void ScreenGameplaySyncMachine::Input( const InputEventPlus &input ) +{ + // Hack to make this work from Player2's controls + InputEventPlus _input = input; + + if( _input.GameI.controller != GAME_CONTROLLER_INVALID ) + _input.GameI.controller = GAME_CONTROLLER_1; + if( _input.MenuI.player != PLAYER_INVALID ) + _input.MenuI.player = PLAYER_1; + if( _input.StyleI.player != PLAYER_INVALID ) + _input.StyleI.player = PLAYER_1; + + ScreenGameplay::Input( _input ); +} + void ScreenGameplaySyncMachine::HandleScreenMessage( const ScreenMessage SM ) { if( SM == SM_NotesEnded ) @@ -63,12 +79,10 @@ void ScreenGameplaySyncMachine::HandleScreenMessage( const ScreenMessage SM ) ScreenGameplayNormal::HandleScreenMessage( SM ); - if( SM == SM_GoToPrevScreen ) - { - GAMESTATE->m_pCurSong.Set( NULL ); - } - else if( SM == SM_GoToNextScreen ) + if( SM == SM_GoToPrevScreen || SM == SM_GoToNextScreen ) { + GAMESTATE->m_PlayMode.Set( PLAY_MODE_INVALID ); + GAMESTATE->m_pCurStyle.Set( NULL ); GAMESTATE->m_pCurSong.Set( NULL ); } } diff --git a/stepmania/src/ScreenGameplaySyncMachine.h b/stepmania/src/ScreenGameplaySyncMachine.h index 5e956aa022..711c6dbceb 100644 --- a/stepmania/src/ScreenGameplaySyncMachine.h +++ b/stepmania/src/ScreenGameplaySyncMachine.h @@ -11,6 +11,7 @@ public: virtual void Init(); virtual void Update( float fDelta ); + virtual void Input( const InputEventPlus &input ); virtual ScreenType GetScreenType() const { return system_menu; }