Add Var "Player" and Var "Controller" for NoteSkin. [hanubeki]

Sourced from http://code.google.com/r/hanubeki-modified-sm-ssc/source/detail?r=824cff29912d1c29a667046ba463d195e81c524a
This commit is contained in:
AJ Kelly
2012-05-03 14:27:51 -05:00
parent 201d6e8029
commit 967237d881
7 changed files with 34 additions and 1 deletions
+5
View File
@@ -9,6 +9,11 @@ ________________________________________________________________________________
StepMania 5.0 alpha 2 | 201205?? StepMania 5.0 alpha 2 | 201205??
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
2012/05/03
----------
* Add Var "Player" and Var "Controller" for NoteSkin. [hanubeki]
Sourced from http://code.google.com/r/hanubeki-modified-sm-ssc/source/detail?r=824cff29912d1c29a667046ba463d195e81c524a
2012/05/02 2012/05/02
---------- ----------
* Make ReceptorArrowRow and GhostArrowRow respect the column draw order. [hanubeki] * Make ReceptorArrowRow and GhostArrowRow respect the column draw order. [hanubeki]
+2
View File
@@ -87,6 +87,8 @@ Macgravel
hanubeki (@803832, formerly sy567) hanubeki (@803832, formerly sy567)
* Small beginner helper fix * Small beginner helper fix
(http://www.stepmania.com/forums/showpost.php?p=158721&postcount=12) (http://www.stepmania.com/forums/showpost.php?p=158721&postcount=12)
* Lots of code changes from hanubeki-modified-sm-ssc:
http://code.google.com/r/hanubeki-modified-sm-ssc/
galopin galopin
* Pump it Up Exceed PlayStation 2 USB dance mat support patch * Pump it Up Exceed PlayStation 2 USB dance mat support patch
+5
View File
@@ -16,12 +16,17 @@ void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset
m_fYReverseOffsetPixels = fYReverseOffset; m_fYReverseOffsetPixels = fYReverseOffset;
const Style* pStyle = GAMESTATE->GetCurrentStyle(); const Style* pStyle = GAMESTATE->GetCurrentStyle();
const PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
NOTESKIN->SetPlayerNumber( pn );
// init arrows // init arrows
for( int c=0; c<pStyle->m_iColsPerPlayer; c++ ) for( int c=0; c<pStyle->m_iColsPerPlayer; c++ )
{ {
const RString &sButton = GAMESTATE->GetCurrentStyle()->ColToButtonName( c ); const RString &sButton = GAMESTATE->GetCurrentStyle()->ColToButtonName( c );
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( c, pn );
NOTESKIN->SetGameController( GameI.controller );
m_bHoldShowing.push_back( TapNote::SubType_Invalid ); m_bHoldShowing.push_back( TapNote::SubType_Invalid );
m_bLastHoldShowing.push_back( TapNote::SubType_Invalid ); m_bLastHoldShowing.push_back( TapNote::SubType_Invalid );
+5
View File
@@ -246,6 +246,11 @@ void NoteDisplay::Load( int iColNum, const PlayerState* pPlayerState, float fYRe
m_pPlayerState = pPlayerState; m_pPlayerState = pPlayerState;
m_fYReverseOffsetPixels = fYReverseOffsetPixels; m_fYReverseOffsetPixels = fYReverseOffsetPixels;
const PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( iColNum, pn );
NOTESKIN->SetPlayerNumber( pn );
NOTESKIN->SetGameController( GameI.controller );
const RString &sButton = GAMESTATE->GetCurrentStyle()->ColToButtonName( iColNum ); const RString &sButton = GAMESTATE->GetCurrentStyle()->ColToButtonName( iColNum );
cache->Load( sButton ); cache->Load( sButton );
+5
View File
@@ -2,6 +2,7 @@
#include "NoteSkinManager.h" #include "NoteSkinManager.h"
#include "RageFileManager.h" #include "RageFileManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "GameInput.h"
#include "GameState.h" #include "GameState.h"
#include "Game.h" #include "Game.h"
#include "Style.h" #include "Style.h"
@@ -47,6 +48,8 @@ namespace
NoteSkinManager::NoteSkinManager() NoteSkinManager::NoteSkinManager()
{ {
m_pCurGame = NULL; m_pCurGame = NULL;
m_PlayerNumber = PlayerNumber_Invalid;
m_GameController = GameController_Invalid;
// Register with Lua. // Register with Lua.
{ {
@@ -378,6 +381,8 @@ bool NoteSkinManager::PushActorTemplate( Lua *L, const RString &sButton, const R
ASSERT( iter != g_mapNameToData.end() ); ASSERT( iter != g_mapNameToData.end() );
const NoteSkinData &data = iter->second; const NoteSkinData &data = iter->second;
LuaThreadVariable varPlayer( "Player", LuaReference::Create(m_PlayerNumber) );
LuaThreadVariable varController( "Controller", LuaReference::Create(m_GameController) );
LuaThreadVariable varButton( "Button", sButton ); LuaThreadVariable varButton( "Button", sButton );
LuaThreadVariable varElement( "Element", sElement ); LuaThreadVariable varElement( "Element", sElement );
LuaThreadVariable varSpriteOnly( "SpriteOnly", LuaReference::Create(bSpriteOnly) ); LuaThreadVariable varSpriteOnly( "SpriteOnly", LuaReference::Create(bSpriteOnly) );
+7 -1
View File
@@ -4,6 +4,7 @@
#include "Actor.h" #include "Actor.h"
#include "RageTypes.h" #include "RageTypes.h"
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "GameInput.h"
#include "IniFile.h" #include "IniFile.h"
class Game; class Game;
@@ -24,7 +25,8 @@ public:
void SetCurrentNoteSkin( const RString &sNoteSkin ) { m_sCurrentNoteSkin = sNoteSkin; } void SetCurrentNoteSkin( const RString &sNoteSkin ) { m_sCurrentNoteSkin = sNoteSkin; }
const RString &GetCurrentNoteSkin() { return m_sCurrentNoteSkin; } const RString &GetCurrentNoteSkin() { return m_sCurrentNoteSkin; }
void SetPlayerNumber( PlayerNumber pn ) { m_PlayerNumber = pn; }
void SetGameController( GameController gc ) { m_GameController = gc; }
RString GetPath( const RString &sButtonName, const RString &sElement ); RString GetPath( const RString &sButtonName, const RString &sElement );
bool PushActorTemplate( Lua *L, const RString &sButton, const RString &sElement, bool bSpriteOnly ); bool PushActorTemplate( Lua *L, const RString &sButton, const RString &sElement, bool bSpriteOnly );
Actor *LoadActor( const RString &sButton, const RString &sElement, Actor *pParent = NULL, bool bSpriteOnly = false ); Actor *LoadActor( const RString &sButton, const RString &sElement, Actor *pParent = NULL, bool bSpriteOnly = false );
@@ -46,6 +48,10 @@ protected:
void LoadNoteSkinDataRecursive( const RString &sNoteSkinName, NoteSkinData& data_out ); void LoadNoteSkinDataRecursive( const RString &sNoteSkinName, NoteSkinData& data_out );
RString m_sCurrentNoteSkin; RString m_sCurrentNoteSkin;
const Game* m_pCurGame; const Game* m_pCurGame;
// xxx: is this the best way to implement this? -freem
PlayerNumber m_PlayerNumber;
GameController m_GameController;
}; };
extern NoteSkinManager* NOTESKIN; // global and accessable from anywhere in our program extern NoteSkinManager* NOTESKIN; // global and accessable from anywhere in our program
+5
View File
@@ -19,6 +19,11 @@ void ReceptorArrow::Load( const PlayerState* pPlayerState, int iColNo )
m_pPlayerState = pPlayerState; m_pPlayerState = pPlayerState;
m_iColNo = iColNo; m_iColNo = iColNo;
const PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( iColNo, pn );
NOTESKIN->SetPlayerNumber( pn );
NOTESKIN->SetGameController( GameI.controller );
RString sButton = GAMESTATE->GetCurrentStyle()->ColToButtonName( iColNo ); RString sButton = GAMESTATE->GetCurrentStyle()->ColToButtonName( iColNo );
m_pReceptor.Load( NOTESKIN->LoadActor(sButton, "Receptor") ); m_pReceptor.Load( NOTESKIN->LoadActor(sButton, "Receptor") );
this->AddChild( m_pReceptor ); this->AddChild( m_pReceptor );