allow any of the lifebar, notefield/player, character, or dancepad to be turned off by the metrics.

(still need to write code to update the lifebar if it is used and the player isn't)
This commit is contained in:
Thad Ward
2003-09-08 17:49:44 +00:00
parent 6d9228f4fa
commit f61cf91601
2 changed files with 84 additions and 80 deletions
+78 -71
View File
@@ -23,6 +23,9 @@
#include "NotesLoaderSM.h"
#define SECONDS_TO_SHOW THEME->GetMetricF("ScreenHowToPlay","SecondsToShow")
#define STEPFILE THEME->GetMetric ("ScreenHowToPlay","Stepfile")
#define NUM_PERFECTS THEME->GetMetricI("ScreenHowToPlay","NumPerfects")
#define NUM_MISSES THEME->GetMetricI("ScreenHowToPlay","NumMisses")
//
#define USELIFEBAR THEME->GetMetricB("ScreenHowToPlay","UseLifeMeterBar")
#define LIFEBARONCOMMAND THEME->GetMetric ("ScreenHowToPlay","LifeMeterBarOnCommand")
@@ -35,21 +38,18 @@
//
#define USEPLAYER THEME->GetMetricB("ScreenHowToPlay","UseNotefield")
#define PLAYERX THEME->GetMetricF("ScreenHowToPlay","PlayerX")
#define NUM_PERFECTS THEME->GetMetricI("ScreenHowToPlay","NumPerfects")
#define NUM_MISSES THEME->GetMetricI("ScreenHowToPlay","NumMisses")
//#define SONG_BPM THEME->GetMetricF("ScreenHowToPlay","SongBPM")
#define STEPFILE THEME->GetMetric ("ScreenHowToPlay","Stepfile")
ScreenHowToPlay::ScreenHowToPlay() : ScreenAttract("ScreenHowToPlay")
{
m_bUsingLifeBar = USELIFEBAR;
m_bUsingPlayer = USEPLAYER;
m_bUsingPad = (USEPAD && DoesFileExist("Characters" SLASH "DancePad-DDR.txt"));
m_bUsingCharacter = (USECHARACTER && GAMESTATE->m_pCharacters.size());
m_iPerfects = 0;
m_iNumPerfects = NUM_PERFECTS;
// initialize these because they might not be used.
m_pPlayer = NULL;
m_pLifeMeterBar = NULL;
m_pmCharacter = NULL;
m_pmDancePad = NULL;
m_In.Load( THEME->GetPathToB("ScreenHowToPlay in") );
m_In.StartTransitioning();
@@ -58,42 +58,43 @@ ScreenHowToPlay::ScreenHowToPlay() : ScreenAttract("ScreenHowToPlay")
m_Overlay.LoadFromAniDir( THEME->GetPathToB("ScreenHowToPlay overlay") );
this->AddChild( &m_Overlay );
if( m_bUsingPad )
if( (USEPAD && DoesFileExist("Characters" SLASH "DancePad-DDR.txt")) )
{
m_mDancePad.LoadMilkshapeAscii("Characters" SLASH "DancePad-DDR.txt");
m_mDancePad.SetRotationX( 35 );
m_mDancePad.Command( PADONCOMMAND );
m_pmDancePad = new Model;
m_pmDancePad->LoadMilkshapeAscii("Characters" SLASH "DancePad-DDR.txt");
m_pmDancePad->SetRotationX( 35 );
m_pmDancePad->Command( PADONCOMMAND );
}
// Display random character
if( m_bUsingCharacter )
if( (USECHARACTER && GAMESTATE->m_pCharacters.size()) )
{
Character* rndchar = GAMESTATE->GetRandomCharacter();
m_mCharacter.LoadMilkshapeAscii( rndchar->GetModelPath() );
// m_mCharacter.LoadMilkshapeAsciiBones("howtoplay", rndchar->GetHowToPlayAnimationPath() );
m_mCharacter.LoadMilkshapeAsciiBones( "Step-LEFT","Characters" SLASH "BeginnerHelper_step-left.bones.txt" );
m_mCharacter.LoadMilkshapeAsciiBones( "Step-DOWN","Characters" SLASH "BeginnerHelper_step-down.bones.txt" );
m_mCharacter.LoadMilkshapeAsciiBones( "Step-UP","Characters" SLASH "BeginnerHelper_step-up.bones.txt" );
m_mCharacter.LoadMilkshapeAsciiBones( "Step-RIGHT","Characters" SLASH "BeginnerHelper_step-right.bones.txt" );
m_mCharacter.LoadMilkshapeAsciiBones( "Step-JUMPLR","Characters" SLASH "BeginnerHelper_step-jumplr.bones.txt" );
m_mCharacter.LoadMilkshapeAsciiBones( "rest",rndchar->GetRestAnimationPath() );
m_mCharacter.SetDefaultAnimation( "rest" );
m_mCharacter.PlayAnimation( "rest" );
m_mCharacter.m_bRevertToDefaultAnimation = true; // Stay bouncing after a step has finished animating.
m_pmCharacter = new Model;
m_pmCharacter->LoadMilkshapeAscii( rndchar->GetModelPath() );
// m_pmCharacter->LoadMilkshapeAsciiBones("howtoplay", rndchar->GetHowToPlayAnimationPath() );
m_pmCharacter->LoadMilkshapeAsciiBones( "Step-LEFT","Characters" SLASH "BeginnerHelper_step-left.bones.txt" );
m_pmCharacter->LoadMilkshapeAsciiBones( "Step-DOWN","Characters" SLASH "BeginnerHelper_step-down.bones.txt" );
m_pmCharacter->LoadMilkshapeAsciiBones( "Step-UP","Characters" SLASH "BeginnerHelper_step-up.bones.txt" );
m_pmCharacter->LoadMilkshapeAsciiBones( "Step-RIGHT","Characters" SLASH "BeginnerHelper_step-right.bones.txt" );
m_pmCharacter->LoadMilkshapeAsciiBones( "Step-JUMPLR","Characters" SLASH "BeginnerHelper_step-jumplr.bones.txt" );
m_pmCharacter->LoadMilkshapeAsciiBones( "rest",rndchar->GetRestAnimationPath() );
m_pmCharacter->SetDefaultAnimation( "rest" );
m_pmCharacter->PlayAnimation( "rest" );
m_pmCharacter->m_bRevertToDefaultAnimation = true; // Stay bouncing after a step has finished animating.
m_mCharacter.SetRotationX( 40 );
m_mCharacter.Command( CHARACTERONCOMMAND );
m_pmCharacter->SetRotationX( 40 );
m_pmCharacter->Command( CHARACTERONCOMMAND );
}
LifeMeterBar *pBarUsed = NULL;
// silly to use the lifebar without a player, since the player updates the lifebar
if( m_bUsingLifeBar )
if( USELIFEBAR )
{
m_LifeMeterBar.Load( PLAYER_1 );
m_LifeMeterBar.Command( LIFEBARONCOMMAND );
m_LifeMeterBar.FillForHowToPlay( NUM_PERFECTS, NUM_MISSES );
pBarUsed = &m_LifeMeterBar;
m_pLifeMeterBar = new LifeMeterBar;
m_pLifeMeterBar->Load( PLAYER_1 );
m_pLifeMeterBar->Command( LIFEBARONCOMMAND );
m_pLifeMeterBar->FillForHowToPlay( NUM_PERFECTS, NUM_MISSES );
}
switch(GAMESTATE->m_CurGame) // which style should we use to demonstrate?
@@ -108,28 +109,31 @@ ScreenHowToPlay::ScreenHowToPlay() : ScreenAttract("ScreenHowToPlay")
default: ASSERT(0); // we should cover all gametypes....
}
m_pSong = new Song;
SMLoader smfile;
smfile.LoadFromSMFile( THEME->GetCurThemeDir() + STEPFILE, *m_pSong, false );
ASSERT( m_pSong->m_apNotes.size() == 1 );
smfile.LoadFromSMFile( THEME->GetCurThemeDir() + STEPFILE, m_Song, false );
ASSERT( m_Song.m_apNotes.size() == 1 );
m_Song.m_apNotes[0]->GetNoteData(&m_NoteData);
GAMESTATE->m_pCurSong = m_pSong;
GAMESTATE->m_pCurSong = &m_Song;
GAMESTATE->m_bPastHereWeGo = true;
GAMESTATE->m_PlayerController[PLAYER_1] = PC_AUTOPLAY;
NoteData *pND = new NoteData;
m_pSong->m_apNotes[0]->GetNoteData(pND);
m_Player.Load( PLAYER_1, pND, pBarUsed, NULL, NULL, NULL, NULL, NULL );
delete pND;
m_Player.SetX( PLAYERX );
if( USEPLAYER )
{
m_pPlayer = new Player;
m_pPlayer->Load( PLAYER_1, &m_NoteData, m_pLifeMeterBar, NULL, NULL, NULL, NULL, NULL );
m_pPlayer->SetX( PLAYERX );
this->AddChild( m_pPlayer );
}
// deferred until after the player, so the notes go under it
if( m_pLifeMeterBar )
this->AddChild( m_pLifeMeterBar );
// Don't show judgement
GAMESTATE->m_PlayerOptions[PLAYER_1].m_fBlind = 1;
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
GAMESTATE->m_bDemonstrationOrJukebox = true;
this->AddChild( &m_Player );
if( m_bUsingLifeBar )
this->AddChild( &m_LifeMeterBar );
m_fFakeSecondsIntoSong = 0;
this->ClearMessageQueue();
@@ -142,7 +146,10 @@ ScreenHowToPlay::ScreenHowToPlay() : ScreenAttract("ScreenHowToPlay")
ScreenHowToPlay::~ScreenHowToPlay()
{
delete m_pSong;
SAFE_DELETE(m_pLifeMeterBar);
SAFE_DELETE(m_pmCharacter);
SAFE_DELETE(m_pmDancePad);
SAFE_DELETE(m_pPlayer);
}
void ScreenHowToPlay::Step( float fDelta )
@@ -158,31 +165,31 @@ void ScreenHowToPlay::Step( float fDelta )
int iStep = 0;
int iNoteRow = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat + 0.6f );
int iNumTracks = m_Player.GetNumTracks();
int iNumTracks = m_NoteData.GetNumTracks();
// if we want to miss from here on out, don't process steps.
if((m_iPerfects < m_iNumPerfects) && (m_Player.IsThereATapAtRow( iNoteRow )))
if((m_iPerfects < m_iNumPerfects) && (m_NoteData.IsThereATapAtRow( iNoteRow )))
{
for( int k=0; k<iNumTracks; k++ )
if( m_Player.GetTapNote(k, iNoteRow ) == TAP_TAP )
if( m_NoteData.GetTapNote(k, iNoteRow ) == TAP_TAP )
iStep += 1 << (iNumTracks - (k + 1));
switch( iStep )
{
case ST_LEFT: m_mCharacter.PlayAnimation( "Step-LEFT", 1.8f ); break;
case ST_RIGHT: m_mCharacter.PlayAnimation( "Step-RIGHT", 1.8f ); break;
case ST_UP: m_mCharacter.PlayAnimation( "Step-UP", 1.8f ); break;
case ST_DOWN: m_mCharacter.PlayAnimation( "Step-DOWN", 1.8f ); break;
case ST_JUMPLR: m_mCharacter.PlayAnimation( "Step-JUMPLR", 1.8f ); break;
case ST_LEFT: m_pmCharacter->PlayAnimation( "Step-LEFT", 1.8f ); break;
case ST_RIGHT: m_pmCharacter->PlayAnimation( "Step-RIGHT", 1.8f ); break;
case ST_UP: m_pmCharacter->PlayAnimation( "Step-UP", 1.8f ); break;
case ST_DOWN: m_pmCharacter->PlayAnimation( "Step-DOWN", 1.8f ); break;
case ST_JUMPLR: m_pmCharacter->PlayAnimation( "Step-JUMPLR", 1.8f ); break;
case ST_JUMPUD:
// Until I can get an UP+DOWN jump animation, this will have to do.
m_mCharacter.PlayAnimation( "Step-JUMPLR", 1.8f );
m_pmCharacter->PlayAnimation( "Step-JUMPLR", 1.8f );
m_mCharacter.StopTweening();
m_mCharacter.BeginTweening( GAMESTATE->m_fCurBPS /8, TWEEN_LINEAR );
m_mCharacter.SetRotationY( 90 );
m_mCharacter.BeginTweening( (1/(GAMESTATE->m_fCurBPS * 2) ) ); //sleep between jump-frames
m_mCharacter.BeginTweening( GAMESTATE->m_fCurBPS /6, TWEEN_LINEAR );
m_mCharacter.SetRotationY( 0 );
m_pmCharacter->StopTweening();
m_pmCharacter->BeginTweening( GAMESTATE->m_fCurBPS /8, TWEEN_LINEAR );
m_pmCharacter->SetRotationY( 90 );
m_pmCharacter->BeginTweening( (1/(GAMESTATE->m_fCurBPS * 2) ) ); //sleep between jump-frames
m_pmCharacter->BeginTweening( GAMESTATE->m_fCurBPS /6, TWEEN_LINEAR );
m_pmCharacter->SetRotationY( 0 );
break;
}
}
@@ -191,7 +198,7 @@ void ScreenHowToPlay::Step( float fDelta )
if( GAMESTATE->m_bFreeze )
rate = 0;
m_mCharacter.Update( fDelta * rate );
m_pmCharacter->Update( fDelta * rate );
}
void ScreenHowToPlay::Update( float fDelta )
@@ -204,7 +211,7 @@ void ScreenHowToPlay::Update( float fDelta )
static int iLastNoteRowCounted = 0;
int iCurNoteRow = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat );
if(( iCurNoteRow != iLastNoteRowCounted ) &&(m_Player.IsThereATapAtRow( iCurNoteRow )))
if(( iCurNoteRow != iLastNoteRowCounted ) &&(m_NoteData.IsThereATapAtRow( iCurNoteRow )))
{
m_iPerfects++;
iLastNoteRowCounted = iCurNoteRow;
@@ -215,14 +222,14 @@ void ScreenHowToPlay::Update( float fDelta )
if(m_iPerfects > m_iNumPerfects)
GAMESTATE->m_PlayerController[PLAYER_1] = PC_HUMAN;
if ( m_bUsingCharacter )
if ( m_pmCharacter )
{
Step( fDelta );
}
}
if( m_bUsingPad )
m_mDancePad.Update( fDelta );
if( m_pmDancePad )
m_pmDancePad->Update( fDelta );
ScreenAttract::Update( fDelta );
}
@@ -242,7 +249,7 @@ void ScreenHowToPlay::DrawPrimitives()
{
Screen::DrawPrimitives();
if( m_bUsingPad || m_bUsingCharacter )
if( m_pmDancePad || m_pmCharacter )
{
DISPLAY->SetLighting( true );
DISPLAY->SetLightDirectional(
@@ -252,10 +259,10 @@ void ScreenHowToPlay::DrawPrimitives()
RageColor(0,0,0,1),
RageVector3(0, 0, 1) );
if( m_bUsingCharacter )
m_mCharacter.Draw();
if( m_bUsingPad )
m_mDancePad.Draw();
if( m_pmCharacter )
m_pmCharacter->Draw();
if( m_pmDancePad )
m_pmDancePad->Draw();
DISPLAY->SetLightOff( 0 );
DISPLAY->SetLighting( false );
+6 -9
View File
@@ -28,19 +28,16 @@ public:
protected:
virtual void Step( float fDelta );
LifeMeterBar m_LifeMeterBar;
LifeMeterBar* m_pLifeMeterBar;
BGAnimation m_Overlay;
Player m_Player;
Model m_mCharacter;
Model m_mDancePad;
bool m_bUsingCharacter;
bool m_bUsingPad;
bool m_bUsingLifeBar;
bool m_bUsingPlayer;
Player* m_pPlayer;
Model* m_pmCharacter;
Model* m_pmDancePad;
int m_iPerfects;
int m_iNumPerfects;
Song* m_pSong;
Song m_Song;
NoteData m_NoteData;
float m_fFakeSecondsIntoSong;
};