2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-08-13 23:26:46 +00:00
|
|
|
#include "NoteDisplay.h"
|
2003-08-03 00:13:55 +00:00
|
|
|
#include "Steps.h"
|
2002-08-13 23:26:46 +00:00
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "GameState.h"
|
2003-02-06 07:32:57 +00:00
|
|
|
#include "NoteSkinManager.h"
|
2002-08-13 23:26:46 +00:00
|
|
|
#include "RageException.h"
|
|
|
|
|
#include "ArrowEffects.h"
|
|
|
|
|
#include "RageLog.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "RageDisplay.h"
|
2003-02-05 03:53:57 +00:00
|
|
|
#include "NoteTypes.h"
|
2003-04-17 21:45:37 +00:00
|
|
|
#include "NoteFieldPositioning.h"
|
2003-09-21 20:57:07 +00:00
|
|
|
#include "ActorUtil.h"
|
2004-05-07 04:57:29 +00:00
|
|
|
#include "NoteDataWithScoring.h"
|
2003-02-05 03:53:57 +00:00
|
|
|
|
2004-04-16 05:21:25 +00:00
|
|
|
enum part
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2003-01-13 08:31:34 +00:00
|
|
|
// cache
|
2004-04-16 04:17:26 +00:00
|
|
|
struct NoteMetricCache_t
|
|
|
|
|
{
|
2003-02-08 23:47:47 +00:00
|
|
|
bool m_bDrawHoldHeadForTapsOnSameRow;
|
2004-04-16 05:21:25 +00:00
|
|
|
float m_fAnimationLengthInBeats[NUM_PARTS];
|
|
|
|
|
bool m_bAnimationIsVivid[NUM_PARTS];
|
|
|
|
|
bool m_bAnimationIsNoteColor[NUM_PARTS];
|
|
|
|
|
|
2003-07-17 07:37:56 +00:00
|
|
|
bool m_bHoldHeadIsAboveWavyParts;
|
|
|
|
|
bool m_bHoldTailIsAboveWavyParts;
|
2003-02-08 23:47:47 +00:00
|
|
|
int m_iStartDrawingHoldBodyOffsetFromHead;
|
|
|
|
|
int m_iStopDrawingHoldBodyOffsetFromTail;
|
|
|
|
|
float m_fHoldNGGrayPercent;
|
2003-12-31 08:15:34 +00:00
|
|
|
bool m_bTapNoteUseLighting;
|
|
|
|
|
bool m_bTapAdditionUseLighting;
|
|
|
|
|
bool m_bTapMineUseLighting;
|
|
|
|
|
bool m_bHoldHeadUseLighting;
|
|
|
|
|
bool m_bHoldTailUseLighting;
|
2003-10-14 04:41:24 +00:00
|
|
|
bool m_bFlipHeadAndTailWhenReverse;
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2003-09-12 06:23:51 +00:00
|
|
|
void Load(CString skin, const CString &name);
|
2003-02-08 23:47:47 +00:00
|
|
|
} *NoteMetricCache;
|
|
|
|
|
|
2003-09-12 06:23:51 +00:00
|
|
|
void NoteMetricCache_t::Load(CString skin, const CString &name)
|
2003-02-08 23:47:47 +00:00
|
|
|
{
|
2004-04-16 04:17:26 +00:00
|
|
|
m_bDrawHoldHeadForTapsOnSameRow = NOTESKIN->GetMetricB(skin,name,"DrawHoldHeadForTapsOnSameRow");
|
2004-04-16 05:21:25 +00:00
|
|
|
m_fAnimationLengthInBeats[PART_TAP] = NOTESKIN->GetMetricF(skin,name,"TapNoteAnimationLengthInBeats");
|
|
|
|
|
m_fAnimationLengthInBeats[PART_ADDITION] = NOTESKIN->GetMetricF(skin,name,"TapAdditionAnimationLengthInBeats");
|
|
|
|
|
m_fAnimationLengthInBeats[PART_MINE] = NOTESKIN->GetMetricF(skin,name,"TapMineAnimationLengthInBeats");
|
|
|
|
|
m_fAnimationLengthInBeats[PART_HOLD_HEAD] = NOTESKIN->GetMetricF(skin,name,"HoldHeadAnimationLengthInBeats");
|
|
|
|
|
m_fAnimationLengthInBeats[PART_HOLD_TOP_CAP] = NOTESKIN->GetMetricF(skin,name,"HoldTopCapAnimationLengthInBeats");
|
|
|
|
|
m_fAnimationLengthInBeats[PART_HOLD_BODY] = NOTESKIN->GetMetricF(skin,name,"HoldBodyAnimationLengthInBeats");
|
|
|
|
|
m_fAnimationLengthInBeats[PART_HOLD_BOTTOM_CAP] = NOTESKIN->GetMetricF(skin,name,"HoldBottomCapAnimationLengthInBeats");
|
|
|
|
|
m_fAnimationLengthInBeats[PART_HOLD_TAIL] = NOTESKIN->GetMetricF(skin,name,"HoldTailAnimationLengthInBeats");
|
|
|
|
|
m_bAnimationIsVivid[PART_TAP] = NOTESKIN->GetMetricB(skin,name,"TapNoteAnimationIsVivid");
|
|
|
|
|
m_bAnimationIsVivid[PART_ADDITION] = NOTESKIN->GetMetricB(skin,name,"TapAdditionAnimationIsVivid");
|
|
|
|
|
m_bAnimationIsVivid[PART_MINE] = NOTESKIN->GetMetricB(skin,name,"TapMineAnimationIsVivid");
|
|
|
|
|
m_bAnimationIsVivid[PART_HOLD_HEAD] = NOTESKIN->GetMetricB(skin,name,"HoldHeadAnimationIsVivid");
|
|
|
|
|
m_bAnimationIsVivid[PART_HOLD_TOP_CAP] = NOTESKIN->GetMetricB(skin,name,"HoldTopCapAnimationIsVivid");
|
|
|
|
|
m_bAnimationIsVivid[PART_HOLD_BODY] = NOTESKIN->GetMetricB(skin,name,"HoldBodyAnimationIsVivid");
|
|
|
|
|
m_bAnimationIsVivid[PART_HOLD_BOTTOM_CAP] = NOTESKIN->GetMetricB(skin,name,"HoldBottomCapAnimationIsVivid");
|
|
|
|
|
m_bAnimationIsVivid[PART_HOLD_TAIL] = NOTESKIN->GetMetricB(skin,name,"HoldTailAnimationIsVivid");
|
|
|
|
|
|
|
|
|
|
m_bAnimationIsNoteColor[PART_TAP] = NOTESKIN->GetMetricB(skin,name,"TapNoteAnimationIsNoteColor");
|
|
|
|
|
m_bAnimationIsNoteColor[PART_ADDITION] = NOTESKIN->GetMetricB(skin,name,"TapAdditionAnimationIsNoteColor");
|
|
|
|
|
// m_bAnimationIsNoteColor[PART_MINE] = NOTESKIN->GetMetricB(skin,name,"TapMineAnimationIsNoteColor");
|
|
|
|
|
m_bAnimationIsNoteColor[PART_HOLD_HEAD] = NOTESKIN->GetMetricB(skin,name,"HoldHeadAnimationIsNoteColor");
|
|
|
|
|
m_bAnimationIsNoteColor[PART_HOLD_TOP_CAP] =NOTESKIN->GetMetricB(skin,name,"HoldTopCapAnimationIsNoteColor");
|
|
|
|
|
m_bAnimationIsNoteColor[PART_HOLD_BODY] = NOTESKIN->GetMetricB(skin,name,"HoldBodyAnimationIsNoteColor");
|
|
|
|
|
m_bAnimationIsNoteColor[PART_HOLD_BOTTOM_CAP] = NOTESKIN->GetMetricB(skin,name,"HoldBottomCapAnimationIsNoteColor");
|
|
|
|
|
m_bAnimationIsNoteColor[PART_HOLD_TAIL] = NOTESKIN->GetMetricB(skin,name,"HoldTailAnimationIsNoteColor");
|
|
|
|
|
|
2004-04-16 04:17:26 +00:00
|
|
|
m_bHoldHeadIsAboveWavyParts = NOTESKIN->GetMetricB(skin,name,"HoldHeadIsAboveWavyParts");
|
|
|
|
|
m_bHoldTailIsAboveWavyParts = NOTESKIN->GetMetricB(skin,name,"HoldTailIsAboveWavyParts");
|
|
|
|
|
m_iStartDrawingHoldBodyOffsetFromHead = NOTESKIN->GetMetricI(skin,name,"StartDrawingHoldBodyOffsetFromHead");
|
|
|
|
|
m_iStopDrawingHoldBodyOffsetFromTail = NOTESKIN->GetMetricI(skin,name,"StopDrawingHoldBodyOffsetFromTail");
|
|
|
|
|
m_fHoldNGGrayPercent = NOTESKIN->GetMetricF(skin,name,"HoldNGGrayPercent");
|
|
|
|
|
m_bTapNoteUseLighting = NOTESKIN->GetMetricB(skin,name,"TapNoteUseLighting");
|
|
|
|
|
m_bTapAdditionUseLighting = NOTESKIN->GetMetricB(skin,name,"TapAdditionUseLighting");
|
|
|
|
|
m_bTapMineUseLighting = NOTESKIN->GetMetricB(skin,name,"TapMineUseLighting");
|
|
|
|
|
m_bHoldHeadUseLighting = NOTESKIN->GetMetricB(skin,name,"HoldHeadUseLighting");
|
|
|
|
|
m_bHoldTailUseLighting = NOTESKIN->GetMetricB(skin,name,"HoldTailUseLighting");
|
|
|
|
|
m_bFlipHeadAndTailWhenReverse = NOTESKIN->GetMetricB(skin,name,"FlipHeadAndTailWhenReverse");
|
2003-09-12 02:44:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NoteDisplay::NoteDisplay()
|
|
|
|
|
{
|
|
|
|
|
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
|
|
|
|
|
{
|
|
|
|
|
m_pTapNote[i] = NULL;
|
2003-12-29 03:51:15 +00:00
|
|
|
m_pTapAddition[i] = NULL;
|
2003-09-12 02:44:14 +00:00
|
|
|
m_pHoldHeadActive[i] = NULL;
|
|
|
|
|
m_pHoldHeadInactive[i] = NULL;
|
2003-09-23 01:24:20 +00:00
|
|
|
m_pHoldTailActive[i] = NULL;
|
|
|
|
|
m_pHoldTailInactive[i] = NULL;
|
2003-09-12 02:44:14 +00:00
|
|
|
}
|
|
|
|
|
m_pTapMine = NULL;
|
|
|
|
|
|
|
|
|
|
cache = new NoteMetricCache_t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NoteDisplay::~NoteDisplay()
|
|
|
|
|
{
|
|
|
|
|
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
|
|
|
|
|
{
|
|
|
|
|
delete m_pTapNote[i];
|
2003-12-29 03:51:15 +00:00
|
|
|
delete m_pTapAddition[i];
|
2003-09-12 02:44:14 +00:00
|
|
|
delete m_pHoldHeadActive[i];
|
|
|
|
|
delete m_pHoldHeadInactive[i];
|
2003-09-23 01:24:20 +00:00
|
|
|
delete m_pHoldTailActive[i];
|
|
|
|
|
delete m_pHoldTailInactive[i];
|
2003-09-12 02:44:14 +00:00
|
|
|
}
|
|
|
|
|
delete m_pTapMine;
|
|
|
|
|
|
|
|
|
|
delete cache;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-12 06:23:51 +00:00
|
|
|
void NoteDisplay::Load( int iColNum, PlayerNumber pn, CString NoteSkin, float fYReverseOffsetPixels )
|
2003-09-12 02:44:14 +00:00
|
|
|
{
|
|
|
|
|
m_PlayerNumber = pn;
|
|
|
|
|
m_fYReverseOffsetPixels = fYReverseOffsetPixels;
|
|
|
|
|
|
|
|
|
|
/* Normally, this is empty and we use the style table entry via ColToButtonName. */
|
2004-06-19 23:04:10 +00:00
|
|
|
NoteFieldMode &mode = g_NoteFieldMode[pn];
|
|
|
|
|
CString Button = mode.NoteButtonNames[iColNum];
|
2003-09-12 02:44:14 +00:00
|
|
|
if(Button == "")
|
|
|
|
|
Button = NoteSkinManager::ColToButtonName(iColNum);
|
|
|
|
|
|
2003-09-12 06:23:51 +00:00
|
|
|
cache->Load( NoteSkin, Button );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2003-02-06 07:32:57 +00:00
|
|
|
// Look up note names once and store them here.
|
|
|
|
|
CString sNoteType[ NOTE_COLOR_IMAGES ];
|
|
|
|
|
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
|
|
|
|
|
sNoteType[i] = NoteTypeToString( (NoteType)i );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
|
|
|
|
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_TAP] )
|
2003-02-06 07:32:57 +00:00
|
|
|
{
|
|
|
|
|
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
|
2003-12-31 21:40:38 +00:00
|
|
|
m_pTapNote[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "tap note "+sNoteType[i]) );
|
2003-02-06 07:32:57 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_pTapNote[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "tap note") );
|
2003-02-06 07:32:57 +00:00
|
|
|
}
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_ADDITION] )
|
2003-12-29 03:51:15 +00:00
|
|
|
{
|
|
|
|
|
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
|
2003-12-31 21:40:38 +00:00
|
|
|
m_pTapAddition[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "tap addition "+sNoteType[i]) );
|
2003-12-29 03:51:15 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_pTapAddition[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "tap addition") );
|
2003-12-29 03:51:15 +00:00
|
|
|
}
|
2003-08-10 06:00:30 +00:00
|
|
|
|
2003-12-31 21:40:38 +00:00
|
|
|
m_pTapMine = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "tap mine") );
|
2003-08-10 10:12:50 +00:00
|
|
|
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_HOLD_HEAD] )
|
2003-02-05 03:53:57 +00:00
|
|
|
{
|
2003-02-06 07:32:57 +00:00
|
|
|
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
|
|
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_pHoldHeadActive[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold head active "+sNoteType[i]) );
|
|
|
|
|
m_pHoldHeadInactive[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold head inactive "+sNoteType[i]) );
|
2003-02-06 07:32:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_pHoldHeadActive[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold head active") );
|
|
|
|
|
m_pHoldHeadInactive[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold head inactive") );
|
2003-02-05 03:53:57 +00:00
|
|
|
}
|
2003-02-06 07:32:57 +00:00
|
|
|
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_HOLD_TOP_CAP] )
|
2003-02-08 23:47:47 +00:00
|
|
|
{
|
|
|
|
|
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
|
|
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_sprHoldTopCapActive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold topcap active "+sNoteType[i]) );
|
|
|
|
|
m_sprHoldTopCapInactive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold topcap inactive "+sNoteType[i]) );
|
2003-02-08 23:47:47 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_sprHoldTopCapActive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold topcap active") );
|
|
|
|
|
m_sprHoldTopCapInactive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold topcap inactive") );
|
2003-02-08 23:47:47 +00:00
|
|
|
}
|
|
|
|
|
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_HOLD_BODY] )
|
2003-02-05 03:53:57 +00:00
|
|
|
{
|
2003-02-06 07:32:57 +00:00
|
|
|
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
|
2003-02-05 03:53:57 +00:00
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_sprHoldBodyActive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold body active "+sNoteType[i]) );
|
|
|
|
|
m_sprHoldBodyInactive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold body inactive "+sNoteType[i]) );
|
2003-02-05 03:53:57 +00:00
|
|
|
}
|
2003-02-06 07:32:57 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_sprHoldBodyActive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold body active") );
|
|
|
|
|
m_sprHoldBodyInactive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold body inactive") );
|
2003-02-06 07:32:57 +00:00
|
|
|
}
|
2003-02-05 03:53:57 +00:00
|
|
|
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_HOLD_BOTTOM_CAP] )
|
2003-02-08 23:47:47 +00:00
|
|
|
{
|
|
|
|
|
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
|
|
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_sprHoldBottomCapActive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold bottomcap active "+sNoteType[i]) );
|
|
|
|
|
m_sprHoldBottomCapInactive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold bottomcap inactive "+sNoteType[i]) );
|
2003-02-08 23:47:47 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_sprHoldBottomCapActive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold bottomcap active") );
|
|
|
|
|
m_sprHoldBottomCapInactive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold bottomcap inactive") );
|
2003-02-08 23:47:47 +00:00
|
|
|
}
|
|
|
|
|
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_HOLD_TAIL] )
|
2003-02-06 07:32:57 +00:00
|
|
|
{
|
|
|
|
|
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
|
|
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_pHoldTailActive[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold tail active "+sNoteType[i]) );
|
|
|
|
|
m_pHoldTailInactive[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold tail inactive "+sNoteType[i]) );
|
2003-02-06 07:32:57 +00:00
|
|
|
}
|
2003-02-05 03:53:57 +00:00
|
|
|
}
|
2003-02-06 07:32:57 +00:00
|
|
|
else
|
2003-02-05 03:53:57 +00:00
|
|
|
{
|
2003-12-31 21:40:38 +00:00
|
|
|
m_pHoldTailActive[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold tail active") );
|
|
|
|
|
m_pHoldTailInactive[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold tail inactive") );
|
2003-02-05 03:53:57 +00:00
|
|
|
}
|
2003-02-06 07:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
2004-03-01 05:58:19 +00:00
|
|
|
void NoteDisplay::Update( float fDeltaTime )
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for( i=0; i<NOTE_COLOR_IMAGES; i++ ) if(m_pTapNote[i]) m_pTapNote[i]->Update(fDeltaTime);
|
|
|
|
|
for( i=0; i<NOTE_COLOR_IMAGES; i++ ) if(m_pTapAddition[i]) m_pTapAddition[i]->Update(fDeltaTime);
|
|
|
|
|
m_pTapMine->Update(fDeltaTime);
|
|
|
|
|
for( i=0; i<NOTE_COLOR_IMAGES; i++ ) if(m_pHoldHeadActive[i]) m_pHoldHeadActive[i]->Update(fDeltaTime);
|
|
|
|
|
for( i=0; i<NOTE_COLOR_IMAGES; i++ ) if(m_pHoldHeadInactive[i]) m_pHoldHeadInactive[i]->Update(fDeltaTime);
|
|
|
|
|
for( i=0; i<NOTE_COLOR_IMAGES; i++ ) if(m_pHoldTailActive[i]) m_pHoldTailActive[i]->Update(fDeltaTime);
|
|
|
|
|
for( i=0; i<NOTE_COLOR_IMAGES; i++ ) if(m_pHoldTailInactive[i]) m_pHoldTailInactive[i]->Update(fDeltaTime);
|
|
|
|
|
}
|
2003-02-06 07:32:57 +00:00
|
|
|
|
2003-05-09 04:42:04 +00:00
|
|
|
void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor )
|
2003-02-06 07:32:57 +00:00
|
|
|
{
|
2003-05-09 04:42:04 +00:00
|
|
|
const int iNumFrames = actorToSet.GetNumStates();
|
2003-09-23 05:39:24 +00:00
|
|
|
if( iNumFrames == 0 ) // Model with no textures
|
|
|
|
|
return;
|
2003-09-16 00:47:52 +00:00
|
|
|
|
2003-02-06 07:32:57 +00:00
|
|
|
float fSongBeat = GAMESTATE->m_fSongBeat;
|
|
|
|
|
float fPrecentIntoAnimation = fmodf(fSongBeat,fAnimationLengthInBeats) / fAnimationLengthInBeats;
|
|
|
|
|
float fNoteBeatFraction = fmodf( fNoteBeat, 1.0f );
|
|
|
|
|
|
2003-02-07 01:23:35 +00:00
|
|
|
int iFrameNo = (int)(fPrecentIntoAnimation*iNumFrames);
|
2003-02-06 07:32:57 +00:00
|
|
|
if( bVivid )
|
2004-03-01 01:37:22 +00:00
|
|
|
{
|
2004-02-21 05:20:39 +00:00
|
|
|
// changed to deal with the minor complaint that the color cycling is
|
|
|
|
|
// one tick off in general
|
2004-03-01 01:37:22 +00:00
|
|
|
const float fFraction = fNoteBeatFraction - 0.25f/fAnimationLengthInBeats;
|
|
|
|
|
const float fInterval = 1.f / fAnimationLengthInBeats;
|
|
|
|
|
iFrameNo += int( froundf(fFraction,fInterval)*iNumFrames );
|
|
|
|
|
}
|
2003-02-06 07:32:57 +00:00
|
|
|
|
2004-02-25 08:22:57 +00:00
|
|
|
// just in case somehow we're majorly negative with the subtraction
|
|
|
|
|
iFrameNo += (iNumFrames * 2);
|
2003-02-06 07:32:57 +00:00
|
|
|
iFrameNo %= iNumFrames;
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2003-02-05 03:53:57 +00:00
|
|
|
ASSERT( iFrameNo>=0 && iFrameNo<iNumFrames );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2003-05-09 04:42:04 +00:00
|
|
|
actorToSet.SetState( iFrameNo );
|
2003-01-13 08:31:34 +00:00
|
|
|
}
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2003-05-09 04:42:04 +00:00
|
|
|
Actor * NoteDisplay::GetTapNoteActor( float fNoteBeat )
|
2003-02-05 03:53:57 +00:00
|
|
|
{
|
2003-02-08 23:47:47 +00:00
|
|
|
NoteType nt = NoteType(0);
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_TAP] )
|
2003-02-08 23:47:47 +00:00
|
|
|
nt = BeatToNoteType( fNoteBeat );
|
2003-11-13 07:35:58 +00:00
|
|
|
// NOTE_TYPE_INVALID is 192nds at this point.
|
2003-02-08 23:47:47 +00:00
|
|
|
if( nt == NOTE_TYPE_INVALID )
|
2003-11-13 07:35:58 +00:00
|
|
|
nt = NOTE_TYPE_192ND;
|
2003-11-06 07:17:31 +00:00
|
|
|
nt = min( nt, (NoteType) (NOTE_COLOR_IMAGES-1) );
|
|
|
|
|
|
2003-09-12 02:44:14 +00:00
|
|
|
Actor *pActorOut = m_pTapNote[nt];
|
2003-02-08 23:47:47 +00:00
|
|
|
|
|
|
|
|
SetActiveFrame(
|
|
|
|
|
fNoteBeat,
|
2003-05-09 04:42:04 +00:00
|
|
|
*pActorOut,
|
2004-04-16 05:21:25 +00:00
|
|
|
cache->m_fAnimationLengthInBeats[PART_TAP],
|
|
|
|
|
cache->m_bAnimationIsVivid[PART_TAP],
|
|
|
|
|
cache->m_bAnimationIsNoteColor[PART_TAP] );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2003-05-09 04:42:04 +00:00
|
|
|
return pActorOut;
|
2003-02-08 23:47:47 +00:00
|
|
|
}
|
2003-02-06 07:32:57 +00:00
|
|
|
|
2003-08-10 06:00:30 +00:00
|
|
|
Actor * NoteDisplay::GetTapAdditionActor( float fNoteBeat )
|
|
|
|
|
{
|
2003-12-29 03:51:15 +00:00
|
|
|
NoteType nt = NoteType(0);
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_ADDITION] )
|
2003-12-29 03:51:15 +00:00
|
|
|
nt = BeatToNoteType( fNoteBeat );
|
|
|
|
|
// NOTE_TYPE_INVALID is 192nds at this point.
|
|
|
|
|
if( nt == NOTE_TYPE_INVALID )
|
|
|
|
|
nt = NOTE_TYPE_192ND;
|
|
|
|
|
nt = min( nt, (NoteType) (NOTE_COLOR_IMAGES-1) );
|
|
|
|
|
|
|
|
|
|
Actor *pActorOut = m_pTapAddition[nt];
|
|
|
|
|
|
2003-08-10 06:00:30 +00:00
|
|
|
SetActiveFrame(
|
|
|
|
|
fNoteBeat,
|
2003-12-29 03:51:15 +00:00
|
|
|
*pActorOut,
|
2004-04-16 05:21:25 +00:00
|
|
|
cache->m_fAnimationLengthInBeats[PART_ADDITION],
|
|
|
|
|
cache->m_bAnimationIsVivid[PART_ADDITION],
|
|
|
|
|
cache->m_bAnimationIsNoteColor[PART_ADDITION] );
|
2003-08-10 06:00:30 +00:00
|
|
|
|
2003-12-29 03:51:15 +00:00
|
|
|
return pActorOut;
|
2003-08-10 06:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
2003-08-10 10:12:50 +00:00
|
|
|
Actor * NoteDisplay::GetTapMineActor( float fNoteBeat )
|
|
|
|
|
{
|
|
|
|
|
SetActiveFrame(
|
|
|
|
|
fNoteBeat,
|
2003-09-12 02:44:14 +00:00
|
|
|
*m_pTapMine,
|
2004-04-16 05:21:25 +00:00
|
|
|
cache->m_fAnimationLengthInBeats[PART_MINE],
|
|
|
|
|
cache->m_bAnimationIsVivid[PART_MINE],
|
2003-08-10 10:12:50 +00:00
|
|
|
false );
|
|
|
|
|
|
2003-09-12 02:44:14 +00:00
|
|
|
return m_pTapMine;
|
2003-08-10 10:12:50 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Sprite * NoteDisplay::GetHoldTopCapSprite( float fNoteBeat, bool bIsBeingHeld )
|
2003-02-08 23:47:47 +00:00
|
|
|
{
|
|
|
|
|
NoteType nt = NoteType(0);
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_HOLD_TOP_CAP] )
|
2003-02-08 23:47:47 +00:00
|
|
|
nt = BeatToNoteType( fNoteBeat );
|
2003-11-13 07:35:58 +00:00
|
|
|
// NOTE_TYPE_INVALID is 192nds at this point.
|
2003-02-08 23:47:47 +00:00
|
|
|
if( nt == NOTE_TYPE_INVALID )
|
2003-11-13 07:35:58 +00:00
|
|
|
nt = NOTE_TYPE_192ND;
|
2003-11-06 07:17:31 +00:00
|
|
|
nt = min( nt, (NoteType) (NOTE_COLOR_IMAGES-1) );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Sprite *pSpriteOut = bIsBeingHeld ? &m_sprHoldTopCapActive[nt] : &m_sprHoldTopCapInactive[nt];
|
2003-02-08 23:47:47 +00:00
|
|
|
|
|
|
|
|
SetActiveFrame(
|
2003-02-05 03:53:57 +00:00
|
|
|
fNoteBeat,
|
2003-02-08 23:47:47 +00:00
|
|
|
*pSpriteOut,
|
2004-04-16 05:21:25 +00:00
|
|
|
cache->m_fAnimationLengthInBeats[PART_HOLD_TOP_CAP],
|
|
|
|
|
cache->m_bAnimationIsVivid[PART_HOLD_TOP_CAP],
|
|
|
|
|
cache->m_bAnimationIsNoteColor[PART_HOLD_TOP_CAP] );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
|
|
|
|
return pSpriteOut;
|
2003-02-05 03:53:57 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Sprite * NoteDisplay::GetHoldBottomCapSprite( float fNoteBeat, bool bIsBeingHeld )
|
2003-02-05 03:53:57 +00:00
|
|
|
{
|
2003-02-08 23:47:47 +00:00
|
|
|
NoteType nt = NoteType(0);
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_HOLD_BOTTOM_CAP] )
|
2003-02-08 23:47:47 +00:00
|
|
|
nt = BeatToNoteType( fNoteBeat );
|
2003-11-13 07:35:58 +00:00
|
|
|
// NOTE_TYPE_INVALID is 192nds at this point.
|
2003-02-08 23:47:47 +00:00
|
|
|
if( nt == NOTE_TYPE_INVALID )
|
2003-11-13 07:35:58 +00:00
|
|
|
nt = NOTE_TYPE_192ND;
|
2003-11-06 07:17:31 +00:00
|
|
|
nt = min( nt, (NoteType) (NOTE_COLOR_IMAGES-1) );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Sprite *pSpriteOut = bIsBeingHeld ? &m_sprHoldBottomCapActive[nt] : &m_sprHoldBottomCapInactive[nt];
|
2003-02-08 23:47:47 +00:00
|
|
|
|
|
|
|
|
SetActiveFrame(
|
|
|
|
|
fNoteBeat,
|
|
|
|
|
*pSpriteOut,
|
2004-04-16 05:21:25 +00:00
|
|
|
cache->m_fAnimationLengthInBeats[PART_HOLD_BOTTOM_CAP],
|
|
|
|
|
cache->m_bAnimationIsVivid[PART_HOLD_BOTTOM_CAP],
|
|
|
|
|
cache->m_bAnimationIsNoteColor[PART_HOLD_BOTTOM_CAP] );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
|
|
|
|
return pSpriteOut;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Actor* NoteDisplay::GetHoldHeadActor( float fNoteBeat, bool bIsBeingHeld )
|
2003-02-08 23:47:47 +00:00
|
|
|
{
|
|
|
|
|
NoteType nt = NoteType(0);
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_HOLD_HEAD] )
|
2003-02-08 23:47:47 +00:00
|
|
|
nt = BeatToNoteType( fNoteBeat );
|
2003-11-13 07:35:58 +00:00
|
|
|
// NOTE_TYPE_INVALID is 192nds at this point.
|
2003-02-08 23:47:47 +00:00
|
|
|
if( nt == NOTE_TYPE_INVALID )
|
2003-11-13 07:35:58 +00:00
|
|
|
nt = NOTE_TYPE_192ND;
|
2003-11-06 07:17:31 +00:00
|
|
|
nt = min( nt, (NoteType) (NOTE_COLOR_IMAGES-1) );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Actor *pActorOut = bIsBeingHeld ? m_pHoldHeadActive[nt] : m_pHoldHeadInactive[nt];
|
2003-02-06 07:32:57 +00:00
|
|
|
|
2003-02-08 23:47:47 +00:00
|
|
|
SetActiveFrame(
|
2003-02-05 03:53:57 +00:00
|
|
|
fNoteBeat,
|
2003-05-09 04:42:04 +00:00
|
|
|
*pActorOut,
|
2004-04-16 05:21:25 +00:00
|
|
|
cache->m_fAnimationLengthInBeats[PART_HOLD_HEAD],
|
|
|
|
|
cache->m_bAnimationIsVivid[PART_HOLD_HEAD],
|
|
|
|
|
cache->m_bAnimationIsNoteColor[PART_HOLD_HEAD] );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2003-05-09 04:42:04 +00:00
|
|
|
return pActorOut;
|
2003-02-05 03:53:57 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Sprite *NoteDisplay::GetHoldBodySprite( float fNoteBeat, bool bIsBeingHeld )
|
2003-02-05 03:53:57 +00:00
|
|
|
{
|
2003-02-08 23:47:47 +00:00
|
|
|
NoteType nt = NoteType(0);
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_HOLD_BODY] )
|
2003-02-08 23:47:47 +00:00
|
|
|
nt = BeatToNoteType( fNoteBeat );
|
2003-11-13 07:35:58 +00:00
|
|
|
// NOTE_TYPE_INVALID is 192nds at this point.
|
2003-02-08 23:47:47 +00:00
|
|
|
if( nt == NOTE_TYPE_INVALID )
|
2003-11-13 07:35:58 +00:00
|
|
|
nt = NOTE_TYPE_192ND;
|
2003-11-06 07:17:31 +00:00
|
|
|
nt = min( nt, (NoteType) (NOTE_COLOR_IMAGES-1) );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Sprite *pSpriteOut = bIsBeingHeld ? &m_sprHoldBodyActive[nt] : &m_sprHoldBodyInactive[nt];
|
2003-02-06 07:32:57 +00:00
|
|
|
|
2003-02-08 23:47:47 +00:00
|
|
|
SetActiveFrame(
|
2003-02-05 03:53:57 +00:00
|
|
|
fNoteBeat,
|
2003-02-08 23:47:47 +00:00
|
|
|
*pSpriteOut,
|
2004-04-16 05:21:25 +00:00
|
|
|
cache->m_fAnimationLengthInBeats[PART_HOLD_BODY],
|
|
|
|
|
cache->m_bAnimationIsVivid[PART_HOLD_BODY],
|
|
|
|
|
cache->m_bAnimationIsNoteColor[PART_HOLD_BODY] );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
|
|
|
|
return pSpriteOut;
|
2003-02-05 03:53:57 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Actor* NoteDisplay::GetHoldTailActor( float fNoteBeat, bool bIsBeingHeld )
|
2003-02-05 03:53:57 +00:00
|
|
|
{
|
2003-02-08 23:47:47 +00:00
|
|
|
NoteType nt = NoteType(0);
|
2004-04-16 05:21:25 +00:00
|
|
|
if( cache->m_bAnimationIsNoteColor[PART_HOLD_TAIL] )
|
2003-02-08 23:47:47 +00:00
|
|
|
nt = BeatToNoteType( fNoteBeat );
|
2003-11-13 07:35:58 +00:00
|
|
|
// NOTE_TYPE_INVALID is 192nds at this point.
|
2003-02-08 23:47:47 +00:00
|
|
|
if( nt == NOTE_TYPE_INVALID )
|
2003-11-13 07:35:58 +00:00
|
|
|
nt = NOTE_TYPE_192ND;
|
2003-11-06 07:19:46 +00:00
|
|
|
nt = min( nt, (NoteType) (NOTE_COLOR_IMAGES-1) );
|
2003-02-06 07:32:57 +00:00
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Actor *pActorOut = bIsBeingHeld ? m_pHoldTailActive[nt] : m_pHoldTailInactive[nt];
|
2003-02-06 07:32:57 +00:00
|
|
|
|
2003-02-08 23:47:47 +00:00
|
|
|
SetActiveFrame(
|
2003-02-05 03:53:57 +00:00
|
|
|
fNoteBeat,
|
2003-07-09 05:57:48 +00:00
|
|
|
*pActorOut,
|
2004-04-16 05:21:25 +00:00
|
|
|
cache->m_fAnimationLengthInBeats[PART_HOLD_TAIL],
|
|
|
|
|
cache->m_bAnimationIsVivid[PART_HOLD_TAIL],
|
|
|
|
|
cache->m_bAnimationIsNoteColor[PART_HOLD_TAIL] );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2003-07-09 05:57:48 +00:00
|
|
|
return pActorOut;
|
2003-02-05 03:53:57 +00:00
|
|
|
}
|
|
|
|
|
|
2004-04-16 03:05:16 +00:00
|
|
|
static float ArrowGetAlphaOrGlow( bool bGlow, PlayerNumber pn, int iCol, float fYOffset, float fPercentFadeToFail, float fYReverseOffsetPixels )
|
|
|
|
|
{
|
|
|
|
|
if( bGlow )
|
|
|
|
|
return ArrowGetGlow( pn, iCol, fYOffset, fPercentFadeToFail, fYReverseOffsetPixels );
|
|
|
|
|
else
|
|
|
|
|
return ArrowGetAlpha( pn, iCol, fYOffset, fPercentFadeToFail, fYReverseOffsetPixels );
|
|
|
|
|
}
|
2003-02-05 03:53:57 +00:00
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
void NoteDisplay::DrawHoldTopCap( const HoldNote& hn, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, int iCol, float fPercentFadeToFail, float fColorScale, bool bGlow )
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
2003-02-05 03:53:57 +00:00
|
|
|
//
|
2003-07-17 06:10:25 +00:00
|
|
|
// Draw the top cap (always wavy)
|
2003-02-05 03:53:57 +00:00
|
|
|
//
|
2003-06-28 02:15:27 +00:00
|
|
|
const int size = 4096;
|
2003-07-07 01:29:18 +00:00
|
|
|
static RageSpriteVertex queue[size];
|
2004-01-01 02:14:01 +00:00
|
|
|
Sprite* pSprTopCap = GetHoldTopCapSprite( hn.GetStartBeat(), bIsBeingHeld );
|
2003-07-17 06:10:25 +00:00
|
|
|
|
2004-06-08 22:27:37 +00:00
|
|
|
pSprTopCap->SetZoom( ArrowGetZoom( m_PlayerNumber ) );
|
|
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
// draw manually in small segments
|
|
|
|
|
RageSpriteVertex *v = &queue[0];
|
|
|
|
|
RageTexture* pTexture = pSprTopCap->GetTexture();
|
|
|
|
|
const RectF *pRect = pSprTopCap->GetCurrentTextureCoordRect();
|
2004-02-04 09:55:18 +00:00
|
|
|
DISPLAY->ClearAllTextures();
|
|
|
|
|
DISPLAY->SetTexture( 0, pTexture );
|
2003-07-17 06:10:25 +00:00
|
|
|
DISPLAY->SetBlendMode( BLEND_NORMAL );
|
2004-02-04 11:05:33 +00:00
|
|
|
DISPLAY->SetCullMode( CULL_NONE );
|
2003-07-17 06:10:25 +00:00
|
|
|
DISPLAY->SetTextureWrapping(false);
|
|
|
|
|
|
2004-06-08 19:04:26 +00:00
|
|
|
const float fFrameWidth = pSprTopCap->GetZoomedWidth();
|
|
|
|
|
const float fFrameHeight = pSprTopCap->GetZoomedHeight();
|
2003-07-17 06:10:25 +00:00
|
|
|
const float fYCapTop = fYHead+cache->m_iStartDrawingHoldBodyOffsetFromHead-fFrameHeight;
|
|
|
|
|
const float fYCapBottom = fYHead+cache->m_iStartDrawingHoldBodyOffsetFromHead;
|
|
|
|
|
|
2004-04-16 03:05:16 +00:00
|
|
|
if( bGlow )
|
|
|
|
|
fColorScale = 1;
|
|
|
|
|
|
|
|
|
|
bool bAllAreTransparent = true;
|
2004-04-13 07:47:10 +00:00
|
|
|
bool bLast = false;
|
2004-05-04 05:49:35 +00:00
|
|
|
// don't draw any part of the head that is after the middle of the tail
|
|
|
|
|
float fY = fYCapTop;
|
|
|
|
|
float fYStop = min(fYTail,fYCapBottom);
|
|
|
|
|
for( ; !bLast; fY+=fYStep )
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
2004-05-04 05:49:35 +00:00
|
|
|
if( fY >= fYStop )
|
2004-04-13 07:47:10 +00:00
|
|
|
{
|
2004-05-04 05:49:35 +00:00
|
|
|
fY = fYStop;
|
2004-04-13 07:47:10 +00:00
|
|
|
bLast = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const float fYOffset = ArrowGetYOffsetFromYPos( m_PlayerNumber, iCol, fY, m_fYReverseOffsetPixels );
|
|
|
|
|
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fXLeft = fX - fFrameWidth/2;
|
|
|
|
|
const float fXRight = fX + fFrameWidth/2;
|
|
|
|
|
const float fTopDistFromHeadTop = fY - fYCapTop;
|
2003-07-17 06:10:25 +00:00
|
|
|
const float fTexCoordTop = SCALE( fTopDistFromHeadTop, 0, fFrameHeight, pRect->top, pRect->bottom );
|
|
|
|
|
const float fTexCoordLeft = pRect->left;
|
|
|
|
|
const float fTexCoordRight = pRect->right;
|
2004-04-16 03:05:16 +00:00
|
|
|
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
|
|
|
|
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
|
|
|
|
|
|
|
|
|
if( fAlpha > 0 )
|
|
|
|
|
bAllAreTransparent = false;
|
2004-04-13 07:47:10 +00:00
|
|
|
|
2004-04-16 03:05:16 +00:00
|
|
|
v[0].p = RageVector3(fXLeft, fY, fZ); v[0].c = color; v[0].t = RageVector2(fTexCoordLeft, fTexCoordTop),
|
|
|
|
|
v[1].p = RageVector3(fXRight, fY, fZ); v[1].c = color; v[1].t = RageVector2(fTexCoordRight, fTexCoordTop);
|
2004-04-13 07:47:10 +00:00
|
|
|
v+=2;
|
2003-07-17 06:10:25 +00:00
|
|
|
if( v-queue >= size )
|
|
|
|
|
break;
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
2004-04-16 03:05:16 +00:00
|
|
|
if( !bAllAreTransparent )
|
|
|
|
|
DISPLAY->DrawQuadStrip( queue, v-queue );
|
2003-07-17 06:10:25 +00:00
|
|
|
}
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
void NoteDisplay::DrawHoldBody( const HoldNote& hn, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, int iCol, float fPercentFadeToFail, float fColorScale, bool bGlow )
|
2003-07-17 06:10:25 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
//
|
2003-02-05 03:53:57 +00:00
|
|
|
// Draw the body (always wavy)
|
2002-08-13 23:26:46 +00:00
|
|
|
//
|
2003-07-17 06:10:25 +00:00
|
|
|
const int size = 4096;
|
|
|
|
|
static RageSpriteVertex queue[size];
|
|
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Sprite* pSprBody = GetHoldBodySprite( hn.GetStartBeat(), bIsBeingHeld );
|
2003-07-17 06:10:25 +00:00
|
|
|
|
2004-06-08 22:27:37 +00:00
|
|
|
pSprBody->SetZoom( ArrowGetZoom( m_PlayerNumber ) );
|
|
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
// draw manually in small segments
|
|
|
|
|
RageSpriteVertex *v = &queue[0];
|
|
|
|
|
RageTexture* pTexture = pSprBody->GetTexture();
|
|
|
|
|
const RectF *pRect = pSprBody->GetCurrentTextureCoordRect();
|
2004-02-04 09:55:18 +00:00
|
|
|
DISPLAY->ClearAllTextures();
|
|
|
|
|
DISPLAY->SetTexture( 0, pTexture );
|
2003-07-17 06:10:25 +00:00
|
|
|
DISPLAY->SetBlendMode( BLEND_NORMAL );
|
2004-02-04 11:05:33 +00:00
|
|
|
DISPLAY->SetCullMode( CULL_NONE );
|
2003-07-17 06:10:25 +00:00
|
|
|
DISPLAY->SetTextureWrapping( true );
|
|
|
|
|
|
|
|
|
|
|
2004-06-08 19:04:26 +00:00
|
|
|
const float fFrameWidth = pSprBody->GetZoomedWidth();
|
|
|
|
|
const float fFrameHeight = pSprBody->GetZoomedHeight();
|
2003-07-17 06:10:25 +00:00
|
|
|
const float fYBodyTop = fYHead + cache->m_iStartDrawingHoldBodyOffsetFromHead;
|
|
|
|
|
const float fYBodyBottom = fYTail + cache->m_iStopDrawingHoldBodyOffsetFromTail;
|
2004-06-07 20:54:21 +00:00
|
|
|
|
2003-12-31 23:47:01 +00:00
|
|
|
const bool bReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(iCol) > 0.5;
|
|
|
|
|
bool bAnchorToBottom = bReverse && cache->m_bFlipHeadAndTailWhenReverse;
|
|
|
|
|
|
2004-04-16 03:05:16 +00:00
|
|
|
if( bGlow )
|
|
|
|
|
fColorScale = 1;
|
|
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
// top to bottom
|
2004-04-16 03:05:16 +00:00
|
|
|
bool bAllAreTransparent = true;
|
2004-04-13 07:47:10 +00:00
|
|
|
bool bLast = false;
|
|
|
|
|
for( float fY = fYBodyTop; !bLast; fY += fYStep )
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
2004-04-13 07:47:10 +00:00
|
|
|
if( fY >= fYBodyBottom )
|
2003-12-31 23:47:01 +00:00
|
|
|
{
|
2004-04-13 07:47:10 +00:00
|
|
|
fY = fYBodyBottom;
|
|
|
|
|
bLast = true;
|
2003-07-17 06:10:25 +00:00
|
|
|
}
|
2004-04-13 07:47:10 +00:00
|
|
|
|
|
|
|
|
const float fYOffset = ArrowGetYOffsetFromYPos( m_PlayerNumber, iCol, fY, m_fYReverseOffsetPixels );
|
|
|
|
|
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fXLeft = fX - fFrameWidth/2;
|
|
|
|
|
const float fXRight = fX + fFrameWidth/2;
|
|
|
|
|
const float fDistFromBodyBottom = fYBodyBottom - fY;
|
|
|
|
|
const float fDistFromBodyTop = fY - fYBodyTop;
|
|
|
|
|
const float fTexCoordTop = SCALE( bAnchorToBottom ? fDistFromBodyTop : fDistFromBodyBottom, 0, fFrameHeight, pRect->bottom, pRect->top );
|
|
|
|
|
const float fTexCoordLeft = pRect->left;
|
|
|
|
|
const float fTexCoordRight = pRect->right;
|
2004-04-16 03:05:16 +00:00
|
|
|
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
|
|
|
|
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
|
|
|
|
|
|
|
|
|
if( fAlpha > 0 )
|
|
|
|
|
bAllAreTransparent = false;
|
2004-04-13 07:47:10 +00:00
|
|
|
|
2004-04-16 03:05:16 +00:00
|
|
|
v[0].p = RageVector3(fXLeft, fY, fZ); v[0].c = color; v[0].t = RageVector2(fTexCoordLeft, fTexCoordTop);
|
|
|
|
|
v[1].p = RageVector3(fXRight, fY, fZ); v[1].c = color; v[1].t = RageVector2(fTexCoordRight, fTexCoordTop);
|
2004-04-13 07:47:10 +00:00
|
|
|
v+=2;
|
2003-07-17 06:10:25 +00:00
|
|
|
if( v-queue >= size )
|
|
|
|
|
break;
|
2004-04-13 07:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
2004-04-16 03:05:16 +00:00
|
|
|
if( !bAllAreTransparent )
|
|
|
|
|
DISPLAY->DrawQuadStrip( queue, v-queue );
|
2003-07-17 06:10:25 +00:00
|
|
|
}
|
2003-02-05 03:53:57 +00:00
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
void NoteDisplay::DrawHoldBottomCap( const HoldNote& hn, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, int iCol, float fPercentFadeToFail, float fColorScale, bool bGlow )
|
2003-07-17 06:10:25 +00:00
|
|
|
{
|
2003-02-08 23:47:47 +00:00
|
|
|
//
|
2003-07-17 06:10:25 +00:00
|
|
|
// Draw the bottom cap (always wavy)
|
2003-02-08 23:47:47 +00:00
|
|
|
//
|
2003-07-17 06:10:25 +00:00
|
|
|
const int size = 4096;
|
|
|
|
|
static RageSpriteVertex queue[size];
|
|
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
Sprite* pBottomCap = GetHoldBottomCapSprite( hn.GetStartBeat(), bIsBeingHeld );
|
2003-07-17 06:10:25 +00:00
|
|
|
|
2004-06-08 22:27:37 +00:00
|
|
|
pBottomCap->SetZoom( ArrowGetZoom( m_PlayerNumber ) );
|
|
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
// draw manually in small segments
|
|
|
|
|
RageSpriteVertex *v = &queue[0];
|
|
|
|
|
RageTexture* pTexture = pBottomCap->GetTexture();
|
|
|
|
|
const RectF *pRect = pBottomCap->GetCurrentTextureCoordRect();
|
2004-02-04 09:55:18 +00:00
|
|
|
DISPLAY->ClearAllTextures();
|
|
|
|
|
DISPLAY->SetTexture( 0, pTexture );
|
2003-07-17 06:10:25 +00:00
|
|
|
DISPLAY->SetBlendMode( BLEND_NORMAL );
|
2004-02-04 11:05:33 +00:00
|
|
|
DISPLAY->SetCullMode( CULL_NONE );
|
2003-07-17 06:10:25 +00:00
|
|
|
DISPLAY->SetTextureWrapping(false);
|
|
|
|
|
|
2004-06-08 19:04:26 +00:00
|
|
|
const float fFrameWidth = pBottomCap->GetZoomedWidth();
|
|
|
|
|
const float fFrameHeight = pBottomCap->GetZoomedHeight();
|
2003-07-17 06:10:25 +00:00
|
|
|
const float fYCapTop = fYTail+cache->m_iStopDrawingHoldBodyOffsetFromTail;
|
|
|
|
|
const float fYCapBottom = fYTail+cache->m_iStopDrawingHoldBodyOffsetFromTail+fFrameHeight;
|
|
|
|
|
|
2004-04-16 03:05:16 +00:00
|
|
|
if( bGlow )
|
|
|
|
|
fColorScale = 1;
|
|
|
|
|
|
|
|
|
|
bool bAllAreTransparent = true;
|
2004-04-13 07:47:10 +00:00
|
|
|
bool bLast = false;
|
2004-05-04 05:49:35 +00:00
|
|
|
// don't draw any part of the tail that is before the middle of the head
|
2003-07-17 06:10:25 +00:00
|
|
|
float fY=max( fYCapTop, fYHead );
|
2004-04-13 07:47:10 +00:00
|
|
|
for( ; !bLast; fY += fYStep )
|
2003-02-08 23:47:47 +00:00
|
|
|
{
|
2004-04-13 07:47:10 +00:00
|
|
|
if( fY >= fYCapBottom )
|
|
|
|
|
{
|
|
|
|
|
fY = fYCapBottom;
|
|
|
|
|
bLast = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const float fYOffset = ArrowGetYOffsetFromYPos( m_PlayerNumber, iCol, fY, m_fYReverseOffsetPixels );
|
|
|
|
|
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fXLeft = fX - fFrameWidth/2;
|
|
|
|
|
const float fXRight = fX + fFrameWidth/2;
|
|
|
|
|
const float fTopDistFromTail = fY - fYCapTop;
|
|
|
|
|
const float fTexCoordTop = SCALE( fTopDistFromTail, 0, fFrameHeight, pRect->top, pRect->bottom );
|
2003-07-17 06:10:25 +00:00
|
|
|
const float fTexCoordLeft = pRect->left;
|
|
|
|
|
const float fTexCoordRight = pRect->right;
|
2004-04-16 03:05:16 +00:00
|
|
|
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
|
|
|
|
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
|
|
|
|
|
|
|
|
|
if( fAlpha > 0 )
|
|
|
|
|
bAllAreTransparent = false;
|
2004-04-13 07:47:10 +00:00
|
|
|
|
2004-04-16 03:05:16 +00:00
|
|
|
v[0].p = RageVector3(fXLeft, fY, fZ); v[0].c = color; v[0].t = RageVector2(fTexCoordLeft, fTexCoordTop),
|
|
|
|
|
v[1].p = RageVector3(fXRight, fY, fZ); v[1].c = color; v[1].t = RageVector2(fTexCoordRight, fTexCoordTop);
|
2004-04-13 07:47:10 +00:00
|
|
|
v+=2;
|
2003-07-17 06:10:25 +00:00
|
|
|
if( v-queue >= size )
|
|
|
|
|
break;
|
2003-02-08 23:47:47 +00:00
|
|
|
}
|
2004-04-16 03:05:16 +00:00
|
|
|
if( !bAllAreTransparent )
|
|
|
|
|
DISPLAY->DrawQuadStrip( queue, v-queue );
|
2003-07-17 06:10:25 +00:00
|
|
|
}
|
2003-02-05 03:53:57 +00:00
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
void NoteDisplay::DrawHoldTail( const HoldNote& hn, bool bIsBeingHeld, float fYTail, int iCol, float fPercentFadeToFail, float fColorScale, bool bGlow )
|
2003-07-17 06:10:25 +00:00
|
|
|
{
|
2003-02-05 03:53:57 +00:00
|
|
|
//
|
2003-02-08 23:47:47 +00:00
|
|
|
// Draw the tail
|
2003-02-05 03:53:57 +00:00
|
|
|
//
|
2004-01-01 02:14:01 +00:00
|
|
|
Actor* pSprTail = GetHoldTailActor( hn.GetStartBeat(), bIsBeingHeld );
|
2003-07-17 06:10:25 +00:00
|
|
|
|
2004-06-17 21:42:00 +00:00
|
|
|
pSprTail->SetZoom( ArrowGetZoom( m_PlayerNumber ) );
|
|
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
const float fY = fYTail;
|
2003-09-30 03:14:09 +00:00
|
|
|
const float fYOffset = ArrowGetYOffsetFromYPos( m_PlayerNumber, iCol, fY, m_fYReverseOffsetPixels );
|
|
|
|
|
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
|
|
|
|
const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
2003-07-17 06:10:25 +00:00
|
|
|
const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
|
|
|
|
const RageColor colorGlow = RageColor(1,1,1,fGlow);
|
|
|
|
|
|
|
|
|
|
pSprTail->SetXY( fX, fY );
|
|
|
|
|
pSprTail->SetZ( fZ );
|
|
|
|
|
|
|
|
|
|
if( bGlow )
|
2002-09-17 23:02:37 +00:00
|
|
|
{
|
2003-07-17 06:10:25 +00:00
|
|
|
pSprTail->SetDiffuse( RageColor(1,1,1,0) );
|
|
|
|
|
pSprTail->SetGlow( colorGlow );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pSprTail->SetDiffuse( colorDiffuse );
|
|
|
|
|
pSprTail->SetGlow( RageColor(0,0,0,0) );
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
2003-07-17 06:11:32 +00:00
|
|
|
|
2003-12-31 08:15:34 +00:00
|
|
|
if( cache->m_bHoldTailUseLighting )
|
2003-07-17 06:11:32 +00:00
|
|
|
{
|
|
|
|
|
DISPLAY->SetLighting( true );
|
|
|
|
|
DISPLAY->SetLightDirectional(
|
|
|
|
|
0,
|
2003-12-31 03:42:59 +00:00
|
|
|
RageColor(1,1,1,1),
|
2003-07-17 06:11:32 +00:00
|
|
|
RageColor(1,1,1,1),
|
|
|
|
|
RageColor(1,1,1,1),
|
|
|
|
|
RageVector3(1, 0, +1) );
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
pSprTail->Draw();
|
2003-07-17 06:11:32 +00:00
|
|
|
|
2003-12-31 08:15:34 +00:00
|
|
|
if( cache->m_bHoldTailUseLighting )
|
2003-07-17 06:11:32 +00:00
|
|
|
{
|
|
|
|
|
DISPLAY->SetLightOff( 0 );
|
|
|
|
|
DISPLAY->SetLighting( false );
|
|
|
|
|
}
|
2003-07-17 06:10:25 +00:00
|
|
|
}
|
2002-08-29 01:38:21 +00:00
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
void NoteDisplay::DrawHoldHead( const HoldNote& hn, bool bIsBeingHeld, float fYHead, int iCol, float fPercentFadeToFail, float fColorScale, bool bGlow )
|
2003-07-17 06:10:25 +00:00
|
|
|
{
|
2003-02-08 23:47:47 +00:00
|
|
|
//
|
|
|
|
|
// Draw the head
|
|
|
|
|
//
|
2004-01-01 02:14:01 +00:00
|
|
|
Actor* pActor = GetHoldHeadActor( hn.GetStartBeat(), bIsBeingHeld );
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2004-06-17 21:42:00 +00:00
|
|
|
pActor->SetZoom( ArrowGetZoom( m_PlayerNumber ) );
|
|
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
// draw with normal Sprite
|
|
|
|
|
const float fY = fYHead;
|
2003-09-30 03:14:09 +00:00
|
|
|
const float fYOffset = ArrowGetYOffsetFromYPos( m_PlayerNumber, iCol, fY, m_fYReverseOffsetPixels );
|
|
|
|
|
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
|
|
|
|
const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
2003-07-17 06:10:25 +00:00
|
|
|
const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
|
|
|
|
const RageColor colorGlow = RageColor(1,1,1,fGlow);
|
2003-02-08 23:47:47 +00:00
|
|
|
|
2004-03-20 19:15:15 +00:00
|
|
|
pActor->SetRotationZ( 0 );
|
2003-07-17 06:10:25 +00:00
|
|
|
pActor->SetXY( fX, fY );
|
|
|
|
|
pActor->SetZ( fZ );
|
2003-07-09 00:49:05 +00:00
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
if( bGlow )
|
|
|
|
|
{
|
|
|
|
|
pActor->SetDiffuse( RageColor(1,1,1,0) );
|
|
|
|
|
pActor->SetGlow( colorGlow );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pActor->SetDiffuse( colorDiffuse );
|
|
|
|
|
pActor->SetGlow( RageColor(0,0,0,0) );
|
|
|
|
|
}
|
2003-07-10 03:38:45 +00:00
|
|
|
|
2003-12-31 08:15:34 +00:00
|
|
|
if( cache->m_bHoldHeadUseLighting )
|
2003-07-17 06:10:25 +00:00
|
|
|
{
|
|
|
|
|
DISPLAY->SetLighting( true );
|
|
|
|
|
DISPLAY->SetLightDirectional(
|
|
|
|
|
0,
|
2003-12-31 03:42:59 +00:00
|
|
|
RageColor(1,1,1,1),
|
2003-07-17 06:10:25 +00:00
|
|
|
RageColor(1,1,1,1),
|
|
|
|
|
RageColor(1,1,1,1),
|
|
|
|
|
RageVector3(1, 0, +1) );
|
|
|
|
|
}
|
2003-07-10 03:38:45 +00:00
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
pActor->Draw();
|
2003-07-10 03:38:45 +00:00
|
|
|
|
2003-12-31 08:15:34 +00:00
|
|
|
if( cache->m_bHoldHeadUseLighting )
|
2003-07-17 06:10:25 +00:00
|
|
|
{
|
|
|
|
|
DISPLAY->SetLightOff( 0 );
|
|
|
|
|
DISPLAY->SetLighting( false );
|
2003-02-08 23:47:47 +00:00
|
|
|
}
|
2003-07-17 06:10:25 +00:00
|
|
|
}
|
|
|
|
|
|
2004-05-07 04:57:29 +00:00
|
|
|
void NoteDisplay::DrawHold( const HoldNote& hn, bool bIsBeingHeld, bool bIsActive, const HoldNoteResult &Result, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels )
|
2003-07-17 06:10:25 +00:00
|
|
|
{
|
|
|
|
|
// bDrawGlowOnly is a little hacky. We need to draw the diffuse part and the glow part one pass at a time to minimize state changes
|
|
|
|
|
|
2004-01-01 02:14:01 +00:00
|
|
|
int iCol = hn.iTrack;
|
|
|
|
|
bool bReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(iCol) > 0.5;
|
2004-05-07 04:57:29 +00:00
|
|
|
float fStartYOffset = ArrowGetYOffset( m_PlayerNumber, iCol, Result.GetLastHeldBeat() );
|
2004-01-01 02:14:01 +00:00
|
|
|
|
|
|
|
|
// HACK: If active, don't allow the top of the hold to go above the receptor
|
|
|
|
|
if( bIsActive )
|
|
|
|
|
fStartYOffset = 0;
|
|
|
|
|
|
|
|
|
|
float fStartYPos = ArrowGetYPos( m_PlayerNumber, iCol, fStartYOffset, fReverseOffsetPixels );
|
|
|
|
|
float fEndYOffset = ArrowGetYOffset( m_PlayerNumber, iCol, hn.GetEndBeat() );
|
|
|
|
|
float fEndYPos = ArrowGetYPos( m_PlayerNumber, iCol, fEndYOffset, fReverseOffsetPixels );
|
2003-07-17 06:10:25 +00:00
|
|
|
|
|
|
|
|
const float fYHead = bReverse ? fEndYPos : fStartYPos; // the center of the head
|
|
|
|
|
const float fYTail = bReverse ? fStartYPos : fEndYPos; // the center the tail
|
|
|
|
|
|
|
|
|
|
// const bool bWavy = GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fEffects[PlayerOptions::EFFECT_DRUNK] > 0;
|
|
|
|
|
const bool WavyPartsNeedZBuffer = ArrowsNeedZBuffer( m_PlayerNumber );
|
|
|
|
|
/* Hack: Z effects need a finer grain step. */
|
|
|
|
|
const int fYStep = WavyPartsNeedZBuffer? 4: 16; //bWavy ? 16 : 128; // use small steps only if wavy
|
|
|
|
|
|
2004-05-07 04:57:29 +00:00
|
|
|
const float fColorScale = 1*Result.fLife + (1-Result.fLife)*cache->m_fHoldNGGrayPercent;
|
2003-07-17 06:10:25 +00:00
|
|
|
|
2003-10-19 07:47:16 +00:00
|
|
|
bool bFlipHeadAndTail = bReverse && cache->m_bFlipHeadAndTailWhenReverse;
|
|
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
/* The body and caps should have no overlap, so their order doesn't matter.
|
|
|
|
|
* Draw the head last, so it appears on top. */
|
2003-07-17 07:37:56 +00:00
|
|
|
if( !cache->m_bHoldHeadIsAboveWavyParts )
|
2004-01-01 02:14:01 +00:00
|
|
|
DrawHoldHead( hn, bIsBeingHeld, bFlipHeadAndTail ? fYTail : fYHead, iCol, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
2003-07-17 07:37:56 +00:00
|
|
|
if( !cache->m_bHoldTailIsAboveWavyParts )
|
2004-01-01 02:14:01 +00:00
|
|
|
DrawHoldTail( hn, bIsBeingHeld, bFlipHeadAndTail ? fYHead : fYTail, iCol, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
2003-07-17 07:37:56 +00:00
|
|
|
|
2003-07-17 06:10:25 +00:00
|
|
|
if( bDrawGlowOnly )
|
|
|
|
|
DISPLAY->SetTextureModeGlow();
|
|
|
|
|
else
|
|
|
|
|
DISPLAY->SetTextureModeModulate();
|
2004-05-15 18:35:03 +00:00
|
|
|
DISPLAY->SetZTestMode( WavyPartsNeedZBuffer?ZTEST_WRITE_ON_PASS:ZTEST_OFF );
|
|
|
|
|
DISPLAY->SetZWrite( WavyPartsNeedZBuffer );
|
2004-01-01 00:03:14 +00:00
|
|
|
|
|
|
|
|
if( !bFlipHeadAndTail )
|
2004-01-01 02:14:01 +00:00
|
|
|
DrawHoldBottomCap( hn, bIsBeingHeld, fYHead, fYTail, fYStep, iCol, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
|
|
|
|
DrawHoldBody( hn, bIsBeingHeld, fYHead, fYTail, fYStep, iCol, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
2004-01-01 00:03:14 +00:00
|
|
|
if( bFlipHeadAndTail )
|
2004-01-01 02:14:01 +00:00
|
|
|
DrawHoldTopCap( hn, bIsBeingHeld, fYHead, fYTail, fYStep, iCol, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
2003-07-17 06:10:25 +00:00
|
|
|
|
|
|
|
|
/* These set the texture mode themselves. */
|
2003-07-17 07:37:56 +00:00
|
|
|
if( cache->m_bHoldTailIsAboveWavyParts )
|
2004-01-01 02:14:01 +00:00
|
|
|
DrawHoldTail( hn, bIsBeingHeld, bFlipHeadAndTail ? fYHead : fYTail, iCol, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
2003-07-17 07:37:56 +00:00
|
|
|
if( cache->m_bHoldHeadIsAboveWavyParts )
|
2004-01-01 02:14:01 +00:00
|
|
|
DrawHoldHead( hn, bIsBeingHeld, bFlipHeadAndTail ? fYTail : fYHead, iCol, fPercentFadeToFail, fColorScale, bDrawGlowOnly );
|
2002-09-17 23:02:37 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
// now, draw the glow pass
|
2002-08-29 01:38:21 +00:00
|
|
|
if( !bDrawGlowOnly )
|
2004-05-07 04:57:29 +00:00
|
|
|
DrawHold( hn, bIsBeingHeld, bIsActive, Result, fPercentFadeToFail, true, fReverseOffsetPixels );
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
2003-12-31 08:15:34 +00:00
|
|
|
void NoteDisplay::DrawActor( Actor* pActor, int iCol, float fBeat, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels, bool bUseLighting )
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
2003-08-16 23:34:47 +00:00
|
|
|
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, iCol, fBeat );
|
|
|
|
|
const float fYPos = ArrowGetYPos( m_PlayerNumber, iCol, fYOffset, fReverseOffsetPixels );
|
2003-02-12 22:05:14 +00:00
|
|
|
const float fRotation = ArrowGetRotation( m_PlayerNumber, fBeat );
|
2003-09-30 03:14:09 +00:00
|
|
|
const float fXPos = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fZPos = ArrowGetZPos( m_PlayerNumber, iCol, fYOffset );
|
|
|
|
|
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
|
|
|
|
const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels );
|
2003-02-17 02:45:30 +00:00
|
|
|
const float fColorScale = ArrowGetBrightness( m_PlayerNumber, fBeat ) * SCALE(fLife,0,1,0.2f,1);
|
2004-06-08 22:27:37 +00:00
|
|
|
const float fZoom = ArrowGetZoom( m_PlayerNumber );
|
2003-01-14 05:35:12 +00:00
|
|
|
RageColor diffuse = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
|
|
|
|
RageColor glow = RageColor(1,1,1,fGlow);
|
|
|
|
|
|
2003-08-10 06:00:30 +00:00
|
|
|
pActor->SetRotationZ( fRotation );
|
2003-05-09 04:42:04 +00:00
|
|
|
pActor->SetXY( fXPos, fYPos );
|
2003-07-09 00:49:05 +00:00
|
|
|
pActor->SetZ( fZPos );
|
2003-05-09 04:42:04 +00:00
|
|
|
pActor->SetDiffuse( diffuse );
|
|
|
|
|
pActor->SetGlow( glow );
|
2004-06-08 22:27:37 +00:00
|
|
|
pActor->SetZoom( fZoom );
|
2003-05-11 07:23:47 +00:00
|
|
|
|
2003-12-31 08:15:34 +00:00
|
|
|
if( bUseLighting )
|
2003-05-13 13:35:32 +00:00
|
|
|
{
|
2003-05-15 06:09:19 +00:00
|
|
|
DISPLAY->SetLighting( true );
|
2003-05-13 13:35:32 +00:00
|
|
|
DISPLAY->SetLightDirectional(
|
|
|
|
|
0,
|
2003-12-31 03:42:59 +00:00
|
|
|
RageColor(1,1,1,1),
|
2003-05-13 13:35:32 +00:00
|
|
|
RageColor(1,1,1,1),
|
|
|
|
|
RageColor(1,1,1,1),
|
|
|
|
|
RageVector3(1, 0, +1) );
|
|
|
|
|
}
|
2003-05-11 07:23:47 +00:00
|
|
|
|
2003-05-09 04:42:04 +00:00
|
|
|
pActor->Draw();
|
2003-05-11 07:23:47 +00:00
|
|
|
|
2003-12-31 08:15:34 +00:00
|
|
|
if( bUseLighting )
|
2003-05-13 13:35:32 +00:00
|
|
|
{
|
|
|
|
|
DISPLAY->SetLightOff( 0 );
|
2003-05-15 06:09:19 +00:00
|
|
|
DISPLAY->SetLighting( false );
|
2003-05-13 13:35:32 +00:00
|
|
|
}
|
2003-01-14 05:35:12 +00:00
|
|
|
}
|
|
|
|
|
|
2003-11-15 08:51:47 +00:00
|
|
|
void NoteDisplay::DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bool bIsAddition, bool bIsMine, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels )
|
|
|
|
|
{
|
|
|
|
|
Actor* pActor = NULL;
|
2003-12-31 08:15:34 +00:00
|
|
|
bool bUseLighting = false;
|
2003-11-15 08:51:47 +00:00
|
|
|
if( bIsMine )
|
2003-12-31 08:15:34 +00:00
|
|
|
{
|
2003-11-15 08:51:47 +00:00
|
|
|
pActor = GetTapMineActor( fBeat );
|
2003-12-31 08:15:34 +00:00
|
|
|
bUseLighting = cache->m_bTapMineUseLighting;
|
|
|
|
|
}
|
2003-11-15 08:51:47 +00:00
|
|
|
else if( bIsAddition )
|
2003-12-31 08:15:34 +00:00
|
|
|
{
|
2003-11-15 08:51:47 +00:00
|
|
|
pActor = GetTapAdditionActor( fBeat );
|
2003-12-31 08:15:34 +00:00
|
|
|
bUseLighting = cache->m_bTapAdditionUseLighting;
|
|
|
|
|
}
|
2003-11-15 08:51:47 +00:00
|
|
|
else if( bOnSameRowAsHoldStart && cache->m_bDrawHoldHeadForTapsOnSameRow )
|
2003-12-31 08:15:34 +00:00
|
|
|
{
|
2003-11-15 08:51:47 +00:00
|
|
|
pActor = GetHoldHeadActor( fBeat, false );
|
2003-12-31 08:15:34 +00:00
|
|
|
bUseLighting = cache->m_bHoldHeadUseLighting;
|
|
|
|
|
}
|
2003-11-15 08:51:47 +00:00
|
|
|
else
|
2003-12-31 08:15:34 +00:00
|
|
|
{
|
2003-11-15 08:51:47 +00:00
|
|
|
pActor = GetTapNoteActor( fBeat );
|
2003-12-31 08:15:34 +00:00
|
|
|
bUseLighting = cache->m_bTapNoteUseLighting;
|
|
|
|
|
}
|
2003-11-15 08:51:47 +00:00
|
|
|
|
2003-12-31 08:15:34 +00:00
|
|
|
DrawActor( pActor, iCol, fBeat, fPercentFadeToFail, fLife, fReverseOffsetPixels, bUseLighting );
|
2003-11-15 08:51:47 +00:00
|
|
|
}
|
2004-06-08 00:08:04 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 Brian Bugh, Ben Nordstrom, Chris Danford
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|