Modify NoteDisplay to work with Var "Player" and Var "Controller" in non-receptor arrow.
This commit is contained in:
+33
-20
@@ -114,16 +114,28 @@ void NoteMetricCache_t::Load( const RString &sButton )
|
|||||||
|
|
||||||
struct NoteSkinAndPath
|
struct NoteSkinAndPath
|
||||||
{
|
{
|
||||||
NoteSkinAndPath( const RString sNoteSkin_, const RString sPath_ ) : sNoteSkin(sNoteSkin_), sPath(sPath_) { }
|
NoteSkinAndPath( const RString sNoteSkin_, const RString sPath_, const PlayerNumber pn_, const GameController gc_ ) : sNoteSkin(sNoteSkin_), sPath(sPath_), pn(pn_), gc(gc_) { }
|
||||||
RString sNoteSkin;
|
RString sNoteSkin;
|
||||||
RString sPath;
|
RString sPath;
|
||||||
|
PlayerNumber pn;
|
||||||
|
GameController gc;
|
||||||
bool operator<( const NoteSkinAndPath &other ) const
|
bool operator<( const NoteSkinAndPath &other ) const
|
||||||
{
|
{
|
||||||
int cmp = strcmp(sNoteSkin, other.sNoteSkin);
|
int cmp = strcmp(sNoteSkin, other.sNoteSkin);
|
||||||
if( cmp < 0 )
|
if( cmp < 0 )
|
||||||
return true;
|
return true;
|
||||||
else if( cmp == 0 )
|
else if( cmp == 0 )
|
||||||
return sPath < other.sPath;
|
if( sPath < other.sPath )
|
||||||
|
return true;
|
||||||
|
else if( sPath == other.sPath )
|
||||||
|
if ( pn < other.pn )
|
||||||
|
return true;
|
||||||
|
else if ( pn == other.pn )
|
||||||
|
return gc < other.gc;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -149,16 +161,19 @@ struct NoteResource
|
|||||||
|
|
||||||
static map<NoteSkinAndPath, NoteResource *> g_NoteResource;
|
static map<NoteSkinAndPath, NoteResource *> g_NoteResource;
|
||||||
|
|
||||||
static NoteResource *MakeNoteResource( const RString &sButton, const RString &sElement, bool bSpriteOnly )
|
static NoteResource *MakeNoteResource( const RString &sButton, const RString &sElement, PlayerNumber pn, GameController gc, bool bSpriteOnly )
|
||||||
{
|
{
|
||||||
RString sElementAndType = ssprintf( "%s, %s", sButton.c_str(), sElement.c_str() );
|
RString sElementAndType = ssprintf( "%s, %s", sButton.c_str(), sElement.c_str() );
|
||||||
NoteSkinAndPath nsap( NOTESKIN->GetCurrentNoteSkin(), sElementAndType );
|
NoteSkinAndPath nsap( NOTESKIN->GetCurrentNoteSkin(), sElementAndType, pn, gc );
|
||||||
|
|
||||||
map<NoteSkinAndPath, NoteResource *>::iterator it = g_NoteResource.find( nsap );
|
map<NoteSkinAndPath, NoteResource *>::iterator it = g_NoteResource.find( nsap );
|
||||||
if( it == g_NoteResource.end() )
|
if( it == g_NoteResource.end() )
|
||||||
{
|
{
|
||||||
NoteResource *pRes = new NoteResource( nsap );
|
NoteResource *pRes = new NoteResource( nsap );
|
||||||
|
|
||||||
|
NOTESKIN->SetPlayerNumber( pn );
|
||||||
|
NOTESKIN->SetGameController( gc );
|
||||||
|
|
||||||
pRes->m_pActor = NOTESKIN->LoadActor( sButton, sElement, NULL, bSpriteOnly );
|
pRes->m_pActor = NOTESKIN->LoadActor( sButton, sElement, NULL, bSpriteOnly );
|
||||||
ASSERT( pRes->m_pActor != NULL );
|
ASSERT( pRes->m_pActor != NULL );
|
||||||
|
|
||||||
@@ -197,9 +212,9 @@ NoteColorActor::~NoteColorActor()
|
|||||||
DeleteNoteResource( m_p );
|
DeleteNoteResource( m_p );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteColorActor::Load( const RString &sButton, const RString &sElement )
|
void NoteColorActor::Load( const RString &sButton, const RString &sElement, PlayerNumber pn, GameController gc )
|
||||||
{
|
{
|
||||||
m_p = MakeNoteResource( sButton, sElement, false );
|
m_p = MakeNoteResource( sButton, sElement, pn, gc, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -221,9 +236,9 @@ NoteColorSprite::~NoteColorSprite()
|
|||||||
DeleteNoteResource( m_p );
|
DeleteNoteResource( m_p );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteColorSprite::Load( const RString &sButton, const RString &sElement )
|
void NoteColorSprite::Load( const RString &sButton, const RString &sElement, PlayerNumber pn, GameController gc )
|
||||||
{
|
{
|
||||||
m_p = MakeNoteResource( sButton, sElement, true );
|
m_p = MakeNoteResource( sButton, sElement, pn, gc, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite *NoteColorSprite::Get()
|
Sprite *NoteColorSprite::Get()
|
||||||
@@ -263,30 +278,28 @@ void NoteDisplay::Load( int iColNum, const PlayerState* pPlayerState, float fYRe
|
|||||||
|
|
||||||
const PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
const PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( iColNum, pn );
|
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 );
|
||||||
|
|
||||||
// "normal" note types
|
// "normal" note types
|
||||||
m_TapNote.Load( sButton, "Tap Note" );
|
m_TapNote.Load( sButton, "Tap Note", pn, GameI.controller );
|
||||||
//m_TapAdd.Load( sButton, "Tap Addition" );
|
//m_TapAdd.Load( sButton, "Tap Addition", pn, GameI.controller );
|
||||||
m_TapMine.Load( sButton, "Tap Mine" );
|
m_TapMine.Load( sButton, "Tap Mine", pn, GameI.controller );
|
||||||
m_TapLift.Load( sButton, "Tap Lift" );
|
m_TapLift.Load( sButton, "Tap Lift", pn, GameI.controller );
|
||||||
m_TapFake.Load( sButton, "Tap Fake" );
|
m_TapFake.Load( sButton, "Tap Fake", pn, GameI.controller );
|
||||||
|
|
||||||
// hold types
|
// hold types
|
||||||
FOREACH_HoldType( ht )
|
FOREACH_HoldType( ht )
|
||||||
{
|
{
|
||||||
FOREACH_ActiveType( at )
|
FOREACH_ActiveType( at )
|
||||||
{
|
{
|
||||||
m_HoldHead[ht][at].Load( sButton, HoldTypeToString(ht)+" Head "+ActiveTypeToString(at) );
|
m_HoldHead[ht][at].Load( sButton, HoldTypeToString(ht)+" Head "+ActiveTypeToString(at), pn, GameI.controller );
|
||||||
m_HoldTopCap[ht][at].Load( sButton, HoldTypeToString(ht)+" Topcap "+ActiveTypeToString(at) );
|
m_HoldTopCap[ht][at].Load( sButton, HoldTypeToString(ht)+" Topcap "+ActiveTypeToString(at), pn, GameI.controller );
|
||||||
m_HoldBody[ht][at].Load( sButton, HoldTypeToString(ht)+" Body "+ActiveTypeToString(at) );
|
m_HoldBody[ht][at].Load( sButton, HoldTypeToString(ht)+" Body "+ActiveTypeToString(at), pn, GameI.controller );
|
||||||
m_HoldBottomCap[ht][at].Load( sButton, HoldTypeToString(ht)+" Bottomcap "+ActiveTypeToString(at) );
|
m_HoldBottomCap[ht][at].Load( sButton, HoldTypeToString(ht)+" Bottomcap "+ActiveTypeToString(at), pn, GameI.controller );
|
||||||
m_HoldTail[ht][at].Load( sButton, HoldTypeToString(ht)+" Tail "+ActiveTypeToString(at) );
|
m_HoldTail[ht][at].Load( sButton, HoldTypeToString(ht)+" Tail "+ActiveTypeToString(at), pn, GameI.controller );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -1,6 +1,9 @@
|
|||||||
#ifndef NOTE_DISPLAY_H
|
#ifndef NOTE_DISPLAY_H
|
||||||
#define NOTE_DISPLAY_H
|
#define NOTE_DISPLAY_H
|
||||||
|
|
||||||
|
#include "PlayerNumber.h"
|
||||||
|
#include "GameInput.h"
|
||||||
|
|
||||||
class Actor;
|
class Actor;
|
||||||
class Sprite;
|
class Sprite;
|
||||||
class Model;
|
class Model;
|
||||||
@@ -41,7 +44,7 @@ struct NoteColorActor
|
|||||||
{
|
{
|
||||||
NoteColorActor();
|
NoteColorActor();
|
||||||
~NoteColorActor();
|
~NoteColorActor();
|
||||||
void Load( const RString &sButton, const RString &sElement );
|
void Load( const RString &sButton, const RString &sElement, PlayerNumber, GameController );
|
||||||
Actor *Get();
|
Actor *Get();
|
||||||
private:
|
private:
|
||||||
NoteResource *m_p;
|
NoteResource *m_p;
|
||||||
@@ -51,7 +54,7 @@ struct NoteColorSprite
|
|||||||
{
|
{
|
||||||
NoteColorSprite();
|
NoteColorSprite();
|
||||||
~NoteColorSprite();
|
~NoteColorSprite();
|
||||||
void Load( const RString &sButton, const RString &sElement );
|
void Load( const RString &sButton, const RString &sElement, PlayerNumber, GameController );
|
||||||
Sprite *Get();
|
Sprite *Get();
|
||||||
private:
|
private:
|
||||||
NoteResource *m_p;
|
NoteResource *m_p;
|
||||||
|
|||||||
Reference in New Issue
Block a user