From 8ec01b7cb35c9da3a7a9a3733c517185737a523a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 20 Apr 2005 01:53:41 +0000 Subject: [PATCH] add TapNote SubType instead of a bool for rolls --- stepmania/src/NoteDataUtil.cpp | 11 +++++++++-- stepmania/src/NoteDisplay.cpp | 10 +++++----- stepmania/src/NoteTypes.cpp | 18 +++++++++--------- stepmania/src/NoteTypes.h | 13 +++++++++---- stepmania/src/ScreenEdit.cpp | 2 +- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/stepmania/src/NoteDataUtil.cpp b/stepmania/src/NoteDataUtil.cpp index 9619ed9cea..6e1117da8f 100644 --- a/stepmania/src/NoteDataUtil.cpp +++ b/stepmania/src/NoteDataUtil.cpp @@ -301,7 +301,14 @@ void NoteDataUtil::GetSMNoteDataString( const NoteData &in_, CString ¬es_out { case TapNote::empty: c = '0'; break; case TapNote::tap: c = '1'; break; - case TapNote::hold_head: c = tn.bIsRoll ? '2':'4'; break; + case TapNote::hold_head: + switch( tn.subType ) + { + case TapNote::hold_head_hold: c = '2'; break; + case TapNote::hold_head_roll: c = '4'; break; + default: ASSERT(0); + } + break; case TapNote::hold_tail: c = '3'; break; case TapNote::mine: c = 'M'; break; case TapNote::attack: c = 'A'; break; @@ -1741,7 +1748,7 @@ void NoteDataUtil::AddTapAttacks( NoteData &nd, Song* pSong ) int iTrack = iBeat % nd.GetNumTracks(); // deterministically calculates track TapNote tn( TapNote::attack, - false, + TapNote::SubType_invalid, TapNote::original, szAttacks[rand()%ARRAYSIZE(szAttacks)], 15.0f, diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index cd8aee0b47..c57dc76d2d 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -541,7 +541,7 @@ void NoteDisplay::DrawHoldTopCap( const TapNote& tn, int iCol, int iRow, bool bI // StripBuffer queue; - Sprite* pSprTopCap = GetHoldTopCapSprite( NoteRowToBeat(iRow), tn.bIsRoll, bIsBeingHeld ); + Sprite* pSprTopCap = GetHoldTopCapSprite( NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld ); pSprTopCap->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) ); @@ -630,7 +630,7 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, int iRow, bool bIsB // StripBuffer queue; - Sprite* pSprBody = GetHoldBodySprite( NoteRowToBeat(iRow), tn.bIsRoll, bIsBeingHeld ); + Sprite* pSprBody = GetHoldBodySprite( NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld ); pSprBody->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) ); @@ -728,7 +728,7 @@ void NoteDisplay::DrawHoldBottomCap( const TapNote& tn, int iCol, int iRow, bool // StripBuffer queue; - Sprite* pBottomCap = GetHoldBottomCapSprite( NoteRowToBeat(iRow), tn.bIsRoll, bIsBeingHeld ); + Sprite* pBottomCap = GetHoldBottomCapSprite( NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld ); pBottomCap->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) ); @@ -810,7 +810,7 @@ void NoteDisplay::DrawHoldTail( const TapNote& tn, int iCol, int iRow, bool bIsB // // Draw the tail // - Actor* pSprTail = GetHoldTailActor( NoteRowToBeat(iRow), tn.bIsRoll, bIsBeingHeld ); + Actor* pSprTail = GetHoldTailActor( NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld ); pSprTail->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) ); @@ -864,7 +864,7 @@ void NoteDisplay::DrawHoldHead( const TapNote& tn, int iCol, int iRow, bool bIsB // // Draw the head // - Actor* pActor = GetHoldHeadActor( NoteRowToBeat(iRow), tn.bIsRoll, bIsBeingHeld ); + Actor* pActor = GetHoldHeadActor( NoteRowToBeat(iRow), tn.subType == TapNote::hold_head_roll, bIsBeingHeld ); pActor->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) ); diff --git a/stepmania/src/NoteTypes.cpp b/stepmania/src/NoteTypes.cpp index 099fc50b30..1acc998955 100644 --- a/stepmania/src/NoteTypes.cpp +++ b/stepmania/src/NoteTypes.cpp @@ -2,15 +2,15 @@ #include "NoteTypes.h" #include "RageUtil.h" -TapNote TAP_EMPTY ( TapNote::empty, false, TapNote::original, "", 0, false, 0 ); -TapNote TAP_ORIGINAL_TAP ( TapNote::tap, false, TapNote::original, "", 0, false, 0 ); -TapNote TAP_ORIGINAL_HOLD_HEAD ( TapNote::hold_head, false, TapNote::original, "", 0, false, 0 ); -TapNote TAP_ORIGINAL_ROLL_HEAD ( TapNote::hold_head, true, TapNote::original, "", 0, false, 0 ); -TapNote TAP_ORIGINAL_MINE ( TapNote::mine, false, TapNote::original, "", 0, false, 0 ); -TapNote TAP_ORIGINAL_ATTACK ( TapNote::attack, false, TapNote::original, "", 0, false, 0 ); -TapNote TAP_ORIGINAL_AUTO_KEYSOUND ( TapNote::autoKeysound,false, TapNote::original, "", 0, false, 0 ); -TapNote TAP_ADDITION_TAP ( TapNote::tap, false, TapNote::addition, "", 0, false, 0 ); -TapNote TAP_ADDITION_MINE ( TapNote::mine, false, TapNote::addition, "", 0, false, 0 ); +TapNote TAP_EMPTY ( TapNote::empty, TapNote::SubType_invalid, TapNote::original, "", 0, false, 0 ); +TapNote TAP_ORIGINAL_TAP ( TapNote::tap, TapNote::SubType_invalid, TapNote::original, "", 0, false, 0 ); +TapNote TAP_ORIGINAL_HOLD_HEAD ( TapNote::hold_head, TapNote::hold_head_hold, TapNote::original, "", 0, false, 0 ); +TapNote TAP_ORIGINAL_ROLL_HEAD ( TapNote::hold_head, TapNote::hold_head_roll, TapNote::original, "", 0, false, 0 ); +TapNote TAP_ORIGINAL_MINE ( TapNote::mine, TapNote::SubType_invalid, TapNote::original, "", 0, false, 0 ); +TapNote TAP_ORIGINAL_ATTACK ( TapNote::attack, TapNote::SubType_invalid, TapNote::original, "", 0, false, 0 ); +TapNote TAP_ORIGINAL_AUTO_KEYSOUND ( TapNote::autoKeysound,TapNote::SubType_invalid, TapNote::original, "", 0, false, 0 ); +TapNote TAP_ADDITION_TAP ( TapNote::tap, TapNote::SubType_invalid, TapNote::addition, "", 0, false, 0 ); +TapNote TAP_ADDITION_MINE ( TapNote::mine, TapNote::SubType_invalid, TapNote::addition, "", 0, false, 0 ); static const CString NoteTypeNames[NUM_NOTE_TYPES] = { "4th", diff --git a/stepmania/src/NoteTypes.h b/stepmania/src/NoteTypes.h index 56b19e40b5..d6589ff2e3 100644 --- a/stepmania/src/NoteTypes.h +++ b/stepmania/src/NoteTypes.h @@ -63,7 +63,12 @@ struct TapNote attack, autoKeysound, } type; - bool bIsRoll; // only possibly true if type == hold_head + enum SubType + { + hold_head_hold, + hold_head_roll, + SubType_invalid + } subType; // only used if type == hold_head enum Source { original, // part of the original NoteData addition, // additional note added by a transform @@ -101,7 +106,7 @@ struct TapNote TapNote() {} TapNote( Type type_, - bool bIsRoll_, + SubType subType_, Source source_, CString sAttackModifiers_, float fAttackDurationSeconds_, @@ -109,7 +114,7 @@ struct TapNote int iKeysoundIndex_ ) { type = type_; - bIsRoll = bIsRoll_; + subType = subType_; source = source_; sAttackModifiers = sAttackModifiers_; fAttackDurationSeconds = fAttackDurationSeconds_; @@ -121,7 +126,7 @@ struct TapNote { #define COMPARE(x) if(x!=other.x) return false; COMPARE(type); - COMPARE(bIsRoll); + COMPARE(subType); COMPARE(source); COMPARE(sAttackModifiers); COMPARE(fAttackDurationSeconds); diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index cdf4030a1a..e489f13234 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -1632,7 +1632,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM ) TapNote tn( TapNote::attack, - false, + TapNote::SubType_invalid, TapNote::original, sMods, g_fLastInsertAttackDurationSeconds,