Files
itgmania212121/stepmania/src/ScreenHowToPlay.cpp
T

119 lines
3.8 KiB
C++
Raw Normal View History

2003-04-05 03:49:03 +00:00
#include "global.h"
/*
-----------------------------------------------------------------------------
Class: ScreenHowToPlay
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScreenHowToPlay.h"
#include "ThemeManager.h"
#include "GameState.h"
#include "GameDef.h"
#include "RageLog.h"
#include "SongManager.h"
#include "NoteFieldPositioning.h"
#include "GameManager.h"
2003-04-05 03:49:03 +00:00
#define SONG_BPM THEME->GetMetricF("ScreenHowToPlay","SongBPM")
#define SECONDS_TO_SHOW THEME->GetMetricF("ScreenHowToPlay","SecondsToShow")
2003-04-05 03:49:03 +00:00
ScreenHowToPlay::ScreenHowToPlay() : ScreenAttract("ScreenHowToPlay")
{
switch(GAMESTATE->m_CurGame) // which style should we use to demonstrate?
{
case GAME_DANCE: GAMESTATE->m_CurStyle = STYLE_DANCE_SINGLE; break;
case GAME_PUMP: GAMESTATE->m_CurStyle = STYLE_PUMP_SINGLE; break;
case GAME_EZ2: GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE; break;
case GAME_PARA: GAMESTATE->m_CurStyle = STYLE_PARA_SINGLE; break;
case GAME_DS3DDX: GAMESTATE->m_CurStyle = STYLE_DS3DDX_SINGLE; break;
case GAME_BM: GAMESTATE->m_CurStyle = STYLE_BM_SINGLE; break;
default: ASSERT(0); // we should cover all gametypes....
}
2003-04-05 03:49:03 +00:00
NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType;
int iNumOfTracks = GAMEMAN->NotesTypeToNumTracks( nt );
ASSERT(iNumOfTracks > 0); // crazy to have less than 1 track....
2003-04-05 03:49:03 +00:00
m_LifeMeter.Load( PLAYER_1 );
m_LifeMeter.SetXY( 480, 40 );
this->AddChild( &m_LifeMeter );
NoteData* pND = new NoteData;
pND->SetNumTracks( iNumOfTracks );
2003-04-05 03:49:03 +00:00
pND->SetTapNote( 0, ROWS_PER_BEAT*12, TAP_TAP );
pND->SetTapNote( 1, ROWS_PER_BEAT*16, TAP_TAP );
pND->SetTapNote( 2, ROWS_PER_BEAT*20, TAP_TAP );
pND->SetTapNote( 0, ROWS_PER_BEAT*24, TAP_TAP );
pND->SetTapNote( 3, ROWS_PER_BEAT*24, TAP_TAP );
pND->SetTapNote( 0, ROWS_PER_BEAT*28, TAP_TAP );
2003-04-05 21:18:31 +00:00
pND->AddHoldNote( HoldNote(2, 32, 35) );
pND->AddHoldNote( HoldNote(0, 36, 39) );
pND->AddHoldNote( HoldNote(3, 36, 39) );
pND->AddHoldNote( HoldNote(2, 40, 43) );
pND->SetTapNote( 0, ROWS_PER_BEAT*44, TAP_TAP );
pND->SetTapNote( 1, (int)(ROWS_PER_BEAT*44.5f), TAP_TAP );
pND->SetTapNote( 2, ROWS_PER_BEAT*45, TAP_TAP );
pND->SetTapNote( 3, (int)(ROWS_PER_BEAT*45.5f), TAP_TAP );
pND->SetTapNote( 0, ROWS_PER_BEAT*46, TAP_TAP );
pND->SetTapNote( 2, ROWS_PER_BEAT*46, TAP_TAP );
2003-04-05 03:49:03 +00:00
m_pSong = new Song;
float fSongBPM = SONG_BPM; // need this on a separate line, otherwise VC6 release build screws up and returns 0
m_pSong->AddBPMSegment( BPMSegment(0.0,fSongBPM) );
m_pSong->AddStopSegment( StopSegment(15,2) );
2003-04-05 03:49:03 +00:00
m_pSong->AddStopSegment( StopSegment(16,2) );
m_pSong->AddStopSegment( StopSegment(20,2) );
m_pSong->AddStopSegment( StopSegment(24,2) );
m_pSong->AddStopSegment( StopSegment(28,2) );
2003-04-05 03:49:03 +00:00
GAMESTATE->m_pCurSong = m_pSong;
GAMESTATE->m_bPastHereWeGo = true;
GAMESTATE->m_PlayerController[PLAYER_1] = PC_AUTOPLAY;
m_Player.Load( PLAYER_1, pND, &m_LifeMeter, NULL, NULL, NULL );
2003-04-05 03:49:03 +00:00
m_Player.SetX( 480 );
2003-05-19 08:47:10 +00:00
m_Player.DontShowJudgement();
2003-04-05 03:49:03 +00:00
this->AddChild( &m_Player );
delete pND;
m_fFakeSecondsIntoSong = 0;
this->ClearMessageQueue();
this->PostScreenMessage( SM_BeginFadingOut, SECONDS_TO_SHOW );
2003-04-05 03:49:03 +00:00
}
ScreenHowToPlay::~ScreenHowToPlay()
{
delete m_pSong;
}
void ScreenHowToPlay::Update( float fDelta )
{
2003-05-28 03:33:46 +00:00
if(GAMESTATE->m_pCurSong != NULL)
{
GAMESTATE->UpdateSongPosition( m_fFakeSecondsIntoSong );
m_fFakeSecondsIntoSong += fDelta;
}
2003-04-05 03:49:03 +00:00
ScreenAttract::Update( fDelta );
}
void ScreenHowToPlay::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
case SM_BeginFadingOut:
2003-05-28 03:33:46 +00:00
/* We can't do this in ScreenHowToPlay::~ScreenHowToPlay, since that happens
* after the ctor of the next screen; we don't want to mess with its state. */
GAMESTATE->m_pCurSong = NULL;
break;
}
ScreenAttract::HandleScreenMessage( SM );
}