From d750f2a1e8ce15a57ac2e9f0a9a6796f20705633 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Wed, 2 Mar 2011 16:37:20 -0600 Subject: [PATCH] src\NoteDisplay.cpp --- src/NoteDisplay.cpp | 84 ++++++++++++++++++++++----------------------- src/PlayerState.cpp | 9 +++-- src/PlayerState.h | 2 -- 3 files changed, 49 insertions(+), 46 deletions(-) diff --git a/src/NoteDisplay.cpp b/src/NoteDisplay.cpp index 25f224f9c8..d769ace410 100644 --- a/src/NoteDisplay.cpp +++ b/src/NoteDisplay.cpp @@ -247,21 +247,21 @@ void NoteDisplay::Load( int iColNum, const PlayerState* pPlayerState, float fYRe cache->Load( sButton ); // "normal" note types - m_TapNote.Load( sButton, "Tap Note" ); - m_TapMine.Load( sButton, "Tap Mine" ); - m_TapLift.Load( sButton, "Tap Lift" ); - m_TapFake.Load( sButton, "Tap Fake" ); + m_TapNote.Load( sButton, "Tap Note" ); + m_TapMine.Load( sButton, "Tap Mine" ); + m_TapLift.Load( sButton, "Tap Lift" ); + m_TapFake.Load( sButton, "Tap Fake" ); // hold types FOREACH_HoldType( ht ) { FOREACH_ActiveType( at ) { - m_HoldHead[ht][at].Load( sButton, HoldTypeToString(ht)+" Head "+ActiveTypeToString(at) ); - m_HoldTopCap[ht][at].Load( sButton, HoldTypeToString(ht)+" Topcap "+ActiveTypeToString(at) ); - m_HoldBody[ht][at].Load( sButton, HoldTypeToString(ht)+" Body "+ActiveTypeToString(at) ); + m_HoldHead[ht][at].Load( sButton, HoldTypeToString(ht)+" Head "+ActiveTypeToString(at) ); + m_HoldTopCap[ht][at].Load( sButton, HoldTypeToString(ht)+" Topcap "+ActiveTypeToString(at) ); + m_HoldBody[ht][at].Load( sButton, HoldTypeToString(ht)+" Body "+ActiveTypeToString(at) ); m_HoldBottomCap[ht][at].Load( sButton, HoldTypeToString(ht)+" Bottomcap "+ActiveTypeToString(at) ); - m_HoldTail[ht][at].Load( sButton, HoldTypeToString(ht)+" Tail "+ActiveTypeToString(at) ); + m_HoldTail[ht][at].Load( sButton, HoldTypeToString(ht)+" Tail "+ActiveTypeToString(at) ); } } } @@ -274,7 +274,7 @@ bool NoteDisplay::DrawHoldHeadForTapsOnSameRow() const void NoteDisplay::Update( float fDeltaTime ) { /* This function is static: it's called once per game loop, not once per - * NoteDisplay. Update each cached item exactly once. */ + * NoteDisplay. Update each cached item exactly once. */ map::iterator it; for( it = g_NoteResource.begin(); it != g_NoteResource.end(); ++it ) { @@ -285,11 +285,11 @@ void NoteDisplay::Update( float fDeltaTime ) 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; - /* -len ... +len */ + // -len ... +len float fPercentIntoAnimation = fmodf( fBeatOrSecond, fAnimationLength ); - /* -1 ... 1 */ + // -1 ... 1 fPercentIntoAnimation /= fAnimationLength; if( bVivid ) @@ -304,7 +304,7 @@ void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAni } else { - /* 0 ... 1, wrapped */ + // 0 ... 1, wrapped if( fPercentIntoAnimation < 0 ) fPercentIntoAnimation += 1.0f; } @@ -393,8 +393,8 @@ void NoteDisplay::DrawHoldPart( vector &vpSpr, int iCol, int fYStep, fl const float fFrameWidth = pSprite->GetZoomedWidth(); const float fFrameHeight = pSprite->GetZoomedHeight(); - /* Only draw the section that's within the range specified. If a hold note is - * very long, don't process or draw the part outside of the range. Don't change + /* Only draw the section that's within the range specified. If a hold note is + * very long, don't process or draw the part outside of the range. Don't change * fYTop or fYBottom; they need to be left alone to calculate texture coordinates. */ fYStartPos = max( fYTop, fYStartPos ); fYEndPos = min( fYBottom, fYEndPos ); @@ -416,9 +416,9 @@ void NoteDisplay::DrawHoldPart( vector &vpSpr, int iCol, int fYStep, fl if( bWrapping ) { - /* For very large hold notes, shift the texture coordinates to be near 0, so we - * don't send very large values to the renderer. */ - const float fDistFromTop = fYStartPos - fYTop; + /* For very large hold notes, shift the texture coordinates to be near 0, + * so we don't send very large values to the renderer. */ + const float fDistFromTop = fYStartPos - fYTop; float fTexCoordTop = SCALE( fDistFromTop, 0, fFrameHeight, rect.top, rect.bottom ); fTexCoordTop += fAddToTexCoord; fAddToTexCoord -= floorf( fTexCoordTop ); @@ -479,8 +479,8 @@ void NoteDisplay::DrawHoldPart( vector &vpSpr, int iCol, int fYStep, fl if( queue.Free() < 3 || bLast ) { - /* The queue is full. Render it, clear the buffer, and move back a step to - * start off the strip again. */ + /* The queue is full. Render it, clear the buffer, and move back + * a step to start off the strip again. */ if( !bAllAreTransparent ) { FOREACH( Sprite*, vpSpr, spr ) @@ -542,8 +542,8 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool b DISPLAY->SetZTestMode( bWavyPartsNeedZBuffer?ZTEST_WRITE_ON_PASS:ZTEST_OFF ); DISPLAY->SetZWrite( bWavyPartsNeedZBuffer ); - /* Hack: Z effects need a finer grain step. */ - const int fYStep = bWavyPartsNeedZBuffer? 4: 16; // use small steps only if wavy + // Hack: Z effects need a finer grain step. + const int fYStep = bWavyPartsNeedZBuffer? 4: 16; // use small steps only if wavy if( bFlipHoldBody ) { @@ -610,23 +610,23 @@ void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iRow, bool bIsBeing // HACK: If life > 0, don't set YOffset to 0 so that it doesn't jiggle around the receptor. bool bStartIsPastPeak = true; - float fStartYOffset = 0; + float fStartYOffset = 0; if( tn.HoldResult.bActive && tn.HoldResult.fLife > 0 ) - ; // use the default values filled in above + ; // use the default values filled in above else fStartYOffset = ArrowEffects::GetYOffset( m_pPlayerState, iCol, fStartBeat, fThrowAway, bStartIsPastPeak ); - + float fEndPeakYOffset = 0; bool bEndIsPastPeak = false; float fEndYOffset = ArrowEffects::GetYOffset( m_pPlayerState, iCol, NoteRowToBeat(iEndRow), fEndPeakYOffset, bEndIsPastPeak ); - // In boomerang, the arrows reverse direction at Y offset value fPeakAtYOffset. - // If fPeakAtYOffset lies inside of the hold we're drawing, then the we - // want to draw the tail at that max Y offset, or else the hold will appear + // In boomerang, the arrows reverse direction at Y offset value fPeakAtYOffset. + // If fPeakAtYOffset lies inside of the hold we're drawing, then the we + // want to draw the tail at that max Y offset, or else the hold will appear // to magically grow as the tail approaches the max Y offset. if( bStartIsPastPeak && !bEndIsPastPeak ) fEndYOffset = fEndPeakYOffset; // use the calculated PeakYOffset so that long holds don't appear to grow - + // Swap in reverse, so fStartYOffset is always the offset higher on the screen. if( bReverse ) swap( fStartYOffset, fEndYOffset ); @@ -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. * Draw the head last, so it appears on top. */ float fBeat = NoteRowToBeat(iRow); - //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 ); - //} - //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 ); - //} + /* + 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 ); + } + 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 ); + } + */ 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 ); - /* 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 + // These set the texture mode themselves. if( cache->m_bHoldTailIsAboveWavyParts ) { Actor *pActor = GetHoldActor( m_HoldTail, NotePart_HoldTail, NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld ); diff --git a/src/PlayerState.cpp b/src/PlayerState.cpp index e66a311a35..3adc10407b 100644 --- a/src/PlayerState.cpp +++ b/src/PlayerState.cpp @@ -5,6 +5,7 @@ #include "RageLog.h" #include "RadarValues.h" #include "Steps.h" +#include "NoteSkinManager.h" PlayerState::PlayerState() { @@ -28,6 +29,9 @@ void PlayerState::Reset() m_iCpuSkill = 5; + m_iNoteSkinColSpacing = 0; + m_iNoteSkinArrowSize = 0; + m_iLastPositiveSumOfAttackLevels = 0; m_fSecondsUntilAttacksPhasedOut = 0; m_bAttackBeganThisUpdate = false; @@ -189,9 +193,10 @@ int PlayerState::GetSumOfActiveAttackLevels() const return iSum; } -/* + void PlayerState::LoadNoteSkinMetrics() { + /* // Read metrics from current noteskin for setting row/col spacing and // arrow size (originally from StepMania AMX) @@ -206,8 +211,8 @@ void PlayerState::LoadNoteSkinMetrics() // todo: allow per-column spacing values? -aj m_iNoteSkinColSpacing = NOTESKIN->GetMetricI( m_sNoteSkin, sStepsType, "ColSpacing" ); m_iNoteSkinArrowSize = NOTESKIN->GetMetricI( m_sNoteSkin, sStepsType, "ArrowSize" ); + */ } -*/ // lua start #include "LuaBinding.h" diff --git a/src/PlayerState.h b/src/PlayerState.h index 86958d40d2..c68d678cb8 100644 --- a/src/PlayerState.h +++ b/src/PlayerState.h @@ -47,11 +47,9 @@ public: ModsGroup m_PlayerOptions; // Metricable noteskin things - /* void LoadNoteSkinMetrics(); int m_iNoteSkinColSpacing; int m_iNoteSkinArrowSize; - */ // not sure I want to let noteskins change row spacing, as that changes how // the speed mods work... -aj //int m_iNoteSkinRowSpacing;