fix percentages regarding oni mode

fix crash in oni mode when using 5th mix scoring
This commit is contained in:
Andrew Wong
2003-08-14 19:46:22 +00:00
parent 49b646fa5e
commit 18d61edb52
5 changed files with 41 additions and 13 deletions
+30 -9
View File
@@ -21,9 +21,10 @@
#include "UnlockSystem.h" #include "UnlockSystem.h"
#include "SDL_utils.h" #include "SDL_utils.h"
#include "SongManager.h" #include "SongManager.h"
#include "NoteDataUtil.h"
ScoreKeeper5th::ScoreKeeper5th( const vector<Steps*>& apNotes_, PlayerNumber pn_ ): ScoreKeeper5th::ScoreKeeper5th( const vector<Steps*>& apNotes_, const CStringArray &asModifiers, PlayerNumber pn_ ):
ScoreKeeper(pn_), apNotes(apNotes_) ScoreKeeper(pn_), apNotes(apNotes_)
{ {
// //
@@ -32,15 +33,31 @@ ScoreKeeper5th::ScoreKeeper5th( const vector<Steps*>& apNotes_, PlayerNumber pn_
int iTotalPossibleDancePoints = 0; int iTotalPossibleDancePoints = 0;
for( unsigned i=0; i<apNotes.size(); i++ ) for( unsigned i=0; i<apNotes.size(); i++ )
{ {
Steps* pSteps = apNotes[0]; Steps* pSteps = apNotes[i];
NoteData notedata; NoteData notedata;
pSteps->GetNoteData( &notedata ); pSteps->GetNoteData( &notedata );
/* We might have been given lots of songs; don't keep them in memory uncompressed. */
pSteps->Compress();
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef(); const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
NoteData playerNoteData; NoteData playerNoteData;
pStyleDef->GetTransformedNoteDataForStyle( pn_, &notedata, &playerNoteData ); pStyleDef->GetTransformedNoteDataForStyle( pn_, &notedata, &playerNoteData );
iTotalPossibleDancePoints += this->GetPossibleDancePoints( &notedata ); /* Apply transforms to find out how the notes will really look.
*
* XXX: This is brittle: if we end up combining mods for a song differently
* than ScreenGameplay, we'll end up with the wrong data. We should probably
* have eg. GAMESTATE->GetOptionsForCourse(po,so,pn) to get options based on
* the last call to StoreSelectedOptions and the modifiers list, but that'd
* mean moving the queues in ScreenGameplay to GameState ... */
PlayerOptions ModsForThisSong( GAMESTATE->m_PlayerOptions[pn_] );
ModsForThisSong.FromString( asModifiers[i] );
NoteData playerNoteDataPostModifiers(playerNoteData);
NoteDataUtil::TransformNoteData( playerNoteData, ModsForThisSong, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
iTotalPossibleDancePoints += this->GetPossibleDancePoints( playerNoteData, playerNoteDataPostModifiers );
} }
GAMESTATE->m_CurStageStats.iPossibleDancePoints[pn_] = iTotalPossibleDancePoints; GAMESTATE->m_CurStageStats.iPossibleDancePoints[pn_] = iTotalPossibleDancePoints;
@@ -433,19 +450,23 @@ void ScoreKeeper5th::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapS
} }
int ScoreKeeper5th::GetPossibleDancePoints( const NoteData* pNoteData ) int ScoreKeeper5th::GetPossibleDancePoints( const NoteData &preNoteData, const NoteData &postNoteData )
{ {
/* Note that, if Marvelous timing is disabled or not active (not course mode), /* Note that, if Marvelous timing is disabled or not active (not course mode),
* PERFECT will be used instead. */ * PERFECT will be used instead. */
TapNoteScore maxPossibleTapScore = /*
(GAMESTATE->ShowMarvelous() ) ? TNS_MARVELOUS : TNS_PERFECT; * The logic here is that if you use a modifier that adds notes, you should have to
* hit the new notes to get a high grade. However, if you use one that removes notes,
return pNoteData->GetNumRowsWithTaps()*TapNoteScoreToDancePoints(maxPossibleTapScore)+ * they should simply be counted as misses. */
pNoteData->GetNumHoldNotes()*HoldNoteScoreToDancePoints(HNS_OK); int NumTaps = max( preNoteData.GetNumRowsWithTaps(), postNoteData.GetNumRowsWithTaps() );
int NumHolds = max( preNoteData.GetNumHoldNotes(), postNoteData.GetNumHoldNotes() );
return NumTaps*TapNoteScoreToDancePoints(TNS_MARVELOUS)+
NumHolds*HoldNoteScoreToDancePoints(HNS_OK);
} }
int ScoreKeeper5th::TapNoteScoreToDancePoints( TapNoteScore tns ) int ScoreKeeper5th::TapNoteScoreToDancePoints( TapNoteScore tns )
{ {
if(!GAMESTATE->ShowMarvelous() && tns == TNS_MARVELOUS) if(!GAMESTATE->ShowMarvelous() && tns == TNS_MARVELOUS)
+2 -2
View File
@@ -34,7 +34,7 @@ class ScoreKeeper5th: public ScoreKeeper
void AddScore( TapNoteScore score ); void AddScore( TapNoteScore score );
public: public:
ScoreKeeper5th( const vector<Steps*>& apNotes, PlayerNumber pn); ScoreKeeper5th( const vector<Steps*>& apNotes_, const CStringArray &asModifiers, PlayerNumber pn_ );
// before a song plays (called multiple times if course) // before a song plays (called multiple times if course)
void OnNextSong( int iSongInCourseIndex, Steps* pNotes, NoteData* pNoteData ); void OnNextSong( int iSongInCourseIndex, Steps* pNotes, NoteData* pNoteData );
@@ -44,7 +44,7 @@ public:
int TapNoteScoreToDancePoints( TapNoteScore tns ); int TapNoteScoreToDancePoints( TapNoteScore tns );
int HoldNoteScoreToDancePoints( HoldNoteScore hns ); int HoldNoteScoreToDancePoints( HoldNoteScore hns );
int GetPossibleDancePoints( const NoteData* pNoteData ); int GetPossibleDancePoints( const NoteData &preNoteData, const NoteData &postNoteData );
}; };
#endif #endif
+5 -1
View File
@@ -33,7 +33,11 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Steps*>& apNotes_, const CStringA
int iTotalPossibleDancePoints = 0; int iTotalPossibleDancePoints = 0;
for( unsigned i=0; i<apNotes.size(); i++ ) for( unsigned i=0; i<apNotes.size(); i++ )
{ {
Steps* pSteps = apNotes[0]; // Steps* pSteps = apNotes[0];
Steps* pSteps = apNotes[i]; // this should reflect the
// song's steps since in oni mode all songs don't necessarily
// have the same number of steps
NoteData notedata; NoteData notedata;
pSteps->GetNoteData( &notedata ); pSteps->GetNoteData( &notedata );
+3
View File
@@ -826,6 +826,9 @@ void ScreenEvaluation::Update( float fDeltaTime )
if (GAMESTATE->m_CurStageStats.iBonus[p] == 0) if (GAMESTATE->m_CurStageStats.iBonus[p] == 0)
continue; continue;
if (GAMESTATE->IsCourseMode())
continue;
// wait a few seconds before adding bonus // wait a few seconds before adding bonus
if ( RageTimer::GetTimeSinceStart() - m_fScreenCreateTime < 1.5f) if ( RageTimer::GetTimeSinceStart() - m_fScreenCreateTime < 1.5f)
continue; continue;
+1 -1
View File
@@ -191,7 +191,7 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) : Screen("ScreenGameplay")
m_pPrimaryScoreKeeper[p] = new ScoreKeeperMAX2( m_apNotesQueue[p], m_asModifiersQueue[p], (PlayerNumber)p ); m_pPrimaryScoreKeeper[p] = new ScoreKeeperMAX2( m_apNotesQueue[p], m_asModifiersQueue[p], (PlayerNumber)p );
break; break;
case PrefsManager::SCORING_5TH: case PrefsManager::SCORING_5TH:
m_pPrimaryScoreKeeper[p] = new ScoreKeeper5th( m_apNotesQueue[p], (PlayerNumber)p ); m_pPrimaryScoreKeeper[p] = new ScoreKeeper5th( m_apNotesQueue[p], m_asModifiersQueue[p], (PlayerNumber)p );
break; break;
default: ASSERT(0); default: ASSERT(0);
} }