2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-08-26 05:53:48 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2003-01-08 23:43:54 +00:00
|
|
|
Class: ScreenInstructions
|
2002-08-26 05:53:48 +00:00
|
|
|
|
|
|
|
|
Desc: See header.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
2003-01-08 23:43:54 +00:00
|
|
|
#include "ScreenInstructions.h"
|
2002-08-26 05:53:48 +00:00
|
|
|
#include "RageTextureManager.h"
|
|
|
|
|
#include "RageUtil.h"
|
2003-01-02 07:54:28 +00:00
|
|
|
#include "RageSoundManager.h"
|
2002-08-26 05:53:48 +00:00
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "GameState.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2002-12-17 20:58:53 +00:00
|
|
|
#include "PrefsManager.h"
|
2002-08-26 05:53:48 +00:00
|
|
|
|
|
|
|
|
|
2003-01-08 23:43:54 +00:00
|
|
|
#define HELP_TEXT THEME->GetMetric("ScreenInstructions","HelpText")
|
|
|
|
|
#define TIMER_SECONDS THEME->GetMetricI("ScreenInstructions","TimerSeconds")
|
|
|
|
|
#define NEXT_SCREEN_ARCADE THEME->GetMetric("ScreenInstructions","NextScreenArcade")
|
|
|
|
|
#define NEXT_SCREEN_ONI THEME->GetMetric("ScreenInstructions","NextScreenOni")
|
2003-02-25 00:33:42 +00:00
|
|
|
#define NEXT_SCREEN_BATTLE THEME->GetMetric("ScreenInstructions","NextScreenBattle")
|
2002-08-27 03:59:22 +00:00
|
|
|
|
2002-08-26 05:53:48 +00:00
|
|
|
|
2003-01-08 23:43:54 +00:00
|
|
|
ScreenInstructions::ScreenInstructions()
|
2002-08-26 05:53:48 +00:00
|
|
|
{
|
2003-01-08 23:43:54 +00:00
|
|
|
LOG->Trace( "ScreenInstructions::ScreenInstructions()" );
|
2002-08-26 05:53:48 +00:00
|
|
|
|
2003-01-11 08:55:21 +00:00
|
|
|
//
|
2003-02-15 08:08:36 +00:00
|
|
|
// Skip this screen unless someone chose easy or beginner
|
2003-01-11 08:55:21 +00:00
|
|
|
//
|
2003-03-09 00:55:49 +00:00
|
|
|
if( !PREFSMAN->m_bInstructions )
|
|
|
|
|
{
|
|
|
|
|
HandleScreenMessage( SM_GoToNextScreen );
|
|
|
|
|
return;
|
|
|
|
|
}
|
2003-02-25 00:33:42 +00:00
|
|
|
if( GAMESTATE->m_PlayMode == PLAY_MODE_ARCADE )
|
2003-01-11 08:55:21 +00:00
|
|
|
{
|
2003-02-25 00:33:42 +00:00
|
|
|
Difficulty easiestDifficulty = (Difficulty)(NUM_DIFFICULTIES-1);
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
|
|
|
|
if( !GAMESTATE->IsPlayerEnabled(p) )
|
|
|
|
|
continue;
|
|
|
|
|
easiestDifficulty = min( easiestDifficulty, GAMESTATE->m_PreferredDifficulty[p] );
|
|
|
|
|
}
|
|
|
|
|
if( easiestDifficulty > DIFFICULTY_EASY )
|
|
|
|
|
{
|
2003-03-09 00:55:49 +00:00
|
|
|
HandleScreenMessage( SM_GoToNextScreen );
|
2003-02-25 00:33:42 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2002-09-04 21:08:52 +00:00
|
|
|
}
|
|
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
m_Menu.Load("ScreenInstructions");
|
|
|
|
|
this->AddChild( &m_Menu );
|
2002-09-04 21:08:52 +00:00
|
|
|
|
2002-08-26 05:53:48 +00:00
|
|
|
CString sHowToPlayPath;
|
2003-03-09 00:55:49 +00:00
|
|
|
if( GAMESTATE->m_PlayMode != PLAY_MODE_INVALID )
|
|
|
|
|
sHowToPlayPath = THEME->GetPathTo("Graphics","ScreenInstructions "+PlayModeToString(GAMESTATE->m_PlayMode)) ;
|
|
|
|
|
else
|
|
|
|
|
RageException::Throw( "The PlayMode has not been set. A theme must set the PlayMode before showing ScreenInstructions." );
|
2002-08-26 05:53:48 +00:00
|
|
|
|
|
|
|
|
m_sprHowToPlay.Load( sHowToPlayPath );
|
|
|
|
|
m_sprHowToPlay.SetXY( CENTER_X, CENTER_Y );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_sprHowToPlay );
|
2002-08-26 05:53:48 +00:00
|
|
|
|
|
|
|
|
m_sprHowToPlay.SetX( SCREEN_LEFT-SCREEN_WIDTH );
|
2002-09-02 21:59:58 +00:00
|
|
|
m_sprHowToPlay.BeginTweening( 0.4f ); // sleep
|
2003-03-10 00:16:49 +00:00
|
|
|
m_sprHowToPlay.BeginTweening( 0.6f, Actor::TWEEN_DECELERATE );
|
2002-08-27 03:59:22 +00:00
|
|
|
m_sprHowToPlay.SetTweenX( CENTER_X );
|
2002-08-27 16:53:25 +00:00
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds","ScreenInstructions music") );
|
2002-08-26 05:53:48 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-08 23:43:54 +00:00
|
|
|
ScreenInstructions::~ScreenInstructions()
|
2002-08-26 05:53:48 +00:00
|
|
|
{
|
2003-01-08 23:43:54 +00:00
|
|
|
LOG->Trace( "ScreenInstructions::~ScreenInstructions()" );
|
2002-08-26 05:53:48 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-08 23:43:54 +00:00
|
|
|
void ScreenInstructions::Update( float fDeltaTime )
|
2002-08-26 05:53:48 +00:00
|
|
|
{
|
2003-01-08 23:43:54 +00:00
|
|
|
//LOG->Trace( "ScreenInstructions::Update(%f)", fDeltaTime );
|
2002-08-26 05:53:48 +00:00
|
|
|
|
|
|
|
|
Screen::Update( fDeltaTime );
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-08 23:43:54 +00:00
|
|
|
void ScreenInstructions::DrawPrimitives()
|
2002-08-26 05:53:48 +00:00
|
|
|
{
|
|
|
|
|
m_Menu.DrawBottomLayer();
|
2003-03-09 00:55:49 +00:00
|
|
|
Screen::DrawPrimitives();
|
2002-08-26 05:53:48 +00:00
|
|
|
m_Menu.DrawTopLayer();
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-08 23:43:54 +00:00
|
|
|
void ScreenInstructions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
2002-08-26 05:53:48 +00:00
|
|
|
{
|
2003-03-09 00:55:49 +00:00
|
|
|
if( m_Menu.IsTransitioning() )
|
2002-08-26 05:53:48 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// default input handler
|
|
|
|
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-08 23:43:54 +00:00
|
|
|
void ScreenInstructions::HandleScreenMessage( const ScreenMessage SM )
|
2002-08-26 05:53:48 +00:00
|
|
|
{
|
|
|
|
|
switch( SM )
|
|
|
|
|
{
|
|
|
|
|
case SM_MenuTimer:
|
|
|
|
|
this->MenuStart(PLAYER_1);
|
|
|
|
|
break;
|
2002-08-28 22:42:40 +00:00
|
|
|
case SM_GoToPrevScreen:
|
|
|
|
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
|
|
|
|
break;
|
2002-08-27 23:31:41 +00:00
|
|
|
case SM_GoToNextScreen:
|
2002-08-26 05:53:48 +00:00
|
|
|
switch( GAMESTATE->m_PlayMode )
|
|
|
|
|
{
|
|
|
|
|
case PLAY_MODE_ARCADE:
|
2002-08-27 03:59:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( NEXT_SCREEN_ARCADE );
|
2002-08-26 05:53:48 +00:00
|
|
|
break;
|
2003-01-21 05:14:59 +00:00
|
|
|
case PLAY_MODE_NONSTOP:
|
2002-08-26 05:53:48 +00:00
|
|
|
case PLAY_MODE_ONI:
|
|
|
|
|
case PLAY_MODE_ENDLESS:
|
2002-08-27 03:59:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( NEXT_SCREEN_ONI );
|
2002-08-26 05:53:48 +00:00
|
|
|
break;
|
2003-02-25 00:33:42 +00:00
|
|
|
case PLAY_MODE_BATTLE:
|
|
|
|
|
SCREENMAN->SetNewScreen( NEXT_SCREEN_BATTLE );
|
|
|
|
|
break;
|
2002-08-26 05:53:48 +00:00
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-08 23:43:54 +00:00
|
|
|
void ScreenInstructions::MenuBack( PlayerNumber pn )
|
2002-08-26 05:53:48 +00:00
|
|
|
{
|
2003-03-09 00:55:49 +00:00
|
|
|
m_Menu.Back( SM_GoToPrevScreen );
|
2002-08-26 05:53:48 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-08 23:43:54 +00:00
|
|
|
void ScreenInstructions::MenuStart( PlayerNumber pn )
|
2002-08-26 05:53:48 +00:00
|
|
|
{
|
2003-03-09 00:55:49 +00:00
|
|
|
m_Menu.StartTransitioning( SM_GoToNextScreen );
|
2002-08-26 05:53:48 +00:00
|
|
|
|
2002-09-16 00:56:30 +00:00
|
|
|
m_sprHowToPlay.StopTweening();
|
2003-03-10 00:16:49 +00:00
|
|
|
m_sprHowToPlay.BeginTweening( 0.3f, Actor::TWEEN_ACCELERATE );
|
2002-08-27 03:59:22 +00:00
|
|
|
m_sprHowToPlay.SetTweenX( SCREEN_RIGHT+m_sprHowToPlay.GetUnzoomedWidth()/2 );
|
2002-08-26 05:53:48 +00:00
|
|
|
}
|