do note coloring with tex coord shifting, not separate elements

This commit is contained in:
Chris Danford
2005-10-04 19:45:45 +00:00
parent 57153b6c6c
commit e628f74491
8 changed files with 121 additions and 85 deletions
+1 -1
View File
@@ -358,7 +358,7 @@ void Model::DrawPrimitives()
if( vTexTranslate.x != 0 || vTexTranslate.y != 0 ) if( vTexTranslate.x != 0 || vTexTranslate.y != 0 )
{ {
DISPLAY->TexturePushMatrix(); DISPLAY->TexturePushMatrix();
DISPLAY->TextureTranslate( vTexTranslate.x, vTexTranslate.y, 0 ); DISPLAY->TextureTranslate( vTexTranslate.x, vTexTranslate.y );
} }
/* There's some common code that could be folded out here, but it seems /* There's some common code that could be folded out here, but it seems
+93 -74
View File
@@ -12,22 +12,10 @@
#include "PlayerState.h" #include "PlayerState.h"
#include "LuaBinding.h" #include "LuaBinding.h"
enum Part const CString& NoteNotePartToString( NotePart i );
{ #define FOREACH_NotePart( i ) FOREACH_ENUM( NotePart, NUM_NotePart, i )
PART_TAP,
PART_ADDITION,
PART_MINE,
PART_HOLD_HEAD,
PART_HOLD_TAIL,
PART_HOLD_TOP_CAP,
PART_HOLD_BODY,
PART_HOLD_BOTTOM_CAP,
NUM_PARTS
};
const CString& PartToString( Part p );
#define FOREACH_Part( p ) FOREACH_ENUM( Part, NUM_PARTS, p )
static const CString PartNames[] = { static const CString NotePartNames[] = {
"TapNote", "TapNote",
"TapAddition", "TapAddition",
"TapMine", "TapMine",
@@ -37,16 +25,17 @@ static const CString PartNames[] = {
"HoldBottomCap", "HoldBottomCap",
"HoldTail", "HoldTail",
}; };
XToString( Part, NUM_PARTS ); XToString( NotePart, NUM_NotePart );
static const RageVector2 g_emptyVector = RageVector2( 0, 0 );
// cache // cache
struct NoteMetricCache_t struct NoteMetricCache_t
{ {
bool m_bDrawHoldHeadForTapsOnSameRow; bool m_bDrawHoldHeadForTapsOnSameRow;
float m_fAnimationLengthInBeats[NUM_PARTS]; float m_fAnimationLengthInBeats[NUM_NotePart];
bool m_bAnimationIsVivid[NUM_PARTS]; bool m_bAnimationIsVivid[NUM_NotePart];
bool m_bAnimationIsNoteColor[NUM_PARTS]; RageVector2 m_fNoteColorTextureCoordSpacing[NUM_NotePart];
bool m_bHoldHeadIsAboveWavyParts; bool m_bHoldHeadIsAboveWavyParts;
bool m_bHoldTailIsAboveWavyParts; bool m_bHoldTailIsAboveWavyParts;
@@ -66,12 +55,14 @@ struct NoteMetricCache_t
void NoteMetricCache_t::Load( const CString &sButton ) void NoteMetricCache_t::Load( const CString &sButton )
{ {
m_bDrawHoldHeadForTapsOnSameRow = NOTESKIN->GetMetricB(sButton,"DrawHoldHeadForTapsOnSameRow"); m_bDrawHoldHeadForTapsOnSameRow = NOTESKIN->GetMetricB(sButton,"DrawHoldHeadForTapsOnSameRow");
FOREACH_Part( p ) FOREACH_NotePart( p )
m_fAnimationLengthInBeats[p] = NOTESKIN->GetMetricF(sButton,PartToString(p)+"AnimationLengthInBeats"); {
FOREACH_Part( p ) const CString s = NotePartToString(p);
m_bAnimationIsVivid[p] = NOTESKIN->GetMetricB(sButton,PartToString(p)+"AnimationIsVivid"); m_fAnimationLengthInBeats[p] = NOTESKIN->GetMetricF(sButton,s+"AnimationLengthInBeats");
FOREACH_Part( p ) m_bAnimationIsVivid[p] = NOTESKIN->GetMetricB(sButton,s+"AnimationIsVivid");
m_bAnimationIsNoteColor[p] = NOTESKIN->GetMetricB(sButton,PartToString(p)+"AnimationIsNoteColor"); m_fNoteColorTextureCoordSpacing[p].x = NOTESKIN->GetMetricF(sButton,s+"NoteColorTextureCoordSpacingX");
m_fNoteColorTextureCoordSpacing[p].y = NOTESKIN->GetMetricF(sButton,s+"NoteColorTextureCoordSpacingY");
}
m_bHoldHeadIsAboveWavyParts = NOTESKIN->GetMetricB(sButton,"HoldHeadIsAboveWavyParts"); m_bHoldHeadIsAboveWavyParts = NOTESKIN->GetMetricB(sButton,"HoldHeadIsAboveWavyParts");
m_bHoldTailIsAboveWavyParts = NOTESKIN->GetMetricB(sButton,"HoldTailIsAboveWavyParts"); m_bHoldTailIsAboveWavyParts = NOTESKIN->GetMetricB(sButton,"HoldTailIsAboveWavyParts");
m_iStartDrawingHoldBodyOffsetFromHead = NOTESKIN->GetMetricI(sButton,"StartDrawingHoldBodyOffsetFromHead"); m_iStartDrawingHoldBodyOffsetFromHead = NOTESKIN->GetMetricI(sButton,"StartDrawingHoldBodyOffsetFromHead");
@@ -123,9 +114,9 @@ struct NoteResource
static map<NoteSkinAndPath, NoteResource *> g_NoteResource; static map<NoteSkinAndPath, NoteResource *> g_NoteResource;
static NoteResource *MakeNoteResource( const CString &sButton, const CString &sElement, NoteType nt, bool bSpriteOnly ) static NoteResource *MakeNoteResource( const CString &sButton, const CString &sElement, bool bSpriteOnly )
{ {
CString sElementAndType = sElement + " " + NoteTypeToString(nt); CString sElementAndType = sElement;
NoteSkinAndPath nsap( NOTESKIN->GetCurrentNoteSkin(), NOTESKIN->GetPath(sButton, sElementAndType) ); NoteSkinAndPath nsap( NOTESKIN->GetCurrentNoteSkin(), NOTESKIN->GetPath(sButton, sElementAndType) );
map<NoteSkinAndPath, NoteResource *>::iterator it = g_NoteResource.find( nsap ); map<NoteSkinAndPath, NoteResource *>::iterator it = g_NoteResource.find( nsap );
@@ -185,15 +176,15 @@ static void DeleteNoteResource( const Actor *pActor )
delete pRes; delete pRes;
} }
Actor *MakeRefcountedActor( const CString &sButton, const CString &sElement, NoteType nt ) Actor *MakeRefcountedActor( const CString &sButton, const CString &sElement )
{ {
NoteResource *pRes = MakeNoteResource( sButton, sElement, nt, false ); NoteResource *pRes = MakeNoteResource( sButton, sElement, false );
return pRes->m_pActor; return pRes->m_pActor;
} }
Sprite *MakeRefcountedSprite( const CString &sButton, const CString &sElement, NoteType nt ) Sprite *MakeRefcountedSprite( const CString &sButton, const CString &sElement )
{ {
NoteResource *pRes = MakeNoteResource( sButton, sElement, nt, true ); NoteResource *pRes = MakeNoteResource( sButton, sElement, true );
return (Sprite *) pRes->m_pActor; /* XXX ick */ return (Sprite *) pRes->m_pActor; /* XXX ick */
} }
@@ -211,17 +202,17 @@ NoteColorActor::~NoteColorActor()
m_bIsNoteColor = false; m_bIsNoteColor = false;
} }
void NoteColorActor::Load( bool bIsNoteColor, const CString &sButton, const CString &sElement ) void NoteColorActor::Load( const CString &sButton, const CString &sElement )
{ {
m_bIsNoteColor = bIsNoteColor; m_bIsNoteColor = false;
if( m_bIsNoteColor ) if( m_bIsNoteColor )
{ {
for( int i=0; i<NOTE_COLOR_IMAGES; i++ ) for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
m_p[i] = MakeRefcountedActor( sButton, sElement, (NoteType)i ); m_p[i] = MakeRefcountedActor( sButton, sElement );
} }
else else
{ {
m_p[0] = MakeRefcountedActor( sButton, sElement, NOTE_TYPE_4TH ); m_p[0] = MakeRefcountedActor( sButton, sElement );
} }
} }
@@ -251,17 +242,17 @@ NoteColorSprite::~NoteColorSprite()
m_bIsNoteColor = false; m_bIsNoteColor = false;
} }
void NoteColorSprite::Load( bool bIsNoteColor, const CString &sButton, const CString &sElement ) void NoteColorSprite::Load( const CString &sButton, const CString &sElement )
{ {
m_bIsNoteColor = bIsNoteColor; m_bIsNoteColor = false;
if( m_bIsNoteColor ) if( m_bIsNoteColor )
{ {
for( int i=0; i<NOTE_COLOR_IMAGES; i++ ) for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
m_p[i] = MakeRefcountedSprite( sButton, sElement, (NoteType)i ); m_p[i] = MakeRefcountedSprite( sButton, sElement );
} }
else else
{ {
m_p[0] = MakeRefcountedSprite( sButton, sElement, NOTE_TYPE_4TH ); m_p[0] = MakeRefcountedSprite( sButton, sElement );
} }
} }
@@ -309,19 +300,19 @@ void NoteDisplay::Load( int iColNum, const PlayerState* pPlayerState, float fYRe
cache->Load( sButton ); cache->Load( sButton );
m_TapNote.Load( cache->m_bAnimationIsNoteColor[PART_TAP], sButton, "tap note" ); m_TapNote.Load( sButton, "tap note" );
m_TapAddition.Load( cache->m_bAnimationIsNoteColor[PART_ADDITION], sButton, "tap addition" ); m_TapAddition.Load( sButton, "tap addition" );
m_TapMine.Load( cache->m_bAnimationIsNoteColor[PART_MINE], sButton, "tap mine" ); m_TapMine.Load( sButton, "tap mine" );
FOREACH_HoldType( ht ) FOREACH_HoldType( ht )
{ {
FOREACH_ActiveType( at ) FOREACH_ActiveType( at )
{ {
m_HoldHead[ht][at].Load( cache->m_bAnimationIsNoteColor[PART_HOLD_HEAD], sButton, HoldTypeToString(ht)+" head "+ActiveTypeToString(at) ); m_HoldHead[ht][at].Load( sButton, HoldTypeToString(ht)+" head "+ActiveTypeToString(at) );
m_HoldTopCap[ht][at].Load( cache->m_bAnimationIsNoteColor[PART_HOLD_TOP_CAP], sButton, HoldTypeToString(ht)+" topcap "+ActiveTypeToString(at) ); m_HoldTopCap[ht][at].Load( sButton, HoldTypeToString(ht)+" topcap "+ActiveTypeToString(at) );
m_HoldBody[ht][at].Load( cache->m_bAnimationIsNoteColor[PART_HOLD_BODY], sButton, HoldTypeToString(ht)+" body "+ActiveTypeToString(at) ); m_HoldBody[ht][at].Load( sButton, HoldTypeToString(ht)+" body "+ActiveTypeToString(at) );
m_HoldBottomCap[ht][at].Load( cache->m_bAnimationIsNoteColor[PART_HOLD_BOTTOM_CAP], sButton, HoldTypeToString(ht)+" bottomcap "+ActiveTypeToString(at) ); m_HoldBottomCap[ht][at].Load( sButton, HoldTypeToString(ht)+" bottomcap "+ActiveTypeToString(at) );
m_HoldTail[ht][at].Load( cache->m_bAnimationIsNoteColor[PART_HOLD_TAIL], sButton, HoldTypeToString(ht)+" tail "+ActiveTypeToString(at) ); m_HoldTail[ht][at].Load( sButton, HoldTypeToString(ht)+" tail "+ActiveTypeToString(at) );
} }
} }
} }
@@ -343,7 +334,7 @@ void NoteDisplay::Update( float fDeltaTime )
} }
} }
void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor ) void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLengthInBeats, bool bVivid )
{ {
/* -inf ... inf */ /* -inf ... inf */
float fSongBeat = GAMESTATE->m_fSongBeat; float fSongBeat = GAMESTATE->m_fSongBeat;
@@ -383,9 +374,8 @@ Actor * NoteDisplay::GetTapNoteActor( float fNoteBeat )
SetActiveFrame( SetActiveFrame(
fNoteBeat, fNoteBeat,
*pActorOut, *pActorOut,
cache->m_fAnimationLengthInBeats[PART_TAP], cache->m_fAnimationLengthInBeats[NotePart_Tap],
cache->m_bAnimationIsVivid[PART_TAP], cache->m_bAnimationIsVivid[NotePart_Tap] );
cache->m_bAnimationIsNoteColor[PART_TAP] );
return pActorOut; return pActorOut;
} }
@@ -398,9 +388,8 @@ Actor * NoteDisplay::GetTapAdditionActor( float fNoteBeat )
SetActiveFrame( SetActiveFrame(
fNoteBeat, fNoteBeat,
*pActorOut, *pActorOut,
cache->m_fAnimationLengthInBeats[PART_ADDITION], cache->m_fAnimationLengthInBeats[NotePart_Addition],
cache->m_bAnimationIsVivid[PART_ADDITION], cache->m_bAnimationIsVivid[NotePart_Addition] );
cache->m_bAnimationIsNoteColor[PART_ADDITION] );
return pActorOut; return pActorOut;
} }
@@ -413,9 +402,8 @@ Actor * NoteDisplay::GetTapMineActor( float fNoteBeat )
SetActiveFrame( SetActiveFrame(
fNoteBeat, fNoteBeat,
*pActorOut, *pActorOut,
cache->m_fAnimationLengthInBeats[PART_MINE], cache->m_fAnimationLengthInBeats[NotePart_Mine],
cache->m_bAnimationIsVivid[PART_MINE], cache->m_bAnimationIsVivid[NotePart_Mine] );
cache->m_bAnimationIsNoteColor[PART_MINE] );
return pActorOut; return pActorOut;
} }
@@ -428,9 +416,8 @@ Sprite * NoteDisplay::GetHoldTopCapSprite( float fNoteBeat, bool bIsRoll, bool b
SetActiveFrame( SetActiveFrame(
fNoteBeat, fNoteBeat,
*pSpriteOut, *pSpriteOut,
cache->m_fAnimationLengthInBeats[PART_HOLD_TOP_CAP], cache->m_fAnimationLengthInBeats[NotePart_HoldTopCap],
cache->m_bAnimationIsVivid[PART_HOLD_TOP_CAP], cache->m_bAnimationIsVivid[NotePart_HoldTopCap] );
cache->m_bAnimationIsNoteColor[PART_HOLD_TOP_CAP] );
return pSpriteOut; return pSpriteOut;
} }
@@ -443,9 +430,8 @@ Sprite * NoteDisplay::GetHoldBottomCapSprite( float fNoteBeat, bool bIsRoll, boo
SetActiveFrame( SetActiveFrame(
fNoteBeat, fNoteBeat,
*pSpriteOut, *pSpriteOut,
cache->m_fAnimationLengthInBeats[PART_HOLD_BOTTOM_CAP], cache->m_fAnimationLengthInBeats[NotePart_HoldBottomCap],
cache->m_bAnimationIsVivid[PART_HOLD_BOTTOM_CAP], cache->m_bAnimationIsVivid[NotePart_HoldBottomCap] );
cache->m_bAnimationIsNoteColor[PART_HOLD_BOTTOM_CAP] );
return pSpriteOut; return pSpriteOut;
} }
@@ -459,9 +445,8 @@ Actor* NoteDisplay::GetHoldHeadActor( float fNoteBeat, bool bIsRoll, bool bIsBei
SetActiveFrame( SetActiveFrame(
fNoteBeat, fNoteBeat,
*pActorOut, *pActorOut,
cache->m_fAnimationLengthInBeats[PART_HOLD_HEAD], cache->m_fAnimationLengthInBeats[NotePart_HoldHead],
cache->m_bAnimationIsVivid[PART_HOLD_HEAD], cache->m_bAnimationIsVivid[NotePart_HoldHead] );
cache->m_bAnimationIsNoteColor[PART_HOLD_HEAD] );
return pActorOut; return pActorOut;
} }
@@ -474,9 +459,8 @@ Sprite *NoteDisplay::GetHoldBodySprite( float fNoteBeat, bool bIsRoll, bool bIsB
SetActiveFrame( SetActiveFrame(
fNoteBeat, fNoteBeat,
*pSpriteOut, *pSpriteOut,
cache->m_fAnimationLengthInBeats[PART_HOLD_BODY], cache->m_fAnimationLengthInBeats[NotePart_HoldBody],
cache->m_bAnimationIsVivid[PART_HOLD_BODY], cache->m_bAnimationIsVivid[NotePart_HoldBody] );
cache->m_bAnimationIsNoteColor[PART_HOLD_BODY] );
return pSpriteOut; return pSpriteOut;
} }
@@ -489,9 +473,8 @@ Actor* NoteDisplay::GetHoldTailActor( float fNoteBeat, bool bIsRoll, bool bIsBei
SetActiveFrame( SetActiveFrame(
fNoteBeat, fNoteBeat,
*pActorOut, *pActorOut,
cache->m_fAnimationLengthInBeats[PART_HOLD_TAIL], cache->m_fAnimationLengthInBeats[NotePart_HoldTail],
cache->m_bAnimationIsVivid[PART_HOLD_TAIL], cache->m_bAnimationIsVivid[NotePart_HoldTail] );
cache->m_bAnimationIsNoteColor[PART_HOLD_TAIL] );
return pActorOut; return pActorOut;
} }
@@ -825,6 +808,13 @@ void NoteDisplay::DrawHoldTail( const TapNote& tn, int iCol, int iRow, bool bIsB
pSprTail->SetXY( fX, fY ); pSprTail->SetXY( fX, fY );
pSprTail->SetZ( fZ ); pSprTail->SetZ( fZ );
if( cache->m_fNoteColorTextureCoordSpacing[NotePart_HoldTail] != g_emptyVector )
{
DISPLAY->TexturePushMatrix();
NoteType nt = GetNoteType( iRow );
DISPLAY->TextureTranslate( cache->m_fNoteColorTextureCoordSpacing[NotePart_HoldTail]*nt );
}
if( bGlow ) if( bGlow )
{ {
pSprTail->SetDiffuse( RageColor(1,1,1,0) ); pSprTail->SetDiffuse( RageColor(1,1,1,0) );
@@ -854,6 +844,11 @@ void NoteDisplay::DrawHoldTail( const TapNote& tn, int iCol, int iRow, bool bIsB
DISPLAY->SetLightOff( 0 ); DISPLAY->SetLightOff( 0 );
DISPLAY->SetLighting( false ); DISPLAY->SetLighting( false );
} }
if( cache->m_fNoteColorTextureCoordSpacing[NotePart_HoldTail] != g_emptyVector )
{
DISPLAY->TexturePopMatrix();
}
} }
void NoteDisplay::DrawHoldHead( const TapNote& tn, int iCol, int iRow, bool bIsBeingHeld, float fYHead, float fPercentFadeToFail, float fColorScale, bool bGlow, float fYStartOffset, float fYEndOffset ) void NoteDisplay::DrawHoldHead( const TapNote& tn, int iCol, int iRow, bool bIsBeingHeld, float fYHead, float fPercentFadeToFail, float fColorScale, bool bGlow, float fYStartOffset, float fYEndOffset )
@@ -881,6 +876,13 @@ void NoteDisplay::DrawHoldHead( const TapNote& tn, int iCol, int iRow, bool bIsB
pActor->SetXY( fX, fY ); pActor->SetXY( fX, fY );
pActor->SetZ( fZ ); pActor->SetZ( fZ );
if( cache->m_fNoteColorTextureCoordSpacing[NotePart_HoldHead] != g_emptyVector )
{
DISPLAY->TexturePushMatrix();
NoteType nt = GetNoteType( iRow );
DISPLAY->TextureTranslate( cache->m_fNoteColorTextureCoordSpacing[NotePart_HoldHead]*nt );
}
if( bGlow ) if( bGlow )
{ {
pActor->SetDiffuse( RageColor(1,1,1,0) ); pActor->SetDiffuse( RageColor(1,1,1,0) );
@@ -910,6 +912,11 @@ void NoteDisplay::DrawHoldHead( const TapNote& tn, int iCol, int iRow, bool bIsB
DISPLAY->SetLightOff( 0 ); DISPLAY->SetLightOff( 0 );
DISPLAY->SetLighting( false ); DISPLAY->SetLighting( false );
} }
if( cache->m_fNoteColorTextureCoordSpacing[NotePart_HoldHead] != g_emptyVector )
{
DISPLAY->TexturePopMatrix();
}
} }
void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iRow, bool bIsBeingHeld, bool bIsActive, const HoldNoteResult &Result, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels, float fYStartOffset, float fYEndOffset ) void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iRow, bool bIsBeingHeld, bool bIsActive, const HoldNoteResult &Result, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels, float fYStartOffset, float fYEndOffset )
@@ -987,7 +994,7 @@ void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iRow, bool bIsBeing
DrawHold( tn, iCol, iRow, bIsBeingHeld, bIsActive, Result, fPercentFadeToFail, true, fReverseOffsetPixels, fYStartOffset, fYEndOffset ); DrawHold( tn, iCol, iRow, bIsBeingHeld, bIsActive, Result, fPercentFadeToFail, true, fReverseOffsetPixels, fYStartOffset, fYEndOffset );
} }
void NoteDisplay::DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting ) void NoteDisplay::DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting, NotePart part )
{ {
const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, iCol, fBeat ); const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, iCol, fBeat );
const float fYPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fYOffset, fReverseOffsetPixels ); const float fYPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fYOffset, fReverseOffsetPixels );
@@ -1008,6 +1015,13 @@ void NoteDisplay::DrawActor( Actor* pActor, int iCol, float fBeat, float fPercen
pActor->SetGlow( glow ); pActor->SetGlow( glow );
pActor->SetZoom( fZoom ); pActor->SetZoom( fZoom );
if( cache->m_fNoteColorTextureCoordSpacing[part] != g_emptyVector )
{
DISPLAY->TexturePushMatrix();
NoteType nt = BeatToNoteType( fBeat );
DISPLAY->TextureTranslate( cache->m_fNoteColorTextureCoordSpacing[part]*nt );
}
if( bUseLighting ) if( bUseLighting )
{ {
DISPLAY->SetLighting( true ); DISPLAY->SetLighting( true );
@@ -1026,6 +1040,11 @@ void NoteDisplay::DrawActor( Actor* pActor, int iCol, float fBeat, float fPercen
DISPLAY->SetLightOff( 0 ); DISPLAY->SetLightOff( 0 );
DISPLAY->SetLighting( false ); DISPLAY->SetLighting( false );
} }
if( cache->m_fNoteColorTextureCoordSpacing[part] != g_emptyVector )
{
DISPLAY->TexturePopMatrix();
}
} }
void NoteDisplay::DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bool bIsAddition, bool bIsMine, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels ) void NoteDisplay::DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bool bIsAddition, bool bIsMine, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels )
@@ -1053,7 +1072,7 @@ void NoteDisplay::DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bo
bUseLighting = cache->m_bTapNoteUseLighting; bUseLighting = cache->m_bTapNoteUseLighting;
} }
DrawActor( pActor, iCol, fBeat, fPercentFadeToFail, fLife, fReverseOffsetPixels, bUseLighting ); DrawActor( pActor, iCol, fBeat, fPercentFadeToFail, fLife, fReverseOffsetPixels, bUseLighting, NotePart_Tap );
} }
/* /*
+17 -4
View File
@@ -11,13 +11,26 @@ struct HoldNoteResult;
struct NoteMetricCache_t; struct NoteMetricCache_t;
class PlayerState; class PlayerState;
enum NotePart
{
NotePart_Tap,
NotePart_Addition,
NotePart_Mine,
NotePart_HoldHead,
NotePart_HoldTail,
NotePart_HoldTopCap,
NotePart_HoldBody,
NotePart_HoldBottomCap,
NUM_NotePart
};
#define NOTE_COLOR_IMAGES 8 #define NOTE_COLOR_IMAGES 8
struct NoteColorActor struct NoteColorActor
{ {
NoteColorActor(); NoteColorActor();
~NoteColorActor(); ~NoteColorActor();
void Load( bool bIsNoteColor, const CString &sButton, const CString &sElement ); void Load( const CString &sButton, const CString &sElement );
Actor* Get( NoteType nt ); Actor* Get( NoteType nt );
private: private:
Actor* m_p[NOTE_COLOR_IMAGES]; Actor* m_p[NOTE_COLOR_IMAGES];
@@ -28,7 +41,7 @@ struct NoteColorSprite
{ {
NoteColorSprite(); NoteColorSprite();
~NoteColorSprite(); ~NoteColorSprite();
void Load( bool bIsNoteColor, const CString &sButton, const CString &sElement ); void Load( const CString &sButton, const CString &sElement );
Sprite* Get( NoteType nt ); Sprite* Get( NoteType nt );
private: private:
Sprite* m_p[NOTE_COLOR_IMAGES]; Sprite* m_p[NOTE_COLOR_IMAGES];
@@ -54,14 +67,14 @@ public:
static void Update( float fDeltaTime ); static void Update( float fDeltaTime );
void DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting ); void DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting, NotePart part );
void DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bool bIsAddition, bool bIsMine, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels ); void DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bool bIsAddition, bool bIsMine, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels );
void DrawHold( const TapNote& tn, int iCol, int iRow, bool bIsBeingHeld, bool bIsActive, const HoldNoteResult &Result, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels, float fYStartOffset, float fYEndOffset ); void DrawHold( const TapNote& tn, int iCol, int iRow, bool bIsBeingHeld, bool bIsActive, const HoldNoteResult &Result, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels, float fYStartOffset, float fYEndOffset );
bool DrawHoldHeadForTapsOnSameRow() const; bool DrawHoldHeadForTapsOnSameRow() const;
protected: protected:
void SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor ); void SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLengthInBeats, bool bVivid );
Actor *GetTapNoteActor( float fNoteBeat ); Actor *GetTapNoteActor( float fNoteBeat );
Actor *GetTapAdditionActor( float fNoteBeat ); Actor *GetTapAdditionActor( float fNoteBeat );
Actor *GetTapMineActor( float fNoteBeat ); Actor *GetTapMineActor( float fNoteBeat );
+1 -1
View File
@@ -798,7 +798,7 @@ void NoteField::DrawPrimitives()
Sprite sprite; Sprite sprite;
sprite.Load( THEME->GetPathG("NoteField","attack "+tn.sAttackModifiers) ); sprite.Load( THEME->GetPathG("NoteField","attack "+tn.sAttackModifiers) );
float fBeat = NoteRowToBeat(i); float fBeat = NoteRowToBeat(i);
nd->display[c].DrawActor( &sprite, c, fBeat, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, 1, m_fYReverseOffsetPixels, false ); nd->display[c].DrawActor( &sprite, c, fBeat, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, 1, m_fYReverseOffsetPixels, false, NotePart_Tap );
} }
else else
{ {
+5 -1
View File
@@ -162,8 +162,12 @@ CString NoteSkinManager::GetMetric( const CString &sButtonName, const CString &s
if( data.metrics.GetValue( sButtonName, sValue, sReturn ) ) if( data.metrics.GetValue( sButtonName, sValue, sReturn ) )
return sReturn; return sReturn;
if( !data.metrics.GetValue( "NoteDisplay", sValue, sReturn ) ) if( !data.metrics.GetValue( "NoteDisplay", sValue, sReturn ) )
RageException::Throw( "Could not read metric '[%s] %s' or '[NoteDisplay] %s' in '%s'", {
CString sError = ssprintf(
"Could not read metric '[%s] %s' or '[NoteDisplay] %s' in '%s'",
sButtonName.c_str(), sValue.c_str(), sValue.c_str(), sNoteSkinName.c_str() ); sButtonName.c_str(), sValue.c_str(), sValue.c_str(), sNoteSkinName.c_str() );
RageException::Throw( sError );
}
return sReturn; return sReturn;
} }
-1
View File
@@ -178,7 +178,6 @@ enum NoteType
// MD 11/02/03 - added finer divisions // MD 11/02/03 - added finer divisions
NOTE_TYPE_48TH, // forty-eighth note NOTE_TYPE_48TH, // forty-eighth note
NOTE_TYPE_64TH, // sixty-fourth note NOTE_TYPE_64TH, // sixty-fourth note
// Not having this triggers asserts all over the place. Go figure.
NOTE_TYPE_192ND, NOTE_TYPE_192ND,
NUM_NOTE_TYPES, NUM_NOTE_TYPES,
NOTE_TYPE_INVALID NOTE_TYPE_INVALID
+2 -2
View File
@@ -445,9 +445,9 @@ void RageDisplay::TexturePopMatrix()
g_TextureStack.Pop(); g_TextureStack.Pop();
} }
void RageDisplay::TextureTranslate( float x, float y, float z ) void RageDisplay::TextureTranslate( float x, float y )
{ {
g_TextureStack.TranslateLocal(x, y, z); g_TextureStack.TranslateLocal(x, y, 0);
} }
+2 -1
View File
@@ -275,7 +275,8 @@ public:
/* Texture matrix functions */ /* Texture matrix functions */
void TexturePushMatrix(); void TexturePushMatrix();
void TexturePopMatrix(); void TexturePopMatrix();
void TextureTranslate( float x, float y, float z ); void TextureTranslate( float x, float y );
void TextureTranslate( const RageVector2 &v ) { this->TextureTranslate( v.x, v.y ); }
/* Projection and View matrix stack functions. */ /* Projection and View matrix stack functions. */
void CameraPushMatrix(); void CameraPushMatrix();