Remove "note skin for beat range", "beat range revision" stuff.
We still load all note skins for a course in advance, and note skins are still sent through the weird "attack queue" stuff.
This commit is contained in:
@@ -196,7 +196,6 @@ void GameState::Reset()
|
||||
m_bJukeboxUsesModifiers = false;
|
||||
m_iCurrentStageIndex = 0;
|
||||
m_bGameplayLeadIn.Set( false );
|
||||
m_BeatToNoteSkinRev = 0;
|
||||
m_iNumStagesOfThisSong = 0;
|
||||
|
||||
NOTESKIN->RefreshNoteSkinData( this->m_pCurGame );
|
||||
@@ -1095,21 +1094,6 @@ bool GameState::IsDisqualified( PlayerNumber pn )
|
||||
}
|
||||
}
|
||||
|
||||
void GameState::ResetNoteSkins()
|
||||
{
|
||||
FOREACH_PlayerNumber( pn )
|
||||
ResetNoteSkinsForPlayer( m_pPlayerState[pn] );
|
||||
|
||||
++m_BeatToNoteSkinRev;
|
||||
}
|
||||
|
||||
void GameState::ResetNoteSkinsForPlayer( PlayerState *ps )
|
||||
{
|
||||
ps->ResetNoteSkins();
|
||||
|
||||
++m_BeatToNoteSkinRev;
|
||||
}
|
||||
|
||||
void GameState::GetAllUsedNoteSkins( vector<CString> &out ) const
|
||||
{
|
||||
FOREACH_EnabledPlayer( pn )
|
||||
@@ -1151,24 +1135,6 @@ void GameState::GetUndisplayedBeats( const PlayerState* pPlayerState, float Tota
|
||||
}
|
||||
|
||||
|
||||
void GameState::SetNoteSkinForBeatRange( PlayerState* pPlayerState, const CString& sNoteSkin, float StartBeat, float EndBeat )
|
||||
{
|
||||
map<float,CString> &BeatToNoteSkin = pPlayerState->m_BeatToNoteSkin;
|
||||
|
||||
/* Erase any other note skin settings in this range. */
|
||||
map<float,CString>::iterator begin = BeatToNoteSkin.lower_bound( StartBeat );
|
||||
map<float,CString>::iterator end = BeatToNoteSkin.upper_bound( EndBeat );
|
||||
BeatToNoteSkin.erase( begin, end );
|
||||
|
||||
/* Add the skin to m_BeatToNoteSkin. */
|
||||
BeatToNoteSkin[StartBeat] = sNoteSkin;
|
||||
|
||||
/* Return to the default note skin after the duration. */
|
||||
BeatToNoteSkin[EndBeat] = pPlayerState->m_StagePlayerOptions.m_sNoteSkin;
|
||||
|
||||
++m_BeatToNoteSkinRev;
|
||||
}
|
||||
|
||||
/* This is called to launch an attack, or to queue an attack if a.fStartSecond
|
||||
* is set. This is also called by GameState::Update when activating a queued attack. */
|
||||
void GameState::LaunchAttack( MultiPlayer target, const Attack& a )
|
||||
|
||||
@@ -164,9 +164,6 @@ public:
|
||||
RageTimer m_LastBeatUpdate; // time of last m_fSongBeat, etc. update
|
||||
BroadcastOnChange<bool> m_bGameplayLeadIn;
|
||||
|
||||
int m_BeatToNoteSkinRev; /* hack: incremented whenever m_BeatToNoteSkin changes */
|
||||
void ResetNoteSkins();
|
||||
void ResetNoteSkinsForPlayer( PlayerState *ps );
|
||||
void GetAllUsedNoteSkins( vector<CString> &out ) const;
|
||||
|
||||
static const float MUSIC_SECONDS_INVALID;
|
||||
@@ -183,9 +180,6 @@ public:
|
||||
bool AllHumanHaveComboOf30OrMoreMisses() const;
|
||||
bool OneIsHot() const;
|
||||
|
||||
// used in PLAY_MODE_BATTLE and PLAY_MODE_RAVE
|
||||
void SetNoteSkinForBeatRange( PlayerState* pPlayerState, const CString& sNoteSkin, float StartBeat, float EndBeat );
|
||||
|
||||
// used in PLAY_MODE_BATTLE
|
||||
float m_fOpponentHealthPercent;
|
||||
|
||||
|
||||
+23
-111
@@ -77,6 +77,12 @@ void NoteField::CacheNoteSkin( const CString &sNoteSkin_ )
|
||||
|
||||
void NoteField::CacheAllUsedNoteSkins()
|
||||
{
|
||||
/* Cache all note skins that we might need for the whole song, course or battle
|
||||
* play, so we don't have to load them later (such as between course songs). */
|
||||
vector<CString> skins;
|
||||
GAMESTATE->GetAllUsedNoteSkins( skins );
|
||||
for( unsigned i=0; i < skins.size(); ++i )
|
||||
CacheNoteSkin( skins[i] );
|
||||
CString sNoteSkin = m_pPlayerState->m_PlayerOptions.m_sNoteSkin;
|
||||
CacheNoteSkin( sNoteSkin );
|
||||
}
|
||||
@@ -98,7 +104,6 @@ void NoteField::Load(
|
||||
m_iEndDrawingPixel = iLastPixelToDraw;
|
||||
|
||||
m_fPercentFadeToFail = -1;
|
||||
m_LastSeenBeatToNoteSkinRev = -1;
|
||||
|
||||
//int i1 = m_pNoteData->GetNumTracks();
|
||||
//int i2 = GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer;
|
||||
@@ -106,46 +111,10 @@ void NoteField::Load(
|
||||
ASSERT_M( m_pNoteData->GetNumTracks() == GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer,
|
||||
ssprintf("%d = %d",m_pNoteData->GetNumTracks(), GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer) );
|
||||
|
||||
RefreshBeatToNoteSkin();
|
||||
}
|
||||
|
||||
|
||||
void NoteField::RefreshBeatToNoteSkin()
|
||||
{
|
||||
if( GAMESTATE->m_BeatToNoteSkinRev == m_LastSeenBeatToNoteSkinRev )
|
||||
return;
|
||||
m_LastSeenBeatToNoteSkinRev = GAMESTATE->m_BeatToNoteSkinRev;
|
||||
|
||||
/* Set by GameState::ResetNoteSkins(): */
|
||||
ASSERT( !m_pPlayerState->m_BeatToNoteSkin.empty() );
|
||||
|
||||
m_BeatToNoteDisplays.clear();
|
||||
|
||||
/* GAMESTATE->m_BeatToNoteSkin[pn] maps from song beats to note skins. Maintain
|
||||
* m_BeatToNoteDisplays, to map from song beats to NoteDisplay*s, so we don't
|
||||
* have to do it while rendering. */
|
||||
|
||||
for( map<float,CString>::const_iterator it = m_pPlayerState->m_BeatToNoteSkin.begin();
|
||||
it != m_pPlayerState->m_BeatToNoteSkin.end();
|
||||
++it )
|
||||
{
|
||||
const float Beat = it->first;
|
||||
const CString &Skin = it->second;
|
||||
|
||||
map<CString, NoteDisplayCols *>::iterator display = m_NoteDisplays.find( Skin );
|
||||
if( display == m_NoteDisplays.end() )
|
||||
{
|
||||
/* Skins should always be loaded by CacheAllUsedNoteSkins. */
|
||||
LOG->Warn( "NoteField::RefreshBeatToNoteSkin: need note skin \"%s\" which should have been loaded already", Skin.c_str() );
|
||||
this->CacheNoteSkin( Skin );
|
||||
display = m_NoteDisplays.find( Skin );
|
||||
}
|
||||
|
||||
ASSERT_M( display != m_NoteDisplays.end(), ssprintf("Couldn't find %s", Skin.c_str()) );
|
||||
|
||||
NoteDisplayCols *cols = display->second;
|
||||
m_BeatToNoteDisplays[Beat] = cols;
|
||||
}
|
||||
// The note skin may have changed at the beginning of a new course song.
|
||||
map<CString, NoteDisplayCols *>::iterator it = m_NoteDisplays.find( m_pPlayerState->m_PlayerOptions.m_sNoteSkin );
|
||||
ASSERT_M( it != m_NoteDisplays.end(), m_pPlayerState->m_PlayerOptions.m_sNoteSkin );
|
||||
LastDisplay = it->second;
|
||||
}
|
||||
|
||||
void NoteField::Update( float fDeltaTime )
|
||||
@@ -154,10 +123,7 @@ void NoteField::Update( float fDeltaTime )
|
||||
|
||||
m_rectMarkerBar.Update( fDeltaTime );
|
||||
|
||||
NoteDisplayCols *cur = SearchForSongBeat();
|
||||
|
||||
if( cur != LastDisplay )
|
||||
LastDisplay = cur;
|
||||
NoteDisplayCols *cur = LastDisplay;
|
||||
|
||||
cur->m_ReceptorArrowRow.Update( fDeltaTime );
|
||||
cur->m_GhostArrowRow.Update( fDeltaTime );
|
||||
@@ -167,14 +133,9 @@ void NoteField::Update( float fDeltaTime )
|
||||
|
||||
|
||||
// Update fade to failed
|
||||
FOREACHM( CString, NoteDisplayCols*, m_NoteDisplays, iter )
|
||||
{
|
||||
iter->second->m_ReceptorArrowRow.SetFadeToFailPercent( m_fPercentFadeToFail );
|
||||
}
|
||||
LastDisplay->m_ReceptorArrowRow.SetFadeToFailPercent( m_fPercentFadeToFail );
|
||||
|
||||
|
||||
RefreshBeatToNoteSkin();
|
||||
|
||||
/*
|
||||
* Update all NoteDisplays. Hack: We need to call this once per frame, not
|
||||
* once per player.
|
||||
@@ -189,13 +150,11 @@ void NoteField::ProcessMessages( float fDeltaTime )
|
||||
{
|
||||
ActorFrame::ProcessMessages( fDeltaTime );
|
||||
|
||||
/* If m_BeatToNoteDisplays isn't filled yet, we're receiving a message
|
||||
* before Load() was called. */
|
||||
if( !m_BeatToNoteDisplays.empty() )
|
||||
/* If LastDisplay is NULL, we're receiving a message before Load() was called. */
|
||||
if( LastDisplay != NULL )
|
||||
{
|
||||
NoteDisplayCols *pCur = SearchForSongBeat();
|
||||
pCur->m_ReceptorArrowRow.ProcessMessages( fDeltaTime );
|
||||
pCur->m_GhostArrowRow.ProcessMessages( fDeltaTime );
|
||||
LastDisplay->m_ReceptorArrowRow.ProcessMessages( fDeltaTime );
|
||||
LastDisplay->m_GhostArrowRow.ProcessMessages( fDeltaTime );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,46 +306,9 @@ void NoteField::DrawBGChangeText( const float fBeat, const CString sNewBGName )
|
||||
m_textMeasureNumber.Draw();
|
||||
}
|
||||
|
||||
/* cur is an iterator within m_NoteDisplays. next is ++cur. Advance or rewind cur to
|
||||
* point to the block that contains beat. We maintain next as an optimization, as this
|
||||
* is called for every tap. */
|
||||
void NoteField::SearchForBeat( NDMap::iterator &cur, NDMap::iterator &next, float Beat )
|
||||
{
|
||||
/* cur is too far ahead: */
|
||||
while( cur != m_BeatToNoteDisplays.begin() && cur->first > Beat )
|
||||
{
|
||||
next = cur;
|
||||
--cur;
|
||||
}
|
||||
|
||||
/* cur is too far behind: */
|
||||
while( next != m_BeatToNoteDisplays.end() && next->first < Beat )
|
||||
{
|
||||
cur = next;
|
||||
++next;
|
||||
}
|
||||
}
|
||||
|
||||
NoteField::NoteDisplayCols *NoteField::SearchForSongBeat()
|
||||
{
|
||||
return SearchForBeat( GAMESTATE->m_fSongBeat );
|
||||
}
|
||||
|
||||
NoteField::NoteDisplayCols *NoteField::SearchForBeat( float Beat )
|
||||
{
|
||||
NDMap::iterator it = m_BeatToNoteDisplays.lower_bound( Beat );
|
||||
/* The first entry should always be lower than any Beat we might receive. */
|
||||
// This assert is firing with Beat = -7408. -Chris
|
||||
// Again with Beat = -7254 and GAMESTATE->m_fMusicSeconds = -3043.61
|
||||
// Again with Beat = -9806 and GAMESTATE->m_fMusicSeconds = -3017.22
|
||||
// Again with Beat = -9806 and GAMESTATE->m_fMusicSeconds = -3017.22
|
||||
// Again in the middle of Remember December in Hardcore Galore:
|
||||
// Beat = -9373.56 and GAMESTATE->m_fMusicSeconds = -2923.48
|
||||
ASSERT_M( it != m_BeatToNoteDisplays.begin(), ssprintf("%f",Beat) );
|
||||
--it;
|
||||
ASSERT_M( it != m_BeatToNoteDisplays.end(), ssprintf("%f",Beat) );
|
||||
|
||||
return it->second;
|
||||
return LastDisplay;
|
||||
}
|
||||
|
||||
// CPU OPTIMIZATION OPPORTUNITY:
|
||||
@@ -478,11 +400,11 @@ void NoteField::DrawPrimitives()
|
||||
//LOG->Trace( "NoteField::DrawPrimitives()" );
|
||||
|
||||
/* This should be filled in on the first update. */
|
||||
ASSERT( !m_BeatToNoteDisplays.empty() );
|
||||
ASSERT( LastDisplay != NULL );
|
||||
|
||||
ArrowEffects::Update();
|
||||
|
||||
NoteDisplayCols *cur = SearchForSongBeat();
|
||||
NoteDisplayCols *cur = LastDisplay;
|
||||
cur->m_ReceptorArrowRow.Draw();
|
||||
|
||||
const PlayerOptions ¤t_po = m_pPlayerState->m_CurrentPlayerOptions;
|
||||
@@ -696,10 +618,6 @@ void NoteField::DrawPrimitives()
|
||||
//
|
||||
// Draw all HoldNotes in this column (so that they appear under the tap notes)
|
||||
//
|
||||
NDMap::iterator CurDisplay = m_BeatToNoteDisplays.begin();
|
||||
ASSERT( CurDisplay != m_BeatToNoteDisplays.end() );
|
||||
NDMap::iterator NextDisplay = CurDisplay; ++NextDisplay;
|
||||
|
||||
{
|
||||
NoteData::TrackMap::const_iterator begin, end;
|
||||
m_pNoteData->GetTapNoteRangeInclusive( c, iFirstIndexToDraw, iLastIndexToDraw+1, begin, end );
|
||||
@@ -742,14 +660,12 @@ void NoteField::DrawPrimitives()
|
||||
SearchForSongBeat()->m_GhostArrowRow.SetHoldIsActive( c );
|
||||
|
||||
ASSERT_M( NoteRowToBeat(iStartRow) > -2000, ssprintf("%i %i %i", iStartRow, iEndRow, c) );
|
||||
SearchForBeat( CurDisplay, NextDisplay, NoteRowToBeat(iStartRow) );
|
||||
|
||||
bool bIsInSelectionRange = false;
|
||||
if( m_iBeginMarker!=-1 && m_iEndMarker!=-1 )
|
||||
bIsInSelectionRange = (m_iBeginMarker <= iStartRow && iEndRow < m_iEndMarker);
|
||||
|
||||
const NoteDisplayCols *nd = CurDisplay->second;
|
||||
nd->display[c].DrawHold( tn, c, iStartRow, bIsHoldingNote, bIsActive, Result, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, false, m_fYReverseOffsetPixels, (float) iFirstPixelToDraw, (float) iLastPixelToDraw );
|
||||
LastDisplay->display[c].DrawHold( tn, c, iStartRow, bIsHoldingNote, bIsActive, Result, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, false, m_fYReverseOffsetPixels, (float) iFirstPixelToDraw, (float) iLastPixelToDraw );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -758,8 +674,6 @@ void NoteField::DrawPrimitives()
|
||||
//
|
||||
// Draw all TapNotes in this column
|
||||
//
|
||||
CurDisplay = m_BeatToNoteDisplays.begin();
|
||||
NextDisplay = CurDisplay; ++NextDisplay;
|
||||
|
||||
// draw notes from furthest to closest
|
||||
|
||||
@@ -788,13 +702,11 @@ void NoteField::DrawPrimitives()
|
||||
continue; // skip
|
||||
|
||||
ASSERT_M( NoteRowToBeat(i) > -2000, ssprintf("%i %i %i, %f %f", i, iLastIndexToDraw, iFirstIndexToDraw, GAMESTATE->m_fSongBeat, GAMESTATE->m_fMusicSeconds) );
|
||||
SearchForBeat( CurDisplay, NextDisplay, NoteRowToBeat(i) );
|
||||
const NoteDisplayCols *nd = CurDisplay->second;
|
||||
|
||||
// See if there is a hold step that begins on this index. Only do this
|
||||
// if the note skin cares.
|
||||
bool bHoldNoteBeginsOnThisBeat = false;
|
||||
if( nd->display[c].DrawHoldHeadForTapsOnSameRow() )
|
||||
if( LastDisplay->display[c].DrawHoldHeadForTapsOnSameRow() )
|
||||
{
|
||||
for( int c2=0; c2<m_pNoteData->GetNumTracks(); c2++ )
|
||||
{
|
||||
@@ -819,11 +731,11 @@ void NoteField::DrawPrimitives()
|
||||
Sprite sprite;
|
||||
sprite.Load( THEME->GetPathG("NoteField","attack "+tn.sAttackModifiers) );
|
||||
float fBeat = NoteRowToBeat(i);
|
||||
nd->display[c].DrawActor( &sprite, c, fBeat, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, 1, m_fYReverseOffsetPixels, false, NotePart_Tap );
|
||||
LastDisplay->display[c].DrawActor( &sprite, c, fBeat, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, 1, m_fYReverseOffsetPixels, false, NotePart_Tap );
|
||||
}
|
||||
else
|
||||
{
|
||||
nd->display[c].DrawTap( c, NoteRowToBeat(i), bHoldNoteBeginsOnThisBeat, bIsAddition, bIsMine, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, 1, m_fYReverseOffsetPixels );
|
||||
LastDisplay->display[c].DrawTap( c, NoteRowToBeat(i), bHoldNoteBeginsOnThisBeat, bIsAddition, bIsMine, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, 1, m_fYReverseOffsetPixels );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ public:
|
||||
void DidHoldNote( int iCol, HoldNoteScore score, bool bBright );
|
||||
|
||||
const PlayerState *GetPlayerState() const { return m_pPlayerState; }
|
||||
void RefreshBeatToNoteSkin();
|
||||
|
||||
protected:
|
||||
void CacheAllUsedNoteSkins();
|
||||
@@ -77,16 +76,8 @@ protected:
|
||||
/* All loaded note displays, mapped by their name. */
|
||||
map<CString, NoteDisplayCols *> m_NoteDisplays;
|
||||
|
||||
int m_LastSeenBeatToNoteSkinRev;
|
||||
|
||||
/* Map of beat->NoteDisplayCols. This is updated whenever GAMESTATE-> changes. */
|
||||
typedef map<float, NoteDisplayCols *> NDMap;
|
||||
void SearchForBeat( NDMap::iterator &cur, NDMap::iterator &next, float Beat );
|
||||
NoteDisplayCols *SearchForBeat( float Beat );
|
||||
NoteDisplayCols *SearchForSongBeat();
|
||||
|
||||
NDMap m_BeatToNoteDisplays;
|
||||
|
||||
NoteDisplayCols *LastDisplay;
|
||||
|
||||
// used in MODE_EDIT
|
||||
|
||||
@@ -2,12 +2,6 @@
|
||||
#include "PlayerState.h"
|
||||
#include "GameState.h"
|
||||
|
||||
void PlayerState::ResetNoteSkins()
|
||||
{
|
||||
m_BeatToNoteSkin.clear();
|
||||
m_BeatToNoteSkin[-1000] = m_PlayerOptions.m_sNoteSkin;
|
||||
}
|
||||
|
||||
void PlayerState::Update( float fDelta )
|
||||
{
|
||||
m_CurrentPlayerOptions.Approach( m_PlayerOptions, fDelta );
|
||||
|
||||
@@ -25,7 +25,6 @@ public:
|
||||
m_StagePlayerOptions.Init();
|
||||
m_StoredPlayerOptions.Init();
|
||||
|
||||
m_BeatToNoteSkin.clear();
|
||||
m_fLastDrawnBeat = -100;
|
||||
|
||||
m_HealthState = ALIVE;
|
||||
@@ -48,7 +47,6 @@ public:
|
||||
m_Inventory[i].MakeBlank();
|
||||
}
|
||||
|
||||
void ResetNoteSkins();
|
||||
void Update( float fDelta );
|
||||
|
||||
// TODO: Remove use of PlayerNumber. All data about the player should live
|
||||
@@ -66,7 +64,6 @@ public:
|
||||
//
|
||||
// Used in Gameplay
|
||||
//
|
||||
map<float,CString> m_BeatToNoteSkin;
|
||||
mutable float m_fLastDrawnBeat; // Set by NoteField. Used to push NoteSkin-changing modifers back so that the NoteSkin doesn't pop.
|
||||
|
||||
enum HealthState { HOT, ALIVE, DANGER, DEAD };
|
||||
|
||||
@@ -998,7 +998,9 @@ void ScreenGameplay::SetupSong( int iSongIndex )
|
||||
a.sModifiers = po.m_sNoteSkin;
|
||||
|
||||
GAMESTATE->LaunchAttack( pi->GetPlayerStateAndStageStatsIndex(), a );
|
||||
GAMESTATE->m_SongOptions.FromString( a.sModifiers );
|
||||
|
||||
/* Update attack bOn flags. */
|
||||
pi->GetPlayerState()->Update(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user