Various bug fixes. See changelog.
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
#include "stdafx.h" // testing updates
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
File: ActorFrame.h
|
||||
Class: ActorFrame
|
||||
|
||||
Desc: Base class for all objects that appear on the screen.
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "ActorFrame.h"
|
||||
|
||||
void ActorFrame::AddActor( Actor* pActor)
|
||||
void ActorFrame::AddSubActor( Actor* pActor)
|
||||
{
|
||||
ASSERT( pActor );
|
||||
ASSERT( (void*)pActor != (void*)0xC0000005 );
|
||||
m_SubActors.Add( pActor );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
File: ActorFrame.h
|
||||
Class: ActorFrame
|
||||
|
||||
Desc: Base class for all objects that appear on the screen.
|
||||
Desc: A container for other actors.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -23,7 +24,7 @@ protected:
|
||||
|
||||
|
||||
public:
|
||||
void AddActor( Actor* pActor);
|
||||
void AddSubActor( Actor* pActor);
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
virtual void DrawPrimitives();
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
#include "AnnouncerManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
|
||||
@@ -28,10 +27,8 @@ AnnouncerManager::AnnouncerManager()
|
||||
|
||||
CStringArray arrayAnnouncerNames;
|
||||
GetAnnouncerNames( arrayAnnouncerNames );
|
||||
// for( int i=0; i<arrayAnnouncerNames.GetSize(); i++ )
|
||||
// AssertAnnouncerIsComplete( arrayAnnouncerNames[i] );
|
||||
|
||||
SwitchAnnouncer( PREFSMAN->m_sAnnouncer );
|
||||
for( int i=0; i<arrayAnnouncerNames.GetSize(); i++ )
|
||||
AssertAnnouncerIsComplete( arrayAnnouncerNames[i] );
|
||||
}
|
||||
|
||||
void AnnouncerManager::GetAnnouncerNames( CStringArray& AddTo )
|
||||
@@ -46,36 +43,17 @@ void AnnouncerManager::GetAnnouncerNames( CStringArray& AddTo )
|
||||
}
|
||||
}
|
||||
|
||||
void AnnouncerManager::SwitchAnnouncer( CString sAnnouncerName )
|
||||
bool AnnouncerManager::DoesAnnouncerExist( CString sAnnouncerName )
|
||||
{
|
||||
LOG->WriteLine("AnnouncerManager::SwitchAnnouncer()");
|
||||
|
||||
if( sAnnouncerName == "" )
|
||||
{
|
||||
m_sCurAnnouncerName = "";
|
||||
return;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
CStringArray asAnnouncerNames;
|
||||
GetAnnouncerNames( asAnnouncerNames );
|
||||
for( int i=0; i<asAnnouncerNames.GetSize(); i++ )
|
||||
if( asAnnouncerNames[i] == sAnnouncerName )
|
||||
goto announcer_exists;
|
||||
|
||||
// if we get here, the announcer doesn't exist
|
||||
sAnnouncerName = asAnnouncerNames[0];
|
||||
|
||||
LOG->WriteLine("Announcer '" + sAnnouncerName + "' does not exist.");
|
||||
|
||||
announcer_exists:
|
||||
|
||||
m_sCurAnnouncerName = sAnnouncerName;
|
||||
CString sAnnouncerDir = GetAnnouncerDirFromName( m_sCurAnnouncerName );
|
||||
if( !DoesFileExist( sAnnouncerDir ) )
|
||||
throw RageException( "Error loading the announcer in diretory '%s'.", m_sCurAnnouncerName );
|
||||
|
||||
LOG->WriteLine("Announcer successfully switched to '" + sAnnouncerName + "'.");
|
||||
if( 0==stricmp(sAnnouncerName, asAnnouncerNames[i]) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void AnnouncerManager::AssertAnnouncerIsComplete( CString sAnnouncerName )
|
||||
@@ -83,8 +61,8 @@ void AnnouncerManager::AssertAnnouncerIsComplete( CString sAnnouncerName )
|
||||
for( int i=0; i<NUM_ANNOUNCER_ELEMENTS; i++ )
|
||||
{
|
||||
CString sPath = GetPathTo( (AnnouncerElement)i, sAnnouncerName );
|
||||
if( !DoesFileExist(sPath) )
|
||||
throw RageException( "The Announcer element '%s' is missing.", sPath );
|
||||
// if( !DoesFileExist(sPath) )
|
||||
// throw RageException( "The Announcer element '%s' is missing.", sPath );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +71,16 @@ CString AnnouncerManager::GetAnnouncerDirFromName( CString sAnnouncerName )
|
||||
return ANNOUNCER_BASE_DIR + sAnnouncerName + "\\";
|
||||
}
|
||||
|
||||
void AnnouncerManager::SwitchAnnouncer( CString sNewAnnouncerName )
|
||||
{
|
||||
if( sNewAnnouncerName != "" )
|
||||
m_sCurAnnouncerName = "";
|
||||
else if( !DoesAnnouncerExist(sNewAnnouncerName) )
|
||||
m_sCurAnnouncerName = "";
|
||||
else
|
||||
m_sCurAnnouncerName = sNewAnnouncerName;
|
||||
}
|
||||
|
||||
CString AnnouncerManager::GetPathTo( AnnouncerElement ae )
|
||||
{
|
||||
return GetPathTo( ae, m_sCurAnnouncerName );
|
||||
@@ -107,42 +95,44 @@ CString AnnouncerManager::GetPathTo( AnnouncerElement ae, CString sAnnouncerName
|
||||
|
||||
switch( ae )
|
||||
{
|
||||
case ANNOUNCER_CAUTION: sAssetDir = "caution"; break;
|
||||
case ANNOUNCER_GAMEPLAY_100_COMBO: sAssetDir = "gameplay 100 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_1000_COMBO: sAssetDir = "gameplay 1000 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_200_COMBO: sAssetDir = "gameplay 200 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_300_COMBO: sAssetDir = "gameplay 300 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_400_COMBO: sAssetDir = "gameplay 400 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_500_COMBO: sAssetDir = "gameplay 500 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_600_COMBO: sAssetDir = "gameplay 600 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_700_COMBO: sAssetDir = "gameplay 700 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_800_COMBO: sAssetDir = "gameplay 800 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_900_COMBO: sAssetDir = "gameplay 900 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_CLEARED: sAssetDir = "gameplay cleared"; break;
|
||||
case ANNOUNCER_GAMEPLAY_COMBO_STOPPED: sAssetDir = "gameplay combo stopped"; break;
|
||||
case ANNOUNCER_GAMEPLAY_COMMENT_DANGER: sAssetDir = "gameplay comment danger"; break;
|
||||
case ANNOUNCER_GAMEPLAY_COMMENT_GOOD: sAssetDir = "gameplay comment good"; break;
|
||||
case ANNOUNCER_GAMEPLAY_COMMENT_HOT: sAssetDir = "gameplay comment hot"; break;
|
||||
case ANNOUNCER_CAUTION: sAssetDir = "caution"; break;
|
||||
case ANNOUNCER_GAMEPLAY_100_COMBO: sAssetDir = "gameplay 100 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_1000_COMBO: sAssetDir = "gameplay 1000 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_200_COMBO: sAssetDir = "gameplay 200 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_300_COMBO: sAssetDir = "gameplay 300 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_400_COMBO: sAssetDir = "gameplay 400 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_500_COMBO: sAssetDir = "gameplay 500 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_600_COMBO: sAssetDir = "gameplay 600 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_700_COMBO: sAssetDir = "gameplay 700 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_800_COMBO: sAssetDir = "gameplay 800 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_900_COMBO: sAssetDir = "gameplay 900 combo"; break;
|
||||
case ANNOUNCER_GAMEPLAY_CLEARED: sAssetDir = "gameplay cleared"; break;
|
||||
case ANNOUNCER_GAMEPLAY_COMBO_STOPPED: sAssetDir = "gameplay combo stopped"; break;
|
||||
case ANNOUNCER_GAMEPLAY_COMMENT_DANGER: sAssetDir = "gameplay comment danger"; break;
|
||||
case ANNOUNCER_GAMEPLAY_COMMENT_GOOD: sAssetDir = "gameplay comment good"; break;
|
||||
case ANNOUNCER_GAMEPLAY_COMMENT_HOT: sAssetDir = "gameplay comment hot"; break;
|
||||
case ANNOUNCER_GAMEPLAY_FAILED: sAssetDir = "gameplay failed"; break;
|
||||
case ANNOUNCER_GAMEPLAY_HERE_WE_GO_EXTRA: sAssetDir = "gameplay here we go extra"; break;
|
||||
case ANNOUNCER_GAMEPLAY_HERE_WE_GO_FINAL: sAssetDir = "gameplay here we go final"; break;
|
||||
case ANNOUNCER_GAMEPLAY_HERE_WE_GO_NORMAL: sAssetDir = "gameplay here we go normal"; break;
|
||||
case ANNOUNCER_GAMEPLAY_READY: sAssetDir = "gameplay ready"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_A: sAssetDir = "evaluation final a"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_AA: sAssetDir = "evaluation final aa"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_AAA: sAssetDir = "evaluation final aaa"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_B: sAssetDir = "evaluation final b"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_C: sAssetDir = "evaluation final c"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_D: sAssetDir = "evaluation final d"; break;
|
||||
case ANNOUNCER_GAME_OVER: sAssetDir = "game over"; break;
|
||||
case ANNOUNCER_MENU_HURRY_UP: sAssetDir = "menu hurry up"; break;
|
||||
case ANNOUNCER_MUSIC_SCROLL: sAssetDir = "music scroll"; break;
|
||||
case ANNOUNCER_EVALUATION_A: sAssetDir = "evaluation a"; break;
|
||||
case ANNOUNCER_EVALUATION_AA: sAssetDir = "evaluation aa"; break;
|
||||
case ANNOUNCER_EVALUATION_AAA: sAssetDir = "evaluation aaa"; break;
|
||||
case ANNOUNCER_EVALUATION_B: sAssetDir = "evaluation b"; break;
|
||||
case ANNOUNCER_EVALUATION_C: sAssetDir = "evaluation c"; break;
|
||||
case ANNOUNCER_EVALUATION_D: sAssetDir = "evaluation d"; break;
|
||||
case ANNOUNCER_GAMEPLAY_READY: sAssetDir = "gameplay ready"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_A: sAssetDir = "evaluation final a"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_AA: sAssetDir = "evaluation final aa"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_AAA: sAssetDir = "evaluation final aaa"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_B: sAssetDir = "evaluation final b"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_C: sAssetDir = "evaluation final c"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_D: sAssetDir = "evaluation final d"; break;
|
||||
case ANNOUNCER_EVALUATION_FINAL_E: sAssetDir = "evaluation final e"; break;
|
||||
case ANNOUNCER_GAME_OVER: sAssetDir = "game over"; break;
|
||||
case ANNOUNCER_MENU_HURRY_UP: sAssetDir = "menu hurry up"; break;
|
||||
case ANNOUNCER_MUSIC_SCROLL: sAssetDir = "music scroll"; break;
|
||||
case ANNOUNCER_EVALUATION_A: sAssetDir = "evaluation a"; break;
|
||||
case ANNOUNCER_EVALUATION_AA: sAssetDir = "evaluation aa"; break;
|
||||
case ANNOUNCER_EVALUATION_AAA: sAssetDir = "evaluation aaa"; break;
|
||||
case ANNOUNCER_EVALUATION_B: sAssetDir = "evaluation b"; break;
|
||||
case ANNOUNCER_EVALUATION_C: sAssetDir = "evaluation c"; break;
|
||||
case ANNOUNCER_EVALUATION_D: sAssetDir = "evaluation d"; break;
|
||||
case ANNOUNCER_EVALUATION_E: sAssetDir = "evaluation e"; break;
|
||||
case ANNOUNCER_SELECT_COURSE_INTRO: sAssetDir = "select course intro"; break;
|
||||
case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_EASY: sAssetDir = "select difficulty comment easy"; break;
|
||||
case ANNOUNCER_SELECT_DIFFICULTY_COMMENT_HARD: sAssetDir = "select difficulty comment hard"; break;
|
||||
@@ -163,15 +153,17 @@ CString AnnouncerManager::GetPathTo( AnnouncerElement ae, CString sAnnouncerName
|
||||
case ANNOUNCER_SELECT_STYLE_COMMENT_SOLO: sAssetDir = "select style comment solo"; break;
|
||||
case ANNOUNCER_SELECT_STYLE_COMMENT_VERSUS: sAssetDir = "select style comment versus"; break;
|
||||
case ANNOUNCER_SELECT_STYLE_INTRO: sAssetDir = "select style intro"; break;
|
||||
case ANNOUNCER_STAGE_1: sAssetDir = "stage 1"; break;
|
||||
case ANNOUNCER_STAGE_2: sAssetDir = "stage 2"; break;
|
||||
case ANNOUNCER_STAGE_3: sAssetDir = "stage 3"; break;
|
||||
case ANNOUNCER_STAGE_4: sAssetDir = "stage 4"; break;
|
||||
case ANNOUNCER_STAGE_5: sAssetDir = "stage 5"; break;
|
||||
case ANNOUNCER_STAGE_EXTRA: sAssetDir = "stage extra"; break;
|
||||
case ANNOUNCER_STAGE_FINAL: sAssetDir = "stage final"; break;
|
||||
case ANNOUNCER_TITLE_MENU_ATTRACT: sAssetDir = "title menu attract"; break;
|
||||
case ANNOUNCER_TITLE_MENU_GAME_NAME: sAssetDir = "title menu game name"; break;
|
||||
case ANNOUNCER_STAGE_1: sAssetDir = "stage 1"; break;
|
||||
case ANNOUNCER_STAGE_2: sAssetDir = "stage 2"; break;
|
||||
case ANNOUNCER_STAGE_3: sAssetDir = "stage 3"; break;
|
||||
case ANNOUNCER_STAGE_4: sAssetDir = "stage 4"; break;
|
||||
case ANNOUNCER_STAGE_5: sAssetDir = "stage 5"; break;
|
||||
case ANNOUNCER_STAGE_FINAL: sAssetDir = "stage final"; break;
|
||||
case ANNOUNCER_STAGE_EXTRA: sAssetDir = "stage extra"; break;
|
||||
case ANNOUNCER_STAGE_ANOTHER_EXTRA: sAssetDir = "stage another extra"; break;
|
||||
case ANNOUNCER_STAGE_CHALLENGE: sAssetDir = "stage challenge"; break;
|
||||
case ANNOUNCER_TITLE_MENU_ATTRACT: sAssetDir = "title menu attract"; break;
|
||||
case ANNOUNCER_TITLE_MENU_GAME_NAME: sAssetDir = "title menu game name"; break;
|
||||
|
||||
default: ASSERT(0); // Unhandled Announcer element
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ enum AnnouncerElement {
|
||||
ANNOUNCER_EVALUATION_FINAL_B,
|
||||
ANNOUNCER_EVALUATION_FINAL_C,
|
||||
ANNOUNCER_EVALUATION_FINAL_D,
|
||||
ANNOUNCER_EVALUATION_FINAL_E,
|
||||
ANNOUNCER_GAME_OVER,
|
||||
ANNOUNCER_MENU_HURRY_UP,
|
||||
ANNOUNCER_MUSIC_SCROLL,
|
||||
@@ -51,6 +52,7 @@ enum AnnouncerElement {
|
||||
ANNOUNCER_EVALUATION_B,
|
||||
ANNOUNCER_EVALUATION_C,
|
||||
ANNOUNCER_EVALUATION_D,
|
||||
ANNOUNCER_EVALUATION_E,
|
||||
ANNOUNCER_SELECT_COURSE_INTRO,
|
||||
ANNOUNCER_SELECT_DIFFICULTY_COMMENT_EASY,
|
||||
ANNOUNCER_SELECT_DIFFICULTY_COMMENT_HARD,
|
||||
@@ -76,8 +78,10 @@ enum AnnouncerElement {
|
||||
ANNOUNCER_STAGE_3,
|
||||
ANNOUNCER_STAGE_4,
|
||||
ANNOUNCER_STAGE_5,
|
||||
ANNOUNCER_STAGE_EXTRA,
|
||||
ANNOUNCER_STAGE_FINAL,
|
||||
ANNOUNCER_STAGE_EXTRA,
|
||||
ANNOUNCER_STAGE_ANOTHER_EXTRA,
|
||||
ANNOUNCER_STAGE_CHALLENGE,
|
||||
ANNOUNCER_TITLE_MENU_ATTRACT,
|
||||
ANNOUNCER_TITLE_MENU_GAME_NAME,
|
||||
|
||||
@@ -91,19 +95,23 @@ public:
|
||||
AnnouncerManager();
|
||||
|
||||
void GetAnnouncerNames( CStringArray& AddTo );
|
||||
CString GetCurrentAnnouncerName() { return m_sCurAnnouncerName; }
|
||||
void SwitchAnnouncer( CString sAnnouncerName ); // return false if Announcer doesn't exist
|
||||
void AssertAnnouncerIsComplete( CString sAnnouncerName ); // return false if Announcer doesn't exist
|
||||
bool DoesAnnouncerExist( CString sAnnouncerName );
|
||||
void SwitchAnnouncer( CString sNewAnnouncerName );
|
||||
CString GetCurAnnouncerName() { return m_sCurAnnouncerName; };
|
||||
|
||||
CString GetPathTo( AnnouncerElement ae );
|
||||
CString GetPathTo( AnnouncerElement ae, CString sAnnouncerName );
|
||||
|
||||
protected:
|
||||
CString GetAnnouncerDirFromName( CString sAnnouncerName );
|
||||
void AssertAnnouncerIsComplete( CString sAnnouncerName ); // only used in Debug
|
||||
CString GetPathTo( AnnouncerElement ae, CString sAnnouncerName );
|
||||
|
||||
static CString GetAnnouncerDirFromName( CString sAnnouncerName );
|
||||
CString GetElementDir( AnnouncerElement te );
|
||||
|
||||
CString m_sCurAnnouncerName; // "" means no announcer
|
||||
CString m_sCurAnnouncerName;
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern AnnouncerManager* ANNOUNCER; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "ColorNote.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBeat )
|
||||
@@ -34,8 +35,7 @@ float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBea
|
||||
|
||||
float ArrowGetXPos( const PlayerOptions& po, int iColNum, float fYOffset, float fSongBeat )
|
||||
{
|
||||
float fColOffsetFromCenter = iColNum - (GAMEMAN->GetCurrentStyleDef()->m_iColsPerPlayer-1)/2.0f;
|
||||
float fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE;
|
||||
float fPixelOffsetFromCenter = GAMESTATE->GetCurrentStyleDef()->m_ColumnInfo[PLAYER_1][iColNum].fXOffset;
|
||||
|
||||
// BUG OR FEATURE??? THIS IS WHERE THE REAL COLUMN PLACEMENT HAPPENS!!!
|
||||
// GAMEMANAGER SITS AROUND ON ITS ASS DOING NOTHING
|
||||
@@ -44,22 +44,27 @@ float ArrowGetXPos( const PlayerOptions& po, int iColNum, float fYOffset, float
|
||||
// can possibly change my arrow placements, Ez2dancer column setups will be here until
|
||||
// somebody makes some other system. In the meantime, if it works, i'm using it.
|
||||
|
||||
if ( GAMEMAN->m_CurGame == GAME_EZ2 )
|
||||
// Chris:
|
||||
// It's working now, so I'm commenting out your placement code below.
|
||||
|
||||
/*
|
||||
if ( GAMESTATE->m_CurGame == GAME_EZ2 )
|
||||
{
|
||||
fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE / 1.3f;
|
||||
if ( GAMEMAN->m_CurStyle == STYLE_EZ2_REAL || GAMEMAN->m_CurStyle == STYLE_EZ2_REAL_VERSUS ) // real gets MEGA squashed
|
||||
if ( GAEMSTATE->m_CurStyle == STYLE_EZ2_REAL || GAEMSTATE->m_CurStyle == STYLE_EZ2_REAL_VERSUS ) // real gets MEGA squashed
|
||||
{
|
||||
fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE / 1.6f;
|
||||
}
|
||||
else if ( GAMEMAN->m_CurStyle == STYLE_EZ2_DOUBLE && GAMEMAN->m_sMasterPlayerNumber == PLAYER_1)
|
||||
else if ( GAEMSTATE->m_CurStyle == STYLE_EZ2_DOUBLE && GAEMSTATE->m_sMasterPlayerNumber == PLAYER_1)
|
||||
{
|
||||
fPixelOffsetFromCenter = (fColOffsetFromCenter + 2.9f) * ARROW_SIZE / 1.3f;
|
||||
}
|
||||
else if ( GAMEMAN->m_CurStyle == STYLE_EZ2_DOUBLE && GAMEMAN->m_sMasterPlayerNumber == PLAYER_2)
|
||||
else if ( GAEMSTATE->m_CurStyle == STYLE_EZ2_DOUBLE && GAEMSTATE->m_sMasterPlayerNumber == PLAYER_2)
|
||||
{
|
||||
fPixelOffsetFromCenter = (fColOffsetFromCenter - 3.1f) * ARROW_SIZE / 1.3f;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
switch( po.m_EffectType )
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "BPMDisplay.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ BPMDisplay::BPMDisplay()
|
||||
m_textLabel.SetDiffuseColorTopEdge( D3DXCOLOR(1,1,0,1) ); // yellow
|
||||
m_textLabel.SetDiffuseColorBottomEdge( D3DXCOLOR(1,0.5f,0,1) ); // orange
|
||||
|
||||
//this->AddActor( &m_rectFrame );
|
||||
this->AddActor( &m_textBPM );
|
||||
this->AddActor( &m_textLabel );
|
||||
//this->AddSubActor( &m_rectFrame );
|
||||
this->AddSubActor( &m_textBPM );
|
||||
this->AddSubActor( &m_textLabel );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "Background.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageBitmapTexture.h"
|
||||
|
||||
@@ -300,7 +300,7 @@ void Background::DrawPrimitives()
|
||||
|
||||
bool Background::DangerVisible()
|
||||
{
|
||||
return m_bInDanger && (TIMER->GetTimeSinceStart() - (int)TIMER->GetTimeSinceStart()) > 0.5f;
|
||||
return m_bInDanger && (TIMER->GetTimeSinceStart() - (int)TIMER->GetTimeSinceStart()) < 0.5f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "RageUtil.h"
|
||||
|
||||
#include "Banner.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "SongManager.h"
|
||||
#include "RageBitmapTexture.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "BannerWithFrame.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ BannerWithFrame::BannerWithFrame()
|
||||
m_sprBannerFrame.Load( THEME->GetPathTo(GRAPHIC_EVALUATION_BANNER_FRAME) );
|
||||
m_Banner.SetCroppedSize( m_sprBannerFrame.GetUnzoomedWidth()-6, m_sprBannerFrame.GetUnzoomedHeight()-6 );
|
||||
|
||||
this->AddActor( &m_Banner );
|
||||
this->AddActor( &m_sprBannerFrame );
|
||||
this->AddSubActor( &m_Banner );
|
||||
this->AddSubActor( &m_sprBannerFrame );
|
||||
}
|
||||
|
||||
void BannerWithFrame::LoadFromSong( Song* pSong )
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
File: Combo.h
|
||||
Class: Combo
|
||||
|
||||
Desc: A graphic displayed in the Combo during Dancing.
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Combo.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "ScreenGameplay.h"
|
||||
|
||||
@@ -35,8 +36,8 @@ Combo::Combo()
|
||||
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
|
||||
|
||||
|
||||
this->AddActor( &m_textComboNumber );
|
||||
this->AddActor( &m_sprCombo );
|
||||
this->AddSubActor( &m_textComboNumber );
|
||||
this->AddSubActor( &m_sprCombo );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+5
-10
@@ -1,21 +1,18 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
File: Combo.h
|
||||
Class: Combo
|
||||
|
||||
Desc: A graphic displayed in the Combo during Dancing.
|
||||
Desc: Text that displays the size of the current combo.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _Combo_H_
|
||||
#define _Combo_H_
|
||||
|
||||
|
||||
#include "ActorFrame.h"
|
||||
#include "Sprite.h"
|
||||
#include "ScoreDisplayRolling.h"
|
||||
#include "BitmapText.h"
|
||||
|
||||
|
||||
|
||||
@@ -38,5 +35,3 @@ protected:
|
||||
Sprite m_sprCombo;
|
||||
BitmapText m_textComboNumber;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,11 @@
|
||||
*/
|
||||
|
||||
#include "Course.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "Song.h"
|
||||
#include "GameManager.h"
|
||||
#include "SongManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs )
|
||||
@@ -88,13 +91,77 @@ void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs )
|
||||
|
||||
if( pSong == NULL ) // we didn't find the Song
|
||||
continue; // skip this song
|
||||
|
||||
DifficultyClass dc = Notes::DifficultyClassFromDescriptionAndMeter( sNotesDescription, 6 );
|
||||
|
||||
AddStage( pSong, dc );
|
||||
AddStage( pSong, sNotesDescription );
|
||||
}
|
||||
|
||||
else
|
||||
LOG->WriteLine( "Unexpected value named '%s'", sValueName );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Course::CreateFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray<Song*,Song*> &apSongsInGroup )
|
||||
{
|
||||
CString sShortGroupName = SONGMAN->ShortenGroupName( sGroupName );
|
||||
|
||||
m_sName = sShortGroupName + " ";
|
||||
switch( dc )
|
||||
{
|
||||
case CLASS_EASY: m_sName += "Easy"; break;
|
||||
case CLASS_MEDIUM: m_sName += "Medium"; break;
|
||||
case CLASS_HARD: m_sName += "Hard"; break;
|
||||
}
|
||||
|
||||
for( int s=0; s<apSongsInGroup.GetSize(); s++ )
|
||||
{
|
||||
Song* pSong = apSongsInGroup[s];
|
||||
AddStage( pSong, DifficultyClassToString(dc) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Notes* Course::GetNotesForStage( int iStage )
|
||||
{
|
||||
Song* pSong = m_apSongs[iStage];
|
||||
CString sDescription = m_asDescriptions[iStage];
|
||||
|
||||
for( int i=0; i<pSong->m_apNotes.GetSize(); i++ )
|
||||
{
|
||||
Notes* pNotes = pSong->m_apNotes[i];
|
||||
if( 0==stricmp(pNotes->m_sDescription, sDescription) &&
|
||||
pNotes->m_NotesType == GAMESTATE->GetCurrentStyleDef()->m_NotesType )
|
||||
return pNotes;
|
||||
}
|
||||
|
||||
|
||||
// Didn't find a matching description. Try to match the DifficultyClass instead.
|
||||
DifficultyClass dc = Notes::DifficultyClassFromDescriptionAndMeter( sDescription, 5 );
|
||||
|
||||
for( i=0; i<pSong->m_apNotes.GetSize(); i++ )
|
||||
{
|
||||
Notes* pNotes = pSong->m_apNotes[i];
|
||||
if( pNotes->m_DifficultyClass == dc )
|
||||
return pNotes;
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void Course::GetSongAndNotesForCurrentStyle( CArray<Song*,Song*>& apSongsOut, CArray<Notes*,Notes*> apNotesOut[NUM_PLAYERS] )
|
||||
{
|
||||
for( int i=0; i<m_iStages; i++ )
|
||||
{
|
||||
Song* pSong = m_apSongs[i];
|
||||
Notes* pNotes = GetNotesForStage( i );
|
||||
|
||||
if( pNotes == NULL )
|
||||
continue; // skip
|
||||
|
||||
apSongsOut.Add( pSong );
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
apNotesOut[p].Add( pNotes );
|
||||
}
|
||||
}
|
||||
@@ -32,18 +32,22 @@ public:
|
||||
CString m_sCDTitlePath;
|
||||
int m_iStages;
|
||||
Song* m_apSongs[MAX_COURSE_STAGES];
|
||||
DifficultyClass m_aDifficultyClasses[MAX_COURSE_STAGES];
|
||||
CString m_asDescriptions[MAX_COURSE_STAGES];
|
||||
Notes* GetNotesForStage( int iStage );
|
||||
bool m_bRepeat; // repeat after last song?
|
||||
PlayerOptions m_PlayerOptions;
|
||||
|
||||
void LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs );
|
||||
|
||||
void AddStage( Song* pSong, DifficultyClass dc )
|
||||
void LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs );
|
||||
void CreateFromGroupAndDifficultyClass( CString sGroupName, DifficultyClass dc, CArray<Song*,Song*> &apSongsInGroup );
|
||||
|
||||
void AddStage( Song* pSong, CString sDescription )
|
||||
{
|
||||
ASSERT( m_iStages <= MAX_COURSE_STAGES );
|
||||
m_apSongs[m_iStages] = pSong;
|
||||
m_aDifficultyClasses[m_iStages] = dc;
|
||||
m_asDescriptions[m_iStages] = sDescription;
|
||||
m_iStages++;
|
||||
}
|
||||
|
||||
void GetSongAndNotesForCurrentStyle( CArray<Song*,Song*>& apSongsOut, CArray<Notes*,Notes*> apNotesOut[NUM_PLAYERS] );
|
||||
};
|
||||
|
||||
@@ -13,74 +13,156 @@
|
||||
#include "CourseContentsFrame.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "Course.h"
|
||||
#include "SongManager.h"
|
||||
|
||||
|
||||
const float TEXT_BANNER_X = 0;
|
||||
const float TEXT_BANNER_Y = 0;
|
||||
|
||||
const float NUMBER_X = -118;
|
||||
const float NUMBER_Y = 0;
|
||||
|
||||
const float FOOT_X = 102;
|
||||
const float FOOT_Y = 8;
|
||||
|
||||
const float DIFFICULTY_X = FOOT_X+18;
|
||||
const float DIFFICULTY_Y = FOOT_Y;
|
||||
|
||||
const float CONTENTS_BAR_WIDTH = 270;
|
||||
const float CONTENTS_BAR_HEIGHT = 44;
|
||||
|
||||
|
||||
CourseContentDisplay::CourseContentDisplay()
|
||||
{
|
||||
m_sprFrame.Load( THEME->GetPathTo(GRAPHIC_SELECT_COURSE_CONTENT_BAR) );
|
||||
this->AddSubActor( &m_sprFrame );
|
||||
|
||||
m_textNumber.Load( THEME->GetPathTo(FONT_HEADER2) );
|
||||
m_textNumber.SetXY( NUMBER_X, NUMBER_Y );
|
||||
m_textNumber.TurnShadowOff();
|
||||
this->AddSubActor( &m_textNumber );
|
||||
|
||||
m_TextBanner.SetXY( TEXT_BANNER_X, TEXT_BANNER_Y );
|
||||
this->AddSubActor( &m_TextBanner );
|
||||
|
||||
m_textFoot.Load( THEME->GetPathTo(FONT_METER) );
|
||||
m_textFoot.SetXY( FOOT_X, FOOT_Y );
|
||||
m_textFoot.TurnShadowOff();
|
||||
this->AddSubActor( &m_textFoot );
|
||||
|
||||
m_textDifficultyNumber.Load( THEME->GetPathTo(FONT_NORMAL) );
|
||||
m_textDifficultyNumber.SetXY( DIFFICULTY_X, DIFFICULTY_Y );
|
||||
m_textDifficultyNumber.SetZoom( 0.8f );
|
||||
m_textDifficultyNumber.TurnShadowOff();
|
||||
this->AddSubActor( &m_textDifficultyNumber );
|
||||
}
|
||||
|
||||
void CourseContentDisplay::Load( int iNum, Song* pSong, Notes* pNotes )
|
||||
{
|
||||
m_textNumber.SetText( ssprintf("%d", iNum) );
|
||||
|
||||
D3DXCOLOR colorGroup = SONGMAN->GetGroupColor( pSong->m_sGroupName );
|
||||
D3DXCOLOR colorDifficulty = DifficultyClassToColor( pNotes->m_DifficultyClass );
|
||||
|
||||
m_TextBanner.LoadFromSong( pSong );
|
||||
m_TextBanner.SetDiffuseColor( colorGroup );
|
||||
|
||||
m_textFoot.SetText( "1" );
|
||||
m_textFoot.SetDiffuseColor( colorDifficulty );
|
||||
|
||||
m_textDifficultyNumber.SetText( ssprintf("%d", pNotes->m_iMeter) );
|
||||
m_textDifficultyNumber.SetDiffuseColor( colorDifficulty );
|
||||
}
|
||||
|
||||
const float NAME_X = -100;
|
||||
const float METER_X = +50;
|
||||
const float GAP_Y = 34;
|
||||
const float START_Y = 0 - MAX_COURSE_CONTENTS/2*GAP_Y;
|
||||
|
||||
|
||||
CourseContentsFrame::CourseContentsFrame()
|
||||
{
|
||||
for( int i=0; i<MAX_COURSE_CONTENTS; i++ )
|
||||
{
|
||||
m_textContents[i].Load( THEME->GetPathTo(FONT_TEXT_BANNER) );
|
||||
m_textContents[i].SetHorizAlign( Actor::align_left );
|
||||
m_textContents[i].SetXY( NAME_X, START_Y + GAP_Y*i );
|
||||
m_textContents[i].SetText( "" );
|
||||
m_textContents[i].SetZoom( 0.7f );
|
||||
this->AddActor( &m_textContents[i] );
|
||||
m_iNumContents = 0;
|
||||
m_quad.SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); // invisible, since we want to write only to the Zbuffer
|
||||
|
||||
m_Meters[i].SetXY( METER_X, START_Y + GAP_Y*i + 10 );
|
||||
this->AddActor( &m_Meters[i] );
|
||||
}
|
||||
}
|
||||
|
||||
void CourseContentsFrame::Update( float fDeltaTime )
|
||||
{
|
||||
ActorFrame::Update( fDeltaTime );
|
||||
m_fTimeUntilScroll = 0;
|
||||
m_fItemAtTopOfList = 0;
|
||||
}
|
||||
|
||||
void CourseContentsFrame::SetFromCourse( Course* pCourse )
|
||||
{
|
||||
ASSERT( pCourse != NULL );
|
||||
|
||||
int i;
|
||||
m_fTimeUntilScroll = 3;
|
||||
m_fItemAtTopOfList = 0;
|
||||
|
||||
// turn all lines "off"
|
||||
for( i=0; i<MAX_COURSE_CONTENTS; i++ )
|
||||
m_iNumContents = 0;
|
||||
|
||||
for( int i=0; i<min(pCourse->m_iStages, MAX_TOTAL_CONTENTS); i++ )
|
||||
{
|
||||
m_textContents[i].SetText( "" );
|
||||
m_Meters[i].SetFromNotes( NULL );
|
||||
}
|
||||
|
||||
for( i=0; i<min(pCourse->m_iStages, MAX_COURSE_CONTENTS); i++ )
|
||||
{
|
||||
m_textContents[i].SetText( pCourse->m_apSongs[i]->GetFullTitle() );
|
||||
m_textContents[i].SetDiffuseColor( DifficultyClassToColor(pCourse->m_aDifficultyClasses[i]) );
|
||||
|
||||
m_Meters[i].SetFromNotes( NULL );
|
||||
|
||||
Song* pSong = pCourse->m_apSongs[i];
|
||||
for( int j=0; j<pSong->m_apNotes.GetSize(); j++ )
|
||||
{
|
||||
Notes* pNotes = pSong->m_apNotes[j];
|
||||
if( pSong->m_apNotes[j]->m_DifficultyClass == pCourse->m_aDifficultyClasses[i] )
|
||||
{
|
||||
m_Meters[i].SetFromNotes( pNotes );
|
||||
break;
|
||||
}
|
||||
}
|
||||
Notes* pNotes = pCourse->GetNotesForStage(i);
|
||||
|
||||
}
|
||||
if( pNotes == NULL )
|
||||
continue; // skip
|
||||
|
||||
if( pCourse->m_iStages >= MAX_COURSE_CONTENTS )
|
||||
{
|
||||
m_textContents[MAX_COURSE_CONTENTS-1].SetText( ssprintf("%d more...", pCourse->m_iStages-(MAX_COURSE_CONTENTS-1)) );
|
||||
m_Meters[MAX_COURSE_CONTENTS-1].SetFromNotes( NULL );
|
||||
printf( "Adding song '%s'\n", pSong->m_sMainTitle );
|
||||
m_CourseContentDisplays[m_iNumContents].Load( m_iNumContents+1, pSong, pNotes );
|
||||
|
||||
m_iNumContents ++;
|
||||
}
|
||||
printf( "m_iNumContents is %d\n", m_iNumContents );
|
||||
}
|
||||
|
||||
void CourseContentsFrame::Update( float fDeltaTime )
|
||||
{
|
||||
if( m_fTimeUntilScroll > 0 && m_iNumContents > MAX_VISIBLE_CONTENTS)
|
||||
m_fTimeUntilScroll -= fDeltaTime;
|
||||
if( m_fTimeUntilScroll <= 0 )
|
||||
m_fItemAtTopOfList += fDeltaTime;
|
||||
if( m_fItemAtTopOfList > m_iNumContents )
|
||||
m_fItemAtTopOfList -= m_iNumContents;
|
||||
|
||||
for( int i=0; i<m_iNumContents; i++ )
|
||||
m_CourseContentDisplays[i].Update( fDeltaTime );
|
||||
}
|
||||
|
||||
void CourseContentsFrame::DrawPrimitives()
|
||||
{
|
||||
// turn on Z buffer to clip items
|
||||
LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice();
|
||||
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
|
||||
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
|
||||
|
||||
|
||||
// write to z buffer so that top and bottom are clipped
|
||||
m_quad.SetZ( -1 );
|
||||
|
||||
CRect rectBarSize(-(int)CONTENTS_BAR_WIDTH/2, -(int)CONTENTS_BAR_HEIGHT/2, (int)CONTENTS_BAR_WIDTH/2, (int)CONTENTS_BAR_HEIGHT/2);
|
||||
m_quad.StretchTo( rectBarSize );
|
||||
|
||||
m_quad.SetY( (-(MAX_VISIBLE_CONTENTS-1)/2 - 1) * CONTENTS_BAR_HEIGHT );
|
||||
m_quad.Draw();
|
||||
|
||||
m_quad.SetY( ((MAX_VISIBLE_CONTENTS-1)/2 + 1) * CONTENTS_BAR_HEIGHT );
|
||||
m_quad.Draw();
|
||||
|
||||
|
||||
int iItemToDraw = (int)m_fItemAtTopOfList;
|
||||
float fY = (iItemToDraw-m_fItemAtTopOfList-(MAX_VISIBLE_CONTENTS-1)/2) * CONTENTS_BAR_HEIGHT;
|
||||
|
||||
for( int i=0; i<min(MAX_VISIBLE_CONTENTS+1, m_iNumContents); i++ )
|
||||
{
|
||||
m_CourseContentDisplays[iItemToDraw].SetY( fY );
|
||||
m_CourseContentDisplays[iItemToDraw].Draw();
|
||||
iItemToDraw++;
|
||||
if( iItemToDraw >= m_iNumContents )
|
||||
iItemToDraw -= m_iNumContents;
|
||||
fY += CONTENTS_BAR_HEIGHT;
|
||||
}
|
||||
|
||||
|
||||
// turn off Z buffer
|
||||
pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
|
||||
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
|
||||
}
|
||||
|
||||
@@ -12,22 +12,51 @@
|
||||
|
||||
#include "FootMeter.h"
|
||||
#include "BitmapText.h"
|
||||
#include "TextBanner.h"
|
||||
#include "ActorFrame.h"
|
||||
#include "Sprite.h"
|
||||
#include "Quad.h"
|
||||
class Course;
|
||||
class Song;
|
||||
struct Notes;
|
||||
|
||||
|
||||
const int MAX_VISIBLE_CONTENTS = 5;
|
||||
const int MAX_TOTAL_CONTENTS = 56;
|
||||
|
||||
|
||||
class CourseContentDisplay : public ActorFrame
|
||||
{
|
||||
public:
|
||||
CourseContentDisplay();
|
||||
|
||||
void Load( int iNum, Song* pSong, Notes* pNotes );
|
||||
|
||||
Sprite m_sprFrame;
|
||||
BitmapText m_textNumber;
|
||||
TextBanner m_TextBanner;
|
||||
BitmapText m_textFoot;
|
||||
BitmapText m_textDifficultyNumber;
|
||||
};
|
||||
|
||||
const int MAX_COURSE_CONTENTS = 8;
|
||||
|
||||
class CourseContentsFrame : public ActorFrame
|
||||
{
|
||||
public:
|
||||
CourseContentsFrame();
|
||||
|
||||
void Update( float fDeltaTime );
|
||||
virtual void Update( float fDeltaTime );
|
||||
virtual void DrawPrimitives();
|
||||
|
||||
void SetFromCourse( Course* pCourse );
|
||||
|
||||
protected:
|
||||
|
||||
BitmapText m_textContents[MAX_COURSE_CONTENTS];
|
||||
FootMeter m_Meters[MAX_COURSE_CONTENTS];
|
||||
Quad m_quad;
|
||||
|
||||
int m_iNumContents;
|
||||
CourseContentDisplay m_CourseContentDisplays[MAX_TOTAL_CONTENTS];
|
||||
|
||||
float m_fTimeUntilScroll;
|
||||
float m_fItemAtTopOfList; // between 0 and m_iNumContents
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "RageUtil.h"
|
||||
|
||||
#include "CroppedSprite.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageBitmapTexture.h"
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "DifficultyIcon.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "Sprite.h"
|
||||
#include "Song.h"
|
||||
#include "BitmapText.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
class DifficultyIcon : public Sprite
|
||||
|
||||
@@ -24,7 +24,7 @@ FocusingSprite::FocusingSprite()
|
||||
{
|
||||
for( int i=0; i<3; i++ )
|
||||
{
|
||||
this->AddActor( &m_sprites[i] );
|
||||
this->AddSubActor( &m_sprites[i] );
|
||||
}
|
||||
|
||||
m_fPercentBlurred = 1.0f;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "FootMeter.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "Sprite.h"
|
||||
#include "Song.h"
|
||||
#include "BitmapText.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
class FootMeter : public BitmapText
|
||||
|
||||
@@ -353,6 +353,19 @@ inline Game StyleToGame( Style s )
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Chris:
|
||||
|
||||
Very cool system :-)
|
||||
|
||||
However, the NotesType is a property of the StyleDef, so we can look it up there.
|
||||
Get the the NotesType for a style with:
|
||||
GAMESTATE->GetCurrentStyleDef()->m_NotesType - or -
|
||||
GAMEMAN->GetStyleDefForStyle(style)->m_NotesType
|
||||
I'll add a new method to GAMEMAN called GetStyleThatPlaysNotesType():
|
||||
Style s = GAMEMAN->GetStyleThatPlaysNotesType( nt );
|
||||
|
||||
////////////////////////////////
|
||||
// NotesType/Style conversions
|
||||
////////////////////////////////
|
||||
@@ -496,7 +509,7 @@ print "\t\tdefault:\treturn NOTES_TYPE_INVALID;
|
||||
<- End of Perl file
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
//
|
||||
// NotesTypeToStyle(nt): Converts nt to a Style
|
||||
//
|
||||
@@ -549,7 +562,7 @@ inline NotesType StyleToNotesType ( Style s )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
///////////////////////////
|
||||
// Options stuff
|
||||
|
||||
+17
-16
@@ -18,7 +18,7 @@
|
||||
#include "StyleDef.h"
|
||||
|
||||
|
||||
CString GameDef::ElementToGraphicSuffix( const GameButtonGraphic gbg )
|
||||
CString GameDef::ElementToGraphicSuffix( const SkinElement gbg )
|
||||
{
|
||||
CString sAssetPath; // fill this in below
|
||||
|
||||
@@ -38,10 +38,9 @@ CString GameDef::ElementToGraphicSuffix( const GameButtonGraphic gbg )
|
||||
return sAssetPath;
|
||||
}
|
||||
|
||||
CString GameDef::GetPathToGraphic( const CString sSkinName, const int iInstrumentButton, const GameButtonGraphic gbg )
|
||||
CString GameDef::GetPathToGraphic( const CString sSkinName, const CString sButtonName, const SkinElement gbg )
|
||||
{
|
||||
const CString sSkinDir = ssprintf("Skins\\%s\\%s\\", m_szName, sSkinName);
|
||||
const CString sButtonName = m_szButtonNames[ iInstrumentButton ];
|
||||
const CString sGraphicSuffix = ElementToGraphicSuffix( gbg );
|
||||
|
||||
CStringArray arrayPossibleFileNames; // fill this with the possible files
|
||||
@@ -58,10 +57,9 @@ CString GameDef::GetPathToGraphic( const CString sSkinName, const int iInstrumen
|
||||
return "";
|
||||
}
|
||||
|
||||
void GameDef::GetTweenColors( const CString sSkinName, const int iInstrumentButton, CArray<D3DXCOLOR,D3DXCOLOR> &arrayTweenColors )
|
||||
void GameDef::GetTweenColors( const CString sSkinName, const CString sButtonName, CArray<D3DXCOLOR,D3DXCOLOR> &arrayTweenColors )
|
||||
{
|
||||
const CString sSkinDir = ssprintf("Skins\\%s\\%s\\", m_szName, sSkinName);
|
||||
const CString sButtonName = m_szButtonNames[ iInstrumentButton ];
|
||||
|
||||
const CString sColorsFilePath = sSkinDir + sButtonName + ".colors";
|
||||
|
||||
@@ -115,16 +113,19 @@ void GameDef::AssertSkinsAreComplete()
|
||||
GetSkinNames( asSkinNames );
|
||||
|
||||
for( int i=0; i<asSkinNames.GetSize(); i++ )
|
||||
AssertSkinIsComplete( asSkinNames[i] );
|
||||
}
|
||||
|
||||
void GameDef::AssertSkinIsComplete( CString sSkin )
|
||||
{
|
||||
CString sGameSkinFolder = "Skins\\" + sSkin + "\\";
|
||||
|
||||
for( int j=0; j<NUM_GAME_BUTTON_GRAPHICS; j++ )
|
||||
{
|
||||
CString sSkin = asSkinNames[i];
|
||||
CString sGameSkinFolder = "Skins\\" + sSkin + "\\";
|
||||
|
||||
for( int i=0; i<NUM_GAME_BUTTON_GRAPHICS; i++ )
|
||||
{
|
||||
GameButtonGraphic gbg = (GameButtonGraphic)i;
|
||||
CString sPathToGraphic = GetPathToGraphic( sSkin, INSTRUMENT_1, gbg );
|
||||
if( !DoesFileExist(sPathToGraphic) )
|
||||
throw RageException( "Game button graphic at %s is missing.", sPathToGraphic );
|
||||
}
|
||||
}
|
||||
SkinElement gbg = (SkinElement)j;
|
||||
CString sButtonName = m_szButtonNames[j];
|
||||
CString sPathToGraphic = GetPathToGraphic( sSkin, sButtonName, gbg );
|
||||
if( !DoesFileExist(sPathToGraphic) )
|
||||
throw RageException( "Game button graphic at %s is missing.", sPathToGraphic );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
const int MAX_STYLES_PER_GAME = 10;
|
||||
|
||||
|
||||
enum GameButtonGraphic {
|
||||
enum SkinElement {
|
||||
GRAPHIC_NOTE_COLOR_PART,
|
||||
GRAPHIC_NOTE_GRAY_PART,
|
||||
GRAPHIC_RECEPTOR,
|
||||
@@ -57,10 +57,11 @@ public:
|
||||
void GetSkinNames( CStringArray &asSkinNames );
|
||||
bool HasASkinNamed( CString sSkin );
|
||||
void AssertSkinsAreComplete();
|
||||
void AssertSkinIsComplete( CString sSkin );
|
||||
|
||||
CString GetPathToGraphic( const CString sSkinName, const int iInstrumentButton, const GameButtonGraphic gbg );
|
||||
void GetTweenColors( const CString sSkinName, const int iInstrumentButton, CArray<D3DXCOLOR,D3DXCOLOR> &arrayTweenColors );
|
||||
CString ElementToGraphicSuffix( const GameButtonGraphic gbg );
|
||||
CString GetPathToGraphic( const CString sSkinName, const CString sButtonName, const SkinElement gbg );
|
||||
void GetTweenColors( const CString sSkinName, const CString sButtonName, CArray<D3DXCOLOR,D3DXCOLOR> &arrayTweenColors );
|
||||
CString ElementToGraphicSuffix( const SkinElement gbg );
|
||||
|
||||
|
||||
inline MenuInput GameInputToMenuInput( const GameInput GameI )
|
||||
|
||||
@@ -12,10 +12,13 @@
|
||||
|
||||
#include "GameManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
|
||||
InstrumentButton DANCE_BUTTON_LEFT = (InstrumentButton)0;
|
||||
InstrumentButton DANCE_BUTTON_RIGHT = (InstrumentButton)1;
|
||||
InstrumentButton DANCE_BUTTON_UP = (InstrumentButton)2;
|
||||
@@ -584,34 +587,28 @@ StyleDef g_StyleDefs[NUM_STYLES] =
|
||||
|
||||
GameManager::GameManager()
|
||||
{
|
||||
m_CurGame = GAME_DANCE;
|
||||
m_CurStyle = STYLE_NONE;
|
||||
|
||||
CStringArray asSkinNames;
|
||||
GetSkinNames( asSkinNames );
|
||||
m_sCurrentSkin = PREFSMAN->m_sNoteSkin;
|
||||
for( int i=0; i<asSkinNames.GetSize(); i++ )
|
||||
{
|
||||
if( m_sCurrentSkin == asSkinNames[i] )
|
||||
goto skin_exists;
|
||||
}
|
||||
m_sCurrentSkin = asSkinNames[0];
|
||||
|
||||
skin_exists:
|
||||
|
||||
m_sMasterPlayerNumber = PLAYER_1;
|
||||
}
|
||||
|
||||
|
||||
GameDef* GameManager::GetCurrentGameDef()
|
||||
GameDef* GameManager::GetGameDefForGame( Game g )
|
||||
{
|
||||
return &g_GameDefs[ m_CurGame ];
|
||||
ASSERT( g != GAME_INVALID );
|
||||
return &g_GameDefs[ g ];
|
||||
}
|
||||
|
||||
StyleDef* GameManager::GetCurrentStyleDef()
|
||||
StyleDef* GameManager::GetStyleDefForStyle( Style s )
|
||||
{
|
||||
ASSERT( m_CurStyle != STYLE_NONE );
|
||||
return &g_StyleDefs[ m_CurStyle ];
|
||||
ASSERT( s != STYLE_NONE );
|
||||
return &g_StyleDefs[ s ];
|
||||
}
|
||||
|
||||
Style GameManager::GetStyleThatPlaysNotesType( NotesType nt )
|
||||
{
|
||||
for( int i=0; i<NUM_STYLES; i++ )
|
||||
if( g_StyleDefs[i].m_NotesType == nt )
|
||||
return (Style)i;
|
||||
|
||||
return STYLE_NONE;
|
||||
}
|
||||
|
||||
void GameManager::GetGameNames( CStringArray &AddTo )
|
||||
@@ -620,31 +617,64 @@ void GameManager::GetGameNames( CStringArray &AddTo )
|
||||
AddTo.Add( g_GameDefs[i].m_szName );
|
||||
}
|
||||
|
||||
void GameManager::GetSkinNames( CStringArray &AddTo )
|
||||
|
||||
void GameManager::GetNoteSkinNames( CStringArray &AddTo )
|
||||
{
|
||||
GetCurrentGameDef()->GetSkinNames( AddTo );
|
||||
GAMESTATE->GetCurrentGameDef()->GetSkinNames( AddTo );
|
||||
}
|
||||
|
||||
bool GameManager::IsPlayerEnabled( PlayerNumber pn )
|
||||
bool GameManager::DoesNoteSkinExist( CString sSkinName )
|
||||
{
|
||||
if( m_CurStyle == STYLE_NONE ) // if no style set (we're in TitleMenu, ConfigInstruments or something)
|
||||
return true; // allow input from both sides
|
||||
|
||||
return ( pn == m_sMasterPlayerNumber ) ||
|
||||
( GetCurrentStyleDef()->m_StyleType == StyleDef::TWO_PLAYERS_USE_TWO_SIDES );
|
||||
};
|
||||
|
||||
CString GameManager::GetPathToGraphic( const PlayerNumber p, const int col, const GameButtonGraphic gbg )
|
||||
{
|
||||
StyleInput si( p, col );
|
||||
GameInput gi = GetCurrentStyleDef()->StyleInputToGameInput( si );
|
||||
InstrumentButton b = gi.button;
|
||||
return GetCurrentGameDef()->GetPathToGraphic( m_sCurrentSkin, b, gbg );
|
||||
CStringArray asSkinNames;
|
||||
GetNoteSkinNames( asSkinNames );
|
||||
for( int i=0; i<asSkinNames.GetSize(); i++ )
|
||||
if( 0==stricmp(sSkinName, asSkinNames[i]) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void GameManager::GetTweenColors( const PlayerNumber p, const int col, CArray<D3DXCOLOR,D3DXCOLOR> &aTweenColorsAddTo )
|
||||
void GameManager::SwitchNoteSkin( CString sNewNoteSkin )
|
||||
{
|
||||
StyleInput StyleI( p, col );
|
||||
GameInput GameI = GetCurrentStyleDef()->StyleInputToGameInput( StyleI );
|
||||
GetCurrentGameDef()->GetTweenColors( m_sCurrentSkin, GameI.button, aTweenColorsAddTo );
|
||||
if( sNewNoteSkin == "" || !DoesNoteSkinExist(sNewNoteSkin) )
|
||||
{
|
||||
CStringArray as;
|
||||
GetNoteSkinNames( as );
|
||||
m_sCurNoteSkin = as[0];
|
||||
}
|
||||
else
|
||||
m_sCurNoteSkin = sNewNoteSkin;
|
||||
}
|
||||
|
||||
CString GameManager::GetPathTo( Game g, CString sSkinName, CString sButtonName, const SkinElement gbg )
|
||||
{
|
||||
return GetGameDefForGame(g)->GetPathToGraphic( sSkinName, sButtonName, gbg );
|
||||
}
|
||||
|
||||
void GameManager::GetTweenColors( Game g, CString sSkinName, CString sButtonName, CArray<D3DXCOLOR,D3DXCOLOR> &aTweenColorsAddTo )
|
||||
{
|
||||
GetGameDefForGame(g)->GetTweenColors( sSkinName, sButtonName, aTweenColorsAddTo );
|
||||
}
|
||||
|
||||
CString GameManager::GetPathTo( const int col, const SkinElement gbg ) // looks in GAMESTATE for the current Style
|
||||
{
|
||||
StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
||||
|
||||
StyleInput SI( PLAYER_1, col );
|
||||
GameInput GI = pStyleDef->StyleInputToGameInput( SI );
|
||||
CString sButtonName = pGameDef->m_szButtonNames[GI.button];
|
||||
return pGameDef->GetPathToGraphic( m_sCurNoteSkin, sButtonName, gbg );
|
||||
}
|
||||
|
||||
void GameManager::GetTweenColors( const int col, CArray<D3DXCOLOR,D3DXCOLOR> &aTweenColorsAddTo ) // looks in GAMESTATE for the current Style
|
||||
{
|
||||
ASSERT( m_sCurNoteSkin != "" ); // if this == NULL, SwitchGame() was never called
|
||||
|
||||
StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
||||
|
||||
StyleInput SI( PLAYER_1, col );
|
||||
GameInput GI = pStyleDef->StyleInputToGameInput( SI );
|
||||
CString sButtonName = pGameDef->m_szButtonNames[GI.button];
|
||||
pGameDef->GetTweenColors( m_sCurNoteSkin, sButtonName, aTweenColorsAddTo );
|
||||
}
|
||||
|
||||
+21
-14
@@ -14,28 +14,35 @@
|
||||
#include "StyleDef.h"
|
||||
|
||||
|
||||
const int MAX_GAME_DEFS = 10;
|
||||
|
||||
|
||||
class GameManager
|
||||
{
|
||||
public:
|
||||
GameManager();
|
||||
|
||||
Game m_CurGame;
|
||||
Style m_CurStyle;
|
||||
NotesType m_CurNotesType; // only used in Edit
|
||||
CString m_sCurrentSkin;
|
||||
PlayerNumber m_sMasterPlayerNumber;
|
||||
GameDef* GetGameDefForGame( Game g );
|
||||
StyleDef* GetStyleDefForStyle( Style s );
|
||||
|
||||
GameDef* GetCurrentGameDef();
|
||||
StyleDef* GetCurrentStyleDef();
|
||||
Style GetStyleThatPlaysNotesType( NotesType nt );
|
||||
|
||||
void GetGameNames( CStringArray &AddTo );
|
||||
void GetSkinNames( CStringArray &AddTo );
|
||||
bool IsPlayerEnabled( PlayerNumber PlayerNo );
|
||||
CString GetPathToGraphic( const PlayerNumber p, const int col, const GameButtonGraphic gbg );
|
||||
void GetTweenColors( const PlayerNumber p, const int col, CArray<D3DXCOLOR,D3DXCOLOR> &aTweenColorsAddTo );
|
||||
bool DoesGameExist( CString sGameName );
|
||||
void SwitchGame( Game newGame );
|
||||
|
||||
void GetNoteSkinNames( CStringArray &AddTo ); // looks up current Game in GAMESTATE
|
||||
bool DoesNoteSkinExist( CString sSkinName ); // looks up current Game in GAMESTATE
|
||||
void SwitchNoteSkin( CString sNewNoteSkin ); // looks up current Game in GAMESTATE
|
||||
CString GetCurNoteSkin() { return m_sCurNoteSkin; };
|
||||
|
||||
CString GetPathTo( const int col, const SkinElement gbg ); // looks in GAMESTATE for the current Style
|
||||
void GetTweenColors( const int col, CArray<D3DXCOLOR,D3DXCOLOR> &aTweenColorsAddTo ); // looks in GAMESTATE for the current Style
|
||||
|
||||
protected:
|
||||
|
||||
CString GetPathTo( Game g, CString sSkinName, CString sButtonName, const SkinElement gbg );
|
||||
void GetTweenColors( Game g, CString sSkinName, CString sButtonName, CArray<D3DXCOLOR,D3DXCOLOR> &aTweenColorsAddTo );
|
||||
|
||||
CString m_sCurNoteSkin;
|
||||
|
||||
};
|
||||
|
||||
extern GameManager* GAMEMAN; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: GameState
|
||||
|
||||
Desc: See Header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "GameState.h"
|
||||
#include "IniFile.h"
|
||||
#include "GameManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "InputMapper.h"
|
||||
|
||||
|
||||
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
|
||||
GameState::GameState()
|
||||
{
|
||||
m_sLoadingMessage = "Initializing hardware...";
|
||||
Reset();
|
||||
}
|
||||
|
||||
GameState::~GameState()
|
||||
{
|
||||
}
|
||||
|
||||
void GameState::Reset()
|
||||
{
|
||||
int p;
|
||||
|
||||
m_pCurSong = NULL;
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
m_pCurNotes[p] = NULL;
|
||||
m_pCurCourse = NULL;
|
||||
m_sPreferredGroup = "";
|
||||
|
||||
m_aGameplayStatistics.RemoveAll();
|
||||
|
||||
m_CurGame = GAME_DANCE;
|
||||
m_CurStyle = STYLE_NONE;
|
||||
m_MasterPlayerNumber = PLAYER_INVALID;
|
||||
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
m_PreferredDifficultyClass[p] = CLASS_EASY;
|
||||
m_SongSortOrder = SORT_GROUP;
|
||||
m_PlayMode = PLAY_MODE_INVALID;
|
||||
m_iCurrentStageIndex = 0;
|
||||
}
|
||||
|
||||
void GameState::SwitchGame( Game newGame )
|
||||
{
|
||||
ASSERT( newGame >= 0 && newGame < NUM_GAMES );
|
||||
|
||||
m_CurGame = newGame;
|
||||
}
|
||||
|
||||
int GameState::GetStageIndex()
|
||||
{
|
||||
return m_iCurrentStageIndex;
|
||||
}
|
||||
|
||||
bool GameState::IsFinalStage()
|
||||
{
|
||||
if( PREFSMAN->m_bEventMode )
|
||||
return false;
|
||||
return m_iCurrentStageIndex == PREFSMAN->m_iNumArcadeStages-1;
|
||||
}
|
||||
|
||||
bool GameState::IsExtraStage()
|
||||
{
|
||||
if( PREFSMAN->m_bEventMode )
|
||||
return false;
|
||||
return m_iCurrentStageIndex == PREFSMAN->m_iNumArcadeStages;
|
||||
}
|
||||
|
||||
bool GameState::IsExtraStage2()
|
||||
{
|
||||
if( PREFSMAN->m_bEventMode )
|
||||
return false;
|
||||
return m_iCurrentStageIndex == PREFSMAN->m_iNumArcadeStages+1;
|
||||
}
|
||||
|
||||
CString GameState::GetStageText()
|
||||
{
|
||||
if( IsFinalStage() )
|
||||
return "Final";
|
||||
else if( IsExtraStage() )
|
||||
return "Extra";
|
||||
else if( IsExtraStage2() )
|
||||
return "Extra 2";
|
||||
|
||||
|
||||
int iStageNo = m_iCurrentStageIndex+1;
|
||||
|
||||
CString sNumberSuffix;
|
||||
if( ( (iStageNo/10) % 10 ) == 1 ) // in the teens (e.g. 19, 213)
|
||||
{
|
||||
sNumberSuffix = "th";
|
||||
}
|
||||
else // not in the teens
|
||||
{
|
||||
const int iLastDigit = iStageNo%10;
|
||||
switch( iLastDigit )
|
||||
{
|
||||
case 1: sNumberSuffix = "st"; break;
|
||||
case 2: sNumberSuffix = "nd"; break;
|
||||
case 3: sNumberSuffix = "rd"; break;
|
||||
default:sNumberSuffix = "th"; break;
|
||||
}
|
||||
}
|
||||
return ssprintf( "%d%s", iStageNo, sNumberSuffix );
|
||||
}
|
||||
|
||||
D3DXCOLOR GameState::GetStageColor()
|
||||
{
|
||||
if( IsFinalStage() )
|
||||
return D3DXCOLOR(1,0.1f,0.1f,1); // red
|
||||
else if( IsExtraStage() || IsExtraStage2() )
|
||||
return D3DXCOLOR(1,1,0.3f,1); // yellow
|
||||
else
|
||||
return D3DXCOLOR(0.3f,1,0.3f,1); // green
|
||||
}
|
||||
|
||||
GameplayStatistics& GameState::GetLatestGameplayStatistics()
|
||||
{
|
||||
ASSERT( m_aGameplayStatistics.GetSize() > 0 );
|
||||
return m_aGameplayStatistics[ m_aGameplayStatistics.GetSize()-1 ];
|
||||
}
|
||||
|
||||
GameDef* GameState::GetCurrentGameDef()
|
||||
{
|
||||
return GAMEMAN->GetGameDefForGame( m_CurGame );
|
||||
}
|
||||
|
||||
StyleDef* GameState::GetCurrentStyleDef()
|
||||
{
|
||||
return GAMEMAN->GetStyleDefForStyle( m_CurStyle );
|
||||
}
|
||||
|
||||
bool GameState::IsPlayerEnabled( PlayerNumber pn )
|
||||
{
|
||||
if( m_CurStyle == STYLE_NONE ) // if no style set (we're in TitleMenu, ConfigInstruments or something)
|
||||
return true; // allow input from both sides
|
||||
|
||||
return ( pn == m_MasterPlayerNumber ) ||
|
||||
( GetCurrentStyleDef()->m_StyleType == StyleDef::TWO_PLAYERS_USE_TWO_SIDES );
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: GameState
|
||||
|
||||
Desc: Holds game data that is not saved between sessions.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "GameplayStatistics.h"
|
||||
|
||||
|
||||
class Song;
|
||||
struct Notes;
|
||||
class Course;
|
||||
class GameDef;
|
||||
class StyleDef;
|
||||
|
||||
|
||||
class GameState
|
||||
{
|
||||
public:
|
||||
GameState();
|
||||
~GameState();
|
||||
void Reset();
|
||||
|
||||
Song* m_pCurSong;
|
||||
Notes* m_pCurNotes[NUM_PLAYERS];
|
||||
Course* m_pCurCourse;
|
||||
int m_iCoursePossibleDancePoints;
|
||||
|
||||
// Info used during gameplay
|
||||
// Let lots of classes access the music beat here so we don't have to pass it around everywhere
|
||||
float m_fMusicSeconds;
|
||||
float m_fMusicBeat;
|
||||
float m_fCurBPS;
|
||||
bool m_bFreeze;
|
||||
|
||||
CArray<GameplayStatistics,GameplayStatistics> m_aGameplayStatistics; // for passing from Dancing to Results
|
||||
GameplayStatistics& GetLatestGameplayStatistics();
|
||||
|
||||
protected:
|
||||
Game m_CurGame;
|
||||
public:
|
||||
Game GetCurGame() { return m_CurGame; };
|
||||
void SwitchGame( Game newGame );
|
||||
Style m_CurStyle;
|
||||
PlayerNumber m_MasterPlayerNumber;
|
||||
|
||||
GameDef* GetCurrentGameDef();
|
||||
StyleDef* GetCurrentStyleDef();
|
||||
|
||||
bool IsPlayerEnabled( PlayerNumber pn );
|
||||
//bool IsPlayerEnabled( int p ) { return IsPlayerEnabled( (PlayerNumber)p ); }; // for those too lasy to cast all those p's to a PlayerNumber
|
||||
|
||||
|
||||
CString m_sLoadingMessage;
|
||||
CString m_sPreferredGroup;
|
||||
DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS];
|
||||
SongSortOrder m_SongSortOrder; // used by MusicWheel
|
||||
PlayMode m_PlayMode;
|
||||
int m_iCurrentStageIndex; // starts at 0, and is incremented with each Stage Clear
|
||||
|
||||
int GetStageIndex();
|
||||
bool IsFinalStage();
|
||||
bool IsExtraStage();
|
||||
bool IsExtraStage2();
|
||||
CString GetStageText();
|
||||
D3DXCOLOR GetStageColor();
|
||||
|
||||
|
||||
PlayerOptions m_PlayerOptions[NUM_PLAYERS];
|
||||
SongOptions m_SongOptions;
|
||||
};
|
||||
|
||||
|
||||
extern GameState* GAMESTATE; // global and accessable from anywhere in our program
|
||||
@@ -5,7 +5,7 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "GhostArrow.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
const float GRAY_ARROW_TWEEN_TIME = 0.5f;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "GhostArrowBright.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
const float GRAY_ARROW_TWEEN_TIME = 0.5f;
|
||||
|
||||
@@ -12,11 +12,12 @@
|
||||
#include "GhostArrowRow.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ColorNote.h"
|
||||
#include "ArrowEffects.h"
|
||||
#include "GameManager.h"
|
||||
|
||||
#include "GameState.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
GhostArrowRow::GhostArrowRow()
|
||||
@@ -28,16 +29,16 @@ void GhostArrowRow::Load( PlayerNumber pn, StyleDef* pStyleDef, PlayerOptions po
|
||||
{
|
||||
m_PlayerOptions = po;
|
||||
|
||||
GameDef* pGameDef = GAMEMAN->GetCurrentGameDef();
|
||||
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
||||
|
||||
m_iNumCols = pStyleDef->m_iColsPerPlayer;
|
||||
|
||||
// init arrows
|
||||
for( int c=0; c<m_iNumCols; c++ )
|
||||
{
|
||||
m_GhostArrowRow[c].Load( GAMEMAN->GetPathToGraphic(pn, c, GRAPHIC_TAP_EXPLOSION_DIM) );
|
||||
m_GhostArrowRowBright[c].Load( GAMEMAN->GetPathToGraphic(pn, c, GRAPHIC_TAP_EXPLOSION_BRIGHT) );
|
||||
m_HoldGhostArrowRow[c].Load( GAMEMAN->GetPathToGraphic(pn, c, GRAPHIC_HOLD_EXPLOSION) );
|
||||
m_GhostArrowRow[c].Load( GAMEMAN->GetPathTo(c, GRAPHIC_TAP_EXPLOSION_DIM) );
|
||||
m_GhostArrowRowBright[c].Load( GAMEMAN->GetPathTo(c, GRAPHIC_TAP_EXPLOSION_BRIGHT) );
|
||||
m_HoldGhostArrowRow[c].Load( GAMEMAN->GetPathTo(c, GRAPHIC_HOLD_EXPLOSION) );
|
||||
|
||||
m_GhostArrowRow[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset );
|
||||
m_GhostArrowRowBright[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset );
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "GradeDisplay.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
const float SCROLL_TIME = 5.0f;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
#include "Sprite.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "Grade.h"
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "GrayArrow.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
const float GRAY_ARROW_POP_UP_TIME = 0.15f;
|
||||
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
#include "GrayArrowRow.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ColorNote.h"
|
||||
#include "ArrowEffects.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameState.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
GrayArrowRow::GrayArrowRow()
|
||||
@@ -28,13 +30,13 @@ void GrayArrowRow::Load( PlayerNumber pn, StyleDef* pStyleDef, PlayerOptions po
|
||||
{
|
||||
m_PlayerOptions = po;
|
||||
|
||||
GameDef* pGameDef = GAMEMAN->GetCurrentGameDef();
|
||||
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
||||
|
||||
m_iNumCols = pStyleDef->m_iColsPerPlayer;
|
||||
|
||||
for( int c=0; c<m_iNumCols; c++ )
|
||||
{
|
||||
m_GrayArrow[c].Load( GAMEMAN->GetPathToGraphic(pn, c, GRAPHIC_RECEPTOR) );
|
||||
m_GrayArrow[c].Load( GAMEMAN->GetPathTo(c, GRAPHIC_RECEPTOR) );
|
||||
m_GrayArrow[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset );
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "RageUtil.h"
|
||||
|
||||
#include "GrooveRadar.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageBitmapTexture.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ float RADAR_VALUE_ROTATION( int iValueIndex ) { return D3DX_PI/2 + D3DX_PI*2 / 5
|
||||
|
||||
GrooveRadar::GrooveRadar()
|
||||
{
|
||||
this->AddActor( &m_GrooveRadarValueMap );
|
||||
this->AddSubActor( &m_GrooveRadarValueMap );
|
||||
|
||||
for( int c=0; c<NUM_RADAR_CATEGORIES; c++ )
|
||||
{
|
||||
@@ -48,7 +48,7 @@ GrooveRadar::GrooveRadar()
|
||||
m_sprRadarLabels[c].StopAnimating();
|
||||
m_sprRadarLabels[c].SetState( c );
|
||||
m_sprRadarLabels[c].SetXY( fX, fY );
|
||||
this->AddActor( &m_sprRadarLabels[c] );
|
||||
this->AddSubActor( &m_sprRadarLabels[c] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ void GrooveRadar::TweenOffScreen()
|
||||
GrooveRadar::GrooveRadarValueMap::GrooveRadarValueMap()
|
||||
{
|
||||
m_sprRadarBase.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_BASE) );
|
||||
this->AddActor( &m_sprRadarBase );
|
||||
this->AddSubActor( &m_sprRadarBase );
|
||||
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "HoldGhostArrow.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
const float HOLD_GHOST_ARROW_TWEEN_TIME = 0.5f;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "HoldJudgement.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
const float JUDGEMENT_DISPLAY_TIME = 0.6f;
|
||||
@@ -24,7 +24,7 @@ HoldJudgement::HoldJudgement()
|
||||
m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_JUDGEMENT) );
|
||||
m_sprJudgement.StopAnimating();
|
||||
m_sprJudgement.TurnShadowOn();
|
||||
this->AddActor( &m_sprJudgement );
|
||||
this->AddSubActor( &m_sprJudgement );
|
||||
}
|
||||
|
||||
void HoldJudgement::Update( float fDeltaTime )
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "ActorFrame.h"
|
||||
#include "Song.h"
|
||||
#include "BitmapText.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
class HoldJudgement : public ActorFrame
|
||||
|
||||
+115
-99
@@ -1,14 +1,16 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
File: IniFile.h
|
||||
Class: IniFile
|
||||
|
||||
Desc: Wrapper for reading and writing an .ini file.
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Adam Clauss
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "IniFile.h"
|
||||
|
||||
|
||||
@@ -45,23 +47,26 @@ void IniFile::SetPath(CString newpath)
|
||||
|
||||
//reads ini file specified using IniFile::SetPath()
|
||||
//returns true if successful, false otherwise
|
||||
BOOL IniFile::ReadFile()
|
||||
bool IniFile::ReadFile()
|
||||
{
|
||||
CStdioFile file;
|
||||
if( !file.Open(path, CFile::modeRead) )
|
||||
CFileStatus status;
|
||||
if (!file.GetStatus(path,status))
|
||||
return 0;
|
||||
int curkey = -1, curval = -1;
|
||||
if (!file.Open(path, CFile::modeRead))
|
||||
{
|
||||
error = "Unable to open ini file.";
|
||||
return FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
CString line;
|
||||
int curkey = -1, curval = -1;
|
||||
CString keyname, valuename, value;
|
||||
while( file.ReadString(line) )
|
||||
CString temp;
|
||||
CString line;
|
||||
while (file.ReadString(line))
|
||||
{
|
||||
if( line != "" )
|
||||
if (line != "")
|
||||
{
|
||||
if( line[0] == '[' && line[line.GetLength()-1] == ']' ) //if a section heading
|
||||
if (line[0] == '[' && line[line.GetLength()-1] == ']') //if a section heading
|
||||
{
|
||||
keyname = line;
|
||||
keyname.TrimLeft('[');
|
||||
@@ -69,10 +74,7 @@ BOOL IniFile::ReadFile()
|
||||
}
|
||||
else //if a value
|
||||
{
|
||||
int iIndexOfEqual = line.Find("=");
|
||||
if( iIndexOfEqual == -1 ) // this is a malformed line
|
||||
continue;
|
||||
valuename = line.Left( iIndexOfEqual );
|
||||
valuename = line.Left(line.Find("="));
|
||||
value = line.Right(line.GetLength()-valuename.GetLength()-1);
|
||||
SetValue(keyname,valuename,value);
|
||||
}
|
||||
@@ -85,36 +87,18 @@ BOOL IniFile::ReadFile()
|
||||
//writes data stored in class to ini file
|
||||
void IniFile::WriteFile()
|
||||
{
|
||||
CStdioFile file;
|
||||
if( !file.Open(path, CFile::modeCreate | CFile::modeWrite ) )
|
||||
FILE* fp = fopen( path, "w" );
|
||||
for (int keynum = 0; keynum <= names.GetUpperBound(); keynum++)
|
||||
{
|
||||
error = "Unable to open ini for writing.";
|
||||
return;
|
||||
}
|
||||
|
||||
// foreach key
|
||||
for( int keynum = 0; keynum <= names.GetUpperBound(); keynum++ )
|
||||
{
|
||||
CString sTemp;
|
||||
sTemp.Format( "[%s]\n", names[keynum] );
|
||||
file.WriteString( sTemp );
|
||||
|
||||
CMapStringToString &map = keys[keynum];
|
||||
|
||||
// for each value_name/value pair
|
||||
for( POSITION pos = map.GetStartPosition(); pos != NULL; )
|
||||
if (keys[keynum].names.GetSize() != 0)
|
||||
{
|
||||
CString value_name;
|
||||
CString value;
|
||||
map.GetNextAssoc( pos, value_name, value );
|
||||
|
||||
sTemp.Format( "%s=%s\n", value_name, value );
|
||||
file.WriteString( sTemp );
|
||||
fprintf( fp, "[%s]\n", names[keynum] );
|
||||
for (int valuenum = 0; valuenum <= keys[keynum].names.GetUpperBound(); valuenum++)
|
||||
fprintf( fp, "%s=%s\n", keys[keynum].names[valuenum], keys[keynum].values[valuenum] );
|
||||
fprintf( fp, "\n" );
|
||||
}
|
||||
file.WriteString( "\n" );
|
||||
}
|
||||
|
||||
file.Close();
|
||||
fclose( fp );
|
||||
}
|
||||
|
||||
//deletes all stored ini data
|
||||
@@ -130,68 +114,71 @@ int IniFile::GetNumKeys()
|
||||
return keys.GetSize();
|
||||
}
|
||||
|
||||
//returns a pointer to the key for direct modification
|
||||
CMapStringToString* IniFile::GetKeyPointer( CString keyname )
|
||||
{
|
||||
int keynum = FindKey(keyname);
|
||||
if (keynum == -1)
|
||||
return NULL;
|
||||
else
|
||||
return &keys[keynum];
|
||||
}
|
||||
|
||||
//returns number of values stored for specified key, or -1 if key not found
|
||||
//returns number of values stored for specified key, or -1 if key found
|
||||
int IniFile::GetNumValues(CString keyname)
|
||||
{
|
||||
int keynum = FindKey(keyname);
|
||||
if (keynum == -1)
|
||||
return -1;
|
||||
else
|
||||
return keys[keynum].GetCount();
|
||||
return keys[keynum].names.GetSize();
|
||||
}
|
||||
|
||||
//gets value of [keyname] valuename =
|
||||
//overloaded to return CString, int, and double
|
||||
bool IniFile::GetValue(CString keyname, CString valuename, CString &value_out)
|
||||
bool IniFile::GetValue(CString keyname, CString valuename, CString& value)
|
||||
{
|
||||
int keynum = FindKey(keyname);//, valuenum = FindValue(keynum,valuename);
|
||||
if( keynum == -1 )
|
||||
return false;
|
||||
int keynum = FindKey(keyname), valuenum = FindValue(keynum,valuename);
|
||||
|
||||
CMapStringToString &map = keys[keynum];
|
||||
return 1 == map.Lookup(valuename, value_out);
|
||||
}
|
||||
|
||||
//gets value of [keyname] valuename =
|
||||
//overloaded to return CString, int, and double
|
||||
bool IniFile::GetValueI(CString keyname, CString valuename, int &value_out)
|
||||
{
|
||||
CString sValue;
|
||||
if( !GetValue(keyname, valuename, sValue) )
|
||||
if (keynum == -1)
|
||||
{
|
||||
error = "Unable to locate specified key.";
|
||||
return false;
|
||||
value_out = atoi(sValue);
|
||||
}
|
||||
|
||||
if (valuenum == -1)
|
||||
{
|
||||
error = "Unable to locate specified value.";
|
||||
return false;
|
||||
}
|
||||
|
||||
value = keys[keynum].values[valuenum];
|
||||
return true;
|
||||
}
|
||||
|
||||
//gets value of [keyname] valuename =
|
||||
//overloaded to return CString, int, and double
|
||||
bool IniFile::GetValueF(CString keyname, CString valuename, float &value_out)
|
||||
bool IniFile::GetValueI(CString keyname, CString valuename, int& value)
|
||||
{
|
||||
CString sValue;
|
||||
if( !GetValue(keyname, valuename, sValue) )
|
||||
bool bSuccess = GetValue(keyname,valuename,sValue);
|
||||
if( !bSuccess )
|
||||
return false;
|
||||
value_out = (float)atof(sValue);
|
||||
value = atoi(sValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
//gets value of [keyname] valuename =
|
||||
//overloaded to return CString, int, and double
|
||||
bool IniFile::GetValueB(CString keyname, CString valuename, bool &value_out)
|
||||
bool IniFile::GetValueF(CString keyname, CString valuename, float& value)
|
||||
{
|
||||
CString sValue;
|
||||
if( !GetValue(keyname, valuename, sValue) )
|
||||
bool bSuccess = GetValue(keyname,valuename,sValue);
|
||||
if( !bSuccess )
|
||||
return false;
|
||||
value_out = sValue == "1";
|
||||
value = (float)atof(sValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
//gets value of [keyname] valuename =
|
||||
//overloaded to return CString, int, and double
|
||||
bool IniFile::GetValueB(CString keyname, CString valuename, bool& value)
|
||||
{
|
||||
CString sValue;
|
||||
bool bSuccess = GetValue(keyname,valuename,sValue);
|
||||
if( !bSuccess )
|
||||
return false;
|
||||
value = atoi(sValue) != 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -199,34 +186,40 @@ bool IniFile::GetValueB(CString keyname, CString valuename, bool &value_out)
|
||||
//specify the optional paramter as false (0) if you do not want it to create
|
||||
//the key if it doesn't exist. Returns true if data entered, false otherwise
|
||||
//overloaded to accept CString, int, and double
|
||||
bool IniFile::SetValue(CString keyname, CString valuename, CString value, BOOL create)
|
||||
bool IniFile::SetValue(CString keyname, CString valuename, CString value, bool create)
|
||||
{
|
||||
int keynum = FindKey(keyname);
|
||||
|
||||
if( keynum == -1 ) //if key doesn't exist
|
||||
int keynum = FindKey(keyname), valuenum = 0;
|
||||
//find key
|
||||
if (keynum == -1) //if key doesn't exist
|
||||
{
|
||||
if( !create ) //and user does not want to create it,
|
||||
return FALSE; //stop entering this key
|
||||
if (!create) //and user does not want to create it,
|
||||
return 0; //stop entering this key
|
||||
names.SetSize(names.GetSize()+1);
|
||||
keys.SetSize(keys.GetSize()+1);
|
||||
keynum = names.GetSize()-1;
|
||||
names[keynum] = keyname;
|
||||
}
|
||||
|
||||
// insert value
|
||||
CMapStringToString &map = keys[keynum];
|
||||
CString oldvalue;
|
||||
if( !map.Lookup(valuename, oldvalue) && !create )
|
||||
return FALSE;
|
||||
map[valuename] = value;
|
||||
return TRUE;
|
||||
//find value
|
||||
valuenum = FindValue(keynum,valuename);
|
||||
if (valuenum == -1)
|
||||
{
|
||||
if (!create)
|
||||
return 0;
|
||||
keys[keynum].names.SetSize(keys[keynum].names.GetSize()+1);
|
||||
keys[keynum].values.SetSize(keys[keynum].names.GetSize()+1);
|
||||
valuenum = keys[keynum].names.GetSize()-1;
|
||||
keys[keynum].names[valuenum] = valuename;
|
||||
}
|
||||
keys[keynum].values[valuenum] = value;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//sets value of [keyname] valuename =.
|
||||
//specify the optional paramter as false (0) if you do not want it to create
|
||||
//the key if it doesn't exist. Returns true if data entered, false otherwise
|
||||
//overloaded to accept CString, int, and double
|
||||
bool IniFile::SetValueI(CString keyname, CString valuename, int value, BOOL create)
|
||||
bool IniFile::SetValueI(CString keyname, CString valuename, int value, bool create)
|
||||
{
|
||||
CString temp;
|
||||
temp.Format("%d",value);
|
||||
@@ -237,10 +230,10 @@ bool IniFile::SetValueI(CString keyname, CString valuename, int value, BOOL crea
|
||||
//specify the optional paramter as false (0) if you do not want it to create
|
||||
//the key if it doesn't exist. Returns true if data entered, false otherwise
|
||||
//overloaded to accept CString, int, and double
|
||||
bool IniFile::SetValueF(CString keyname, CString valuename, double value, BOOL create)
|
||||
bool IniFile::SetValueF(CString keyname, CString valuename, float value, bool create)
|
||||
{
|
||||
CString temp;
|
||||
temp.Format("%f",value);
|
||||
temp.Format("%e",value);
|
||||
return SetValue(keyname, valuename, temp, create);
|
||||
}
|
||||
|
||||
@@ -248,7 +241,7 @@ bool IniFile::SetValueF(CString keyname, CString valuename, double value, BOOL c
|
||||
//specify the optional paramter as false (0) if you do not want it to create
|
||||
//the key if it doesn't exist. Returns true if data entered, false otherwise
|
||||
//overloaded to accept CString, int, and double
|
||||
bool IniFile::SetValueB(CString keyname, CString valuename, bool value, BOOL create)
|
||||
bool IniFile::SetValueB(CString keyname, CString valuename, bool value, bool create)
|
||||
{
|
||||
CString temp;
|
||||
temp.Format("%d",value);
|
||||
@@ -257,19 +250,20 @@ bool IniFile::SetValueB(CString keyname, CString valuename, bool value, BOOL cre
|
||||
|
||||
//deletes specified value
|
||||
//returns true if value existed and deleted, false otherwise
|
||||
BOOL IniFile::DeleteValue(CString keyname, CString valuename)
|
||||
bool IniFile::DeleteValue(CString keyname, CString valuename)
|
||||
{
|
||||
int keynum = FindKey(keyname);
|
||||
if( keynum == -1 )
|
||||
return FALSE;
|
||||
int keynum = FindKey(keyname), valuenum = FindValue(keynum,valuename);
|
||||
if (keynum == -1 || valuenum == -1)
|
||||
return 0;
|
||||
|
||||
CMapStringToString &map = keys[keynum];
|
||||
return map.RemoveKey( valuename );
|
||||
keys[keynum].names.RemoveAt(valuenum);
|
||||
keys[keynum].values.RemoveAt(valuenum);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//deletes specified key and all values contained within
|
||||
//returns true if key existed and deleted, false otherwise
|
||||
BOOL IniFile::DeleteKey(CString keyname)
|
||||
bool IniFile::DeleteKey(CString keyname)
|
||||
{
|
||||
int keynum = FindKey(keyname);
|
||||
if (keynum == -1)
|
||||
@@ -279,6 +273,16 @@ BOOL IniFile::DeleteKey(CString keyname)
|
||||
return 1;
|
||||
}
|
||||
|
||||
//deletes specified key and all values contained within
|
||||
//returns true if key existed and deleted, false otherwise
|
||||
IniFile::key* IniFile::GetKey(CString keyname)
|
||||
{
|
||||
int keynum = FindKey(keyname);
|
||||
if (keynum == -1)
|
||||
return NULL;
|
||||
return &keys[keynum];
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Private Functions
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
@@ -294,3 +298,15 @@ int IniFile::FindKey(CString keyname)
|
||||
return keynum;
|
||||
}
|
||||
|
||||
//returns index of specified value, in the specified key, or -1 if not found
|
||||
int IniFile::FindValue(int keynum, CString valuename)
|
||||
{
|
||||
if (keynum == -1)
|
||||
return -1;
|
||||
int valuenum = 0;
|
||||
while (valuenum < keys[keynum].names.GetSize() && keys[keynum].names[valuenum] != valuename)
|
||||
valuenum++;
|
||||
if (valuenum == keys[keynum].names.GetSize())
|
||||
return -1;
|
||||
return valuenum;
|
||||
}
|
||||
|
||||
+31
-30
@@ -1,21 +1,16 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
File: IniFile.h
|
||||
Class: IniFile
|
||||
|
||||
Desc: Wrapper for reading and writing an .ini file.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Adam Clauss
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _INIFILE_H_
|
||||
#define _INIFILE_H_
|
||||
|
||||
#include <afxtempl.h>
|
||||
//#include <iostream.h>
|
||||
|
||||
|
||||
class IniFile
|
||||
{
|
||||
//all private variables
|
||||
@@ -24,19 +19,29 @@ private:
|
||||
//stores pathname of ini file to read/write
|
||||
CString path;
|
||||
|
||||
public:
|
||||
//all keys are of this time
|
||||
typedef CMapStringToString key;
|
||||
struct key
|
||||
{
|
||||
//list of values in key
|
||||
CArray<CString, CString> values;
|
||||
|
||||
//corresponding list of value names
|
||||
CArray<CString, CString> names;
|
||||
};
|
||||
|
||||
private:
|
||||
//list of keys in ini
|
||||
CArray<key, key> keys;
|
||||
|
||||
//corresponding list of keynames
|
||||
CArray<CString, CString> names;
|
||||
|
||||
|
||||
|
||||
|
||||
//all private functions
|
||||
private:
|
||||
//returns index of specified value, in the specified key, or -1 if not found
|
||||
int FindValue(int keynum, CString valuename);
|
||||
|
||||
//returns index of specified key, or -1 if not found
|
||||
int FindKey(CString keyname);
|
||||
@@ -66,7 +71,7 @@ public:
|
||||
|
||||
//reads ini file specified using IniFile::SetPath()
|
||||
//returns true if successful, false otherwise
|
||||
BOOL ReadFile();
|
||||
bool ReadFile();
|
||||
|
||||
//writes data stored in class to ini file
|
||||
void WriteFile();
|
||||
@@ -77,37 +82,33 @@ public:
|
||||
//returns number of keys currently in the ini
|
||||
int GetNumKeys();
|
||||
|
||||
//returns a pointer to the key for direct modification
|
||||
CMapStringToString* GetKeyPointer( CString keyname );
|
||||
|
||||
//returns number of values stored for specified key
|
||||
int GetNumValues( CString keyname );
|
||||
int GetNumValues(CString keyname);
|
||||
|
||||
//gets value of [keyname] valuename =
|
||||
//overloaded to return CString, int, and double,
|
||||
//returns "", or 0 if key/value not found. Sets error member to show problem
|
||||
bool GetValue(CString keyname, CString valuename, CString &value_out);
|
||||
bool GetValueI(CString keyname, CString valuename, int &value_out);
|
||||
bool GetValueF(CString keyname, CString valuename, float &value_out);
|
||||
bool GetValueB(CString keyname, CString valuename, bool &value_out);
|
||||
bool GetValue(CString key, CString valuename, CString& value);
|
||||
bool GetValueI(CString key, CString valuename, int& value);
|
||||
bool GetValueF(CString key, CString valuename, float& value);
|
||||
bool GetValueB(CString key, CString valuename, bool& value);
|
||||
|
||||
//sets value of [keyname] valuename =.
|
||||
//specify the optional paramter as false (0) if you do not want it to create
|
||||
//the key if it doesn't exist. Returns true if data entered, false otherwise
|
||||
//overloaded to accept CString, int, and double
|
||||
bool SetValue(CString key, CString valuename, CString value, BOOL create = 1);
|
||||
bool SetValueI(CString key, CString valuename, int value, BOOL create = 1);
|
||||
bool SetValueF(CString key, CString valuename, double value, BOOL create = 1);
|
||||
bool SetValueB(CString key, CString valuename, bool value, BOOL create = 1);
|
||||
bool SetValue(CString key, CString valuename, CString value, bool create = 1);
|
||||
bool SetValueI(CString key, CString valuename, int value, bool create = 1);
|
||||
bool SetValueF(CString key, CString valuename, float value, bool create = 1);
|
||||
bool SetValueB(CString key, CString valuename, bool value, bool create = 1);
|
||||
|
||||
//deletes specified value
|
||||
//returns true if value existed and deleted, false otherwise
|
||||
BOOL DeleteValue(CString keyname, CString valuename);
|
||||
bool DeleteValue(CString keyname, CString valuename);
|
||||
|
||||
//deletes specified key and all values contained within
|
||||
//returns true if key existed and deleted, false otherwise
|
||||
BOOL DeleteKey(CString keyname);
|
||||
bool DeleteKey(CString keyname);
|
||||
|
||||
key* GetKey(CString keyname);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "InputMapper.h"
|
||||
#include "IniFile.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
InputMapper* INPUTMAPPER = NULL; // global and accessable from anywhere in our program
|
||||
@@ -20,9 +21,6 @@ InputMapper* INPUTMAPPER = NULL; // global and accessable from anywhere in our p
|
||||
|
||||
InputMapper::InputMapper()
|
||||
{
|
||||
m_sCurrentGame = GAMEMAN->GetCurrentGameDef()->m_szName;
|
||||
|
||||
ReadMappingsFromDisk();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,34 +36,33 @@ void InputMapper::ReadMappingsFromDisk()
|
||||
ASSERT( GAMEMAN != NULL );
|
||||
|
||||
IniFile ini;
|
||||
ini.SetPath( m_sCurrentGame + ".ini" );
|
||||
ini.SetPath( GAMESTATE->GetCurrentGameDef()->m_szName + CString("Map.ini") );
|
||||
if( !ini.ReadFile() ) {
|
||||
return; // load nothing
|
||||
//throw RageException( "could not read config file" );
|
||||
}
|
||||
|
||||
CMapStringToString* pKey = ini.GetKeyPointer("Input");
|
||||
CString name_string, value_string;
|
||||
IniFile::key* pKey = ini.GetKey( "Input" );
|
||||
|
||||
if( pKey != NULL )
|
||||
if( pKey == NULL )
|
||||
return;
|
||||
for( int i=0; i<pKey->names.GetSize(); i++ )
|
||||
{
|
||||
for( POSITION pos = pKey->GetStartPosition(); pos != NULL; )
|
||||
CString name = pKey->names[i];
|
||||
CString value = pKey->values[i];
|
||||
|
||||
GameInput GameI;
|
||||
GameI.fromString( name );
|
||||
|
||||
CStringArray sDeviceInputStrings;
|
||||
split( value, ",", sDeviceInputStrings, false );
|
||||
|
||||
for( int i=0; i<sDeviceInputStrings.GetSize() && i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
|
||||
{
|
||||
pKey->GetNextAssoc( pos, name_string, value_string );
|
||||
|
||||
GameInput GameI;
|
||||
GameI.fromString(name_string);
|
||||
|
||||
CStringArray sDeviceInputStrings;
|
||||
split( value_string, ",", sDeviceInputStrings, false );
|
||||
|
||||
for( int i=0; i<sDeviceInputStrings.GetSize() && i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
|
||||
{
|
||||
DeviceInput DeviceI;
|
||||
DeviceI.fromString( sDeviceInputStrings[i] );
|
||||
if( !DeviceI.IsBlank() )
|
||||
SetInputMap( DeviceI, GameI, i );
|
||||
}
|
||||
DeviceInput DeviceI;
|
||||
DeviceI.fromString( sDeviceInputStrings[i] );
|
||||
if( !DeviceI.IsBlank() )
|
||||
SetInputMap( DeviceI, GameI, i );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +71,7 @@ void InputMapper::ReadMappingsFromDisk()
|
||||
void InputMapper::SaveMappingsToDisk()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.SetPath( m_sCurrentGame + ".ini" );
|
||||
ini.SetPath( GAMESTATE->GetCurrentGameDef()->m_szName + CString("Map.ini") );
|
||||
// ini.ReadFile(); // don't read the file so that we overwrite everything there
|
||||
|
||||
|
||||
@@ -235,31 +232,31 @@ DeviceInput InputMapper::MenuToDevice( MenuInput MenuI )
|
||||
|
||||
void InputMapper::GameToStyle( GameInput GameI, StyleInput &StyleI )
|
||||
{
|
||||
if( GAMEMAN->m_CurStyle == STYLE_NONE )
|
||||
if( GAMESTATE->m_CurStyle == STYLE_NONE )
|
||||
{
|
||||
StyleI.MakeBlank();
|
||||
return;
|
||||
}
|
||||
|
||||
StyleDef* pStyleDef = GAMEMAN->GetCurrentStyleDef();
|
||||
StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||
StyleI = pStyleDef->GameInputToStyleInput( GameI );
|
||||
}
|
||||
|
||||
void InputMapper::GameToMenu( GameInput GameI, MenuInput &MenuI )
|
||||
{
|
||||
GameDef* pGameDef = GAMEMAN->GetCurrentGameDef();
|
||||
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
||||
MenuI = pGameDef->GameInputToMenuInput( GameI );
|
||||
}
|
||||
|
||||
void InputMapper::StyleToGame( StyleInput StyleI, GameInput &GameI )
|
||||
{
|
||||
StyleDef* pStyleDef = GAMEMAN->GetCurrentStyleDef();
|
||||
StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||
GameI = pStyleDef->StyleInputToGameInput( StyleI );
|
||||
}
|
||||
|
||||
void InputMapper::MenuToGame( MenuInput MenuI, GameInput &GameI )
|
||||
{
|
||||
GameDef* pGameDef = GAMEMAN->GetCurrentGameDef();
|
||||
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
||||
GameI = pGameDef->MenuInputToGameInput( MenuI );
|
||||
}
|
||||
|
||||
|
||||
@@ -29,13 +29,6 @@ public:
|
||||
InputMapper();
|
||||
~InputMapper();
|
||||
|
||||
void SwitchGame( CString sNewGame )
|
||||
{
|
||||
SaveMappingsToDisk();
|
||||
m_sCurrentGame = sNewGame;
|
||||
ReadMappingsFromDisk();
|
||||
};
|
||||
|
||||
void ReadMappingsFromDisk();
|
||||
void SaveMappingsToDisk();
|
||||
|
||||
@@ -63,8 +56,6 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
CString m_sCurrentGame;
|
||||
|
||||
// all the DeviceInputs that map to a GameInput
|
||||
DeviceInput m_GItoDI[MAX_INSTRUMENTS][MAX_INSTRUMENT_BUTTONS][NUM_GAME_TO_DEVICE_SLOTS];
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
File: Judgement.h
|
||||
Class: Judgement
|
||||
|
||||
Desc: A graphic displayed in the Judgement during Dancing.
|
||||
Desc: See header
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Judgement.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
const float JUDGEMENT_DISPLAY_TIME = 0.8f;
|
||||
|
||||
@@ -24,7 +25,7 @@ Judgement::Judgement()
|
||||
m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_JUDGEMENT) );
|
||||
m_sprJudgement.StopAnimating();
|
||||
m_sprJudgement.TurnShadowOn();
|
||||
this->AddActor( &m_sprJudgement );
|
||||
this->AddSubActor( &m_sprJudgement );
|
||||
}
|
||||
|
||||
void Judgement::Update( float fDeltaTime )
|
||||
@@ -59,7 +60,7 @@ void Judgement::SetJudgement( TapNoteScore score )
|
||||
default: ASSERT( false );
|
||||
}
|
||||
|
||||
if ( GAMEMAN->m_CurGame == GAME_EZ2 ) // Resize Judgement graphics for Ez2.
|
||||
if ( GAMESTATE->GetCurGame() == GAME_EZ2 ) // Resize Judgement graphics for Ez2.
|
||||
{
|
||||
m_sprJudgement.SetHeight( 22.0f * 2.1f );
|
||||
m_sprJudgement.SetWidth( 143.0f * 2.1f );
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "ActorFrame.h"
|
||||
#include "Song.h"
|
||||
#include "BitmapText.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
class Judgement : public ActorFrame
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "ActorFrame.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "NoteData.h"
|
||||
#include "ActorFrame.h"
|
||||
|
||||
|
||||
class Song;
|
||||
|
||||
|
||||
class LifeMeter : public ActorFrame
|
||||
@@ -21,15 +23,18 @@ public:
|
||||
LifeMeter() { m_fSongBeat = 0; };
|
||||
virtual ~LifeMeter() {};
|
||||
|
||||
void SetPlayerOptions(const PlayerOptions &po) { m_po = po; }
|
||||
void SetBeat( float fSongBeat ) { m_fSongBeat = fSongBeat; };
|
||||
virtual void Load( PlayerNumber p, const PlayerOptions &po ) { m_PlayerNumber = p; m_po = po; }
|
||||
virtual void SetBeat( float fSongBeat ) { m_fSongBeat = fSongBeat; };
|
||||
|
||||
virtual void NextSong( Song* pSong ) {};
|
||||
virtual void ChangeLife( TapNoteScore score ) = 0;
|
||||
virtual bool IsInDanger() = 0;
|
||||
virtual bool IsHot() = 0;
|
||||
virtual bool HasFailed() = 0;
|
||||
virtual bool IsFailing() = 0;
|
||||
virtual bool FailedEarlier() = 0;
|
||||
|
||||
protected:
|
||||
float m_fSongBeat;
|
||||
PlayerNumber m_PlayerNumber;
|
||||
PlayerOptions m_po;
|
||||
};
|
||||
|
||||
+125
-42
@@ -11,48 +11,97 @@
|
||||
*/
|
||||
|
||||
#include "LifeMeterBar.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
const int NUM_SECTIONS = 3;
|
||||
const float SECTION_WIDTH = 1.0f/NUM_SECTIONS;
|
||||
const int NUM_LIFE_STREAM_SECTIONS = 3;
|
||||
const float LIFE_STREAM_SECTION_WIDTH = 1.0f/NUM_LIFE_STREAM_SECTIONS;
|
||||
|
||||
const float METER_WIDTH = 258;
|
||||
const float METER_HEIGHT = 20;
|
||||
|
||||
const float DANGER_THRESHOLD = -0.3f;
|
||||
const float DANGER_THRESHOLD = 0.4f;
|
||||
const float FAIL_THRESHOLD = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
LifeMeterBar::LifeMeterBar()
|
||||
{
|
||||
m_fLifePercentage = 0.5f;
|
||||
m_fTrailingLifePercentage = 0;
|
||||
m_fLifeVelocity = 0;
|
||||
m_bHasFailed = false;
|
||||
m_fHotAlpha = 0;
|
||||
m_bFailedEarlier = false;
|
||||
|
||||
m_frame;
|
||||
|
||||
m_quadBlackBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
|
||||
m_quadBlackBackground.SetZoomX( METER_WIDTH );
|
||||
m_quadBlackBackground.SetZoomY( METER_HEIGHT );
|
||||
m_frame.AddSubActor( &m_quadBlackBackground );
|
||||
|
||||
m_sprStreamNormal.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_LIFEMETER_STREAM_NORMAL) );
|
||||
m_frame.AddSubActor( &m_sprStreamNormal );
|
||||
|
||||
m_sprStreamHot.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_LIFEMETER_STREAM_HOT) );
|
||||
m_frame.AddSubActor( &m_sprStreamHot );
|
||||
|
||||
m_sprFrame.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_LIFEMETER_BAR) );
|
||||
m_frame.AddSubActor( &m_sprFrame );
|
||||
|
||||
this->AddSubActor( &m_frame );
|
||||
|
||||
ResetBarVelocity();
|
||||
}
|
||||
|
||||
void LifeMeterBar::Load( PlayerNumber p, const PlayerOptions &po )
|
||||
{
|
||||
LifeMeter::Load( p, po );
|
||||
|
||||
if( p == PLAYER_2 )
|
||||
m_frame.SetZoomX( -1 );
|
||||
}
|
||||
|
||||
void LifeMeterBar::ChangeLife( TapNoteScore score )
|
||||
{
|
||||
bool bWasHot = IsHot();
|
||||
|
||||
float fDeltaLife;
|
||||
switch( score )
|
||||
switch( m_PlayerOptions.m_DrainType )
|
||||
{
|
||||
case TNS_PERFECT: fDeltaLife = +0.008f; break;
|
||||
case TNS_GREAT: fDeltaLife = +0.004f; break;
|
||||
case TNS_GOOD: fDeltaLife = +0.000f; break;
|
||||
case TNS_BOO: fDeltaLife = -0.040f; break;
|
||||
case TNS_MISS: fDeltaLife = -0.080f; break;
|
||||
case PlayerOptions::DRAIN_NORMAL:
|
||||
switch( score )
|
||||
{
|
||||
case TNS_PERFECT: fDeltaLife = +0.008f; break;
|
||||
case TNS_GREAT: fDeltaLife = +0.004f; break;
|
||||
case TNS_GOOD: fDeltaLife = +0.000f; break;
|
||||
case TNS_BOO: fDeltaLife = -0.040f; break;
|
||||
case TNS_MISS: fDeltaLife = -0.080f; break;
|
||||
}
|
||||
if( IsHot() && score < TNS_GOOD )
|
||||
fDeltaLife = -0.10f; // make it take a while to get back to "doing great"
|
||||
break;
|
||||
case PlayerOptions::DRAIN_NO_RECOVER:
|
||||
switch( score )
|
||||
{
|
||||
case TNS_PERFECT: fDeltaLife = +0.000f; break;
|
||||
case TNS_GREAT: fDeltaLife = +0.000f; break;
|
||||
case TNS_GOOD: fDeltaLife = +0.000f; break;
|
||||
case TNS_BOO: fDeltaLife = -0.040f; break;
|
||||
case TNS_MISS: fDeltaLife = -0.080f; break;
|
||||
}
|
||||
break;
|
||||
case PlayerOptions::DRAIN_SUDDEN_DEATH:
|
||||
fDeltaLife = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if( IsHot() && score < TNS_GOOD )
|
||||
fDeltaLife = -0.10f; // make it take a while to get back to "doing great"
|
||||
|
||||
m_fLifePercentage += fDeltaLife;
|
||||
m_fLifePercentage = min( m_fLifePercentage, 1 );
|
||||
CLAMP( m_fLifePercentage, 0, 1 );
|
||||
|
||||
if( m_fLifePercentage < FAIL_THRESHOLD )
|
||||
m_bHasFailed = true;
|
||||
m_bFailedEarlier = true;
|
||||
|
||||
ResetBarVelocity();
|
||||
}
|
||||
@@ -75,13 +124,20 @@ bool LifeMeterBar::IsInDanger()
|
||||
return m_fLifePercentage < DANGER_THRESHOLD;
|
||||
}
|
||||
|
||||
bool LifeMeterBar::HasFailed()
|
||||
bool LifeMeterBar::IsFailing()
|
||||
{
|
||||
return m_bHasFailed;
|
||||
return m_fLifePercentage <= 0;
|
||||
}
|
||||
|
||||
bool LifeMeterBar::FailedEarlier()
|
||||
{
|
||||
return m_bFailedEarlier;
|
||||
}
|
||||
|
||||
void LifeMeterBar::Update( float fDeltaTime )
|
||||
{
|
||||
ActorFrame::Update( fDeltaTime );
|
||||
|
||||
float fDelta = m_fLifePercentage - m_fTrailingLifePercentage;
|
||||
m_fLifeVelocity += fDelta * fDeltaTime; // accelerate
|
||||
m_fLifeVelocity *= 1-fDeltaTime; // dampen
|
||||
@@ -91,9 +147,50 @@ void LifeMeterBar::Update( float fDeltaTime )
|
||||
|
||||
if( fDelta * fNewDelta < 0 ) // the deltas have different signs
|
||||
m_fLifeVelocity /= 4; // make some drag
|
||||
m_fTrailingLifePercentage = clamp( m_fTrailingLifePercentage, 0, 1 );
|
||||
CLAMP( m_fTrailingLifePercentage, 0, 1 );
|
||||
|
||||
|
||||
// set custom texture coords
|
||||
CRect rectSize(
|
||||
-METER_WIDTH/2,
|
||||
-METER_HEIGHT/2,
|
||||
-METER_WIDTH/2 + METER_WIDTH * m_fTrailingLifePercentage,
|
||||
-METER_HEIGHT/2 + METER_HEIGHT );
|
||||
|
||||
float fPrecentOffset = TIMER->GetTimeSinceStart();
|
||||
fPrecentOffset -= (int)fPrecentOffset;
|
||||
|
||||
FRECT frectCustomTexCoords(
|
||||
0 - fPrecentOffset,
|
||||
0,
|
||||
m_fTrailingLifePercentage - fPrecentOffset,
|
||||
1 );
|
||||
|
||||
m_sprStreamNormal.StretchTo( rectSize );
|
||||
m_sprStreamNormal.SetCustomTextureRect( frectCustomTexCoords );
|
||||
m_sprStreamHot.StretchTo( rectSize );
|
||||
m_sprStreamHot.SetCustomTextureRect( frectCustomTexCoords );
|
||||
|
||||
m_fHotAlpha += IsHot() ? +fDeltaTime*2 : -fDeltaTime*2;
|
||||
CLAMP( m_fHotAlpha, 0, 1 );
|
||||
m_sprStreamHot.SetDiffuseColor( D3DXCOLOR(1,1,1,m_fHotAlpha) );
|
||||
}
|
||||
|
||||
void LifeMeterBar::DrawPrimitives()
|
||||
{
|
||||
float fPercentRed = IsInDanger() ? sinf( TIMER->GetTimeSinceStart()*D3DX_PI*4 )/2+0.5f : 0;
|
||||
m_quadBlackBackground.SetDiffuseColor( D3DXCOLOR(fPercentRed*0.8f,0,0,1) );
|
||||
|
||||
ActorFrame::DrawPrimitives();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Chris:
|
||||
I'm making the coloring of the lifemeter a property of the theme.
|
||||
That's where it belongs anyway...
|
||||
|
||||
|
||||
const D3DXCOLOR COLOR_EZ2NORMAL_1 = D3DXCOLOR(0.7f,0.4f,0,1);
|
||||
const D3DXCOLOR COLOR_EZ2NORMAL_2 = D3DXCOLOR(0.8f,0.4f,0,1);
|
||||
const D3DXCOLOR COLOR_EZ2NEARFULL_1 = D3DXCOLOR(0.7f,0.6f,0,1);
|
||||
@@ -107,11 +204,11 @@ const D3DXCOLOR COLOR_NORMAL_2 = D3DXCOLOR(0,1,0,1);
|
||||
const D3DXCOLOR COLOR_FULL_1 = D3DXCOLOR(1,0,0,1);
|
||||
const D3DXCOLOR COLOR_FULL_2 = D3DXCOLOR(1,1,0,1);
|
||||
|
||||
D3DXCOLOR LifeMeterBar::GetColor( float fPercentIntoSection )
|
||||
D3DXCOLOR LifeStream::GetColor( float fPercentIntoSection )
|
||||
{
|
||||
float fPercentColor1 = fabsf( fPercentIntoSection*2 - 1 );
|
||||
fPercentColor1 *= fPercentColor1 * fPercentColor1 * fPercentColor1; // make the color bunch around one side
|
||||
if (GAMEMAN->m_CurGame != GAME_EZ2)
|
||||
if (GAMESTATE->m_CurGame != GAME_EZ2)
|
||||
{
|
||||
if( m_fLifePercentage == 1 )
|
||||
return COLOR_FULL_1 * fPercentColor1 + COLOR_FULL_2 * (1-fPercentColor1);
|
||||
@@ -131,9 +228,8 @@ D3DXCOLOR LifeMeterBar::GetColor( float fPercentIntoSection )
|
||||
}
|
||||
}
|
||||
|
||||
void LifeMeterBar::DrawPrimitives()
|
||||
void LifeStream::DrawPrimitives()
|
||||
{
|
||||
|
||||
// make the object in logical units centered at the origin
|
||||
LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer();
|
||||
RAGEVERTEX* v;
|
||||
@@ -141,7 +237,7 @@ void LifeMeterBar::DrawPrimitives()
|
||||
|
||||
int iNumV = 0;
|
||||
|
||||
float fPercentIntoSection = (TIMER->GetTimeSinceStart()/0.3f* (IsHot() ? 2 : 1) )*SECTION_WIDTH;
|
||||
float fPercentIntoSection = (TIMER->GetTimeSinceStart()/0.3f* (m_bIsHot ? 2 : 1) )*LIFE_STREAM_SECTION_WIDTH;
|
||||
fPercentIntoSection -= (int)fPercentIntoSection;
|
||||
fPercentIntoSection = 1-fPercentIntoSection;
|
||||
fPercentIntoSection -= (int)fPercentIntoSection;
|
||||
@@ -167,13 +263,13 @@ void LifeMeterBar::DrawPrimitives()
|
||||
{
|
||||
const float fPercentToAdd = 0.5f-fPercentIntoSection;
|
||||
fPercentIntoSection += fPercentToAdd;
|
||||
fX += fPercentToAdd*SECTION_WIDTH;
|
||||
fX += fPercentToAdd*LIFE_STREAM_SECTION_WIDTH;
|
||||
}
|
||||
else if( fPercentIntoSection < 1.0f )
|
||||
{
|
||||
const float fPercentToAdd = 1.0f-fPercentIntoSection;
|
||||
fPercentIntoSection = 0;
|
||||
fX += fPercentToAdd*SECTION_WIDTH;
|
||||
fX += fPercentToAdd*LIFE_STREAM_SECTION_WIDTH;
|
||||
}
|
||||
else
|
||||
ASSERT( false );
|
||||
@@ -181,7 +277,7 @@ void LifeMeterBar::DrawPrimitives()
|
||||
|
||||
const float fXToSubtract = fX - (m_fTrailingLifePercentage-0.5f);
|
||||
fX -= fXToSubtract;
|
||||
fPercentIntoSection -= fXToSubtract/SECTION_WIDTH;
|
||||
fPercentIntoSection -= fXToSubtract/LIFE_STREAM_SECTION_WIDTH;
|
||||
if( fPercentIntoSection < 0 )
|
||||
fPercentIntoSection += 1;
|
||||
|
||||
@@ -196,20 +292,6 @@ void LifeMeterBar::DrawPrimitives()
|
||||
v[iNumV++].color = color;
|
||||
v[iNumV++].color = color;
|
||||
|
||||
//
|
||||
// draw black filler
|
||||
//
|
||||
v[iNumV++].p = D3DXVECTOR3( fX, -0.5f, 0 );
|
||||
v[iNumV++].p = D3DXVECTOR3( fX, 0.5f, 0 );
|
||||
v[iNumV++].p = D3DXVECTOR3( 0.5f, -0.5f, 0 );
|
||||
v[iNumV++].p = D3DXVECTOR3( 0.5f, 0.5f, 0 );
|
||||
|
||||
iNumV -= 4;
|
||||
const D3DXCOLOR colorBlack = D3DXCOLOR(0,0,0,1);
|
||||
v[iNumV++].color = colorBlack;
|
||||
v[iNumV++].color = colorBlack;
|
||||
v[iNumV++].color = colorBlack;
|
||||
v[iNumV++].color = colorBlack;
|
||||
|
||||
|
||||
pVB->Unlock();
|
||||
@@ -235,4 +317,5 @@ void LifeMeterBar::DrawPrimitives()
|
||||
pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) );
|
||||
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, iNumV-2 );
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -20,20 +20,32 @@ class LifeMeterBar : public LifeMeter
|
||||
public:
|
||||
LifeMeterBar();
|
||||
|
||||
virtual void Load( PlayerNumber p, const PlayerOptions &po );
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
virtual void DrawPrimitives();
|
||||
|
||||
virtual void ChangeLife( TapNoteScore score );
|
||||
virtual bool IsInDanger();
|
||||
virtual bool IsHot();
|
||||
virtual bool HasFailed();
|
||||
virtual bool IsFailing();
|
||||
virtual bool FailedEarlier();
|
||||
|
||||
private:
|
||||
D3DXCOLOR GetColor( float fPercentIntoSection );
|
||||
void ResetBarVelocity();
|
||||
|
||||
ActorFrame m_frame; // hold everything and mirror this for PLAYER_2 instead of mirroring all the individual Actors
|
||||
|
||||
Quad m_quadBlackBackground;
|
||||
Sprite m_sprStreamNormal;
|
||||
Sprite m_sprStreamHot;
|
||||
Sprite m_sprFrame;
|
||||
|
||||
PlayerOptions m_PlayerOptions;
|
||||
|
||||
float m_fLifePercentage;
|
||||
float m_fTrailingLifePercentage; // this approaches m_fLifePercentage
|
||||
float m_fLifeVelocity; // how m_fTrailingLifePercentage approaches m_fLifePercentage
|
||||
bool m_bHasFailed; // set this to true when life dips below 0
|
||||
float m_fHotAlpha;
|
||||
bool m_bFailedEarlier; // set this to true when life dips below 0
|
||||
};
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: LifeMeterBattery
|
||||
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "LifeMeterBattery.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
const float BATTERY_X[NUM_PLAYERS] = { -92, +92 };
|
||||
|
||||
const float NUM_X[NUM_PLAYERS] = { BATTERY_X[0], BATTERY_X[1] };
|
||||
const float NUM_Y = +2;
|
||||
|
||||
const float PERCENT_X[NUM_PLAYERS] = { +28, -28 };
|
||||
const float PERCENT_Y = 0;
|
||||
|
||||
const float BATTERY_BLINK_TIME = 1.2f;
|
||||
|
||||
|
||||
LifeMeterBattery::LifeMeterBattery()
|
||||
{
|
||||
m_iMaxLives = 3;
|
||||
m_iLivesLeft = m_iMaxLives;
|
||||
m_bFailedEarlier = false;
|
||||
|
||||
m_fBatteryBlinkTime = 0;
|
||||
|
||||
m_sprFrame.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_LIFEMETER_ONI) );
|
||||
this->AddSubActor( &m_sprFrame );
|
||||
|
||||
m_sprBattery.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_LIFEMETER_BATTERY) );
|
||||
m_sprBattery.StopAnimating();
|
||||
this->AddSubActor( &m_sprBattery );
|
||||
|
||||
m_textNumLives.Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textNumLives.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); // pink
|
||||
m_textNumLives.SetZoom( 1.1f );
|
||||
m_textNumLives.TurnShadowOff();
|
||||
this->AddSubActor( &m_textNumLives );
|
||||
|
||||
m_textPercent.Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) );
|
||||
m_textPercent.TurnShadowOff();
|
||||
m_textPercent.SetZoom( 0.7f );
|
||||
m_textPercent.SetText( "0.00" );
|
||||
this->AddSubActor( &m_textPercent );
|
||||
|
||||
m_soundGainLife.Load( THEME->GetPathTo(SOUND_GAMEPLAY_ONI_GAIN_LIFE) );
|
||||
m_soundLoseLife.Load( THEME->GetPathTo(SOUND_GAMEPLAY_ONI_LOSE_LIFE) );
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void LifeMeterBattery::Load( PlayerNumber p, const PlayerOptions &po )
|
||||
{
|
||||
LifeMeter::Load( p, po );
|
||||
|
||||
m_sprFrame.SetZoomX( p==PLAYER_1 ? 1.0f : -1.0f );
|
||||
m_sprBattery.SetZoomX( p==PLAYER_1 ? 1.0f : -1.0f );
|
||||
m_sprBattery.SetX( BATTERY_X[p] );
|
||||
m_textNumLives.SetX( NUM_X[p] );
|
||||
m_textNumLives.SetY( NUM_Y );
|
||||
m_textPercent.SetX( PERCENT_X[p] );
|
||||
m_textPercent.SetY( PERCENT_Y );
|
||||
|
||||
m_textPercent.SetDiffuseColor( PlayerToColor(p) ); // light blue
|
||||
|
||||
}
|
||||
|
||||
void LifeMeterBattery::NextSong( Song* pSong )
|
||||
{
|
||||
if( m_bFailedEarlier )
|
||||
return;
|
||||
|
||||
m_iLivesLeft++;
|
||||
m_soundGainLife.Play();
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void LifeMeterBattery::ChangeLife( TapNoteScore score )
|
||||
{
|
||||
if( m_bFailedEarlier )
|
||||
return;
|
||||
|
||||
if( GAMESTATE->m_aGameplayStatistics.GetSize() > 0 )
|
||||
{
|
||||
int iActualDancePoints = 0;
|
||||
for( int i=0; i<GAMESTATE->m_aGameplayStatistics.GetSize(); i++ )
|
||||
iActualDancePoints += GAMESTATE->m_aGameplayStatistics[i].iActualDancePoints[m_PlayerNumber];
|
||||
int iPossibleDancePoints = GAMESTATE->m_iCoursePossibleDancePoints;
|
||||
float fPercentDancePoints = iActualDancePoints / (float)iPossibleDancePoints + 0.0001f; // correct for rounding errors
|
||||
m_textPercent.SetText( ssprintf("%1.2f", fPercentDancePoints) );
|
||||
}
|
||||
|
||||
switch( score )
|
||||
{
|
||||
case TNS_PERFECT:
|
||||
case TNS_GREAT:
|
||||
break;
|
||||
case TNS_GOOD:
|
||||
case TNS_BOO:
|
||||
case TNS_MISS:
|
||||
m_iLivesLeft--;
|
||||
m_soundLoseLife.Play();
|
||||
Refresh();
|
||||
m_fBatteryBlinkTime = BATTERY_BLINK_TIME;
|
||||
break;
|
||||
}
|
||||
if( m_iLivesLeft == -1 )
|
||||
m_bFailedEarlier = true;
|
||||
}
|
||||
|
||||
bool LifeMeterBattery::IsInDanger()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LifeMeterBattery::IsHot()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LifeMeterBattery::IsFailing()
|
||||
{
|
||||
return m_bFailedEarlier;
|
||||
}
|
||||
|
||||
bool LifeMeterBattery::FailedEarlier()
|
||||
{
|
||||
return m_bFailedEarlier;
|
||||
}
|
||||
|
||||
void LifeMeterBattery::Refresh()
|
||||
{
|
||||
if( m_iLivesLeft <= 3 )
|
||||
{
|
||||
m_textNumLives.SetText( "" );
|
||||
m_sprBattery.SetState( max(m_iLivesLeft,0) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_textNumLives.SetText( ssprintf("x%d", m_iLivesLeft) );
|
||||
m_sprBattery.SetState( 3 );
|
||||
}
|
||||
}
|
||||
|
||||
void LifeMeterBattery::Update( float fDeltaTime )
|
||||
{
|
||||
if( m_iLivesLeft == -1 )
|
||||
{
|
||||
m_sprBattery.SetState( 0 );
|
||||
}
|
||||
else if( m_fBatteryBlinkTime > 0 )
|
||||
{
|
||||
m_fBatteryBlinkTime -= fDeltaTime;
|
||||
int iFrameNo = m_iLivesLeft + int(m_fBatteryBlinkTime*15)%2;
|
||||
CLAMP( iFrameNo, 0, 3 );
|
||||
m_sprBattery.SetState( iFrameNo );
|
||||
|
||||
|
||||
if( m_fBatteryBlinkTime < 0 )
|
||||
{
|
||||
m_fBatteryBlinkTime = 0;
|
||||
m_sprBattery.SetState( max(m_iLivesLeft,0) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: LifeMeterBattery
|
||||
|
||||
Desc: The battery life meter used in Oni.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "LifeMeter.h"
|
||||
#include "Sprite.h"
|
||||
#include "BitmapText.h"
|
||||
#include "RageSoundSample.h"
|
||||
|
||||
|
||||
class LifeMeterBattery : public LifeMeter
|
||||
{
|
||||
public:
|
||||
LifeMeterBattery();
|
||||
|
||||
virtual void Load( PlayerNumber p, const PlayerOptions &po );
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
|
||||
virtual void NextSong( Song* pSong );
|
||||
virtual void ChangeLife( TapNoteScore score );
|
||||
virtual bool IsInDanger();
|
||||
virtual bool IsHot();
|
||||
virtual bool IsFailing();
|
||||
virtual bool FailedEarlier();
|
||||
|
||||
void Refresh();
|
||||
|
||||
private:
|
||||
int m_iLivesLeft;
|
||||
int m_iMaxLives;
|
||||
bool m_bFailedEarlier;
|
||||
|
||||
float m_fBatteryBlinkTime; // if > 0 battery is blinking
|
||||
|
||||
Sprite m_sprFrame;
|
||||
Sprite m_sprBattery;
|
||||
BitmapText m_textNumLives;
|
||||
BitmapText m_textPercent;
|
||||
|
||||
RageSoundSample m_soundLoseLife;
|
||||
RageSoundSample m_soundGainLife;
|
||||
};
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
#include "ScreenManager.h"
|
||||
#include "ScreenGameplay.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
const float HELP_X = CENTER_X;
|
||||
@@ -38,28 +39,28 @@ const float CREDIT_Y[NUM_PLAYERS] = {SCREEN_BOTTOM-8, SCREEN_BOTTOM-8};
|
||||
|
||||
MenuElements::MenuElements()
|
||||
{
|
||||
m_frameTopBar.AddActor( &m_sprTopEdge );
|
||||
m_frameTopBar.AddActor( &m_sprStyleIcon );
|
||||
m_frameTopBar.AddActor( &m_MenuTimer );
|
||||
m_frameTopBar.AddSubActor( &m_sprTopEdge );
|
||||
m_frameTopBar.AddSubActor( &m_sprStyleIcon );
|
||||
m_frameTopBar.AddSubActor( &m_MenuTimer );
|
||||
|
||||
m_frameBottomBar.AddActor( &m_sprBottomEdge );
|
||||
m_frameBottomBar.AddSubActor( &m_sprBottomEdge );
|
||||
|
||||
this->AddActor( &m_sprBG );
|
||||
this->AddActor( &m_frameTopBar );
|
||||
this->AddActor( &m_frameBottomBar );
|
||||
this->AddActor( &m_textHelp );
|
||||
this->AddSubActor( &m_sprBG );
|
||||
this->AddSubActor( &m_frameTopBar );
|
||||
this->AddSubActor( &m_frameBottomBar );
|
||||
this->AddSubActor( &m_textHelp );
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
this->AddActor( &m_textCreditInfo[p] );
|
||||
this->AddSubActor( &m_textCreditInfo[p] );
|
||||
|
||||
m_KeepAlive.SetZ( -2 );
|
||||
m_KeepAlive.SetOpened();
|
||||
this->AddActor( &m_KeepAlive );
|
||||
this->AddSubActor( &m_KeepAlive );
|
||||
|
||||
m_Wipe.SetZ( -2 );
|
||||
m_Wipe.SetOpened();
|
||||
this->AddActor( &m_Wipe );
|
||||
this->AddSubActor( &m_Wipe );
|
||||
|
||||
this->AddActor( &m_Invisible );
|
||||
this->AddSubActor( &m_Invisible );
|
||||
}
|
||||
|
||||
void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString sHelpText, bool bShowStyleIcon, bool bTimerEnabled, int iTimerSeconds )
|
||||
@@ -80,10 +81,10 @@ void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString
|
||||
m_sprStyleIcon.StopAnimating();
|
||||
m_sprStyleIcon.SetXY( STYLE_ICON_LOCAL_X, STYLE_ICON_LOCAL_Y );
|
||||
m_sprStyleIcon.SetZ( -1 );
|
||||
if( GAMEMAN->m_CurStyle == STYLE_NONE || !bShowStyleIcon )
|
||||
if( GAMESTATE->m_CurStyle == STYLE_NONE || !bShowStyleIcon )
|
||||
m_sprStyleIcon.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
else
|
||||
m_sprStyleIcon.SetState( GAMEMAN->m_CurStyle );
|
||||
m_sprStyleIcon.SetState( GAMESTATE->m_CurStyle );
|
||||
|
||||
m_MenuTimer.SetXY( TIMER_LOCAL_X, TIMER_LOCAL_Y );
|
||||
m_MenuTimer.SetZ( -1 );
|
||||
@@ -100,13 +101,13 @@ void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString
|
||||
m_sprBottomEdge.Load( THEME->GetPathTo(GRAPHIC_MENU_BOTTOM_EDGE) );
|
||||
m_sprBottomEdge.TurnShadowOff();
|
||||
|
||||
m_textHelp.Load( THEME->GetPathTo(FONT_NORMAL) );
|
||||
m_textHelp.SetXY( HELP_X, HELP_Y );
|
||||
m_textHelp.SetZ( -1 );
|
||||
m_textHelp.SetText( sHelpText );
|
||||
// m_textHelp.SetZ( -1 );
|
||||
CStringArray asHelpTips;
|
||||
split( sHelpText, "\n", asHelpTips );
|
||||
m_textHelp.SetTips( asHelpTips );
|
||||
//m_textHelp.SetText( sHelpText );
|
||||
m_textHelp.SetZoom( 0.5f );
|
||||
m_textHelp.SetEffectBlinking();
|
||||
m_textHelp.TurnShadowOff();
|
||||
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
@@ -114,9 +115,9 @@ void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString
|
||||
m_textCreditInfo[p].SetXY( CREDIT_X[p], CREDIT_Y[p] );
|
||||
m_textCreditInfo[p].SetZ( -1 );
|
||||
|
||||
if( GAMEMAN->m_CurStyle == STYLE_NONE )
|
||||
if( GAMESTATE->m_CurStyle == STYLE_NONE )
|
||||
m_textCreditInfo[p].SetText( "PRESS START" );
|
||||
else if( GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
else if( GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
m_textCreditInfo[p].SetText( "" );
|
||||
else // not enabled
|
||||
m_textCreditInfo[p].SetText( "NOT PRESENT" );
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "TransitionFadeWipe.h"
|
||||
#include "TransitionKeepAlive.h"
|
||||
#include "TransitionInvisible.h"
|
||||
#include "TipDisplay.h"
|
||||
|
||||
|
||||
const float MENU_ELEMENTS_TWEEN_TIME = 0.30f;
|
||||
@@ -69,7 +70,7 @@ protected:
|
||||
|
||||
// stuff in the main frame
|
||||
Sprite m_sprBG;
|
||||
BitmapText m_textHelp;
|
||||
TipDisplay m_textHelp;
|
||||
BitmapText m_textCreditInfo[NUM_PLAYERS];
|
||||
|
||||
TransitionFadeWipe m_Wipe;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "MenuTimer.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "AnnouncerManager.h"
|
||||
|
||||
@@ -28,12 +28,12 @@ MenuTimer::MenuTimer()
|
||||
m_textDigit1.Load( THEME->GetPathTo(FONT_TIMER_NUMBERS) );
|
||||
m_textDigit1.TurnShadowOff();
|
||||
m_textDigit1.SetXY( -18, 0 );
|
||||
this->AddActor( &m_textDigit1 );
|
||||
this->AddSubActor( &m_textDigit1 );
|
||||
|
||||
m_textDigit2.Load( THEME->GetPathTo(FONT_TIMER_NUMBERS) );
|
||||
m_textDigit2.TurnShadowOff();
|
||||
m_textDigit2.SetXY( +18, 0 );
|
||||
this->AddActor( &m_textDigit2 );
|
||||
this->AddSubActor( &m_textDigit2 );
|
||||
|
||||
m_soundBeep.Load( THEME->GetPathTo(SOUND_MENU_TIMER) );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: MsdFile
|
||||
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "MsdFile.h"
|
||||
|
||||
|
||||
MsdFile::MsdFile()
|
||||
{
|
||||
m_szFileString = NULL;
|
||||
int m_iNumValues = 0;
|
||||
}
|
||||
|
||||
MsdFile::~MsdFile()
|
||||
{
|
||||
if( m_szFileString )
|
||||
delete m_szFileString;
|
||||
}
|
||||
|
||||
//returns true if successful, false otherwise
|
||||
bool MsdFile::ReadFile( CString sNewPath )
|
||||
{
|
||||
if( m_szFileString )
|
||||
delete m_szFileString;
|
||||
|
||||
// Get file size in bytes
|
||||
HANDLE hFile = CreateFile(
|
||||
sNewPath, // pointer to name of the file
|
||||
GENERIC_READ, // access (read-write) mode
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE, // share mode
|
||||
NULL, // pointer to security attributes
|
||||
OPEN_EXISTING, // how to create
|
||||
FILE_ATTRIBUTE_NORMAL, // file attributes
|
||||
NULL // handle to file with attributes to
|
||||
);
|
||||
|
||||
int iBufferSize = GetFileSize( hFile, NULL ) + 1;
|
||||
CloseHandle( hFile );
|
||||
|
||||
// allocate a string to hold the file
|
||||
m_szFileString = new char[iBufferSize];
|
||||
|
||||
FILE* fp = fopen(sNewPath, "r");
|
||||
if( fp == NULL )
|
||||
return false;
|
||||
|
||||
int iBytesRead = fread( m_szFileString, 1, iBufferSize, fp );
|
||||
|
||||
ASSERT( iBufferSize > iBytesRead );
|
||||
|
||||
m_iNumValues = 0;
|
||||
|
||||
for( int i=0; i<iBytesRead; i++ )
|
||||
{
|
||||
switch( m_szFileString[i] )
|
||||
{
|
||||
case '#': // begins a new value
|
||||
{
|
||||
m_iNumValues++;
|
||||
int iCurValueIndex = m_iNumValues-1;
|
||||
m_iNumParams[iCurValueIndex] = 1;
|
||||
m_szValuesAndParams[iCurValueIndex][0] = &m_szFileString[i+1];
|
||||
}
|
||||
break;
|
||||
case ':': // begins a new parameter
|
||||
{
|
||||
m_szFileString[i] = '\0';
|
||||
int iCurValueIndex = m_iNumValues-1;
|
||||
m_iNumParams[iCurValueIndex] ++;
|
||||
int iCurParamIndex = m_iNumParams[iCurValueIndex]-1;
|
||||
m_szValuesAndParams[iCurValueIndex][iCurParamIndex] = &m_szFileString[i+1];
|
||||
}
|
||||
break;
|
||||
case ';': // ends a value
|
||||
{
|
||||
m_szFileString[i] = '\0';
|
||||
// fast forward until just before the next '#'
|
||||
while( m_szFileString[i+1] != '#' && i<iBytesRead )
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
case '/':
|
||||
if( m_szFileString[i+1] == '/' )
|
||||
{
|
||||
// advance until new line
|
||||
for( ; i<iBytesRead; i++ )
|
||||
{
|
||||
if( m_szFileString[i] == '\n' )
|
||||
break;
|
||||
else
|
||||
m_szFileString[i] = ' ';
|
||||
}
|
||||
}
|
||||
// fall through. If we didn't take the if above, then this '/' is part of a parameter!
|
||||
default:
|
||||
; // do nothing
|
||||
}
|
||||
}
|
||||
|
||||
m_szFileString[i] = '\0';
|
||||
|
||||
int iCurValueIndex = m_iNumValues-1;
|
||||
int iCurParamIndex = m_iNumParams[iCurValueIndex]-1;
|
||||
|
||||
for( i=0; i<m_iNumValues; i++ )
|
||||
{
|
||||
for( int j=0; j<m_iNumParams[i]; j++ )
|
||||
{
|
||||
m_sValuesAndParams[i][j] = m_szValuesAndParams[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
fclose( fp );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: MsdFile
|
||||
|
||||
Desc: Wrapper for reading and writing an .sm, .dwi, .or msd file.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
const int MAX_VALUES = 50;
|
||||
const int MAX_PARAMS_PER_VALUE = 10;
|
||||
|
||||
class MsdFile
|
||||
{
|
||||
public:
|
||||
MsdFile();
|
||||
|
||||
//default destructor
|
||||
virtual ~MsdFile();
|
||||
|
||||
//reads ini file specified using MsdFile::SetPath()
|
||||
//returns true if successful, false otherwise
|
||||
bool ReadFile( CString sFilePath );
|
||||
|
||||
char* m_szFileString;
|
||||
|
||||
char* m_szValuesAndParams[MAX_VALUES][MAX_PARAMS_PER_VALUE];
|
||||
CString m_sValuesAndParams[MAX_VALUES][MAX_PARAMS_PER_VALUE];
|
||||
|
||||
int m_iNumValues; // tells how many values are valid
|
||||
int m_iNumParams[MAX_VALUES]; // tells how many params this value has
|
||||
};
|
||||
@@ -16,7 +16,7 @@ class MusicStatusDisplay;
|
||||
|
||||
|
||||
#include "Sprite.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
|
||||
enum MusicStatusDisplayType { TYPE_NEW, TYPE_NONE, TYPE_CROWN1, TYPE_CROWN2, TYPE_CROWN3 };
|
||||
|
||||
@@ -14,11 +14,12 @@
|
||||
#include "RageUtil.h"
|
||||
#include "SongManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageMusic.h"
|
||||
#include "ScreenManager.h" // for sending SM_PlayMusicSample
|
||||
#include "RageLog.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
const float FADE_TIME = 1.0f;
|
||||
@@ -200,7 +201,7 @@ void WheelItemDisplay::RefreshGrades()
|
||||
// Refresh Grades
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
{
|
||||
m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
continue;
|
||||
@@ -208,8 +209,8 @@ void WheelItemDisplay::RefreshGrades()
|
||||
|
||||
if( m_pSong ) // this is a song display
|
||||
{
|
||||
const DifficultyClass dc = PREFSMAN->m_PreferredDifficultyClass[p];
|
||||
const Grade grade = m_pSong->GetGradeForDifficultyClass( GAMEMAN->GetCurrentStyleDef()->m_NotesType, dc );
|
||||
const DifficultyClass dc = GAMESTATE->m_PreferredDifficultyClass[p];
|
||||
const Grade grade = m_pSong->GetGradeForDifficultyClass( GAMESTATE->GetCurrentStyleDef()->m_NotesType, dc );
|
||||
m_GradeDisplay[p].SetGrade( grade );
|
||||
m_GradeDisplay[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) );
|
||||
}
|
||||
@@ -301,25 +302,25 @@ MusicWheel::MusicWheel()
|
||||
|
||||
|
||||
// for debugging
|
||||
if( GAMEMAN->m_CurStyle == STYLE_NONE )
|
||||
GAMEMAN->m_CurStyle = STYLE_DANCE_SINGLE;
|
||||
if( GAMESTATE->m_CurStyle == STYLE_NONE )
|
||||
GAMESTATE->m_CurStyle = STYLE_DANCE_SINGLE;
|
||||
|
||||
|
||||
m_frameOverlay.SetXY( 0, 0 );
|
||||
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled((PlayerNumber)p) )
|
||||
if( !GAMESTATE->IsPlayerEnabled((PlayerNumber)p) )
|
||||
continue; // skip
|
||||
|
||||
m_sprHighScoreFrame[p].Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SCORE_FRAME) );
|
||||
m_sprHighScoreFrame[p].SetXY( SCORE_X, SCORE_Y[p] );
|
||||
m_frameOverlay.AddActor( &m_sprHighScoreFrame[p] );
|
||||
m_frameOverlay.AddSubActor( &m_sprHighScoreFrame[p] );
|
||||
|
||||
m_HighScore[p].SetXY( SCORE_X, SCORE_Y[p]*0.97f );
|
||||
m_HighScore[p].SetZoom( 0.6f );
|
||||
m_HighScore[p].SetDiffuseColor( PlayerToColor(p) );
|
||||
m_frameOverlay.AddActor( &m_HighScore[p] );
|
||||
m_frameOverlay.AddSubActor( &m_HighScore[p] );
|
||||
}
|
||||
|
||||
m_sprHighScoreFrame[1].SetZoomY( -1 ); // flip vertically
|
||||
@@ -329,17 +330,17 @@ MusicWheel::MusicWheel()
|
||||
m_sprSelectionOverlay.SetXY( 0, 0 );
|
||||
m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||
m_sprSelectionOverlay.SetEffectGlowing( 1.0f, D3DXCOLOR(1,1,1,0.4f), D3DXCOLOR(1,1,1,1) );
|
||||
m_frameOverlay.AddActor( &m_sprSelectionOverlay );
|
||||
m_frameOverlay.AddSubActor( &m_sprSelectionOverlay );
|
||||
|
||||
m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y );
|
||||
m_MusicSortDisplay.SetEffectGlowing( 1.0f );
|
||||
m_frameOverlay.AddActor( &m_MusicSortDisplay );
|
||||
m_frameOverlay.AddSubActor( &m_MusicSortDisplay );
|
||||
|
||||
this->AddActor( &m_frameOverlay );
|
||||
this->AddSubActor( &m_frameOverlay );
|
||||
|
||||
|
||||
m_ScrollBar.SetX( SCROLLBAR_X );
|
||||
this->AddActor( &m_ScrollBar );
|
||||
this->AddSubActor( &m_ScrollBar );
|
||||
|
||||
|
||||
m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_CHANGE_MUSIC), 16 );
|
||||
@@ -359,7 +360,7 @@ MusicWheel::MusicWheel()
|
||||
|
||||
|
||||
|
||||
m_SortOrder = PREFSMAN->m_SongSortOrder;
|
||||
m_SortOrder = GAMESTATE->m_SongSortOrder;
|
||||
m_MusicSortDisplay.Set( m_SortOrder );
|
||||
m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y );
|
||||
|
||||
@@ -380,23 +381,23 @@ MusicWheel::MusicWheel()
|
||||
BuildWheelItemDatas( m_WheelItemDatas[so], SongSortOrder(so) );
|
||||
|
||||
// select a song if none are selected
|
||||
if( SONGMAN->m_pCurSong == NULL && // if there is no currently selected song
|
||||
if( GAMESTATE->m_pCurSong == NULL && // if there is no currently selected song
|
||||
SONGMAN->m_pSongs.GetSize() > 0 ) // and there is at least one song
|
||||
{
|
||||
CArray<Song*, Song*> arraySongs;
|
||||
SONGMAN->GetSongsInGroup( SONGMAN->m_sPreferredGroup, arraySongs );
|
||||
SONGMAN->GetSongsInGroup( GAMESTATE->m_sPreferredGroup, arraySongs );
|
||||
|
||||
if( arraySongs.GetSize() > 0 )
|
||||
SONGMAN->SetCurrentSong( arraySongs[0] ); // select the first song
|
||||
GAMESTATE->m_pCurSong = arraySongs[0]; // select the first song
|
||||
}
|
||||
|
||||
|
||||
if( SONGMAN->m_pCurSong != NULL )
|
||||
if( GAMESTATE->m_pCurSong != NULL )
|
||||
{
|
||||
// find the previously selected song (if any)
|
||||
for( int i=0; i<GetCurWheelItemDatas().GetSize(); i++ )
|
||||
{
|
||||
if( GetCurWheelItemDatas()[i].m_pSong == SONGMAN->GetCurrentSong() )
|
||||
if( GetCurWheelItemDatas()[i].m_pSong == GAMESTATE->m_pCurSong )
|
||||
{
|
||||
m_iSelection = i; // select it
|
||||
m_sExpandedSectionName = GetCurWheelItemDatas()[m_iSelection].m_sSectionName; // make its group the currently expanded group
|
||||
@@ -412,14 +413,14 @@ MusicWheel::MusicWheel()
|
||||
|
||||
MusicWheel::~MusicWheel()
|
||||
{
|
||||
PREFSMAN->m_SongSortOrder = m_SortOrder;
|
||||
GAMESTATE->m_SongSortOrder = m_SortOrder;
|
||||
}
|
||||
|
||||
void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arrayWheelItemDatas, SongSortOrder so, bool bRoulette )
|
||||
{
|
||||
int i;
|
||||
|
||||
switch( PREFSMAN->m_PlayMode )
|
||||
switch( GAMESTATE->m_PlayMode )
|
||||
{
|
||||
case PLAY_MODE_ARCADE:
|
||||
{
|
||||
@@ -434,7 +435,7 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
|
||||
Song* pSong = SONGMAN->m_pSongs[i];
|
||||
|
||||
CArray<Notes*, Notes*> arraySteps;
|
||||
pSong->GetNotesThatMatch( GAMEMAN->GetCurrentStyleDef()->m_NotesType, arraySteps );
|
||||
pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, arraySteps );
|
||||
|
||||
if( arraySteps.GetSize() > 0 )
|
||||
arraySongs.Add( pSong );
|
||||
@@ -477,7 +478,7 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
|
||||
{
|
||||
case SORT_MOST_PLAYED: bUseSections = false; break;
|
||||
case SORT_BPM: bUseSections = false; break;
|
||||
case SORT_GROUP: bUseSections = SONGMAN->m_sPreferredGroup != "ALL MUSIC"; break;
|
||||
case SORT_GROUP: bUseSections = GAMESTATE->m_sPreferredGroup != "ALL MUSIC"; break;
|
||||
case SORT_TITLE: bUseSections = true; break;
|
||||
default: ASSERT( false );
|
||||
}
|
||||
@@ -568,7 +569,7 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
|
||||
arrayWheelItemDatas.SetSize( 1 );
|
||||
arrayWheelItemDatas[0].Load( TYPE_SECTION, NULL, "NO SONGS", NULL, D3DXCOLOR(1,0,0,1) );
|
||||
}
|
||||
else if( PREFSMAN->m_PlayMode == PLAY_MODE_ARCADE && !bRoulette )
|
||||
else if( GAMESTATE->m_PlayMode == PLAY_MODE_ARCADE && !bRoulette )
|
||||
{
|
||||
arrayWheelItemDatas.SetSize( arrayWheelItemDatas.GetSize()+1 );
|
||||
arrayWheelItemDatas[arrayWheelItemDatas.GetSize()-1].Load( TYPE_ROULETTE, NULL, "", NULL, D3DXCOLOR(1,0,0,1) );
|
||||
@@ -667,9 +668,9 @@ void MusicWheel::RebuildWheelItemDisplays()
|
||||
|
||||
void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and top score
|
||||
{
|
||||
DifficultyClass dc = PREFSMAN->m_PreferredDifficultyClass[pn];
|
||||
Song* pSong = SONGMAN->GetCurrentSong();
|
||||
Notes* m_pNotes = SONGMAN->GetCurrentNotes( pn );
|
||||
DifficultyClass dc = GAMESTATE->m_PreferredDifficultyClass[pn];
|
||||
Song* pSong = GAMESTATE->m_pCurSong;
|
||||
Notes* m_pNotes = GAMESTATE->m_pCurNotes[ pn ];
|
||||
|
||||
if( m_pNotes )
|
||||
m_HighScore[pn].SetScore( (float)m_pNotes->m_iTopScore );
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "MusicSortDisplay.h"
|
||||
#include "MusicStatusDisplay.h"
|
||||
#include "Screen.h" // for ScreenMessage
|
||||
#include "ScoreDisplayRolling.h"
|
||||
#include "ScoreDisplayNormal.h"
|
||||
#include "ScrollBar.h"
|
||||
#include "Course.h"
|
||||
|
||||
@@ -137,7 +137,7 @@ protected:
|
||||
// Actors inside of m_frameOverlay
|
||||
Sprite m_sprSelectionOverlay;
|
||||
Sprite m_sprHighScoreFrame[NUM_PLAYERS];
|
||||
ScoreDisplayRolling m_HighScore[NUM_PLAYERS];
|
||||
ScoreDisplayNormal m_HighScore[NUM_PLAYERS];
|
||||
|
||||
|
||||
CArray<WheelItemData, WheelItemData&> m_WheelItemDatas[NUM_SORT_ORDERS];
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "NoteData.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ArrowEffects.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
#include "NoteField.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ArrowEffects.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "SongManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
const float HOLD_NOTE_BITS_PER_BEAT = 6;
|
||||
const float HOLD_NOTE_BITS_PER_ROW = HOLD_NOTE_BITS_PER_BEAT / ELEMENTS_PER_BEAT;
|
||||
@@ -54,10 +54,10 @@ void NoteField::Load( NoteData* pNoteData, PlayerNumber p, StyleDef* pStyleDef,
|
||||
for( int c=0; c<m_iNumTracks; c++ )
|
||||
{
|
||||
CArray<D3DXCOLOR,D3DXCOLOR> arrayTweenColors;
|
||||
GAMEMAN->GetTweenColors( p, c, arrayTweenColors );
|
||||
GAMEMAN->GetTweenColors( c, arrayTweenColors );
|
||||
|
||||
m_ColorNote[c].m_sprColorPart.Load( GAMEMAN->GetPathToGraphic( p, c, GRAPHIC_NOTE_COLOR_PART) );
|
||||
m_ColorNote[c].m_sprGrayPart.Load( GAMEMAN->GetPathToGraphic( p, c, GRAPHIC_NOTE_GRAY_PART) );
|
||||
m_ColorNote[c].m_sprColorPart.Load( GAMEMAN->GetPathTo(c, GRAPHIC_NOTE_COLOR_PART) );
|
||||
m_ColorNote[c].m_sprGrayPart.Load( GAMEMAN->GetPathTo(c, GRAPHIC_NOTE_GRAY_PART) );
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ void NoteField::Load( NoteData* pNoteData, PlayerNumber p, StyleDef* pStyleDef,
|
||||
m_HoldNoteLife[i] = 1; // start with full life
|
||||
|
||||
|
||||
ASSERT( m_iNumTracks == GAMEMAN->GetCurrentStyleDef()->m_iColsPerPlayer );
|
||||
ASSERT( m_iNumTracks == GAMESTATE->GetCurrentStyleDef()->m_iColsPerPlayer );
|
||||
}
|
||||
|
||||
void NoteField::Update( float fDeltaTime, float fSongBeat )
|
||||
@@ -214,7 +214,7 @@ void NoteField::DrawPrimitives()
|
||||
//
|
||||
// BPM text
|
||||
//
|
||||
CArray<BPMSegment,BPMSegment&> &aBPMSegments = SONGMAN->GetCurrentSong()->m_BPMSegments;
|
||||
CArray<BPMSegment,BPMSegment&> &aBPMSegments = GAMESTATE->m_pCurSong->m_BPMSegments;
|
||||
for( i=0; i<aBPMSegments.GetSize(); i++ )
|
||||
{
|
||||
DrawBPMText( BeatToNoteRow(aBPMSegments[i].m_fStartBeat), aBPMSegments[i].m_fBPM );
|
||||
@@ -223,7 +223,7 @@ void NoteField::DrawPrimitives()
|
||||
//
|
||||
// Freeze text
|
||||
//
|
||||
CArray<StopSegment,StopSegment&> &aStopSegments = SONGMAN->GetCurrentSong()->m_StopSegments;
|
||||
CArray<StopSegment,StopSegment&> &aStopSegments = GAMESTATE->m_pCurSong->m_StopSegments;
|
||||
for( i=0; i<aStopSegments.GetSize(); i++ )
|
||||
{
|
||||
DrawFreezeText( BeatToNoteRow(aStopSegments[i].m_fStartBeat), aStopSegments[i].m_fStopSeconds );
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "ActorFrame.h"
|
||||
#include "Song.h"
|
||||
#include "BitmapText.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "StyleDef.h"
|
||||
#include "ColorNote.h"
|
||||
#include "BitmapText.h"
|
||||
|
||||
+19
-9
@@ -412,7 +412,6 @@ bool Notes::LoadFromDWITokens(
|
||||
|
||||
NoteData* pNoteData = new NoteData;
|
||||
ASSERT( pNoteData );
|
||||
printf( "sizeof NoteData = %d\n", sizeof(NoteData) );
|
||||
pNoteData->m_iNumTracks = mapDanceNoteToNoteDataColumn.GetCount();
|
||||
|
||||
for( int pad=0; pad<2; pad++ ) // foreach pad
|
||||
@@ -528,15 +527,23 @@ bool Notes::LoadFromDWITokens(
|
||||
}
|
||||
|
||||
void Notes::LoadFromSMTokens(
|
||||
const CString &sNotesType,
|
||||
const CString &sDescription,
|
||||
const CString &sDifficultyClass,
|
||||
const CString &sMeter,
|
||||
const CString &sRadarValues,
|
||||
const CString &sNoteData
|
||||
CString sNotesType,
|
||||
CString sDescription,
|
||||
CString sDifficultyClass,
|
||||
CString sMeter,
|
||||
CString sRadarValues,
|
||||
CString sNoteData
|
||||
)
|
||||
{
|
||||
LOG->WriteLine( "Notes::LoadFromSMTokens()" );
|
||||
sNotesType.TrimLeft();
|
||||
sNotesType.TrimRight();
|
||||
sDescription.TrimLeft();
|
||||
sDescription.TrimRight();
|
||||
sDifficultyClass.TrimLeft();
|
||||
sDifficultyClass.TrimRight();
|
||||
|
||||
|
||||
// LOG->WriteLine( "Notes::LoadFromSMTokens()" );
|
||||
|
||||
m_NotesType = StringToNotesType(sNotesType);
|
||||
m_sDescription = sDescription;
|
||||
@@ -603,18 +610,21 @@ DifficultyClass Notes::DifficultyClassFromDescriptionAndMeter( CString sDescript
|
||||
{
|
||||
sDescription.MakeLower();
|
||||
|
||||
const CString sDescriptionParts[NUM_DIFFICULTY_CLASSES][3] = {
|
||||
const CString sDescriptionParts[NUM_DIFFICULTY_CLASSES][4] = {
|
||||
{
|
||||
"easy",
|
||||
"basic",
|
||||
"light",
|
||||
"SDFKSJDKFJS",
|
||||
},
|
||||
{
|
||||
"medium",
|
||||
"another",
|
||||
"trick",
|
||||
"standard",
|
||||
},
|
||||
{
|
||||
"hard",
|
||||
"ssr",
|
||||
"maniac",
|
||||
"heavy",
|
||||
|
||||
@@ -33,12 +33,12 @@ public:
|
||||
CString sStepData1, const CString sStepData2
|
||||
);
|
||||
void LoadFromSMTokens(
|
||||
const CString &sNotesType,
|
||||
const CString &sDescription,
|
||||
const CString &sDifficultyClass,
|
||||
const CString &sMeter,
|
||||
const CString &sRadarValues,
|
||||
const CString &sNoteDataOut
|
||||
CString sNotesType,
|
||||
CString sDescription,
|
||||
CString sDifficultyClass,
|
||||
CString sMeter,
|
||||
CString sRadarValues,
|
||||
CString sNoteDataOut
|
||||
);
|
||||
void WriteSMNotesTag( FILE* fp );
|
||||
|
||||
|
||||
+52
-47
@@ -14,12 +14,13 @@
|
||||
#include "Math.h" // for fabs()
|
||||
#include "Player.h"
|
||||
#include "RageUtil.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ArrowEffects.h"
|
||||
#include "GameManager.h"
|
||||
#include "InputMapper.h"
|
||||
#include "SongManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
// these two items are in the
|
||||
@@ -42,20 +43,22 @@ Player::Player()
|
||||
m_pLifeMeter = NULL;
|
||||
m_pScore = NULL;
|
||||
|
||||
this->AddActor( &m_GrayArrowRow );
|
||||
this->AddActor( &m_NoteField );
|
||||
this->AddActor( &m_GhostArrowRow );
|
||||
this->AddSubActor( &m_GrayArrowRow );
|
||||
this->AddSubActor( &m_NoteField );
|
||||
this->AddSubActor( &m_GhostArrowRow );
|
||||
|
||||
m_frameJudgeAndCombo.AddActor( &m_Judgement );
|
||||
m_frameJudgeAndCombo.AddActor( &m_Combo );
|
||||
this->AddActor( &m_frameJudgeAndCombo );
|
||||
m_frameJudgement.AddSubActor( &m_Judgement );
|
||||
this->AddSubActor( &m_frameJudgement );
|
||||
|
||||
m_frameCombo.AddSubActor( &m_Combo );
|
||||
this->AddSubActor( &m_frameCombo );
|
||||
|
||||
for( int c=0; c<MAX_NOTE_TRACKS; c++ )
|
||||
this->AddActor( &m_HoldJudgement[c] );
|
||||
this->AddSubActor( &m_HoldJudgement[c] );
|
||||
}
|
||||
|
||||
|
||||
void Player::Load( PlayerNumber player_no, StyleDef* pStyleDef, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore, int iOriginalNumNotes, int iNotesMeter )
|
||||
void Player::Load( PlayerNumber player_no, StyleDef* pStyleDef, NoteData* pNoteData, const PlayerOptions& po, LifeMeter* pLM, ScoreDisplay* pScore, int iOriginalNumNotes, int iNotesMeter )
|
||||
{
|
||||
//LOG->WriteLine( "Player::Load()", );
|
||||
this->CopyAll( pNoteData );
|
||||
@@ -84,7 +87,8 @@ void Player::Load( PlayerNumber player_no, StyleDef* pStyleDef, NoteData* pNoteD
|
||||
m_GrayArrowRow.Load( player_no, pStyleDef, po );
|
||||
m_GhostArrowRow.Load( player_no, pStyleDef, po );
|
||||
|
||||
m_frameJudgeAndCombo.SetY( FRAME_JUDGE_AND_COMBO_Y );
|
||||
m_frameJudgement.SetY( FRAME_JUDGE_AND_COMBO_Y );
|
||||
m_frameCombo.SetY( FRAME_JUDGE_AND_COMBO_Y );
|
||||
m_Combo.SetY( po.m_bReverseScroll ? -COMBO_Y_OFFSET : COMBO_Y_OFFSET );
|
||||
m_Judgement.SetY( po.m_bReverseScroll ? -JUDGEMENT_Y_OFFSET : JUDGEMENT_Y_OFFSET );
|
||||
|
||||
@@ -102,6 +106,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
||||
{
|
||||
//LOG->WriteLine( "Player::Update(%f, %f, %f)", fDeltaTime, fSongBeat, fMaxBeatDifference );
|
||||
|
||||
m_fSongBeat = fSongBeat; // save song beat
|
||||
|
||||
//
|
||||
// Check for TapNote misses
|
||||
@@ -125,7 +130,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
||||
float fEndBeat = NoteRowToBeat( (float)hn.m_iEndIndex );
|
||||
|
||||
const StyleInput StyleI( m_PlayerNumber, hn.m_iTrack );
|
||||
const GameInput GameI = GAMEMAN->GetCurrentStyleDef()->StyleInputToGameInput( StyleI );
|
||||
const GameInput GameI = GAMESTATE->GetCurrentStyleDef()->StyleInputToGameInput( StyleI );
|
||||
|
||||
|
||||
// update the life
|
||||
@@ -162,6 +167,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
||||
if( fLife == 0 ) // the player has not pressed the button for a long time!
|
||||
{
|
||||
hns = HNS_NG;
|
||||
GAMESTATE->GetLatestGameplayStatistics().iActualDancePoints[m_PlayerNumber] += HoldNoteScoreToDancePoints( hns );
|
||||
m_Combo.EndCombo();
|
||||
m_HoldJudgement[hn.m_iTrack].SetHoldJudgement( HNS_NG );
|
||||
}
|
||||
@@ -172,6 +178,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
||||
// At this point fLife > 0, or else we would have marked it NG above
|
||||
fLife = 1;
|
||||
hns = HNS_OK;
|
||||
GAMESTATE->GetLatestGameplayStatistics().iActualDancePoints[m_PlayerNumber] += HoldNoteScoreToDancePoints( hns );
|
||||
m_HoldJudgement[hn.m_iTrack].SetHoldJudgement( HNS_OK );
|
||||
m_NoteField.SetHoldNoteLife( i, fLife ); // update the NoteField display
|
||||
}
|
||||
@@ -181,7 +188,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
||||
|
||||
ActorFrame::Update( fDeltaTime );
|
||||
|
||||
m_frameJudgeAndCombo.Update( fDeltaTime );
|
||||
m_frameJudgement.Update( fDeltaTime );
|
||||
m_frameCombo.Update( fDeltaTime );
|
||||
|
||||
if( m_pLifeMeter )
|
||||
m_pLifeMeter->SetBeat( fSongBeat );
|
||||
@@ -189,9 +197,6 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
|
||||
m_GrayArrowRow.Update( fDeltaTime, fSongBeat );
|
||||
m_NoteField.Update( fDeltaTime, fSongBeat );
|
||||
m_GhostArrowRow.Update( fDeltaTime, fSongBeat );
|
||||
|
||||
m_fSongBeat = fSongBeat; // save song beat
|
||||
|
||||
}
|
||||
|
||||
void Player::DrawPrimitives()
|
||||
@@ -222,6 +227,8 @@ void Player::DrawPrimitives()
|
||||
DISPLAY->GetDevice()->SetTransform( D3DTS_PROJECTION, &matNewProj );
|
||||
}
|
||||
|
||||
m_frameCombo.Draw();
|
||||
|
||||
m_GrayArrowRow.Draw();
|
||||
m_NoteField.Draw();
|
||||
m_GhostArrowRow.Draw();
|
||||
@@ -237,7 +244,7 @@ void Player::DrawPrimitives()
|
||||
DISPLAY->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
|
||||
}
|
||||
|
||||
m_frameJudgeAndCombo.Draw();
|
||||
m_frameJudgement.Draw();
|
||||
|
||||
for( int c=0; c<m_iNumTracks; c++ )
|
||||
m_HoldJudgement[c].Draw();
|
||||
@@ -359,6 +366,9 @@ void Player::OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int i
|
||||
if( m_pScore )
|
||||
m_pScore->AddToScore( score, m_Combo.GetCurrentCombo() ); // update score - called once per note in this row
|
||||
|
||||
// update dance points for Oni lifemeter
|
||||
GAMESTATE->GetLatestGameplayStatistics().iActualDancePoints[m_PlayerNumber] += TapNoteScoreToDancePoints( score );
|
||||
|
||||
// update combo - called once per note in this row
|
||||
switch( score )
|
||||
{
|
||||
@@ -383,9 +393,13 @@ void Player::OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int i
|
||||
case TNS_GOOD: fStartZoom = 1.2f; break;
|
||||
case TNS_BOO: fStartZoom = 1.0f; break;
|
||||
}
|
||||
m_frameJudgeAndCombo.SetZoom( fStartZoom );
|
||||
m_frameJudgeAndCombo.BeginTweening( 0.2f );
|
||||
m_frameJudgeAndCombo.SetTweenZoom( 1 );
|
||||
m_frameJudgement.SetZoom( fStartZoom );
|
||||
m_frameJudgement.BeginTweening( 0.2f );
|
||||
m_frameJudgement.SetTweenZoom( 1 );
|
||||
|
||||
m_frameCombo.SetZoom( fStartZoom );
|
||||
m_frameCombo.BeginTweening( 0.2f );
|
||||
m_frameCombo.SetTweenZoom( 1 );
|
||||
}
|
||||
|
||||
|
||||
@@ -443,16 +457,12 @@ void Player::CrossedRow( int iNoteRow, float fSongBeat, float fMaxBeatDiff )
|
||||
|
||||
|
||||
|
||||
GameplayStatistics Player::GetGameplayStatistics( Song* pS, Notes* pN )
|
||||
void Player::SaveGameplayStatistics()
|
||||
{
|
||||
GameplayStatistics GSreturn;
|
||||
GameplayStatistics& GS = GAMESTATE->m_aGameplayStatistics[GAMESTATE->m_aGameplayStatistics.GetSize()-1];
|
||||
int p = m_PlayerNumber;
|
||||
|
||||
GSreturn.pSong = pS;
|
||||
Notes* pNotes = pN;
|
||||
GSreturn.dc = pNotes->m_DifficultyClass;
|
||||
GSreturn.meter = pNotes->m_iMeter;
|
||||
GSreturn.iPossibleDancePoints = ((NoteData*)this)->GetPossibleDancePoints();
|
||||
GSreturn.iActualDancePoints = 0;
|
||||
GS.iActualDancePoints[p] = 0;
|
||||
|
||||
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
|
||||
{
|
||||
@@ -463,41 +473,36 @@ GameplayStatistics Player::GetGameplayStatistics( Song* pS, Notes* pN )
|
||||
|
||||
switch( m_TapNoteScores[t][r] )
|
||||
{
|
||||
case TNS_PERFECT: GSreturn.perfect++; break;
|
||||
case TNS_GREAT: GSreturn.great++; break;
|
||||
case TNS_GOOD: GSreturn.good++; break;
|
||||
case TNS_BOO: GSreturn.boo++; break;
|
||||
case TNS_MISS: GSreturn.miss++; break;
|
||||
case TNS_PERFECT: GS.perfect[p]++; break;
|
||||
case TNS_GREAT: GS.great[p]++; break;
|
||||
case TNS_GOOD: GS.good[p]++; break;
|
||||
case TNS_BOO: GS.boo[p]++; break;
|
||||
case TNS_MISS: GS.miss[p]++; break;
|
||||
case TNS_NONE: break;
|
||||
default: ASSERT( false );
|
||||
}
|
||||
GSreturn.iActualDancePoints += TapNoteScoreToDancePoints( m_TapNoteScores[t][r] );
|
||||
GS.iActualDancePoints[p] += TapNoteScoreToDancePoints( m_TapNoteScores[t][r] );
|
||||
}
|
||||
}
|
||||
for( int i=0; i<m_iNumHoldNotes; i++ )
|
||||
{
|
||||
switch( m_HoldNoteScores[i] )
|
||||
{
|
||||
case HNS_NG: GSreturn.ng++; break;
|
||||
case HNS_OK: GSreturn.ok++; break;
|
||||
case HNS_NONE: break;
|
||||
case HNS_NG: GS.ng[p]++; break;
|
||||
case HNS_OK: GS.ok[p]++; break;
|
||||
case HNS_NONE: break;
|
||||
default: ASSERT( false );
|
||||
}
|
||||
GSreturn.iActualDancePoints += HoldNoteScoreToDancePoints( m_HoldNoteScores[i] );
|
||||
GS.iActualDancePoints[p] += HoldNoteScoreToDancePoints( m_HoldNoteScores[i] );
|
||||
}
|
||||
GSreturn.max_combo = m_Combo.GetMaxCombo();
|
||||
GSreturn.score = m_pScore ? m_pScore->GetScore() : 0;
|
||||
GS.max_combo[p] = m_Combo.GetMaxCombo();
|
||||
GS.score[p] = m_pScore ? m_pScore->GetScore() : 0;
|
||||
|
||||
GSreturn.failed = m_pLifeMeter ? m_pLifeMeter->HasFailed() : false;
|
||||
GS.failed[p] = m_pLifeMeter ? m_pLifeMeter->FailedEarlier() : false;
|
||||
|
||||
for( int r=0; r<NUM_RADAR_VALUES; r++ )
|
||||
{
|
||||
GSreturn.fRadarPossible[r] = this->GetRadarValue( (RadarCategory)r, pS->m_fMusicLengthSeconds );
|
||||
GSreturn.fRadarActual[r] = this->GetActualRadarValue( (RadarCategory)r, pS->m_fMusicLengthSeconds );
|
||||
|
||||
GSreturn.fRadarPossible[r] = clamp( GSreturn.fRadarPossible[r], 0, 1 );
|
||||
GSreturn.fRadarActual[r] = clamp( GSreturn.fRadarActual[r], 0, 1 );
|
||||
GS.fRadarActual[p][r] = this->GetActualRadarValue( (RadarCategory)r, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
|
||||
CLAMP( GS.fRadarActual[p][r], 0, 1 );
|
||||
}
|
||||
|
||||
return GSreturn;
|
||||
}
|
||||
|
||||
+11
-7
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
File: Player.h
|
||||
Class: Player
|
||||
|
||||
Desc: Object that accepts pad input, knocks down ColorNotes that were stepped on,
|
||||
and keeps score for the player.
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "HoldGhostArrow.h"
|
||||
#include "ActorFrame.h"
|
||||
#include "RandomSample.h"
|
||||
#include "ScoreDisplayRolling.h"
|
||||
#include "ScoreDisplay.h"
|
||||
#include "LifeMeterBar.h"
|
||||
#include "Judgement.h"
|
||||
#include "HoldJudgement.h"
|
||||
@@ -44,12 +44,12 @@ public:
|
||||
void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference );
|
||||
void DrawPrimitives();
|
||||
|
||||
void Load( PlayerNumber player_no, StyleDef *pStyleDef, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore, int iOriginalNumNotes, int iNotesMeter );
|
||||
void Load( PlayerNumber player_no, StyleDef *pStyleDef, NoteData* pNoteData, const PlayerOptions& po, LifeMeter* pLM, ScoreDisplay* pScore, int iOriginalNumNotes, int iNotesMeter );
|
||||
void CrossedRow( int iNoteRow, float fSongBeat, float fMaxBeatDiff );
|
||||
void HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff );
|
||||
int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
|
||||
|
||||
GameplayStatistics GetGameplayStatistics( Song* pS, Notes* pN );
|
||||
void SaveGameplayStatistics();
|
||||
|
||||
void SetOverrideAdd( float fAdd ) { m_NoteField.m_fOverrideAdd = fAdd; };
|
||||
float GetOverrideAdd() { return m_NoteField.m_fOverrideAdd; };
|
||||
@@ -74,10 +74,14 @@ protected:
|
||||
GhostArrowRow m_GhostArrowRow;
|
||||
|
||||
HoldJudgement m_HoldJudgement[MAX_NOTE_TRACKS];
|
||||
ActorFrame m_frameJudgeAndCombo;
|
||||
|
||||
ActorFrame m_frameJudgement;
|
||||
Judgement m_Judgement;
|
||||
|
||||
ActorFrame m_frameCombo;
|
||||
Combo m_Combo;
|
||||
LifeMeterBar* m_pLifeMeter;
|
||||
ScoreDisplayRolling* m_pScore;
|
||||
|
||||
LifeMeter* m_pLifeMeter;
|
||||
ScoreDisplay* m_pScore;
|
||||
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "PrefsManager.h"
|
||||
#include "IniFile.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program
|
||||
@@ -21,8 +22,9 @@ PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our pro
|
||||
PrefsManager::PrefsManager()
|
||||
{
|
||||
m_bWindowed = false;
|
||||
m_bHighDetail = true;
|
||||
m_bHighTextureDetail = false;
|
||||
m_iDisplayResolution = 640;
|
||||
m_iTextureResolution = 512;
|
||||
m_iRefreshRate = 60;
|
||||
m_bIgnoreJoyAxes = false;
|
||||
m_bShowFPS = false;
|
||||
m_BackgroundMode = BGMODE_ANIMATIONS;
|
||||
@@ -33,21 +35,16 @@ PrefsManager::PrefsManager()
|
||||
m_bAutoPlay = false;
|
||||
m_fJudgeWindow = 0.18f;
|
||||
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
m_PreferredDifficultyClass[p] = CLASS_EASY;
|
||||
m_SongSortOrder = SORT_GROUP;
|
||||
m_PlayMode = PLAY_MODE_INVALID;
|
||||
m_iCurrentStageIndex = 0;
|
||||
|
||||
ReadPrefsFromDisk();
|
||||
ReadGlobalPrefsFromDisk( true );
|
||||
}
|
||||
|
||||
PrefsManager::~PrefsManager()
|
||||
{
|
||||
SavePrefsToDisk();
|
||||
SaveGlobalPrefsToDisk();
|
||||
SaveGamePrefsToDisk();
|
||||
}
|
||||
|
||||
void PrefsManager::ReadPrefsFromDisk()
|
||||
void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame )
|
||||
{
|
||||
IniFile ini;
|
||||
ini.SetPath( "StepMania.ini" );
|
||||
@@ -55,8 +52,9 @@ void PrefsManager::ReadPrefsFromDisk()
|
||||
return; // could not read config file, load nothing
|
||||
|
||||
ini.GetValueB( "Options", "Windowed", m_bWindowed );
|
||||
ini.GetValueB( "Options", "HighDetail", m_bHighDetail );
|
||||
ini.GetValueB( "Options", "HighTextureDetail", m_bHighTextureDetail );
|
||||
ini.GetValueI( "Options", "DisplayResolution", m_iDisplayResolution );
|
||||
ini.GetValueI( "Options", "TextureResolution", m_iTextureResolution );
|
||||
ini.GetValueI( "Options", "RefreshRate", m_iRefreshRate );
|
||||
ini.GetValueB( "Options", "IgnoreJoyAxes", m_bIgnoreJoyAxes );
|
||||
ini.GetValueB( "Options", "ShowFPS", m_bShowFPS );
|
||||
ini.GetValueI( "Options", "BackgroundMode", (int&)m_BackgroundMode );
|
||||
@@ -67,23 +65,28 @@ void PrefsManager::ReadPrefsFromDisk()
|
||||
ini.GetValueB( "Options", "AutoPlay", m_bAutoPlay );
|
||||
ini.GetValueF( "Options", "JudgeWindow", m_fJudgeWindow );
|
||||
|
||||
ini.GetValue( "Options", "Announcer", m_sAnnouncer );
|
||||
ini.GetValue( "Options", "NoteSkin", m_sNoteSkin );
|
||||
|
||||
CString sAdditionalSongFolders;
|
||||
ini.GetValue( "Options", "SongFolders", sAdditionalSongFolders );
|
||||
split( sAdditionalSongFolders, ",", m_asSongFolders, true );
|
||||
|
||||
if( bSwitchToLastPlayedGame )
|
||||
{
|
||||
Game game;
|
||||
if( ini.GetValueI("Options", "Game", (int&)game) )
|
||||
GAMESTATE->SwitchGame( game );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PrefsManager::SavePrefsToDisk()
|
||||
void PrefsManager::SaveGlobalPrefsToDisk()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.SetPath( "StepMania.ini" );
|
||||
|
||||
ini.SetValueB( "Options", "Windowed", m_bWindowed );
|
||||
ini.SetValueB( "Options", "HighDetail", m_bHighDetail );
|
||||
ini.SetValueB( "Options", "HighTextureDetail", m_bHighTextureDetail );
|
||||
ini.SetValueI( "Options", "DisplayResolution", m_iDisplayResolution );
|
||||
ini.SetValueI( "Options", "TextureResolution", m_iTextureResolution );
|
||||
ini.SetValueI( "Options", "RefreshRate", m_iRefreshRate );
|
||||
ini.SetValueB( "Options", "IgnoreJoyAxes", m_bIgnoreJoyAxes );
|
||||
ini.SetValueB( "Options", "ShowFPS", m_bShowFPS );
|
||||
ini.SetValueI( "Options", "BackgroundMode", m_BackgroundMode);
|
||||
@@ -94,78 +97,48 @@ void PrefsManager::SavePrefsToDisk()
|
||||
ini.SetValueB( "Options", "AutoPlay", m_bAutoPlay );
|
||||
ini.SetValueF( "Options", "JudgeWindow", m_fJudgeWindow );
|
||||
|
||||
ini.SetValue( "Options", "Announcer", m_sAnnouncer );
|
||||
ini.SetValue( "Options", "NoteSkin", m_sNoteSkin );
|
||||
|
||||
ini.SetValue( "Options", "SongFolders", join(",", m_asSongFolders) );
|
||||
|
||||
ini.SetValueI( "Options", "Game", GAMESTATE->GetCurGame() );
|
||||
|
||||
ini.WriteFile();
|
||||
}
|
||||
|
||||
int PrefsManager::GetStageIndex()
|
||||
void PrefsManager::ReadGamePrefsFromDisk()
|
||||
{
|
||||
return m_iCurrentStageIndex;
|
||||
if( !GAMESTATE )
|
||||
return;
|
||||
|
||||
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
|
||||
IniFile ini;
|
||||
ini.SetPath( sGameName + "Prefs.ini" );
|
||||
if( !ini.ReadFile() )
|
||||
return; // could not read config file, load nothing
|
||||
|
||||
CString sAnnouncer, sTheme, sNoteSkin;
|
||||
|
||||
ini.GetValue( "Options", "Announcer", sAnnouncer );
|
||||
ini.GetValue( "Options", "Theme", sTheme );
|
||||
ini.GetValue( "Options", "NoteSkin", sNoteSkin );
|
||||
|
||||
|
||||
ANNOUNCER->SwitchAnnouncer( sAnnouncer );
|
||||
THEME->SwitchTheme( sTheme );
|
||||
GAMEMAN->SwitchNoteSkin( sNoteSkin );
|
||||
}
|
||||
|
||||
bool PrefsManager::IsFinalStage()
|
||||
void PrefsManager::SaveGamePrefsToDisk()
|
||||
{
|
||||
if( PREFSMAN->m_bEventMode )
|
||||
return false;
|
||||
return m_iCurrentStageIndex == m_iNumArcadeStages-1;
|
||||
if( !GAMESTATE )
|
||||
return;
|
||||
|
||||
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
|
||||
IniFile ini;
|
||||
ini.SetPath( sGameName + "Prefs.ini" );
|
||||
|
||||
ini.SetValue( "Options", "Announcer", ANNOUNCER->GetCurAnnouncerName() );
|
||||
ini.SetValue( "Options", "Theme", THEME->GetCurThemeName() );
|
||||
ini.SetValue( "Options", "NoteSkin", GAMEMAN->GetCurNoteSkin() );
|
||||
|
||||
ini.WriteFile();
|
||||
}
|
||||
|
||||
bool PrefsManager::IsExtraStage()
|
||||
{
|
||||
if( PREFSMAN->m_bEventMode )
|
||||
return false;
|
||||
return m_iCurrentStageIndex == m_iNumArcadeStages;
|
||||
}
|
||||
|
||||
bool PrefsManager::IsExtraStage2()
|
||||
{
|
||||
if( PREFSMAN->m_bEventMode )
|
||||
return false;
|
||||
return m_iCurrentStageIndex == m_iNumArcadeStages+1;
|
||||
}
|
||||
|
||||
CString PrefsManager::GetStageText()
|
||||
{
|
||||
if( IsFinalStage() )
|
||||
return "Final";
|
||||
else if( IsExtraStage() )
|
||||
return "Extra";
|
||||
else if( IsExtraStage2() )
|
||||
return "Extra 2";
|
||||
|
||||
|
||||
int iStageNo = m_iCurrentStageIndex+1;
|
||||
|
||||
CString sNumberSuffix;
|
||||
if( ( (iStageNo/10) % 10 ) == 1 ) // in the teens (e.g. 19, 213)
|
||||
{
|
||||
sNumberSuffix = "th";
|
||||
}
|
||||
else // not in the teens
|
||||
{
|
||||
const int iLastDigit = iStageNo%10;
|
||||
switch( iLastDigit )
|
||||
{
|
||||
case 1: sNumberSuffix = "st"; break;
|
||||
case 2: sNumberSuffix = "nd"; break;
|
||||
case 3: sNumberSuffix = "rd"; break;
|
||||
default:sNumberSuffix = "th"; break;
|
||||
}
|
||||
}
|
||||
return ssprintf( "%d%s", iStageNo, sNumberSuffix );
|
||||
}
|
||||
|
||||
D3DXCOLOR PrefsManager::GetStageColor()
|
||||
{
|
||||
if( IsFinalStage() )
|
||||
return D3DXCOLOR(1,0.1f,0.1f,1); // red
|
||||
else if( IsExtraStage() || IsExtraStage2() )
|
||||
return D3DXCOLOR(1,1,0.3f,1); // yellow
|
||||
else
|
||||
return D3DXCOLOR(0.3f,1,0.3f,1); // green
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
-----------------------------------------------------------------------------
|
||||
Class: PrefsManager
|
||||
|
||||
Desc: Holds user-chosen preferences and saves it between sessions. This class
|
||||
also has temporary holders for information that passed between windows - e.g.
|
||||
GameplayStatistics.
|
||||
Desc: Holds user-chosen preferences that are saved between sessions.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
@@ -15,7 +13,9 @@
|
||||
#include "GameConstantsAndTypes.h"
|
||||
|
||||
|
||||
const int NUM_PAD_TO_DEVICE_SLOTS = 3; // three device inputs may map to one pad input
|
||||
#include "AnnouncerManager.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "GameManager.h"
|
||||
|
||||
|
||||
class PrefsManager
|
||||
@@ -28,8 +28,9 @@ public:
|
||||
|
||||
// GameOptions (ARE saved between sessions)
|
||||
bool m_bWindowed;
|
||||
bool m_bHighDetail;
|
||||
bool m_bHighTextureDetail;
|
||||
int m_iDisplayResolution;
|
||||
int m_iTextureResolution;
|
||||
int m_iRefreshRate;
|
||||
bool m_bIgnoreJoyAxes;
|
||||
bool m_bShowFPS;
|
||||
BackgroundMode m_BackgroundMode;
|
||||
@@ -40,32 +41,34 @@ public:
|
||||
bool m_bAutoPlay;
|
||||
float m_fJudgeWindow;
|
||||
|
||||
// AppearanceOptions (ARE saved between sessions)
|
||||
CString m_sAnnouncer;
|
||||
CString m_sNoteSkin;
|
||||
|
||||
CStringArray m_asSongFolders;
|
||||
|
||||
void ReadPrefsFromDisk();
|
||||
void SavePrefsToDisk();
|
||||
int GetDisplayHeight()
|
||||
{
|
||||
switch( m_iDisplayResolution )
|
||||
{
|
||||
case 1280: return 1024; break;
|
||||
case 1024: return 768; break;
|
||||
case 800: return 600; break;
|
||||
case 640: return 480; break;
|
||||
case 512: return 384; break;
|
||||
case 400: return 300; break;
|
||||
case 320: return 240; break;
|
||||
default: throw RageException( "Invalid DisplayWidth '%d'", m_iDisplayResolution ); return 480;
|
||||
}
|
||||
}
|
||||
|
||||
void ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame );
|
||||
void SaveGlobalPrefsToDisk();
|
||||
|
||||
|
||||
// Options that are NOT saved between sessions
|
||||
DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS];
|
||||
SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits
|
||||
PlayMode m_PlayMode;
|
||||
int m_iCurrentStageIndex; // starts at 0, and is incremented with each Stage Clear
|
||||
// AppearanceOptions (ARE saved between sessions, and saved per game)
|
||||
// CString m_sAnnouncer; // need to make sure to call ANNOUNCER->SwitchAnnouncer() when this changes
|
||||
// CString m_sTheme; // need to make sure to call THEME->SwitchTheme() when this changes
|
||||
// CString m_sNoteSkin;
|
||||
|
||||
int GetStageIndex();
|
||||
bool IsFinalStage();
|
||||
bool IsExtraStage();
|
||||
bool IsExtraStage2();
|
||||
CString GetStageText();
|
||||
D3DXCOLOR GetStageColor();
|
||||
|
||||
|
||||
PlayerOptions m_PlayerOptions[NUM_PLAYERS];
|
||||
SongOptions m_SongOptions;
|
||||
void ReadGamePrefsFromDisk();
|
||||
void SaveGamePrefsToDisk();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -103,9 +103,12 @@ RageDisplay::~RageDisplay()
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
bool RageDisplay::SwitchDisplayMode(
|
||||
const bool bWindowed, const DWORD dwWidth, const DWORD dwHeight, const DWORD dwBPP )
|
||||
const bool bWindowed, const int iWidth, const int iHeight, const int iBPP, const int iFullScreenHz )
|
||||
{
|
||||
LOG->WriteLine( "RageDisplay::SwitchDisplayModes( %d, %u, %u, %u )", bWindowed, dwWidth, dwHeight, dwBPP );
|
||||
LOG->WriteLine( "RageDisplay::SwitchDisplayModes( %d, %d, %d, %d, %d )", bWindowed, iWidth, iHeight, iBPP, iFullScreenHz );
|
||||
|
||||
if( !bWindowed )
|
||||
SetCursor( NULL );
|
||||
|
||||
|
||||
HRESULT hr;
|
||||
@@ -126,7 +129,7 @@ bool RageDisplay::SwitchDisplayMode(
|
||||
else // full screen
|
||||
{
|
||||
// add only the formats that match dwBPP
|
||||
switch( dwBPP )
|
||||
switch( iBPP )
|
||||
{
|
||||
case 16:
|
||||
arrayBackBufferFormats.Add( D3DFMT_R5G6B5 );
|
||||
@@ -139,7 +142,7 @@ bool RageDisplay::SwitchDisplayMode(
|
||||
arrayBackBufferFormats.Add( D3DFMT_A8R8G8B8 );
|
||||
break;
|
||||
default:
|
||||
throw RageException( ssprintf("Invalid BPP '%u' specified", dwBPP) );
|
||||
throw RageException( ssprintf("Invalid BPP '%u' specified", iBPP) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -184,7 +187,7 @@ bool RageDisplay::SwitchDisplayMode(
|
||||
|
||||
if( i == arrayBackBufferFormats.GetSize() ) // we didn't find an appropriate format
|
||||
{
|
||||
LOG->WriteLineHr( hr, "failed to find an appropriate format for %d, %u, %u, %u.", bWindowed, dwWidth, dwHeight, dwBPP );
|
||||
LOG->WriteLineHr( hr, "failed to find an appropriate format for %d, %u, %u, %u.", bWindowed, iWidth, iHeight, iBPP );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -193,8 +196,8 @@ bool RageDisplay::SwitchDisplayMode(
|
||||
// Set up presentation parameters for the display
|
||||
ZeroMemory( &m_d3dpp, sizeof(m_d3dpp) );
|
||||
|
||||
m_d3dpp.BackBufferWidth = dwWidth;
|
||||
m_d3dpp.BackBufferHeight = dwHeight;
|
||||
m_d3dpp.BackBufferWidth = iWidth;
|
||||
m_d3dpp.BackBufferHeight = iHeight;
|
||||
m_d3dpp.BackBufferFormat = fmtBackBuffer;
|
||||
m_d3dpp.BackBufferCount = 1;
|
||||
m_d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
|
||||
@@ -204,7 +207,7 @@ bool RageDisplay::SwitchDisplayMode(
|
||||
m_d3dpp.EnableAutoDepthStencil = TRUE;
|
||||
m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
|
||||
m_d3dpp.Flags = 0;
|
||||
m_d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
|
||||
m_d3dpp.FullScreen_RefreshRateInHz = bWindowed ? D3DPRESENT_RATE_DEFAULT : iFullScreenHz;
|
||||
m_d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
|
||||
|
||||
LOG->WriteLine( "Present Parameters: %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d",
|
||||
@@ -245,7 +248,7 @@ bool RageDisplay::SwitchDisplayMode(
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED,
|
||||
&m_d3dpp, &m_pd3dDevice) ) )
|
||||
{
|
||||
LOG->WriteLineHr( hr, "failed to create device: %d, %u, %u, %u.", bWindowed, dwWidth, dwHeight, dwBPP );
|
||||
LOG->WriteLineHr( hr, "failed to create device: %d, %u, %u, %u.", bWindowed, iWidth, iHeight, iBPP );
|
||||
return false;
|
||||
}
|
||||
LOG->WriteLine(
|
||||
@@ -261,7 +264,7 @@ bool RageDisplay::SwitchDisplayMode(
|
||||
// device is already created. Just reset it.
|
||||
if( FAILED( hr = m_pd3dDevice->Reset( &m_d3dpp ) ) )
|
||||
{
|
||||
LOG->WriteLineHr( hr, "failed to reset device: %d, %u, %u, %u.", bWindowed, dwWidth, dwHeight, dwBPP );
|
||||
LOG->WriteLineHr( hr, "failed to reset device: %d, %u, %u, %u.", bWindowed, iWidth, iHeight, iBPP );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
RageDisplay( HWND hWnd );
|
||||
~RageDisplay();
|
||||
bool SwitchDisplayMode(
|
||||
const bool bWindowed, const DWORD dwWidth, const DWORD dwHeight, const DWORD dwBPP );
|
||||
const bool bWindowed, const int iWidth, const int iHeight, const int iBPP, const int iFullScreenHz );
|
||||
|
||||
LPDIRECT3D8 GetD3D() { return m_pd3d; };
|
||||
inline LPDIRECT3DDEVICE8 GetDevice() { return m_pd3dDevice; };
|
||||
|
||||
@@ -31,8 +31,6 @@ RageLog::RageLog()
|
||||
// delete old log files
|
||||
DeleteFile( LOG_FILE_NAME );
|
||||
|
||||
ShowConsole();
|
||||
|
||||
// Open log file and leave it open. Let the OS close it when the app exits
|
||||
m_fileLog = fopen( LOG_FILE_NAME, "w" );
|
||||
|
||||
|
||||
+135
-15
@@ -12,7 +12,9 @@
|
||||
*/
|
||||
|
||||
#include "RageUtil.h"
|
||||
#include "RageCRC32.h" // Backend for GetHashForString
|
||||
|
||||
ULONG randseed = time(NULL);
|
||||
|
||||
|
||||
|
||||
bool IsAnInt( LPCTSTR s )
|
||||
@@ -21,10 +23,8 @@ bool IsAnInt( LPCTSTR s )
|
||||
return false;
|
||||
|
||||
for( UINT i=0; i<strlen(s); i++ )
|
||||
{
|
||||
if( s[i] < '0' || s[i] > '9' )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -286,16 +286,6 @@ void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bRe
|
||||
::FindClose( hFind );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: GetCrc32ForString( CString s)
|
||||
// Desc: Coerces CString into an unsigned char array and runs CRC-32 on it.
|
||||
//-----------------------------------------------------------------------------
|
||||
unsigned int GetCrc32ForString( CString s )
|
||||
{
|
||||
// A CString has built in length data! Isn't that great?
|
||||
return GetCrc32((unsigned char*)s.GetBuffer(s.GetLength()), s.GetLength());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: GetHashForString( CString s )
|
||||
// Desc: This new version of GetHashForString uses a stronger hashing algorithm
|
||||
@@ -305,9 +295,139 @@ unsigned int GetCrc32ForString( CString s )
|
||||
// characters in the CString are recast as unsigned char and that the
|
||||
// unsigned int result from the hash is recast as a signed int).
|
||||
//-----------------------------------------------------------------------------
|
||||
int GetHashForString ( CString s )
|
||||
int GetHashForString ( CString string )
|
||||
{
|
||||
return (int)abs(GetCrc32((unsigned char*)s.GetBuffer(s.GetLength()), s.GetLength()));
|
||||
/*
|
||||
* RageCRC32.cpp
|
||||
*
|
||||
* Original code
|
||||
* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
|
||||
* code or tables extracted from it, as desired without restriction.
|
||||
*
|
||||
* Code was extracted from IETF Internet Draft
|
||||
* draft-ietf-tsvwg-sctpcsum-00 at URI
|
||||
* http://www.ietf.org/proceedings/01dec/I-D/draft-ietf-tsvwg-sctpcsum-00.txt
|
||||
*
|
||||
* Adaptation
|
||||
* Copyright (C) 2002 Peter S. May.
|
||||
* SourceForge ID: drokulix
|
||||
*
|
||||
* - Header file added
|
||||
* - Name of function changed to GetCrc32
|
||||
* - Values in table changed from long int to int
|
||||
*
|
||||
* Chris:
|
||||
* Moved this code out of RageCRC32 since it's not terribly long. Thanks Dro Kulix!
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
|
||||
* code or tables extracted from it, as desired without restriction.
|
||||
*
|
||||
* First, the polynomial itself and its table of feedback terms. The
|
||||
* polynomial is
|
||||
* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
|
||||
*
|
||||
* Note that we take it "backwards" and put the highest-order term in
|
||||
* the lowest-order bit. The X^32 term is "implied"; the LSB is the
|
||||
* X^31 term, etc. The X^0 term (usually shown as "+1") results in
|
||||
* the MSB being 1
|
||||
*
|
||||
* Note that the usual hardware shift register implementation, which
|
||||
* is what we're using (we're merely optimizing it by doing eight-bit
|
||||
* chunks at a time) shifts bits into the lowest-order term. In our
|
||||
* implementation, that means shifting towards the right. Why do we
|
||||
* do it this way? Because the calculated CRC must be transmitted in
|
||||
* order from highest-order term to lowest-order term. UARTs transmit
|
||||
* characters in order from LSB to MSB. By storing the CRC this way
|
||||
* we hand it to the UART in the order low-byte to high-byte; the UART
|
||||
* sends each low-bit to hight-bit; and the result is transmission bit
|
||||
* by bit from highest- to lowest-order term without requiring any bit
|
||||
* shuffling on our part. Reception works similarly
|
||||
*
|
||||
* The feedback terms table consists of 256, 32-bit entries. Notes
|
||||
*
|
||||
* The table can be generated at runtime if desired; code to do so
|
||||
* is shown later. It might not be obvious, but the feedback
|
||||
* terms simply represent the results of eight shift/xor opera
|
||||
* tions for all combinations of data and CRC register values
|
||||
*
|
||||
* The values must be right-shifted by eight bits by the "updcrc
|
||||
* logic; the shift must be unsigned (bring in zeroes). On some
|
||||
* hardware you could probably optimize the shift in assembler by
|
||||
* using byte-swap instructions
|
||||
* polynomial $edb88320
|
||||
*/
|
||||
|
||||
static const unsigned int crc32_tab[] = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
|
||||
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
|
||||
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
|
||||
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
||||
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
|
||||
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
||||
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
|
||||
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
|
||||
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
|
||||
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
|
||||
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
|
||||
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
|
||||
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
|
||||
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
|
||||
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
|
||||
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
||||
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
|
||||
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
|
||||
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
|
||||
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
|
||||
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
|
||||
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
|
||||
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
||||
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
|
||||
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
||||
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
|
||||
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
|
||||
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
|
||||
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
|
||||
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
|
||||
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
|
||||
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
|
||||
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
|
||||
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
||||
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
|
||||
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
||||
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
|
||||
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
|
||||
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
|
||||
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
|
||||
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
|
||||
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
|
||||
0x2d02ef8d
|
||||
};
|
||||
|
||||
/* Return a 32-bit CRC of the contents of the buffer. */
|
||||
|
||||
//unsigned int
|
||||
//GetCrc32(const unsigned char *s, unsigned int len)
|
||||
//{
|
||||
const char* s = string;
|
||||
int len = string.GetLength();
|
||||
|
||||
unsigned int crc32val = 0;
|
||||
for( int i=0; i<len; i++ )
|
||||
crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8);
|
||||
|
||||
return crc32val;
|
||||
//}
|
||||
}
|
||||
|
||||
int GetHashForFile( CString sPath )
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
-----------------------------------------------------------------------------
|
||||
File: RageUtil
|
||||
|
||||
Desc: Miscellaneous helper functions.
|
||||
Desc: Miscellaneous helper macros and functions.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
@@ -18,10 +18,8 @@
|
||||
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
|
||||
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
|
||||
|
||||
#define ZERO(x) memset(&x, 0, sizeof(x))
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Other Macros
|
||||
//-----------------------------------------------------------------------------
|
||||
#define RECTWIDTH(rect) ((rect).right - (rect).left)
|
||||
#define RECTHEIGHT(rect) ((rect).bottom - (rect).top)
|
||||
inline int RECTCENTERX(RECT rect) { return rect.left + (rect.right-rect.left)/2; }
|
||||
@@ -37,11 +35,55 @@ inline int RECTCENTERY(RECT rect) { return rect.top + (rect.bottom-rect.top)/2;
|
||||
|
||||
#define clamp(val,low,high) ( max( (low), min((val),(high)) ) )
|
||||
|
||||
#define PI D3DX_PI
|
||||
#define DEG (PI / 180.0f)
|
||||
#define RAD (180.0f / PI)
|
||||
// Scales x so that l1 corresponds to l2 and h1 corresponds to h2. Does not modify x, MUST assign the result to something!
|
||||
#define SCALE(x, l1, h1, l2, h2) (((x) - (l1)) / ((h1) - (l1)) * ((h2) - (l2)) + (l2))
|
||||
// Clamps x
|
||||
#define CLAMP(x, l, h) {if (x > h) x = h; else if (x < l) x = l;}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Misc helper functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Fast random number generators
|
||||
// Taken from "Numerical Recipes in C"
|
||||
|
||||
extern ULONG randseed;
|
||||
|
||||
inline ULONG Random()
|
||||
{
|
||||
randseed = 1664525L * randseed + 1013904223L;
|
||||
return randseed;
|
||||
}
|
||||
|
||||
inline float RandomFloat()
|
||||
{
|
||||
randseed = 1664525L * randseed + 1013904223L;
|
||||
ULONG itemp = 0x3f800000 | (0x007fffff & randseed);
|
||||
return (*(float *)&itemp) - 1.0f;
|
||||
}
|
||||
|
||||
// Returns a float between dLow and dHigh inclusive
|
||||
inline float RandomFloat(float fLow, float fHigh)
|
||||
{
|
||||
return RandomFloat() * (fHigh - fLow) + fLow;
|
||||
}
|
||||
|
||||
// Returns an integer between nLow and nHigh inclusive
|
||||
inline int RandomInt(int nLow, int nHigh)
|
||||
{
|
||||
return ((Random() >> 2) % (nHigh - nLow + 1)) + nLow;
|
||||
}
|
||||
|
||||
// Debug new for memory leak tracing
|
||||
//#ifdef _DEBUG
|
||||
//#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
//#endif
|
||||
|
||||
|
||||
// Simple function for generating random numbers
|
||||
inline float randomf( const float low=-1.0f, const float high=1.0f )
|
||||
{
|
||||
@@ -98,7 +140,6 @@ CString join(
|
||||
|
||||
void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs=false, bool bReturnPathToo=false );
|
||||
int GetHashForString( CString s );
|
||||
unsigned int GetCrc32ForString( CString s );
|
||||
int GetHashForFile( CString sPath );
|
||||
int GetHashForDirectory( CString sDir ); // a hash value that remains the same as long as nothing in the directory has changed
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ RandomSample::~RandomSample()
|
||||
|
||||
bool RandomSample::LoadSoundDir( CString sDir )
|
||||
{
|
||||
if( sDir == "" )
|
||||
return true;
|
||||
|
||||
// make sure there's a backslash at the end of this path
|
||||
if( sDir[sDir.GetLength()-1] != '\\' )
|
||||
sDir += "\\";
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScoreDisplay.h
|
||||
|
||||
Desc: A graphic displayed in the ScoreDisplay during Dancing.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "ScoreDisplay.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameState.h"
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScoreDisplay
|
||||
|
||||
Desc: A graphic displayed in the ScoreDisplay during Dancing.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Sprite.h"
|
||||
#include "Song.h"
|
||||
#include "ActorFrame.h"
|
||||
#include "BitmapText.h"
|
||||
|
||||
|
||||
|
||||
class ScoreDisplay : public BitmapText
|
||||
{
|
||||
public:
|
||||
virtual void Init( PlayerNumber pn, PlayerOptions po, int iOriginalNumNotes, int iNotesMeter ) = 0;
|
||||
|
||||
virtual void SetScore( float fNewScore ) = 0;
|
||||
virtual int GetScore() = 0;
|
||||
virtual void AddToScore( TapNoteScore score, int iCurCombo ) = 0;
|
||||
|
||||
virtual void Update( float fDeltaTime ) = 0;
|
||||
virtual void Draw() = 0;
|
||||
|
||||
protected:
|
||||
};
|
||||
@@ -0,0 +1,159 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScoreDisplayNormal.h
|
||||
|
||||
Desc: A graphic displayed in the ScoreDisplayNormal during Dancing.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "ScoreDisplayNormal.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
const float SCORE_TWEEN_TIME = 0.5f;
|
||||
|
||||
|
||||
ScoreDisplayNormal::ScoreDisplayNormal()
|
||||
{
|
||||
LOG->WriteLine( "ScoreDisplayNormal::ScoreDisplayNormal()" );
|
||||
|
||||
// init the text
|
||||
Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) );
|
||||
TurnShadowOff();
|
||||
|
||||
m_fTrailingScore = 0;
|
||||
|
||||
SetScore( 0 );
|
||||
}
|
||||
|
||||
|
||||
void ScoreDisplayNormal::Init( PlayerNumber pn, PlayerOptions po, int iOriginalNumNotes, int iNotesMeter )
|
||||
{
|
||||
m_PlayerNumber = pn;
|
||||
m_PlayerOptions = po;
|
||||
m_iTotalNotes = iOriginalNumNotes;
|
||||
m_iNotesMeter = iNotesMeter;
|
||||
|
||||
//for( int i=0; i<iOriginalNumNotes; i++ )
|
||||
// AddToScore( TNS_GREAT, i );
|
||||
}
|
||||
|
||||
void ScoreDisplayNormal::SetScore( float fNewScore )
|
||||
{
|
||||
m_fScore = fNewScore;
|
||||
|
||||
float fDelta = (float)m_fScore - m_fTrailingScore;
|
||||
|
||||
m_fScoreVelocity = fDelta / SCORE_TWEEN_TIME; // in score units per second
|
||||
}
|
||||
|
||||
|
||||
int ScoreDisplayNormal::GetScore()
|
||||
{
|
||||
return (int)m_fScore;
|
||||
}
|
||||
|
||||
|
||||
void ScoreDisplayNormal::Update( float fDeltaTime )
|
||||
{
|
||||
BitmapText::Update( fDeltaTime );
|
||||
|
||||
float fDeltaBefore = (float)m_fScore - m_fTrailingScore;
|
||||
m_fTrailingScore += m_fScoreVelocity * fDeltaTime;
|
||||
float fDeltaAfter = (float)m_fScore - m_fTrailingScore;
|
||||
|
||||
if( fDeltaBefore * fDeltaAfter < 0 ) // the sign changed
|
||||
{
|
||||
m_fTrailingScore = (float)m_fScore;
|
||||
m_fScoreVelocity = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ScoreDisplayNormal::Draw()
|
||||
{
|
||||
if( m_fScore == 0 )
|
||||
{
|
||||
CString sFormat = ssprintf( "%%%d.0d", NUM_SCORE_DIGITS );
|
||||
SetText( ssprintf(sFormat, 0) );
|
||||
}
|
||||
else
|
||||
{
|
||||
CString sFormat = ssprintf( "%%%d.0f", NUM_SCORE_DIGITS );
|
||||
SetText( ssprintf(sFormat, m_fTrailingScore) );
|
||||
}
|
||||
|
||||
BitmapText::Draw();
|
||||
}
|
||||
|
||||
|
||||
void ScoreDisplayNormal::AddToScore( TapNoteScore score, int iCurCombo )
|
||||
{
|
||||
//A single step's points are calculated as follows:
|
||||
//
|
||||
//Let p = score multiplier (Perfect = 10, Great = 5, other = 0)
|
||||
//N = total number of steps and freeze steps
|
||||
//n = number of the current step or freeze step (varies from 1 to N)
|
||||
//B = Base value of the song (1,000,000 X the number of feet difficulty) - All edit data is rated as 5 feet
|
||||
//So, the score for one step is:
|
||||
//one_step_score = p * (B/S) * n
|
||||
//Where S = The sum of all integers from 1 to N (the total number of steps/freeze steps)
|
||||
//
|
||||
//*IMPORTANT* : Double steps (U+L, D+R, etc.) count as two steps instead of one, so if you get a double L+R on the 112th step of a song, you score is calculated with a Perfect/Great/whatever for both the 112th and 113th steps. Got it? Now, through simple algebraic manipulation
|
||||
//S = 1+...+N = (1+N)*N/2 (1 through N added together)
|
||||
//Okay, time for an example:
|
||||
//
|
||||
//So, for example, suppose we wanted to calculate the step score of a "Great" on the 57th step of a 441 step, 8-foot difficulty song (I'm just making this one up):
|
||||
//
|
||||
//S = (1 + 441)*441 / 2
|
||||
//= 194,222 / 2
|
||||
//= 97,461
|
||||
//StepScore = p * (B/S) * n
|
||||
//= 5 * (8,000,000 / 97,461) * 57
|
||||
//= 5 * (82) * 57 (The 82 is rounded down from 82.08411...)
|
||||
//= 23,370
|
||||
//Remember this is just the score for the step, not the cumulative score up to the 57th step. Also, please note that I am currently checking into rounding errors with the system and if there are any, how they are resolved in the system.
|
||||
//
|
||||
//Note: if you got all Perfect on this song, you would get (p=10)*B, which is 80,000,000. In fact, the maximum possible score for any song is the number of feet difficulty X 10,000,000.
|
||||
|
||||
if( PREFSMAN->m_bAutoPlay )
|
||||
return; // No Scoring on Autoplay!
|
||||
|
||||
|
||||
static int iNumTimesCalled = 0;
|
||||
iNumTimesCalled ++;
|
||||
LOG->WriteLine("Called %d times - param %d.",iNumTimesCalled, iCurCombo);
|
||||
|
||||
|
||||
int p; // score multiplier
|
||||
switch( score )
|
||||
{
|
||||
case TNS_PERFECT: p = 10; break;
|
||||
case TNS_GREAT: p = 5; break;
|
||||
default: p = 0; break;
|
||||
}
|
||||
|
||||
int N = m_iTotalNotes;
|
||||
int n = iCurCombo+1;
|
||||
int B = m_iNotesMeter * 1000000;
|
||||
float S = (1+N)*N/2.0f;
|
||||
|
||||
int one_step_score = roundf( p * (B/S) * n );
|
||||
|
||||
m_fScore += one_step_score;
|
||||
ASSERT( m_fScore >= 0 );
|
||||
|
||||
// HACK: The final total is slightly off because of rounding errors
|
||||
if( fabsf(m_fScore-B*10) < 100.0f )
|
||||
m_fScore = (float)B*10;
|
||||
|
||||
this->SetScore( m_fScore );
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScoreDisplayNormal
|
||||
|
||||
Desc: A graphic displayed in the ScoreDisplayNormal during Dancing.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "ScoreDisplay.h"
|
||||
|
||||
|
||||
const int NUM_SCORE_DIGITS = 9;
|
||||
|
||||
|
||||
class ScoreDisplayNormal : public ScoreDisplay
|
||||
{
|
||||
public:
|
||||
ScoreDisplayNormal();
|
||||
|
||||
virtual void Init( PlayerNumber pn, PlayerOptions po, int iOriginalNumNotes, int iNotesMeter );
|
||||
|
||||
virtual void SetScore( float fNewScore );
|
||||
virtual int GetScore();
|
||||
virtual void AddToScore( TapNoteScore score, int iCurCombo );
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
virtual void Draw();
|
||||
|
||||
protected:
|
||||
PlayerNumber m_PlayerNumber;
|
||||
PlayerOptions m_PlayerOptions;
|
||||
int m_iTotalNotes;
|
||||
int m_iNotesMeter;
|
||||
|
||||
float m_fScore;
|
||||
|
||||
float m_fTrailingScore;
|
||||
float m_fScoreVelocity;
|
||||
};
|
||||
@@ -0,0 +1,152 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScoreDisplayOni.h
|
||||
|
||||
Desc: A graphic displayed in the ScoreDisplayOni during Dancing.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "ScoreDisplayOni.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
const float SCORE_TWEEN_TIME = 0.5f;
|
||||
|
||||
|
||||
ScoreDisplayOni::ScoreDisplayOni()
|
||||
{
|
||||
LOG->WriteLine( "ScoreDisplayOni::ScoreDisplayOni()" );
|
||||
|
||||
// init the text
|
||||
Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) );
|
||||
TurnShadowOff();
|
||||
|
||||
m_fTrailingScore = 0;
|
||||
|
||||
SetScore( 0 );
|
||||
}
|
||||
|
||||
|
||||
void ScoreDisplayOni::Init( PlayerNumber pn, PlayerOptions po, int iOriginalNumNotes, int iNotesMeter )
|
||||
{
|
||||
m_PlayerNumber = pn;
|
||||
m_PlayerOptions = po;
|
||||
m_iTotalNotes = iOriginalNumNotes;
|
||||
m_iNotesMeter = iNotesMeter;
|
||||
|
||||
//for( int i=0; i<iOriginalNumNotes; i++ )
|
||||
// AddToScore( TNS_GREAT, i );
|
||||
}
|
||||
|
||||
void ScoreDisplayOni::SetScore( float fNewScore )
|
||||
{
|
||||
m_fScore = fNewScore;
|
||||
|
||||
float fDelta = (float)m_fScore - m_fTrailingScore;
|
||||
|
||||
m_fScoreVelocity = fDelta / SCORE_TWEEN_TIME; // in score units per second
|
||||
}
|
||||
|
||||
|
||||
int ScoreDisplayOni::GetScore()
|
||||
{
|
||||
return (int)m_fScore;
|
||||
}
|
||||
|
||||
|
||||
void ScoreDisplayOni::Update( float fDeltaTime )
|
||||
{
|
||||
BitmapText::Update( fDeltaTime );
|
||||
|
||||
float fDeltaBefore = (float)m_fScore - m_fTrailingScore;
|
||||
m_fTrailingScore += m_fScoreVelocity * fDeltaTime;
|
||||
float fDeltaAfter = (float)m_fScore - m_fTrailingScore;
|
||||
|
||||
if( fDeltaBefore * fDeltaAfter < 0 ) // the sign changed
|
||||
{
|
||||
m_fTrailingScore = (float)m_fScore;
|
||||
m_fScoreVelocity = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ScoreDisplayOni::Draw()
|
||||
{
|
||||
float fSecsIntoPlay = 0;
|
||||
for( int i=0; i<GAMESTATE->m_aGameplayStatistics.GetSize(); i++ )
|
||||
fSecsIntoPlay += GAMESTATE->m_aGameplayStatistics[i].fSecsIntoPlay[m_PlayerNumber];
|
||||
int iMinsDisplay = (int)fSecsIntoPlay/60;
|
||||
int iSecsDisplay = (int)fSecsIntoPlay - iMinsDisplay*60;
|
||||
int iLeftoverDisplay = int( (fSecsIntoPlay - iMinsDisplay*60 - iSecsDisplay) * 100 );
|
||||
SetText( ssprintf( "%02d:%02d:%02d", iMinsDisplay, iSecsDisplay, iLeftoverDisplay ) );
|
||||
|
||||
BitmapText::Draw();
|
||||
}
|
||||
|
||||
|
||||
void ScoreDisplayOni::AddToScore( TapNoteScore score, int iCurCombo )
|
||||
{
|
||||
//A single step's points are calculated as follows:
|
||||
//
|
||||
//Let p = score multiplier (Perfect = 10, Great = 5, other = 0)
|
||||
//N = total number of steps and freeze steps
|
||||
//n = number of the current step or freeze step (varies from 1 to N)
|
||||
//B = Base value of the song (1,000,000 X the number of feet difficulty) - All edit data is rated as 5 feet
|
||||
//So, the score for one step is:
|
||||
//one_step_score = p * (B/S) * n
|
||||
//Where S = The sum of all integers from 1 to N (the total number of steps/freeze steps)
|
||||
//
|
||||
//*IMPORTANT* : Double steps (U+L, D+R, etc.) count as two steps instead of one, so if you get a double L+R on the 112th step of a song, you score is calculated with a Perfect/Great/whatever for both the 112th and 113th steps. Got it? Now, through simple algebraic manipulation
|
||||
//S = 1+...+N = (1+N)*N/2 (1 through N added together)
|
||||
//Okay, time for an example:
|
||||
//
|
||||
//So, for example, suppose we wanted to calculate the step score of a "Great" on the 57th step of a 441 step, 8-foot difficulty song (I'm just making this one up):
|
||||
//
|
||||
//S = (1 + 441)*441 / 2
|
||||
//= 194,222 / 2
|
||||
//= 97,461
|
||||
//StepScore = p * (B/S) * n
|
||||
//= 5 * (8,000,000 / 97,461) * 57
|
||||
//= 5 * (82) * 57 (The 82 is rounded down from 82.08411...)
|
||||
//= 23,370
|
||||
//Remember this is just the score for the step, not the cumulative score up to the 57th step. Also, please note that I am currently checking into rounding errors with the system and if there are any, how they are resolved in the system.
|
||||
//
|
||||
//Note: if you got all Perfect on this song, you would get (p=10)*B, which is 80,000,000. In fact, the maximum possible score for any song is the number of feet difficulty X 10,000,000.
|
||||
|
||||
static int iNumTimesCalled = 0;
|
||||
iNumTimesCalled ++;
|
||||
LOG->WriteLine("Called %d times - param %d.",iNumTimesCalled, iCurCombo);
|
||||
|
||||
|
||||
int p; // score multiplier
|
||||
switch( score )
|
||||
{
|
||||
case TNS_PERFECT: p = 10; break;
|
||||
case TNS_GREAT: p = 5; break;
|
||||
default: p = 0; break;
|
||||
}
|
||||
|
||||
int N = m_iTotalNotes;
|
||||
int n = iCurCombo+1;
|
||||
int B = m_iNotesMeter * 1000000;
|
||||
float S = (1+N)*N/2.0f;
|
||||
|
||||
int one_step_score = roundf( p * (B/S) * n );
|
||||
|
||||
m_fScore += one_step_score;
|
||||
ASSERT( m_fScore >= 0 );
|
||||
|
||||
// HACK: The final total is slightly off because of rounding errors
|
||||
if( fabsf(m_fScore-B*10) < 100.0f )
|
||||
m_fScore = (float)B*10;
|
||||
|
||||
this->SetScore( m_fScore );
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScoreDisplayOni
|
||||
|
||||
Desc: A graphic displayed in the ScoreDisplayOni during Dancing.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Song.h"
|
||||
#include "ScoreDisplay.h"
|
||||
|
||||
|
||||
|
||||
class ScoreDisplayOni : public ScoreDisplay
|
||||
{
|
||||
public:
|
||||
ScoreDisplayOni();
|
||||
|
||||
virtual void Init( PlayerNumber pn, PlayerOptions po, int iOriginalNumNotes, int iNotesMeter );
|
||||
|
||||
virtual void SetScore( float fNewScore );
|
||||
virtual int GetScore();
|
||||
virtual void AddToScore( TapNoteScore score, int iCurCombo );
|
||||
|
||||
virtual void Update( float fDeltaTime );
|
||||
virtual void Draw();
|
||||
|
||||
protected:
|
||||
PlayerNumber m_PlayerNumber;
|
||||
PlayerOptions m_PlayerOptions;
|
||||
int m_iTotalNotes;
|
||||
int m_iNotesMeter;
|
||||
|
||||
float m_fScore;
|
||||
|
||||
float m_fTrailingScore;
|
||||
float m_fScoreVelocity;
|
||||
};
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "Screen.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
Screen::Screen()
|
||||
{
|
||||
@@ -51,7 +52,7 @@ void Screen::Input( const DeviceInput& DeviceI, const InputEventType type, const
|
||||
if( !MenuI.IsValid() )
|
||||
return;
|
||||
|
||||
if( !GAMEMAN->IsPlayerEnabled(MenuI.player) )
|
||||
if( !GAMESTATE->IsPlayerEnabled(MenuI.player) )
|
||||
return;
|
||||
|
||||
switch( MenuI.button )
|
||||
|
||||
@@ -21,22 +21,25 @@
|
||||
#include "ScreenTitleMenu.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "StepMania.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "AnnouncerManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
AO_ANNOUNCER = 0,
|
||||
AO_THEME,
|
||||
AO_SKIN,
|
||||
NUM_APPEARANCE_OPTIONS_LINES
|
||||
};
|
||||
|
||||
OptionLineData g_AppearanceOptionsLines[NUM_APPEARANCE_OPTIONS_LINES] = {
|
||||
{ "Announcer", 1, {"OFF"} }, // fill this in on ImportOptions()
|
||||
{ "Note Skin", 0, {""} }, // fill this in on ImportOptions()
|
||||
{ "Theme", 0, {""} }, // fill this in on ImportOptions()
|
||||
{ "Note Skin", 0, {""} }, // fill this in on ImportOptions()
|
||||
};
|
||||
|
||||
ScreenAppearanceOptions::ScreenAppearanceOptions() :
|
||||
@@ -57,7 +60,9 @@ ScreenAppearanceOptions::ScreenAppearanceOptions() :
|
||||
|
||||
void ScreenAppearanceOptions::ImportOptions()
|
||||
{
|
||||
//
|
||||
// fill in announcer names
|
||||
//
|
||||
CStringArray arrayAnnouncerNames;
|
||||
ANNOUNCER->GetAnnouncerNames( arrayAnnouncerNames );
|
||||
|
||||
@@ -71,7 +76,7 @@ void ScreenAppearanceOptions::ImportOptions()
|
||||
m_iSelectedOption[0][AO_ANNOUNCER] = -1;
|
||||
for( i=1; i<m_OptionLineData[AO_ANNOUNCER].iNumOptions; i++ )
|
||||
{
|
||||
if( stricmp(m_OptionLineData[AO_ANNOUNCER].szOptionsText[i], ANNOUNCER->GetCurrentAnnouncerName())==0 )
|
||||
if( 0==stricmp(m_OptionLineData[AO_ANNOUNCER].szOptionsText[i], ANNOUNCER->GetCurAnnouncerName()) )
|
||||
{
|
||||
m_iSelectedOption[0][AO_ANNOUNCER] = i;
|
||||
break;
|
||||
@@ -81,9 +86,37 @@ void ScreenAppearanceOptions::ImportOptions()
|
||||
m_iSelectedOption[0][AO_ANNOUNCER] = 0;
|
||||
|
||||
|
||||
//
|
||||
// fill in theme names
|
||||
//
|
||||
CStringArray arrayThemeNames;
|
||||
THEME->GetThemeNames( arrayThemeNames );
|
||||
|
||||
m_OptionLineData[AO_THEME].iNumOptions = arrayThemeNames.GetSize() + 1;
|
||||
|
||||
for( i=0; i<arrayThemeNames.GetSize(); i++ )
|
||||
strcpy( m_OptionLineData[AO_THEME].szOptionsText[i+1], arrayThemeNames[i] );
|
||||
|
||||
|
||||
// highlight currently selected theme
|
||||
m_iSelectedOption[0][AO_THEME] = -1;
|
||||
for( i=1; i<m_OptionLineData[AO_THEME].iNumOptions; i++ )
|
||||
{
|
||||
if( 0==stricmp(m_OptionLineData[AO_THEME].szOptionsText[i], THEME->GetCurThemeName()) )
|
||||
{
|
||||
m_iSelectedOption[0][AO_THEME] = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( m_iSelectedOption[0][AO_THEME] == -1 )
|
||||
m_iSelectedOption[0][AO_THEME] = 0;
|
||||
|
||||
|
||||
//
|
||||
// fill in skin names
|
||||
//
|
||||
CStringArray arraySkinNames;
|
||||
GAMEMAN->GetSkinNames( arraySkinNames );
|
||||
GAMEMAN->GetNoteSkinNames( arraySkinNames );
|
||||
|
||||
m_OptionLineData[AO_SKIN].iNumOptions = arraySkinNames.GetSize();
|
||||
|
||||
@@ -94,7 +127,7 @@ void ScreenAppearanceOptions::ImportOptions()
|
||||
m_iSelectedOption[0][AO_SKIN] = -1;
|
||||
for( i=0; i<m_OptionLineData[AO_SKIN].iNumOptions; i++ )
|
||||
{
|
||||
if( stricmp(m_OptionLineData[AO_SKIN].szOptionsText[i], GAMEMAN->m_sCurrentSkin)==0 )
|
||||
if( 0==stricmp(m_OptionLineData[AO_SKIN].szOptionsText[i], GAMEMAN->GetCurNoteSkin()) )
|
||||
{
|
||||
m_iSelectedOption[0][AO_SKIN] = i;
|
||||
break;
|
||||
@@ -110,26 +143,26 @@ void ScreenAppearanceOptions::ExportOptions()
|
||||
CString sNewAnnouncer = m_OptionLineData[AO_ANNOUNCER].szOptionsText[iSelectedAnnouncer];
|
||||
if( iSelectedAnnouncer == 0 )
|
||||
sNewAnnouncer = "";
|
||||
PREFSMAN->m_sAnnouncer = sNewAnnouncer;
|
||||
ANNOUNCER->SwitchAnnouncer( sNewAnnouncer );
|
||||
|
||||
int iSelectedTheme = m_iSelectedOption[0][AO_THEME];
|
||||
CString sNewTheme = m_OptionLineData[AO_THEME].szOptionsText[iSelectedTheme];
|
||||
THEME->SwitchTheme( sNewTheme );
|
||||
|
||||
int iSelectedSkin = m_iSelectedOption[0][AO_SKIN];
|
||||
CString sNewSkin = m_OptionLineData[AO_SKIN].szOptionsText[iSelectedSkin];
|
||||
PREFSMAN->m_sNoteSkin = sNewSkin;
|
||||
GAMEMAN->m_sCurrentSkin = sNewSkin;
|
||||
GAMEMAN->SwitchNoteSkin( sNewSkin );
|
||||
}
|
||||
|
||||
void ScreenAppearanceOptions::GoToPrevState()
|
||||
{
|
||||
SCREENMAN->SetNewScreen( new ScreenTitleMenu );
|
||||
PREFSMAN->SavePrefsToDisk();
|
||||
|
||||
GoToNextState();
|
||||
}
|
||||
|
||||
void ScreenAppearanceOptions::GoToNextState()
|
||||
{
|
||||
SCREENMAN->SetNewScreen( new ScreenTitleMenu );
|
||||
PREFSMAN->SavePrefsToDisk();
|
||||
PREFSMAN->SaveGlobalPrefsToDisk();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Desc: Screen that displays while resources are being loaded.
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ScreenSelectStyle.h"
|
||||
#include "RageTextureManager.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "AnnouncerManager.h"
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ ScreenCaution::ScreenCaution()
|
||||
{
|
||||
m_sprCaution.Load( THEME->GetPathTo(GRAPHIC_CAUTION) );
|
||||
m_sprCaution.StretchTo( CRect(0,0,640,480) );
|
||||
this->AddActor( &m_sprCaution );
|
||||
this->AddSubActor( &m_sprCaution );
|
||||
|
||||
m_Wipe.OpenWipingRight( SM_DoneOpening );
|
||||
this->AddActor( &m_Wipe );
|
||||
this->AddSubActor( &m_Wipe );
|
||||
|
||||
this->SendScreenMessage( SM_StartClosing, 3 );
|
||||
}
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
#include "ScreenSelectMusic.h"
|
||||
#include "ScreenEvaluation.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "ScreenEditMenu.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameState.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
//
|
||||
@@ -87,9 +89,9 @@ ScreenEdit::ScreenEdit()
|
||||
{
|
||||
LOG->WriteLine( "ScreenEdit::ScreenEdit()" );
|
||||
|
||||
m_pSong = SONGMAN->GetCurrentSong();
|
||||
m_pSong = GAMESTATE->m_pCurSong;
|
||||
|
||||
m_pNotes = SONGMAN->m_pCurNotes[PLAYER_1];
|
||||
m_pNotes = GAMESTATE->m_pCurNotes[PLAYER_1];
|
||||
if( m_pNotes == NULL )
|
||||
{
|
||||
m_pNotes = new Notes;
|
||||
@@ -107,7 +109,7 @@ ScreenEdit::ScreenEdit()
|
||||
// GAMEMAN->m_CurStyle is set to the target game style
|
||||
// of the current edit. Naturally, this is where we'll
|
||||
// want to extract the NotesType for a (NEW) sequence.
|
||||
m_pNotes->m_NotesType = StyleToNotesType( GAMEMAN->m_CurStyle );
|
||||
m_pNotes->m_NotesType = GAMESTATE->GetCurrentStyleDef()->m_NotesType;
|
||||
|
||||
m_pSong->m_apNotes.Add( m_pNotes );
|
||||
}
|
||||
@@ -134,27 +136,27 @@ ScreenEdit::ScreenEdit()
|
||||
m_GranularityIndicator.SetZoom( 0.5f );
|
||||
|
||||
m_GrayArrowRowEdit.SetXY( EDIT_X, EDIT_GRAY_Y );
|
||||
m_GrayArrowRowEdit.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions );
|
||||
m_GrayArrowRowEdit.Load( PLAYER_1, GAMESTATE->GetCurrentStyleDef(), m_PlayerOptions );
|
||||
m_GrayArrowRowEdit.SetZoom( 0.5f );
|
||||
|
||||
m_NoteFieldEdit.SetXY( EDIT_X, EDIT_GRAY_Y );
|
||||
m_NoteFieldEdit.SetZoom( 0.5f );
|
||||
m_NoteFieldEdit.Load( ¬eData, PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions, 10, 12, NoteField::MODE_EDITING );
|
||||
m_NoteFieldEdit.Load( ¬eData, PLAYER_1, GAMESTATE->GetCurrentStyleDef(), m_PlayerOptions, 10, 12, NoteField::MODE_EDITING );
|
||||
|
||||
m_rectRecordBack.StretchTo( CRect(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
|
||||
m_rectRecordBack.SetDiffuseColor( D3DXCOLOR(0,0,0,0) );
|
||||
|
||||
m_GrayArrowRowRecord.SetXY( EDIT_X, EDIT_GRAY_Y );
|
||||
m_GrayArrowRowRecord.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions );
|
||||
m_GrayArrowRowRecord.Load( PLAYER_1, GAMESTATE->GetCurrentStyleDef(), m_PlayerOptions );
|
||||
m_GrayArrowRowRecord.SetZoom( 1.0f );
|
||||
|
||||
m_NoteFieldRecord.SetXY( EDIT_X, EDIT_GRAY_Y );
|
||||
m_NoteFieldRecord.SetZoom( 1.0f );
|
||||
m_NoteFieldRecord.Load( ¬eData, PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions, 2, 5, NoteField::MODE_EDITING );
|
||||
m_NoteFieldRecord.Load( ¬eData, PLAYER_1, GAMESTATE->GetCurrentStyleDef(), m_PlayerOptions, 2, 5, NoteField::MODE_EDITING );
|
||||
|
||||
m_Clipboard.m_iNumTracks = m_NoteFieldEdit.m_iNumTracks;
|
||||
|
||||
m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), ¬eData, PlayerOptions(), NULL, NULL, 1, 1 );
|
||||
m_Player.Load( PLAYER_1, GAMESTATE->GetCurrentStyleDef(), ¬eData, PlayerOptions(), NULL, NULL, 1, 1 );
|
||||
m_Player.SetXY( PLAYER_X, PLAYER_Y );
|
||||
|
||||
m_Fade.SetClosed();
|
||||
@@ -314,7 +316,7 @@ void ScreenEdit::Update( float fDeltaTime )
|
||||
m_fBeat,
|
||||
m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker,
|
||||
DifficultyClassToString( m_pNotes->m_DifficultyClass ),
|
||||
SONGMAN->GetCurrentNotes(PLAYER_1) ? SONGMAN->GetCurrentNotes(PLAYER_1)->m_sDescription : "no description",
|
||||
GAMESTATE->m_pCurNotes[PLAYER_1] ? GAMESTATE->m_pCurNotes[PLAYER_1]->m_sDescription : "no description",
|
||||
iNumTapNotes, iNumHoldNotes,
|
||||
m_pSong->m_fBeat0OffsetInSeconds,
|
||||
m_pSong->m_fMusicSampleStartSeconds, m_pSong->m_fMusicSampleLengthSeconds
|
||||
@@ -423,21 +425,21 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
||||
case DIK_S:
|
||||
{
|
||||
// copy edit into current Notes
|
||||
Song* pSong = SONGMAN->GetCurrentSong();
|
||||
Notes* pNotes = SONGMAN->GetCurrentNotes(PLAYER_1);
|
||||
Song* pSong = GAMESTATE->m_pCurSong;
|
||||
Notes* pNotes = GAMESTATE->m_pCurNotes[PLAYER_1];
|
||||
|
||||
if( pNotes == NULL )
|
||||
{
|
||||
// allocate a new Notes
|
||||
pNotes = new Notes;
|
||||
pSong->m_apNotes.Add( pNotes );
|
||||
pNotes->m_NotesType = GAMEMAN->m_CurNotesType;
|
||||
pNotes->m_NotesType = GAMEMAN->GetStyleDefForStyle( GAMESTATE->m_CurStyle )->m_NotesType;
|
||||
pNotes->m_sDescription = "Untitled";
|
||||
pNotes->m_iMeter = 1;
|
||||
}
|
||||
|
||||
pNotes->SetNoteData( (NoteData*)&m_NoteFieldEdit );
|
||||
SONGMAN->GetCurrentSong()->SaveToSMFile();
|
||||
GAMESTATE->m_pCurSong->SaveToSMFile();
|
||||
}
|
||||
break;
|
||||
case DIK_UP:
|
||||
@@ -567,7 +569,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
||||
|
||||
m_Mode = MODE_PLAY;
|
||||
|
||||
m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), (NoteData*)&m_NoteFieldEdit, PlayerOptions(), NULL, NULL, 1, 1 );
|
||||
m_Player.Load( PLAYER_1, GAMESTATE->GetCurrentStyleDef(), (NoteData*)&m_NoteFieldEdit, PlayerOptions(), NULL, NULL, 1, 1 );
|
||||
|
||||
m_rectRecordBack.BeginTweening( 0.5f );
|
||||
m_rectRecordBack.SetTweenDiffuseColor( D3DXCOLOR(0,0,0,0.5f) );
|
||||
@@ -882,7 +884,7 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ
|
||||
float fSongBeat, fBPS;
|
||||
bool bFreeze;
|
||||
m_pSong->GetBeatAndBPSFromElapsedTime( m_soundMusic.GetPositionSeconds(), fSongBeat, fBPS, bFreeze );
|
||||
const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow / PREFSMAN->m_SongOptions.m_fMusicRate;
|
||||
const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow / GAMESTATE->m_SongOptions.m_fMusicRate;
|
||||
|
||||
switch( StyleI.player )
|
||||
{
|
||||
|
||||
@@ -16,10 +16,11 @@
|
||||
#include "ScreenEdit.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "RageUtil.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "ScreenPrompt.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
//
|
||||
@@ -70,33 +71,33 @@ ScreenEditMenu::ScreenEditMenu()
|
||||
m_textGroup.Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textGroup.SetXY( GROUP_X, GROUP_Y );
|
||||
m_textGroup.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
||||
this->AddActor( &m_textGroup );
|
||||
this->AddSubActor( &m_textGroup );
|
||||
|
||||
m_Banner.SetXY( SONG_BANNER_X, SONG_BANNER_Y );
|
||||
this->AddActor( &m_Banner );
|
||||
this->AddSubActor( &m_Banner );
|
||||
|
||||
m_TextBanner.SetXY( SONG_TEXT_BANNER_X, SONG_TEXT_BANNER_Y );
|
||||
this->AddActor( &m_TextBanner );
|
||||
this->AddSubActor( &m_TextBanner );
|
||||
|
||||
m_sprArrowLeft.Load( THEME->GetPathTo(GRAPHIC_ARROWS_LEFT) );
|
||||
m_sprArrowLeft.SetXY( ARROWS_X[0], ARROWS_Y[0] );
|
||||
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
this->AddActor( &m_sprArrowLeft );
|
||||
this->AddSubActor( &m_sprArrowLeft );
|
||||
|
||||
m_sprArrowRight.Load( THEME->GetPathTo(GRAPHIC_ARROWS_RIGHT) );
|
||||
m_sprArrowRight.SetXY( ARROWS_X[1], ARROWS_Y[1] );
|
||||
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
this->AddActor( &m_sprArrowRight );
|
||||
this->AddSubActor( &m_sprArrowRight );
|
||||
|
||||
m_textNotesType.Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textNotesType.SetXY( GAME_STYLE_X, GAME_STYLE_Y );
|
||||
m_textNotesType.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
||||
this->AddActor( &m_textNotesType );
|
||||
this->AddSubActor( &m_textNotesType );
|
||||
|
||||
m_textNotes.Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textNotes.SetXY( STEPS_X, STEPS_Y );
|
||||
m_textNotes.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
||||
this->AddActor( &m_textNotes );
|
||||
this->AddSubActor( &m_textNotes );
|
||||
|
||||
|
||||
AfterRowChange();
|
||||
@@ -107,7 +108,7 @@ ScreenEditMenu::ScreenEditMenu()
|
||||
m_textExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y );
|
||||
m_textExplanation.SetText( EXPLANATION_TEXT );
|
||||
m_textExplanation.SetZoom( 0.7f );
|
||||
this->AddActor( &m_textExplanation );
|
||||
this->AddSubActor( &m_textExplanation );
|
||||
|
||||
m_Menu.Load(
|
||||
THEME->GetPathTo(GRAPHIC_EDIT_BACKGROUND),
|
||||
@@ -115,11 +116,11 @@ ScreenEditMenu::ScreenEditMenu()
|
||||
ssprintf("%s %s change music START to continue", CString(char(1)), CString(char(2)) ),
|
||||
false, true, 40
|
||||
);
|
||||
this->AddActor( &m_Menu );
|
||||
this->AddSubActor( &m_Menu );
|
||||
|
||||
|
||||
m_Fade.SetOpened();
|
||||
this->AddActor( &m_Fade);
|
||||
this->AddSubActor( &m_Fade);
|
||||
|
||||
|
||||
m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_CHANGE_MUSIC) );
|
||||
@@ -163,20 +164,16 @@ void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
|
||||
case SM_GoToNextState:
|
||||
// set the current style based on the notes type
|
||||
|
||||
//switch( GetSelectedNotesType() )
|
||||
//{
|
||||
//case NOTES_TYPE_DANCE_SINGLE: GAMEMAN->m_CurStyle = STYLE_DANCE_SINGLE; break;
|
||||
//case NOTES_TYPE_DANCE_DOUBLE: GAMEMAN->m_CurStyle = STYLE_DANCE_DOUBLE; break;
|
||||
//case NOTES_TYPE_DANCE_COUPLE: GAMEMAN->m_CurStyle = STYLE_DANCE_COUPLE; break;
|
||||
//case NOTES_TYPE_DANCE_SOLO: GAMEMAN->m_CurStyle = STYLE_DANCE_SOLO; break;
|
||||
//case NOTES_TYPE_PUMP_SINGLE: GAMEMAN->m_CurStyle = STYLE_PUMP_SINGLE; break;
|
||||
//case NOTES_TYPE_PUMP_DOUBLE: GAMEMAN->m_CurStyle = STYLE_PUMP_DOUBLE; break;
|
||||
//}
|
||||
|
||||
// Dro Kulix:
|
||||
// A centralized solution for this switching mess...
|
||||
// (See GameConstantsAndTypes.h)
|
||||
GAMEMAN->m_CurStyle = NotesTypeToStyle( GetSelectedNotesType() );
|
||||
//
|
||||
// Chris:
|
||||
// Find the first Style that will play the selected notes type.
|
||||
// Set the current Style, then let ScreenEdit infer the desired
|
||||
// NotesType from that Style.
|
||||
NotesType nt = GetSelectedNotesType();
|
||||
GAMESTATE->m_CurStyle = GAMEMAN->GetStyleThatPlaysNotesType( nt );
|
||||
|
||||
SCREENMAN->SetNewScreen( new ScreenEdit );
|
||||
break;
|
||||
@@ -349,9 +346,12 @@ void ScreenEditMenu::MenuStart( const PlayerNumber p )
|
||||
|
||||
MUSIC->Stop();
|
||||
|
||||
SONGMAN->SetCurrentSong( GetSelectedSong() );
|
||||
GAMEMAN->m_CurNotesType = GetSelectedNotesType();
|
||||
SONGMAN->SetCurrentNotes( PLAYER_1, GetSelectedNotes() );
|
||||
GAMESTATE->m_pCurSong = GetSelectedSong();
|
||||
|
||||
// find the first style that matches this notes type
|
||||
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
||||
GAMESTATE->m_CurStyle = GAMEMAN->GetStyleThatPlaysNotesType( GetSelectedNotesType() );
|
||||
GAMESTATE->m_pCurNotes[PLAYER_1] = GetSelectedNotes();
|
||||
|
||||
m_soundSelect.PlayRandom();
|
||||
|
||||
|
||||
+185
-171
@@ -18,10 +18,11 @@
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "Notes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "AnnouncerManager.h"
|
||||
#include "ScreenMusicScroll.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
const float BANNER_X = CENTER_X;
|
||||
@@ -66,7 +67,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
///////////////////////////
|
||||
// Set m_ResultMode. This enum will make our life easier later when we init different pieces depending on context.
|
||||
///////////////////////////
|
||||
switch( PREFSMAN->m_PlayMode )
|
||||
switch( GAMESTATE->m_PlayMode )
|
||||
{
|
||||
case PLAY_MODE_ARCADE:
|
||||
m_ResultMode = bSummary ? RM_ARCADE_SUMMARY : RM_ARCADE_STAGE;
|
||||
@@ -83,78 +84,103 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
///////////////////////////
|
||||
// Calculate total statistics depending on m_ResultMode
|
||||
///////////////////////////
|
||||
GameplayStatistics total_statistics[NUM_PLAYERS];
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
GameplayStatistics totalGS;
|
||||
switch( m_ResultMode )
|
||||
{
|
||||
PlayerNumber pn = (PlayerNumber)p;
|
||||
|
||||
if( !GAMEMAN->IsPlayerEnabled(pn) )
|
||||
continue; // skip
|
||||
|
||||
switch( m_ResultMode )
|
||||
case RM_ARCADE_STAGE:
|
||||
{
|
||||
case RM_ARCADE_STAGE:
|
||||
total_statistics[p] = SONGMAN->GetLatestGameplayStatistics((PlayerNumber)p);
|
||||
break;
|
||||
case RM_ARCADE_SUMMARY:
|
||||
// take the latest GameplayStatistics
|
||||
totalGS = GAMESTATE->m_aGameplayStatistics[GAMESTATE->m_aGameplayStatistics.GetSize()-1];
|
||||
}
|
||||
break;
|
||||
case RM_ARCADE_SUMMARY:
|
||||
case RM_ONI:
|
||||
{
|
||||
int iFirstToTakeFrom;
|
||||
switch( m_ResultMode )
|
||||
{
|
||||
int iStageIndex = PREFSMAN->GetStageIndex();
|
||||
int s = 0;
|
||||
for( int i=max(0,iStageIndex-STAGES_TO_SHOW_IN_SUMMARY); i<=iStageIndex; i++, s++ )
|
||||
case RM_ARCADE_SUMMARY:
|
||||
iFirstToTakeFrom = max( 0, GAMESTATE->m_aGameplayStatistics.GetSize()-STAGES_TO_SHOW_IN_SUMMARY );
|
||||
break;
|
||||
case RM_ONI:
|
||||
iFirstToTakeFrom = 0;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
for( int i=iFirstToTakeFrom; i<GAMESTATE->m_aGameplayStatistics.GetSize(); i++ )
|
||||
totalGS += GAMESTATE->m_aGameplayStatistics[i];
|
||||
|
||||
// Chris:
|
||||
// ugly... GameplayStatistics::operator+= simply sums the radar values, so we need
|
||||
// to divide by the number of stages taken from to normalize the values.
|
||||
int iNumTakenFrom = GAMESTATE->m_aGameplayStatistics.GetSize() - iFirstToTakeFrom;
|
||||
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
|
||||
{
|
||||
total_statistics[p] = SONGMAN->GetLatestGameplayStatistics((PlayerNumber)p);
|
||||
totalGS.fRadarActual[p][r] /= iNumTakenFrom;
|
||||
totalGS.fRadarPossible[p][r] /= iNumTakenFrom;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RM_ONI:
|
||||
{
|
||||
int iStageIndex = PREFSMAN->GetStageIndex();
|
||||
int s = 0;
|
||||
for( int i=0; i<=iStageIndex; i++ )
|
||||
total_statistics[p] = SONGMAN->GetLatestGameplayStatistics((PlayerNumber)p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Andy:
|
||||
// Fake COOL! / GOOD / OOPS for Ez2dancer using the DDR Rankings.
|
||||
if( GAMESTATE->GetCurGame() == GAME_EZ2 )
|
||||
{
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
totalGS.perfect[p] += totalGS.great[p];
|
||||
totalGS.great[p] = 0;
|
||||
totalGS.miss[p] += totalGS.boo[p];
|
||||
totalGS.boo[p] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (GAMEMAN->m_CurGame != GAME_EZ2 )
|
||||
///////////////////////////
|
||||
// Init the song banners depending on m_ResultMode
|
||||
///////////////////////////
|
||||
if( GAMESTATE->GetCurGame() != GAME_EZ2 )
|
||||
{
|
||||
///////////////////////////
|
||||
// Init the song banners depending on m_ResultMode
|
||||
///////////////////////////
|
||||
switch( m_ResultMode )
|
||||
{
|
||||
case RM_ARCADE_STAGE:
|
||||
m_BannerWithFrame[0].LoadFromSong( SONGMAN->GetCurrentSong() );
|
||||
m_BannerWithFrame[0].LoadFromSong( GAMESTATE->m_pCurSong );
|
||||
m_BannerWithFrame[0].SetXY( BANNER_X, BANNER_Y );
|
||||
this->AddActor( &m_BannerWithFrame[0] );
|
||||
this->AddSubActor( &m_BannerWithFrame[0] );
|
||||
break;
|
||||
case RM_ARCADE_SUMMARY:
|
||||
{
|
||||
// crop down to 3
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
if( SONGMAN->m_aGameplayStatistics[p].GetSize() > STAGES_TO_SHOW_IN_SUMMARY )
|
||||
SONGMAN->m_aGameplayStatistics[p].RemoveAt( 0, SONGMAN->m_aGameplayStatistics[p].GetSize() - STAGES_TO_SHOW_IN_SUMMARY );
|
||||
{
|
||||
if( GAMESTATE->m_aGameplayStatistics.GetSize() > STAGES_TO_SHOW_IN_SUMMARY )
|
||||
GAMESTATE->m_aGameplayStatistics.RemoveAt( 0, GAMESTATE->m_aGameplayStatistics.GetSize() - STAGES_TO_SHOW_IN_SUMMARY );
|
||||
}
|
||||
|
||||
const int iSongsToShow = SONGMAN->m_aGameplayStatistics[0].GetSize();
|
||||
const int iSongsToShow = GAMESTATE->m_aGameplayStatistics.GetSize();
|
||||
ASSERT( iSongsToShow > 0 );
|
||||
|
||||
for( int i=0; i<iSongsToShow; i++ )
|
||||
{
|
||||
GameplayStatistics &GS = SONGMAN->m_aGameplayStatistics[0][i];
|
||||
GameplayStatistics &GS = GAMESTATE->m_aGameplayStatistics[i];
|
||||
m_BannerWithFrame[i].LoadFromSong( GS.pSong );
|
||||
float fBannerOffset = i - (iSongsToShow-1)/2.0f;
|
||||
m_BannerWithFrame[i].SetXY( BANNER_X + fBannerOffset*32, BANNER_Y + fBannerOffset*16 );
|
||||
m_BannerWithFrame[i].SetZoom( 0.70f );
|
||||
this->AddActor( &m_BannerWithFrame[i] );
|
||||
this->AddSubActor( &m_BannerWithFrame[i] );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RM_ONI:
|
||||
m_BannerWithFrame[0].LoadFromGroup( SONGMAN->m_sPreferredGroup );
|
||||
m_BannerWithFrame[0].LoadFromGroup( GAMESTATE->m_sPreferredGroup );
|
||||
m_BannerWithFrame[0].SetXY( BANNER_X, BANNER_Y );
|
||||
this->AddActor( &m_BannerWithFrame[0] );
|
||||
this->AddSubActor( &m_BannerWithFrame[0] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -170,19 +196,19 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
"Press START to continue.",
|
||||
false, true, 40
|
||||
);
|
||||
this->AddActor( &m_Menu );
|
||||
this->AddSubActor( &m_Menu );
|
||||
|
||||
|
||||
for( l=0; l<NUM_JUDGE_LINES; l++ )
|
||||
{
|
||||
if (GAMEMAN->m_CurGame != GAME_EZ2)
|
||||
if (GAMESTATE->GetCurGame() != GAME_EZ2)
|
||||
{
|
||||
m_sprJudgeLabels[l].Load( THEME->GetPathTo(GRAPHIC_EVALUATION_JUDGE_LABELS) );
|
||||
m_sprJudgeLabels[l].StopAnimating();
|
||||
m_sprJudgeLabels[l].SetState( l );
|
||||
m_sprJudgeLabels[l].SetXY( JUDGE_LABELS_X, JUDGE_START_Y + l*JUDGE_SPACING );
|
||||
m_sprJudgeLabels[l].SetZoom( 1.0f );
|
||||
this->AddActor( &m_sprJudgeLabels[l] );
|
||||
this->AddSubActor( &m_sprJudgeLabels[l] );
|
||||
}
|
||||
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
@@ -196,23 +222,23 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
|
||||
// RE-ARRANGE the scoreboard for EZ2Dancer Scoring
|
||||
|
||||
if (l == 0 && GAMEMAN->m_CurGame == GAME_EZ2) // Change Position For Ez2dancer
|
||||
if (l == 0 && GAMESTATE->GetCurGame() == GAME_EZ2) // Change Position For Ez2dancer
|
||||
{
|
||||
m_textJudgeNumbers[l][p].SetXY( JUDGE_NUMBERS_X_EZ2[p], JUDGE_EZ2_COOL_Y);
|
||||
}
|
||||
else if (l == 2 && GAMEMAN->m_CurGame == GAME_EZ2)
|
||||
else if (l == 2 && GAMESTATE->GetCurGame() == GAME_EZ2)
|
||||
{
|
||||
m_textJudgeNumbers[l][p].SetXY( JUDGE_NUMBERS_X_EZ2[p], JUDGE_EZ2_COOL_Y + 55);
|
||||
}
|
||||
else if (l == 4 && GAMEMAN->m_CurGame == GAME_EZ2)
|
||||
else if (l == 4 && GAMESTATE->GetCurGame() == GAME_EZ2)
|
||||
{
|
||||
m_textJudgeNumbers[l][p].SetXY( JUDGE_NUMBERS_X_EZ2[p], JUDGE_EZ2_COOL_Y + 120);
|
||||
}
|
||||
else if ((l == 1 || l == 3 ) && GAMEMAN->m_CurGame == GAME_EZ2)
|
||||
else if ((l == 1 || l == 3 ) && GAMESTATE->GetCurGame() == GAME_EZ2)
|
||||
{
|
||||
m_textJudgeNumbers[l][p].SetZoomX(0); // Hide These Ones
|
||||
}
|
||||
else if (l == 5 && GAMEMAN->m_CurGame == GAME_EZ2 ) // sneakily use this one for the max combo.
|
||||
else if (l == 5 && GAMESTATE->GetCurGame() == GAME_EZ2 ) // sneakily use this one for the max combo.
|
||||
{
|
||||
if (p == PLAYER_1 )
|
||||
{
|
||||
@@ -224,117 +250,75 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
}
|
||||
}
|
||||
|
||||
this->AddActor( &m_textJudgeNumbers[l][p] );
|
||||
this->AddSubActor( &m_textJudgeNumbers[l][p] );
|
||||
}
|
||||
}
|
||||
|
||||
if (GAMEMAN->m_CurGame != GAME_EZ2)
|
||||
if (GAMESTATE->GetCurGame() != GAME_EZ2)
|
||||
{
|
||||
m_sprScoreLabel.Load( THEME->GetPathTo(GRAPHIC_EVALUATION_SCORE_LABELS) );
|
||||
m_sprScoreLabel.StopAnimating();
|
||||
m_sprScoreLabel.SetXY( SCORE_LABEL_X, SCORE_Y );
|
||||
m_sprScoreLabel.SetZoom( 1.0f );
|
||||
this->AddActor( &m_sprScoreLabel );
|
||||
this->AddSubActor( &m_sprScoreLabel );
|
||||
}
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) || GAMEMAN->m_CurGame == GAME_EZ2 )
|
||||
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) || GAMESTATE->GetCurGame() == GAME_EZ2 )
|
||||
continue; // skip
|
||||
|
||||
m_ScoreDisplay[p].SetXY( SCORE_DISPLAY_X[p], SCORE_Y );
|
||||
m_ScoreDisplay[p].SetZoomY( 0.9f );
|
||||
m_ScoreDisplay[p].SetDiffuseColor( PlayerToColor(p) );
|
||||
this->AddActor( &m_ScoreDisplay[p] );
|
||||
this->AddSubActor( &m_ScoreDisplay[p] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Calculate grades
|
||||
//
|
||||
Grade grade[NUM_PLAYERS];
|
||||
Grade max_grade = GRADE_NO_DATA;
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
PlayerNumber pn = (PlayerNumber)p;
|
||||
grade[p] = !GAMESTATE->IsPlayerEnabled(pn) ? GRADE_NO_DATA : totalGS.GetGrade(pn);
|
||||
max_grade = max( max_grade, grade[p] );
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////
|
||||
// Set Numbers
|
||||
//////////////////////////
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
continue; // skip
|
||||
|
||||
GameplayStatistics GS[NUM_PLAYERS]; // fill this in depending on m_ResultMode
|
||||
|
||||
switch( m_ResultMode )
|
||||
{
|
||||
case RM_ARCADE_STAGE:
|
||||
{
|
||||
GS[p] = SONGMAN->m_aGameplayStatistics[p][SONGMAN->m_aGameplayStatistics[p].GetSize()-1];
|
||||
}
|
||||
break;
|
||||
case RM_ARCADE_SUMMARY:
|
||||
case RM_ONI:
|
||||
{
|
||||
const int iSongsToShow = SONGMAN->m_aGameplayStatistics[0].GetSize();
|
||||
ASSERT( iSongsToShow > 0 );
|
||||
m_textJudgeNumbers[0][p].SetText( ssprintf("%4d", totalGS.perfect[p]) );
|
||||
m_textJudgeNumbers[1][p].SetText( ssprintf("%4d", totalGS.great[p]) );
|
||||
m_textJudgeNumbers[2][p].SetText( ssprintf("%4d", totalGS.good[p]) );
|
||||
m_textJudgeNumbers[3][p].SetText( ssprintf("%4d", totalGS.boo[p]) );
|
||||
m_textJudgeNumbers[4][p].SetText( ssprintf("%4d", totalGS.miss[p]) );
|
||||
m_textJudgeNumbers[5][p].SetText( ssprintf("%4d", totalGS.ok[p]) );
|
||||
|
||||
for( int i=0; i<iSongsToShow; i++ )
|
||||
{
|
||||
GameplayStatistics &GSstage = SONGMAN->m_aGameplayStatistics[p][i];
|
||||
|
||||
GS[p].iPossibleDancePoints += GSstage.iPossibleDancePoints;
|
||||
GS[p].iActualDancePoints += GSstage.iActualDancePoints;
|
||||
|
||||
GS[p].perfect += GSstage.perfect;
|
||||
GS[p].great += GSstage.great;
|
||||
GS[p].good += GSstage.good;
|
||||
GS[p].boo += GSstage.boo;
|
||||
GS[p].miss += GSstage.miss;
|
||||
GS[p].ok += GSstage.ok;
|
||||
GS[p].ng += GSstage.ng;
|
||||
GS[p].max_combo = max( GS[p].max_combo, GSstage.max_combo );
|
||||
GS[p].score += GSstage.score;
|
||||
|
||||
for( int i=0; i<NUM_RADAR_VALUES; i++ )
|
||||
{
|
||||
GS[p].fRadarPossible[i] += GSstage.fRadarPossible[i];
|
||||
GS[p].fRadarActual[i] += GSstage.fRadarActual[i];
|
||||
}
|
||||
}
|
||||
for( i=0; i<NUM_RADAR_VALUES; i++ )
|
||||
{
|
||||
GS[p].fRadarPossible[i] /= iSongsToShow;
|
||||
GS[p].fRadarActual[i] /= iSongsToShow;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (GAMEMAN->m_CurGame == GAME_EZ2) // Fake COOL! / GOOD / OOPS for Ez2dancer using the DDR Rankings.
|
||||
{
|
||||
GS[p].perfect += GS[p].great;
|
||||
GS[p].great = 0;
|
||||
GS[p].miss += GS[p].boo;
|
||||
GS[p].boo = 0;
|
||||
}
|
||||
grade[p] = GS[p].GetGrade();
|
||||
|
||||
m_textJudgeNumbers[0][p].SetText( ssprintf("%4d", GS[p].perfect) );
|
||||
m_textJudgeNumbers[1][p].SetText( ssprintf("%4d", GS[p].great) );
|
||||
m_textJudgeNumbers[2][p].SetText( ssprintf("%4d", GS[p].good) );
|
||||
m_textJudgeNumbers[3][p].SetText( ssprintf("%4d", GS[p].boo) );
|
||||
m_textJudgeNumbers[4][p].SetText( ssprintf("%4d", GS[p].miss) );
|
||||
m_textJudgeNumbers[5][p].SetText( ssprintf("%4d", GS[p].ok) );
|
||||
m_ScoreDisplay[p].SetScore( (float)totalGS.max_combo[p] * 1000 );
|
||||
m_ScoreDisplay[p].SetScore( (float)totalGS.score[p] );
|
||||
|
||||
// SNEAKY! We take the max combo, and put it into element 5, because Ez2dancer
|
||||
// doesn't care for OK's and plus this text element is already nicely aligned =)
|
||||
if (GAMEMAN->m_CurGame == GAME_EZ2)
|
||||
if (GAMESTATE->GetCurGame() == GAME_EZ2)
|
||||
{
|
||||
m_textJudgeNumbers[5][p].SetText( ssprintf("%4d", GS[p].max_combo) );
|
||||
m_textJudgeNumbers[5][p].SetText( ssprintf("%4d", totalGS.max_combo[p]) );
|
||||
}
|
||||
|
||||
m_ScoreDisplay[p].SetScore( (float)GS[p].max_combo * 1000 );
|
||||
m_ScoreDisplay[p].SetScore( (float)GS[p].score );
|
||||
m_ScoreDisplay[p].SetScore( (float)totalGS.max_combo[p] * 1000 );
|
||||
m_ScoreDisplay[p].SetScore( (float)totalGS.score[p] );
|
||||
|
||||
m_BonusInfoFrame[p].SetBonusInfo( (PlayerNumber)p, GS[p].fRadarPossible, GS[p].fRadarActual, GS[p].max_combo );
|
||||
|
||||
m_BonusInfoFrame[p].SetBonusInfo( (PlayerNumber)p, totalGS.fRadarPossible[p], totalGS.fRadarActual[p], totalGS.max_combo[p] );
|
||||
|
||||
switch( m_ResultMode )
|
||||
{
|
||||
@@ -343,15 +327,15 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
// update song stats
|
||||
////////////////////////
|
||||
|
||||
Notes* pNotes = SONGMAN->GetCurrentNotes((PlayerNumber)p);
|
||||
Notes* pNotes = GAMESTATE->m_pCurNotes[p];
|
||||
pNotes->m_iNumTimesPlayed++;
|
||||
|
||||
if( GS[p].max_combo > pNotes->m_iMaxCombo )
|
||||
pNotes->m_iMaxCombo = GS[p].max_combo;
|
||||
if( totalGS.max_combo[p] > pNotes->m_iMaxCombo )
|
||||
pNotes->m_iMaxCombo = totalGS.max_combo[p];
|
||||
|
||||
if( GS[p].score > pNotes->m_iTopScore )
|
||||
if( totalGS.score[p] > pNotes->m_iTopScore )
|
||||
{
|
||||
pNotes->m_iTopScore = (int)GS[p].score;
|
||||
pNotes->m_iTopScore = (int)totalGS.score[p];
|
||||
m_bNewRecord[p] = true;
|
||||
}
|
||||
|
||||
@@ -363,20 +347,16 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
|
||||
|
||||
|
||||
Grade max_grade = GRADE_NO_DATA;
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
max_grade = max( max_grade, grade[p] );
|
||||
|
||||
|
||||
m_bTryExtraStage = false;
|
||||
if( (PREFSMAN->IsFinalStage() || PREFSMAN->IsExtraStage()) && m_ResultMode==RM_ARCADE_STAGE )
|
||||
if( (GAMESTATE->IsFinalStage() || GAMESTATE->IsExtraStage()) && m_ResultMode==RM_ARCADE_STAGE )
|
||||
{
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
continue; // skip
|
||||
|
||||
if( SONGMAN->GetCurrentNotes((PlayerNumber)p)->m_DifficultyClass == CLASS_HARD && grade[p] >= GRADE_AA )
|
||||
if( GAMESTATE->m_pCurNotes[p]->m_DifficultyClass == CLASS_HARD && grade[p] >= GRADE_AA )
|
||||
m_bTryExtraStage = true;
|
||||
}
|
||||
}
|
||||
@@ -387,32 +367,41 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
continue; // skip
|
||||
if ( GAMEMAN->m_CurGame != GAME_EZ2)
|
||||
|
||||
if ( GAMESTATE->GetCurGame() != GAME_EZ2)
|
||||
{
|
||||
m_sprGradeFrame[p].Load( THEME->GetPathTo(GRAPHIC_EVALUATION_GRADE_FRAME) );
|
||||
m_sprGradeFrame[p].StopAnimating();
|
||||
m_sprGradeFrame[p].SetState( p );
|
||||
m_sprGradeFrame[p].SetXY( GRADE_X[p], GRADE_Y );
|
||||
this->AddActor( &m_sprGradeFrame[p] );
|
||||
this->AddSubActor( &m_sprGradeFrame[p] );
|
||||
}
|
||||
|
||||
switch( m_ResultMode )
|
||||
{
|
||||
case RM_ONI:
|
||||
m_textOniPercent[p].Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textOniPercent[p].SetXY( GRADE_X[p], GRADE_Y );
|
||||
m_textOniPercent[p].SetShadowLength( 2 );
|
||||
m_textOniPercent[p].SetZoomX( 1.5f );
|
||||
m_textOniPercent[p].SetZoomY( 3 );
|
||||
m_textOniPercent[p].SetEffectGlowing( 1.0f );
|
||||
m_textOniPercent[p].SetText( "100.0%" );
|
||||
this->AddActor( &m_textOniPercent[p] );
|
||||
{
|
||||
m_textOniPercent[p].Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textOniPercent[p].SetXY( GRADE_X[p], GRADE_Y );
|
||||
m_textOniPercent[p].SetShadowLength( 2 );
|
||||
m_textOniPercent[p].SetZoomX( 1.3f );
|
||||
m_textOniPercent[p].SetZoomY( 2.5f );
|
||||
m_textOniPercent[p].SetEffectGlowing( 1.0f );
|
||||
|
||||
int iActualDancePoints = 0;
|
||||
for( int i=0; i<GAMESTATE->m_aGameplayStatistics.GetSize(); i++ )
|
||||
iActualDancePoints += GAMESTATE->m_aGameplayStatistics[i].iActualDancePoints[p];
|
||||
int iPossibleDancePoints = GAMESTATE->m_iCoursePossibleDancePoints;
|
||||
float fPercentDancePoints = iActualDancePoints / (float)iPossibleDancePoints + 0.0001f; // correct for rounding errors
|
||||
m_textOniPercent[p].SetText( ssprintf("%.1f%%", fPercentDancePoints*100) );
|
||||
this->AddSubActor( &m_textOniPercent[p] );
|
||||
}
|
||||
break;
|
||||
case RM_ARCADE_STAGE:
|
||||
case RM_ARCADE_SUMMARY:
|
||||
if (GAMEMAN->m_CurGame != GAME_EZ2 )
|
||||
if (GAMESTATE->GetCurGame() != GAME_EZ2 )
|
||||
{
|
||||
m_Grades[p].SetXY( GRADE_X[p], GRADE_Y );
|
||||
m_Grades[p].SetZ( -2 );
|
||||
@@ -437,15 +426,15 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
m_Grades[p].SetTweenZoom( 2 );
|
||||
|
||||
}
|
||||
this->AddActor( &m_Grades[p] );
|
||||
this->AddSubActor( &m_Grades[p] );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( GAMEMAN->m_CurGame == GAME_EZ2)
|
||||
if ( GAMESTATE->GetCurGame() == GAME_EZ2)
|
||||
continue;
|
||||
|
||||
m_BonusInfoFrame[p].SetXY( BONUS_FRAME_X[p], BONUS_FRAME_Y );
|
||||
this->AddActor( &m_BonusInfoFrame[p] );
|
||||
this->AddSubActor( &m_BonusInfoFrame[p] );
|
||||
|
||||
m_bNewRecord[p] = false;
|
||||
|
||||
@@ -457,7 +446,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
m_textNewRecord[p].SetText( "IT'S A NEW RECORD!" );
|
||||
m_textNewRecord[p].SetZoom( 0.5f );
|
||||
m_textNewRecord[p].SetEffectGlowing( 1.0f );
|
||||
this->AddActor( &m_textNewRecord[p] );
|
||||
this->AddSubActor( &m_textNewRecord[p] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,36 +455,61 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
{
|
||||
m_textTryExtraStage.Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textTryExtraStage.SetXY( TRY_EXTRA_STAGE_X, TRY_EXTRA_STAGE_Y );
|
||||
if( PREFSMAN->IsExtraStage() )
|
||||
if( GAMESTATE->IsExtraStage() )
|
||||
m_textTryExtraStage.SetText( "Try Another Extra Stage!" );
|
||||
else
|
||||
m_textTryExtraStage.SetText( "Try Extra Stage!" );
|
||||
m_textTryExtraStage.SetZoom( 1 );
|
||||
m_textTryExtraStage.SetEffectGlowing( 1.0f );
|
||||
this->AddActor( &m_textTryExtraStage );
|
||||
this->AddSubActor( &m_textTryExtraStage );
|
||||
|
||||
SOUND->PlayOnceStreamed( THEME->GetPathTo(SOUND_EVALUATION_EXTRA_STAGE) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
switch( max_grade )
|
||||
switch( m_ResultMode )
|
||||
{
|
||||
case GRADE_D: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_D) ); break;
|
||||
case GRADE_C: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_C) ); break;
|
||||
case GRADE_B: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_B) ); break;
|
||||
case GRADE_A: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_A) ); break;
|
||||
case GRADE_AA: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_AA) ); break;
|
||||
case GRADE_AAA: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_AAA) ); break;
|
||||
case GRADE_NO_DATA:
|
||||
case RM_ARCADE_STAGE:
|
||||
switch( max_grade )
|
||||
{
|
||||
case GRADE_E: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_E) ); break;
|
||||
case GRADE_D: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_D) ); break;
|
||||
case GRADE_C: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_C) ); break;
|
||||
case GRADE_B: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_B) ); break;
|
||||
case GRADE_A: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_A) ); break;
|
||||
case GRADE_AA: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_AA) ); break;
|
||||
case GRADE_AAA: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_AAA) ); break;
|
||||
case GRADE_NO_DATA:
|
||||
default:
|
||||
ASSERT(0); // invalid grade
|
||||
}
|
||||
break;
|
||||
case RM_ONI:
|
||||
case RM_ARCADE_SUMMARY:
|
||||
switch( max_grade )
|
||||
{
|
||||
case GRADE_E: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_FINAL_E) ); break;
|
||||
case GRADE_D: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_FINAL_D) ); break;
|
||||
case GRADE_C: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_FINAL_C) ); break;
|
||||
case GRADE_B: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_FINAL_B) ); break;
|
||||
case GRADE_A: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_FINAL_A) ); break;
|
||||
case GRADE_AA: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_FINAL_AA) ); break;
|
||||
case GRADE_AAA: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_EVALUATION_FINAL_AAA) ); break;
|
||||
case GRADE_NO_DATA:
|
||||
default:
|
||||
ASSERT(0); // invalid grade
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ASSERT(0); // invalid grade
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
m_Menu.TweenOnScreenFromBlack( SM_None );
|
||||
}
|
||||
|
||||
|
||||
void ScreenEvaluation::TweenOnScreen()
|
||||
{
|
||||
int i, p;
|
||||
@@ -515,7 +529,7 @@ void ScreenEvaluation::TweenOnScreen()
|
||||
|
||||
for( i=0; i<NUM_JUDGE_LINES; i++ )
|
||||
{
|
||||
if (GAMEMAN->m_CurGame != GAME_EZ2)
|
||||
if (GAMESTATE->GetCurGame() != GAME_EZ2)
|
||||
{
|
||||
fOriginalY = m_sprJudgeLabels[i].GetY();
|
||||
m_sprJudgeLabels[i].SetY( fOriginalY + SCREEN_HEIGHT );
|
||||
@@ -534,7 +548,7 @@ void ScreenEvaluation::TweenOnScreen()
|
||||
}
|
||||
}
|
||||
|
||||
if (GAMEMAN->m_CurGame != GAME_EZ2)
|
||||
if (GAMESTATE->GetCurGame() != GAME_EZ2)
|
||||
{
|
||||
|
||||
fOriginalY = m_sprScoreLabel.GetY();
|
||||
@@ -590,7 +604,7 @@ void ScreenEvaluation::TweenOffScreen()
|
||||
|
||||
for( i=0; i<NUM_JUDGE_LINES; i++ )
|
||||
{
|
||||
if (GAMEMAN->m_CurGame != GAME_EZ2)
|
||||
if (GAMESTATE->GetCurGame() != GAME_EZ2)
|
||||
{
|
||||
m_sprJudgeLabels[i].BeginTweeningQueued( MENU_ELEMENTS_TWEEN_TIME, Actor::TWEEN_BIAS_END );
|
||||
m_sprJudgeLabels[i].SetTweenZoomY( 0 );
|
||||
@@ -603,7 +617,7 @@ void ScreenEvaluation::TweenOffScreen()
|
||||
}
|
||||
}
|
||||
|
||||
if (GAMEMAN->m_CurGame != GAME_EZ2)
|
||||
if (GAMESTATE->GetCurGame() != GAME_EZ2)
|
||||
{
|
||||
m_sprScoreLabel.BeginTweeningQueued( MENU_ELEMENTS_TWEEN_TIME, Actor::TWEEN_BIAS_END );
|
||||
m_sprScoreLabel.SetTweenZoomY( 0 );
|
||||
@@ -690,7 +704,7 @@ void ScreenEvaluation::MenuStart( const PlayerNumber p )
|
||||
|
||||
if( PREFSMAN->m_bEventMode )
|
||||
{
|
||||
PREFSMAN->m_iCurrentStageIndex++;
|
||||
GAMESTATE->m_iCurrentStageIndex++;
|
||||
m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic );
|
||||
return;
|
||||
}
|
||||
@@ -703,19 +717,19 @@ void ScreenEvaluation::MenuStart( const PlayerNumber p )
|
||||
case RM_ARCADE_STAGE:
|
||||
if( m_bTryExtraStage )
|
||||
{
|
||||
PREFSMAN->m_iCurrentStageIndex++;
|
||||
GAMESTATE->m_iCurrentStageIndex++;
|
||||
m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic );
|
||||
}
|
||||
else if(
|
||||
PREFSMAN->m_iCurrentStageIndex == PREFSMAN->m_iNumArcadeStages-1 ||
|
||||
PREFSMAN->IsExtraStage() ||
|
||||
PREFSMAN->IsExtraStage2() )
|
||||
GAMESTATE->m_iCurrentStageIndex == PREFSMAN->m_iNumArcadeStages-1 ||
|
||||
GAMESTATE->IsExtraStage() ||
|
||||
GAMESTATE->IsExtraStage2() )
|
||||
{
|
||||
m_Menu.TweenOffScreenToMenu( SM_GoToFinalEvaluation );
|
||||
}
|
||||
else
|
||||
{
|
||||
PREFSMAN->m_iCurrentStageIndex++;
|
||||
GAMESTATE->m_iCurrentStageIndex++;
|
||||
m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic );
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "GradeDisplay.h"
|
||||
#include "MenuElements.h"
|
||||
#include "Banner.h"
|
||||
#include "ScoreDisplayRolling.h"
|
||||
#include "ScoreDisplayNormal.h"
|
||||
#include "BonusInfoFrame.h"
|
||||
#include "BannerWithFrame.h"
|
||||
|
||||
@@ -58,7 +58,7 @@ protected:
|
||||
BitmapText m_textJudgeNumbers[NUM_JUDGE_LINES][NUM_PLAYERS];
|
||||
|
||||
Sprite m_sprScoreLabel;
|
||||
ScoreDisplayRolling m_ScoreDisplay[NUM_PLAYERS];
|
||||
ScoreDisplayNormal m_ScoreDisplay[NUM_PLAYERS];
|
||||
|
||||
bool m_bNewRecord[NUM_PLAYERS];
|
||||
BitmapText m_textNewRecord[NUM_PLAYERS];
|
||||
|
||||
@@ -15,13 +15,14 @@ Andrew Livy
|
||||
#include "ScreenTitleMenu.h"
|
||||
#include "ScreenCaution.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ScreenSelectDifficulty.h"
|
||||
#include "ScreenSandbox.h"
|
||||
#include "GameManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "AnnouncerManager.h"
|
||||
#include "ScreenEz2SelectStyle.h"
|
||||
#include "GameState.h"
|
||||
|
||||
/* Constants */
|
||||
|
||||
@@ -58,9 +59,9 @@ ScreenEz2SelectPlayer::ScreenEz2SelectPlayer()
|
||||
LOG->WriteLine( "ScreenEz2SelectPlayer::ScreenEz2SelectPlayer()" );
|
||||
ez2_lasttimercheck[0] = TIMER->GetTimeSinceStart();
|
||||
ez2_lasttimercheck[1] = 0.0f;
|
||||
m_iSelectedStyle=3; // set to invalid style
|
||||
GAMEMAN->m_CurStyle = STYLE_NONE;
|
||||
GAMEMAN->m_sMasterPlayerNumber = PLAYER_INVALID;
|
||||
m_iSelectedStyle=0;
|
||||
GAMESTATE->m_CurStyle = STYLE_NONE;
|
||||
GAMESTATE->m_MasterPlayerNumber = PLAYER_INVALID;
|
||||
|
||||
// Load in the sprites we will be working with.
|
||||
for( int i=0; i<NUM_EZ2_GRAPHICS; i++ )
|
||||
@@ -84,7 +85,7 @@ ScreenEz2SelectPlayer::ScreenEz2SelectPlayer()
|
||||
m_sprOpt[i].Load( sPadGraphicPath );
|
||||
m_sprOpt[i].SetXY( OPT_X[i], OPT_Y[i] );
|
||||
m_sprOpt[i].SetZoom( 1 );
|
||||
this->AddActor( &m_sprOpt[i] );
|
||||
this->AddSubActor( &m_sprOpt[i] );
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +95,7 @@ ScreenEz2SelectPlayer::ScreenEz2SelectPlayer()
|
||||
ssprintf("Press %c on the pad you wish to play on", char(4) ),
|
||||
false, true, 40
|
||||
);
|
||||
this->AddActor( &m_Menu );
|
||||
this->AddSubActor( &m_Menu );
|
||||
|
||||
m_soundChange.Load( THEME->GetPathTo(SOUND_SELECT_STYLE_CHANGE) );
|
||||
m_soundSelect.Load( THEME->GetPathTo(SOUND_MENU_START) );
|
||||
@@ -181,18 +182,18 @@ void ScreenEz2SelectPlayer::DrawPrimitives()
|
||||
|
||||
if (m_iSelectedStyle == 0) // only the left pad was selected
|
||||
{
|
||||
GAMEMAN->m_sMasterPlayerNumber = PLAYER_1;
|
||||
GAMEMAN->m_CurStyle = STYLE_EZ2_SINGLE;
|
||||
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
||||
GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE;
|
||||
}
|
||||
else if (m_iSelectedStyle == 1) // only the right pad was selected
|
||||
{
|
||||
GAMEMAN->m_sMasterPlayerNumber = PLAYER_2;
|
||||
GAMEMAN->m_CurStyle = STYLE_EZ2_SINGLE;
|
||||
GAMESTATE->m_MasterPlayerNumber = PLAYER_2;
|
||||
GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE;
|
||||
}
|
||||
else // they both selected
|
||||
{
|
||||
GAMEMAN->m_sMasterPlayerNumber = PLAYER_1;
|
||||
GAMEMAN->m_CurStyle = STYLE_EZ2_SINGLE_VERSUS;
|
||||
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
||||
GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE_VERSUS;
|
||||
}
|
||||
|
||||
MUSIC->Stop();
|
||||
@@ -287,9 +288,11 @@ void ScreenEz2SelectPlayer::MenuStart( PlayerNumber p )
|
||||
}
|
||||
|
||||
// figure out whether we should add a player into the fray or not
|
||||
// if( GAMEMAN->m_sMasterPlayerNumber != PLAYER_2 && GAMEMAN->m_sMasterPlayerNumber != PLAYER_1 )
|
||||
// if( GAMESTATE->m_MasterPlayerNumber != PLAYER_2 && GAMESTATE->m_MasterPlayerNumber != PLAYER_1 )
|
||||
if (m_iSelectedStyle == 3)
|
||||
{
|
||||
GAMESTATE->m_MasterPlayerNumber = p;
|
||||
|
||||
if (p == PLAYER_1)
|
||||
{
|
||||
m_iSelectedStyle = 0;
|
||||
|
||||
@@ -18,7 +18,7 @@ and sloppy and err needs cleaning up ;)
|
||||
#include "ScreenTitleMenu.h"
|
||||
#include "ScreenCaution.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ScreenSelectDifficulty.h"
|
||||
#include "ScreenSandbox.h"
|
||||
#include "GameManager.h"
|
||||
@@ -27,6 +27,7 @@ and sloppy and err needs cleaning up ;)
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "Background.h"
|
||||
#include "ScreenSelectGroup.h"
|
||||
#include "GameState.h"
|
||||
|
||||
/* Constants */
|
||||
|
||||
@@ -146,7 +147,7 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle()
|
||||
m_sprBackground[i].Load( sPadGraphicPath );
|
||||
m_sprBackground[i].SetXY( CENTER_X, CENTER_Y );
|
||||
m_sprBackground[i].SetZoom( 1 );
|
||||
this->AddActor( &m_sprBackground[i] );
|
||||
this->AddSubActor( &m_sprBackground[i] );
|
||||
}
|
||||
|
||||
for( i=0; i<NUM_EZ2STYLE_GRAPHICS; i++ )
|
||||
@@ -170,7 +171,7 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle()
|
||||
m_sprOpt[i].Load( sPadGraphicPath );
|
||||
m_sprOpt[i].SetXY( OPT_X[i], OPT_Y[i] );
|
||||
m_sprOpt[i].SetZoom( 1 );
|
||||
this->AddActor( &m_sprOpt[i] );
|
||||
this->AddSubActor( &m_sprOpt[i] );
|
||||
}
|
||||
|
||||
for( i=0; i<NUM_EZ2P_GRAPHICS; i++ )
|
||||
@@ -194,16 +195,16 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle()
|
||||
m_sprPly[i].Load( sPadGraphicPath );
|
||||
m_sprPly[i].SetXY( OPT_XP[i], OPT_YP[i] );
|
||||
m_sprPly[i].SetZoom( 1 );
|
||||
this->AddActor( &m_sprPly[i] );
|
||||
this->AddSubActor( &m_sprPly[i] );
|
||||
}
|
||||
|
||||
m_Menu.Load(
|
||||
THEME->GetPathTo(GRAPHIC_SELECT_STYLE_PREVIEW_GAME_0_STYLE_0),
|
||||
THEME->GetPathTo(GRAPHIC_SELECT_STYLE_BACKGROUND),
|
||||
THEME->GetPathTo(GRAPHIC_SELECT_STYLE_TOP_EDGE),
|
||||
ssprintf("Use %c %c to select, then press START", char(1), char(2) ),
|
||||
false, true, 40
|
||||
);
|
||||
this->AddActor( &m_Menu );
|
||||
this->AddSubActor( &m_Menu );
|
||||
|
||||
m_soundChange.Load( THEME->GetPathTo(SOUND_SELECT_STYLE_CHANGE) );
|
||||
m_soundSelect.Load( THEME->GetPathTo(SOUND_MENU_START) );
|
||||
@@ -218,7 +219,7 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle()
|
||||
MUSIC->Play( true );
|
||||
}
|
||||
|
||||
if ( GAMEMAN->m_sMasterPlayerNumber == PLAYER_1 && GAMEMAN->m_CurStyle == STYLE_EZ2_SINGLE) //if p1 already selected hide graphic.
|
||||
if ( GAMESTATE->m_MasterPlayerNumber == PLAYER_1 && GAMESTATE->m_CurStyle == STYLE_EZ2_SINGLE) //if p1 already selected hide graphic.
|
||||
{
|
||||
m_iSelectedPlayer = 0;
|
||||
m_sprPly[1].BeginTweening( 0 );
|
||||
@@ -226,7 +227,7 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle()
|
||||
m_sprPly[2].BeginTweening( 0 );
|
||||
m_sprPly[2].SetTweenZoomY( 0 );
|
||||
}
|
||||
else if ( GAMEMAN->m_sMasterPlayerNumber == PLAYER_2 && GAMEMAN->m_CurStyle == STYLE_EZ2_SINGLE) //if p2 already selected hide graphic.
|
||||
else if ( GAMESTATE->m_MasterPlayerNumber == PLAYER_2 && GAMESTATE->m_CurStyle == STYLE_EZ2_SINGLE) //if p2 already selected hide graphic.
|
||||
{
|
||||
m_iSelectedPlayer = 1;
|
||||
m_sprPly[3].BeginTweening( 0 );
|
||||
@@ -256,7 +257,7 @@ ScreenEz2SelectStyle::ScreenEz2SelectStyle()
|
||||
MenuLeft( PLAYER_1 ); // shift left so that we're clean again.
|
||||
|
||||
}
|
||||
GAMEMAN->m_CurStyle = STYLE_NONE; // why reset this? because we want player2 to be able to input at this stage.
|
||||
GAMESTATE->m_CurStyle = STYLE_NONE; // why reset this? because we want player2 to be able to input at this stage.
|
||||
|
||||
|
||||
m_Menu.TweenOnScreenFromBlack( SM_None );
|
||||
@@ -324,7 +325,6 @@ void ScreenEz2SelectStyle::HandleScreenMessage( const ScreenMessage SM )
|
||||
|
||||
if (m_iSelectedStyle == 0) // easy
|
||||
{
|
||||
GAMEMAN->m_CurStyle = STYLE_EZ2_SINGLE_VERSUS;
|
||||
}
|
||||
else if (m_iSelectedStyle == 1) // hard
|
||||
{
|
||||
@@ -334,7 +334,7 @@ void ScreenEz2SelectStyle::HandleScreenMessage( const ScreenMessage SM )
|
||||
}
|
||||
else if (m_iSelectedStyle == 2) // real
|
||||
{
|
||||
GAMEMAN->m_CurStyle = STYLE_EZ2_REAL_VERSUS;
|
||||
GAMESTATE->m_CurStyle = STYLE_EZ2_REAL_VERSUS;
|
||||
//m_soundInvalid.PlayRandom();
|
||||
//return;
|
||||
}
|
||||
@@ -352,17 +352,17 @@ void ScreenEz2SelectStyle::HandleScreenMessage( const ScreenMessage SM )
|
||||
}
|
||||
else if (m_iSelectedStyle == 2) // real
|
||||
{
|
||||
GAMEMAN->m_CurStyle = STYLE_EZ2_REAL;
|
||||
GAMESTATE->m_CurStyle = STYLE_EZ2_REAL;
|
||||
}
|
||||
else // club
|
||||
{
|
||||
GAMEMAN->m_CurStyle = STYLE_EZ2_DOUBLE;
|
||||
GAMEMAN->m_sMasterPlayerNumber = PLAYER_1;
|
||||
GAMESTATE->m_CurStyle = STYLE_EZ2_DOUBLE;
|
||||
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
||||
}
|
||||
}
|
||||
|
||||
m_soundSelect.PlayRandom();
|
||||
PREFSMAN->m_PlayMode = PLAY_MODE_ARCADE;
|
||||
GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE;
|
||||
SCREENMAN->SetNewScreen( new ScreenSelectGroup );
|
||||
|
||||
break;
|
||||
@@ -388,7 +388,7 @@ void ScreenEz2SelectStyle::MenuBack( const PlayerNumber p )
|
||||
MUSIC->Stop();
|
||||
|
||||
m_Menu.TweenOffScreenToBlack( SM_GoToPrevState, true );
|
||||
GAMEMAN->m_CurStyle = STYLE_NONE; // Make sure that both players can scroll around title menu...
|
||||
GAMESTATE->m_CurStyle = STYLE_NONE; // Make sure that both players can scroll around title menu...
|
||||
|
||||
// m_Fade.CloseWipingLeft( SM_GoToPrevState );
|
||||
|
||||
@@ -687,7 +687,7 @@ presses the button bound to start
|
||||
************************************/
|
||||
void ScreenEz2SelectStyle::MenuStart( PlayerNumber p )
|
||||
{
|
||||
// GAMEMAN->m_CurStyle = DANCE_STYLES[m_iSelectedStyle];
|
||||
// GAMESTATE->m_CurStyle = DANCE_STYLES[m_iSelectedStyle];
|
||||
|
||||
if ((m_iSelectedPlayer == 0 && p == PLAYER_2) || (m_iSelectedPlayer == 1 && p == PLAYER_1))
|
||||
{
|
||||
@@ -742,14 +742,15 @@ void ScreenEz2SelectStyle::MenuStart( PlayerNumber p )
|
||||
}
|
||||
else if (m_iSelectedStyle == 2) // real
|
||||
{
|
||||
GAMEMAN->m_CurStyle = STYLE_EZ2_REAL;
|
||||
GAMESTATE->m_CurStyle = STYLE_EZ2_REAL;
|
||||
//m_soundInvalid.PlayRandom();
|
||||
//return;
|
||||
}
|
||||
else // club
|
||||
{
|
||||
GAMEMAN->m_CurStyle = STYLE_EZ2_DOUBLE;
|
||||
GAMEMAN->m_sMasterPlayerNumber = PLAYER_1;
|
||||
GAMESTATE->m_CurStyle = STYLE_EZ2_DOUBLE;
|
||||
GAMESTATE->m_CurStyle = STYLE_EZ2_DOUBLE;
|
||||
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
||||
//m_soundInvalid.PlayRandom();
|
||||
//return;
|
||||
}
|
||||
@@ -758,7 +759,7 @@ void ScreenEz2SelectStyle::MenuStart( PlayerNumber p )
|
||||
|
||||
this->ClearMessageQueue();
|
||||
|
||||
PREFSMAN->m_PlayMode = PLAY_MODE_ARCADE;
|
||||
GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE;
|
||||
|
||||
m_Menu.TweenOffScreenToMenu( SM_GoToNextState );
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "ScreenGameOver.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "TransitionFadeWipe.h"
|
||||
#include "Sprite.h"
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "ScreenManager.h"
|
||||
#include "ScreenTitleMenu.h"
|
||||
#include "AnnouncerManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1);
|
||||
const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User + 2);
|
||||
@@ -27,9 +29,11 @@ const ScreenMessage SM_PlayAnnouncer = ScreenMessage(SM_User + 3);
|
||||
|
||||
ScreenGameOver::ScreenGameOver()
|
||||
{
|
||||
m_bClosing = false;
|
||||
|
||||
m_sprGameOver.Load( THEME->GetPathTo(GRAPHIC_GAME_OVER) );
|
||||
m_sprGameOver.SetXY( CENTER_X, CENTER_Y );
|
||||
this->AddActor( &m_sprGameOver );
|
||||
this->AddSubActor( &m_sprGameOver );
|
||||
|
||||
// tween game over
|
||||
m_sprGameOver.SetAddColor( D3DXCOLOR(1,1,1,0) );
|
||||
@@ -45,7 +49,7 @@ ScreenGameOver::ScreenGameOver()
|
||||
m_sprGameOver.SetTweenAddColor( D3DXCOLOR(1,1,1,0) );
|
||||
|
||||
// BUGFIX by ANDY: Stage will now reset back to 0 when game ends.
|
||||
PREFSMAN->m_iCurrentStageIndex = 0;
|
||||
GAMESTATE->m_iCurrentStageIndex = 0;
|
||||
|
||||
this->SendScreenMessage( SM_PlayAnnouncer, 0.5 );
|
||||
this->SendScreenMessage( SM_StartFadingOut, 5 );
|
||||
@@ -60,6 +64,7 @@ void ScreenGameOver::HandleScreenMessage( const ScreenMessage SM )
|
||||
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_GAME_OVER) );
|
||||
break;
|
||||
case SM_StartFadingOut:
|
||||
m_bClosing = true;
|
||||
m_sprGameOver.BeginTweening( 0.8f );
|
||||
m_sprGameOver.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
this->SendScreenMessage( SM_GoToNextState, 0.8f );
|
||||
@@ -72,6 +77,9 @@ void ScreenGameOver::HandleScreenMessage( const ScreenMessage SM )
|
||||
|
||||
void ScreenGameOver::MenuStart( PlayerNumber p )
|
||||
{
|
||||
if( m_bClosing )
|
||||
return;
|
||||
|
||||
this->ClearMessageQueue();
|
||||
this->SendScreenMessage( SM_StartFadingOut, 0 );
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ public:
|
||||
virtual void MenuStart( const PlayerNumber p );
|
||||
|
||||
private:
|
||||
|
||||
bool m_bClosing;
|
||||
Sprite m_sprGameOver;
|
||||
};
|
||||
|
||||
|
||||
+239
-169
@@ -17,19 +17,24 @@
|
||||
#include "ScreenSelectMusic.h"
|
||||
#include "ScreenEvaluation.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "SongManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "AnnouncerManager.h"
|
||||
#include "ScreenGameOver.h"
|
||||
#include "LifeMeterBar.h"
|
||||
#include "LifeMeterBattery.h"
|
||||
#include "GameState.h"
|
||||
#include "ScoreDisplayNormal.h"
|
||||
#include "ScoreDisplayOni.h"
|
||||
|
||||
//
|
||||
// Defines specific to GameScreenTitleMenu
|
||||
// Defines
|
||||
//
|
||||
|
||||
const float LIFE_LOCAL_X[NUM_PLAYERS] = { -180, +180 };
|
||||
const float LIFE_LOCAL_Y[NUM_PLAYERS] = { -10, -10 };
|
||||
const float LIFE_LOCAL_Y[NUM_PLAYERS] = { -8, -8 };
|
||||
|
||||
const float STAGE_NUMBER_LOCAL_X = 0;
|
||||
const float STAGE_NUMBER_LOCAL_Y = +20;
|
||||
@@ -50,12 +55,13 @@ const float DIFFICULTY_Y[NUM_PLAYERS] = { SCREEN_BOTTOM-70, SCREEN_BOTTOM-70 };
|
||||
const float DEBUG_X = CENTER_X;
|
||||
const float DEBUG_Y = CENTER_Y-70;
|
||||
|
||||
const float TIME_BETWEEN_DANCING_COMMENTS = 15;
|
||||
const float TIME_BETWEEN_DANCING_COMMENTS = 13;
|
||||
|
||||
|
||||
// received while STATE_DANCING
|
||||
const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+102);
|
||||
const ScreenMessage SM_LifeIs0 = ScreenMessage(SM_User+103);
|
||||
const ScreenMessage SM_LastNotesEnded = ScreenMessage(SM_User+103);
|
||||
const ScreenMessage SM_LifeIs0 = ScreenMessage(SM_User+104);
|
||||
|
||||
|
||||
// received while STATE_OUTRO
|
||||
@@ -75,37 +81,33 @@ ScreenGameplay::ScreenGameplay()
|
||||
{
|
||||
LOG->WriteLine( "ScreenGameplay::ScreenGameplay()" );
|
||||
|
||||
m_pCurSong = NULL;
|
||||
|
||||
switch( PREFSMAN->m_PlayMode )
|
||||
switch( GAMESTATE->m_PlayMode )
|
||||
{
|
||||
case PLAY_MODE_ARCADE:
|
||||
{
|
||||
m_apSongQueue.Add( SONGMAN->GetCurrentSong() );
|
||||
m_apSongQueue.Add( GAMESTATE->m_pCurSong );
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
m_apNotesQueue[p].Add( SONGMAN->GetCurrentNotes(PlayerNumber(p)) );
|
||||
m_apNotesQueue[p].Add( GAMESTATE->m_pCurNotes[p] );
|
||||
}
|
||||
break;
|
||||
case PLAY_MODE_ONI:
|
||||
{
|
||||
Course* pCourse = SONGMAN->m_pCurCourse;
|
||||
Course* pCourse = GAMESTATE->m_pCurCourse;
|
||||
ASSERT( pCourse != NULL );
|
||||
for( int i=0; i<pCourse->m_iStages; i++ )
|
||||
{
|
||||
Song* pSong = pCourse->m_apSongs[i];
|
||||
DifficultyClass dc = pCourse->m_aDifficultyClasses[i];
|
||||
|
||||
for( int j=0; j<pSong->m_apNotes.GetSize(); j++ )
|
||||
{
|
||||
Notes* pNotes = pSong->m_apNotes[j];
|
||||
if( pSong->m_apNotes[j]->m_DifficultyClass == dc )
|
||||
{
|
||||
m_apSongQueue.Add( pSong );
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
m_apNotesQueue[p].Add( pNotes );
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_apSongQueue.RemoveAll();
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
m_apNotesQueue[p].RemoveAll();
|
||||
|
||||
pCourse->GetSongAndNotesForCurrentStyle( m_apSongQueue, m_apNotesQueue );
|
||||
|
||||
// store possible dance points in GAMESTATE
|
||||
GAMESTATE->m_iCoursePossibleDancePoints = 0;
|
||||
for( int i=0; i<m_apNotesQueue[PLAYER_1].GetSize(); i++ )
|
||||
{
|
||||
NoteData nd;
|
||||
m_apNotesQueue[PLAYER_1][i]->GetNoteData( &nd );
|
||||
GAMESTATE->m_iCoursePossibleDancePoints += nd.GetPossibleDancePoints();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -118,62 +120,65 @@ ScreenGameplay::ScreenGameplay()
|
||||
|
||||
|
||||
m_Background.SetDiffuseColor( D3DXCOLOR(0.4f,0.4f,0.4f,1) );
|
||||
this->AddActor( &m_Background );
|
||||
this->AddSubActor( &m_Background );
|
||||
|
||||
|
||||
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
continue;
|
||||
|
||||
m_Player[p].SetX( (float) GAMEMAN->GetCurrentStyleDef()->m_iCenterX[p] );
|
||||
this->AddActor( &m_Player[p] );
|
||||
m_Player[p].SetX( (float) GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p] );
|
||||
this->AddSubActor( &m_Player[p] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
// Add all Actors to m_frameTop
|
||||
//////////////////////////////////
|
||||
this->AddActor( &m_frameTop );
|
||||
this->AddSubActor( &m_frameTop );
|
||||
|
||||
// LifeMeter goes underneath top frame
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
m_quadLifeMeterBG[p].SetXY( LIFE_LOCAL_X[p], LIFE_LOCAL_Y[p] );
|
||||
m_quadLifeMeterBG[p].SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
|
||||
m_quadLifeMeterBG[p].SetZoomX( 256 );
|
||||
m_quadLifeMeterBG[p].SetZoomY( (p==PLAYER_1) ? 20.0f : -20.0f );
|
||||
m_frameTop.AddActor( &m_quadLifeMeterBG[p] );
|
||||
switch( GAMESTATE->m_PlayMode )
|
||||
{
|
||||
case PLAY_MODE_ARCADE:
|
||||
m_pLifeMeter[p] = new LifeMeterBar;
|
||||
break;
|
||||
case PLAY_MODE_ONI:
|
||||
m_pLifeMeter[p] = new LifeMeterBattery;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
continue;
|
||||
|
||||
m_LifeMeter[p].SetPlayerOptions( PREFSMAN->m_PlayerOptions[p] );
|
||||
m_LifeMeter[p].SetXY( LIFE_LOCAL_X[p], LIFE_LOCAL_Y[p] );
|
||||
m_LifeMeter[p].SetZoomX( 256 );
|
||||
m_LifeMeter[p].SetZoomY( (p==PLAYER_1) ? 20.0f : -20.0f );
|
||||
m_frameTop.AddActor( &m_LifeMeter[p] );
|
||||
m_pLifeMeter[p]->Load( (PlayerNumber)p, GAMESTATE->m_PlayerOptions[p] );
|
||||
m_pLifeMeter[p]->SetXY( LIFE_LOCAL_X[p], LIFE_LOCAL_Y[p] );
|
||||
m_frameTop.AddSubActor( m_pLifeMeter[p] );
|
||||
|
||||
if ( GAMEMAN->m_CurGame == GAME_EZ2 )
|
||||
if( GAMESTATE->GetCurGame() == GAME_EZ2 )
|
||||
{
|
||||
m_ScoreDisplay[p].SetXY( SCORE_LOCALEZ2_X[p], SCORE_LOCALEZ2_Y[p] );
|
||||
m_ScoreDisplay[p].SetZoom( 0.5f );
|
||||
m_ScoreDisplay[p].SetDiffuseColor( PlayerToColor(p) );
|
||||
m_frameTop.AddActor( &m_ScoreDisplay[p] );
|
||||
m_pScoreDisplay[p]->SetXY( SCORE_LOCALEZ2_X[p], SCORE_LOCALEZ2_Y[p] );
|
||||
m_pScoreDisplay[p]->SetZoom( 0.5f );
|
||||
m_pScoreDisplay[p]->SetDiffuseColor( PlayerToColor(p) );
|
||||
m_frameTop.AddSubActor( m_pScoreDisplay[p] );
|
||||
}
|
||||
}
|
||||
|
||||
// TopFrame goes above LifeMeter
|
||||
m_sprTopFrame.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_TOP_FRAME_ARCADE) );
|
||||
m_frameTop.AddActor( &m_sprTopFrame );
|
||||
m_sprTopFrame.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_TOP_FRAME) );
|
||||
m_frameTop.AddSubActor( &m_sprTopFrame );
|
||||
|
||||
m_frameTop.SetXY( CENTER_X, SCREEN_TOP + m_sprTopFrame.GetZoomedHeight()/2 );
|
||||
|
||||
m_textStageNumber.Load( THEME->GetPathTo(FONT_HEADER2) );
|
||||
m_textStageNumber.TurnShadowOff();
|
||||
if ( GAMEMAN->m_CurGame == GAME_EZ2 )
|
||||
m_textStageNumber.SetXY( STAGE_NUMBER_LOCAL_X, STAGE_NUMBER_LOCAL_Y );
|
||||
m_textStageNumber.SetText( GAMESTATE->GetStageText() );
|
||||
m_textStageNumber.SetDiffuseColor( GAMESTATE->GetStageColor() );
|
||||
|
||||
if( GAMESTATE->GetCurGame() == GAME_EZ2 )
|
||||
{
|
||||
m_textStageNumber.SetXY( STAGE_NUMBER_LOCAL_X, STAGE_NUMBER_LOCALEZ2_Y );
|
||||
}
|
||||
@@ -181,61 +186,96 @@ ScreenGameplay::ScreenGameplay()
|
||||
{
|
||||
m_textStageNumber.SetXY( STAGE_NUMBER_LOCAL_X, STAGE_NUMBER_LOCAL_Y );
|
||||
}
|
||||
m_textStageNumber.SetText( PREFSMAN->GetStageText() );
|
||||
m_textStageNumber.SetDiffuseColor( PREFSMAN->GetStageColor() );
|
||||
m_frameTop.AddActor( &m_textStageNumber );
|
||||
m_textStageNumber.SetText( GAMESTATE->GetStageText() );
|
||||
m_textStageNumber.SetDiffuseColor( GAMESTATE->GetStageColor() );
|
||||
|
||||
m_frameTop.AddSubActor( &m_textStageNumber );
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
// Add all Actors to m_frameBottom
|
||||
//////////////////////////////////
|
||||
this->AddActor( &m_frameBottom );
|
||||
this->AddSubActor( &m_frameBottom );
|
||||
|
||||
if ( GAMEMAN->m_CurGame != GAME_EZ2 )
|
||||
m_sprBottomFrame.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_BOTTOM_FRAME) );
|
||||
m_frameBottom.AddSubActor( &m_sprBottomFrame );
|
||||
|
||||
m_frameBottom.SetXY( CENTER_X, SCREEN_BOTTOM - m_sprBottomFrame.GetZoomedHeight()/2 );
|
||||
|
||||
if( GAMESTATE->GetCurGame() != GAME_EZ2 )
|
||||
{
|
||||
m_sprBottomFrame.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_BOTTOM_FRAME) );
|
||||
m_frameBottom.AddActor( &m_sprBottomFrame );
|
||||
m_frameBottom.AddSubActor( &m_sprBottomFrame );
|
||||
m_frameBottom.SetXY( CENTER_X, SCREEN_BOTTOM - m_sprBottomFrame.GetZoomedHeight()/2 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
switch( GAMESTATE->m_PlayMode )
|
||||
{
|
||||
case PLAY_MODE_ARCADE:
|
||||
m_pScoreDisplay[p] = new ScoreDisplayNormal;
|
||||
break;
|
||||
case PLAY_MODE_ONI:
|
||||
m_pScoreDisplay[p] = new ScoreDisplayOni;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
m_pScoreDisplay[p]->Init( (PlayerNumber)p, GAMESTATE->m_PlayerOptions[p], 100, 7 );
|
||||
m_pScoreDisplay[p]->SetXY( SCORE_LOCAL_X[p], SCORE_LOCAL_Y[p] );
|
||||
m_pScoreDisplay[p]->SetZoom( 0.8f );
|
||||
m_pScoreDisplay[p]->SetDiffuseColor( PlayerToColor(p) );
|
||||
m_frameBottom.AddSubActor( m_pScoreDisplay[p] );
|
||||
|
||||
m_textPlayerOptions[p].Load( THEME->GetPathTo(FONT_NORMAL) );
|
||||
|
||||
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
continue;
|
||||
if ( GAMEMAN->m_CurGame != GAME_EZ2 )
|
||||
if( GAMESTATE->GetCurGame() != GAME_EZ2 )
|
||||
{
|
||||
m_ScoreDisplay[p].SetXY( SCORE_LOCAL_X[p], SCORE_LOCAL_Y[p] );
|
||||
m_ScoreDisplay[p].SetZoom( 0.8f );
|
||||
m_ScoreDisplay[p].SetDiffuseColor( PlayerToColor(p) );
|
||||
m_frameBottom.AddActor( &m_ScoreDisplay[p] );
|
||||
m_pScoreDisplay[p]->SetXY( SCORE_LOCAL_X[p], SCORE_LOCAL_Y[p] );
|
||||
m_pScoreDisplay[p]->SetZoom( 0.8f );
|
||||
m_pScoreDisplay[p]->SetDiffuseColor( PlayerToColor(p) );
|
||||
m_frameBottom.AddSubActor( m_pScoreDisplay[p] );
|
||||
}
|
||||
|
||||
m_textPlayerOptions[p].Load( THEME->GetPathTo(FONT_NORMAL) );
|
||||
|
||||
m_textPlayerOptions[p].TurnShadowOff();
|
||||
m_textPlayerOptions[p].SetXY( PLAYER_OPTIONS_LOCAL_X[p], PLAYER_OPTIONS_LOCAL_Y[p] );
|
||||
m_textPlayerOptions[p].SetZoom( 0.5f );
|
||||
m_textPlayerOptions[p].SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||
m_textPlayerOptions[p].SetText( PREFSMAN->m_PlayerOptions[p].GetString() );
|
||||
m_frameBottom.AddActor( &m_textPlayerOptions[p] );
|
||||
m_textPlayerOptions[p].SetText( GAMESTATE->m_PlayerOptions[p].GetString() );
|
||||
m_frameBottom.AddSubActor( &m_textPlayerOptions[p] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get the current StyleDef definition (used below)
|
||||
StyleDef* pStyleDef = GAMEMAN->GetCurrentStyleDef();
|
||||
StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
continue;
|
||||
if (GAMEMAN->m_CurGame != GAME_EZ2)
|
||||
|
||||
float fDifficultyY = DIFFICULTY_Y[p];
|
||||
if( GAMESTATE->m_PlayerOptions[p].m_bReverseScroll )
|
||||
fDifficultyY = SCREEN_HEIGHT - DIFFICULTY_Y[p];
|
||||
m_DifficultyBanner[p].SetXY( DIFFICULTY_X[p], fDifficultyY );
|
||||
this->AddSubActor( &m_DifficultyBanner[p] );
|
||||
|
||||
if( GAMESTATE->GetCurGame() != GAME_EZ2 )
|
||||
{
|
||||
float fDifficultyY = DIFFICULTY_Y[p];
|
||||
if( PREFSMAN->m_PlayerOptions[p].m_bReverseScroll )
|
||||
if( GAMESTATE->m_PlayerOptions[p].m_bReverseScroll )
|
||||
fDifficultyY = SCREEN_HEIGHT - DIFFICULTY_Y[p];
|
||||
m_DifficultyBanner[p].SetXY( DIFFICULTY_X[p], fDifficultyY );
|
||||
this->AddActor( &m_DifficultyBanner[p] );
|
||||
this->AddSubActor( &m_DifficultyBanner[p] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,42 +283,42 @@ ScreenGameplay::ScreenGameplay()
|
||||
m_textDebug.Load( THEME->GetPathTo(FONT_NORMAL) );
|
||||
m_textDebug.SetXY( DEBUG_X, DEBUG_Y );
|
||||
m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||
this->AddActor( &m_textDebug );
|
||||
this->AddSubActor( &m_textDebug );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
m_StarWipe.SetClosed();
|
||||
this->AddActor( &m_StarWipe );
|
||||
this->AddSubActor( &m_StarWipe );
|
||||
|
||||
m_sprReady.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_READY) );
|
||||
m_sprReady.SetXY( CENTER_X, CENTER_Y );
|
||||
m_sprReady.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
this->AddActor( &m_sprReady );
|
||||
this->AddSubActor( &m_sprReady );
|
||||
|
||||
m_sprHereWeGo.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_HERE_WE_GO) );
|
||||
m_sprHereWeGo.SetXY( CENTER_X, CENTER_Y );
|
||||
m_sprHereWeGo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
this->AddActor( &m_sprHereWeGo );
|
||||
this->AddSubActor( &m_sprHereWeGo );
|
||||
|
||||
m_sprCleared.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_CLEARED) );
|
||||
m_sprCleared.SetXY( CENTER_X, CENTER_Y );
|
||||
m_sprCleared.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
this->AddActor( &m_sprCleared );
|
||||
this->AddSubActor( &m_sprCleared );
|
||||
|
||||
m_sprFailed.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_FAILED) );
|
||||
m_sprFailed.SetXY( CENTER_X, CENTER_Y );
|
||||
m_sprFailed.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||
this->AddActor( &m_sprFailed );
|
||||
this->AddSubActor( &m_sprFailed );
|
||||
|
||||
|
||||
|
||||
m_soundFail.Load( THEME->GetPathTo(SOUND_GAMEPLAY_FAILED) );
|
||||
m_announcerReady.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_READY) );
|
||||
if( PREFSMAN->IsExtraStage() || PREFSMAN->IsExtraStage2() )
|
||||
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
|
||||
m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_HERE_WE_GO_EXTRA) );
|
||||
else if( PREFSMAN->IsFinalStage() )
|
||||
else if( GAMESTATE->IsFinalStage() )
|
||||
m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_HERE_WE_GO_FINAL) );
|
||||
else
|
||||
m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_HERE_WE_GO_NORMAL) );
|
||||
@@ -304,7 +344,7 @@ ScreenGameplay::ScreenGameplay()
|
||||
m_soundAssistTick.Load( THEME->GetPathTo(SOUND_GAMEPLAY_ASSIST_TICK) );
|
||||
|
||||
|
||||
LoadNextSong();
|
||||
LoadNextSong( false );
|
||||
|
||||
// Send some messages every have second to we can get the introduction rolling
|
||||
for( int i=0; i<30; i++ )
|
||||
@@ -314,85 +354,95 @@ ScreenGameplay::ScreenGameplay()
|
||||
ScreenGameplay::~ScreenGameplay()
|
||||
{
|
||||
LOG->WriteLine( "ScreenGameplay::~ScreenGameplay()" );
|
||||
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
delete m_pLifeMeter[p];
|
||||
delete m_pScoreDisplay[p];
|
||||
}
|
||||
|
||||
m_soundMusic.Stop();
|
||||
}
|
||||
|
||||
|
||||
void ScreenGameplay::SaveSummary()
|
||||
void ScreenGameplay::LoadNextSong( bool bPlayMusic )
|
||||
{
|
||||
// save score summaries
|
||||
if( m_pCurSong != NULL )
|
||||
if( m_apSongQueue.GetSize() == 0 )
|
||||
{
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled((PlayerNumber)p) )
|
||||
continue; // skip
|
||||
|
||||
SONGMAN->m_aGameplayStatistics[p].Add( m_Player[p].GetGameplayStatistics( m_pCurSong, m_pCurNotes[p]) );
|
||||
}
|
||||
|
||||
m_pCurSong = NULL;
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
m_pCurNotes[p] = NULL;
|
||||
this->SendScreenMessage( SM_LastNotesEnded, 0 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ScreenGameplay::LoadNextSong()
|
||||
{
|
||||
int p;
|
||||
|
||||
// add a new GameplayStatistic for this song
|
||||
GAMESTATE->m_aGameplayStatistics.Add( GameplayStatistics() );
|
||||
|
||||
SaveSummary();
|
||||
|
||||
m_pCurSong = m_apSongQueue[m_apSongQueue.GetSize()-1];
|
||||
m_apSongQueue.RemoveAt(m_apSongQueue.GetSize()-1);
|
||||
GAMESTATE->m_pCurSong = m_apSongQueue[0];
|
||||
m_apSongQueue.RemoveAt(0);
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
m_pCurNotes[p] = m_apNotesQueue[p][m_apNotesQueue[p].GetSize()-1];
|
||||
m_apNotesQueue[p].RemoveAt(m_apNotesQueue[p].GetSize()-1);
|
||||
GAMESTATE->m_pCurNotes[p] = m_apNotesQueue[p][0];
|
||||
m_apNotesQueue[p].RemoveAt(0);
|
||||
}
|
||||
|
||||
|
||||
// Get the current StyleDef definition (used below)
|
||||
StyleDef* pStyleDef = GAMEMAN->GetCurrentStyleDef();
|
||||
StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
continue;
|
||||
|
||||
m_DifficultyBanner[p].SetFromNotes( PlayerNumber(p), m_pCurNotes[p] );
|
||||
m_DifficultyBanner[p].SetFromNotes( PlayerNumber(p), GAMESTATE->m_pCurNotes[p] );
|
||||
|
||||
|
||||
NoteData originalNoteData;
|
||||
m_pCurNotes[p]->GetNoteData( &originalNoteData );
|
||||
GAMESTATE->m_pCurNotes[p]->GetNoteData( &originalNoteData );
|
||||
|
||||
NoteData newNoteData;
|
||||
pStyleDef->GetTransformedNoteDataForStyle( (PlayerNumber)p, &originalNoteData, &newNoteData );
|
||||
|
||||
|
||||
// Fill in info about these notes in the latest GameplayStatistics
|
||||
GAMESTATE->GetLatestGameplayStatistics().dc[p] = GAMESTATE->m_pCurNotes[p]->m_DifficultyClass;
|
||||
GAMESTATE->GetLatestGameplayStatistics().meter[p] = GAMESTATE->m_pCurNotes[p]->m_iMeter;
|
||||
GAMESTATE->GetLatestGameplayStatistics().iPossibleDancePoints[p] = newNoteData.GetPossibleDancePoints();
|
||||
for( int r=0; r<NUM_RADAR_VALUES; r++ )
|
||||
GAMESTATE->GetLatestGameplayStatistics().fRadarPossible[p][r] = newNoteData.GetRadarValue( (RadarCategory)r, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
|
||||
|
||||
m_Player[p].Load(
|
||||
(PlayerNumber)p,
|
||||
GAMEMAN->GetCurrentStyleDef(),
|
||||
GAMESTATE->GetCurrentStyleDef(),
|
||||
&newNoteData,
|
||||
PREFSMAN->m_PlayerOptions[p],
|
||||
&m_LifeMeter[p],
|
||||
&m_ScoreDisplay[p],
|
||||
GAMESTATE->m_PlayerOptions[p],
|
||||
m_pLifeMeter[p],
|
||||
m_pScoreDisplay[p],
|
||||
originalNoteData.GetNumTapNotes(),
|
||||
m_pCurNotes[p]->m_iMeter
|
||||
GAMESTATE->m_pCurNotes[p]->m_iMeter
|
||||
);
|
||||
}
|
||||
|
||||
m_soundMusic.Load( m_pCurSong->GetMusicPath(), true ); // enable accurate sync
|
||||
float fStartSeconds = min( 0, m_pCurSong->GetElapsedTimeFromBeat(m_pCurSong->m_fFirstBeat-4) );
|
||||
m_soundMusic.SetPositionSeconds( fStartSeconds );
|
||||
m_soundMusic.SetPlaybackRate( PREFSMAN->m_SongOptions.m_fMusicRate );
|
||||
|
||||
m_Background.LoadFromSong( m_pCurSong );
|
||||
m_Background.LoadFromSong( GAMESTATE->m_pCurSong );
|
||||
m_Background.SetDiffuseColor( D3DXCOLOR(0.5f,0.5f,0.5f,1) );
|
||||
m_Background.BeginTweeningQueued( 2 );
|
||||
m_Background.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||
|
||||
m_soundMusic.Load( GAMESTATE->m_pCurSong->GetMusicPath(), true ); // enable accurate sync
|
||||
float fStartSeconds = min( 0, -4+GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(GAMESTATE->m_pCurSong->m_fFirstBeat) );
|
||||
m_soundMusic.SetPositionSeconds( fStartSeconds );
|
||||
m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate );
|
||||
if( bPlayMusic )
|
||||
m_soundMusic.Play();
|
||||
|
||||
if( bPlayMusic )
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
if( GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
m_pLifeMeter[p]->NextSong( NULL );
|
||||
}
|
||||
|
||||
|
||||
@@ -403,76 +453,88 @@ void ScreenGameplay::Update( float fDeltaTime )
|
||||
|
||||
m_soundMusic.Update( fDeltaTime );
|
||||
|
||||
if( m_pCurSong == NULL )
|
||||
if( GAMESTATE->m_pCurSong == NULL )
|
||||
return;
|
||||
|
||||
|
||||
float fPositionSeconds = m_soundMusic.GetPositionSeconds();
|
||||
float fSongBeat, fBPS;
|
||||
bool bFreeze;
|
||||
m_pCurSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS, bFreeze );
|
||||
GAMESTATE->m_pCurSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS, bFreeze );
|
||||
|
||||
|
||||
// update the global music statistics for other classes to access
|
||||
GAMESTATE->m_fMusicSeconds = fPositionSeconds;
|
||||
GAMESTATE->m_fMusicBeat = fSongBeat;
|
||||
GAMESTATE->m_fCurBPS = fBPS;
|
||||
GAMESTATE->m_bFreeze = bFreeze;
|
||||
|
||||
|
||||
m_Background.SetSongBeat( fSongBeat, bFreeze, fPositionSeconds );
|
||||
|
||||
|
||||
//LOG->WriteLine( "m_fOffsetInBeats = %f, m_fBeatsPerSecond = %f, m_Music.GetPositionSeconds = %f", m_fOffsetInBeats, m_fBeatsPerSecond, m_Music.GetPositionSeconds() );
|
||||
|
||||
const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * PREFSMAN->m_SongOptions.m_fMusicRate;
|
||||
const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * GAMESTATE->m_SongOptions.m_fMusicRate;
|
||||
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
continue;
|
||||
m_Player[p].Update( fDeltaTime, fSongBeat, fMaxBeatDifference );
|
||||
}
|
||||
|
||||
// check for fail
|
||||
switch( PREFSMAN->m_SongOptions.m_FailType )
|
||||
switch( GAMESTATE->m_SongOptions.m_FailType )
|
||||
{
|
||||
case SongOptions::FAIL_ARCADE:
|
||||
case SongOptions::FAIL_END_OF_SONG:
|
||||
|
||||
if( m_bBothHaveFailed )
|
||||
break; // if they have already failed, don't bother checking again
|
||||
|
||||
{
|
||||
// check for both players fail
|
||||
bool bAllInDanger = true;
|
||||
bool bAllFailed = true;
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
continue;
|
||||
|
||||
if( !m_LifeMeter[p].IsInDanger() )
|
||||
bAllInDanger = false;
|
||||
if( m_bBothHaveFailed )
|
||||
break; // if they have already failed, don't bother checking again
|
||||
|
||||
if( !m_LifeMeter[p].HasFailed() )
|
||||
bAllFailed = false;
|
||||
}
|
||||
// check for both players fail
|
||||
bool bAllInDanger = true;
|
||||
bool bAllAreFailing = true;
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
continue;
|
||||
|
||||
if( bAllInDanger ) m_Background.TurnDangerOn();
|
||||
else m_Background.TurnDangerOff();
|
||||
if( !m_pLifeMeter[p]->IsInDanger() )
|
||||
bAllInDanger = false;
|
||||
|
||||
if( bAllFailed )
|
||||
{
|
||||
m_bBothHaveFailed = true;
|
||||
SCREENMAN->SendMessageToTopScreen( SM_LifeIs0, 0 );
|
||||
}
|
||||
if( !m_pLifeMeter[p]->IsFailing() )
|
||||
bAllAreFailing = false;
|
||||
}
|
||||
|
||||
if( bAllInDanger ) m_Background.TurnDangerOn();
|
||||
else m_Background.TurnDangerOff();
|
||||
|
||||
if( bAllAreFailing )
|
||||
{
|
||||
m_bBothHaveFailed = true;
|
||||
SCREENMAN->SendMessageToTopScreen( SM_LifeIs0, 0 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SongOptions::FAIL_OFF:
|
||||
break;
|
||||
}
|
||||
|
||||
// update seconds into play
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
if( GAMESTATE->IsPlayerEnabled((PlayerNumber)p) && !m_pLifeMeter[p]->FailedEarlier() )
|
||||
GAMESTATE->GetLatestGameplayStatistics().fSecsIntoPlay[p] = max( GAMESTATE->GetLatestGameplayStatistics().fSecsIntoPlay[p], GAMESTATE->m_fMusicSeconds );
|
||||
|
||||
|
||||
switch( m_DancingState )
|
||||
{
|
||||
case STATE_DANCING:
|
||||
|
||||
// Check for end of song
|
||||
if( fSongBeat > m_pCurSong->m_fLastBeat+4 )
|
||||
if( fSongBeat > GAMESTATE->m_pCurSong->m_fLastBeat+4 )
|
||||
this->SendScreenMessage( SM_NotesEnded, 0 );
|
||||
|
||||
// Check to see if it's time to play a gameplay comment
|
||||
@@ -483,12 +545,12 @@ void ScreenGameplay::Update( float fDeltaTime )
|
||||
|
||||
bool bAllInDanger = true;
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
if( !m_LifeMeter[p].IsInDanger() )
|
||||
if( !m_pLifeMeter[p]->IsInDanger() )
|
||||
bAllInDanger = false;
|
||||
|
||||
bool bOneIsHot = false;
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
if( m_LifeMeter[p].IsHot() )
|
||||
if( m_pLifeMeter[p]->IsHot() )
|
||||
bOneIsHot = true;
|
||||
|
||||
if( bOneIsHot )
|
||||
@@ -512,7 +574,7 @@ void ScreenGameplay::Update( float fDeltaTime )
|
||||
{
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
continue; // skip
|
||||
|
||||
m_Player[p].CrossedRow( r, fSongBeat, fMaxBeatDifference );
|
||||
@@ -529,10 +591,10 @@ void ScreenGameplay::Update( float fDeltaTime )
|
||||
// Sound cards have a latency between when a sample is Play()ed and when the sound
|
||||
// will start coming out the speaker. Compensate for this by boosting
|
||||
// fPositionSeconds ahead
|
||||
if( PREFSMAN->m_SongOptions.m_AssistType == SongOptions::ASSIST_TICK )
|
||||
if( GAMESTATE->m_SongOptions.m_AssistType == SongOptions::ASSIST_TICK )
|
||||
{
|
||||
fPositionSeconds += (SOUND->GetPlayLatency()+0.04f) * m_soundMusic.GetPlaybackRate(); // HACK: Add 0.04 seconds to make them play a tiny bit earlier
|
||||
m_pCurSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS, bFreeze );
|
||||
GAMESTATE->m_pCurSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS, bFreeze );
|
||||
|
||||
int iRowNow = BeatToNoteRowNotRounded( fSongBeat );
|
||||
static int iRowLastCrossed = 0;
|
||||
@@ -543,7 +605,7 @@ void ScreenGameplay::Update( float fDeltaTime )
|
||||
{
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
continue; // skip
|
||||
|
||||
m_Player[p].CrossedRow( r, fSongBeat, fMaxBeatDifference );
|
||||
@@ -564,7 +626,7 @@ void ScreenGameplay::Update( float fDeltaTime )
|
||||
{
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMEMAN->IsPlayerEnabled((PlayerNumber)p) )
|
||||
if( !GAMESTATE->IsPlayerEnabled((PlayerNumber)p) )
|
||||
continue;
|
||||
|
||||
float fOverrideAdd = m_Player[p].GetOverrideAdd();
|
||||
@@ -595,7 +657,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
|
||||
|
||||
float fSongBeat, fBPS;
|
||||
bool bFreeze;
|
||||
m_pCurSong->GetBeatAndBPSFromElapsedTime( m_soundMusic.GetPositionSeconds(), fSongBeat, fBPS, bFreeze );
|
||||
GAMESTATE->m_pCurSong->GetBeatAndBPSFromElapsedTime( m_soundMusic.GetPositionSeconds(), fSongBeat, fBPS, bFreeze );
|
||||
|
||||
|
||||
// Handle special keys to adjust the offset
|
||||
@@ -616,9 +678,9 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
|
||||
if( type == IET_FAST_REPEAT )
|
||||
fOffsetDelta *= 40;
|
||||
|
||||
m_pCurSong->m_fBeat0OffsetInSeconds += fOffsetDelta;
|
||||
GAMESTATE->m_pCurSong->m_fBeat0OffsetInSeconds += fOffsetDelta;
|
||||
|
||||
m_textDebug.SetText( ssprintf("Offset = %f.", m_pCurSong->m_fBeat0OffsetInSeconds) );
|
||||
m_textDebug.SetText( ssprintf("Offset = %f.", GAMESTATE->m_pCurSong->m_fBeat0OffsetInSeconds) );
|
||||
m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||
m_textDebug.StopTweening();
|
||||
m_textDebug.BeginTweeningQueued( 3 ); // sleep
|
||||
@@ -637,13 +699,13 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
|
||||
SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 );
|
||||
}
|
||||
|
||||
const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * PREFSMAN->m_SongOptions.m_fMusicRate;
|
||||
const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * GAMESTATE->m_SongOptions.m_fMusicRate;
|
||||
|
||||
if( type == IET_FIRST_PRESS )
|
||||
{
|
||||
if( StyleI.IsValid() )
|
||||
{
|
||||
if( GAMEMAN->IsPlayerEnabled( StyleI.player ) )
|
||||
if( GAMESTATE->IsPlayerEnabled( StyleI.player ) )
|
||||
m_Player[StyleI.player].HandlePlayerStep( fSongBeat, StyleI.col, fMaxBeatDifference );
|
||||
}
|
||||
}
|
||||
@@ -669,11 +731,12 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
m_sprReady.StartBlurring();
|
||||
break;
|
||||
case SM_User+5:
|
||||
m_sprHereWeGo.StartFocusing();
|
||||
m_announcerHereWeGo.PlayRandom();
|
||||
m_Background.FadeIn();
|
||||
m_soundMusic.Play();
|
||||
m_soundMusic.SetPlaybackRate( PREFSMAN->m_SongOptions.m_fMusicRate );
|
||||
{
|
||||
m_sprHereWeGo.StartFocusing();
|
||||
m_announcerHereWeGo.PlayRandom();
|
||||
m_Background.FadeIn();
|
||||
m_soundMusic.Play();
|
||||
}
|
||||
break;
|
||||
case SM_User+6:
|
||||
break;
|
||||
@@ -688,11 +751,19 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
|
||||
// received while STATE_DANCING
|
||||
case SM_LifeIs0:
|
||||
if( PREFSMAN->m_SongOptions.m_FailType == SongOptions::FAIL_ARCADE ) // fail them now!
|
||||
if( GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_ARCADE ) // fail them now!
|
||||
this->SendScreenMessage( SM_BeginFailed, 0 );
|
||||
m_DancingState = STATE_OUTRO;
|
||||
break;
|
||||
case SM_NotesEnded:
|
||||
{
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
if( GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
|
||||
m_Player[p].SaveGameplayStatistics();
|
||||
LoadNextSong( true );
|
||||
}
|
||||
break;
|
||||
case SM_LastNotesEnded:
|
||||
if( m_DancingState == STATE_OUTRO ) // gameplay already ended
|
||||
return; // ignore
|
||||
|
||||
@@ -797,8 +868,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
SCREENMAN->SendMessageToTopScreen( SM_GoToResults, 1 );
|
||||
break;
|
||||
case SM_GoToResults:
|
||||
SaveSummary();
|
||||
SCREENMAN->SetNewScreen( new ScreenEvaluation(false) );
|
||||
SCREENMAN->SetNewScreen( new ScreenEvaluation(false) );
|
||||
break;
|
||||
|
||||
|
||||
@@ -827,7 +897,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
m_sprFailed.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0.7f) ); // and fade in
|
||||
|
||||
// BUGFIX by ANDY: Stage will now reset back to 0 when game ends.
|
||||
PREFSMAN->m_iCurrentStageIndex = 0;
|
||||
GAMESTATE->m_iCurrentStageIndex = 0;
|
||||
|
||||
SCREENMAN->SendMessageToTopScreen( SM_PlayFailComment, 1.5f );
|
||||
SCREENMAN->SendMessageToTopScreen( SM_HideFailed, 3.0f );
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "RageMusic.h"
|
||||
#include "MotionBlurSprite.h"
|
||||
#include "Background.h"
|
||||
#include "LifeMeterBar.h"
|
||||
#include "ScoreDisplayRolling.h"
|
||||
#include "LifeMeter.h"
|
||||
#include "ScoreDisplay.h"
|
||||
#include "DifficultyBanner.h"
|
||||
|
||||
|
||||
@@ -61,14 +61,12 @@ public:
|
||||
private:
|
||||
void TweenOnScreen();
|
||||
void TweenOffScreen();
|
||||
void SaveSummary();
|
||||
void LoadNextSong();
|
||||
|
||||
void LoadNextSong( bool bPlayMusic );
|
||||
|
||||
|
||||
DancingState m_DancingState;
|
||||
|
||||
Song* m_pCurSong;
|
||||
Notes* m_pCurNotes[NUM_PLAYERS];
|
||||
CArray<Song*,Song*> m_apSongQueue; // nearest songs are on back of queue
|
||||
CArray<Notes*,Notes*> m_apNotesQueue[NUM_PLAYERS]; // nearest notes are on back of queue
|
||||
bool m_bBothHaveFailed;
|
||||
@@ -80,13 +78,12 @@ private:
|
||||
|
||||
ActorFrame m_frameTop;
|
||||
Sprite m_sprTopFrame;
|
||||
Quad m_quadLifeMeterBG[NUM_PLAYERS]; // just a black quad to fill in hole for the life meter
|
||||
LifeMeterBar m_LifeMeter[NUM_PLAYERS];
|
||||
LifeMeter* m_pLifeMeter[NUM_PLAYERS];
|
||||
BitmapText m_textStageNumber;
|
||||
|
||||
ActorFrame m_frameBottom;
|
||||
Sprite m_sprBottomFrame;
|
||||
ScoreDisplayRolling m_ScoreDisplay[NUM_PLAYERS];
|
||||
ScoreDisplay* m_pScoreDisplay[NUM_PLAYERS];
|
||||
BitmapText m_textPlayerOptions[NUM_PLAYERS];
|
||||
|
||||
BitmapText m_textDebug;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "stdafx.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScreenLoading
|
||||
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "ScreenLoading.h"
|
||||
#include "GameState.h"
|
||||
|
||||
ScreenLoading::ScreenLoading()
|
||||
{
|
||||
m_sprLoading.Load( THEME->GetPathTo(GRAPHIC_LOADING) );
|
||||
m_sprLoading.SetXY( CENTER_X, CENTER_Y );
|
||||
this->AddSubActor( &m_sprLoading );
|
||||
|
||||
m_textMessage.Load( THEME->GetPathTo(FONT_NORMAL) );
|
||||
m_textMessage.SetXY( CENTER_X, CENTER_Y );
|
||||
this->AddSubActor( &m_textMessage );
|
||||
}
|
||||
|
||||
void ScreenLoading::DrawPrimitives()
|
||||
{
|
||||
m_textMessage.SetText( GAMESTATE->m_sLoadingMessage );
|
||||
|
||||
Screen::DrawPrimitives();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: ScreenLoading
|
||||
|
||||
Desc: Shows while game loads.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Screen.h"
|
||||
#include "BitmapText.h"
|
||||
#include "Sprite.h"
|
||||
|
||||
class ScreenLoading : public Screen
|
||||
{
|
||||
public:
|
||||
ScreenLoading();
|
||||
|
||||
virtual void DrawPrimitives();
|
||||
|
||||
protected:
|
||||
BitmapText m_textMessage;
|
||||
Sprite m_sprLoading;
|
||||
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "ScreenManager.h"
|
||||
#include "IniFile.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
#include "ScreenMusicScroll.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ScreenSelectMusic.h"
|
||||
#include "ScreenTitleMenu.h"
|
||||
#include "GameManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "SongManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
const ScreenMessage SM_StartFadingOut = ScreenMessage(SM_User + 1);
|
||||
@@ -60,8 +61,9 @@ const CString CREDIT_LINES[] =
|
||||
"",
|
||||
"PROGRAMMING:",
|
||||
"Chris Danford",
|
||||
"Ben Nordstrom",
|
||||
"Lord Frieza (Andrew Livy)",
|
||||
"Dro Kulix",
|
||||
"Ben Nordstrom",
|
||||
"Parasyte (Chris Gomez)",
|
||||
"angedelamort (Sauleil Lamarre)",
|
||||
"Edwin Evans",
|
||||
@@ -112,8 +114,7 @@ const CString CREDIT_LINES[] =
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"If your name is missing from this list,",
|
||||
" send me an e-mail!",
|
||||
"Please, join the StepMania team and help us out!"
|
||||
" -Chris"
|
||||
};
|
||||
const int NUM_CREDIT_LINES = sizeof(CREDIT_LINES) / sizeof(CString);
|
||||
@@ -125,12 +126,9 @@ ScreenMusicScroll::ScreenMusicScroll()
|
||||
|
||||
int i;
|
||||
|
||||
// BUGFIX by ANDY: Stage will now reset back to 0 when game ends.
|
||||
PREFSMAN->m_iCurrentStageIndex = 0;
|
||||
|
||||
m_sprBackground.Load( THEME->GetPathTo(GRAPHIC_MUSIC_SCROLL_BACKGROUND) );
|
||||
m_sprBackground.StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
|
||||
this->AddActor( &m_sprBackground );
|
||||
this->AddSubActor( &m_sprBackground );
|
||||
|
||||
|
||||
CArray<Song*, Song*> arraySongs;
|
||||
@@ -153,7 +151,7 @@ ScreenMusicScroll::ScreenMusicScroll()
|
||||
{
|
||||
m_textLines[m_iNumLines].Load( THEME->GetPathTo(FONT_NORMAL) );
|
||||
m_textLines[m_iNumLines].SetText( CREDIT_LINES[i] );
|
||||
// this->AddActor( &m_textLines[m_iNumLines] );
|
||||
// this->AddSubActor( &m_textLines[m_iNumLines] );
|
||||
|
||||
m_iNumLines++;
|
||||
}
|
||||
@@ -169,9 +167,9 @@ ScreenMusicScroll::ScreenMusicScroll()
|
||||
|
||||
this->SendScreenMessage( SM_StartFadingOut, 0.3f * i + 3.0f );
|
||||
|
||||
this->AddActor( &m_Fade );
|
||||
this->AddSubActor( &m_Fade );
|
||||
|
||||
if ( GAMEMAN->m_CurGame != GAME_EZ2 )
|
||||
if ( GAMESTATE->GetCurGame() != GAME_EZ2 )
|
||||
{
|
||||
m_soundMusic.Load( THEME->GetPathTo(SOUND_MUSIC_SCROLL_MUSIC) );
|
||||
}
|
||||
@@ -181,7 +179,7 @@ ScreenMusicScroll::ScreenMusicScroll()
|
||||
}
|
||||
|
||||
m_Fade.OpenWipingRight();
|
||||
if ( GAMEMAN->m_CurGame != GAME_EZ2 )
|
||||
if ( GAMESTATE->GetCurGame() != GAME_EZ2 )
|
||||
{
|
||||
m_soundMusic.Play( true );
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "ScreenManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ScreenGameplay.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
@@ -53,7 +53,7 @@ ScreenOptions::ScreenOptions( CString sBackgroundPath, CString sTopEdgePath )
|
||||
ssprintf("%s %s to change line %s %s to select between options then press START", CString(char(3)), CString(char(4)), CString(char(1)), CString(char(2)) ),
|
||||
false, true, 40
|
||||
);
|
||||
this->AddActor( &m_Menu );
|
||||
this->AddSubActor( &m_Menu );
|
||||
m_Menu.TweenOnScreenFromBlack( SM_None );
|
||||
|
||||
// init row numbers and element colors
|
||||
@@ -62,32 +62,32 @@ ScreenOptions::ScreenOptions( CString sBackgroundPath, CString sTopEdgePath )
|
||||
m_iCurrentRow[p] = 0;
|
||||
m_SelectionHighlight[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) );
|
||||
|
||||
this->AddActor( &m_SelectionHighlight[p] );
|
||||
this->AddSubActor( &m_SelectionHighlight[p] );
|
||||
|
||||
for( int l=0; l<MAX_OPTION_LINES; l++ )
|
||||
{
|
||||
m_iSelectedOption[p][l] = 0;
|
||||
|
||||
m_OptionUnderline[p][l].SetDiffuseColor( PlayerToColor(p) );
|
||||
this->AddActor( &m_OptionUnderline[p][l] );
|
||||
this->AddSubActor( &m_OptionUnderline[p][l] );
|
||||
}
|
||||
}
|
||||
|
||||
// add sub actors
|
||||
for( int i=0; i<MAX_OPTION_LINES; i++ ) // foreach line
|
||||
{
|
||||
this->AddActor( &m_textOptionLineTitles[i] );
|
||||
this->AddSubActor( &m_textOptionLineTitles[i] );
|
||||
|
||||
for( int j=0; j<MAX_OPTIONS_PER_LINE; j++ )
|
||||
{
|
||||
m_textOptions[i][j].SetZ( -1 );
|
||||
this->AddActor( &m_textOptions[i][j] ); // this array has to be big enough to hold all of the options
|
||||
this->AddSubActor( &m_textOptions[i][j] ); // this array has to be big enough to hold all of the options
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_Wipe.OpenWipingRight(SM_None);
|
||||
this->AddActor( &m_Wipe );
|
||||
this->AddSubActor( &m_Wipe );
|
||||
}
|
||||
|
||||
void ScreenOptions::Init( InputMode im, OptionLineData optionLineData[], int iNumOptionLines )
|
||||
@@ -149,7 +149,7 @@ void ScreenOptions::InitOptionsText()
|
||||
title.SetXY( LABELS_X, fY );
|
||||
title.SetZoom( 0.7f );
|
||||
title.SetVertAlign( Actor::align_middle );
|
||||
this->AddActor( &title );
|
||||
this->AddSubActor( &title );
|
||||
|
||||
// init all text in this line and count the width of the line
|
||||
float fX = 150; // indent 70 pixels
|
||||
@@ -162,7 +162,7 @@ void ScreenOptions::InitOptionsText()
|
||||
option.SetText( optline.szOptionsText[j] );
|
||||
option.SetZoom( 0.65f );
|
||||
option.SetShadowLength( 2 );
|
||||
this->AddActor( &option );
|
||||
this->AddSubActor( &option );
|
||||
|
||||
// set the XY position of each item in the line
|
||||
float fItemWidth = option.GetWidestLineWidthInSourcePixels() * option.GetZoomX();
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
#include "ScreenGameplay.h"
|
||||
#include "ScreenSongOptions.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "ScreenSelectMusic.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameState.h"
|
||||
|
||||
|
||||
enum {
|
||||
@@ -38,7 +39,7 @@ enum {
|
||||
NUM_PLAYER_OPTIONS_LINES
|
||||
};
|
||||
OptionLineData g_PlayerOptionsLines[NUM_PLAYER_OPTIONS_LINES] = {
|
||||
{ "Speed", 6, {"x1","x1.5","x2","x3","x5","x8"} },
|
||||
{ "Speed", 8, {"x0.5","x0.75","x1","x1.5","x2","x3","x5","x8"} },
|
||||
{ "Effect", 6, {"OFF","BOOST","WAVE", "DRUNK", "DIZZY", "SPACE"} },
|
||||
{ "Appear", 4, {"VISIBLE","HIDDEN","SUDDEN","STEALTH"} },
|
||||
{ "Turn", 5, {"OFF","MIRROR","LEFT","RIGHT","SHUFFLE"} },
|
||||
@@ -72,15 +73,17 @@ void ScreenPlayerOptions::ImportOptions()
|
||||
{
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
PlayerOptions &po = PREFSMAN->m_PlayerOptions[p];
|
||||
PlayerOptions &po = GAMESTATE->m_PlayerOptions[p];
|
||||
|
||||
if( po.m_fArrowScrollSpeed == 1.0f ) m_iSelectedOption[p][PO_SPEED] = 0;
|
||||
else if( po.m_fArrowScrollSpeed == 1.5f ) m_iSelectedOption[p][PO_SPEED] = 1;
|
||||
else if( po.m_fArrowScrollSpeed == 2.0f ) m_iSelectedOption[p][PO_SPEED] = 2;
|
||||
else if( po.m_fArrowScrollSpeed == 3.0f ) m_iSelectedOption[p][PO_SPEED] = 3;
|
||||
else if( po.m_fArrowScrollSpeed == 5.0f ) m_iSelectedOption[p][PO_SPEED] = 4;
|
||||
else if( po.m_fArrowScrollSpeed == 8.0f ) m_iSelectedOption[p][PO_SPEED] = 5;
|
||||
else m_iSelectedOption[p][PO_SPEED] = 0;
|
||||
if( po.m_fArrowScrollSpeed == 0.5f ) m_iSelectedOption[p][PO_SPEED] = 0;
|
||||
else if( po.m_fArrowScrollSpeed == 0.75f) m_iSelectedOption[p][PO_SPEED] = 1;
|
||||
else if( po.m_fArrowScrollSpeed == 1.0f ) m_iSelectedOption[p][PO_SPEED] = 2;
|
||||
else if( po.m_fArrowScrollSpeed == 1.5f ) m_iSelectedOption[p][PO_SPEED] = 3;
|
||||
else if( po.m_fArrowScrollSpeed == 2.0f ) m_iSelectedOption[p][PO_SPEED] = 4;
|
||||
else if( po.m_fArrowScrollSpeed == 3.0f ) m_iSelectedOption[p][PO_SPEED] = 5;
|
||||
else if( po.m_fArrowScrollSpeed == 5.0f ) m_iSelectedOption[p][PO_SPEED] = 6;
|
||||
else if( po.m_fArrowScrollSpeed == 8.0f ) m_iSelectedOption[p][PO_SPEED] = 7;
|
||||
else m_iSelectedOption[p][PO_SPEED] = 2;
|
||||
|
||||
m_iSelectedOption[p][PO_EFFECT] = po.m_EffectType;
|
||||
m_iSelectedOption[p][PO_APPEAR] = po.m_AppearanceType;
|
||||
@@ -98,16 +101,18 @@ void ScreenPlayerOptions::ExportOptions()
|
||||
{
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
PlayerOptions &po = PREFSMAN->m_PlayerOptions[p];
|
||||
PlayerOptions &po = GAMESTATE->m_PlayerOptions[p];
|
||||
|
||||
switch( m_iSelectedOption[p][PO_SPEED] )
|
||||
{
|
||||
case 0: po.m_fArrowScrollSpeed = 1.0f; break;
|
||||
case 1: po.m_fArrowScrollSpeed = 1.5f; break;
|
||||
case 2: po.m_fArrowScrollSpeed = 2.0f; break;
|
||||
case 3: po.m_fArrowScrollSpeed = 3.0f; break;
|
||||
case 4: po.m_fArrowScrollSpeed = 5.0f; break;
|
||||
case 5: po.m_fArrowScrollSpeed = 8.0f; break;
|
||||
case 0: po.m_fArrowScrollSpeed = 0.5f; break;
|
||||
case 1: po.m_fArrowScrollSpeed = 0.75f; break;
|
||||
case 2: po.m_fArrowScrollSpeed = 1.0f; break;
|
||||
case 3: po.m_fArrowScrollSpeed = 1.5f; break;
|
||||
case 4: po.m_fArrowScrollSpeed = 2.0f; break;
|
||||
case 5: po.m_fArrowScrollSpeed = 3.0f; break;
|
||||
case 6: po.m_fArrowScrollSpeed = 5.0f; break;
|
||||
case 7: po.m_fArrowScrollSpeed = 8.0f; break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "RageMusic.h"
|
||||
#include "ScreenTitleMenu.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
ScreenPrompt::ScreenPrompt( CString sText, PromptType pt, bool* pbAnswer )
|
||||
{
|
||||
@@ -37,7 +37,7 @@ ScreenPrompt::ScreenPrompt( CString sText, PromptType pt, bool* pbAnswer )
|
||||
m_Fade.SetOpened();
|
||||
m_Fade.CloseWipingRight();
|
||||
m_Fade.SetZ(-2);
|
||||
this->AddActor( &m_Fade );
|
||||
this->AddSubActor( &m_Fade );
|
||||
|
||||
CStringArray arrayTextLines;
|
||||
split( sText, "\n", arrayTextLines );
|
||||
@@ -47,7 +47,7 @@ ScreenPrompt::ScreenPrompt( CString sText, PromptType pt, bool* pbAnswer )
|
||||
m_textQuestion[i].SetText( arrayTextLines[i] );
|
||||
m_textQuestion[i].SetXY( CENTER_X, CENTER_Y-50 + i*27 - arrayTextLines.GetSize()*27/2 );
|
||||
m_textQuestion[i].SetZ(-2);
|
||||
this->AddActor( &m_textQuestion[i] );
|
||||
this->AddSubActor( &m_textQuestion[i] );
|
||||
}
|
||||
|
||||
m_rectAnswerBox.SetDiffuseColor( D3DXCOLOR(0.5f,0.5f,1.0f,0.7f) );
|
||||
@@ -55,7 +55,7 @@ ScreenPrompt::ScreenPrompt( CString sText, PromptType pt, bool* pbAnswer )
|
||||
m_rectAnswerBox.SetZoomX( m_textAnswer[*m_pbAnswer].GetWidestLineWidthInSourcePixels()+10.0f );
|
||||
m_rectAnswerBox.SetZoomY( 30 );
|
||||
m_rectAnswerBox.SetZ(-2);
|
||||
this->AddActor( &m_rectAnswerBox );
|
||||
this->AddSubActor( &m_rectAnswerBox );
|
||||
|
||||
m_textAnswer[0].Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
m_textAnswer[1].Load( THEME->GetPathTo(FONT_HEADER1) );
|
||||
@@ -63,8 +63,8 @@ ScreenPrompt::ScreenPrompt( CString sText, PromptType pt, bool* pbAnswer )
|
||||
m_textAnswer[1].SetY( CENTER_Y+120 );
|
||||
m_textAnswer[0].SetZ(-2);
|
||||
m_textAnswer[1].SetZ(-2);
|
||||
this->AddActor( &m_textAnswer[0] );
|
||||
this->AddActor( &m_textAnswer[1] );
|
||||
this->AddSubActor( &m_textAnswer[0] );
|
||||
this->AddSubActor( &m_textAnswer[1] );
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,21 +16,34 @@
|
||||
#include "ScreenTitleMenu.h"
|
||||
#include "ScreenSelectMusic.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "Quad.h"
|
||||
|
||||
|
||||
ScreenSandbox::ScreenSandbox()
|
||||
{
|
||||
m_text.Load( THEME->GetPathTo(FONT_NORMAL) );
|
||||
// m_text.Load( THEME->GetPathTo(FONT_NORMAL) );
|
||||
m_text.SetXY( CENTER_X, CENTER_Y );
|
||||
this->AddActor( &m_text );
|
||||
CStringArray as;
|
||||
as.Add( "Testing... Attention please." );
|
||||
m_text.SetTips( as );
|
||||
m_text.SetXY( CENTER_X, CENTER_Y );
|
||||
this->AddSubActor( &m_text );
|
||||
|
||||
m_Menu.Load(
|
||||
THEME->GetPathTo(GRAPHIC_SELECT_STYLE_BACKGROUND),
|
||||
THEME->GetPathTo(GRAPHIC_SELECT_STYLE_TOP_EDGE),
|
||||
ssprintf("Use %c %c to select, then press START", char(1), char(2) ),
|
||||
false, true, 40
|
||||
);
|
||||
this->AddSubActor( &m_Menu );
|
||||
m_Menu.TweenOnScreenFromBlack( SM_None );
|
||||
|
||||
m_sound.Load( THEME->GetPathTo(SOUND_MENU_MUSIC) );
|
||||
m_sound.SetPositionSeconds( -10 );
|
||||
m_sound.Play();
|
||||
|
||||
//this->AddActor( &m_spr );
|
||||
//this->AddSubActor( &m_spr );
|
||||
}
|
||||
|
||||
|
||||
@@ -38,12 +51,13 @@ void ScreenSandbox::Update( float fDeltaTime )
|
||||
{
|
||||
Screen::Update( fDeltaTime );
|
||||
m_sound.Update( fDeltaTime );
|
||||
m_text.SetText( ssprintf("%f", m_sound.GetPositionSeconds()) );
|
||||
}
|
||||
|
||||
void ScreenSandbox::DrawPrimitives()
|
||||
{
|
||||
m_Menu.DrawBottomLayer();
|
||||
Screen::DrawPrimitives();
|
||||
m_Menu.DrawTopLayer();
|
||||
}
|
||||
|
||||
void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user