clamp to 8 different note colors so that NoteSkins can implement colors efficiently in power-of-2 texture sizes
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
#include "ArrowEffects.h"
|
#include "ArrowEffects.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "RageDisplay.h"
|
#include "RageDisplay.h"
|
||||||
#include "NoteTypes.h"
|
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "PlayerState.h"
|
#include "PlayerState.h"
|
||||||
@@ -28,6 +27,11 @@ XToString( NotePart, NUM_NotePart );
|
|||||||
|
|
||||||
static const RageVector2 g_emptyVector = RageVector2( 0, 0 );
|
static const RageVector2 g_emptyVector = RageVector2( 0, 0 );
|
||||||
|
|
||||||
|
// Don't require that NoteSkins have more than 8 colors. Using 9 colors to display 192nd notes
|
||||||
|
// would double the number of texture memory needed for many NoteSkin graphics versus just having
|
||||||
|
// 8 colors.
|
||||||
|
static const NoteType MAX_DISPLAY_NOTE_TYPE = (NoteType)7;
|
||||||
|
|
||||||
// cache
|
// cache
|
||||||
struct NoteMetricCache_t
|
struct NoteMetricCache_t
|
||||||
{
|
{
|
||||||
@@ -756,6 +760,7 @@ void NoteDisplay::DrawHoldTail( const TapNote& tn, int iCol, int iRow, bool bIsB
|
|||||||
{
|
{
|
||||||
DISPLAY->TexturePushMatrix();
|
DISPLAY->TexturePushMatrix();
|
||||||
NoteType nt = GetNoteType( iRow );
|
NoteType nt = GetNoteType( iRow );
|
||||||
|
ENUM_CLAMP( nt, (NoteType)0, MAX_DISPLAY_NOTE_TYPE );
|
||||||
DISPLAY->TextureTranslate( cache->m_fNoteColorTextureCoordSpacing[NotePart_HoldTail]*(float)nt );
|
DISPLAY->TextureTranslate( cache->m_fNoteColorTextureCoordSpacing[NotePart_HoldTail]*(float)nt );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -824,6 +829,7 @@ void NoteDisplay::DrawHoldHead( const TapNote& tn, int iCol, int iRow, bool bIsB
|
|||||||
{
|
{
|
||||||
DISPLAY->TexturePushMatrix();
|
DISPLAY->TexturePushMatrix();
|
||||||
NoteType nt = GetNoteType( iRow );
|
NoteType nt = GetNoteType( iRow );
|
||||||
|
ENUM_CLAMP( nt, (NoteType)0, MAX_DISPLAY_NOTE_TYPE );
|
||||||
DISPLAY->TextureTranslate( cache->m_fNoteColorTextureCoordSpacing[NotePart_HoldHead]*(float)nt );
|
DISPLAY->TextureTranslate( cache->m_fNoteColorTextureCoordSpacing[NotePart_HoldHead]*(float)nt );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -963,6 +969,7 @@ void NoteDisplay::DrawActor( Actor* pActor, int iCol, float fBeat, float fPercen
|
|||||||
{
|
{
|
||||||
DISPLAY->TexturePushMatrix();
|
DISPLAY->TexturePushMatrix();
|
||||||
NoteType nt = BeatToNoteType( fBeat );
|
NoteType nt = BeatToNoteType( fBeat );
|
||||||
|
ENUM_CLAMP( nt, (NoteType)0, MAX_DISPLAY_NOTE_TYPE );
|
||||||
DISPLAY->TextureTranslate( cache->m_fNoteColorTextureCoordSpacing[part]*(float)nt );
|
DISPLAY->TextureTranslate( cache->m_fNoteColorTextureCoordSpacing[part]*(float)nt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,13 @@ inline bool CLAMP( float &x, float l, float h )
|
|||||||
else if (x < l) { x = l; return true; }
|
else if (x < l) { x = l; return true; }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
template<class T>
|
||||||
|
inline bool ENUM_CLAMP( T &x, T l, T h )
|
||||||
|
{
|
||||||
|
if (x > h) { x = h; return true; }
|
||||||
|
else if (x < l) { x = l; return true; }
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
inline void wrap( int &x, int n )
|
inline void wrap( int &x, int n )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user