phase out StyleI.player

This commit is contained in:
Glenn Maynard
2006-09-13 00:16:23 +00:00
parent 5be4331e71
commit 6a80311172
8 changed files with 17 additions and 31 deletions
+1 -2
View File
@@ -96,8 +96,7 @@ RString Game::ColToButtonName( int col ) const
if( pzColumnName != NULL )
return pzColumnName;
StyleInput SI( PLAYER_1, col );
GameInput GI = pStyle->StyleInputToGameInput( SI, PLAYER_1 );
GameInput GI = pStyle->StyleInputToGameInput( col, PLAYER_1 );
return m_szButtonNames[GI.button];
}
+1 -2
View File
@@ -65,8 +65,7 @@ static void GetUsedGameInputs( vector<GameInput> &vGameInputsOut )
{
for( int i=0; i<(*style)->m_iColsPerPlayer; i++ )
{
StyleInput si( pn, i );
GameInput gi = (*style)->StyleInputToGameInput( si, pn );
GameInput gi = (*style)->StyleInputToGameInput( i, pn );
if( gi.IsValid() )
{
vGIs.insert( gi );
+5 -9
View File
@@ -543,8 +543,7 @@ void Player::Update( float fDeltaTime )
// TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
const StyleInput StyleI( pn, col );
bool bIsHoldingButton = INPUTMAPPER->IsBeingPressed( StyleI, pn );
bool bIsHoldingButton = INPUTMAPPER->IsBeingPressed( col, pn );
// TODO: Make this work for non-human-controlled players
if( bIsHoldingButton && !GAMESTATE->m_bDemonstrationOrJukebox && m_pPlayerState->m_PlayerController==PC_HUMAN )
if( m_pNoteField )
@@ -621,8 +620,7 @@ void Player::Update( float fDeltaTime )
}
else
{
const StyleInput StyleI( pn, iTrack );
bIsHoldingButton = INPUTMAPPER->IsBeingPressed( StyleI, pn, m_pPlayerState->m_mp );
bIsHoldingButton = INPUTMAPPER->IsBeingPressed( iTrack, pn, m_pPlayerState->m_mp );
}
int iEndRow = iRow + tn.iDuration;
@@ -1008,8 +1006,7 @@ void Player::Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRele
int iNumTracksHeld = 0;
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
{
const StyleInput StyleI( pn, t );
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( t, pn );
const float fSecsHeld = INPUTMAPPER->GetSecsHeld( GameI );
if( fSecsHeld > 0 && fSecsHeld < JUMP_WINDOW_SECONDS )
iNumTracksHeld++;
@@ -1489,16 +1486,15 @@ void Player::CrossedMineRow( int iNoteRow, const RageTimer &now )
// TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
const StyleInput StyleI( pn, t );
if( PREFSMAN->m_fPadStickSeconds > 0 )
{
float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI, pn, m_pPlayerState->m_mp );
float fSecsHeld = INPUTMAPPER->GetSecsHeld( t, pn, m_pPlayerState->m_mp );
if( fSecsHeld >= PREFSMAN->m_fPadStickSeconds )
Step( t, -1, now+(-PREFSMAN->m_fPadStickSeconds), true, false );
}
else
{
bool bIsDown = INPUTMAPPER->IsBeingPressed( StyleI, pn, m_pPlayerState->m_mp );
bool bIsDown = INPUTMAPPER->IsBeingPressed( t, pn, m_pPlayerState->m_mp );
if( bIsDown )
Step( t, iNoteRow, now, true, false );
}
+2 -4
View File
@@ -886,8 +886,7 @@ void ScreenEdit::Update( float fDeltaTime )
{
for( int t=0; t<GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer; t++ ) // for each track
{
StyleInput StyleI( PLAYER_1, t );
float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI, PLAYER_1 );
float fSecsHeld = INPUTMAPPER->GetSecsHeld( t, PLAYER_1 );
fSecsHeld = min( fSecsHeld, m_RemoveNoteButtonLastChanged.Ago() );
if( fSecsHeld == 0 )
continue;
@@ -934,8 +933,7 @@ void ScreenEdit::Update( float fDeltaTime )
bool bButtonIsBeingPressed = false;
for( int t=0; t<GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer; t++ ) // for each track
{
StyleInput StyleI( PLAYER_1, t );
if( INPUTMAPPER->IsBeingPressed(StyleI, PLAYER_1) )
if( INPUTMAPPER->IsBeingPressed(t, PLAYER_1) )
bButtonIsBeingPressed = true;
}
+1 -2
View File
@@ -1895,8 +1895,7 @@ void ScreenGameplay::UpdateLights()
if( bBlink )
{
StyleInput si( pi->m_pn, t );
GameInput gi = pStyle->StyleInputToGameInput( si, pi->m_pn );
GameInput gi = pStyle->StyleInputToGameInput( t, pi->m_pn );
bBlinkGameButton[gi.controller][gi.button] = true;
}
}
+1 -2
View File
@@ -194,8 +194,7 @@ void ScreenNameEntry::Init()
continue; /* We have enough columns. */
/* Find out if this column is associated with the START menu button. */
StyleInput si(p, t);
GameInput gi=GAMESTATE->GetCurrentStyle()->StyleInputToGameInput(si, p);
GameInput gi=GAMESTATE->GetCurrentStyle()->StyleInputToGameInput(t, p);
MenuInput m=GAMESTATE->GetCurrentGame()->GameInputToMenuInput(gi);
if(m.button == MENU_BUTTON_START)
continue;
+1 -1
View File
@@ -68,7 +68,7 @@ StyleInput Style::GameInputToStyleInput( const GameInput &GameI ) const
if( m_iInputColumn[GameI.controller][i] == END_MAPPING )
return SI; // Return invalid.
SI = StyleInput( ControllerToPlayerNumber(GameI.controller), m_iInputColumn[GameI.controller][GameI.button] );
SI = StyleInput( m_iInputColumn[GameI.controller][GameI.button] );
return SI;
}
+5 -9
View File
@@ -1,22 +1,18 @@
/* StyleInput - An input event specific to a style that is defined by a player number and the player's note column. */
/* StyleInput - An input event specific to a style that is defined by the note column. */
#ifndef STYLE_INPUT_H
#define STYLE_INPUT_H
#include "PlayerNumber.h"
struct StyleInput
{
PlayerNumber player;
int col;
StyleInput() { MakeInvalid(); };
StyleInput( PlayerNumber pn, int c ) { player = pn; col = c; };
bool operator==( const StyleInput &other ) { return player == other.player && col == other.col; };
StyleInput( int c ) { col = c; }
bool operator==( const StyleInput &other ) { return col == other.col; }
inline bool IsValid() const { return player != PLAYER_INVALID; };
inline void MakeInvalid() { player = PLAYER_INVALID; col = -1; };
bool IsValid() const { return col != -1; }
void MakeInvalid() { col = -1; }
};
#endif