Remove unnecessary member. Just set iKeysoundIndex to -1 if it isn't valid.
This commit is contained in:
@@ -91,11 +91,11 @@ void AutoKeysounds::FinishLoading()
|
|||||||
bool bSoundIsGlobal = true;
|
bool bSoundIsGlobal = true;
|
||||||
{
|
{
|
||||||
PlayerNumber pn = GetNextEnabledPlayer((PlayerNumber)-1);
|
PlayerNumber pn = GetNextEnabledPlayer((PlayerNumber)-1);
|
||||||
const TapNote t = tn[pn];
|
const TapNote &t = tn[pn];
|
||||||
pn = GetNextEnabledPlayer(pn);
|
pn = GetNextEnabledPlayer(pn);
|
||||||
while( pn != PLAYER_INVALID )
|
while( pn != PLAYER_INVALID )
|
||||||
{
|
{
|
||||||
if( tn[pn].type != TapNote::autoKeysound || tn[pn].bKeysound != t.bKeysound )
|
if( tn[pn].type != TapNote::autoKeysound || tn[pn].iKeysoundIndex != t.iKeysoundIndex )
|
||||||
bSoundIsGlobal = false;
|
bSoundIsGlobal = false;
|
||||||
pn = GetNextEnabledPlayer(pn);
|
pn = GetNextEnabledPlayer(pn);
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ void AutoKeysounds::FinishLoading()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ASSERT( tn[pn].type == TapNote::autoKeysound );
|
ASSERT( tn[pn].type == TapNote::autoKeysound );
|
||||||
if( tn[pn].bKeysound )
|
if( tn[pn].iKeysoundIndex >= 0 )
|
||||||
{
|
{
|
||||||
RString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[tn[pn].iKeysoundIndex];
|
RString sKeysoundFilePath = sSongDir + pSong->m_vsKeysoundFile[tn[pn].iKeysoundIndex];
|
||||||
float fSeconds = pSong->m_Timing.GetElapsedTimeFromBeat( NoteRowToBeat(iRow) );
|
float fSeconds = pSong->m_Timing.GetElapsedTimeFromBeat( NoteRowToBeat(iRow) );
|
||||||
|
|||||||
@@ -187,10 +187,7 @@ static void LoadFromSMNoteDataStringWithPlayer( NoteData& out, const RString &sS
|
|||||||
p++;
|
p++;
|
||||||
int iKeysoundIndex = 0;
|
int iKeysoundIndex = 0;
|
||||||
if( 1 == sscanf( p, "%d]", &iKeysoundIndex ) ) // not fatal if this fails due to malformed data
|
if( 1 == sscanf( p, "%d]", &iKeysoundIndex ) ) // not fatal if this fails due to malformed data
|
||||||
{
|
|
||||||
tn.bKeysound = true;
|
|
||||||
tn.iKeysoundIndex = iKeysoundIndex;
|
tn.iKeysoundIndex = iKeysoundIndex;
|
||||||
}
|
|
||||||
|
|
||||||
// skip past the ']'
|
// skip past the ']'
|
||||||
while( p < endLine )
|
while( p < endLine )
|
||||||
@@ -386,7 +383,7 @@ void NoteDataUtil::GetSMNoteDataString( const NoteData &in, RString &sRet )
|
|||||||
sRet.append( ssprintf("{%s:%.2f}", tn.sAttackModifiers.c_str(),
|
sRet.append( ssprintf("{%s:%.2f}", tn.sAttackModifiers.c_str(),
|
||||||
tn.fAttackDurationSeconds) );
|
tn.fAttackDurationSeconds) );
|
||||||
}
|
}
|
||||||
if( tn.bKeysound )
|
if( tn.iKeysoundIndex >= 0 )
|
||||||
sRet.append( ssprintf("[%d]",tn.iKeysoundIndex) );
|
sRet.append( ssprintf("[%d]",tn.iKeysoundIndex) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1962,8 +1959,7 @@ void NoteDataUtil::AddTapAttacks( NoteData &nd, Song* pSong )
|
|||||||
TapNote::original,
|
TapNote::original,
|
||||||
szAttacks[RandomInt(ARRAYSIZE(szAttacks))],
|
szAttacks[RandomInt(ARRAYSIZE(szAttacks))],
|
||||||
15.0f,
|
15.0f,
|
||||||
false,
|
-1 );
|
||||||
0 );
|
|
||||||
nd.SetTapNote( iTrack, BeatToNoteRow(fBeat), tn );
|
nd.SetTapNote( iTrack, BeatToNoteRow(fBeat), tn );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,15 @@
|
|||||||
#include "XmlFile.h"
|
#include "XmlFile.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
|
|
||||||
TapNote TAP_EMPTY ( TapNote::empty, TapNote::SubType_invalid, TapNote::original, "", 0, false, 0 );
|
TapNote TAP_EMPTY ( TapNote::empty, TapNote::SubType_invalid, TapNote::original, "", 0, -1 );
|
||||||
TapNote TAP_ORIGINAL_TAP ( TapNote::tap, TapNote::SubType_invalid, TapNote::original, "", 0, false, 0 );
|
TapNote TAP_ORIGINAL_TAP ( TapNote::tap, TapNote::SubType_invalid, TapNote::original, "", 0, -1 );
|
||||||
TapNote TAP_ORIGINAL_HOLD_HEAD ( TapNote::hold_head, TapNote::hold_head_hold, TapNote::original, "", 0, false, 0 );
|
TapNote TAP_ORIGINAL_HOLD_HEAD ( TapNote::hold_head, TapNote::hold_head_hold, TapNote::original, "", 0, -1 );
|
||||||
TapNote TAP_ORIGINAL_ROLL_HEAD ( TapNote::hold_head, TapNote::hold_head_roll, TapNote::original, "", 0, false, 0 );
|
TapNote TAP_ORIGINAL_ROLL_HEAD ( TapNote::hold_head, TapNote::hold_head_roll, TapNote::original, "", 0, -1 );
|
||||||
TapNote TAP_ORIGINAL_MINE ( TapNote::mine, TapNote::SubType_invalid, TapNote::original, "", 0, false, 0 );
|
TapNote TAP_ORIGINAL_MINE ( TapNote::mine, TapNote::SubType_invalid, TapNote::original, "", 0, -1 );
|
||||||
TapNote TAP_ORIGINAL_ATTACK ( TapNote::attack, TapNote::SubType_invalid, TapNote::original, "", 0, false, 0 );
|
TapNote TAP_ORIGINAL_ATTACK ( TapNote::attack, TapNote::SubType_invalid, TapNote::original, "", 0, -1 );
|
||||||
TapNote TAP_ORIGINAL_AUTO_KEYSOUND ( TapNote::autoKeysound,TapNote::SubType_invalid, TapNote::original, "", 0, false, 0 );
|
TapNote TAP_ORIGINAL_AUTO_KEYSOUND ( TapNote::autoKeysound,TapNote::SubType_invalid, TapNote::original, "", 0, -1 );
|
||||||
TapNote TAP_ADDITION_TAP ( TapNote::tap, TapNote::SubType_invalid, TapNote::addition, "", 0, false, 0 );
|
TapNote TAP_ADDITION_TAP ( TapNote::tap, TapNote::SubType_invalid, TapNote::addition, "", 0, -1 );
|
||||||
TapNote TAP_ADDITION_MINE ( TapNote::mine, TapNote::SubType_invalid, TapNote::addition, "", 0, false, 0 );
|
TapNote TAP_ADDITION_MINE ( TapNote::mine, TapNote::SubType_invalid, TapNote::addition, "", 0, -1 );
|
||||||
|
|
||||||
static const char *NoteTypeNames[] = {
|
static const char *NoteTypeNames[] = {
|
||||||
"4th",
|
"4th",
|
||||||
|
|||||||
@@ -100,10 +100,8 @@ struct TapNote
|
|||||||
RString sAttackModifiers;
|
RString sAttackModifiers;
|
||||||
float fAttackDurationSeconds;
|
float fAttackDurationSeconds;
|
||||||
|
|
||||||
bool bKeysound; // true if this note plays a keysound when hit
|
|
||||||
|
|
||||||
int iKeysoundIndex; // index into Song's vector of keysound files.
|
int iKeysoundIndex; // index into Song's vector of keysound files.
|
||||||
// Only valid if bKeysound.
|
// Only valid if nonnegative.
|
||||||
|
|
||||||
/* hold_head only: */
|
/* hold_head only: */
|
||||||
int iDuration;
|
int iDuration;
|
||||||
@@ -119,15 +117,14 @@ struct TapNote
|
|||||||
XNode* CreateNode() const;
|
XNode* CreateNode() const;
|
||||||
void LoadFromNode( const XNode* pNode );
|
void LoadFromNode( const XNode* pNode );
|
||||||
|
|
||||||
|
TapNote() : type(empty), subType(SubType_invalid), source(original), fAttackDurationSeconds(0.f),
|
||||||
TapNote() {}
|
iKeysoundIndex(-1), iDuration(0), pn(PLAYER_INVALID) { }
|
||||||
TapNote(
|
TapNote(
|
||||||
Type type_,
|
Type type_,
|
||||||
SubType subType_,
|
SubType subType_,
|
||||||
Source source_,
|
Source source_,
|
||||||
RString sAttackModifiers_,
|
RString sAttackModifiers_,
|
||||||
float fAttackDurationSeconds_,
|
float fAttackDurationSeconds_,
|
||||||
bool bKeysound_,
|
|
||||||
int iKeysoundIndex_ )
|
int iKeysoundIndex_ )
|
||||||
{
|
{
|
||||||
type = type_;
|
type = type_;
|
||||||
@@ -135,7 +132,6 @@ struct TapNote
|
|||||||
source = source_;
|
source = source_;
|
||||||
sAttackModifiers = sAttackModifiers_;
|
sAttackModifiers = sAttackModifiers_;
|
||||||
fAttackDurationSeconds = fAttackDurationSeconds_;
|
fAttackDurationSeconds = fAttackDurationSeconds_;
|
||||||
bKeysound = bKeysound_;
|
|
||||||
iKeysoundIndex = iKeysoundIndex_;
|
iKeysoundIndex = iKeysoundIndex_;
|
||||||
iDuration = 0;
|
iDuration = 0;
|
||||||
pn = PLAYER_INVALID;
|
pn = PLAYER_INVALID;
|
||||||
@@ -148,13 +144,13 @@ struct TapNote
|
|||||||
COMPARE(source);
|
COMPARE(source);
|
||||||
COMPARE(sAttackModifiers);
|
COMPARE(sAttackModifiers);
|
||||||
COMPARE(fAttackDurationSeconds);
|
COMPARE(fAttackDurationSeconds);
|
||||||
COMPARE(bKeysound);
|
|
||||||
COMPARE(iKeysoundIndex);
|
COMPARE(iKeysoundIndex);
|
||||||
COMPARE(iDuration);
|
COMPARE(iDuration);
|
||||||
COMPARE(pn);
|
COMPARE(pn);
|
||||||
#undef COMPARE
|
#undef COMPARE
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
bool operator!=( const TapNote &other ) const { return !operator==( other ); }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TapNote TAP_EMPTY; // '0'
|
extern TapNote TAP_EMPTY; // '0'
|
||||||
|
|||||||
@@ -311,10 +311,7 @@ bool BMSLoader::LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNa
|
|||||||
TapNote tn = TAP_ORIGINAL_TAP;
|
TapNote tn = TAP_ORIGINAL_TAP;
|
||||||
map<RString,int>::const_iterator it = m_mapWavIdToKeysoundIndex.find(sNoteId);
|
map<RString,int>::const_iterator it = m_mapWavIdToKeysoundIndex.find(sNoteId);
|
||||||
if( it != m_mapWavIdToKeysoundIndex.end() )
|
if( it != m_mapWavIdToKeysoundIndex.end() )
|
||||||
{
|
|
||||||
tn.bKeysound = true;
|
|
||||||
tn.iKeysoundIndex = it->second;
|
tn.iKeysoundIndex = it->second;
|
||||||
}
|
|
||||||
vTapNotes.push_back( tn );
|
vTapNotes.push_back( tn );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1267,7 +1267,7 @@ void Player::Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRele
|
|||||||
if( iIndexOverlappingNote != -1 )
|
if( iIndexOverlappingNote != -1 )
|
||||||
{
|
{
|
||||||
const TapNote &tn = m_NoteData.GetTapNote( col, iIndexOverlappingNote );
|
const TapNote &tn = m_NoteData.GetTapNote( col, iIndexOverlappingNote );
|
||||||
if( tn.bKeysound && tn.iKeysoundIndex < (int) m_vKeysounds.size() )
|
if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() )
|
||||||
m_vKeysounds[tn.iKeysoundIndex].Play();
|
m_vKeysounds[tn.iKeysoundIndex].Play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1404,7 +1404,7 @@ void Player::UpdateJudgedRows()
|
|||||||
|
|
||||||
if( tn.pn != PLAYER_INVALID && tn.pn != pn )
|
if( tn.pn != PLAYER_INVALID && tn.pn != pn )
|
||||||
continue;
|
continue;
|
||||||
if( tn.bKeysound && tn.iKeysoundIndex < (int) m_vKeysounds.size() )
|
if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() )
|
||||||
m_vKeysounds[tn.iKeysoundIndex].Play();
|
m_vKeysounds[tn.iKeysoundIndex].Play();
|
||||||
else
|
else
|
||||||
m_soundMine.Play();
|
m_soundMine.Play();
|
||||||
|
|||||||
@@ -2438,8 +2438,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
TapNote::original,
|
TapNote::original,
|
||||||
sMods,
|
sMods,
|
||||||
g_fLastInsertAttackDurationSeconds,
|
g_fLastInsertAttackDurationSeconds,
|
||||||
false,
|
-1 );
|
||||||
0 );
|
|
||||||
tn.pn = m_InputPlayerNumber;
|
tn.pn = m_InputPlayerNumber;
|
||||||
SaveUndo();
|
SaveUndo();
|
||||||
m_NoteDataEdit.SetTapNote( g_iLastInsertTapAttackTrack, row, tn );
|
m_NoteDataEdit.SetTapNote( g_iLastInsertTapAttackTrack, row, tn );
|
||||||
|
|||||||
Reference in New Issue
Block a user