pass around InputEventPlus in Screen::Input instead of multiple input structures

This commit is contained in:
Chris Danford
2005-09-05 02:26:50 +00:00
parent 056dd1b1d5
commit bb10c7c21f
83 changed files with 506 additions and 427 deletions
+16 -15
View File
@@ -9,6 +9,7 @@
#include "ScreenManager.h"
#include "GameSoundManager.h"
#include "ActorUtil.h"
#include "InputEventPlus.h"
#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen")
#define PREV_SCREEN THEME->GetMetric (m_sName,"PrevScreen")
@@ -142,15 +143,15 @@ void Screen::MenuBack( PlayerNumber pn, const InputEventType type )
* pass at input. Return true if the input was handled and should not be passed
* to lower screens, or false if not handled. If true is returned, Input() will
* not be called, either. Normal screens should not overload this function. */
bool Screen::OverlayInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
bool Screen::OverlayInput( const InputEventPlus &input )
{
return false;
}
void Screen::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void Screen::Input( const InputEventPlus &input )
{
/* Don't send release messages with the default handler. */
switch( type )
switch( input.type )
{
case IET_FIRST_PRESS:
case IET_SLOW_REPEAT:
@@ -161,26 +162,26 @@ void Screen::Input( const DeviceInput& DeviceI, const InputEventType type, const
}
/* Don't make the user hold the back button if they're pressing escape and escape is the back button. */
if( MenuI.button == MENU_BUTTON_BACK && DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == KEY_ESC )
if( input.MenuI.button == MENU_BUTTON_BACK && input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_ESC )
{
this->MenuBack( MenuI.player );
this->MenuBack( input.MenuI.player );
return;
}
// default input handler used by most menus
if( !MenuI.IsValid() )
if( !input.MenuI.IsValid() )
return;
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_UP: this->MenuUp( MenuI.player, type ); return;
case MENU_BUTTON_DOWN: this->MenuDown( MenuI.player, type ); return;
case MENU_BUTTON_LEFT: this->MenuLeft( MenuI.player, type ); return;
case MENU_BUTTON_RIGHT: this->MenuRight( MenuI.player, type ); return;
case MENU_BUTTON_BACK: this->MenuBack( MenuI.player, type ); return;
case MENU_BUTTON_START: this->MenuStart( MenuI.player, type ); return;
case MENU_BUTTON_SELECT:this->MenuSelect( MenuI.player, type ); return;
case MENU_BUTTON_COIN: this->MenuCoin( MenuI.player, type ); return;
case MENU_BUTTON_UP: this->MenuUp ( input.MenuI.player, input.type ); return;
case MENU_BUTTON_DOWN: this->MenuDown ( input.MenuI.player, input.type ); return;
case MENU_BUTTON_LEFT: this->MenuLeft ( input.MenuI.player, input.type ); return;
case MENU_BUTTON_RIGHT: this->MenuRight ( input.MenuI.player, input.type ); return;
case MENU_BUTTON_BACK: this->MenuBack ( input.MenuI.player, input.type ); return;
case MENU_BUTTON_START: this->MenuStart ( input.MenuI.player, input.type ); return;
case MENU_BUTTON_SELECT:this->MenuSelect( input.MenuI.player, input.type ); return;
case MENU_BUTTON_COIN: this->MenuCoin ( input.MenuI.player, input.type ); return;
}
}
+5 -5
View File
@@ -6,11 +6,11 @@
#include "ActorFrame.h"
#include "ScreenMessage.h"
#include "InputFilter.h"
#include "GameInput.h"
#include "MenuInput.h"
#include "StyleInput.h"
#include "ThemeMetric.h"
#include "PlayerNumber.h"
class InputEventPlus;
struct MenuInput;
class Screen;
typedef Screen* (*CreateScreenFn)(const CString& sClassName);
void RegisterScreenClass( const CString& sClassName, CreateScreenFn pfn );
@@ -45,8 +45,8 @@ public:
virtual void BeginScreen();
virtual void Update( float fDeltaTime );
virtual bool OverlayInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual bool OverlayInput( const InputEventPlus &input );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
void PostScreenMessage( const ScreenMessage SM, float fDelay );
+11 -10
View File
@@ -13,6 +13,7 @@
#include "ThemeManager.h"
#include "GameSoundManager.h"
#include "CommonMetrics.h"
#include "InputEventPlus.h"
#define START_SCREEN(sScreenName) THEME->GetMetric (sScreenName,"StartScreen")
@@ -28,21 +29,21 @@ ScreenAttract::ScreenAttract( CString sName, bool bResetGameState ) : ScreenWith
}
void ScreenAttract::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenAttract::Input( const InputEventPlus &input )
{
// LOG->Trace( "ScreenAttract::Input()" );
AttractInput( DeviceI, type, GameI, MenuI, StyleI, this );
AttractInput( input, this );
}
void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, ScreenWithMenuElements *pScreen )
void ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuElements *pScreen )
{
if(type != IET_FIRST_PRESS)
if( input.type != IET_FIRST_PRESS )
return; // don't care
if( MenuI.IsValid() )
if( input.MenuI.IsValid() )
{
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_BACK:
if( !(bool)BACK_GOES_TO_START_SCREEN )
@@ -68,7 +69,7 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
SCREENMAN->SendMessageToTopScreen( SM_StopMusic );
/* HandleGlobalInputs() already played the coin sound. Don't play it again. */
if( MenuI.button != MENU_BUTTON_COIN )
if( input.MenuI.button != MENU_BUTTON_COIN )
SCREENMAN->PlayCoinSound();
pScreen->Cancel( SM_GoToStartScreen );
@@ -83,9 +84,9 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
if( pScreen->IsTransitioning() )
return;
if( MenuI.IsValid() )
if( input.MenuI.IsValid() )
{
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_LEFT:
case MENU_BUTTON_RIGHT:
@@ -94,7 +95,7 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
}
}
// Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
// Screen::Input( input );
}
void ScreenAttract::StartPlayingMusic()
+2 -2
View File
@@ -12,10 +12,10 @@ class ScreenAttract : public ScreenWithMenuElements
public:
ScreenAttract( CString sName, bool bResetGameState=true );
static void AttractInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, ScreenWithMenuElements *pScreen );
static void AttractInput( const InputEventPlus &input, ScreenWithMenuElements *pScreen );
static void GoToStartScreen( CString sScreenName );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual ScreenType GetScreenType() const { return attract; }
+4 -3
View File
@@ -5,6 +5,7 @@
#include "ThemeManager.h"
#include "Bookkeeper.h"
#include "ScreenDimensions.h"
#include "InputEventPlus.h"
REGISTER_SCREEN_CLASS( ScreenBookkeeping );
@@ -54,12 +55,12 @@ void ScreenBookkeeping::Update( float fDelta )
ScreenWithMenuElements::Update( fDelta );
}
void ScreenBookkeeping::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenBookkeeping::Input( const InputEventPlus &input )
{
if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT )
if( input.type != IET_FIRST_PRESS && input.type != IET_SLOW_REPEAT )
return; // ignore
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler
Screen::Input( input ); // default handler
}
void ScreenBookkeeping::MenuLeft( PlayerNumber pn )
+1 -1
View File
@@ -16,7 +16,7 @@ public:
virtual ~ScreenBookkeeping();
virtual void Update( float fDelta );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void MenuLeft( PlayerNumber pn );
virtual void MenuRight( PlayerNumber pn );
+14 -13
View File
@@ -9,6 +9,7 @@
#include "RageDisplay.h"
#include "HelpDisplay.h"
#include "ScreenDimensions.h"
#include "InputEventPlus.h"
static ThemeMetric<bool> ALLOW_RESIZE("ScreenCenterImage","AllowResize");
@@ -49,14 +50,14 @@ ScreenCenterImage::~ScreenCenterImage()
void ScreenCenterImage::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenCenterImage::Input( const InputEventPlus &input )
{
if( IsTransitioning() )
return;
if( type == IET_FIRST_PRESS )
if( input.type == IET_FIRST_PRESS )
{
if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == KEY_SPACE )
if( input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_SPACE )
{
PREFSMAN->m_iCenterImageTranslateX.Set( 0 );
PREFSMAN->m_iCenterImageTranslateY.Set( 0 );
@@ -65,7 +66,7 @@ void ScreenCenterImage::Input( const DeviceInput& DeviceI, const InputEventType
return;
}
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_START:
SCREENMAN->PlayStartSound();
@@ -84,20 +85,20 @@ void ScreenCenterImage::Input( const DeviceInput& DeviceI, const InputEventType
bool bIncrease = false;
Axis axis = NUM_AXES;
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_UP: axis = AXIS_TRANS_Y; bIncrease = false; break;
case MENU_BUTTON_DOWN: axis = AXIS_TRANS_Y; bIncrease = true; break;
case MENU_BUTTON_LEFT: axis = AXIS_TRANS_X; bIncrease = false; break;
case MENU_BUTTON_RIGHT: axis = AXIS_TRANS_X; bIncrease = true; break;
default:
if( !DeviceI.IsJoystick() )
if( !input.DeviceI.IsJoystick() )
return;
/* Secondary axes aren't always mapped correctly; for example, PS2 converters
* tend to map the right stick to weird things, and every one is different,
* so they usually won't work. */
switch( DeviceI.button )
switch( input.DeviceI.button )
{
case JOY_UP: axis = AXIS_TRANS_Y; bIncrease = false; break;
case JOY_DOWN: axis = AXIS_TRANS_Y; bIncrease = true; break;
@@ -121,21 +122,21 @@ void ScreenCenterImage::Input( const DeviceInput& DeviceI, const InputEventType
}
float fScale = 1.0f;
if( type == IET_RELEASE )
if( input.type == IET_RELEASE )
fScale = 0;
if( DeviceI.level >= 0 )
if( input.DeviceI.level >= 0 )
{
/* Increase the dead zone. XXX: input drivers should handle dead zones */
if( DeviceI.level < 0.10f )
if( input.DeviceI.level < 0.10f )
fScale = 0;
else
fScale = SCALE( DeviceI.level, 0.10f, 1.0f, 0.0f, 1.0f );
fScale = SCALE( input.DeviceI.level, 0.10f, 1.0f, 0.0f, 1.0f );
}
if( DeviceI.level < 0 )
if( input.DeviceI.level < 0 )
{
switch( type )
switch( input.type )
{
case IET_SLOW_REPEAT: fScale *= 4; break;
case IET_FAST_REPEAT: fScale *= 16; break;
+1 -1
View File
@@ -14,7 +14,7 @@ public:
void Init();
virtual ~ScreenCenterImage();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void Update( float fDeltaTime );
private:
+7 -6
View File
@@ -19,6 +19,7 @@
#include "CodeDetector.h"
#include "RageInput.h"
#include "RageDisplay.h"
#include "InputEventPlus.h"
static bool g_bIsDisplayed = false;
static bool g_bIsSlow = false;
@@ -256,10 +257,10 @@ void ScreenDebugOverlay::UpdateText()
}
}
bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input )
{
if( DeviceI == g_Mappings.holdForDebug1 ||
DeviceI == g_Mappings.holdForDebug2 )
if( input.DeviceI == g_Mappings.holdForDebug1 ||
input.DeviceI == g_Mappings.holdForDebug2 )
{
bool bHoldingBoth =
(!g_Mappings.holdForDebug1.IsValid() || INPUTFILTER->IsBeingPressed(g_Mappings.holdForDebug1)) &&
@@ -275,10 +276,10 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
{
int i = p-g_pvpSubscribers->begin();
if( (g_bIsDisplayed && DeviceI == g_Mappings.debugButton[i]) ||
(IsGameplay() && DeviceI == g_Mappings.gameplayButton[i]) )
if( (g_bIsDisplayed && input.DeviceI == g_Mappings.debugButton[i]) ||
(IsGameplay() && input.DeviceI == g_Mappings.gameplayButton[i]) )
{
if( type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
return true; /* eat the input but do nothing */
BitmapText &txt1 = *m_vptextButton[i];
+1 -1
View File
@@ -14,7 +14,7 @@ public:
virtual ~ScreenDebugOverlay();
virtual void Init();
bool OverlayInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
bool OverlayInput( const InputEventPlus &input );
void Update( float fDeltaTime );
+60 -45
View File
@@ -31,6 +31,7 @@
#include "BackgroundUtil.h"
#include <utility>
#include <float.h>
#include "InputEventPlus.h"
static Preference<float> g_iDefaultRecordLength( "DefaultRecordLength", 4 );
@@ -995,41 +996,39 @@ void ScreenEdit::DrawPrimitives()
GAMESTATE->m_fSongBeat = fSongBeat; // restore real song beat
}
void ScreenEdit::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenEdit::Input( const InputEventPlus &input )
{
// LOG->Trace( "ScreenEdit::Input()" );
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
return;
const DeviceInput& di = DeviceI;
EditButton EditB;
DeviceToEdit( di, EditB );
DeviceToEdit( input.DeviceI, EditB );
if( EditB == EDIT_BUTTON_REMOVE_NOTE )
{
// Ugly: we need to know when the button was pressed or released, so we
// can clamp operations to that time. Should InputFilter keep track of
// last release, too?
m_bRemoveNoteButtonDown = (type != IET_RELEASE);
m_bRemoveNoteButtonDown = (input.type != IET_RELEASE);
m_RemoveNoteButtonLastChanged.Touch();
}
switch( m_EditState )
{
case STATE_EDITING:
InputEdit( di, type, GameI, MenuI, StyleI, EditB );
InputEdit( input, EditB );
m_bTextInfoNeedsUpdate = true;
break;
case STATE_RECORDING:
InputRecord( di, type, GameI, MenuI, StyleI, EditB );
InputRecord( input, EditB );
break;
case STATE_RECORDING_PAUSED:
InputRecordPaused( di, type, GameI, MenuI, StyleI, EditB );
InputRecordPaused( input, EditB );
break;
case STATE_PLAYING:
InputPlay( di, type, GameI, MenuI, StyleI, EditB );
InputPlay( input, EditB );
break;
default: ASSERT(0);
}
@@ -1050,14 +1049,14 @@ static void ShiftToRightSide( int &iCol, int iNumTracks )
}
}
void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB )
void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
{
if( type == IET_LEVEL_CHANGED )
if( input.type == IET_LEVEL_CHANGED )
return; // don't care
if( type == IET_RELEASE )
if( input.type == IET_RELEASE )
{
if( EditPressed( EDIT_BUTTON_SCROLL_SELECT, DeviceI ) )
if( EditPressed( EDIT_BUTTON_SCROLL_SELECT, input.DeviceI ) )
m_iShiftAnchor = -1;
return;
}
@@ -1076,7 +1075,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
case EDIT_BUTTON_COLUMN_8:
case EDIT_BUTTON_COLUMN_9:
{
if( type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
break; // We only care about first presses
int iCol = EditB - EDIT_BUTTON_COLUMN_0;
@@ -1355,11 +1354,16 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
default: ASSERT(0); return;
}
if( EditIsBeingPressed( EDIT_BUTTON_ADJUST_FINE ) )
fDeltaBPM /= 2;
else switch( type )
{
case IET_SLOW_REPEAT: fDeltaBPM *= 10; break;
case IET_FAST_REPEAT: fDeltaBPM *= 40; break;
fDeltaBPM /= 2;
}
else
{
switch( input.type )
{
case IET_SLOW_REPEAT: fDeltaBPM *= 10; break;
case IET_FAST_REPEAT: fDeltaBPM *= 40; break;
}
}
float fNewBPM = fBPM + fDeltaBPM;
@@ -1377,13 +1381,17 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
default: ASSERT(0); return;
}
if( EditIsBeingPressed( EDIT_BUTTON_ADJUST_FINE ) )
fStopDelta /= 20; /* 1ms */
else switch( type )
{
case IET_SLOW_REPEAT: fStopDelta *= 10; break;
case IET_FAST_REPEAT: fStopDelta *= 40; break;
fStopDelta /= 20; /* 1ms */
}
else
{
switch( input.type )
{
case IET_SLOW_REPEAT: fStopDelta *= 10; break;
case IET_FAST_REPEAT: fStopDelta *= 40; break;
}
}
unsigned i;
for( i=0; i<m_pSong->m_Timing.m_StopSegments.size(); i++ )
{
@@ -1417,13 +1425,17 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
default: ASSERT(0); return;
}
if( EditIsBeingPressed( EDIT_BUTTON_ADJUST_FINE ) )
fOffsetDelta /= 20; /* 1ms */
else switch( type )
{
case IET_SLOW_REPEAT: fOffsetDelta *= 10; break;
case IET_FAST_REPEAT: fOffsetDelta *= 40; break;
fOffsetDelta /= 20; /* 1ms */
}
else
{
switch( input.type )
{
case IET_SLOW_REPEAT: fOffsetDelta *= 10; break;
case IET_FAST_REPEAT: fOffsetDelta *= 40; break;
}
}
m_pSong->m_Timing.m_fBeat0OffsetInSeconds += fOffsetDelta;
}
break;
@@ -1439,7 +1451,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
case EDIT_BUTTON_SAMPLE_LENGTH_UP: fDelta = +0.02f; break;
default: ASSERT(0); return;
}
switch( type )
switch( input.type )
{
case IET_SLOW_REPEAT: fDelta *= 10; break;
case IET_FAST_REPEAT: fDelta *= 40; break;
@@ -1718,7 +1730,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
}
}
void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB )
void ScreenEdit::InputRecord( const InputEventPlus &input, EditButton EditB )
{
if( EditB == EDIT_BUTTON_RETURN_TO_EDIT )
{
@@ -1726,12 +1738,12 @@ void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType t
return;
}
if( StyleI.player != PLAYER_1 )
if( input.StyleI.player != PLAYER_1 )
return; // ignore
const int iCol = StyleI.col;
const int iCol = input.StyleI.col;
switch( type )
switch( input.type )
{
case IET_FIRST_PRESS:
{
@@ -1774,9 +1786,9 @@ void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType t
}
}
void ScreenEdit::InputRecordPaused( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB )
void ScreenEdit::InputRecordPaused( const InputEventPlus &input, EditButton EditB )
{
if( type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
return; // don't care
switch( EditB )
@@ -1827,9 +1839,9 @@ void ScreenEdit::InputRecordPaused( const DeviceInput& DeviceI, const InputEvent
}
}
void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB )
void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
{
if( type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
return;
switch( EditB )
@@ -1861,11 +1873,16 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ
}
if( EditIsBeingPressed( EDIT_BUTTON_ADJUST_FINE ) )
fOffsetDelta /= 20; /* 1ms */
else switch( type )
{
case IET_SLOW_REPEAT: fOffsetDelta *= 10; break;
case IET_FAST_REPEAT: fOffsetDelta *= 40; break;
fOffsetDelta /= 20; /* 1ms */
}
else
{
switch( input.type )
{
case IET_SLOW_REPEAT: fOffsetDelta *= 10; break;
case IET_FAST_REPEAT: fOffsetDelta *= 40; break;
}
}
m_pSong->m_Timing.m_fBeat0OffsetInSeconds += fOffsetDelta;
@@ -1873,11 +1890,11 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ
break;
}
switch( StyleI.player )
switch( input.StyleI.player )
{
case PLAYER_1:
if( PREFSMAN->m_AutoPlay == PC_HUMAN )
m_Player.Step( StyleI.col, DeviceI.ts );
m_Player.Step( input.StyleI.col, input.DeviceI.ts );
break;
}
@@ -2236,7 +2253,6 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
{
Course *pCourse = GAMESTATE->m_pCurCourse;
CourseEntry &ce = pCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex];
bool bAnyAttackAtThisBeat = false;
FOREACH( Attack, ce.attacks, a )
{
if( a->fStartSecond == m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) )
@@ -2255,7 +2271,6 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
{
PlayerOptions poChosen = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
CString sMods = poChosen.GetString();
const int row = BeatToNoteRow( GAMESTATE->m_fSongBeat );
Course *pCourse = GAMESTATE->m_pCurCourse;
CourseEntry &ce = pCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex];
+5 -5
View File
@@ -153,11 +153,11 @@ public:
virtual ~ScreenEdit();
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
void InputEdit( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB );
void InputRecord( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB );
void InputRecordPaused( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB );
void InputPlay( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB );
virtual void Input( const InputEventPlus &input );
void InputEdit( const InputEventPlus &input, EditButton EditB );
void InputRecord( const InputEventPlus &input, EditButton EditB );
void InputRecordPaused( const InputEventPlus &input, EditButton EditB );
void InputPlay( const InputEventPlus &input, EditButton EditB );
virtual void HandleScreenMessage( const ScreenMessage SM );
protected:
+5 -4
View File
@@ -18,6 +18,7 @@
#include "StatsManager.h"
#include "PlayerState.h"
#include "CommonMetrics.h"
#include "InputEventPlus.h"
CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line )
@@ -237,12 +238,12 @@ void ScreenEnding::Init()
GAMESTATE->Reset();
}
void ScreenEnding::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenEnding::Input( const InputEventPlus &input )
{
bool bIsTransitioning = m_In.IsTransitioning() || m_Out.IsTransitioning();
if( MenuI.IsValid() && !bIsTransitioning )
if( input.MenuI.IsValid() && !bIsTransitioning )
{
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_START:
SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 );
@@ -250,7 +251,7 @@ void ScreenEnding::Input( const DeviceInput& DeviceI, const InputEventType type,
}
}
ScreenAttract::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenAttract::Input( input );
}
/*
+1 -1
View File
@@ -25,7 +25,7 @@ class ScreenEnding : public ScreenAttract
public:
ScreenEnding( CString sName );
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
private:
struct Line
+7 -6
View File
@@ -31,6 +31,7 @@
#include "Command.h"
#include "CommonMetrics.h"
#include "ScoreKeeperMAX2.h"
#include "InputEventPlus.h"
const int NUM_SCORE_DIGITS = 9;
@@ -1151,21 +1152,21 @@ void ScreenEvaluation::TweenOursOffScreen()
OFF_COMMAND( m_sprTryExtraStage );
}
void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenEvaluation::Input( const InputEventPlus &input )
{
// LOG->Trace( "ScreenEvaluation::Input()" );
if( IsTransitioning() )
return;
if( GameI.IsValid() )
if( input.GameI.IsValid() )
{
PlayerNumber pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( GameI.controller );
PlayerNumber pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( input.GameI.controller );
HighScore &hs = m_HighScore[pn];
if( CodeDetector::EnteredCode(GameI.controller, CODE_SAVE_SCREENSHOT1) ||
CodeDetector::EnteredCode(GameI.controller, CODE_SAVE_SCREENSHOT2) )
if( CodeDetector::EnteredCode(input.GameI.controller, CODE_SAVE_SCREENSHOT1) ||
CodeDetector::EnteredCode(input.GameI.controller, CODE_SAVE_SCREENSHOT2) )
{
if( !m_bSavedScreenshot[pn] && // only allow one screenshot
PROFILEMAN->IsPersistentProfile(pn) )
@@ -1197,7 +1198,7 @@ void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType t
}
}
ScreenWithMenuElements::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenWithMenuElements::Input( input );
}
void ScreenEvaluation::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -25,7 +25,7 @@ public:
enum Type { stage, summary, course };
ScreenEvaluation( CString sClassName );
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void TweenOursOffScreen();
@@ -259,12 +259,12 @@ void ScreenEvaluationMultiplayer::HandleScreenMessage( const ScreenMessage SM )
ScreenWithMenuElements::HandleScreenMessage( SM );
}
void ScreenEvaluationMultiplayer::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenEvaluationMultiplayer::Input( const InputEventPlus &input )
{
if( this->IsTransitioning() )
return;
ScreenWithMenuElements::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenWithMenuElements::Input( input );
}
void ScreenEvaluationMultiplayer::Update( float fDeltaTime )
+1 -1
View File
@@ -27,7 +27,7 @@ public:
~ScreenEvaluationMultiplayer();
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void Update(float f);
virtual void DrawPrimitives();
+12 -11
View File
@@ -21,6 +21,7 @@
#include "Command.h"
#include "RageLog.h"
#include "song.h"
#include "InputEventPlus.h"
#define PREV_SCREEN THEME->GetMetric ("ScreenEz2SelectMusic","PrevScreen")
@@ -232,20 +233,20 @@ void ScreenEz2SelectMusic::Init()
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("select music intro") );
}
void ScreenEz2SelectMusic::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenEz2SelectMusic::Input( const InputEventPlus &input )
{
// if( type != IET_FIRST_PRESS )
// return; // ignore
if(i_ErrorDetected) return; // don't let the user do anything if theres an error
if( type == IET_RELEASE || type == IET_LEVEL_CHANGED ) return; // don't care
if( input.type == IET_RELEASE || input.type == IET_LEVEL_CHANGED ) return; // don't care
if( IsTransitioning() ) return; // ignore
if( !GameI.IsValid() ) return; // don't care
if( !input.GameI.IsValid() ) return; // don't care
if( m_bMadeChoice && !m_bGoToOptions && MenuI.IsValid() && MenuI.button == MENU_BUTTON_START )
if( m_bMadeChoice && !m_bGoToOptions && input.MenuI.IsValid() && input.MenuI.button == MENU_BUTTON_START )
{
SCREENMAN->PlayStartSound();
m_bGoToOptions = true;
@@ -255,31 +256,31 @@ void ScreenEz2SelectMusic::Input( const DeviceInput& DeviceI, const InputEventTy
if( m_bMadeChoice )
return;
PlayerNumber pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( GameI.controller );
PlayerNumber pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( input.GameI.controller );
if( CodeDetector::EnteredEasierDifficulty(GameI.controller) )
if( CodeDetector::EnteredEasierDifficulty(input.GameI.controller) )
{
EasierDifficulty( pn );
return;
}
if( CodeDetector::EnteredHarderDifficulty(GameI.controller) )
if( CodeDetector::EnteredHarderDifficulty(input.GameI.controller) )
{
HarderDifficulty( pn );
return;
}
if( CodeDetector::DetectAndAdjustMusicOptions(GameI.controller) )
if( CodeDetector::DetectAndAdjustMusicOptions(input.GameI.controller) )
{
UpdateOptions(pn,1);
}
if( CodeDetector::EnteredNextBannerGroup(GameI.controller))
if( CodeDetector::EnteredNextBannerGroup(input.GameI.controller))
{
m_MusicBannerWheel.ScanToNextGroup();
MusicChanged();
return;
}
if( type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
{
m_bScanning = true;
m_soundMusicCycle.Play();
@@ -310,7 +311,7 @@ void ScreenEz2SelectMusic::Input( const DeviceInput& DeviceI, const InputEventTy
m_soundButtonPress.Play();
}
LastInputTime = RageTimer::GetTimeSinceStartFast();
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
Screen::Input( input );
}
void ScreenEz2SelectMusic::UpdateOptions(PlayerNumber pn, int nosound)
+1 -1
View File
@@ -18,7 +18,7 @@ public:
virtual void Init();
virtual void Update( float fDeltaTime );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( PlayerNumber pn );
virtual void MenuLeft( PlayerNumber pn, const InputEventType type );
+2 -2
View File
@@ -111,14 +111,14 @@ void ScreenEz2SelectPlayer::Update( float fDeltaTime )
Input
Desc: Handles player input.
************************************/
void ScreenEz2SelectPlayer::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenEz2SelectPlayer::Input( const InputEventPlus &input )
{
LOG->Trace( "ScreenEz2SelectPlayer::Input()" );
if( IsTransitioning() )
return;
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
Screen::Input( input ); // default input handler
}
/************************************
+1 -1
View File
@@ -16,7 +16,7 @@ public:
/* Public Function Prototypes */
virtual void Update( float fDeltaTime );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuDown( PlayerNumber pn );
+28 -27
View File
@@ -57,6 +57,7 @@
#include "DifficultyIcon.h"
#include "DifficultyMeter.h"
#include "PlayerScoreList.h"
#include "InputEventPlus.h"
//
// Defines
@@ -2104,27 +2105,27 @@ void ScreenGameplay::AbortGiveUp( bool bShowText )
}
void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenGameplay::Input( const InputEventPlus &input )
{
//LOG->Trace( "ScreenGameplay::Input()" );
if( type == IET_LEVEL_CHANGED )
if( input.type == IET_LEVEL_CHANGED )
return;
if( m_bPaused )
{
/* If we're paused, only accept MENU_BUTTON_START to unpause. */
if( MenuI.IsValid() && GAMESTATE->IsHumanPlayer(MenuI.player) && MenuI.button == MENU_BUTTON_START && type == IET_FIRST_PRESS )
if( input.MenuI.IsValid() && GAMESTATE->IsHumanPlayer(input.MenuI.player) && input.MenuI.button == MENU_BUTTON_START && input.type == IET_FIRST_PRESS )
{
if( m_PauseController == GAME_CONTROLLER_INVALID || m_PauseController == GameI.controller )
if( m_PauseController == GAME_CONTROLLER_INVALID || m_PauseController == input.GameI.controller )
this->PauseGame( false );
}
return;
}
if( MenuI.IsValid() &&
if( input.MenuI.IsValid() &&
m_DancingState != STATE_OUTRO &&
GAMESTATE->IsHumanPlayer(MenuI.player) &&
GAMESTATE->IsHumanPlayer(input.MenuI.player) &&
!m_Cancel.IsTransitioning() )
{
/* Allow bailing out by holding the START button of all active players. This
@@ -2133,15 +2134,15 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
*
* However, if this is also a style button, don't do this. (pump center = start) */
bool bHoldingGiveUp = false;
bHoldingGiveUp |= ( START_GIVES_UP && MenuI.button == MENU_BUTTON_START && !StyleI.IsValid() );
bHoldingGiveUp |= ( BACK_GIVES_UP && MenuI.button == MENU_BUTTON_BACK && !StyleI.IsValid() );
bHoldingGiveUp |= ( START_GIVES_UP && input.MenuI.button == MENU_BUTTON_START && !input.StyleI.IsValid() );
bHoldingGiveUp |= ( BACK_GIVES_UP && input.MenuI.button == MENU_BUTTON_BACK && !input.StyleI.IsValid() );
if( bHoldingGiveUp )
{
/* No PREFSMAN->m_bDelayedEscape; always delayed. */
if( type==IET_RELEASE )
if( input.type==IET_RELEASE )
AbortGiveUp( true );
else if( type==IET_FIRST_PRESS && m_GiveUpTimer.IsZero() )
else if( input.type==IET_FIRST_PRESS && m_GiveUpTimer.IsZero() )
{
m_textDebug.SetText( GIVE_UP_TEXT );
m_textDebug.StopTweening();
@@ -2156,16 +2157,16 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
/* Only handle MENU_BUTTON_BACK as a regular BACK button if BACK_GIVES_UP is
* disabled. */
if( MenuI.button == MENU_BUTTON_BACK && !BACK_GIVES_UP )
if( input.MenuI.button == MENU_BUTTON_BACK && !BACK_GIVES_UP )
{
if( ((!PREFSMAN->m_bDelayedBack && type==IET_FIRST_PRESS) ||
(DeviceI.device==DEVICE_KEYBOARD && (type==IET_SLOW_REPEAT||type==IET_FAST_REPEAT)) ||
(DeviceI.device!=DEVICE_KEYBOARD && type==IET_FAST_REPEAT)) )
if( ((!PREFSMAN->m_bDelayedBack && input.type==IET_FIRST_PRESS) ||
(input.DeviceI.device==DEVICE_KEYBOARD && (input.type==IET_SLOW_REPEAT||input.type==IET_FAST_REPEAT)) ||
(input.DeviceI.device!=DEVICE_KEYBOARD && input.type==IET_FAST_REPEAT)) )
{
LOG->Trace("Player %i went back", MenuI.player+1);
LOG->Trace("Player %i went back", input.MenuI.player+1);
BackOutFromGameplay();
}
else if( PREFSMAN->m_bDelayedBack && type==IET_FIRST_PRESS )
else if( PREFSMAN->m_bDelayedBack && input.type==IET_FIRST_PRESS )
{
m_textDebug.SetText( "Continue holding BACK to quit" );
m_textDebug.StopTweening();
@@ -2173,7 +2174,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
m_textDebug.BeginTweening( 1/8.f );
m_textDebug.SetDiffuse( RageColor(1,1,1,1) );
}
else if( PREFSMAN->m_bDelayedBack && type==IET_RELEASE )
else if( PREFSMAN->m_bDelayedBack && input.type==IET_RELEASE )
{
m_textDebug.StopTweening();
m_textDebug.BeginTweening( 1/8.f );
@@ -2185,7 +2186,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
}
/* Nothing below cares about releases. */
if(type == IET_RELEASE)
if( input.type == IET_RELEASE )
return;
@@ -2195,22 +2196,22 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
// Translate input and sent to the appropriate player. Assume that all
// joystick devices are mapped the same as the master player.
if( DeviceI.IsJoystick() )
if( input.DeviceI.IsJoystick() )
{
DeviceInput _DeviceI = DeviceI;
DeviceInput _DeviceI = input.DeviceI;
_DeviceI.device = DEVICE_JOY1;
GameInput _GameI;
INPUTMAPPER->DeviceToGame( _DeviceI, _GameI );
if( GameI.IsValid() )
if( input.GameI.IsValid() )
{
StyleInput _StyleI;
INPUTMAPPER->GameToStyle( _GameI, _StyleI );
mp = InputMapper::InputDeviceToMultiPlayer( DeviceI.device );
mp = InputMapper::InputDeviceToMultiPlayer( input.DeviceI.device );
if( mp>=0 && mp<NUM_MultiPlayer )
m_vPlayerInfo[mp].m_pPlayer->Step( _StyleI.col, DeviceI.ts );
m_vPlayerInfo[mp].m_pPlayer->Step( _StyleI.col, input.DeviceI.ts );
}
}
}
@@ -2219,14 +2220,14 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
//
// handle a step or battle item activate
//
if( type==IET_FIRST_PRESS &&
StyleI.IsValid() &&
GAMESTATE->IsHumanPlayer( StyleI.player ) )
if( input.type==IET_FIRST_PRESS &&
input.StyleI.IsValid() &&
GAMESTATE->IsHumanPlayer( input.StyleI.player ) )
{
AbortGiveUp( true );
if( PREFSMAN->m_AutoPlay == PC_HUMAN )
m_vPlayerInfo[StyleI.player].m_pPlayer->Step( StyleI.col, DeviceI.ts );
m_vPlayerInfo[input.StyleI.player].m_pPlayer->Step( input.StyleI.col, input.DeviceI.ts );
}
}
}
+2 -1
View File
@@ -19,6 +19,7 @@
#include "ThemeMetric.h"
#include "PlayerStageStats.h"
#include "PlayerState.h"
#include "GameInput.h"
class LyricsLoader;
class ActiveAttackList;
@@ -101,7 +102,7 @@ public:
virtual ~ScreenGameplay();
virtual void Update( float fDeltaTime );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual bool UsesBackground() const { return false; }
+2 -2
View File
@@ -14,13 +14,13 @@ void ScreenInstructions::Init()
this->SortByDrawOrder();
}
void ScreenInstructions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenInstructions::Input( const InputEventPlus &input )
{
if( IsTransitioning() )
return;
// default input handler
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
Screen::Input( input );
}
void ScreenInstructions::MenuBack( PlayerNumber pn )
+1 -1
View File
@@ -9,7 +9,7 @@ public:
ScreenInstructions( CString sName );
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void MenuBack( PlayerNumber pn );
virtual void MenuStart( PlayerNumber pn );
+8 -8
View File
@@ -1,7 +1,6 @@
/*
* Join players in perparation for ScreenGameplayMultiplayer.
*/
#include "global.h"
#include "ScreenJoinMultiplayer.h"
#include "RageInput.h"
@@ -13,6 +12,7 @@ class Style;
#include "GameCommand.h"
#include "ScreenPrompt.h"
#include "ScreenManager.h"
#include "InputEventPlus.h"
static const CString MultiPlayerStatusNames[] = {
@@ -97,18 +97,18 @@ void ScreenJoinMultiplayer::HandleScreenMessage( const ScreenMessage SM )
ScreenWithMenuElements::HandleScreenMessage( SM );
}
void ScreenJoinMultiplayer::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenJoinMultiplayer::Input( const InputEventPlus &input )
{
if( this->IsTransitioning() )
return;
// Translate input and sent to the appropriate player. Assume that all
// joystick devices are mapped the same as the master player.
if( type == IET_FIRST_PRESS &&
DeviceI.device >= DEVICE_JOY1 &&
DeviceI.device < DEVICE_JOY1 + NUM_MultiPlayer )
if( input.type == IET_FIRST_PRESS &&
input.DeviceI.device >= DEVICE_JOY1 &&
input.DeviceI.device < DEVICE_JOY1 + NUM_MultiPlayer )
{
DeviceInput di = DeviceI;
DeviceInput di = input.DeviceI;
di.device = DEVICE_JOY1;
GameInput gi;
INPUTMAPPER->DeviceToGame( di, gi );
@@ -118,7 +118,7 @@ void ScreenJoinMultiplayer::Input( const DeviceInput& DeviceI, const InputEventT
MenuInput mi;
INPUTMAPPER->GameToMenu( gi, mi );
MultiPlayer p = InputMapper::InputDeviceToMultiPlayer( DeviceI.device );
MultiPlayer p = InputMapper::InputDeviceToMultiPlayer( input.DeviceI.device );
// testing hack
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD,KEY_LSHIFT) ) )
@@ -160,7 +160,7 @@ void ScreenJoinMultiplayer::Input( const DeviceInput& DeviceI, const InputEventT
}
}
ScreenWithMenuElements::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenWithMenuElements::Input( input );
}
void ScreenJoinMultiplayer::Update( float fDeltaTime )
+1 -1
View File
@@ -21,7 +21,7 @@ public:
ScreenJoinMultiplayer( CString sName );
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void Update(float f);
virtual void DrawPrimitives();
+6 -5
View File
@@ -18,6 +18,7 @@
#include "StatsManager.h"
#include "CommonMetrics.h"
#include "PrefsManager.h"
#include "InputEventPlus.h"
#define SHOW_COURSE_MODIFIERS_PROBABILITY THEME->GetMetricF(m_sName,"ShowCourseModifiersProbability")
@@ -241,16 +242,16 @@ void ScreenJukebox::Init()
m_DancingState = STATE_DANCING;
}
void ScreenJukebox::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenJukebox::Input( const InputEventPlus &input )
{
//LOG->Trace( "ScreenJukebox::Input()" );
if( type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
return; /* ignore */
if( MenuI.IsValid() )
if( input.MenuI.IsValid() )
{
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_LEFT:
case MENU_BUTTON_RIGHT:
@@ -259,7 +260,7 @@ void ScreenJukebox::Input( const DeviceInput& DeviceI, const InputEventType type
}
}
ScreenAttract::AttractInput( DeviceI, type, GameI, MenuI, StyleI, this );
ScreenAttract::AttractInput( input, this );
}
void ScreenJukebox::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -12,7 +12,7 @@ public:
ScreenJukebox( CString sName );
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
void SetSong();
+3 -3
View File
@@ -433,7 +433,7 @@ void ScreenManager::Draw()
}
void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenManager::Input( const InputEventPlus &input )
{
// LOG->Trace( "ScreenManager::Input( %d-%d, %d-%d, %d-%d, %d-%d )",
// DeviceI.device, DeviceI.button, GameI.controller, GameI.button, MenuI.player, MenuI.button, StyleI.player, StyleI.col );
@@ -445,7 +445,7 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type
for( unsigned i = 0; i < g_OverlayScreens.size(); ++i )
{
Screen *pScreen = g_OverlayScreens[i];
if( pScreen->OverlayInput(DeviceI, type, GameI, MenuI, StyleI) )
if( pScreen->OverlayInput(input) )
return;
}
@@ -455,7 +455,7 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type
return;
if( !g_ScreenStack.empty() )
g_ScreenStack.back().m_pScreen->Input( DeviceI, type, GameI, MenuI, StyleI );
g_ScreenStack.back().m_pScreen->Input( input );
}
/* Just create a new screen; don't do any associated cleanup. */
+2 -1
View File
@@ -15,6 +15,7 @@ class Actor;
class Screen;
struct Menu;
struct lua_State;
class InputEventPlus;
class ScreenManager
@@ -26,7 +27,7 @@ public:
// pass these messages along to the current state
void Update( float fDeltaTime );
void Draw();
void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
void Input( const InputEventPlus &input );
// Main screen stack management
void SetNewScreen( const CString &sName );
+20 -19
View File
@@ -10,6 +10,7 @@
#include "Game.h"
#include "ScreenDimensions.h"
#include "Command.h"
#include "InputEventPlus.h"
#if defined(XBOX)
#include "HelpDisplay.h" //We still need this for Xbox controller mapping.
#endif
@@ -162,34 +163,34 @@ static bool IsAxis( const DeviceInput& DeviceI )
return false;
}
void ScreenMapControllers::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenMapControllers::Input( const InputEventPlus &input )
{
if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT )
if( input.type != IET_FIRST_PRESS && input.type != IET_SLOW_REPEAT )
return; // ignore
LOG->Trace( "ScreenMapControllers::Input(): device: %d, button: %d",
DeviceI.device, DeviceI.button );
input.DeviceI.device, input.DeviceI.button );
int button = DeviceI.button;
int button = input.DeviceI.button;
#ifdef _XBOX
if(!m_iWaitingForPress && DeviceI.device == DEVICE_JOY1)
if( !m_iWaitingForPress && input.DeviceI.device == DEVICE_JOY1 )
{
// map the xbox controller buttons to the keyboard equivalents
if(DeviceI.button == JOY_HAT_LEFT)
if( input.DeviceI.button == JOY_HAT_LEFT )
button = KEY_LEFT;
else if(DeviceI.button == JOY_HAT_RIGHT)
else if( input.DeviceI.button == JOY_HAT_RIGHT )
button = KEY_RIGHT;
else if(DeviceI.button == JOY_HAT_UP)
else if( input.DeviceI.button == JOY_HAT_UP )
button = KEY_UP;
else if(DeviceI.button == JOY_HAT_DOWN)
else if( input.DeviceI.button == JOY_HAT_DOWN )
button = KEY_DOWN;
else if(DeviceI.button == JOY_AUX_1)
else if( input.DeviceI.button == JOY_AUX_1 )
button = KEY_ENTER;
else if(DeviceI.button == JOY_AUX_2)
else if( input.DeviceI.button == JOY_AUX_2 )
button = KEY_ESC;
else if(DeviceI.button == JOY_1 || DeviceI.button == JOY_2 ||
DeviceI.button == JOY_3 || DeviceI.button == JOY_4)
else if( input.DeviceI.button == JOY_1 || input.DeviceI.button == JOY_2 ||
input.DeviceI.button == JOY_3 || input.DeviceI.button == JOY_4 )
button = KEY_DEL;
}
#endif
@@ -206,7 +207,7 @@ void ScreenMapControllers::Input( const DeviceInput& DeviceI, const InputEventTy
if( m_iWaitingForPress )
{
/* Don't allow function keys to be mapped. */
if ( DeviceI.device == DEVICE_KEYBOARD && (DeviceI.button >= KEY_F1 && DeviceI.button <= KEY_F12) )
if( input.DeviceI.device == DEVICE_KEYBOARD && (input.DeviceI.button >= KEY_F1 && input.DeviceI.button <= KEY_F12) )
{
m_textError.SetText( "That key can not be mapped." );
SCREENMAN->PlayInvalidSound();
@@ -220,19 +221,19 @@ void ScreenMapControllers::Input( const DeviceInput& DeviceI, const InputEventTy
{
if( m_DeviceIToMap.IsValid() &&
!IsAxis(m_DeviceIToMap) &&
IsAxis(DeviceI) )
IsAxis(input.DeviceI) )
{
LOG->Trace("Ignored input; non-axis event already received");
return; // ignore this press
}
m_DeviceIToMap = DeviceI;
m_DeviceIToMap = input.DeviceI;
}
}
#ifdef _XBOX
else if( DeviceI.device == DEVICE_JOY1 )
else if( input.DeviceI.device == DEVICE_JOY1 )
#else
else if( DeviceI.device == DEVICE_KEYBOARD )
else if( input.DeviceI.device == DEVICE_KEYBOARD )
#endif
{
switch( button )
@@ -311,7 +312,7 @@ void ScreenMapControllers::Input( const DeviceInput& DeviceI, const InputEventTy
}
}
// Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler
// Screen::Input( input ); // default handler
LOG->Trace( "m_iCurSlot: %d m_iCurController: %d m_iCurButton: %d", m_iCurSlot, m_iCurController, m_iCurButton );
+1 -1
View File
@@ -17,7 +17,7 @@ public:
virtual ~ScreenMapControllers();
virtual void Update( float fDeltaTime );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
private:
void KeyLeft();
+10 -9
View File
@@ -21,6 +21,7 @@
#include "PlayerState.h"
#include "Style.h"
#include "NoteSkinManager.h"
#include "InputEventPlus.h"
//
@@ -343,30 +344,30 @@ void ScreenNameEntry::DrawPrimitives()
}
}
void ScreenNameEntry::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenNameEntry::Input( const InputEventPlus &input )
{
LOG->Trace( "ScreenNameEntry::Input()" );
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
return;
if( type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
return; // ignore
if( StyleI.IsValid() && m_bStillEnteringName[StyleI.player])
if( input.StyleI.IsValid() && m_bStillEnteringName[input.StyleI.player])
{
int StringIndex = m_ColToStringIndex[StyleI.player][StyleI.col];
if(StringIndex != -1)
int iStringIndex = m_ColToStringIndex[input.StyleI.player][input.StyleI.col];
if( iStringIndex != -1 )
{
m_ReceptorArrowRow[StyleI.player].Step( StyleI.col, TNS_MARVELOUS );
m_ReceptorArrowRow[input.StyleI.player].Step( input.StyleI.col, TNS_MARVELOUS );
m_soundStep.Play();
char c = NAME_CHARS[GetClosestCharIndex(m_fFakeBeat)];
m_textSelectedChars[StyleI.player][StyleI.col].SetText( ssprintf("%c",c) );
m_sSelectedName[StyleI.player][StringIndex] = c;
m_textSelectedChars[input.StyleI.player][input.StyleI.col].SetText( ssprintf("%c",c) );
m_sSelectedName[input.StyleI.player][iStringIndex] = c;
}
}
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
Screen::Input( input );
}
void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -18,7 +18,7 @@ public:
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( PlayerNumber pn );
+2 -2
View File
@@ -508,12 +508,12 @@ void ScreenNameEntryTraditional::Update( float fDelta )
ScreenWithMenuElements::Update(fDelta);
}
void ScreenNameEntryTraditional::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenNameEntryTraditional::Input( const InputEventPlus &input )
{
if( IsTransitioning() )
return;
ScreenWithMenuElements::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenWithMenuElements::Input( input );
}
void ScreenNameEntryTraditional::ChangeDisplayedFeat()
+1 -1
View File
@@ -47,7 +47,7 @@ public:
void Update( float fDeltaTime );
void HandleScreenMessage( const ScreenMessage SM );
void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
void Input( const InputEventPlus &input );
void MenuStart( PlayerNumber pn, const InputEventType type );
void MenuSelect( PlayerNumber pn, const InputEventType type );
+4 -5
View File
@@ -10,6 +10,7 @@
#include "Command.h"
#include "WheelItemBase.h"
#include "RageLog.h"
#include "InputEventPlus.h"
#define TITLEBG_WIDTH THEME->GetMetricF(m_sName,"TitleBGWidth")
#define TITLEBG_HEIGHT THEME->GetMetricF(m_sName,"TitleBGHeight")
@@ -66,14 +67,12 @@ void ScreenNetRoom::Init()
NSMAN->ReportNSSOnOff(7);
}
void ScreenNetRoom::Input( const DeviceInput& DeviceI, const InputEventType type,
const GameInput& GameI, const MenuInput& MenuI,
const StyleInput& StyleI )
void ScreenNetRoom::Input( const InputEventPlus &input )
{
if (((MenuI.button == MENU_BUTTON_LEFT) || (MenuI.button == MENU_BUTTON_RIGHT)) && (type == IET_RELEASE))
if (((input.MenuI.button == MENU_BUTTON_LEFT) || (input.MenuI.button == MENU_BUTTON_RIGHT)) && (input.type == IET_RELEASE))
m_RoomWheel.Move(0);
ScreenNetSelectBase::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenNetSelectBase::Input( input );
}
void ScreenNetRoom::HandleScreenMessage( const ScreenMessage SM )
+1 -3
View File
@@ -27,9 +27,7 @@ class ScreenNetRoom : public ScreenNetSelectBase
public:
ScreenNetRoom( const CString& sName );
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type,
const GameInput& GameI, const MenuInput& MenuI,
const StyleInput& StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
protected:
+6 -7
View File
@@ -12,6 +12,7 @@
#include "NetworkSyncManager.h"
#include "RageUtil.h"
#include "GameState.h"
#include "InputEventPlus.h"
#define CHATINPUT_WIDTH THEME->GetMetricF(m_sName,"ChatInputBoxWidth")
#define CHATINPUT_HEIGHT THEME->GetMetricF(m_sName,"ChatInputBoxHeight")
@@ -88,14 +89,12 @@ void ScreenNetSelectBase::Init()
return;
}
void ScreenNetSelectBase::Input( const DeviceInput& DeviceI, const InputEventType type,
const GameInput& GameI, const MenuInput& MenuI,
const StyleInput& StyleI )
void ScreenNetSelectBase::Input( const InputEventPlus &input )
{
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
return;
if( (type != IET_FIRST_PRESS) && (type != IET_SLOW_REPEAT) && (type != IET_FAST_REPEAT ) )
if( (input.type != IET_FIRST_PRESS) && (input.type != IET_SLOW_REPEAT) && (input.type != IET_FAST_REPEAT ) )
return;
bool bHoldingShift =
@@ -107,7 +106,7 @@ void ScreenNetSelectBase::Input( const DeviceInput& DeviceI, const InputEventTyp
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL)) ||
(!NSMAN->useSMserver); //If we are disconnected, assume no chatting
switch( DeviceI.button )
switch( input.DeviceI.button )
{
case KEY_ENTER:
case KEY_KP_ENTER:
@@ -127,7 +126,7 @@ void ScreenNetSelectBase::Input( const DeviceInput& DeviceI, const InputEventTyp
break;
default:
char c;
c = DeviceI.ToChar();
c = input.DeviceI.ToChar();
if( bHoldingShift && !bHoldingCtrl )
{
@@ -172,7 +171,7 @@ void ScreenNetSelectBase::Input( const DeviceInput& DeviceI, const InputEventTyp
return;
break;
}
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
Screen::Input( input ); // default input handler
}
void ScreenNetSelectBase::HandleScreenMessage( const ScreenMessage SM )
+1 -3
View File
@@ -14,9 +14,7 @@ public:
ScreenNetSelectBase( const CString& sName );
virtual void Init();
void Input( const DeviceInput& DeviceI, const InputEventType type,
const GameInput& GameI, const MenuInput& MenuI,
const StyleInput& StyleI );
void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void TweenOffScreen();
+6 -7
View File
@@ -21,6 +21,7 @@
#include "InputMapper.h"
#include "RageLog.h"
#include "song.h"
#include "InputEventPlus.h"
AutoScreenMessage( SM_NoSongs )
AutoScreenMessage( SM_ChangeSong )
@@ -105,9 +106,7 @@ void ScreenNetSelectMusic::Init()
m_bAllowInput = false;
}
void ScreenNetSelectMusic::Input( const DeviceInput& DeviceI, const InputEventType type,
const GameInput& GameI, const MenuInput& MenuI,
const StyleInput& StyleI )
void ScreenNetSelectMusic::Input( const InputEventPlus &input )
{
if( !m_bAllowInput )
return;
@@ -115,13 +114,13 @@ void ScreenNetSelectMusic::Input( const DeviceInput& DeviceI, const InputEventTy
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
return;
if ( type == IET_RELEASE )
if ( input.type == IET_RELEASE )
{
m_MusicWheel.Move(0);
return;
}
if( (type != IET_FIRST_PRESS) && (type != IET_SLOW_REPEAT) && (type != IET_FAST_REPEAT ) )
if( (input.type != IET_FIRST_PRESS) && (input.type != IET_SLOW_REPEAT) && (input.type != IET_FAST_REPEAT ) )
return;
bool bHoldingCtrl =
@@ -129,7 +128,7 @@ void ScreenNetSelectMusic::Input( const DeviceInput& DeviceI, const InputEventTy
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL)) ||
(!NSMAN->useSMserver); //If we are disconnected, assume no chatting
char c = (char) toupper(DeviceI.ToChar() );
char c = (char) toupper(input.DeviceI.ToChar() );
if ( bHoldingCtrl && ( c >= 'A' ) && ( c <= 'Z' ) )
{
@@ -146,7 +145,7 @@ void ScreenNetSelectMusic::Input( const DeviceInput& DeviceI, const InputEventTy
//m_MusicWheel.Move( -1 );
}
ScreenNetSelectBase::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenNetSelectBase::Input( input );
}
void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
+1 -3
View File
@@ -24,9 +24,7 @@ public:
ScreenNetSelectMusic( const CString& sName );
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type,
const GameInput& GameI, const MenuInput& MenuI,
const StyleInput& StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
void UpdateSongsListPos();
+9 -8
View File
@@ -14,6 +14,7 @@
#include "GameCommand.h"
#include "OptionRowHandler.h"
#include "LuaBinding.h"
#include "InputEventPlus.h"
/*
@@ -580,32 +581,32 @@ void ScreenOptions::Update( float fDeltaTime )
ScreenWithMenuElements::Update( fDeltaTime );
}
void ScreenOptions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenOptions::Input( const InputEventPlus &input )
{
/* Allow input when transitioning in (m_In.IsTransitioning()), but ignore it
* when we're transitioning out. */
if( m_Cancel.IsTransitioning() || m_Out.IsTransitioning() || m_fLockInputSecs > 0 )
return;
if( !GAMESTATE->IsHumanPlayer(MenuI.player) )
if( !GAMESTATE->IsHumanPlayer(input.MenuI.player) )
return;
if( type == IET_RELEASE )
if( input.type == IET_RELEASE )
{
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_START:
case MENU_BUTTON_SELECT:
case MENU_BUTTON_RIGHT:
case MENU_BUTTON_LEFT:
INPUTMAPPER->ResetKeyRepeat( MenuInput(MenuI.player, MENU_BUTTON_START) );
INPUTMAPPER->ResetKeyRepeat( MenuInput(MenuI.player, MENU_BUTTON_RIGHT) );
INPUTMAPPER->ResetKeyRepeat( MenuInput(MenuI.player, MENU_BUTTON_LEFT) );
INPUTMAPPER->ResetKeyRepeat( MenuInput(input.MenuI.player, MENU_BUTTON_START) );
INPUTMAPPER->ResetKeyRepeat( MenuInput(input.MenuI.player, MENU_BUTTON_RIGHT) );
INPUTMAPPER->ResetKeyRepeat( MenuInput(input.MenuI.player, MENU_BUTTON_LEFT) );
}
}
// default input handler
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
Screen::Input( input );
}
void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -33,7 +33,7 @@ public:
void InitMenu( const vector<OptionRowDefinition> &vDefs, const vector<OptionRowHandler*> &vHands );
virtual ~ScreenOptions();
virtual void Update( float fDeltaTime );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
protected:
+2 -2
View File
@@ -136,9 +136,9 @@ void ScreenPackages::HandleScreenMessage( const ScreenMessage SM )
ScreenWithMenuElements::HandleScreenMessage( SM );
}
void ScreenPackages::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenPackages::Input( const InputEventPlus &input )
{
ScreenWithMenuElements::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenWithMenuElements::Input( input );
}
void ScreenPackages::Update( float fDeltaTime )
+1 -1
View File
@@ -15,7 +15,7 @@ public:
ScreenPackages( CString sName );
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( PlayerNumber pn );
+9 -8
View File
@@ -13,6 +13,7 @@
#include "Style.h"
#include "PlayerState.h"
#include "Foreach.h"
#include "InputEventPlus.h"
REGISTER_SCREEN_CLASS( ScreenPlayerOptions );
ScreenPlayerOptions::ScreenPlayerOptions( CString sClassName ) :
@@ -74,13 +75,13 @@ void ScreenPlayerOptions::BeginScreen()
}
}
void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenPlayerOptions::Input( const InputEventPlus &input )
{
if( m_bAskOptionsMessage &&
type == IET_FIRST_PRESS &&
input.type == IET_FIRST_PRESS &&
!m_In.IsTransitioning() &&
MenuI.IsValid() &&
MenuI.button == MENU_BUTTON_START )
input.MenuI.IsValid() &&
input.MenuI.button == MENU_BUTTON_START )
{
if( m_bAcceptedChoices && !m_bGoToOptions )
{
@@ -90,8 +91,8 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
}
}
PlayerNumber pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( GameI.controller );
if( GAMESTATE->IsHumanPlayer(pn) && CodeDetector::EnteredCode(GameI.controller,CODE_CANCEL_ALL_PLAYER_OPTIONS) )
PlayerNumber pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( input.GameI.controller );
if( GAMESTATE->IsHumanPlayer(pn) && CodeDetector::EnteredCode(input.GameI.controller,CODE_CANCEL_ALL_PLAYER_OPTIONS) )
{
if( m_CancelAll.IsLoaded() )
m_CancelAll.Play();
@@ -112,10 +113,10 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
}
}
ScreenOptionsMaster::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenOptionsMaster::Input( input );
// UGLY: Update m_Disqualified whenever Start is pressed
if( GAMESTATE->IsHumanPlayer(pn) && MenuI.IsValid() && MenuI.button == MENU_BUTTON_START )
if( GAMESTATE->IsHumanPlayer(pn) && input.MenuI.IsValid() && input.MenuI.button == MENU_BUTTON_START )
{
int row = m_iCurrentRow[pn];
UpdateDisqualified( row, pn );
+1 -1
View File
@@ -11,7 +11,7 @@ public:
virtual void Init();
virtual void BeginScreen();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
bool GetGoToOptions() const { return m_bGoToOptions; }
+7 -6
View File
@@ -8,6 +8,7 @@
#include "ThemeManager.h"
#include "ScreenDimensions.h"
#include "ActorUtil.h"
#include "InputEventPlus.h"
PromptAnswer ScreenPrompt::s_LastAnswer = ANSWER_YES;
bool ScreenPrompt::s_bCancelledLast = false;
@@ -90,19 +91,19 @@ void ScreenPrompt::BeginScreen()
m_In.StartTransitioning();
}
void ScreenPrompt::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenPrompt::Input( const InputEventPlus &input )
{
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
return;
if( DeviceI.device==DEVICE_KEYBOARD && type==IET_FIRST_PRESS )
if( input.DeviceI.device==DEVICE_KEYBOARD && input.type==IET_FIRST_PRESS )
{
PlayerNumber pn;
if ( GAMESTATE->GetCurrentStyle() == NULL )
pn = (PlayerNumber)GameI.controller;
pn = (PlayerNumber)input.GameI.controller;
else
pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( GameI.controller );
switch( DeviceI.button )
pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( input.GameI.controller );
switch( input.DeviceI.button )
{
case KEY_LEFT:
this->MenuLeft( pn );
@@ -113,7 +114,7 @@ void ScreenPrompt::Input( const DeviceInput& DeviceI, const InputEventType type,
}
}
ScreenWithMenuElements::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenWithMenuElements::Input( input );
}
bool ScreenPrompt::CanGoRight()
+1 -1
View File
@@ -29,7 +29,7 @@ public:
ScreenPrompt( const CString &sScreenName );
virtual void Init();
virtual void BeginScreen();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
static PromptAnswer s_LastAnswer;
static bool s_bCancelledLast;
+3 -3
View File
@@ -402,15 +402,15 @@ ScreenRanking::~ScreenRanking()
{
}
void ScreenRanking::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenRanking::Input( const InputEventPlus &input )
{
LOG->Trace( "ScreenRanking::Input()" );
// If manually scrolling, then pass the input to Scree::Input so it will call Menu*
if( (bool)MANUAL_SCROLLING )
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
Screen::Input( input );
else
ScreenAttract::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenAttract::Input( input );
}
void ScreenRanking::Scroll( int iDir )
+1 -1
View File
@@ -37,7 +37,7 @@ public:
virtual void Init();
~ScreenRanking();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void MenuLeft( PlayerNumber pn, const InputEventType type ) { Scroll(-1); }
virtual void MenuRight( PlayerNumber pn, const InputEventType type ) { Scroll(+1); }
virtual void MenuUp( PlayerNumber pn, const InputEventType type ) { Scroll(-1); }
+2 -2
View File
@@ -23,9 +23,9 @@ void ScreenSandbox::HandleScreenMessage( const ScreenMessage SM )
Screen::HandleScreenMessage( SM );
}
void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenSandbox::Input( const InputEventPlus &input )
{
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
Screen::Input( input );
}
void ScreenSandbox::Update( float fDeltaTime )
+1 -1
View File
@@ -8,7 +8,7 @@ class ScreenSandbox : public Screen
public:
ScreenSandbox( CString sName );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void Update(float f);
virtual void DrawPrimitives();
+9 -8
View File
@@ -9,6 +9,7 @@
#include "GameCommand.h"
#include "LightsManager.h"
#include "Command.h"
#include "InputEventPlus.h"
#define CHOICE_NAMES THEME->GetMetric (m_sName,"ChoiceNames")
#define CHOICE( s ) THEME->GetMetricM(m_sName,ssprintf("Choice%s",s.c_str()))
@@ -129,7 +130,7 @@ void ScreenSelect::DrawPrimitives()
Screen::DrawPrimitives();
}
void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenSelect::Input( const InputEventPlus &input )
{
// LOG->Trace( "ScreenSelect::Input()" );
@@ -143,10 +144,10 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type,
// user will still be on the title menu.
bool bAllowJoinInput = !ALLOW_DISABLED_PLAYER_INPUT;
if( MenuI.button == MENU_BUTTON_COIN ||
(bAllowJoinInput && Screen::JoinInput(MenuI)) )
if( input.MenuI.button == MENU_BUTTON_COIN ||
(bAllowJoinInput && Screen::JoinInput(input.MenuI)) )
{
if( type == IET_FIRST_PRESS )
if( input.type == IET_FIRST_PRESS )
this->UpdateSelectableChoices();
if( !ALLOW_DISABLED_PLAYER_INPUT )
@@ -154,7 +155,7 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type,
}
// block input of disabled players
if( !ALLOW_DISABLED_PLAYER_INPUT && !GAMESTATE->IsPlayerEnabled(MenuI.player) )
if( !ALLOW_DISABLED_PLAYER_INPUT && !GAMESTATE->IsPlayerEnabled(input.MenuI.player) )
return;
if( IsTransitioning() )
@@ -162,13 +163,13 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type,
for( unsigned i = 0; i < m_aCodes.size(); ++i )
{
if( !m_aCodes[i].EnteredCode( GameI.controller ) )
if( !m_aCodes[i].EnteredCode( input.GameI.controller ) )
continue;
LOG->Trace("entered code for index %d", i);
m_aCodeChoices[i].Apply( MenuI.player );
m_aCodeChoices[i].Apply( input.MenuI.player );
}
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
Screen::Input( input ); // default input handler
}
void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -20,7 +20,7 @@ public:
virtual void Update( float fDelta );
virtual void DrawPrimitives();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void HandleMessage( const CString &sMessage );
+2 -2
View File
@@ -167,14 +167,14 @@ ScreenSelectCharacter::~ScreenSelectCharacter()
}
void ScreenSelectCharacter::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenSelectCharacter::Input( const InputEventPlus &input )
{
LOG->Trace( "ScreenSelectCharacter::Input()" );
if( IsTransitioning() )
return;
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
Screen::Input( input ); // default input handler
}
void ScreenSelectCharacter::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -20,7 +20,7 @@ public:
virtual void Init();
virtual ~ScreenSelectCharacter();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
void MenuLeft( PlayerNumber pn );
+2 -2
View File
@@ -137,14 +137,14 @@ void ScreenSelectGroup::Init()
}
void ScreenSelectGroup::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenSelectGroup::Input( const InputEventPlus &input )
{
LOG->Trace( "ScreenSelectGroup::Input()" );
if( IsTransitioning() )
return;
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
Screen::Input( input ); // default input handler
}
void ScreenSelectGroup::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -17,7 +17,7 @@ public:
ScreenSelectGroup( CString sName );
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
void AfterChange();
+38 -35
View File
@@ -29,6 +29,7 @@
#include "CommonMetrics.h"
#include "BannerCache.h"
#include "song.h"
#include "InputEventPlus.h"
const int NUM_SCORE_DIGITS = 9;
@@ -676,15 +677,16 @@ void ScreenSelectMusic::Update( float fDeltaTime )
CheckBackgroundRequests();
}
void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenSelectMusic::Input( const InputEventPlus &input )
{
// LOG->Trace( "ScreenSelectMusic::Input()" );
// debugging?
// I just like being able to see untransliterated titles occasionally.
if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == KEY_F9 )
if( input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_F9 )
{
if( type != IET_FIRST_PRESS ) return;
if( input.type != IET_FIRST_PRESS )
return;
PREFSMAN->m_bShowNativeLanguage.Set( !PREFSMAN->m_bShowNativeLanguage );
m_MusicWheel.RebuildAllMusicWheelItems();
if( SHOW_COURSE_CONTENTS )
@@ -692,29 +694,30 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
return;
}
if( !GameI.IsValid() ) return; // don't care
if( !input.GameI.IsValid() )
return; // don't care
/* XXX: What's the difference between this and StyleI.player? */
/* StyleI won't be valid if it's a menu button that's pressed.
* There's got to be a better way of doing this. -Chris */
PlayerNumber pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( GameI.controller );
PlayerNumber pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( input.GameI.controller );
if( !GAMESTATE->IsHumanPlayer(pn) )
return;
// Check for "Press START again for options" button press
if( m_bMadeChoice &&
MenuI.IsValid() &&
MenuI.button == MENU_BUTTON_START &&
type != IET_RELEASE &&
type != IET_LEVEL_CHANGED &&
input.MenuI.IsValid() &&
input.MenuI.button == MENU_BUTTON_START &&
input.type != IET_RELEASE &&
input.type != IET_LEVEL_CHANGED &&
OPTIONS_MENU_AVAILABLE.GetValue() )
{
if(m_bGoToOptions) return; /* got it already */
if(!m_bAllowOptionsMenu) return; /* not allowed */
if( !m_bAllowOptionsMenuRepeat &&
(type == IET_SLOW_REPEAT || type == IET_FAST_REPEAT ))
(input.type == IET_SLOW_REPEAT || input.type == IET_FAST_REPEAT ))
return; /* not allowed yet */
m_bGoToOptions = true;
@@ -744,9 +747,9 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
SELECT_MENU_AVAILABLE && INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_SELECT) );
if( bSelectIsPressed )
{
if( type == IET_FIRST_PRESS )
if( input.type == IET_FIRST_PRESS )
{
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_LEFT:
ChangeDifficulty( pn, -1 );
@@ -764,7 +767,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
}
}
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_RIGHT:
case MENU_BUTTON_LEFT:
@@ -791,9 +794,9 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
if( bBothDown || bNeitherDown )
{
m_MusicWheel.Move( 0 );
if( type == IET_FIRST_PRESS )
if( input.type == IET_FIRST_PRESS )
{
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_LEFT:
m_MusicWheel.ChangeMusic( -1 );
@@ -806,12 +809,12 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
}
else if( bLeftIsDown )
{
if( type != IET_RELEASE )
if( input.type != IET_RELEASE )
m_MusicWheel.Move( -1 );
}
else if( bRightIsDown )
{
if( type != IET_RELEASE )
if( input.type != IET_RELEASE )
m_MusicWheel.Move( +1 );
}
else
@@ -823,7 +826,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
// Reset the repeat timer when the button is released.
// This fixes jumping when you release Left and Right after entering the sort
// code at the same if L & R aren't released at the exact same time.
if( type == IET_RELEASE )
if( input.type == IET_RELEASE )
{
FOREACH_HumanPlayer( p )
{
@@ -843,28 +846,28 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
// codes. Do default processing of Start AFTER detecting codes. This gives us a
// change to return if Start is part of a code because we don't want to process
// Start as "move to the next screen" if it was just part of a code.
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_UP: this->MenuUp( MenuI.player, type ); break;
case MENU_BUTTON_DOWN: this->MenuDown( MenuI.player, type ); break;
case MENU_BUTTON_LEFT: this->MenuLeft( MenuI.player, type ); break;
case MENU_BUTTON_RIGHT: this->MenuRight( MenuI.player, type ); break;
case MENU_BUTTON_UP: this->MenuUp( input.MenuI.player, input.type ); break;
case MENU_BUTTON_DOWN: this->MenuDown( input.MenuI.player, input.type ); break;
case MENU_BUTTON_LEFT: this->MenuLeft( input.MenuI.player, input.type ); break;
case MENU_BUTTON_RIGHT: this->MenuRight( input.MenuI.player, input.type ); break;
case MENU_BUTTON_BACK:
/* Don't make the user hold the back button if they're pressing escape and escape is the back button. */
if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == KEY_ESC )
this->MenuBack( MenuI.player );
if( input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_ESC )
this->MenuBack( input.MenuI.player );
else
Screen::MenuBack( MenuI.player, type );
Screen::MenuBack( input.MenuI.player, input.type );
break;
// Do the default handler for Start after detecting codes.
// case MENU_BUTTON_START: this->MenuStart( MenuI.player, type ); break;
case MENU_BUTTON_COIN: this->MenuCoin( MenuI.player, type ); break;
case MENU_BUTTON_COIN: this->MenuCoin( input.MenuI.player, input.type ); break;
}
if( type == IET_FIRST_PRESS )
if( input.type == IET_FIRST_PRESS )
{
if( CodeDetector::EnteredEasierDifficulty(GameI.controller) )
if( CodeDetector::EnteredEasierDifficulty(input.GameI.controller) )
{
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
m_soundLocked.Play();
@@ -872,7 +875,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
ChangeDifficulty( pn, -1 );
return;
}
if( CodeDetector::EnteredHarderDifficulty(GameI.controller) )
if( CodeDetector::EnteredHarderDifficulty(input.GameI.controller) )
{
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
m_soundLocked.Play();
@@ -880,7 +883,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
ChangeDifficulty( pn, +1 );
return;
}
if( CodeDetector::EnteredModeMenu(GameI.controller) )
if( CodeDetector::EnteredModeMenu(input.GameI.controller) )
{
if( MODE_MENU_AVAILABLE )
m_MusicWheel.ChangeSort( SORT_MODE_MENU );
@@ -888,7 +891,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
m_soundLocked.Play();
return;
}
if( CodeDetector::EnteredNextSort(GameI.controller) )
if( CodeDetector::EnteredNextSort(input.GameI.controller) )
{
if( ( GAMESTATE->IsExtraStage() && !PREFSMAN->m_bPickExtraStage ) || GAMESTATE->IsExtraStage2() )
m_soundLocked.Play();
@@ -896,7 +899,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
m_MusicWheel.NextSort();
return;
}
if( !GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2() && CodeDetector::DetectAndAdjustMusicOptions(GameI.controller) )
if( !GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2() && CodeDetector::DetectAndAdjustMusicOptions(input.GameI.controller) )
{
m_soundOptionsChange.Play();
MESSAGEMAN->Broadcast( ssprintf("PlayerOptionsChangedP%i", pn+1) );
@@ -905,9 +908,9 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
}
}
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_START: Screen::MenuStart( MenuI.player, type ); break;
case MENU_BUTTON_START: Screen::MenuStart( input.MenuI.player, input.type ); break;
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ public:
virtual void BeginScreen();
virtual void Update( float fDeltaTime );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( PlayerNumber pn );
+4 -3
View File
@@ -9,6 +9,7 @@
#include "DateTime.h"
#include "EnumHelper.h"
#include "arch/ArchHooks/ArchHooks.h"
#include "InputEventPlus.h"
static const CString SetTimeSelectionNames[] = {
"Year",
@@ -108,15 +109,15 @@ void ScreenSetTime::Update( float fDelta )
m_textValue[day].SetText( ssprintf("%02d",now.tm_mday) );
}
void ScreenSetTime::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenSetTime::Input( const InputEventPlus &input )
{
if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT )
if( input.type != IET_FIRST_PRESS && input.type != IET_SLOW_REPEAT )
return; // ignore
if( IsTransitioning() )
return;
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler
Screen::Input( input ); // default handler
}
void ScreenSetTime::ChangeValue( int iDirection )
+1 -1
View File
@@ -22,7 +22,7 @@ public:
virtual void Init();
virtual void Update( float fDelta );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void MenuUp( PlayerNumber pn );
virtual void MenuDown( PlayerNumber pn );
+13 -8
View File
@@ -5,6 +5,7 @@
#include "GameState.h"
#include "song.h"
#include "PrefsManager.h"
#include "InputEventPlus.h"
static bool IsGameplay()
{
@@ -154,15 +155,15 @@ void ScreenSyncOverlay::UpdateText()
m_textStatus.SetText( s );
}
bool ScreenSyncOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input )
{
if( !IsGameplay() )
return false;
if( DeviceI.device != DEVICE_KEYBOARD )
if( input.DeviceI.device != DEVICE_KEYBOARD )
return false;
switch( DeviceI.button )
switch( input.DeviceI.button )
{
case KEY_F4:
case KEY_F9:
@@ -179,7 +180,7 @@ bool ScreenSyncOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEve
return false;
}
switch( DeviceI.button )
switch( input.DeviceI.button )
{
case KEY_F4:
SCREENMAN->SystemMessage( "Sync changes reverted." );
@@ -189,7 +190,7 @@ bool ScreenSyncOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEve
case KEY_F10:
{
float fDelta;
switch( DeviceI.button )
switch( input.DeviceI.button )
{
case KEY_F9: fDelta = -0.02f; break;
case KEY_F10: fDelta = +0.02f; break;
@@ -197,8 +198,10 @@ bool ScreenSyncOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEve
}
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
{
fDelta /= 20;
switch( type )
}
switch( input.type )
{
case IET_RELEASE: fDelta *= 0; break;
case IET_SLOW_REPEAT: fDelta *= 0; break;
@@ -215,7 +218,7 @@ bool ScreenSyncOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEve
case KEY_F12:
{
float fDelta;
switch( DeviceI.button )
switch( input.DeviceI.button )
{
case KEY_F11: fDelta = +0.02f; break; // notes earlier
case KEY_F12: fDelta = -0.02f; break; // notes earlier
@@ -223,8 +226,10 @@ bool ScreenSyncOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEve
}
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
{
fDelta /= 20; /* 1ms */
switch( type )
}
switch( input.type )
{
case IET_RELEASE: fDelta *= 0; break;
case IET_SLOW_REPEAT: fDelta *= 0; break;
+1 -1
View File
@@ -14,7 +14,7 @@ public:
virtual ~ScreenSyncOverlay();
virtual void Init();
bool OverlayInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
bool OverlayInput( const InputEventPlus &input );
void Update( float fDeltaTime );
+9 -8
View File
@@ -7,6 +7,7 @@
#include "GameSoundManager.h"
#include "ThemeManager.h"
#include "CommonMetrics.h"
#include "InputEventPlus.h"
ScreenTest::~ScreenTest()
@@ -48,25 +49,25 @@ void ScreenTest::Update(float f) { current->Update(f); Screen::Update(f); }
void ScreenTest::HandleScreenMessage( const ScreenMessage SM ) { current->HandleScreenMessage(SM); }
void ScreenTest::Draw() { current->Draw(); }
void ScreenTest::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenTest::Input( const InputEventPlus &input )
{
if(DeviceI.device == DEVICE_KEYBOARD)
if( input.DeviceI.device == DEVICE_KEYBOARD )
{
if( DeviceI.button >= KEY_F9 && DeviceI.button <= KEY_F12 )
if( input.DeviceI.button >= KEY_F9 && input.DeviceI.button <= KEY_F12 )
{
if( type != IET_FIRST_PRESS ) return;
SetScreen( DeviceI.button - KEY_F9 );
if( input.type != IET_FIRST_PRESS ) return;
SetScreen( input.DeviceI.button - KEY_F9 );
return;
}
if( DeviceI.button == KEY_ESC )
if( input.DeviceI.button == KEY_ESC )
{
if( type != IET_FIRST_PRESS ) return;
if( input.type != IET_FIRST_PRESS ) return;
SCREENMAN->SetNewScreen( INITIAL_SCREEN );
return;
}
}
current->Input( DeviceI, type, GameI, MenuI, StyleI );
current->Input( input );
}
/*
+1 -1
View File
@@ -10,7 +10,7 @@ public:
~ScreenTest();
virtual void Init();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
Screen *current;
+4 -3
View File
@@ -5,6 +5,7 @@
#include "ScreenTextEntry.h"
#include "GameConstantsAndTypes.h"
#include "ScreenDimensions.h"
#include "InputEventPlus.h"
static const float LineWidth = 400;
@@ -82,11 +83,11 @@ void ScreenTestFonts::DrawPrimitives()
}
void ScreenTestFonts::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenTestFonts::Input( const InputEventPlus &input )
{
if( type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
return;
switch( DeviceI.button )
switch( input.DeviceI.button )
{
case '[': txt.SetVertAlign(align_bottom); break;
case '\\': txt.SetVertAlign(align_middle); break;
+1 -1
View File
@@ -11,7 +11,7 @@ public:
ScreenTestFonts( CString sName );
virtual void Init();
void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
void Input( const InputEventPlus &input );
void DrawPrimitives();
void HandleScreenMessage( const ScreenMessage SM );
+7 -6
View File
@@ -11,6 +11,7 @@
#include "GameManager.h"
#include "PrefsManager.h"
#include "RageInput.h"
#include "InputEventPlus.h"
REGISTER_SCREEN_CLASS( ScreenTestInput );
@@ -113,15 +114,15 @@ void ScreenTestInput::Update( float fDeltaTime )
}
void ScreenTestInput::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenTestInput::Input( const InputEventPlus &input )
{
CString sMessage = DeviceI.toString();
switch( type )
CString sMessage = input.DeviceI.toString();
switch( input.type )
{
case IET_FIRST_PRESS:
case IET_RELEASE:
{
switch( type )
switch( input.type )
{
case IET_FIRST_PRESS: sMessage += "Pressed"; break;
case IET_RELEASE: sMessage += "Released"; break;
@@ -130,10 +131,10 @@ void ScreenTestInput::Input( const DeviceInput& DeviceI, const InputEventType ty
}
}
if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT )
if( input.type != IET_FIRST_PRESS && input.type != IET_SLOW_REPEAT )
return; // ignore
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler
Screen::Input( input ); // default handler
}
void ScreenTestInput::MenuStart( PlayerNumber pn )
+1 -1
View File
@@ -15,7 +15,7 @@ public:
virtual ~ScreenTestInput();
virtual void Update( float fDelta );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void MenuStart( PlayerNumber pn );
virtual void MenuBack( PlayerNumber pn );
+4 -3
View File
@@ -9,6 +9,7 @@
#include "LightsManager.h"
#include "Game.h"
#include "ScreenDimensions.h"
#include "InputEventPlus.h"
REGISTER_SCREEN_CLASS( ScreenTestLights );
@@ -88,12 +89,12 @@ void ScreenTestLights::Update( float fDeltaTime )
}
void ScreenTestLights::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenTestLights::Input( const InputEventPlus &input )
{
if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT )
if( input.type != IET_FIRST_PRESS && input.type != IET_SLOW_REPEAT )
return; // ignore
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler
Screen::Input( input ); // default handler
}
void ScreenTestLights::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -13,7 +13,7 @@ public:
virtual ~ScreenTestLights();
virtual void Update( float fDelta );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuLeft( PlayerNumber pn );
+6 -5
View File
@@ -5,6 +5,7 @@
#include "RageSoundManager.h"
#include "ThemeManager.h"
#include "RageUtil.h"
#include "InputEventPlus.h"
REGISTER_SCREEN_CLASS( ScreenTestSound );
ScreenTestSound::ScreenTestSound( CString sClassName ) : Screen( sClassName )
@@ -126,21 +127,21 @@ void ScreenTestSound::Update(float f)
}
}
void ScreenTestSound::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenTestSound::Input( const InputEventPlus &input )
{
if( type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
return; // ignore
switch( DeviceI.device)
switch( input.DeviceI.device )
{
case DEVICE_KEYBOARD:
switch( DeviceI.button )
switch( input.DeviceI.button )
{
case '1':
case '2':
case '3':
case '4':
case '5': selected = DeviceI.button - '0'-1; break;
case '5': selected = input.DeviceI.button - '0'-1; break;
case 'p':
{
/* We want to be able to read the position of copied sounds; if we let
+1 -1
View File
@@ -14,7 +14,7 @@ public:
virtual void Init();
~ScreenTestSound();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
void Update(float f);
void UpdateText(int n);
+10 -7
View File
@@ -10,6 +10,7 @@
#include "ScreenDimensions.h"
#include "ScreenPrompt.h"
#include "ActorUtil.h"
#include "InputEventPlus.h"
static const char* g_szKeys[NUM_KEYBOARD_ROWS][KEYS_PER_ROW] =
@@ -219,19 +220,19 @@ void ScreenTextEntry::Update( float fDelta )
}
}
void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenTextEntry::Input( const InputEventPlus &input )
{
if( m_In.IsTransitioning() || m_Out.IsTransitioning() || m_Cancel.IsTransitioning() )
return;
//The user wants to input text traditionally
if ( g_bAllowOldKeyboardInput.Get() && ( type == IET_FIRST_PRESS ) )
if( g_bAllowOldKeyboardInput.Get() && ( input.type == IET_FIRST_PRESS ) )
{
if ( DeviceI.button == KEY_BACK )
if( input.DeviceI.button == KEY_BACK )
{
BackspaceInAnswer();
}
else if ( DeviceI.ToChar() >= ' ' )
else if( input.DeviceI.ToChar() >= ' ' )
{
bool bIsHoldingShift =
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT)) ||
@@ -239,7 +240,7 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
if ( bIsHoldingShift )
{
char c = (char)toupper( DeviceI.ToChar() );
char c = (char)toupper( input.DeviceI.ToChar() );
switch( c )
{
@@ -269,7 +270,9 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
AppendToAnswer( ssprintf( "%c", c ) );
}
else
AppendToAnswer( ssprintf( "%c", DeviceI.ToChar() ) );
{
AppendToAnswer( ssprintf( "%c", input.DeviceI.ToChar() ) );
}
//If the user wishes to select text in traditional way, start should finish text entry
m_iFocusY = KEYBOARD_ROW_SPECIAL;
@@ -280,7 +283,7 @@ void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
}
}
ScreenWithMenuElements::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenWithMenuElements::Input( input );
}
void ScreenTextEntry::MoveX( int iDir )
+1 -1
View File
@@ -46,7 +46,7 @@ public:
virtual void BeginScreen();
virtual void Update( float fDelta );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
static CString s_sLastAnswer;
static bool s_bCancelledLast;
+11 -10
View File
@@ -17,6 +17,7 @@
#include "InputMapper.h"
#include "ProfileManager.h"
#include "CharacterManager.h"
#include "InputEventPlus.h"
#define COIN_MODE_CHANGE_SCREEN THEME->GetMetric (m_sName,"CoinModeChangeScreen")
@@ -58,20 +59,20 @@ ScreenTitleMenu::~ScreenTitleMenu()
CHARMAN->UndemandGraphics();
}
void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenTitleMenu::Input( const InputEventPlus &input )
{
LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", DeviceI.device, DeviceI.button ); // debugging gameport joystick problem
LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", input.DeviceI.device, input.DeviceI.button ); // debugging gameport joystick problem
if( m_In.IsTransitioning() || m_Cancel.IsTransitioning() ) /* not m_Out */
return;
if( type == IET_FIRST_PRESS )
if( input.type == IET_FIRST_PRESS )
{
//
// detect codes
//
if( CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_THEME) ||
CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_THEME2) )
if( CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_THEME) ||
CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_THEME2) )
{
THEME->NextTheme();
ApplyGraphicOptions(); // update window title and icon
@@ -79,8 +80,8 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
SCREENMAN->SetNewScreen( m_sName );
TEXTUREMAN->DoDelayedDelete();
}
if( CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_ANNOUNCER) ||
CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_ANNOUNCER2) )
if( CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_ANNOUNCER) ||
CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_ANNOUNCER2) )
{
ANNOUNCER->NextAnnouncer();
CString sName = ANNOUNCER->GetCurAnnouncerName();
@@ -88,8 +89,8 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
SCREENMAN->SystemMessage( "Announcer: "+sName );
SCREENMAN->SetNewScreen( m_sName );
}
if( CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_GAME) ||
CodeDetector::EnteredCode(GameI.controller,CODE_NEXT_GAME2) )
if( CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_GAME) ||
CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_GAME2) )
{
vector<const Game*> vGames;
GAMEMAN->GetEnabledGames( vGames );
@@ -113,7 +114,7 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
}
}
ScreenSelectMaster::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenSelectMaster::Input( input );
}
void ScreenTitleMenu::HandleMessage( const CString& sMessage )
+1 -1
View File
@@ -12,7 +12,7 @@ public:
virtual void Init();
virtual ~ScreenTitleMenu();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void Input( const InputEventPlus &input );
virtual void HandleMessage( const CString& sMessage );
+68 -31
View File
@@ -28,6 +28,7 @@
#endif
#include "Screen.h"
#include "InputEventPlus.h"
#include "ScreenDimensions.h"
#include "CodeDetector.h"
#include "CommonMetrics.h"
@@ -1289,13 +1290,13 @@ void InsertCredit()
/* Returns true if the key has been handled and should be discarded, false if
* the key should be sent on to screens. */
bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput GameI, MenuInput MenuI, StyleInput StyleI )
bool HandleGlobalInputs( const InputEventPlus &input )
{
/* None of the globals keys act on types other than FIRST_PRESS */
if( type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
return false;
switch( MenuI.button )
switch( input.MenuI.button )
{
case MENU_BUTTON_OPERATOR:
@@ -1318,12 +1319,12 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
LOG->Trace( "Ignored coin insertion (editing)" );
break;
}
InsertCoin( 1, &DeviceI.ts );
InsertCoin( 1, &input.DeviceI.ts );
return false; // Attract need to know because they go to TitleMenu on > 1 credit
}
#ifndef __MACOSX__
if(DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_F4))
if( input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_F4) )
{
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
@@ -1334,7 +1335,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
}
}
#else
if(DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_Cq))
if( input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_Cq) )
{
if(INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RMETA)) ||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LMETA)))
@@ -1346,19 +1347,23 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
}
#endif
bool bDoScreenshot =
#if defined(__MACOSX__)
/* Pressing F13 on an Apple keyboard sends KEY_PRINT.
* However, notebooks don't have F13. Use cmd-F12 then*/
input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_F12) &&
( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LMETA)) || INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RMETA)) );
#else
/* The default Windows message handler will capture the desktop window upon
* pressing PrntScrn, or will capture the foregroud with focus upon pressing
* Alt+PrntScrn. Windows will do this whether or not we save a screenshot
* ourself by dumping the frame buffer. */
/* Pressing F13 on an Apple keyboard sends KEY_PRINT.
* However, notebooks don't have F13. Use cmd-F12 then*/
// "if pressing PrintScreen and not pressing Alt"
if( (DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_PRTSC) &&
!INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) &&
!INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LALT))) ||
(DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_F12) &&
(INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RMETA)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LMETA)))))
input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_PRTSC) &&
!INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) &&
!INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RALT));
#endif
if( bDoScreenshot )
{
// If holding LShift save uncompressed, else save compressed
bool bSaveCompressed = !INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) );
@@ -1366,7 +1371,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
return true; // handled
}
if(DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_ENTER))
if( input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_ENTER) )
{
if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
@@ -1402,20 +1407,52 @@ void HandleInputEvents(float fDeltaTime)
for( unsigned i=0; i<ieArray.size(); i++ )
{
DeviceInput DeviceI = (DeviceInput)ieArray[i];
InputEventType type = ieArray[i].type;
GameInput GameI;
MenuInput MenuI;
StyleInput StyleI;
InputEventPlus input;
input.DeviceI = (DeviceInput)ieArray[i];
input.type = ieArray[i].type;
INPUTMAPPER->DeviceToGame( DeviceI, GameI );
INPUTMAPPER->DeviceToGame( input.DeviceI, input.GameI );
if( GameI.IsValid() && type == IET_FIRST_PRESS )
INPUTQUEUE->RememberInput( GameI );
if( GameI.IsValid() )
if( input.GameI.IsValid() && input.type == IET_FIRST_PRESS )
INPUTQUEUE->RememberInput( input.GameI );
if( input.GameI.IsValid() )
{
INPUTMAPPER->GameToMenu( GameI, MenuI );
INPUTMAPPER->GameToStyle( GameI, StyleI );
INPUTMAPPER->GameToMenu( input.GameI, input.MenuI );
INPUTMAPPER->GameToStyle( input.GameI, input.StyleI );
}
if( !GAMESTATE->m_bMultiplayer )
{
input.mp = MultiPlayer_INVALID;
}
else
{
// Translate input and sent to the appropriate player. Assume that all
// joystick devices are mapped the same as the master player.
if( input.DeviceI.IsJoystick() )
{
DeviceInput _DeviceI = input.DeviceI;
_DeviceI.device = DEVICE_JOY1;
GameInput _GameI;
INPUTMAPPER->DeviceToGame( _DeviceI, _GameI );
if( input.GameI.IsValid() )
{
StyleInput _StyleI;
INPUTMAPPER->GameToStyle( _GameI, _StyleI );
input.mp = InputMapper::InputDeviceToMultiPlayer( input.DeviceI.device );
}
/*
// hack for testing with only one joytick
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD,KEY_LSHIFT) ) )
p = (MultiPlayer)(p + 1);
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD,KEY_LCTRL) ) )
p = (MultiPlayer)(p + 2);
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD,KEY_LALT) ) )
p = (MultiPlayer)(p + 4);
*/
}
}
// HACK: Numlock is read is being pressed if the NumLock light is on.
@@ -1425,18 +1462,18 @@ void HandleInputEvents(float fDeltaTime)
// if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == KEY_NUMLOCK && type != IET_FIRST_PRESS )
// continue; // skip
if( HandleGlobalInputs(DeviceI, type, GameI, MenuI, StyleI ) )
if( HandleGlobalInputs(input) )
continue; // skip
// check back in event mode
if( GAMESTATE->IsEventMode() &&
CodeDetector::EnteredCode(GameI.controller,CODE_BACK_IN_EVENT_MODE) )
CodeDetector::EnteredCode(input.GameI.controller,CODE_BACK_IN_EVENT_MODE) )
{
MenuI.player = PLAYER_1;
MenuI.button = MENU_BUTTON_BACK;
input.MenuI.player = PLAYER_1;
input.MenuI.button = MENU_BUTTON_BACK;
}
SCREENMAN->Input( DeviceI, type, GameI, MenuI, StyleI );
SCREENMAN->Input( input );
}
}