more work on ranking

This commit is contained in:
Chris Danford
2003-01-26 20:49:05 +00:00
parent a649abe852
commit 5a7b10e989
12 changed files with 141 additions and 98 deletions
+5 -5
View File
@@ -764,15 +764,15 @@ SecondsToShow=10
NextScreen=ScreenRanking
[ScreenRanking]
SecondsToShow=30
SecondsToShow=0 // ignored in favor of SecsBetweenPages below
NextScreen=ScreenMemoryCard
CategoryX=520
CategoryY=30
CategoryY=32
TypeX=520
TypeY=50
TypeY=60
LineSpacingX=0
LineSpacingY=60
BulletsStartX=60
BulletsStartX=100
BulletsStartY=140
NamesStartX=250
NamesStartY=140
@@ -782,7 +782,7 @@ ScoresStartX=450
ScoresStartY=140
ScoresZoom=1.2
ScoresColor=0.8,0.8,1,1
SecsBetweenCategories=5
SecondsPerPage=5
ShowCategories=1
CoursesToShow=Courses/NaokiStandard.crs,Courses/ParanoiaBrothers.crs
NotesTypesToHide=dance-couple,dance-solo
+14 -4
View File
@@ -517,9 +517,19 @@ void Actor::Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds,
else if( CONTAINS("spring") ) tt = TWEEN_SPRING;
else tt = TWEEN_LINEAR;
mod.pos.x += (CONTAINS("left")?-SCREEN_WIDTH:0) + (CONTAINS("right")?+SCREEN_HEIGHT:0);
mod.pos.y += (CONTAINS("top")?-SCREEN_WIDTH:0) + (CONTAINS("bottom")?+SCREEN_HEIGHT:0);
mod.pos.z += 0;
float fDeltaX = (float)(CONTAINS("left")?-SCREEN_WIDTH:0) + (CONTAINS("right")?+SCREEN_HEIGHT:0);
float fDeltaY = (float)(CONTAINS("top")?-SCREEN_WIDTH:0) + (CONTAINS("bottom")?+SCREEN_HEIGHT:0);
float fDeltaZ = (float)0;
if( CONTAINS("far") )
{
fDeltaX *= 2;
fDeltaY *= 2;
fDeltaZ *= 2;
}
mod.pos.x += fDeltaX;
mod.pos.y += fDeltaY;
mod.pos.z += fDeltaZ;
mod.rotation.x += (CONTAINS("spinx")?-PI*2:0);
mod.rotation.y += (CONTAINS("spiny")?-PI*2:0);
mod.rotation.z += (CONTAINS("spinz")?-PI*2:0);
@@ -534,7 +544,7 @@ void Actor::Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds,
mod.glow.a *= CONTAINS("glow")?1:0;
// StopTweening(); // Will commenting this out break some of the animations?
StopTweening();
m_current = bOnToScreenOrOffOfScreen ? original : mod;
BeginTweening( fSleepSeconds );
BeginTweening( fFadeSeconds, tt );
+5
View File
@@ -171,7 +171,9 @@ public:
Effect GetEffect() { return m_Effect; };
//
// other properties
//
void TurnShadowOn() { m_bShadow = true; };
void TurnShadowOff() { m_bShadow = false; };
void SetShadowLength( float fLength ) { m_fShadowLength = fLength; };
@@ -180,6 +182,9 @@ public:
void SetBlendModeNormal() { m_bBlendAdd = false; };
//
// fade command
//
void Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds, bool bOnToScreenOrOffOfScreen );
void FadeOn( float fSleepSeconds, CString sFadeString, float fFadeSeconds ) { Fade(fSleepSeconds,sFadeString,fFadeSeconds,false); };
void FadeOff( float fSleepSeconds, CString sFadeString, float fFadeSeconds ) { Fade(fSleepSeconds,sFadeString,fFadeSeconds,true); };
-1
View File
@@ -66,4 +66,3 @@ RankingCategory AverageMeterToRankingCategory( float fAverageMeter )
}
+12 -1
View File
@@ -116,7 +116,7 @@ void Screen::MenuCoin( PlayerNumber pn )
}
}
void Screen::SendScreenMessage( ScreenMessage SM, float fDelay )
void Screen::SendScreenMessage( const ScreenMessage SM, float fDelay )
{
ASSERT( fDelay >= 0.0 );
@@ -125,3 +125,14 @@ void Screen::SendScreenMessage( ScreenMessage SM, float fDelay )
QSM.fDelayRemaining = fDelay;
m_QueuedMessages.push_back( QSM );
}
void Screen::ClearMessageQueue()
{
m_QueuedMessages.clear();
}
void Screen::ClearMessageQueue( const ScreenMessage SM )
{
for( int i=m_QueuedMessages.size()-1; i>=0; i-- )
m_QueuedMessages.erase( m_QueuedMessages.begin()+i );
}
+2 -2
View File
@@ -37,8 +37,8 @@ public:
virtual void HandleScreenMessage( const ScreenMessage SM ) {};
void SendScreenMessage( const ScreenMessage SM, const float fDelay );
void ClearMessageQueue() { m_QueuedMessages.clear(); }
void ClearMessageQueue();
void ClearMessageQueue( const ScreenMessage SM ); // clear of a specific SM
protected:
// structure for holding messages sent to a Screen
+5 -6
View File
@@ -30,8 +30,6 @@
#define SECONDS_TO_SHOW THEME->GetMetricF(m_sMetricName,"SecondsToShow")
#define NEXT_SCREEN THEME->GetMetric(m_sMetricName,"NextScreen")
const ScreenMessage SM_BeginFadingOut = ScreenMessage(SM_User+2);
ScreenAttract::ScreenAttract( CString sMetricName, CString sElementName )
{
@@ -55,7 +53,7 @@ ScreenAttract::ScreenAttract( CString sMetricName, CString sElementName )
m_soundStart.Load( THEME->GetPathTo("Sounds","menu start") );
SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds",m_sElementName + " music"), false );
SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds",m_sElementName + " music") ); // DO loop. -Chris
GAMESTATE->m_bPlayersCanJoin = true;
@@ -96,8 +94,7 @@ void ScreenAttract::Input( const DeviceInput& DeviceI, const InputEventType type
{
case MENU_BUTTON_LEFT:
case MENU_BUTTON_RIGHT:
if( !m_Fade.IsOpening() && !m_Fade.IsClosing() )
m_Fade.CloseWipingRight( SM_GoToNextScreen );
this->SendScreenMessage( SM_BeginFadingOut, 0 );
break;
case MENU_BUTTON_COIN:
Screen::MenuCoin( MenuI.player ); // increment coins, play sound
@@ -149,7 +146,9 @@ void ScreenAttract::HandleScreenMessage( const ScreenMessage SM )
* music theme element and it's the same as the one we're playing
* now, don't stop. (However, if we're going to interrupt it
* when we fade in, it's cleaner to stop it before we fade out.) */
SOUNDMAN->PlayMusic( "" );
/* Don't stop the music, or else the music will start over from the
* beginning for consecutive screens with the same music. -Chris */
//SOUNDMAN->PlayMusic( "" );
SCREENMAN->SetNewScreen( NEXT_SCREEN );
break;
}
+1 -1
View File
@@ -4,7 +4,7 @@
-----------------------------------------------------------------------------
Class: ScreenLogo
Desc: Base class for all attraction screens.
Desc:
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
+1
View File
@@ -20,6 +20,7 @@ enum ScreenMessage {
SM_DoneOpeningWipingLeft,
SM_DoneOpeningWipingRight,
SM_MenuTimer,
SM_BeginFadingOut,
SM_GoToNextScreen,
SM_GoToPrevScreen,
SM_User = 100
+88 -75
View File
@@ -33,13 +33,15 @@
#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 SECONDS_PER_PAGE THEME->GetMetricF("ScreenRanking","SecondsPerPage")
#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);
const ScreenMessage SM_ShowNextPage = (ScreenMessage)(SM_User+67);
const ScreenMessage SM_HidePage = (ScreenMessage)(SM_User+68);
ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking")
{
@@ -59,6 +61,7 @@ ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking")
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);
m_sprBullets[i].SetDiffuse( RageColor(1,1,1,0) );
this->AddChild( &m_sprBullets[i] );
m_textNames[i].LoadFromFont( THEME->GetPathTo("Fonts","ranking") );
@@ -77,104 +80,118 @@ ScreenRanking::ScreenRanking() : ScreenAttract("ScreenRanking","ranking")
}
vector<NotesType> aNotesTypesToHide;
vector<NotesType> aNotesTypesToShow;
GAMEMAN->GetNotesTypesForGame( GAMESTATE->m_CurGame, aNotesTypesToShow );
// subtract hidden NotesTypes
{
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]) );
{
NotesType nt = GameManager::StringToNotesType(asNotesTypesToHide[i]);
if( nt != NOTES_TYPE_INVALID )
{
const vector<NotesType>::iterator iter = find( aNotesTypesToShow.begin(), aNotesTypesToShow.end(), nt );
if( iter != aNotesTypesToShow.end() )
aNotesTypesToShow.erase( iter );
}
}
}
// fill m_vCategoriesToShow
// fill m_vPagesToShow
if( SHOW_CATEGORIES )
{
for( NotesType nt=(NotesType)0; nt<NUM_NOTES_TYPES; nt=(NotesType)(nt+1) )
for( unsigned i=0; i<aNotesTypesToShow.size(); i++ )
{
for( int i=0; i<NUM_RANKING_CATEGORIES; i++ )
for( int c=0; c<NUM_RANKING_CATEGORIES; c++ )
{
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 );
PageToShow pts;
pts.type = PageToShow::TYPE_CATEGORY;
pts.category = (RankingCategory)c;
pts.nt = aNotesTypesToShow[i];
m_vPagesToShow.push_back( pts );
}
}
}
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<aNotesTypesToShow.size(); i++ )
{
for( unsigned i=0; i<asCoursePaths.size(); i++ )
for( unsigned c=0; c<asCoursePaths.size(); c++ )
{
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 );
PageToShow pts;
pts.type = PageToShow::TYPE_COURSE;
pts.nt = aNotesTypesToShow[i];
pts.pCourse = SONGMAN->GetCourseFromPath( asCoursePaths[c] );
if( pts.pCourse )
m_vPagesToShow.push_back( pts );
}
}
this->MoveToTail( &m_Fade );
this->SendScreenMessage( SM_NextCategory, 0.5f );
this->ClearMessageQueue( SM_BeginFadingOut ); // ignore ScreenAttract's SecsToShow
this->SendScreenMessage( SM_ShowNextPage, 0.5f );
}
void ScreenRanking::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
case SM_NextCategory:
if( m_vCategoriesToShow.size() > 0 )
case SM_BeginFadingOut:
m_Fade.CloseWipingRight(SM_GoToNextScreen);
break;
case SM_ShowNextPage:
if( m_vPagesToShow.size() > 0 )
{
ShowCategory( m_vCategoriesToShow[0] );
m_vCategoriesToShow.erase( m_vCategoriesToShow.begin() );
this->SendScreenMessage( SM_NextCategory, 5 );
SetPage( m_vPagesToShow[0] );
m_vPagesToShow.erase( m_vPagesToShow.begin() );
this->SendScreenMessage( SM_HidePage, SECONDS_PER_PAGE-1 );
TweenPageOnScreen();
}
else
{
m_Fade.CloseWipingRight(SM_GoToNextScreen);
}
break;
case SM_HidePage:
TweenPageOffScreen();
this->SendScreenMessage( SM_ShowNextPage, 1 );
break;
}
ScreenAttract::HandleScreenMessage( SM );
}
void ScreenRanking::ShowCategory( CategoryToShow cts )
void ScreenRanking::SetPage( PageToShow pts )
{
switch( cts.type )
switch( pts.type )
{
case CategoryToShow::TYPE_CATEGORY:
case PageToShow::TYPE_CATEGORY:
{
m_textCategory.SetText( ssprintf("Type %c", 'A'+cts.category) );
m_textType.SetText( GameManager::NotesTypeToString(cts.nt) );
m_textCategory.SetText( ssprintf("Type %c", 'A'+pts.category) );
m_textType.SetText( GameManager::NotesTypeToString(pts.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;
CString sName = SONGMAN->m_MachineScores[pts.nt][pts.category][l].sName;
float fScore = SONGMAN->m_MachineScores[pts.nt][pts.category][l].fScore;
m_textNames[l].SetText( sName );
m_textScores[l].SetText( ssprintf("%.0f",fScore) );
}
}
break;
case CategoryToShow::TYPE_COURSE:
case PageToShow::TYPE_COURSE:
{
m_textCategory.SetText( cts.pCourse->m_sName );
m_textType.SetText( GameManager::NotesTypeToString(cts.nt) );
m_textCategory.SetText( pts.pCourse->m_sName );
m_textType.SetText( GameManager::NotesTypeToString(pts.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;
CString sName = pts.pCourse->m_MachineScores[pts.nt][l].sName;
int iDancePoints = pts.pCourse->m_MachineScores[pts.nt][l].iDancePoints;
m_textNames[l].SetText( sName );
m_textScores[l].SetText( ssprintf("%d",iDancePoints) );
}
@@ -183,39 +200,35 @@ void ScreenRanking::ShowCategory( CategoryToShow cts )
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);
void ScreenRanking::TweenPageOnScreen()
{
m_textCategory.SetDiffuse( RageColor(1,1,1,1) );
m_textCategory.FadeOn(0,"bounce right",0.5f);
m_textType.SetDiffuse( RageColor(1,1,1,1) );
m_textType.FadeOn(0.1f,"bounce right",0.5f);
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_sprBullets[l].SetDiffuse( RageColor(1,1,1,1) );
m_sprBullets[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
m_textNames[l].SetDiffuse( RageColor(1,1,1,1) );
m_textNames[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
m_textScores[l].SetDiffuse( RageColor(1,1,1,1) );
m_textScores[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
}
}
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);
void ScreenRanking::TweenPageOffScreen()
{
m_textCategory.FadeOff(0,"fade",0.25f);
m_textType.FadeOff(0.1f,"fade",0.25f);
for( int l=0; l<NUM_HIGH_SCORE_LINES; l++ )
{
m_sprBullets[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
m_textNames[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
m_textScores[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
}
}
+5 -3
View File
@@ -25,7 +25,7 @@ public:
void HandleScreenMessage( const ScreenMessage SM );
protected:
struct CategoryToShow
struct PageToShow
{
enum { TYPE_CATEGORY, TYPE_COURSE } type;
NotesType nt; // used in category and course
@@ -33,7 +33,9 @@ protected:
Course* pCourse;
};
void ShowCategory( CategoryToShow cts );
void SetPage( PageToShow pts );
void TweenPageOnScreen();
void TweenPageOffScreen();
BitmapText m_textCategory;
@@ -42,7 +44,7 @@ protected:
BitmapText m_textNames[NUM_HIGH_SCORE_LINES];
BitmapText m_textScores[NUM_HIGH_SCORE_LINES];
vector<CategoryToShow> m_vCategoriesToShow;
vector<PageToShow> m_vPagesToShow;
};
+3
View File
@@ -192,6 +192,9 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
<File
RelativePath="ScreenCaution.h">
</File>
<File
RelativePath="ScreenCompany.h">
</File>
<File
RelativePath="ScreenDemonstration.cpp">
</File>