working on ranking

This commit is contained in:
Chris Danford
2003-01-26 07:33:03 +00:00
parent dffd6052b9
commit 9a104a7b2f
41 changed files with 345 additions and 205 deletions
+10 -4
View File
@@ -761,13 +761,15 @@ WheelSections=If YES, songs are broken down into sections in the Select Music sc
[ScreenUnlock]
SecondsToShow=10
NextScreen=ScreenHighScores
NextScreen=ScreenRanking
[ScreenHighScores]
[ScreenRanking]
SecondsToShow=30
NextScreen=ScreenMemoryCard
CategoryX=400
CategoryY=40
CategoryX=520
CategoryY=30
TypeX=520
TypeY=50
LineSpacingX=0
LineSpacingY=60
BulletsStartX=60
@@ -780,6 +782,10 @@ ScoresStartX=450
ScoresStartY=140
ScoresZoom=1.2
ScoresColor=0.8,0.8,1,1
SecsBetweenCategories=5
ShowCategories=1
CoursesToShow=Courses/NaokiStandard.crs,Courses/ParanoiaBrothers.crs
NotesTypesToHide=dance-couple,dance-solo
[ScreenMemoryCard]
SecondsToShow=5
+1 -1
View File
@@ -534,7 +534,7 @@ void Actor::Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds,
mod.glow.a *= CONTAINS("glow")?1:0;
StopTweening();
// StopTweening(); // Will commenting this out break some of the animations?
m_current = bOnToScreenOrOffOfScreen ? original : mod;
BeginTweening( fSleepSeconds );
BeginTweening( fFadeSeconds, tt );
+19 -19
View File
@@ -34,23 +34,21 @@ Course::Course()
//
// Init high scores
//
unsigned i, j, k;
for( i=0; i<NUM_STYLES; i++ )
for( j=0; j<NUM_DIFFICULTIES; j++ )
for( k=0; k<NUM_HIGH_SCORE_LINES; k++ )
{
m_MachineScores[i][j][k].iDancePoints = 0;
m_MachineScores[i][j][k].fSurviveTime = 0;
m_MachineScores[i][j][k].sName = "STEP";
}
unsigned i, j;
for( i=0; i<NUM_NOTES_TYPES; i++ )
for( j=0; j<NUM_HIGH_SCORE_LINES; j++ )
{
m_MachineScores[i][j].iDancePoints = 0;
m_MachineScores[i][j].fSurviveTime = 0;
m_MachineScores[i][j].sName = "STEP";
}
for( i=0; i<NUM_STYLES; i++ )
for( j=0; j<NUM_DIFFICULTIES; j++ )
for( k=0; k<NUM_PLAYERS; k++ )
{
m_MemCardScores[i][j][k].iDancePoints = 0;
m_MemCardScores[i][j][k].fSurviveTime = 0;
}
for( i=0; i<NUM_NOTES_TYPES; i++ )
for( j=0; j<NUM_PLAYERS; j++ )
{
m_MemCardScores[i][j].iDancePoints = 0;
m_MemCardScores[i][j].fSurviveTime = 0;
}
}
void Course::LoadFromCRSFile( CString sPath, vector<Song*> &apSongs )
@@ -187,6 +185,8 @@ void Course::CreateEndlessCourseFromGroupAndDifficulty( CString sGroupName, Diff
case DIFFICULTY_EASY: m_sName += "Easy"; break;
case DIFFICULTY_MEDIUM: m_sName += "Medium"; break;
case DIFFICULTY_HARD: m_sName += "Hard"; break;
default:
ASSERT(0);
}
for( unsigned s=0; s<apSongsInGroup.size(); s++ )
@@ -306,7 +306,7 @@ bool Course::IsNewMachineRecord( PlayerNumber pn, int iDancePoints, float fSurvi
{
for( int i=0; i<NUM_HIGH_SCORE_LINES; i++ )
{
const MachineScore& hs = m_MachineScores[GAMESTATE->m_CurStyle][GAMESTATE->m_PreferredDifficulty[pn]][i];
const MachineScore& hs = m_MachineScores[GAMESTATE->m_CurStyle][i];
if( iDancePoints > hs.iDancePoints )
return true;
}
@@ -354,7 +354,7 @@ void Course::AddMachineRecord( int iDancePoints[NUM_PLAYERS], float fSurviveTime
for( unsigned i=0; i<vHS.size(); i++ )
{
MachineScoreAndPlayerNumber& newHS = vHS[i];
MachineScore* machineScores = m_MachineScores[GAMESTATE->m_CurStyle][GAMESTATE->m_PreferredDifficulty[newHS.pn]];
MachineScore* machineScores = m_MachineScores[GAMESTATE->m_CurStyle];
for( int i=0; i<NUM_HIGH_SCORE_LINES; i++ )
{
if( newHS.iDancePoints > machineScores[i].iDancePoints )
@@ -372,7 +372,7 @@ void Course::AddMachineRecord( int iDancePoints[NUM_PLAYERS], float fSurviveTime
bool Course::AddMemCardRecord( PlayerNumber pn, int iDancePoints, float fSurviveTime ) // return true if new record
{
MemCardScore& hs = m_MemCardScores[GAMESTATE->m_CurStyle][GAMESTATE->m_PreferredDifficulty[pn]][pn];
MemCardScore& hs = m_MemCardScores[GAMESTATE->m_CurStyle][pn];
if( iDancePoints > hs.iDancePoints )
{
hs.iDancePoints = iDancePoints;
+2 -3
View File
@@ -12,7 +12,6 @@
*/
#include "GameConstantsAndTypes.h"
#include "Style.h" // for NUM_STYLES
struct PlayerOptions;
struct SongOptions;
@@ -65,7 +64,7 @@ public:
int iDancePoints;
float fSurviveTime;
CString sName;
} m_MachineScores[NUM_STYLES][NUM_DIFFICULTIES][NUM_HIGH_SCORE_LINES]; // sorted highest to lowest by iDancePoints
} m_MachineScores[NUM_NOTES_TYPES][NUM_HIGH_SCORE_LINES]; // sorted highest to lowest by iDancePoints
bool IsNewMachineRecord( PlayerNumber pn, int iDancePoints, float fSurviveTime ) const; // return true if this is would be a new machine record
void AddMachineRecord( int iDancePoints[NUM_PLAYERS], float fSurviveTime[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
@@ -74,7 +73,7 @@ public:
{
int iDancePoints;
float fSurviveTime;
} m_MemCardScores[NUM_STYLES][NUM_DIFFICULTIES][NUM_PLAYERS];
} m_MemCardScores[NUM_NOTES_TYPES][NUM_PLAYERS];
bool AddMemCardRecord( PlayerNumber pn, int iDancePoints, float fSurviveTime ); // return true if this is a new record
+5 -5
View File
@@ -57,12 +57,12 @@ RageColor PlayerToColor( int p )
}
HighScoreCategory AverageMeterToHighScoreCategory( float fAverageMeter )
RankingCategory AverageMeterToRankingCategory( float fAverageMeter )
{
if( fAverageMeter <= 3 ) return CATEGORY_A;
else if( fAverageMeter <= 6 ) return CATEGORY_B;
else if( fAverageMeter <= 9 ) return CATEGORY_C;
else return CATEGORY_D;
if( fAverageMeter <= 3 ) return RANKING_A;
else if( fAverageMeter <= 6 ) return RANKING_B;
else if( fAverageMeter <= 9 ) return RANKING_C;
else return RANKING_D;
}
+7 -7
View File
@@ -176,16 +176,16 @@ inline int HoldNoteScoreToDancePoints( HoldNoteScore hns )
//
// High Score stuff
//
enum HighScoreCategory
enum RankingCategory
{
CATEGORY_A, // 1-3 meter per song avg.
CATEGORY_B, // 4-6 meter per song avg.
CATEGORY_C, // 7-9 meter per song avg.
CATEGORY_D, // 10+ meter per song avg. // doesn't count extra stage!
NUM_HIGH_SCORE_CATEGORIES
RANKING_A, // 1-3 meter per song avg.
RANKING_B, // 4-6 meter per song avg.
RANKING_C, // 7-9 meter per song avg.
RANKING_D, // 10+ meter per song avg. // doesn't count extra stage!
NUM_RANKING_CATEGORIES
};
HighScoreCategory AverageMeterToHighScoreCategory( float fAverageMeter );
RankingCategory AverageMeterToRankingCategory( float fAverageMeter );
const int NUM_HIGH_SCORE_LINES = 5;
+1 -1
View File
@@ -83,7 +83,7 @@ void GameState::Reset()
for( int p=0; p<NUM_PLAYERS; p++ )
{
m_LastHighScoreCategory[p] = (HighScoreCategory)-1;
m_LastRankingCategory[p] = (RankingCategory)-1;
m_iLastHighScoreIndex[p] = -1;
}
}
+2 -2
View File
@@ -118,8 +118,8 @@ public:
// High score stuff.
// These should be set by final evaluation, and used by ScreenNameEntry and ScreenHighScores
HighScoreCategory m_LastHighScoreCategory[NUM_PLAYERS]; // meaningless if a course was played
// These should be set by final evaluation, and used by ScreenNameEntry and ScreenRanking
RankingCategory m_LastRankingCategory[NUM_PLAYERS]; // meaningless if a course was played
int m_iLastHighScoreIndex[NUM_PLAYERS]; // -1 if no new high score
};
+1 -1
View File
@@ -39,7 +39,7 @@ PrefsManager::PrefsManager()
m_iTextureColorDepth = 32;
m_iMaxTextureResolution = 2048;
m_iRefreshRate = REFRESH_DEFAULT;
m_bIgnoreJoyAxes = true;
m_bIgnoreJoyAxes = false; // when did this get changed to ON by default?
m_bOnlyDedicatedMenuButtons = false;
#ifdef _DEBUG
m_bShowStats = true;
-1
View File
@@ -31,7 +31,6 @@
#define NEXT_SCREEN THEME->GetMetric(m_sMetricName,"NextScreen")
const ScreenMessage SM_BeginFadingOut = ScreenMessage(SM_User+2);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+3);
ScreenAttract::ScreenAttract( CString sMetricName, CString sElementName )
-2
View File
@@ -22,10 +22,8 @@
#define NEXT_SCREEN THEME->GetMetric("ScreenCaution","NextScreen")
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User-6);
const ScreenMessage SM_DoneOpening = ScreenMessage(SM_User-7);
const ScreenMessage SM_StartClosing = ScreenMessage(SM_User-8);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User-9);
ScreenCaution::ScreenCaution()
-1
View File
@@ -24,7 +24,6 @@
const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+101); // MUST be same as in ScreenGameplay
const ScreenMessage SM_BeginFadingToNextScreen = ScreenMessage(SM_User+1000);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+1002);
bool SetUpSongOptions() // always return true.
-2
View File
@@ -173,8 +173,6 @@ const std::pair<int, bool> NAMING_MENU_ITEM_KEY[NUM_NAMING_MENU_ITEMS] = {
std::make_pair(SDLK_a, true),
};
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
ScreenEdit::ScreenEdit()
-2
View File
@@ -31,8 +31,6 @@
#define EXPLANATION_TEXT THEME->GetMetric("ScreenEditMenu","ExplanationText")
#define HELP_TEXT THEME->GetMetric("ScreenEditMenu","HelpText")
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
ScreenEditMenu::ScreenEditMenu()
+1 -1
View File
@@ -274,7 +274,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
case RM_ARCADE_SUMMARY:
{
float fAverageMeter = stageStats.iMeter[p] / (float)PREFSMAN->m_iNumArcadeStages; // intentional: doesn't count extra stage
HighScoreCategory hsc = AverageMeterToHighScoreCategory( fAverageMeter );
RankingCategory hsc = AverageMeterToRankingCategory( fAverageMeter );
m_bGoToNameEntry |= SONGMAN->IsNewMachineRecord( hsc, stageStats.fScore[p] );
}
break;
-2
View File
@@ -55,8 +55,6 @@
const float TWEEN_TIME = 0.5f;
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
const ScreenMessage SM_NoSongs = ScreenMessage(SM_User+3);
ScreenEz2SelectMusic::ScreenEz2SelectMusic()
-2
View File
@@ -24,8 +24,6 @@ Andrew Livy
/* Constants */
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2);
#define JOIN_FRAME_X( p ) THEME->GetMetricF("ScreenEz2SelectPlayer",ssprintf("JoinFrameP%dX",p+1))
-1
View File
@@ -24,7 +24,6 @@
const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2);
const ScreenMessage SM_PlayAnnouncer = ScreenMessage(SM_User + 3);
-66
View File
@@ -1,66 +0,0 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: ScreenHighScores
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScreenHighScores.h"
#include "ThemeManager.h"
#define CATEGORY_X THEME->GetMetricF("ScreenHighScores","CategoryX")
#define CATEGORY_Y THEME->GetMetricF("ScreenHighScores","CategoryY")
#define LINE_SPACING_X THEME->GetMetricF("ScreenHighScores","LineSpacingX")
#define LINE_SPACING_Y THEME->GetMetricF("ScreenHighScores","LineSpacingY")
#define BULLETS_START_X THEME->GetMetricF("ScreenHighScores","BulletsStartX")
#define BULLETS_START_Y THEME->GetMetricF("ScreenHighScores","BulletsStartY")
#define NAMES_START_X THEME->GetMetricF("ScreenHighScores","NamesStartX")
#define NAMES_START_Y THEME->GetMetricF("ScreenHighScores","NamesStartY")
#define NAMES_ZOOM THEME->GetMetricF("ScreenHighScores","NamesZoom")
#define NAMES_COLOR THEME->GetMetricC("ScreenHighScores","NamesColor")
#define SCORES_START_X THEME->GetMetricF("ScreenHighScores","ScoresStartX")
#define SCORES_START_Y THEME->GetMetricF("ScreenHighScores","ScoresStartY")
#define SCORES_ZOOM THEME->GetMetricF("ScreenHighScores","ScoresZoom")
#define SCORES_COLOR THEME->GetMetricC("ScreenHighScores","ScoresColor")
ScreenHighScores::ScreenHighScores() : ScreenAttract("ScreenHighScores","high scores")
{
m_textCategory.LoadFromFont( THEME->GetPathTo("Fonts","Header2") );
m_textCategory.TurnShadowOff();
m_textCategory.SetXY( CATEGORY_X, CATEGORY_Y );
m_textCategory.SetText( "" );
for( int i=0; i<NUM_HIGH_SCORE_LINES; i++ )
{
m_sprBullets[i].Load( THEME->GetPathTo("Graphics",("high scores bullets 1x5")) );
m_sprBullets[i].SetXY( BULLETS_START_X+LINE_SPACING_X*i, BULLETS_START_Y+LINE_SPACING_Y*i );
m_sprBullets[i].StopAnimating();
m_sprBullets[i].SetState(i);
this->AddChild( &m_sprBullets[i] );
m_textNames[i].LoadFromFont( THEME->GetPathTo("Fonts","high scores") );
m_textNames[i].TurnShadowOff();
m_textNames[i].SetXY( NAMES_START_X+LINE_SPACING_X*i, NAMES_START_Y+LINE_SPACING_Y*i );
m_textNames[i].SetText( ssprintf("NAME %d",i) );
m_textNames[i].SetZoom( NAMES_ZOOM );
m_textNames[i].SetDiffuse( NAMES_COLOR );
this->AddChild( &m_textNames[i] );
m_textScores[i].LoadFromFont( THEME->GetPathTo("Fonts","high scores") );
m_textScores[i].TurnShadowOff();
m_textScores[i].SetXY( SCORES_START_X+LINE_SPACING_X*i, SCORES_START_Y+LINE_SPACING_Y*i );
m_textScores[i].SetText( ssprintf("SCORE %d",i) );
m_textScores[i].SetZoom( SCORES_ZOOM );
m_textScores[i].SetDiffuse( SCORES_COLOR );
this->AddChild( &m_textScores[i] );
}
this->MoveToTail( &m_Fade );
}
-3
View File
@@ -28,9 +28,6 @@
#define NEXT_SCREEN_ONI THEME->GetMetric("ScreenInstructions","NextScreenOni")
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
ScreenInstructions::ScreenInstructions()
{
+2 -2
View File
@@ -192,7 +192,7 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type
#include "ScreenTitleMenu.h"
#include "ScreenEz2SelectMusic.h"
#include "ScreenWarning.h"
#include "ScreenHighScores.h"
#include "ScreenRanking.h"
#include "ScreenMemoryCard.h"
#include "ScreenCompany.h"
#include "ScreenAlbums.h"
@@ -243,7 +243,7 @@ Screen* ScreenManager::MakeNewScreen( CString sClassName )
else if( 0==stricmp(sClassName, "ScreenTitleMenu") ) ret = new ScreenTitleMenu;
else if( 0==stricmp(sClassName, "ScreenEz2SelectMusic") ) ret = new ScreenEz2SelectMusic;
else if( 0==stricmp(sClassName, "ScreenWarning") ) ret = new ScreenWarning;
else if( 0==stricmp(sClassName, "ScreenHighScores") ) ret = new ScreenHighScores;
else if( 0==stricmp(sClassName, "ScreenRanking") ) ret = new ScreenRanking;
else if( 0==stricmp(sClassName, "ScreenMemoryCard") ) ret = new ScreenMemoryCard;
else if( 0==stricmp(sClassName, "ScreenCompany") ) ret = new ScreenCompany;
else if( 0==stricmp(sClassName, "ScreenAlbums") ) ret = new ScreenAlbums;
-2
View File
@@ -41,8 +41,6 @@ const float BUTTON_COLUMN_X[NUM_GAME_TO_DEVICE_SLOTS*MAX_GAME_CONTROLLERS] =
};
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
ScreenMapControllers::ScreenMapControllers()
{
+2
View File
@@ -20,6 +20,8 @@ enum ScreenMessage {
SM_DoneOpeningWipingLeft,
SM_DoneOpeningWipingRight,
SM_MenuTimer,
SM_GoToNextScreen,
SM_GoToPrevScreen,
SM_User = 100
};
-1
View File
@@ -28,7 +28,6 @@
#define TEXT_ZOOM THEME->GetMetricF("ScreenMusicScroll","TextZoom")
const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2);
const CString CREDIT_LINES[] =
+11 -13
View File
@@ -21,7 +21,7 @@
#include "GameState.h"
#include "RageSoundManager.h"
#include "ThemeManager.h"
#include "ScreenHighScores.h"
#include "ScreenRanking.h"
#include <math.h>
@@ -62,8 +62,6 @@ const char NAME_CHARS[] =
#define NUM_NAME_CHARS (sizeof(NAME_CHARS)/sizeof(char))
#define HEIGHT_OF_ALL_CHARS (NUM_NAME_CHARS * g_fCharsSpacingY)
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
int GetClosestCharIndex( float fFakeBeat )
@@ -106,13 +104,13 @@ ScreenNameEntry::ScreenNameEntry()
// DEBUGGING STUFF
GAMESTATE->m_CurGame = GAME_DANCE;
GAMESTATE->m_CurStyle = STYLE_DANCE_SINGLE;
GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE;
GAMESTATE->m_bSideIsJoined[PLAYER_1] = true;
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
GAMESTATE->m_LastHighScoreCategory[PLAYER_1] = CATEGORY_A;
GAMESTATE->m_iLastHighScoreIndex[PLAYER_1] = 0;
// GAMESTATE->m_CurGame = GAME_DANCE;
// GAMESTATE->m_CurStyle = STYLE_DANCE_SINGLE;
// GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE;
// GAMESTATE->m_bSideIsJoined[PLAYER_1] = true;
// GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
// GAMESTATE->m_LastRankingCategory[PLAYER_1] = RANKING_A;
// GAMESTATE->m_iLastHighScoreIndex[PLAYER_1] = 0;
@@ -143,14 +141,14 @@ ScreenNameEntry::ScreenNameEntry()
{
float ColX = pStyleDef->m_iCenterX[p] + pStyleDef->m_ColumnInfo[p][t].fXOffset;
m_textSelectedChars[p][t].LoadFromFont( THEME->GetPathTo("Fonts","high scores") );
m_textSelectedChars[p][t].LoadFromFont( THEME->GetPathTo("Fonts","ranking") );
m_textSelectedChars[p][t].SetX( ColX );
m_textSelectedChars[p][t].SetY( GRAY_ARROWS_Y );
m_textSelectedChars[p][t].SetDiffuse( g_SelectedCharsColor );
m_textSelectedChars[p][t].SetZoom( CHARS_ZOOM_LARGE );
this->AddChild( &m_textSelectedChars[p][t] ); // draw these manually
m_textScrollingChars[p][t].LoadFromFont( THEME->GetPathTo("Fonts","high scores") );
m_textScrollingChars[p][t].LoadFromFont( THEME->GetPathTo("Fonts","ranking") );
m_textScrollingChars[p][t].SetX( ColX );
m_textScrollingChars[p][t].SetY( GRAY_ARROWS_Y );
m_textScrollingChars[p][t].SetDiffuse( g_ScrollingCharsColor );
@@ -164,7 +162,7 @@ ScreenNameEntry::ScreenNameEntry()
switch( GAMESTATE->m_PlayMode )
{
case PLAY_MODE_ARCADE:
sCategoryText += ssprintf(" in Type %c", 'A'+GAMESTATE->m_LastHighScoreCategory[p]);
sCategoryText += ssprintf(" in Type %c", 'A'+GAMESTATE->m_LastRankingCategory[p]);
break;
case PLAY_MODE_NONSTOP:
case PLAY_MODE_ONI:
-2
View File
@@ -42,8 +42,6 @@
const ScreenMessage SM_PlaySample = ScreenMessage(SM_User-4);
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User-5);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User-6);
const ScreenMessage SM_TweenOffScreen = ScreenMessage(SM_User-7);
+221
View File
@@ -0,0 +1,221 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: ScreenRanking
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScreenRanking.h"
#include "ThemeManager.h"
#include "SongManager.h"
#include "GameState.h"
#include "GameManager.h"
#define CATEGORY_X THEME->GetMetricF("ScreenRanking","CategoryX")
#define CATEGORY_Y THEME->GetMetricF("ScreenRanking","CategoryY")
#define TYPE_X THEME->GetMetricF("ScreenRanking","TypeX")
#define TYPE_Y THEME->GetMetricF("ScreenRanking","TypeY")
#define LINE_SPACING_X THEME->GetMetricF("ScreenRanking","LineSpacingX")
#define LINE_SPACING_Y THEME->GetMetricF("ScreenRanking","LineSpacingY")
#define BULLETS_START_X THEME->GetMetricF("ScreenRanking","BulletsStartX")
#define BULLETS_START_Y THEME->GetMetricF("ScreenRanking","BulletsStartY")
#define NAMES_START_X THEME->GetMetricF("ScreenRanking","NamesStartX")
#define NAMES_START_Y THEME->GetMetricF("ScreenRanking","NamesStartY")
#define NAMES_ZOOM THEME->GetMetricF("ScreenRanking","NamesZoom")
#define NAMES_COLOR THEME->GetMetricC("ScreenRanking","NamesColor")
#define SCORES_START_X THEME->GetMetricF("ScreenRanking","ScoresStartX")
#define SCORES_START_Y THEME->GetMetricF("ScreenRanking","ScoresStartY")
#define SCORES_ZOOM THEME->GetMetricF("ScreenRanking","ScoresZoom")
#define SCORES_COLOR THEME->GetMetricC("ScreenRanking","ScoresColor")
#define SECS_BETWEEN_PAGES THEME->GetMetricF("ScreenRanking","SecsBetweenPages")
#define SHOW_CATEGORIES THEME->GetMetricB("ScreenRanking","ShowCategories")
#define COURSES_TO_SHOW THEME->GetMetric("ScreenRanking","CoursesToShow")
#define NOTES_TYPES_TO_HIDE THEME->GetMetric("ScreenRanking","NotesTypesToHide")
const ScreenMessage SM_NextCategory = (ScreenMessage)(SM_User+67);
ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking")
{
m_textCategory.LoadFromFont( THEME->GetPathTo("Fonts","Header2") );
m_textCategory.TurnShadowOff();
m_textCategory.SetXY( CATEGORY_X, CATEGORY_Y );
this->AddChild( &m_textCategory );
m_textType.LoadFromFont( THEME->GetPathTo("Fonts","Header2") );
m_textType.TurnShadowOff();
m_textType.SetXY( TYPE_X, TYPE_Y );
this->AddChild( &m_textType );
for( int i=0; i<NUM_HIGH_SCORE_LINES; i++ )
{
m_sprBullets[i].Load( THEME->GetPathTo("Graphics",("ranking bullets 1x5")) );
m_sprBullets[i].SetXY( BULLETS_START_X+LINE_SPACING_X*i, BULLETS_START_Y+LINE_SPACING_Y*i );
m_sprBullets[i].StopAnimating();
m_sprBullets[i].SetState(i);
this->AddChild( &m_sprBullets[i] );
m_textNames[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") );
m_textNames[i].TurnShadowOff();
m_textNames[i].SetXY( NAMES_START_X+LINE_SPACING_X*i, NAMES_START_Y+LINE_SPACING_Y*i );
m_textNames[i].SetZoom( NAMES_ZOOM );
m_textNames[i].SetDiffuse( NAMES_COLOR );
this->AddChild( &m_textNames[i] );
m_textScores[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") );
m_textScores[i].TurnShadowOff();
m_textScores[i].SetXY( SCORES_START_X+LINE_SPACING_X*i, SCORES_START_Y+LINE_SPACING_Y*i );
m_textScores[i].SetZoom( SCORES_ZOOM );
m_textScores[i].SetDiffuse( SCORES_COLOR );
this->AddChild( &m_textScores[i] );
}
vector<NotesType> aNotesTypesToHide;
{
vector<CString> asNotesTypesToHide;
split( NOTES_TYPES_TO_HIDE, ",", asNotesTypesToHide, true );
for( unsigned i=0; i<asNotesTypesToHide.size(); i++ )
if( GameManager::StringToNotesType(asNotesTypesToHide[i]) != NOTES_TYPE_INVALID )
aNotesTypesToHide.push_back( GameManager::StringToNotesType(asNotesTypesToHide[i]) );
}
// fill m_vCategoriesToShow
if( SHOW_CATEGORIES )
{
for( NotesType nt=(NotesType)0; nt<NUM_NOTES_TYPES; nt=(NotesType)(nt+1) )
{
for( int i=0; i<NUM_RANKING_CATEGORIES; i++ )
{
if( find(aNotesTypesToHide.begin(), aNotesTypesToHide.end(), nt) != aNotesTypesToHide.end() ) // hidden
continue; // skip
CategoryToShow cts;
cts.type = CategoryToShow::TYPE_CATEGORY;
cts.category = (RankingCategory)i;
cts.nt = nt;
m_vCategoriesToShow.push_back( cts );
}
}
}
vector<CString> asCoursePaths;
split( COURSES_TO_SHOW, ",", asCoursePaths, true );
for( NotesType nt=(NotesType)0; nt<NUM_NOTES_TYPES; nt=(NotesType)(nt+1) )
{
for( unsigned i=0; i<asCoursePaths.size(); i++ )
{
if( find(aNotesTypesToHide.begin(), aNotesTypesToHide.end(), nt) == aNotesTypesToHide.end() ) // hidden
continue; // skip
CategoryToShow cts;
cts.type = CategoryToShow::TYPE_COURSE;
cts.nt = nt;
cts.pCourse = SONGMAN->GetCourseFromPath( asCoursePaths[i] );
if( cts.pCourse )
m_vCategoriesToShow.push_back( cts );
}
}
this->MoveToTail( &m_Fade );
this->SendScreenMessage( SM_NextCategory, 0.5f );
}
void ScreenRanking::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
case SM_NextCategory:
if( m_vCategoriesToShow.size() > 0 )
{
ShowCategory( m_vCategoriesToShow[0] );
m_vCategoriesToShow.erase( m_vCategoriesToShow.begin() );
this->SendScreenMessage( SM_NextCategory, 5 );
}
else
{
m_Fade.CloseWipingRight(SM_GoToNextScreen);
}
break;
}
ScreenAttract::HandleScreenMessage( SM );
}
void ScreenRanking::ShowCategory( CategoryToShow cts )
{
switch( cts.type )
{
case CategoryToShow::TYPE_CATEGORY:
{
m_textCategory.SetText( ssprintf("Type %c", 'A'+cts.category) );
m_textType.SetText( GameManager::NotesTypeToString(cts.nt) );
for( int l=0; l<NUM_HIGH_SCORE_LINES; l++ )
{
CString sName = SONGMAN->m_MachineScores[cts.nt][cts.category][l].sName;
float fScore = SONGMAN->m_MachineScores[cts.nt][cts.category][l].fScore;
m_textNames[l].SetText( sName );
m_textScores[l].SetText( ssprintf("%.0f",fScore) );
}
}
break;
case CategoryToShow::TYPE_COURSE:
{
m_textCategory.SetText( cts.pCourse->m_sName );
m_textType.SetText( GameManager::NotesTypeToString(cts.nt) );
for( int l=0; l<NUM_HIGH_SCORE_LINES; l++ )
{
CString sName = cts.pCourse->m_MachineScores[cts.nt][l].sName;
int iDancePoints = cts.pCourse->m_MachineScores[cts.nt][l].iDancePoints;
m_textNames[l].SetText( sName );
m_textScores[l].SetText( ssprintf("%d",iDancePoints) );
}
}
break;
default:
ASSERT(0);
}
m_textCategory.SetZoomY(0);
m_textCategory.BeginTweening(0.0f); // sleep
m_textCategory.BeginTweening(0.25f);
m_textCategory.SetTweenZoomY(1);
m_textCategory.BeginTweening(3.5f); // sleep
m_textCategory.BeginTweening(0.25f);
m_textCategory.SetTweenZoomY(0);
m_textType.SetZoomY(0);
m_textType.BeginTweening(0.2f); // sleep
m_textType.BeginTweening(0.25f);
m_textType.SetTweenZoomY(1);
m_textType.BeginTweening(3.5f); // sleep
m_textType.BeginTweening(0.25f);
m_textType.SetTweenZoomY(0);
for( int l=0; l<NUM_HIGH_SCORE_LINES; l++ )
{
m_textNames[l].SetZoomY(0);
m_textNames[l].BeginTweening(0+l*0.1f+0.4f); // sleep
m_textNames[l].BeginTweening(0.25f);
m_textNames[l].SetTweenZoomY(1);
m_textNames[l].BeginTweening(3.5f); // sleep
m_textNames[l].BeginTweening(0.25f);
m_textNames[l].SetTweenZoomY(0);
m_textScores[l].SetZoomY(0);
m_textScores[l].BeginTweening(0+l*0.1f+0.4f); // sleep
m_textScores[l].BeginTweening(0.25f);
m_textScores[l].SetTweenZoomY(1);
m_textScores[l].BeginTweening(3.5f); // sleep
m_textScores[l].BeginTweening(0.25f);
m_textScores[l].SetTweenZoomY(0);
}
}
@@ -1,6 +1,6 @@
/*
-----------------------------------------------------------------------------
Class: ScreenHighScores
Class: ScreenRanking
Desc: Base class for all attraction screens.
@@ -11,18 +11,38 @@
#include "ScreenAttract.h"
#include "GameConstantsAndTypes.h" // for NUM_HIGH_SCORE_LINES
#include "Style.h"
class ScreenHighScores : public ScreenAttract
class Course;
class ScreenRanking : public ScreenAttract
{
public:
ScreenHighScores();
ScreenRanking();
void HandleScreenMessage( const ScreenMessage SM );
protected:
struct CategoryToShow
{
enum { TYPE_CATEGORY, TYPE_COURSE } type;
NotesType nt; // used in category and course
RankingCategory category;
Course* pCourse;
};
void ShowCategory( CategoryToShow cts );
BitmapText m_textCategory;
BitmapText m_textType;
Sprite m_sprBullets[NUM_HIGH_SCORE_LINES];
BitmapText m_textNames[NUM_HIGH_SCORE_LINES];
BitmapText m_textScores[NUM_HIGH_SCORE_LINES];
vector<CategoryToShow> m_vCategoriesToShow;
};
-2
View File
@@ -52,8 +52,6 @@
const float TWEEN_TIME = 0.5f;
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
-2
View File
@@ -98,8 +98,6 @@ float CURSOR_Y( int choice, int p ) { return CHOICE_Y(choice) + CURSOR_OFFSET_Y(
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2);
const ScreenMessage SM_StartTweeningOffScreen = ScreenMessage(SM_User + 3);
const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 4);
-2
View File
@@ -42,8 +42,6 @@
#define NEXT_SCREEN THEME->GetMetric("ScreenSelectGroup","NextScreen")
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2);
const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 3);
-2
View File
@@ -26,8 +26,6 @@ Chris Danford
/* Constants */
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2);
#define JOIN_FRAME_X( p ) THEME->GetMetricF("ScreenSelectMode",ssprintf("JoinFrameP%dX",p+1))
-3
View File
@@ -78,9 +78,6 @@
const float TWEEN_TIME = 0.5f;
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
ScreenSelectMusic::ScreenSelectMusic()
-3
View File
@@ -40,9 +40,6 @@
#define NEXT_SCREEN THEME->GetMetric("ScreenSelectStyle","NextScreen")
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2);
ScreenSelectStyle::ScreenSelectStyle()
{
-2
View File
@@ -108,8 +108,6 @@ const RageColor COLOR_P1_NOT_SELECTED = COLOR_P1_SELECTED*0.5f + RageColor(0,0,0
const RageColor COLOR_P2_NOT_SELECTED = COLOR_P2_SELECTED*0.5f + RageColor(0,0,0,0.5f);
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2);
const ScreenMessage SM_UpdateAnimations = ScreenMessage(SM_User + 3);
const ScreenMessage SM_TweenExplanation2 = ScreenMessage(SM_User + 4);
-1
View File
@@ -41,7 +41,6 @@ StageType g_StageType; // cache for STAGE_TYPE because it's slow to look up
const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1);
const ScreenMessage SM_DoneFadingIn = ScreenMessage(SM_User + 2);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 3);
enum StageMode
-1
View File
@@ -45,7 +45,6 @@
#define NEXT_SCREEN THEME->GetMetric("ScreenTitleMenu","NextScreen")
const ScreenMessage SM_PlayComment = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+12);
const ScreenMessage SM_GoToAttractLoop = ScreenMessage(SM_User+13);
const CString CHOICE_TEXT[ScreenTitleMenu::NUM_CHOICES]= {
+27 -29
View File
@@ -208,8 +208,8 @@ void SongManager::InitMachineScoresFromDisk()
// Init category top scores
{
for( int i=0; i<NUM_STYLES; i++ )
for( int j=0; j<NUM_HIGH_SCORE_CATEGORIES; j++ )
for( int i=0; i<NUM_NOTES_TYPES; i++ )
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
for( int k=0; k<NUM_HIGH_SCORE_LINES; k++ )
{
m_MachineScores[i][j][k].fScore = 573000;
@@ -226,8 +226,8 @@ void SongManager::InitMachineScoresFromDisk()
fscanf(fp, "%d\n", &version );
if( version == CATEGORY_TOP_SCORE_VERSION )
{
for( int i=0; i<NUM_STYLES; i++ )
for( int j=0; j<NUM_HIGH_SCORE_CATEGORIES; j++ )
for( int i=0; i<NUM_NOTES_TYPES; i++ )
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
for( int k=0; k<NUM_HIGH_SCORE_LINES; k++ )
if( fp && !feof(fp) )
{
@@ -256,22 +256,21 @@ void SongManager::InitMachineScoresFromDisk()
fscanf(fp, "%s\n", szPath);
Course* pCourse = GetCourseFromPath( szPath );
for( int i=0; i<NUM_STYLES; i++ )
for( int j=0; j<NUM_HIGH_SCORE_CATEGORIES; j++ )
for( int k=0; k<NUM_HIGH_SCORE_LINES; k++ )
if( fp && !feof(fp) )
for( int i=0; i<NUM_NOTES_TYPES; i++ )
for( int j=0; j<NUM_HIGH_SCORE_LINES; j++ )
if( fp && !feof(fp) )
{
int iDancePoints;
float fSurviveTime;
char szName[256];
fscanf(fp, "%d %f %[^\n]\n", &iDancePoints, &fSurviveTime, szName);
if( pCourse )
{
int iDancePoints;
float fSurviveTime;
char szName[256];
fscanf(fp, "%d %f %[^\n]\n", &iDancePoints, &fSurviveTime, szName);
if( pCourse )
{
pCourse->m_MachineScores[i][j][k].iDancePoints = iDancePoints;
pCourse->m_MachineScores[i][j][k].fSurviveTime = fSurviveTime;
pCourse->m_MachineScores[i][j][k].sName = szName;
}
pCourse->m_MachineScores[i][j].iDancePoints = iDancePoints;
pCourse->m_MachineScores[i][j].fSurviveTime = fSurviveTime;
pCourse->m_MachineScores[i][j].sName = szName;
}
}
}
}
fclose(fp);
@@ -287,8 +286,8 @@ void SongManager::SaveMachineScoresToDisk()
if( fp )
{
fprintf(fp,"%d",CATEGORY_TOP_SCORE_VERSION);
for( int i=0; i<NUM_STYLES; i++ )
for( int j=0; j<NUM_HIGH_SCORE_CATEGORIES; j++ )
for( int i=0; i<NUM_NOTES_TYPES; i++ )
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
for( int k=0; k<NUM_HIGH_SCORE_LINES; k++ )
if( fp )
fprintf(fp, "%f %s\n", m_MachineScores[i][j][k].fScore, m_MachineScores[i][j][k].sName.c_str());
@@ -309,13 +308,12 @@ void SongManager::SaveMachineScoresToDisk()
fprintf(fp, "%s\n", pCourse->m_sPath.c_str());
for( int i=0; i<NUM_STYLES; i++ )
for( int j=0; j<NUM_DIFFICULTIES; j++ )
for( int k=0; k<NUM_HIGH_SCORE_LINES; k++ )
fprintf(fp, "%d %f %s\n",
pCourse->m_MachineScores[i][j][k].iDancePoints,
pCourse->m_MachineScores[i][j][k].fSurviveTime,
pCourse->m_MachineScores[i][j][k].sName.c_str());
for( int i=0; i<NUM_NOTES_TYPES; i++ )
for( int j=0; j<NUM_HIGH_SCORE_LINES; j++ )
fprintf(fp, "%d %f %s\n",
pCourse->m_MachineScores[i][j].iDancePoints,
pCourse->m_MachineScores[i][j].fSurviveTime,
pCourse->m_MachineScores[i][j].sName.c_str());
}
}
@@ -632,7 +630,7 @@ bool SongManager::IsUsingMemoryCard( PlayerNumber pn )
}
bool SongManager::IsNewMachineRecord( HighScoreCategory hsc, float fScore ) const // return true if this is would be a new machine record
bool SongManager::IsNewMachineRecord( RankingCategory hsc, float fScore ) const // return true if this is would be a new machine record
{
for( int i=0; i<NUM_HIGH_SCORE_LINES; i++ )
{
@@ -659,7 +657,7 @@ struct MachineScoreAndPlayerNumber : public SongManager::MachineScore
}
};
void SongManager::AddMachineRecord( HighScoreCategory hsc, float fScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ) // set iNewRecordIndex = -1 if not a new record
void SongManager::AddMachineRecord( RankingCategory hsc, float fScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ) // set iNewRecordIndex = -1 if not a new record
{
vector<MachineScoreAndPlayerNumber> vHS;
for( int p=0; p<NUM_PLAYERS; p++ )
+3 -3
View File
@@ -84,10 +84,10 @@ public:
{
float fScore;
CString sName;
} m_MachineScores[NUM_STYLES][NUM_HIGH_SCORE_CATEGORIES][NUM_HIGH_SCORE_LINES];
} m_MachineScores[NUM_NOTES_TYPES][NUM_RANKING_CATEGORIES][NUM_HIGH_SCORE_LINES];
bool IsNewMachineRecord( HighScoreCategory hsc, float fScore ) const; // return true if this is would be a new machine record
void AddMachineRecord( HighScoreCategory hsc, float fScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
bool IsNewMachineRecord( RankingCategory hsc, float fScore ) const; // return true if this is would be a new machine record
void AddMachineRecord( RankingCategory hsc, float fScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
protected:
void LoadStepManiaSongDir( CString sDir, LoadingWindow *ld );
+6 -6
View File
@@ -249,12 +249,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
<File
RelativePath="ScreenGraphicOptions.h">
</File>
<File
RelativePath="ScreenHighScores.cpp">
</File>
<File
RelativePath="ScreenHighScores.h">
</File>
<File
RelativePath="ScreenHowToPlay.h">
</File>
@@ -330,6 +324,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
<File
RelativePath="ScreenPrompt.h">
</File>
<File
RelativePath="ScreenRanking.cpp">
</File>
<File
RelativePath="ScreenRanking.h">
</File>
<File
RelativePath="ScreenSandbox.cpp">
</File>
+1
View File
@@ -60,4 +60,5 @@ inline int GetStyleIndexRelativeToGame( int iGameIndex, Style style )
}
return iStyleIndex;
}
#endif