src\NoteDisplay.cpp

This commit is contained in:
AJ Kelly
2011-03-02 16:37:20 -06:00
parent 387bb95745
commit d750f2a1e8
3 changed files with 49 additions and 46 deletions
+22 -22
View File
@@ -285,11 +285,11 @@ void NoteDisplay::Update( float fDeltaTime )
void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLength, bool bVivid ) void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLength, bool bVivid )
{ {
/* -inf ... inf */ // -inf ... inf
float fBeatOrSecond = cache->m_bAnimationBasedOnBeats ? GAMESTATE->m_fSongBeat : GAMESTATE->m_fMusicSeconds; float fBeatOrSecond = cache->m_bAnimationBasedOnBeats ? GAMESTATE->m_fSongBeat : GAMESTATE->m_fMusicSeconds;
/* -len ... +len */ // -len ... +len
float fPercentIntoAnimation = fmodf( fBeatOrSecond, fAnimationLength ); float fPercentIntoAnimation = fmodf( fBeatOrSecond, fAnimationLength );
/* -1 ... 1 */ // -1 ... 1
fPercentIntoAnimation /= fAnimationLength; fPercentIntoAnimation /= fAnimationLength;
if( bVivid ) if( bVivid )
@@ -304,7 +304,7 @@ void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAni
} }
else else
{ {
/* 0 ... 1, wrapped */ // 0 ... 1, wrapped
if( fPercentIntoAnimation < 0 ) if( fPercentIntoAnimation < 0 )
fPercentIntoAnimation += 1.0f; fPercentIntoAnimation += 1.0f;
} }
@@ -416,8 +416,8 @@ void NoteDisplay::DrawHoldPart( vector<Sprite*> &vpSpr, int iCol, int fYStep, fl
if( bWrapping ) if( bWrapping )
{ {
/* For very large hold notes, shift the texture coordinates to be near 0, so we /* For very large hold notes, shift the texture coordinates to be near 0,
* don't send very large values to the renderer. */ * so we don't send very large values to the renderer. */
const float fDistFromTop = fYStartPos - fYTop; const float fDistFromTop = fYStartPos - fYTop;
float fTexCoordTop = SCALE( fDistFromTop, 0, fFrameHeight, rect.top, rect.bottom ); float fTexCoordTop = SCALE( fDistFromTop, 0, fFrameHeight, rect.top, rect.bottom );
fTexCoordTop += fAddToTexCoord; fTexCoordTop += fAddToTexCoord;
@@ -479,8 +479,8 @@ void NoteDisplay::DrawHoldPart( vector<Sprite*> &vpSpr, int iCol, int fYStep, fl
if( queue.Free() < 3 || bLast ) if( queue.Free() < 3 || bLast )
{ {
/* The queue is full. Render it, clear the buffer, and move back a step to /* The queue is full. Render it, clear the buffer, and move back
* start off the strip again. */ * a step to start off the strip again. */
if( !bAllAreTransparent ) if( !bAllAreTransparent )
{ {
FOREACH( Sprite*, vpSpr, spr ) FOREACH( Sprite*, vpSpr, spr )
@@ -542,7 +542,7 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool b
DISPLAY->SetZTestMode( bWavyPartsNeedZBuffer?ZTEST_WRITE_ON_PASS:ZTEST_OFF ); DISPLAY->SetZTestMode( bWavyPartsNeedZBuffer?ZTEST_WRITE_ON_PASS:ZTEST_OFF );
DISPLAY->SetZWrite( bWavyPartsNeedZBuffer ); DISPLAY->SetZWrite( bWavyPartsNeedZBuffer );
/* Hack: Z effects need a finer grain step. */ // Hack: Z effects need a finer grain step.
const int fYStep = bWavyPartsNeedZBuffer? 4: 16; // use small steps only if wavy const int fYStep = bWavyPartsNeedZBuffer? 4: 16; // use small steps only if wavy
if( bFlipHoldBody ) if( bFlipHoldBody )
@@ -641,23 +641,23 @@ void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iRow, bool bIsBeing
/* The body and caps should have no overlap, so their order doesn't matter. /* The body and caps should have no overlap, so their order doesn't matter.
* Draw the head last, so it appears on top. */ * Draw the head last, so it appears on top. */
float fBeat = NoteRowToBeat(iRow); float fBeat = NoteRowToBeat(iRow);
//if( !cache->m_bHoldHeadIsAboveWavyParts ) /*
//{ if( !cache->m_bHoldHeadIsAboveWavyParts )
// Actor *pActor = GetHoldActor( m_HoldHead, NotePart_HoldHead, NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld ); {
// DrawActor( tn, pActor, NotePart_HoldHead, iCol, bFlipHeadAndTail ? fEndYOffset : fStartYOffset, fBeat, bIsAddition, fPercentFadeToFail, fReverseOffsetPixels, fColorScale, fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar ); Actor *pActor = GetHoldActor( m_HoldHead, NotePart_HoldHead, NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld );
//} DrawActor( tn, pActor, NotePart_HoldHead, iCol, bFlipHeadAndTail ? fEndYOffset : fStartYOffset, fBeat, bIsAddition, fPercentFadeToFail, fReverseOffsetPixels, fColorScale, fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar );
//if( !cache->m_bHoldTailIsAboveWavyParts ) }
//{ if( !cache->m_bHoldTailIsAboveWavyParts )
// Actor *pActor = GetHoldActor( m_HoldTail, NotePart_HoldTail, NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld ); {
// DrawActor( tn, pActor, NotePart_HoldTail, iCol, bFlipHeadAndTail ? fStartYOffset : fEndYOffset, fBeat, bIsAddition, fPercentFadeToFail, fReverseOffsetPixels, fColorScale, fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar ); Actor *pActor = GetHoldActor( m_HoldTail, NotePart_HoldTail, NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld );
//} DrawActor( tn, pActor, NotePart_HoldTail, iCol, bFlipHeadAndTail ? fStartYOffset : fEndYOffset, fBeat, bIsAddition, fPercentFadeToFail, fReverseOffsetPixels, fColorScale, fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar );
}
*/
DrawHoldBody( tn, iCol, fBeat, bIsBeingHeld, fYHead, fYTail, bIsAddition, fPercentFadeToFail, fColorScale, false, fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar ); DrawHoldBody( tn, iCol, fBeat, bIsBeingHeld, fYHead, fYTail, bIsAddition, fPercentFadeToFail, fColorScale, false, fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar );
DrawHoldBody( tn, iCol, fBeat, bIsBeingHeld, fYHead, fYTail, bIsAddition, fPercentFadeToFail, fColorScale, true, fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar ); DrawHoldBody( tn, iCol, fBeat, bIsBeingHeld, fYHead, fYTail, bIsAddition, fPercentFadeToFail, fColorScale, true, fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar );
/* These set the texture mode themselves. */ // These set the texture mode themselves.
// this part was modified in pumpmania, where it flips the draw order
// of the head and tail. Perhaps make this a theme/noteskin metric? -aj
if( cache->m_bHoldTailIsAboveWavyParts ) if( cache->m_bHoldTailIsAboveWavyParts )
{ {
Actor *pActor = GetHoldActor( m_HoldTail, NotePart_HoldTail, NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld ); Actor *pActor = GetHoldActor( m_HoldTail, NotePart_HoldTail, NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld );
+7 -2
View File
@@ -5,6 +5,7 @@
#include "RageLog.h" #include "RageLog.h"
#include "RadarValues.h" #include "RadarValues.h"
#include "Steps.h" #include "Steps.h"
#include "NoteSkinManager.h"
PlayerState::PlayerState() PlayerState::PlayerState()
{ {
@@ -28,6 +29,9 @@ void PlayerState::Reset()
m_iCpuSkill = 5; m_iCpuSkill = 5;
m_iNoteSkinColSpacing = 0;
m_iNoteSkinArrowSize = 0;
m_iLastPositiveSumOfAttackLevels = 0; m_iLastPositiveSumOfAttackLevels = 0;
m_fSecondsUntilAttacksPhasedOut = 0; m_fSecondsUntilAttacksPhasedOut = 0;
m_bAttackBeganThisUpdate = false; m_bAttackBeganThisUpdate = false;
@@ -189,9 +193,10 @@ int PlayerState::GetSumOfActiveAttackLevels() const
return iSum; return iSum;
} }
/*
void PlayerState::LoadNoteSkinMetrics() void PlayerState::LoadNoteSkinMetrics()
{ {
/*
// Read metrics from current noteskin for setting row/col spacing and // Read metrics from current noteskin for setting row/col spacing and
// arrow size (originally from StepMania AMX) // arrow size (originally from StepMania AMX)
@@ -206,8 +211,8 @@ void PlayerState::LoadNoteSkinMetrics()
// todo: allow per-column spacing values? -aj // todo: allow per-column spacing values? -aj
m_iNoteSkinColSpacing = NOTESKIN->GetMetricI( m_sNoteSkin, sStepsType, "ColSpacing" ); m_iNoteSkinColSpacing = NOTESKIN->GetMetricI( m_sNoteSkin, sStepsType, "ColSpacing" );
m_iNoteSkinArrowSize = NOTESKIN->GetMetricI( m_sNoteSkin, sStepsType, "ArrowSize" ); m_iNoteSkinArrowSize = NOTESKIN->GetMetricI( m_sNoteSkin, sStepsType, "ArrowSize" );
*/
} }
*/
// lua start // lua start
#include "LuaBinding.h" #include "LuaBinding.h"
-2
View File
@@ -47,11 +47,9 @@ public:
ModsGroup<PlayerOptions> m_PlayerOptions; ModsGroup<PlayerOptions> m_PlayerOptions;
// Metricable noteskin things // Metricable noteskin things
/*
void LoadNoteSkinMetrics(); void LoadNoteSkinMetrics();
int m_iNoteSkinColSpacing; int m_iNoteSkinColSpacing;
int m_iNoteSkinArrowSize; int m_iNoteSkinArrowSize;
*/
// not sure I want to let noteskins change row spacing, as that changes how // not sure I want to let noteskins change row spacing, as that changes how
// the speed mods work... -aj // the speed mods work... -aj
//int m_iNoteSkinRowSpacing; //int m_iNoteSkinRowSpacing;