move ColToButtonName from Game to Style, to reduce GAMESTATE use

in Game
This commit is contained in:
Glenn Maynard
2006-09-30 00:46:21 +00:00
parent 77d506de27
commit 5541709a1f
7 changed files with 18 additions and 18 deletions
-12
View File
@@ -83,18 +83,6 @@ void Game::MenuButtonToGameInputs( MenuButton MenuI, PlayerNumber pn, GameInput
}
}
RString Game::ColToButtonName( int iCol ) const
{
const Style *pStyle = GAMESTATE->GetCurrentStyle();
const char *pzColumnName = pStyle->m_ColumnInfo[PLAYER_1][iCol].pzName;
if( pzColumnName != NULL )
return pzColumnName;
GameInput GI = pStyle->StyleInputToGameInput( iCol, PLAYER_1 );
return m_szButtonNames[GI.button];
}
TapNoteScore Game::MapTapNoteScore( TapNoteScore tns ) const
{
switch( tns )
-1
View File
@@ -51,7 +51,6 @@ public:
GameButton ButtonNameToIndex( const RString &sButtonName ) const;
MenuButton GameInputToMenuButton( GameInput GameI ) const;
void MenuButtonToGameInputs( MenuButton MenuI, PlayerNumber pn, GameInput GameIout[4] ) const; // looks up current style in GAMESTATE. Yuck.
RString ColToButtonName( int col ) const; // looks up current style. Yuck.
TapNoteScore MapTapNoteScore( TapNoteScore tns ) const;
TapNoteScore m_mapW1To;
+1 -1
View File
@@ -25,7 +25,7 @@ void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset
// init arrows
for( int c=0; c<pStyle->m_iColsPerPlayer; c++ )
{
const RString &sButton = GAMESTATE->GetCurrentGame()->ColToButtonName( c );
const RString &sButton = GAMESTATE->GetCurrentStyle()->ColToButtonName( c );
m_bHoldIsActive.push_back( false );
m_bHoldWasActive.push_back( false );
+2 -2
View File
@@ -6,7 +6,7 @@
#include "RageLog.h"
#include "RageDisplay.h"
#include "ActorUtil.h"
#include "Game.h"
#include "Style.h"
#include "PlayerState.h"
#include "Sprite.h"
#include "NoteTypes.h"
@@ -259,7 +259,7 @@ void NoteDisplay::Load( int iColNum, const PlayerState* pPlayerState, float fYRe
m_pPlayerState = pPlayerState;
m_fYReverseOffsetPixels = fYReverseOffsetPixels;
const RString &sButton = GAMESTATE->GetCurrentGame()->ColToButtonName( iColNum );
const RString &sButton = GAMESTATE->GetCurrentStyle()->ColToButtonName( iColNum );
cache->Load( sButton );
+2 -2
View File
@@ -2025,8 +2025,8 @@ void ScreenGameplay::SendCrossedMessages()
// Send col-specific crossed
if( i == 0 )
{
const Game* pGame = GAMESTATE->GetCurrentGame();
RString sButton = pGame->ColToButtonName( t );
const Style *pStyle = GAMESTATE->GetCurrentStyle();
RString sButton = pStyle->ColToButtonName( t );
RString sMessageName = "NoteCrossed" + sButton;
MESSAGEMAN->Broadcast( sMessageName );
}
+12
View File
@@ -95,6 +95,18 @@ void Style::GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXOut
}
}
RString Style::ColToButtonName( int iCol ) const
{
const char *pzColumnName = m_ColumnInfo[PLAYER_1][iCol].pzName;
if( pzColumnName != NULL )
return pzColumnName;
GameInput GI = StyleInputToGameInput( iCol, PLAYER_1 );
const Game *pGame = GAMESTATE->GetCurrentGame();
return pGame->m_szButtonNames[GI.button];
}
// Lua bindings
#include "LuaBinding.h"
+1
View File
@@ -55,6 +55,7 @@ public:
GameInput StyleInputToGameInput( int iCol, PlayerNumber pn ) const;
int GameInputToColumn( const GameInput &GameI ) const;
RString ColToButtonName( int iCol ) const;
PlayerNumber ControllerToPlayerNumber( GameController controller ) const;