use references when passing NoteData
  Have player own a NoteDataWithScoring, not derive from it
This commit is contained in:
Chris Danford
2004-10-23 17:43:49 +00:00
parent e483125b9f
commit 09193d9e4b
22 changed files with 235 additions and 180 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ void BeginnerHelper::AddPlayer( PlayerNumber pn, NoteData *pSteps )
if(!DoesFileExist(Character->GetModelPath()))
return;
m_NoteData[pn].CopyAll(pSteps);
m_NoteData[pn].CopyAll(*pSteps);
m_bPlayerEnabled[pn] = true;
}
+20 -20
View File
@@ -65,12 +65,12 @@ void NoteData::ClearAll()
/* Copy a range from pFrom to this. (Note that this does *not* overlay;
* all data in the range is overwritten.) */
void NoteData::CopyRange( const NoteData* pFrom, int iFromIndexBegin, int iFromIndexEnd, int iToIndexBegin )
void NoteData::CopyRange( const NoteData& from, int iFromIndexBegin, int iFromIndexEnd, int iToIndexBegin )
{
ASSERT( pFrom->GetNumTracks() == GetNumTracks() );
ASSERT( from.GetNumTracks() == GetNumTracks() );
NoteData From, To;
From.To4s( *pFrom );
From.To4s( from );
To.To4s( *this );
// copy recorded TapNotes
@@ -97,20 +97,20 @@ void NoteData::CopyRange( const NoteData* pFrom, int iFromIndexBegin, int iFromI
this->From4s( To );
}
void NoteData::Config( const NoteData &From )
void NoteData::Config( const NoteData& from )
{
SetNumTracks( From.GetNumTracks() );
SetNumTracks( from.GetNumTracks() );
}
void NoteData::CopyAll( const NoteData* pFrom )
void NoteData::CopyAll( const NoteData& from )
{
Config(*pFrom);
Config(from);
ClearAll();
for( int c=0; c<GetNumTracks(); c++ )
m_TapNotes[c] = pFrom->m_TapNotes[c];
m_HoldNotes = pFrom->m_HoldNotes;
m_AttackMap = pFrom->m_AttackMap;
m_TapNotes[c] = from.m_TapNotes[c];
m_HoldNotes = from.m_HoldNotes;
m_AttackMap = from.m_AttackMap;
}
bool NoteData::IsRowEmpty( int index ) const
@@ -628,27 +628,27 @@ void NoteData::ConvertHoldNotesTo2sAnd3s()
}
void NoteData::To2sAnd3s( const NoteData &out )
void NoteData::To2sAnd3s( const NoteData& from )
{
CopyAll( &out );
CopyAll( from );
ConvertHoldNotesTo2sAnd3s();
}
void NoteData::From2sAnd3s( const NoteData &out )
void NoteData::From2sAnd3s( const NoteData& from )
{
CopyAll( &out );
CopyAll( from );
Convert2sAnd3sToHoldNotes();
}
void NoteData::To4s( const NoteData &out )
void NoteData::To4s( const NoteData& from )
{
CopyAll( &out );
CopyAll( from );
ConvertHoldNotesTo4s();
}
void NoteData::From4s( const NoteData &out )
void NoteData::From4s( const NoteData& from )
{
CopyAll( &out );
CopyAll( from );
Convert4sToHoldNotes();
}
@@ -694,13 +694,13 @@ void NoteData::ConvertHoldNotesTo4s()
}
// -1 for iOriginalTracksToTakeFrom means no track
void NoteData::LoadTransformed( const NoteData* pOriginal, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] )
void NoteData::LoadTransformed( const NoteData& original, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] )
{
// reset all notes
Init();
NoteData Original;
Original.To4s( *pOriginal );
Original.To4s( original );
Config( Original );
SetNumTracks( iNewNumTracks );
+8 -8
View File
@@ -35,7 +35,7 @@ public:
/* Set up to hold the data in From; same number of tracks, same
* divisor. Doesn't allocate or copy anything. */
void Config( const NoteData &From );
void Config( const NoteData& from );
NoteData();
~NoteData();
@@ -79,8 +79,8 @@ public:
void ClearRange( int iNoteIndexBegin, int iNoteIndexEnd );
void ClearAll();
void CopyRange( const NoteData* pFrom, int iFromIndexBegin, int iFromIndexEnd, int iToIndexBegin = 0 );
void CopyAll( const NoteData* pFrom );
void CopyRange( const NoteData& from, int iFromIndexBegin, int iFromIndexEnd, int iToIndexBegin = 0 );
void CopyAll( const NoteData& from );
bool IsRowEmpty( int index ) const;
bool IsRangeEmpty( int track, int iIndexBegin, int iIndexEnd ) const;
@@ -138,18 +138,18 @@ public:
int RowNeedsHands( int row ) const;
// Transformations
void LoadTransformed( const NoteData* pOriginal, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] ); // -1 for iOriginalTracksToTakeFrom means no track
void LoadTransformed( const NoteData& original, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] ); // -1 for iOriginalTracksToTakeFrom means no track
// Convert between HoldNote representation and '2' and '3' markers in TapNotes
void Convert2sAnd3sToHoldNotes();
void ConvertHoldNotesTo2sAnd3s();
void To2sAnd3s( const NoteData &out );
void From2sAnd3s( const NoteData &out );
void To2sAnd3s( const NoteData& from );
void From2sAnd3s( const NoteData& from );
void Convert4sToHoldNotes();
void ConvertHoldNotesTo4s();
void To4s( const NoteData &out );
void From4s( const NoteData &out );
void To4s( const NoteData& from );
void From4s( const NoteData& from );
void EliminateAllButOneTap( int row );
};
+7 -7
View File
@@ -141,7 +141,7 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData,
if( 1 == sscanf( p, "%u]", &uKeysoundIndex ) ) // not fatal if this fails due to malformed data
{
tn.bKeysound = true;
tn.keysoundIndex = (uint16_t)uKeysoundIndex;
tn.keysoundIndex = (uint16_t)uKeysoundIndex;
}
// skip past the ']'
@@ -1723,10 +1723,10 @@ void NoteDataUtil::ScaleRegion( NoteData &nd, float fScale, float fStartBeat, fl
const int iScaledFirstRowAfterRegion = (int)((fStartBeat + (fEndBeat - fStartBeat) * fScale) * ROWS_PER_BEAT);
if( fStartBeat != 0 )
temp1.CopyRange( &nd, 0, BeatToNoteRowNotRounded(fStartBeat) );
temp1.CopyRange( nd, 0, BeatToNoteRowNotRounded(fStartBeat) );
if( nd.GetLastRow() > iFirstRowAtEndOfRegion )
temp1.CopyRange( &nd, iFirstRowAtEndOfRegion, nd.GetLastRow(), iScaledFirstRowAfterRegion);
temp2.CopyRange( &nd, BeatToNoteRowNotRounded(fStartBeat), iFirstRowAtEndOfRegion );
temp1.CopyRange( nd, iFirstRowAtEndOfRegion, nd.GetLastRow(), iScaledFirstRowAfterRegion);
temp2.CopyRange( nd, BeatToNoteRowNotRounded(fStartBeat), iFirstRowAtEndOfRegion );
nd.ClearAll();
for( int r=0; r<=temp2.GetLastRow(); r++ )
@@ -1744,7 +1744,7 @@ void NoteDataUtil::ScaleRegion( NoteData &nd, float fScale, float fStartBeat, fl
}
}
nd.CopyAll( &temp1 );
nd.CopyAll( temp1 );
}
void NoteDataUtil::ShiftRows( NoteData &nd, float fStartBeat, float fBeatsToShift )
@@ -1762,9 +1762,9 @@ void NoteDataUtil::ShiftRows( NoteData &nd, float fStartBeat, float fBeatsToShif
else // delete rows
iTakeFromRow += BeatToNoteRow( -fBeatsToShift );
temp.CopyRange( &nd, iTakeFromRow, nd.GetLastRow() );
temp.CopyRange( nd, iTakeFromRow, nd.GetLastRow() );
nd.ClearRange( min(iTakeFromRow,iPasteAtRow), nd.GetLastRow() );
nd.CopyRange( &temp, 0, temp.GetLastRow(), iPasteAtRow );
nd.CopyRange( temp, 0, temp.GetLastRow(), iPasteAtRow );
}
/*
+1 -1
View File
@@ -88,7 +88,7 @@ void NoteField::Load( const NoteData* pNoteData, PlayerNumber pn, int iFirstPixe
m_HeldHoldNotes.clear();
m_ActiveHoldNotes.clear();
this->CopyAll( pNoteData );
this->CopyAll( *pNoteData );
ASSERT( GetNumTracks() == GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer );
CacheAllUsedNoteSkins();
+2 -2
View File
@@ -427,9 +427,9 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out, const map<CSt
NoteData* pNoteData2 = new NoteData;
pNoteData2->SetNumTracks( iNumNewTracks );
pNoteData2->LoadTransformed( pNoteData, iNumNewTracks, iTransformNewToOld );
pNoteData2->LoadTransformed( *pNoteData, iNumNewTracks, iTransformNewToOld );
out.SetNoteData(pNoteData2);
out.SetNoteData(*pNoteData2);
delete pNoteData;
delete pNoteData2;
+1 -1
View File
@@ -297,7 +297,7 @@ bool DWILoader::LoadFromDWITokens(
ASSERT( newNoteData.GetNumTracks() > 0 );
out.SetNoteData(&newNoteData);
out.SetNoteData( newNoteData );
out.TidyUpData();
+1 -1
View File
@@ -210,7 +210,7 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Steps &out, const Song &s
// if( song.m_Timing.m_BPMSegments.size() > 1 )
// RemoveHoles( notedata, song );
out.SetNoteData(&notedata);
out.SetNoteData( notedata );
out.TidyUpData();
+1 -1
View File
@@ -189,7 +189,7 @@ CString NotesWriterDWI::OptimizeDWIString( CString holds, CString taps )
void NotesWriterDWI::WriteDWINotesField( RageFile &f, const Steps &out, int start )
{
NoteData notedata;
out.GetNoteData( &notedata );
out.GetNoteData( notedata );
notedata.ConvertHoldNotesTo2sAnd3s();
const int iLastMeasure = int( notedata.GetLastBeat()/BEATS_PER_MEASURE );
+101 -69
View File
@@ -97,7 +97,17 @@ PlayerMinus::~PlayerMinus()
{
}
void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, ScoreDisplay* pSecondaryScoreDisplay, Inventory* pInventory, ScoreKeeper* pPrimaryScoreKeeper, ScoreKeeper* pSecondaryScoreKeeper, NoteField* pNoteField )
void PlayerMinus::Load(
PlayerNumber pn,
const NoteData& noteData,
LifeMeter* pLM,
CombinedLifeMeter* pCombinedLM,
ScoreDisplay* pScoreDisplay,
ScoreDisplay* pSecondaryScoreDisplay,
Inventory* pInventory,
ScoreKeeper* pPrimaryScoreKeeper,
ScoreKeeper* pSecondaryScoreKeeper,
NoteField* pNoteField )
{
m_iDCState = AS2D_IDLE;
//LOG->Trace( "PlayerMinus::Load()", );
@@ -121,13 +131,11 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
const Style* pStyle = GAMESTATE->GetCurrentStyle();
// init scoring
NoteDataWithScoring::Init();
// copy note data
this->CopyAll( pNoteData );
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && g_CurStageStats.bFailed[pn] ) // Oni dead
this->ClearAll();
// init steps
m_NoteData.Init();
bool bOniDead = GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && g_CurStageStats.bFailed[pn];
if( !bOniDead )
m_NoteData.CopyAll( noteData );
/* The editor reuses Players ... so we really need to make sure everything
* is reset and not tweening. Perhaps ActorFrame should recurse to subactors;
@@ -145,7 +153,7 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
// m_pScore->Init( pn );
/* Apply transforms. */
NoteDataUtil::TransformNoteData( *this, GAMESTATE->m_PlayerOptions[pn], GAMESTATE->GetCurrentStyle()->m_StepsType );
NoteDataUtil::TransformNoteData( m_NoteData, GAMESTATE->m_PlayerOptions[pn], GAMESTATE->GetCurrentStyle()->m_StepsType );
switch( GAMESTATE->m_PlayMode )
{
@@ -153,7 +161,7 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
case PLAY_MODE_BATTLE:
{
// ugly, ugly, ugly. Works only w/ dance.
NoteDataUtil::TransformNoteData( *this, GAMESTATE->m_PlayerOptions[pn], GAMESTATE->GetCurrentStyle()->m_StepsType );
NoteDataUtil::TransformNoteData( m_NoteData, GAMESTATE->m_PlayerOptions[pn], GAMESTATE->GetCurrentStyle()->m_StepsType );
// shuffle either p1 or p2
static int count = 0;
@@ -161,11 +169,11 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
{
case 0:
case 3:
NoteDataUtil::Turn( *this, STEPS_TYPE_DANCE_SINGLE, NoteDataUtil::left);
NoteDataUtil::Turn( m_NoteData, STEPS_TYPE_DANCE_SINGLE, NoteDataUtil::left);
break;
case 1:
case 2:
NoteDataUtil::Turn( *this, STEPS_TYPE_DANCE_SINGLE, NoteDataUtil::right);
NoteDataUtil::Turn( m_NoteData, STEPS_TYPE_DANCE_SINGLE, NoteDataUtil::right);
break;
default:
ASSERT(0);
@@ -188,7 +196,7 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
m_pNoteField->SetY( fNoteFieldMidde );
m_fNoteFieldHeight = GRAY_ARROWS_Y_REVERSE-GRAY_ARROWS_Y_STANDARD;
m_pNoteField->Load( this, pn, iStartDrawingAtPixels, iStopDrawingAtPixels, m_fNoteFieldHeight );
m_pNoteField->Load( &m_NoteData, pn, iStartDrawingAtPixels, iStopDrawingAtPixels, m_fNoteFieldHeight );
m_ArrowBackdrop.SetPlayer( pn );
const bool bReverse = GAMESTATE->m_PlayerOptions[pn].GetReversePercentForColumn(0) == 1;
@@ -319,10 +327,10 @@ void PlayerMinus::Update( float fDeltaTime )
//
// update HoldNotes logic
//
for( int i=0; i < GetNumHoldNotes(); i++ ) // for each HoldNote
for( int i=0; i < m_NoteData.GetNumHoldNotes(); i++ ) // for each HoldNote
{
const HoldNote &hn = GetHoldNote(i);
HoldNoteScore hns = GetHoldNoteScore(hn);
const HoldNote &hn = m_NoteData.GetHoldNote(i);
HoldNoteScore hns = m_NoteData.GetHoldNoteScore(hn);
m_pNoteField->m_HeldHoldNotes[hn] = false; // set hold flag so NoteField can do intelligent drawing
m_pNoteField->m_ActiveHoldNotes[hn] = false; // set hold flag so NoteField can do intelligent drawing
@@ -337,10 +345,10 @@ void PlayerMinus::Update( float fDeltaTime )
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
// if they got a bad score or haven't stepped on the corresponding tap yet
const TapNoteScore tns = GetTapNoteScore( hn.iTrack, hn.iStartRow );
const TapNoteScore tns = m_NoteData.GetTapNoteScore( hn.iTrack, hn.iStartRow );
const bool bSteppedOnTapNote = tns != TNS_NONE && tns != TNS_MISS; // did they step on the start of this hold?
float fLife = GetHoldNoteLife(hn);
float fLife = m_NoteData.GetHoldNoteLife(hn);
// If the song beat is in the range of this hold:
if( hn.iStartRow <= iSongRow && iSongRow <= hn.iEndRow )
@@ -362,7 +370,7 @@ void PlayerMinus::Update( float fDeltaTime )
HoldNoteResult *hnr = m_pNoteField->CreateHoldNoteResult( hn );
hnr->iLastHeldRow = min( iSongRow, hn.iEndRow );
hnr = this->CreateHoldNoteResult( hn );
hnr = m_NoteData.CreateHoldNoteResult( hn );
hnr->iLastHeldRow = min( iSongRow, hn.iEndRow );
}
@@ -418,8 +426,8 @@ void PlayerMinus::Update( float fDeltaTime )
m_pNoteField->SetHoldNoteLife(hn, fLife); // update the NoteField display
m_pNoteField->SetHoldNoteScore(hn, hns); // update the NoteField display
SetHoldNoteLife(hn, fLife);
SetHoldNoteScore(hn, hns);
m_NoteData.SetHoldNoteLife(hn, fLife);
m_NoteData.SetHoldNoteScore(hn, hns);
}
{
@@ -475,15 +483,15 @@ void PlayerMinus::ApplyWaitingTransforms()
float fStartBeat, fEndBeat;
mod.GetAttackBeats( GAMESTATE->m_pCurSong, m_PlayerNumber, fStartBeat, fEndBeat );
fEndBeat = min( fEndBeat, GetLastBeat() );
fEndBeat = min( fEndBeat, m_NoteData.GetLastBeat() );
LOG->Trace( "Applying transform '%s' from %f to %f to '%s'", mod.sModifier.c_str(), fStartBeat, fEndBeat,
GAMESTATE->m_pCurSong->GetTranslitMainTitle().c_str() );
if( po.m_sNoteSkin != "" )
GAMESTATE->SetNoteSkinForBeatRange( m_PlayerNumber, po.m_sNoteSkin, fStartBeat, fEndBeat );
NoteDataUtil::TransformNoteData( *this, po, GAMESTATE->GetCurrentStyle()->m_StepsType, fStartBeat, fEndBeat );
m_pNoteField->CopyRange( this, BeatToNoteRow(fStartBeat), BeatToNoteRow(fEndBeat), BeatToNoteRow(fStartBeat) );
NoteDataUtil::TransformNoteData( m_NoteData, po, GAMESTATE->GetCurrentStyle()->m_StepsType, fStartBeat, fEndBeat );
m_pNoteField->CopyRange( m_NoteData, BeatToNoteRow(fStartBeat), BeatToNoteRow(fEndBeat), BeatToNoteRow(fStartBeat) );
}
GAMESTATE->m_ModsToApply[m_PlayerNumber].clear();
}
@@ -573,7 +581,7 @@ void PlayerMinus::DrawHoldJudgments()
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fBlind > 0 )
return;
for( int c=0; c<GetNumTracks(); c++ )
for( int c=0; c<m_NoteData.GetNumTracks(); c++ )
{
g_NoteFieldMode[m_PlayerNumber].BeginDrawTrack(c);
@@ -599,8 +607,8 @@ int PlayerMinus::GetClosestNoteDirectional( int col, float fBeat, float fMaxBeat
int iCurrentIndex = iIndexStartLookingAt + (iDirection * delta);
if( iCurrentIndex < 0) continue;
if( GetTapNote(col, iCurrentIndex).type == TapNote::empty) continue; /* no note here */
if( GetTapNoteScore(col, iCurrentIndex) != TNS_NONE ) continue; /* this note has a score already */
if( m_NoteData.GetTapNote(col, iCurrentIndex).type == TapNote::empty) continue; /* no note here */
if( m_NoteData.GetTapNoteScore(col, iCurrentIndex) != TNS_NONE ) continue; /* this note has a score already */
return iCurrentIndex;
}
@@ -633,7 +641,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
//LOG->Trace( "PlayerMinus::HandlePlayerStep()" );
ASSERT( col >= 0 && col <= GetNumTracks() );
ASSERT( col >= 0 && col <= m_NoteData.GetNumTracks() );
float fPositionSeconds = GAMESTATE->m_fMusicSeconds;
fPositionSeconds -= tm.Ago();
@@ -676,7 +684,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
const float fSecondsFromPerfect = fabsf( fNoteOffset );
TapNote tn = GetTapNote(col,iIndexOverlappingNote);
TapNote tn = m_NoteData.GetTapNote(col,iIndexOverlappingNote);
switch( GAMESTATE->m_PlayerController[m_PlayerNumber] )
{
@@ -706,16 +714,16 @@ void PlayerMinus::Step( int col, RageTimer tm )
{
m_soundAttackLaunch.Play();
// put attack in effect
Attack attack = this->GetAttackAt( col, iIndexOverlappingNote );
Attack attack = m_NoteData.GetAttackAt( col, iIndexOverlappingNote );
GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[m_PlayerNumber], attack );
// remove all TapAttacks on this row
for( int t=0; t<this->GetNumTracks(); t++ )
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
{
TapNote tn = this->GetTapNote(t, iIndexOverlappingNote);
TapNote tn = m_NoteData.GetTapNote(t, iIndexOverlappingNote);
if( tn.type == TapNote::attack )
{
this->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
m_NoteData.SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
m_pNoteField->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
}
}
@@ -753,13 +761,13 @@ void PlayerMinus::Step( int col, RageTimer tm )
// there are are no mines to the left of us.
for( int t=0; t<col; t++ )
{
if( GetTapNote(t,iIndexOverlappingNote).type == TapNote::mine ) // there's a mine to the left of us
if( m_NoteData.GetTapNote(t,iIndexOverlappingNote).type == TapNote::mine ) // there's a mine to the left of us
return; // avoid
}
// The CPU hits a lot of mines. Make it less likely to hit
// mines that don't have a tap note on the same row.
bool bTapsOnRow = IsThereATapOrHoldHeadAtRow( iIndexOverlappingNote );
bool bTapsOnRow = m_NoteData.IsThereATapOrHoldHeadAtRow( iIndexOverlappingNote );
TapNoteScore get_to_avoid = bTapsOnRow ? TNS_GREAT : TNS_GOOD;
if( score >= get_to_avoid )
@@ -793,16 +801,16 @@ void PlayerMinus::Step( int col, RageTimer tm )
score = TNS_NONE; // don't score this as anything
// put attack in effect
Attack attack = this->GetAttackAt( col, iIndexOverlappingNote );
Attack attack = m_NoteData.GetAttackAt( col, iIndexOverlappingNote );
GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[m_PlayerNumber], attack );
// remove all TapAttacks on this row
for( int t=0; t<this->GetNumTracks(); t++ )
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
{
TapNote tn = this->GetTapNote(t, iIndexOverlappingNote);
TapNote tn = m_NoteData.GetTapNote(t, iIndexOverlappingNote);
if( tn.type == TapNote::attack )
{
this->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
m_NoteData.SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
m_pNoteField->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
}
}
@@ -844,10 +852,10 @@ void PlayerMinus::Step( int col, RageTimer tm )
score, col, fStepSeconds, fCurrentMusicSeconds, fMusicSeconds, fNoteOffset );
// LOG->Trace("Note offset: %f (fSecondsFromPerfect = %f), Score: %i", fNoteOffset, fSecondsFromPerfect, score);
SetTapNoteScore(col, iIndexOverlappingNote, score);
m_NoteData.SetTapNoteScore(col, iIndexOverlappingNote, score);
if( score != TNS_NONE )
SetTapNoteOffset(col, iIndexOverlappingNote, -fNoteOffset);
m_NoteData.SetTapNoteOffset(col, iIndexOverlappingNote, -fNoteOffset);
if( GAMESTATE->m_PlayerController[m_PlayerNumber] == PC_HUMAN &&
score >= TNS_GREAT )
@@ -866,7 +874,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
case TapNote::tap:
case TapNote::hold_head:
// don't the row if this note is a mine or tap attack
if( IsRowCompletelyJudged(iIndexOverlappingNote) )
if( m_NoteData.IsRowCompletelyJudged(iIndexOverlappingNote) )
OnRowCompletelyJudged( iIndexOverlappingNote );
}
@@ -889,7 +897,9 @@ void PlayerMinus::Step( int col, RageTimer tm )
m_pNoteField->Step( col, score );
}
else
{
m_pNoteField->Step( col, TNS_NONE );
}
}
void PlayerMinus::HandleAutosync(float fNoteOffset)
@@ -931,16 +941,16 @@ void PlayerMinus::OnRowCompletelyJudged( int iIndexThatWasSteppedOn )
* columns with the "was pressed recently" columns to see whether or not you hit
* all the columns of the jump. -Chris */
// TapNoteScore score = MinTapNoteScore(iIndexThatWasSteppedOn);
TapNoteScore score = LastTapNoteScore(iIndexThatWasSteppedOn);
TapNoteScore score = m_NoteData.LastTapNoteScore( iIndexThatWasSteppedOn );
ASSERT(score != TNS_NONE);
ASSERT(score != TNS_HIT_MINE);
/* If the whole row was hit with perfects or greats, remove the row
* from the NoteField, so it disappears. */
for( int c=0; c<GetNumTracks(); c++ ) // for each column
for( int c=0; c<m_NoteData.GetNumTracks(); c++ ) // for each column
{
TapNote tn = GetTapNote(c, iIndexThatWasSteppedOn);
TapNote tn = m_NoteData.GetTapNote(c, iIndexThatWasSteppedOn);
if( tn.type == TapNote::empty ) continue; /* no note in this col */
if( tn.type == TapNote::mine ) continue; /* don't flash on mines b/c they're supposed to be missed */
@@ -1006,18 +1016,18 @@ void PlayerMinus::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
for( int r=iStartCheckingAt; r<iMissIfOlderThanThisIndex; r++ )
{
bool MissedNoteOnThisRow = false;
for( int t=0; t<GetNumTracks(); t++ )
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
{
if( GetTapNote(t, r).type == TapNote::empty) /* no note here */
if( m_NoteData.GetTapNote(t, r).type == TapNote::empty) /* no note here */
continue;
if( GetTapNoteScore(t, r) != TNS_NONE ) /* note here is already hit */
if( m_NoteData.GetTapNoteScore(t, r) != TNS_NONE ) /* note here is already hit */
continue;
if( GetTapNote(t, r).type != TapNote::mine )
if( m_NoteData.GetTapNote(t, r).type != TapNote::mine )
{
// A normal note. Penalize for not stepping on it.
MissedNoteOnThisRow = true;
SetTapNoteScore(t, r, TNS_MISS);
m_NoteData.SetTapNoteScore( t, r, TNS_MISS );
g_CurStageStats.iTotalError[m_PlayerNumber] += MAX_PRO_TIMING_ERROR;
m_ProTimingDisplay.SetJudgment( MAX_PRO_TIMING_ERROR, TNS_MISS );
}
@@ -1039,16 +1049,18 @@ void PlayerMinus::CrossedRow( int iNoteRow )
{
// If we're doing random vanish, randomise notes on the fly.
if(GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fAppearances[PlayerOptions::APPEARANCE_RANDOMVANISH]==1)
RandomiseNotes( iNoteRow );
RandomizeNotes( iNoteRow );
// check to see if there's at the crossed row
// check to see if there's a note at the crossed row
RageTimer now;
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
{
for( int t=0; t<GetNumTracks(); t++ )
if( GetTapNote(t, iNoteRow).type != TapNote::empty )
if( GetTapNoteScore(t, iNoteRow) == TNS_NONE )
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
{
if( m_NoteData.GetTapNote(t, iNoteRow).type != TapNote::empty )
if( m_NoteData.GetTapNoteScore(t, iNoteRow) == TNS_NONE )
Step( t, now );
}
}
}
@@ -1056,9 +1068,9 @@ void PlayerMinus::CrossedMineRow( int iNoteRow )
{
// Hold the panel while crossing a mine will cause the mine to explode
RageTimer now;
for( int t=0; t<GetNumTracks(); t++ )
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
{
if( GetTapNote(t,iNoteRow).type == TapNote::mine )
if( m_NoteData.GetTapNote(t,iNoteRow).type == TapNote::mine )
{
const StyleInput StyleI( m_PlayerNumber, t );
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
@@ -1078,7 +1090,7 @@ void PlayerMinus::CrossedMineRow( int iNoteRow )
}
}
void PlayerMinus::RandomiseNotes( int iNoteRow )
void PlayerMinus::RandomizeNotes( int iNoteRow )
{
// change the row to look ahead from based upon their speed mod
/* This is incorrect: if m_fScrollSpeed is 0.5, we'll never change
@@ -1086,33 +1098,33 @@ void PlayerMinus::RandomiseNotes( int iNoteRow )
int iNewNoteRow = iNoteRow + ROWS_PER_BEAT*2;
iNewNoteRow = int( iNewNoteRow / GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fScrollSpeed );
int iNumOfTracks = GetNumTracks();
int iNumOfTracks = m_NoteData.GetNumTracks();
for( int t=0; t+1 < iNumOfTracks; t++ )
{
const int iSwapWith = RandomInt( 0, iNumOfTracks-1 );
/* Only swap a tap and an empty. */
const TapNote t1 = GetTapNote(t, iNewNoteRow);
const TapNote t1 = m_NoteData.GetTapNote(t, iNewNoteRow);
if( t1.type != TapNote::tap )
continue;
const TapNote t2 = GetTapNote( iSwapWith, iNewNoteRow );
const TapNote t2 = m_NoteData.GetTapNote( iSwapWith, iNewNoteRow );
if( t2.type != TapNote::empty )
continue;
/* Make sure the destination row isn't in the middle of a hold. */
bool bSkip = false;
for( int i = 0; !bSkip && i < GetNumHoldNotes(); ++i )
for( int i = 0; !bSkip && i < m_NoteData.GetNumHoldNotes(); ++i )
{
const HoldNote &hn = GetHoldNote(i);
const HoldNote &hn = m_NoteData.GetHoldNote(i);
if( hn.iTrack == iSwapWith && hn.RowIsInRange(iNewNoteRow) )
bSkip = true;
}
if( bSkip )
continue;
SetTapNote( t, iNewNoteRow, t2 );
SetTapNote( iSwapWith, iNewNoteRow, t1 );
m_NoteData.SetTapNote( t, iNewNoteRow, t2 );
m_NoteData.SetTapNote( iSwapWith, iNewNoteRow, t1 );
const TapNote nft1 = m_pNoteField->GetTapNote( t, iNewNoteRow );
const TapNote nft2 = m_pNoteField->GetTapNote( iSwapWith, iNewNoteRow );
@@ -1123,8 +1135,8 @@ void PlayerMinus::RandomiseNotes( int iNoteRow )
void PlayerMinus::HandleTapRowScore( unsigned row )
{
TapNoteScore scoreOfLastTap = LastTapNoteScore(row);
int iNumTapsInRow = this->GetNumTracksWithTapOrHoldHead(row);
TapNoteScore scoreOfLastTap = m_NoteData.LastTapNoteScore(row);
int iNumTapsInRow = m_NoteData.GetNumTracksWithTapOrHoldHead(row);
ASSERT(iNumTapsInRow > 0);
bool NoCheating = true;
@@ -1278,9 +1290,29 @@ void PlayerMinus::FadeToFail()
}
/* XXX: Why's m_NoteField in a separate class, again? Is that still needed? */
void Player::Load( PlayerNumber player_no, const NoteData* pNoteData, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, ScoreDisplay* pSecondaryScoreDisplay, Inventory* pInventory, ScoreKeeper* pPrimaryScoreKeeper, ScoreKeeper* pSecondaryScoreKeeper )
/* It was used to have an invisible computer player in PLAY_MODE_BATTLE. -Chris */
void Player::Load(
PlayerNumber player_no,
const NoteData& noteData,
LifeMeter* pLM,
CombinedLifeMeter* pCombinedLM,
ScoreDisplay* pScoreDisplay,
ScoreDisplay* pSecondaryScoreDisplay,
Inventory* pInventory,
ScoreKeeper* pPrimaryScoreKeeper,
ScoreKeeper* pSecondaryScoreKeeper )
{
PlayerMinus::Load( player_no, pNoteData, pLM, pCombinedLM, pScoreDisplay, pSecondaryScoreDisplay, pInventory, pPrimaryScoreKeeper, pSecondaryScoreKeeper, &m_NoteField );
PlayerMinus::Load(
player_no,
noteData,
pLM,
pCombinedLM,
pScoreDisplay,
pSecondaryScoreDisplay,
pInventory,
pPrimaryScoreKeeper,
pSecondaryScoreKeeper,
&m_NoteField );
}
/*
+25 -4
View File
@@ -29,7 +29,7 @@ class Inventory;
#define SAMPLE_COUNT 16
class PlayerMinus : public NoteDataWithScoring, public ActorFrame
class PlayerMinus : public ActorFrame
{
public:
PlayerMinus();
@@ -38,11 +38,21 @@ public:
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
void Load( PlayerNumber player_no, const NoteData* pNoteData, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, ScoreDisplay* pSecondaryScoreDisplay, Inventory* pInventory, ScoreKeeper* pPrimaryScoreKeeper, ScoreKeeper* pSecondaryScoreKeeper, NoteField* pNoteField );
void Load(
PlayerNumber player_no,
const NoteData& noteData,
LifeMeter* pLM,
CombinedLifeMeter* pCombinedLM,
ScoreDisplay* pScoreDisplay,
ScoreDisplay* pSecondaryScoreDisplay,
Inventory* pInventory,
ScoreKeeper* pPrimaryScoreKeeper,
ScoreKeeper* pSecondaryScoreKeeper,
NoteField* pNoteField );
void CrossedRow( int iNoteRow );
void CrossedMineRow( int iNoteRow );
void Step( int col, RageTimer tm );
void RandomiseNotes( int iNoteRow );
void RandomizeNotes( int iNoteRow );
void FadeToFail();
int GetDancingCharacterState() const { return m_iDCState; };
void SetCharacterState(int iDCState) { m_iDCState = iDCState; };
@@ -50,6 +60,8 @@ public:
static float GetMaxStepDistanceSeconds();
NoteDataWithScoring m_NoteData;
protected:
void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
void OnRowCompletelyJudged( int iStepIndex );
@@ -100,7 +112,16 @@ protected:
class Player : public PlayerMinus
{
public:
void Load( PlayerNumber player_no, const NoteData* pNoteData, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, ScoreDisplay* pSecondaryScoreDisplay, Inventory* pInventory, ScoreKeeper* pPrimaryScoreKeeper, ScoreKeeper* pSecondaryScoreKeeper );
void Load(
PlayerNumber player_no,
const NoteData& noteData,
LifeMeter* pLM,
CombinedLifeMeter* pCombinedLM,
ScoreDisplay* pScoreDisplay,
ScoreDisplay* pSecondaryScoreDisplay,
Inventory* pInventory,
ScoreKeeper* pPrimaryScoreKeeper,
ScoreKeeper* pSecondaryScoreKeeper );
protected:
NoteField m_NoteField;
+4 -1
View File
@@ -120,7 +120,10 @@ RageSound &RageSound::operator=( const RageSound &cpy )
databuf.reserve(internal_buffer_size);
delete Sample;
Sample = cpy.Sample->Copy();
if( cpy.Sample )
Sample = cpy.Sample->Copy();
else
Sample = NULL;
m_sFilePath = cpy.m_sFilePath;
+2 -2
View File
@@ -30,14 +30,14 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
Steps* pSteps = apSteps[i];
const AttackArray &aa = asModifiers[i];
NoteData ndTemp;
pSteps->GetNoteData( &ndTemp );
pSteps->GetNoteData( ndTemp );
/* We might have been given lots of songs; don't keep them in memory uncompressed. */
pSteps->Compress();
const Style* pStyle = GAMESTATE->GetCurrentStyle();
NoteData nd;
pStyle->GetTransformedNoteDataForStyle( pn_, &ndTemp, &nd );
pStyle->GetTransformedNoteDataForStyle( pn_, ndTemp, nd );
/* Compute RadarValues before applying any user-selected mods. Apply
* Course mods and count them in the "pre" RadarValues because they're
+15 -15
View File
@@ -273,7 +273,7 @@ ScreenEdit::ScreenEdit( CString sName ) : Screen( sName )
m_pAttacksFromCourse = NULL;
NoteData noteData;
m_pSteps->GetNoteData( &noteData );
m_pSteps->GetNoteData( noteData );
m_EditMode = MODE_EDITING;
@@ -324,7 +324,7 @@ ScreenEdit::ScreenEdit( CString sName ) : Screen( sName )
/* XXX: Do we actually have to send real note data here, and to m_NoteFieldRecord?
* (We load again on play/record.) */
m_Player.Load( PLAYER_1, &noteData, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
m_Player.Load( PLAYER_1, noteData, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
GAMESTATE->m_PlayerController[PLAYER_1] = PC_HUMAN;
m_Player.SetX( PLAYER_X );
/* Why was this here? Nothing ever sets Player Y values; this was causing
@@ -399,7 +399,7 @@ void ScreenEdit::PlayTicks()
int iTickRow = -1;
for( int r=iRowLastCrossed+1; r<=iSongRow; r++ ) // for each index we crossed since the last update
if( m_Player.IsThereATapOrHoldHeadAtRow( r ) )
if( m_Player.m_NoteData.IsThereATapOrHoldHeadAtRow( r ) )
iTickRow = r;
iRowLastCrossed = iSongRow;
@@ -938,7 +938,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
// save current steps
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
ASSERT( pSteps );
pSteps->SetNoteData( &m_NoteFieldEdit );
pSteps->SetNoteData( m_NoteFieldEdit );
// Get all Steps of this StepsType
StepsType st = pSteps->m_StepsType;
@@ -975,7 +975,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
pSteps = *it;
GAMESTATE->m_pCurSteps[PLAYER_1] = m_pSteps = pSteps;
pSteps->GetNoteData( &m_NoteFieldEdit );
pSteps->GetNoteData( m_NoteFieldEdit );
SCREENMAN->SystemMessage( ssprintf(
"Switched to %s %s '%s'",
GAMEMAN->StepsTypeToString( pSteps->m_StepsType ).c_str(),
@@ -1323,7 +1323,7 @@ void ScreenEdit::TransitionFromRecordToEdit()
// delete old TapNotes in the range
m_NoteFieldEdit.ClearRange( iNoteIndexBegin, iNoteIndexEnd );
m_NoteFieldEdit.CopyRange( &m_NoteFieldRecord, iNoteIndexBegin, iNoteIndexEnd, iNoteIndexBegin );
m_NoteFieldEdit.CopyRange( m_NoteFieldRecord, iNoteIndexBegin, iNoteIndexEnd, iNoteIndexBegin );
}
/* Helper for SM_DoReloadFromDisk */
@@ -1451,7 +1451,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
SCREENMAN->SystemMessage( sMessage );
m_pSteps = GAMESTATE->m_pCurSteps[PLAYER_1] = pSteps;
m_pSteps->GetNoteData( &m_NoteFieldEdit );
m_pSteps->GetNoteData( m_NoteFieldEdit );
break;
}
@@ -1590,7 +1590,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers )
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
ASSERT( pSteps );
pSteps->SetNoteData( &m_NoteFieldEdit );
pSteps->SetNoteData( m_NoteFieldEdit );
GAMESTATE->m_pCurSong->Save();
// we shouldn't say we're saving a DWI if we're on any game besides
@@ -1741,7 +1741,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
int iFirstRow = BeatToNoteRow( m_NoteFieldEdit.m_fBeginMarker );
int iLastRow = BeatToNoteRow( m_NoteFieldEdit.m_fEndMarker );
m_Clipboard.ClearAll();
m_Clipboard.CopyRange( &m_NoteFieldEdit, iFirstRow, iLastRow );
m_Clipboard.CopyRange( m_NoteFieldEdit, iFirstRow, iLastRow );
}
break;
case paste_at_current_beat:
@@ -1749,7 +1749,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
int iSrcFirstRow = 0;
int iSrcLastRow = BeatToNoteRow( m_Clipboard.GetLastBeat() );
int iDestFirstRow = BeatToNoteRow( GAMESTATE->m_fSongBeat );
m_NoteFieldEdit.CopyRange( &m_Clipboard, iSrcFirstRow, iSrcLastRow, iDestFirstRow );
m_NoteFieldEdit.CopyRange( m_Clipboard, iSrcFirstRow, iSrcLastRow, iDestFirstRow );
}
break;
case paste_at_begin_marker:
@@ -1758,7 +1758,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
int iSrcFirstRow = 0;
int iSrcLastRow = BeatToNoteRow( m_Clipboard.GetLastBeat() );
int iDestFirstRow = BeatToNoteRow( m_NoteFieldEdit.m_fBeginMarker );
m_NoteFieldEdit.CopyRange( &m_Clipboard, iSrcFirstRow, iSrcLastRow, iDestFirstRow );
m_NoteFieldEdit.CopyRange( m_Clipboard, iSrcFirstRow, iSrcLastRow, iDestFirstRow );
}
break;
case clear:
@@ -1910,11 +1910,11 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
(sIter[i]->GetDifficulty() == GAMESTATE->m_pCurSteps[PLAYER_1]->GetDifficulty()) )
continue;
sIter[i]->GetNoteData( &ndTemp );
sIter[i]->GetNoteData( ndTemp );
ndTemp.ConvertHoldNotesTo2sAnd3s();
NoteDataUtil::ScaleRegion( ndTemp, fScale, m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker );
ndTemp.Convert2sAnd3sToHoldNotes();
sIter[i]->SetNoteData( &ndTemp );
sIter[i]->SetNoteData( ndTemp );
}
m_NoteFieldEdit.m_fEndMarker = fNewClipboardEndBeat;
@@ -1944,7 +1944,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
SetupCourseAttacks();
m_Player.Load( PLAYER_1, &m_NoteFieldEdit, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
m_Player.Load( PLAYER_1, m_NoteFieldEdit, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
GAMESTATE->m_PlayerController[PLAYER_1] = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
m_rectRecordBack.StopTweening();
@@ -1959,7 +1959,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
* and recalc it. */
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
ASSERT( pSteps );
pSteps->SetNoteData( &m_NoteFieldEdit );
pSteps->SetNoteData( m_NoteFieldEdit );
m_pSong->ReCalculateRadarValuesAndLastBeat();
m_Background.Unload();
+21 -21
View File
@@ -810,13 +810,13 @@ void ScreenGameplay::SetupSong( PlayerNumber p, int iSongIndex )
* once in Player::Load, then again in Player::ApplyActiveAttacks. This
* is very bad for transforms like AddMines.
*/
NoteData pOriginalNoteData;
GAMESTATE->m_pCurSteps[p]->GetNoteData( &pOriginalNoteData );
NoteData originalNoteData;
GAMESTATE->m_pCurSteps[p]->GetNoteData( originalNoteData );
const Style* pStyle = GAMESTATE->GetCurrentStyle();
NoteData pNewNoteData;
pStyle->GetTransformedNoteDataForStyle( p, &pOriginalNoteData, &pNewNoteData );
m_Player[p].Load( p, &pNewNoteData, m_pLifeMeter[p], m_pCombinedLifeMeter, m_pPrimaryScoreDisplay[p], m_pSecondaryScoreDisplay[p], m_pInventory[p], m_pPrimaryScoreKeeper[p], m_pSecondaryScoreKeeper[p] );
NoteData newNoteData;
pStyle->GetTransformedNoteDataForStyle( p, originalNoteData, newNoteData );
m_Player[p].Load( p, newNoteData, m_pLifeMeter[p], m_pCombinedLifeMeter, m_pPrimaryScoreDisplay[p], m_pSecondaryScoreDisplay[p], m_pInventory[p], m_pPrimaryScoreKeeper[p], m_pSecondaryScoreKeeper[p] );
// Put course options into effect. Do this after Player::Load so
@@ -939,9 +939,9 @@ void ScreenGameplay::LoadNextSong()
/* The actual note data for scoring is the base class of Player. This includes
* transforms, like Wide. Otherwise, the scoring will operate on the wrong data. */
m_pPrimaryScoreKeeper[p]->OnNextSong( GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurSteps[p], &m_Player[p] );
m_pPrimaryScoreKeeper[p]->OnNextSong( GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurSteps[p], &m_Player[p].m_NoteData );
if( m_pSecondaryScoreKeeper[p] )
m_pSecondaryScoreKeeper[p]->OnNextSong( GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurSteps[p], &m_Player[p] );
m_pSecondaryScoreKeeper[p]->OnNextSong( GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurSteps[p], &m_Player[p].m_NoteData );
if( m_bDemonstration )
{
@@ -1027,7 +1027,7 @@ void ScreenGameplay::LoadNextSong()
FOREACH_HumanPlayer( p )
{
if( GAMESTATE->m_pCurSteps[p]->GetDifficulty() == DIFFICULTY_BEGINNER )
m_BeginnerHelper.AddPlayer( p, &m_Player[p] );
m_BeginnerHelper.AddPlayer( p, &m_Player[p].m_NoteData );
}
}
@@ -1068,8 +1068,8 @@ void ScreenGameplay::LoadNextSong()
// (Re)Calculate the song position meter
m_fSongPosMeterOffset = GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat(
GAMESTATE->m_pCurSong->m_fFirstBeat );
m_fSongPosMeterEnd = GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat(
GAMESTATE->m_pCurSong->m_fLastBeat );
m_fSongPosMeterEnd = ( GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat(
GAMESTATE->m_pCurSong->m_fLastBeat ) - m_fSongPosMeterOffset );
//
// Load cabinet lights data
@@ -1081,7 +1081,7 @@ void ScreenGameplay::LoadNextSong()
Steps *pSteps = GAMESTATE->m_pCurSong->GetClosestNotes( STEPS_TYPE_LIGHTS_CABINET, StringToDifficulty(PREFSMAN->m_sLightsStepsDifficulty) );
if( pSteps != NULL )
{
pSteps->GetNoteData( &m_CabinetLightsNoteData );
pSteps->GetNoteData( m_CabinetLightsNoteData );
}
else
{
@@ -1089,7 +1089,7 @@ void ScreenGameplay::LoadNextSong()
if( pSteps )
{
NoteData TapNoteData;
pSteps->GetNoteData( &TapNoteData );
pSteps->GetNoteData( TapNoteData );
NoteDataUtil::LoadTransformedLights( TapNoteData, m_CabinetLightsNoteData, GameManager::StepsTypeToNumTracks(STEPS_TYPE_LIGHTS_CABINET) );
}
}
@@ -1155,7 +1155,7 @@ void ScreenGameplay::PlayTicks()
int iTickRow = -1;
for( int r=iRowLastCrossed+1; r<=iSongRow; r++ ) // for each index we crossed since the last update
if( m_Player[GAMESTATE->m_MasterPlayerNumber].IsThereATapOrHoldHeadAtRow( r ) )
if( m_Player[GAMESTATE->m_MasterPlayerNumber].m_NoteData.IsThereATapOrHoldHeadAtRow( r ) )
iTickRow = r;
iRowLastCrossed = iSongRow;
@@ -1351,7 +1351,7 @@ void ScreenGameplay::Update( float fDeltaTime )
// kill them!
SOUND->PlayOnceFromDir( THEME->GetPathS(m_sName,"oni die") );
ShowOniGameOver(pn);
m_Player[pn].Init(); // remove all notes and scoring
m_Player[pn].m_NoteData.Init(); // remove all notes and scoring
m_Player[pn].FadeToFail(); // tell the NoteField to fade to white
}
}
@@ -1432,7 +1432,7 @@ void ScreenGameplay::Update( float fDeltaTime )
{
SOUND->PlayOnceFromDir( THEME->GetPathS(m_sName,"oni die") );
ShowOniGameOver( p );
m_Player[p].Init(); // remove all notes and scoring
m_Player[p].m_NoteData.Init(); // remove all notes and scoring
m_Player[p].FadeToFail(); // tell the NoteField to fade to white
}
}
@@ -1522,9 +1522,9 @@ void ScreenGameplay::Update( float fDeltaTime )
}
FOREACH_EnabledPlayer( pn )
{
for( int t=0; t<m_Player[pn].GetNumTracks(); t++ )
for( int t=0; t<m_Player[pn].m_NoteData.GetNumTracks(); t++ )
{
TapNote tn = m_Player[pn].GetTapNote(t,r);
TapNote tn = m_Player[pn].m_NoteData.GetTapNote(t,r);
bool bBlink = (tn.type != TapNote::empty && tn.type != TapNote::mine);
if( bBlink )
{
@@ -1548,9 +1548,9 @@ void ScreenGameplay::Update( float fDeltaTime )
FOREACH_EnabledPlayer( pn )
{
// check if a hold should be active
for( int i=0; i < m_Player[pn].GetNumHoldNotes(); i++ ) // for each HoldNote
for( int i=0; i < m_Player[pn].m_NoteData.GetNumHoldNotes(); i++ ) // for each HoldNote
{
const HoldNote &hn = m_Player[pn].GetHoldNote(i);
const HoldNote &hn = m_Player[pn].m_NoteData.GetHoldNote(i);
if( hn.iStartRow <= iSongRow && iSongRow <= hn.iEndRow )
{
StyleInput si( pn, hn.iTrack );
@@ -1970,10 +1970,10 @@ void ScreenGameplay::SongFinished()
* not for the percentages (RADAR_AIR). */
RadarValues v;
NoteDataUtil::GetRadarValues( m_Player[p], GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
NoteDataUtil::GetRadarValues( m_Player[p].m_NoteData, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
g_CurStageStats.radarPossible[p] += v;
m_Player[p].GetActualRadarValues( p, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
m_Player[p].m_NoteData.GetActualRadarValues( p, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
g_CurStageStats.radarActual[p] += v;
}
+4 -4
View File
@@ -144,16 +144,16 @@ ScreenHowToPlay::ScreenHowToPlay( CString sName ) : ScreenAttract( sName )
Steps *pSteps = m_Song.GetStepsByDescription( pStyle->m_StepsType, "" );
ASSERT_M( pSteps != NULL, ssprintf("%i", pStyle->m_StepsType) );
NoteData TempNoteData;
pSteps->GetNoteData( &TempNoteData );
pStyle->GetTransformedNoteDataForStyle( PLAYER_1, &TempNoteData, &m_NoteData );
NoteData tempNoteData;
pSteps->GetNoteData( tempNoteData );
pStyle->GetTransformedNoteDataForStyle( PLAYER_1, tempNoteData, m_NoteData );
GAMESTATE->m_pCurSong = &m_Song;
GAMESTATE->m_bPastHereWeGo = true;
GAMESTATE->m_PlayerController[PLAYER_1] = PC_AUTOPLAY;
m_pPlayer = new Player;
m_pPlayer->Load( PLAYER_1, &m_NoteData, m_pLifeMeterBar, NULL, NULL, NULL, NULL, NULL, NULL );
m_pPlayer->Load( PLAYER_1, m_NoteData, m_pLifeMeterBar, NULL, NULL, NULL, NULL, NULL, NULL );
m_pPlayer->SetX( PLAYERX );
this->AddChild( m_pPlayer );
+1 -1
View File
@@ -791,7 +791,7 @@ void Song::ReCalculateRadarValuesAndLastBeat()
// calculate radar values
//
NoteData tempNoteData;
pSteps->GetNoteData( &tempNoteData );
pSteps->GetNoteData( tempNoteData );
RadarValues v;
NoteDataUtil::GetRadarValues( tempNoteData, m_fMusicLengthSeconds, v );
+14 -15
View File
@@ -52,14 +52,14 @@ Steps::~Steps()
delete notes_comp;
}
void Steps::SetNoteData( const NoteData* pNewNoteData )
void Steps::SetNoteData( const NoteData& noteDataNew )
{
ASSERT( pNewNoteData->GetNumTracks() == GameManager::StepsTypeToNumTracks(m_StepsType) );
ASSERT( noteDataNew.GetNumTracks() == GameManager::StepsTypeToNumTracks(m_StepsType) );
DeAutogen();
delete notes;
notes = new NoteData(*pNewNoteData);
notes = new NoteData( noteDataNew );
delete notes_comp;
notes_comp = new CompressedNoteData;
@@ -67,19 +67,18 @@ void Steps::SetNoteData( const NoteData* pNewNoteData )
m_uHash = GetHashForString( notes_comp->notes );
}
void Steps::GetNoteData( NoteData* pNoteDataOut ) const
void Steps::GetNoteData( NoteData& noteDataOut ) const
{
ASSERT(this);
ASSERT(pNoteDataOut);
Decompress();
if( notes != NULL )
*pNoteDataOut = *notes;
noteDataOut = *notes;
else
{
pNoteDataOut->ClearAll();
pNoteDataOut->SetNumTracks( GameManager::StepsTypeToNumTracks(m_StepsType) );
noteDataOut.ClearAll();
noteDataOut.SetNumTracks( GameManager::StepsTypeToNumTracks(m_StepsType) );
}
}
@@ -170,8 +169,8 @@ void Steps::Decompress() const
if(parent)
{
// get autogen notes
NoteData pdata;
parent->GetNoteData(&pdata);
NoteData notedata;
parent->GetNoteData( notedata );
notes = new NoteData;
@@ -179,9 +178,9 @@ void Steps::Decompress() const
if( this->m_StepsType == STEPS_TYPE_LIGHTS_CABINET )
{
NoteDataUtil::LoadTransformedLights( pdata, *notes, iNewTracks );
NoteDataUtil::LoadTransformedLights( notedata, *notes, iNewTracks );
} else {
NoteDataUtil::LoadTransformedSlidingWindow( pdata, *notes, iNewTracks );
NoteDataUtil::LoadTransformedSlidingWindow( notedata, *notes, iNewTracks );
NoteDataUtil::FixImpossibleRows( *notes, m_StepsType );
}
@@ -280,9 +279,9 @@ void Steps::CopyFrom( Steps* pSource, StepsType ntTo ) // pSource does not have
{
m_StepsType = ntTo;
NoteData noteData;
pSource->GetNoteData( &noteData );
pSource->GetNoteData( noteData );
noteData.SetNumTracks( GameManager::StepsTypeToNumTracks(ntTo) );
this->SetNoteData( &noteData );
this->SetNoteData( noteData );
this->SetDescription( "Copied from "+pSource->GetDescription() );
this->SetDifficulty( pSource->GetDifficulty() );
this->SetMeter( pSource->GetMeter() );
@@ -294,7 +293,7 @@ void Steps::CreateBlank( StepsType ntTo )
m_StepsType = ntTo;
NoteData noteData;
noteData.SetNumTracks( GameManager::StepsTypeToNumTracks(ntTo) );
this->SetNoteData( &noteData );
this->SetNoteData( noteData );
}
+2 -2
View File
@@ -47,8 +47,8 @@ public:
StepsType m_StepsType;
void GetNoteData( NoteData* pNoteDataOut ) const;
void SetNoteData( const NoteData* pNewNoteData );
void GetNoteData( NoteData& noteDataOut ) const;
void SetNoteData( const NoteData& noteDataNew );
void SetSMNoteData( const CString &notes_comp, const CString &attacks_comp );
void GetSMNoteData( CString &notes_comp_out, CString &attacks_comp_out ) const;
+2 -2
View File
@@ -22,7 +22,7 @@
#include "NoteData.h"
void Style::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData* pOriginal, NoteData* pNoteDataOut ) const
void Style::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData& original, NoteData& noteDataOut ) const
{
int iNewToOriginalTrack[MAX_COLS_PER_PLAYER];
for( int col=0; col<m_iColsPerPlayer; col++ )
@@ -33,7 +33,7 @@ void Style::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData* pOr
iNewToOriginalTrack[col] = originalTrack;
}
pNoteDataOut->LoadTransformed( pOriginal, m_iColsPerPlayer, iNewToOriginalTrack );
noteDataOut.LoadTransformed( original, m_iColsPerPlayer, iNewToOriginalTrack );
}
+1 -1
View File
@@ -59,7 +59,7 @@ public:
PlayerNumber ControllerToPlayerNumber( GameController controller ) const;
void GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData* pOriginal, NoteData* pNoteDataOut ) const;
void GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData& original, NoteData& noteDataOut ) const;
bool MatchesStepsType( StepsType type ) const;
+1 -1
View File
@@ -76,7 +76,7 @@ RadarValues Trail::GetRadarValues() const
if( !pSteps->IsAutogen() && e->ContainsTransformOrTurn() )
{
NoteData nd;
pSteps->GetNoteData( &nd );
pSteps->GetNoteData( nd );
RadarValues rv_orig;
NoteDataUtil::GetRadarValues( nd, e->pSong->m_fMusicLengthSeconds, rv_orig );
PlayerOptions po;