2003-02-16 04:01:45 +00:00
#include "global.h"
2002-05-20 08:59:37 +00:00
/*
-----------------------------------------------------------------------------
Class: ScreenGameplay
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScreenGameplay.h"
#include "SongManager.h"
#include "ScreenManager.h"
#include "GameConstantsAndTypes.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2002-05-20 08:59:37 +00:00
#include "GameManager.h"
#include "SongManager.h"
#include "RageLog.h"
#include "AnnouncerManager.h"
2002-07-23 01:41:40 +00:00
#include "LifeMeterBar.h"
#include "LifeMeterBattery.h"
#include "GameState.h"
#include "ScoreDisplayNormal.h"
#include "ScoreDisplayOni.h"
2002-07-27 19:29:51 +00:00
#include "ScreenPrompt.h"
2002-08-27 03:59:22 +00:00
#include "GrooveRadar.h"
2002-09-06 23:36:04 +00:00
#include "NotesLoaderSM.h"
2002-11-11 04:53:31 +00:00
#include "ThemeManager.h"
2002-05-20 08:59:37 +00:00
2003-01-25 07:40:47 +00:00
#include "RageTimer.h"
2002-05-20 08:59:37 +00:00
//
2002-07-23 01:41:40 +00:00
// Defines
2002-05-20 08:59:37 +00:00
//
2003-02-14 21:42:44 +00:00
#define SONGSEL_SCREEN THEME->GetMetric("ScreenGameplay","SongSelectScreen")
#define MAXCOMBO_X THEME->GetMetricF("ScreenGameplay","MAXCOMBOX") // Please follow the capitalization conventions used everywhere else. This is case sensitive. -Chris
#define MAXCOMBO_Y THEME->GetMetricF("ScreenGameplay","MAXCOMBOY")
#define MAXCOMBO_ZOOM THEME->GetMetricF("ScreenGameplay","MAXCOMBOZoom")
#define BPM_X THEME->GetMetricF("ScreenGameplay","BPMX")
#define BPM_Y THEME->GetMetricF("ScreenGameplay","BPMY")
#define BPM_ZOOM THEME->GetMetricF("ScreenGameplay","BPMZoom")
#define STAGENAME_X THEME->GetMetricF("ScreenGameplay","StagenameX")
#define STAGENAME_Y THEME->GetMetricF("ScreenGameplay","StagenameY")
#define STAGENAME_ZOOM THEME->GetMetricF("ScreenGameplay","StagenameZoom")
2002-09-10 17:29:11 +00:00
#define LIFE_FRAME_X THEME->GetMetricF("ScreenGameplay","LifeFrameX")
#define LIFE_FRAME_Y( e ) THEME->GetMetricF("ScreenGameplay",ssprintf("LifeFrame%sY",e?"Extra":""))
#define SCORE_FRAME_X THEME->GetMetricF("ScreenGameplay","ScoreFrameX")
#define SCORE_FRAME_Y( e ) THEME->GetMetricF("ScreenGameplay",ssprintf("ScoreFrame%sY",e?"Extra":""))
2002-08-27 03:59:22 +00:00
#define MIDDLE_FRAME_X THEME->GetMetricF("ScreenGameplay","MiddleFrameX")
#define MIDDLE_FRAME_Y THEME->GetMetricF("ScreenGameplay","MiddleFrameY")
2002-08-29 20:18:41 +00:00
#define LIFE_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("LifeP%dX",p+1))
#define LIFE_Y( p, e ) THEME->GetMetricF("ScreenGameplay",ssprintf("LifeP%d%sY",p+1,e?"Extra":""))
2002-08-27 03:59:22 +00:00
#define STAGE_X THEME->GetMetricF("ScreenGameplay","StageX")
2002-08-29 20:18:41 +00:00
#define STAGE_Y( e ) THEME->GetMetricF("ScreenGameplay",ssprintf("Stage%sY",e?"Extra":""))
#define SONG_NUMBER_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("SongNumberP%dX",p+1))
#define SONG_NUMBER_Y( p, e ) THEME->GetMetricF("ScreenGameplay",ssprintf("SongNumberP%d%sY",p+1,e?"Extra":""))
#define SCORE_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("ScoreP%dX",p+1))
#define SCORE_Y( p, e ) THEME->GetMetricF("ScreenGameplay",ssprintf("ScoreP%d%sY",p+1,e?"Extra":""))
2002-09-23 07:35:47 +00:00
#define SCORE_ZOOM THEME->GetMetricF("ScreenGameplay","ScoreZoom")
2002-08-29 20:18:41 +00:00
#define PLAYER_OPTIONS_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("PlayerOptionsP%dX",p+1))
#define PLAYER_OPTIONS_Y( p, e ) THEME->GetMetricF("ScreenGameplay",ssprintf("PlayerOptionsP%d%sY",p+1,e?"Extra":""))
2002-08-27 03:59:22 +00:00
#define SONG_OPTIONS_X THEME->GetMetricF("ScreenGameplay","SongOptionsX")
2002-08-29 20:18:41 +00:00
#define SONG_OPTIONS_Y( e ) THEME->GetMetricF("ScreenGameplay",ssprintf("SongOptions%sY",e?"Extra":""))
#define DIFFICULTY_X( p ) THEME->GetMetricF("ScreenGameplay",ssprintf("DifficultyP%dX",p+1))
#define DIFFICULTY_Y( p, e, r ) THEME->GetMetricF("ScreenGameplay",ssprintf("DifficultyP%d%s%sY",p+1,e?"Extra":"",r?"Reverse":""))
2002-08-27 03:59:22 +00:00
#define DEBUG_X THEME->GetMetricF("ScreenGameplay","DebugX")
#define DEBUG_Y THEME->GetMetricF("ScreenGameplay","DebugY")
2003-01-11 08:55:21 +00:00
#define STATUS_ICONS_X THEME->GetMetricF("ScreenGameplay","StatusIconsX")
#define STATUS_ICONS_Y THEME->GetMetricF("ScreenGameplay","StatusIconsY")
2002-08-27 03:59:22 +00:00
#define SURVIVE_TIME_X THEME->GetMetricF("ScreenGameplay","SurviveTimeX")
#define SURVIVE_TIME_Y THEME->GetMetricF("ScreenGameplay","SurviveTimeY")
#define SECONDS_BETWEEN_COMMENTS THEME->GetMetricF("ScreenGameplay","SecondsBetweenComments")
2002-09-02 21:59:58 +00:00
#define TICK_EARLY_SECONDS THEME->GetMetricF("ScreenGameplay","TickEarlySeconds")
2003-02-07 23:57:52 +00:00
static float g_fTickEarlySecondsCache = 0 ; // reading directly out of theme metrics is slow
2002-05-20 08:59:37 +00:00
// received while STATE_DANCING
2002-08-01 03:15:27 +00:00
const ScreenMessage SM_NotesEnded = ScreenMessage ( SM_User + 101 );
const ScreenMessage SM_BeginLoadingNextSong = ScreenMessage ( SM_User + 102 );
2002-08-26 05:53:48 +00:00
const ScreenMessage SM_PlayToastySound = ScreenMessage ( SM_User + 105 );
2002-05-20 08:59:37 +00:00
// received while STATE_OUTRO
const ScreenMessage SM_ShowCleared = ScreenMessage ( SM_User + 111 );
2002-09-10 01:13:45 +00:00
const ScreenMessage SM_ShowTryExtraStage = ScreenMessage ( SM_User + 112 );
2002-08-01 05:11:11 +00:00
const ScreenMessage SM_SaveChangedBeforeGoingBack = ScreenMessage ( SM_User + 113 );
const ScreenMessage SM_GoToScreenAfterBack = ScreenMessage ( SM_User + 114 );
const ScreenMessage SM_GoToStateAfterCleared = ScreenMessage ( SM_User + 115 );
2002-05-20 08:59:37 +00:00
const ScreenMessage SM_BeginFailed = ScreenMessage ( SM_User + 121 );
const ScreenMessage SM_ShowFailed = ScreenMessage ( SM_User + 122 );
const ScreenMessage SM_PlayFailComment = ScreenMessage ( SM_User + 123 );
2002-07-27 19:29:51 +00:00
const ScreenMessage SM_GoToScreenAfterFail = ScreenMessage ( SM_User + 125 );
2002-05-20 08:59:37 +00:00
2003-01-25 07:40:47 +00:00
// received while STATE_INTRO
const ScreenMessage SM_StartHereWeGo = ScreenMessage ( SM_User + 130 );
const ScreenMessage SM_StopHereWeGo = ScreenMessage ( SM_User + 131 );
2002-05-20 08:59:37 +00:00
2003-01-19 04:44:22 +00:00
ScreenGameplay :: ScreenGameplay ( bool bDemonstration )
2002-05-20 08:59:37 +00:00
{
2002-07-31 19:40:40 +00:00
LOG -> Trace ( "ScreenGameplay::ScreenGameplay()" );
2002-05-20 08:59:37 +00:00
2003-02-04 21:36:30 +00:00
if ( GAMESTATE -> m_pCurSong == NULL && GAMESTATE -> m_pCurCourse == NULL )
2003-01-19 21:05:03 +00:00
return ; // ScreenDemonstration will move us to the next scren. We just need to survive for one update without crashing.
2002-08-28 22:42:40 +00:00
{
2003-02-14 21:42:44 +00:00
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
{
m_pLifeMeter [ p ] = NULL ;
m_pScoreDisplay [ p ] = NULL ;
}
2002-08-28 22:42:40 +00:00
}
2002-09-02 21:59:58 +00:00
g_fTickEarlySecondsCache = TICK_EARLY_SECONDS ;
2003-01-10 02:22:07 +00:00
2003-01-24 02:43:07 +00:00
GAMESTATE -> m_CurStageStats = StageStats (); // clear values
2003-02-14 21:42:44 +00:00
2003-01-24 02:43:07 +00:00
// Fill in m_CurStageStats
2003-02-14 21:42:44 +00:00
NoteData notedata ;
switch ( GAMESTATE -> m_PlayMode )
2002-06-14 22:25:22 +00:00
{
2003-02-14 21:42:44 +00:00
case PLAY_MODE_ARCADE :
2002-06-14 22:25:22 +00:00
{
2003-01-24 02:43:07 +00:00
GAMESTATE -> m_CurStageStats . pSong = GAMESTATE -> m_pCurSong ;
2003-02-14 21:42:44 +00:00
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-07-23 01:41:40 +00:00
{
2003-02-14 21:42:44 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( p ) )
continue ; // skip
GAMESTATE -> m_CurStageStats . iMeter [ p ] = GAMESTATE -> m_pCurNotes [ p ] -> GetMeter ();
GAMESTATE -> m_pCurNotes [ p ] -> GetNoteData ( & notedata );
GAMESTATE -> m_CurStageStats . iPossibleDancePoints [ p ] = notedata . GetPossibleDancePoints ();
2002-06-14 22:25:22 +00:00
}
}
2003-02-14 21:42:44 +00:00
break ;
case PLAY_MODE_NONSTOP :
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
{
Course * pCourse = GAMESTATE -> m_pCurCourse ;
2003-02-16 10:12:03 +00:00
pCourse -> GetStageInfo ( m_apCourseSongs , m_apCourseNotes , m_asCourseModifiers , GAMESTATE -> GetCurrentStyleDef () -> m_NotesType , false );
2003-02-14 21:42:44 +00:00
int iTotalMeter = 0 ;
int iTotalPossibleDancePoints = 0 ;
for ( unsigned i = 0 ; i < m_apCourseNotes . size (); i ++ )
{
iTotalMeter += m_apCourseNotes [ i ] -> GetMeter ();
m_apCourseNotes [ i ] -> GetNoteData ( & notedata );
iTotalPossibleDancePoints += notedata . GetPossibleDancePoints ();
}
GAMESTATE -> m_CurStageStats . pSong = NULL ;
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
{
if ( ! GAMESTATE -> IsPlayerEnabled ( p ) )
continue ; // skip
GAMESTATE -> m_CurStageStats . iMeter [ p ] = iTotalMeter ;
GAMESTATE -> m_CurStageStats . iPossibleDancePoints [ p ] = iTotalPossibleDancePoints ;
}
}
break ;
default :
ASSERT ( 0 );
2002-06-14 22:25:22 +00:00
}
2003-01-10 02:22:07 +00:00
const bool bExtra = GAMESTATE -> IsExtraStage () || GAMESTATE -> IsExtraStage2 ();
const bool bReverse [ NUM_PLAYERS ] = {
GAMESTATE -> m_PlayerOptions [ 0 ]. m_bReverseScroll ,
GAMESTATE -> m_PlayerOptions [ 1 ]. m_bReverseScroll
};
2003-01-11 08:55:21 +00:00
m_bChangedOffsetOrBPM = GAMESTATE -> m_SongOptions . m_bAutoSync ;
2002-07-28 20:28:37 +00:00
2002-05-20 08:59:37 +00:00
m_DancingState = STATE_INTRO ;
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-05-20 08:59:37 +00:00
2002-10-28 05:30:45 +00:00
m_Background . SetDiffuse ( RageColor ( 0.4f , 0.4f , 0.4f , 1 ) );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_Background );
2002-05-20 08:59:37 +00:00
2003-02-14 22:39:23 +00:00
int p ;
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-05-27 08:23:27 +00:00
{
2002-07-23 01:41:40 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( PlayerNumber ( p )) )
2002-05-27 08:23:27 +00:00
continue ;
2002-08-01 21:55:40 +00:00
float fPlayerX = ( float ) GAMESTATE -> GetCurrentStyleDef () -> m_iCenterX [ p ];
m_Player [ p ]. SetX ( fPlayerX );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_Player [ p ] );
2002-08-01 21:55:40 +00:00
2002-08-13 23:26:46 +00:00
m_sprOniGameOver [ p ]. Load ( THEME -> GetPathTo ( "Graphics" , "gameplay oni gameover" ) );
2002-08-01 21:55:40 +00:00
m_sprOniGameOver [ p ]. SetX ( fPlayerX );
m_sprOniGameOver [ p ]. SetY ( SCREEN_TOP - m_sprOniGameOver [ p ]. GetZoomedHeight () / 2 );
2002-10-28 05:30:45 +00:00
m_sprOniGameOver [ p ]. SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) ); // 0 alpha so we don't waste time drawing while not visible
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_sprOniGameOver [ p ] );
2002-05-27 08:23:27 +00:00
}
2002-05-20 08:59:37 +00:00
2002-08-01 21:55:40 +00:00
m_OniFade . SetOpened ();
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_OniFade );
2002-08-01 21:55:40 +00:00
2002-08-13 23:26:46 +00:00
m_sprMiddleFrame . Load ( THEME -> GetPathTo ( "Graphics" , "Gameplay Middle Frame" ) );
m_sprMiddleFrame . SetXY ( MIDDLE_FRAME_X , MIDDLE_FRAME_Y );
2002-06-14 22:25:22 +00:00
2002-10-18 19:01:32 +00:00
// LifeFrame goes below LifeMeter
CString sLifeFrameName ;
if ( bExtra )
sLifeFrameName = "gameplay extra life frame" ;
else if ( GAMESTATE -> m_SongOptions . m_LifeType == SongOptions :: LIFE_BATTERY )
sLifeFrameName = "gameplay oni life frame" ;
else
sLifeFrameName = "gameplay life frame" ;
m_sprLifeFrame . Load ( THEME -> GetPathTo ( "Graphics" , sLifeFrameName ) );
m_sprLifeFrame . SetXY ( LIFE_FRAME_X , LIFE_FRAME_Y ( bExtra ) );
this -> AddChild ( & m_sprLifeFrame );
2002-05-20 08:59:37 +00:00
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
{
2002-07-28 20:28:37 +00:00
switch ( GAMESTATE -> m_SongOptions . m_LifeType )
2002-07-23 01:41:40 +00:00
{
2002-07-28 20:28:37 +00:00
case SongOptions :: LIFE_BAR :
2002-07-23 01:41:40 +00:00
m_pLifeMeter [ p ] = new LifeMeterBar ;
break ;
2002-07-28 20:28:37 +00:00
case SongOptions :: LIFE_BATTERY :
2002-07-23 01:41:40 +00:00
m_pLifeMeter [ p ] = new LifeMeterBattery ;
break ;
default :
ASSERT ( 0 );
}
2002-05-28 20:01:22 +00:00
2002-07-28 20:28:37 +00:00
m_pLifeMeter [ p ] -> Load ( ( PlayerNumber ) p );
2002-08-13 23:26:46 +00:00
m_pLifeMeter [ p ] -> SetXY ( LIFE_X ( p ), LIFE_Y ( p , bExtra ) );
2002-09-02 21:59:58 +00:00
this -> AddChild ( m_pLifeMeter [ p ] );
2002-05-20 08:59:37 +00:00
}
2002-06-14 22:25:22 +00:00
2002-09-03 22:31:06 +00:00
m_textStageNumber . LoadFromFont ( THEME -> GetPathTo ( "Fonts" , "gameplay stage" ) );
2002-06-14 22:25:22 +00:00
m_textStageNumber . TurnShadowOff ();
2002-08-29 20:18:41 +00:00
m_textStageNumber . SetXY ( STAGE_X , STAGE_Y ( bExtra ) );
2002-07-23 01:41:40 +00:00
m_textStageNumber . SetText ( GAMESTATE -> GetStageText () );
2002-09-02 21:59:58 +00:00
m_textStageNumber . SetDiffuse ( GAMESTATE -> GetStageColor () );
2002-07-23 01:41:40 +00:00
2002-08-01 21:11:32 +00:00
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-08-01 03:15:27 +00:00
{
2002-08-13 23:26:46 +00:00
m_textCourseSongNumber [ p ]. LoadFromFont ( THEME -> GetPathTo ( "Fonts" , "Header2" ) );
2002-08-01 03:15:27 +00:00
m_textCourseSongNumber [ p ]. TurnShadowOff ();
2002-08-13 23:26:46 +00:00
m_textCourseSongNumber [ p ]. SetXY ( SONG_NUMBER_X ( p ), SONG_NUMBER_Y ( p , bExtra ) );
2002-08-01 03:15:27 +00:00
m_textCourseSongNumber [ p ]. SetText ( "" );
2002-09-02 21:59:58 +00:00
m_textCourseSongNumber [ p ]. SetDiffuse ( GAMESTATE -> GetStageColor () ); // light blue
2002-08-01 03:15:27 +00:00
}
switch ( GAMESTATE -> m_PlayMode )
{
case PLAY_MODE_ARCADE :
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_textStageNumber );
2002-08-01 03:15:27 +00:00
break ;
2003-01-21 05:14:59 +00:00
case PLAY_MODE_NONSTOP :
2002-08-01 03:15:27 +00:00
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
2002-08-01 21:11:32 +00:00
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-08-01 13:42:56 +00:00
if ( GAMESTATE -> IsPlayerEnabled ( p ) )
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_textCourseSongNumber [ p ] );
2002-08-01 03:15:27 +00:00
break ;
default :
ASSERT ( 0 ); // invalid GameMode
}
2002-06-14 22:25:22 +00:00
2002-08-28 22:42:40 +00:00
//
2002-09-10 17:29:11 +00:00
// Add all Actors in score frame
2002-08-28 22:42:40 +00:00
//
2002-09-10 17:29:11 +00:00
CString sScoreFrameName ;
2002-09-10 16:57:13 +00:00
if ( bExtra )
2002-09-10 17:29:11 +00:00
sScoreFrameName = "gameplay extra score frame" ;
2002-09-10 16:57:13 +00:00
else if ( GAMESTATE -> m_SongOptions . m_LifeType == SongOptions :: LIFE_BATTERY )
2002-09-10 17:29:11 +00:00
sScoreFrameName = "gameplay oni score frame" ;
2002-09-10 16:57:13 +00:00
else
2002-09-10 17:29:11 +00:00
sScoreFrameName = "gameplay score frame" ;
m_sprScoreFrame . Load ( THEME -> GetPathTo ( "Graphics" , sScoreFrameName ) );
m_sprScoreFrame . SetXY ( SCORE_FRAME_X , SCORE_FRAME_Y ( bExtra ) );
this -> AddChild ( & m_sprScoreFrame );
2002-05-20 08:59:37 +00:00
2002-10-30 00:14:47 +00:00
m_StageName . LoadFromFont ( THEME -> GetPathTo ( "Fonts" , "musicwheel text banner" ) );
m_StageName . TurnShadowOff ();
m_StageName . SetXY ( STAGENAME_X , STAGENAME_Y );
m_StageName . SetZoom ( STAGENAME_ZOOM );
this -> AddChild ( & m_StageName );
2002-11-07 19:42:39 +00:00
m_MaxCombo . LoadFromNumbers ( THEME -> GetPathTo ( "Numbers" , "gameplay score numbers" ) );
m_MaxCombo . SetXY ( MAXCOMBO_X , MAXCOMBO_Y );
m_MaxCombo . SetZoom ( MAXCOMBO_ZOOM );
m_MaxCombo . SetText ( ssprintf ( "%d" , m_Player [ GAMESTATE -> m_MasterPlayerNumber ]. GetPlayersMaxCombo ()) ); /* MAKE THIS WORK FOR BOTH PLAYERS! */
this -> AddChild ( & m_MaxCombo );
2002-05-20 08:59:37 +00:00
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
{
2002-07-23 01:41:40 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( PlayerNumber ( p )) )
2002-05-20 08:59:37 +00:00
continue ;
2002-07-30 01:45:18 +00:00
2002-08-28 22:42:40 +00:00
switch ( GAMESTATE -> m_PlayMode )
2002-08-13 23:26:46 +00:00
{
2002-08-28 22:42:40 +00:00
case PLAY_MODE_ARCADE :
m_pScoreDisplay [ p ] = new ScoreDisplayNormal ;
break ;
2003-01-21 05:14:59 +00:00
case PLAY_MODE_NONSTOP :
2002-08-28 22:42:40 +00:00
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
m_pScoreDisplay [ p ] = new ScoreDisplayOni ;
break ;
default :
ASSERT ( 0 );
}
m_pScoreDisplay [ p ] -> Init ( ( PlayerNumber ) p );
m_pScoreDisplay [ p ] -> SetXY ( SCORE_X ( p ), SCORE_Y ( p , bExtra ) );
2002-09-23 07:35:47 +00:00
m_pScoreDisplay [ p ] -> SetZoom ( SCORE_ZOOM );
2002-09-02 21:59:58 +00:00
m_pScoreDisplay [ p ] -> SetDiffuse ( PlayerToColor ( p ) );
this -> AddChild ( m_pScoreDisplay [ p ] );
2002-07-12 22:01:32 +00:00
2002-08-13 23:26:46 +00:00
m_textPlayerOptions [ p ]. LoadFromFont ( THEME -> GetPathTo ( "Fonts" , "normal" ) );
2002-05-28 20:01:22 +00:00
m_textPlayerOptions [ p ]. TurnShadowOff ();
2002-08-13 23:26:46 +00:00
m_textPlayerOptions [ p ]. SetXY ( PLAYER_OPTIONS_X ( p ), PLAYER_OPTIONS_Y ( p , bExtra ) );
2002-05-28 20:01:22 +00:00
m_textPlayerOptions [ p ]. SetZoom ( 0.5f );
2002-10-28 05:30:45 +00:00
m_textPlayerOptions [ p ]. SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_textPlayerOptions [ p ] );
2002-05-20 08:59:37 +00:00
}
2002-08-13 23:26:46 +00:00
m_textSongOptions . LoadFromFont ( THEME -> GetPathTo ( "Fonts" , "normal" ) );
m_textSongOptions . TurnShadowOff ();
2002-08-29 20:18:41 +00:00
m_textSongOptions . SetXY ( SONG_OPTIONS_X , SONG_OPTIONS_Y ( bExtra ) );
2002-08-13 23:26:46 +00:00
m_textSongOptions . SetZoom ( 0.5f );
2002-10-28 05:30:45 +00:00
m_textSongOptions . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-08-13 23:26:46 +00:00
m_textSongOptions . SetText ( GAMESTATE -> m_SongOptions . GetString () );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_textSongOptions );
2002-06-14 22:25:22 +00:00
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
{
2002-07-23 01:41:40 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( PlayerNumber ( p )) )
2002-06-14 22:25:22 +00:00
continue ;
2002-07-23 01:41:40 +00:00
2003-01-21 22:23:01 +00:00
m_DifficultyIcon [ p ]. Load ( THEME -> GetPathTo ( "graphics" , "gameplay difficulty icons 2x5" ) );
2002-10-06 16:56:58 +00:00
m_DifficultyIcon [ p ]. SetXY ( DIFFICULTY_X ( p ), DIFFICULTY_Y ( p , bExtra , bReverse [ p ]) );
this -> AddChild ( & m_DifficultyIcon [ p ] );
2002-06-14 22:25:22 +00:00
}
2002-08-13 23:26:46 +00:00
m_textDebug . LoadFromFont ( THEME -> GetPathTo ( "Fonts" , "normal" ) );
2002-06-24 22:04:31 +00:00
m_textDebug . SetXY ( DEBUG_X , DEBUG_Y );
2002-10-28 05:30:45 +00:00
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_textDebug );
2002-08-23 20:18:29 +00:00
2003-01-11 08:55:21 +00:00
for ( int s = 0 ; s < NUM_STATUS_ICONS ; s ++ )
{
m_sprStatusIcons [ s ]. Load ( THEME -> GetPathTo ( "Graphics" , ssprintf ( "gameplay status icons 1x%d" , NUM_STATUS_ICONS )) );
m_sprStatusIcons [ s ]. StopAnimating ();
m_sprStatusIcons [ s ]. SetState ( s );
this -> AddChild ( & m_sprStatusIcons [ s ] );
}
PositionStatusIcons (); // position them
2002-05-20 08:59:37 +00:00
2002-06-24 22:04:31 +00:00
2002-05-20 08:59:37 +00:00
m_StarWipe . SetClosed ();
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_StarWipe );
2002-05-20 08:59:37 +00:00
2002-08-13 23:26:46 +00:00
m_sprReady . Load ( THEME -> GetPathTo ( "Graphics" , "gameplay ready" ) );
2002-05-20 08:59:37 +00:00
m_sprReady . SetXY ( CENTER_X , CENTER_Y );
2002-10-28 05:30:45 +00:00
m_sprReady . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_sprReady );
2002-05-20 08:59:37 +00:00
2002-08-13 23:26:46 +00:00
m_sprHereWeGo . Load ( THEME -> GetPathTo ( "Graphics" , "gameplay here we go" ) );
2002-05-20 08:59:37 +00:00
m_sprHereWeGo . SetXY ( CENTER_X , CENTER_Y );
2002-10-28 05:30:45 +00:00
m_sprHereWeGo . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_sprHereWeGo );
2002-05-20 08:59:37 +00:00
2002-08-13 23:26:46 +00:00
m_sprCleared . Load ( THEME -> GetPathTo ( "Graphics" , "gameplay cleared" ) );
2002-05-20 08:59:37 +00:00
m_sprCleared . SetXY ( CENTER_X , CENTER_Y );
2002-10-28 05:30:45 +00:00
m_sprCleared . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_sprCleared );
2002-05-20 08:59:37 +00:00
2002-08-13 23:26:46 +00:00
m_sprFailed . Load ( THEME -> GetPathTo ( "Graphics" , "gameplay failed" ) );
2002-05-20 08:59:37 +00:00
m_sprFailed . SetXY ( CENTER_X , CENTER_Y );
2002-10-28 05:30:45 +00:00
m_sprFailed . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_sprFailed );
2002-05-20 08:59:37 +00:00
2002-09-10 01:13:45 +00:00
if ( GAMESTATE -> IsFinalStage () )
m_sprTryExtraStage . Load ( THEME -> GetPathTo ( "Graphics" , "gameplay try extra stage1" ) );
else if ( GAMESTATE -> IsExtraStage () )
m_sprTryExtraStage . Load ( THEME -> GetPathTo ( "Graphics" , "gameplay try extra stage2" ) );
m_sprTryExtraStage . SetXY ( CENTER_X , CENTER_Y );
2002-10-28 05:30:45 +00:00
m_sprTryExtraStage . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-09-10 01:13:45 +00:00
this -> AddChild ( & m_sprTryExtraStage );
2002-07-27 19:29:51 +00:00
m_Fade . SetOpened ();
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_Fade );
2002-07-27 19:29:51 +00:00
2002-09-09 05:22:02 +00:00
m_textSurviveTime . LoadFromFont ( THEME -> GetPathTo ( "Fonts" , "survive time" ) );
2002-08-01 13:42:56 +00:00
m_textSurviveTime . TurnShadowOff ();
m_textSurviveTime . SetXY ( SURVIVE_TIME_X , SURVIVE_TIME_Y );
m_textSurviveTime . SetText ( "" );
2002-10-28 05:30:45 +00:00
m_textSurviveTime . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_textSurviveTime );
2002-08-01 13:42:56 +00:00
2002-08-26 05:53:48 +00:00
m_sprToasty . Load ( THEME -> GetPathTo ( "Graphics" , "gameplay toasty" ) );
2002-10-28 05:30:45 +00:00
m_sprToasty . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_sprToasty );
2003-01-10 02:22:07 +00:00
2003-02-04 21:36:30 +00:00
2003-01-10 02:22:07 +00:00
m_BPMDisplay . SetXY ( BPM_X , BPM_Y );
m_BPMDisplay . SetZoom ( BPM_ZOOM );
this -> AddChild ( & m_BPMDisplay );
2002-08-28 22:42:40 +00:00
TweenOnScreen ();
2002-05-20 08:59:37 +00:00
2003-01-10 02:22:07 +00:00
for ( int i = 0 ; i < 30 ; i ++ )
this -> SendScreenMessage ( ScreenMessage ( SM_User + i ), i / 2.0f ); // Send messages to we can get the introduction rolling
2003-01-25 07:40:47 +00:00
LoadNextSong ();
2003-01-19 04:44:22 +00:00
m_soundToasty . Load ( THEME -> GetPathTo ( "Sounds" , "gameplay toasty" ) );
2003-01-25 07:40:47 +00:00
if ( ! bDemonstration ) // don't load sounds if just playing demonstration
2003-01-19 04:44:22 +00:00
{
m_soundFail . Load ( THEME -> GetPathTo ( "Sounds" , "gameplay failed" ) );
m_soundTryExtraStage . Load ( THEME -> GetPathTo ( "Sounds" , "gameplay try extra stage" ) );
m_soundOniDie . Load ( THEME -> GetPathTo ( "Sounds" , "gameplay oni die" ) );
m_announcerReady . Load ( ANNOUNCER -> GetPathTo ( "gameplay ready" ) );
if ( GAMESTATE -> IsExtraStage () || GAMESTATE -> IsExtraStage2 () )
m_announcerHereWeGo . Load ( ANNOUNCER -> GetPathTo ( "gameplay here we go extra" ) );
else if ( GAMESTATE -> IsFinalStage () )
m_announcerHereWeGo . Load ( ANNOUNCER -> GetPathTo ( "gameplay here we go final" ) );
else
m_announcerHereWeGo . Load ( ANNOUNCER -> GetPathTo ( "gameplay here we go normal" ) );
m_announcerDanger . Load ( ANNOUNCER -> GetPathTo ( "gameplay comment danger" ) );
m_announcerGood . Load ( ANNOUNCER -> GetPathTo ( "gameplay comment good" ) );
m_announcerHot . Load ( ANNOUNCER -> GetPathTo ( "gameplay comment hot" ) );
m_announcerOni . Load ( ANNOUNCER -> GetPathTo ( "gameplay comment oni" ) );
m_announcer100Combo . Load ( ANNOUNCER -> GetPathTo ( "gameplay 100 combo" ) );
m_announcer200Combo . Load ( ANNOUNCER -> GetPathTo ( "gameplay 200 combo" ) );
m_announcer300Combo . Load ( ANNOUNCER -> GetPathTo ( "gameplay 300 combo" ) );
m_announcer400Combo . Load ( ANNOUNCER -> GetPathTo ( "gameplay 400 combo" ) );
m_announcer500Combo . Load ( ANNOUNCER -> GetPathTo ( "gameplay 500 combo" ) );
m_announcer600Combo . Load ( ANNOUNCER -> GetPathTo ( "gameplay 600 combo" ) );
m_announcer700Combo . Load ( ANNOUNCER -> GetPathTo ( "gameplay 700 combo" ) );
m_announcer800Combo . Load ( ANNOUNCER -> GetPathTo ( "gameplay 800 combo" ) );
m_announcer900Combo . Load ( ANNOUNCER -> GetPathTo ( "gameplay 900 combo" ) );
m_announcer1000Combo . Load ( ANNOUNCER -> GetPathTo ( "gameplay 1000 combo" ) );
m_announcerComboStopped . Load ( ANNOUNCER -> GetPathTo ( "gameplay combo stopped" ) );
}
2003-01-25 07:40:47 +00:00
else
{
2003-01-25 08:32:57 +00:00
StartPlayingSong ( 0 , 0 );
2003-01-25 07:40:47 +00:00
}
2003-01-19 04:44:22 +00:00
m_iRowLastCrossed = - 1 ;
m_soundAssistTick . Load ( THEME -> GetPathTo ( "Sounds" , "gameplay assist tick" ) );
2002-05-20 08:59:37 +00:00
}
ScreenGameplay ::~ ScreenGameplay ()
{
2002-07-31 19:40:40 +00:00
LOG -> Trace ( "ScreenGameplay::~ScreenGameplay()" );
2002-07-23 01:41:40 +00:00
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
{
2002-08-28 22:42:40 +00:00
SAFE_DELETE ( m_pLifeMeter [ p ] );
SAFE_DELETE ( m_pScoreDisplay [ p ] );
2002-07-23 01:41:40 +00:00
}
2002-12-29 22:57:38 +00:00
m_soundMusic . StopPlaying ();
2002-05-20 08:59:37 +00:00
}
2002-07-28 20:28:37 +00:00
bool ScreenGameplay :: IsLastSong ()
2002-06-24 22:04:31 +00:00
{
2002-07-28 20:28:37 +00:00
switch ( GAMESTATE -> m_PlayMode )
2002-06-24 22:04:31 +00:00
{
2002-07-28 20:28:37 +00:00
case PLAY_MODE_ARCADE :
return true ;
2003-01-21 05:14:59 +00:00
case PLAY_MODE_NONSTOP :
2002-07-28 20:28:37 +00:00
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
{
Course * pCourse = GAMESTATE -> m_pCurCourse ;
2002-07-29 03:06:55 +00:00
if ( pCourse -> m_bRepeat )
return false ;
2003-02-14 21:42:44 +00:00
else
return GAMESTATE -> GetCourseSongIndex () == ( int ) m_apCourseSongs . size ();
2002-07-28 20:28:37 +00:00
}
break ;
default :
ASSERT ( 0 );
return true ;
}
}
2003-01-25 07:40:47 +00:00
void ScreenGameplay :: LoadNextSong ()
2002-07-28 20:28:37 +00:00
{
GAMESTATE -> ResetMusicStatistics ();
switch ( GAMESTATE -> m_PlayMode )
{
case PLAY_MODE_ARCADE :
break ;
2003-01-21 05:14:59 +00:00
case PLAY_MODE_NONSTOP :
2002-07-28 20:28:37 +00:00
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
{
2002-11-16 20:21:00 +00:00
int p ;
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-11-03 20:17:28 +00:00
{
2003-01-24 02:43:07 +00:00
m_textCourseSongNumber [ p ]. SetText ( ssprintf ( "%d" , GAMESTATE -> m_CurStageStats . iSongsPassed [ p ] + 1 ) );
2002-11-03 20:17:28 +00:00
// If it's the first song, record the options the player selected for later.
2003-01-24 02:43:07 +00:00
if ( GAMESTATE -> m_CurStageStats . iSongsPassed [ p ] == 0 )
2002-11-03 20:17:28 +00:00
GAMESTATE -> m_SelectedOptions [ p ] = GAMESTATE -> m_PlayerOptions [ p ];
}
2003-02-14 21:42:44 +00:00
int iPlaySongIndex = GAMESTATE -> GetCourseSongIndex ();
iPlaySongIndex %= m_apCourseSongs . size ();
GAMESTATE -> m_pCurSong = m_apCourseSongs [ iPlaySongIndex ];
2002-07-28 20:28:37 +00:00
2002-08-01 21:11:32 +00:00
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-08-01 13:42:56 +00:00
{
2003-02-14 21:42:44 +00:00
GAMESTATE -> m_pCurNotes [ p ] = m_apCourseNotes [ iPlaySongIndex ];
// Restore the player's originally selected options.
2002-11-03 20:17:28 +00:00
GAMESTATE -> m_PlayerOptions [ p ] = GAMESTATE -> m_SelectedOptions [ p ];
2003-02-14 21:42:44 +00:00
// Put courses options into effect.
GAMESTATE -> m_PlayerOptions [ p ]. FromString ( m_asCourseModifiers [ iPlaySongIndex ] );
2002-08-01 13:42:56 +00:00
}
2002-07-28 20:28:37 +00:00
}
2003-01-26 09:14:56 +00:00
break ;
2002-07-28 20:28:37 +00:00
default :
ASSERT ( 0 );
break ;
2002-06-24 22:04:31 +00:00
}
2002-07-28 20:28:37 +00:00
m_textStageNumber . SetText ( GAMESTATE -> GetStageText () );
2002-06-24 22:04:31 +00:00
2002-06-14 22:25:22 +00:00
2002-06-24 22:04:31 +00:00
2002-07-28 20:28:37 +00:00
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-06-14 22:25:22 +00:00
{
2002-07-28 20:28:37 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( p ) )
2002-06-14 22:25:22 +00:00
continue ;
2003-01-10 02:22:07 +00:00
m_textPlayerOptions [ p ]. SetText ( GAMESTATE -> m_PlayerOptions [ p ]. GetString () );
2002-08-01 21:55:40 +00:00
// reset oni game over graphic
m_sprOniGameOver [ p ]. SetY ( SCREEN_TOP - m_sprOniGameOver [ p ]. GetZoomedHeight () / 2 );
2002-10-28 05:30:45 +00:00
m_sprOniGameOver [ p ]. SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) ); // 0 alpha so we don't waste time drawing while not visible
2002-08-01 21:55:40 +00:00
2003-01-24 02:43:07 +00:00
if ( GAMESTATE -> m_SongOptions . m_LifeType == SongOptions :: LIFE_BATTERY && GAMESTATE -> m_CurStageStats . bFailed [ p ] ) // already failed
2002-08-01 21:55:40 +00:00
ShowOniGameOver (( PlayerNumber ) p );
2002-10-06 16:56:58 +00:00
m_DifficultyIcon [ p ]. SetFromNotes ( PlayerNumber ( p ), GAMESTATE -> m_pCurNotes [ p ] );
2002-06-14 22:25:22 +00:00
2002-10-12 00:39:00 +00:00
NoteData pOriginalNoteData ;
GAMESTATE -> m_pCurNotes [ p ] -> GetNoteData ( & pOriginalNoteData );
2002-06-14 22:25:22 +00:00
2002-08-22 23:03:39 +00:00
const StyleDef * pStyleDef = GAMESTATE -> GetCurrentStyleDef ();
2002-10-12 00:39:00 +00:00
NoteData pNewNoteData ;
pStyleDef -> GetTransformedNoteDataForStyle ( ( PlayerNumber ) p , & pOriginalNoteData , & pNewNoteData );
2002-06-14 22:25:22 +00:00
2002-10-12 00:39:00 +00:00
m_Player [ p ]. Load ( ( PlayerNumber ) p , & pNewNoteData , m_pLifeMeter [ p ], m_pScoreDisplay [ p ] );
2002-06-14 22:25:22 +00:00
}
2003-02-04 21:36:30 +00:00
/* Set up song-specific graphics. */
2002-08-22 09:31:32 +00:00
m_Background . LoadFromSong ( GAMESTATE -> m_pCurSong );
2002-10-28 05:30:45 +00:00
m_Background . SetDiffuse ( RageColor ( 0.5f , 0.5f , 0.5f , 1 ) );
2002-09-02 21:59:58 +00:00
m_Background . BeginTweening ( 2 );
2002-10-28 05:30:45 +00:00
m_Background . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-07-23 01:41:40 +00:00
2003-02-04 21:36:30 +00:00
m_StageName . SetText ( GAMESTATE -> m_pCurSong -> m_sMainTitle );
/* XXX: set it to the current BPM, not the range */
float fMinBPM , fMaxBPM ;
GAMESTATE -> m_pCurSong -> GetMinMaxBPM ( fMinBPM , fMaxBPM );
m_BPMDisplay . SetBPMRange ( fMinBPM , fMaxBPM );
2002-12-27 23:16:16 +00:00
m_soundMusic . Load ( GAMESTATE -> m_pCurSong -> GetMusicPath () );
2003-01-25 07:40:47 +00:00
}
2003-01-25 08:32:57 +00:00
float ScreenGameplay :: StartPlayingSong ( float MinTimeToNotes , float MinTimeToMusic )
2003-01-25 07:40:47 +00:00
{
2003-01-25 08:32:57 +00:00
ASSERT ( MinTimeToNotes >= 0 );
ASSERT ( MinTimeToMusic >= 0 );
2003-01-25 07:40:47 +00:00
/* XXX: We want the first beat *in use*, so we don't delay needlessly. */
2002-09-10 08:21:55 +00:00
const float fFirstBeat = GAMESTATE -> m_pCurSong -> m_fFirstBeat ;
const float fFirstSecond = GAMESTATE -> m_pCurSong -> GetElapsedTimeFromBeat ( fFirstBeat );
2003-01-25 08:32:57 +00:00
float fStartSecond = fFirstSecond - MinTimeToNotes ;
2002-12-29 23:31:29 +00:00
2003-01-25 08:32:57 +00:00
fStartSecond = min ( fStartSecond , - MinTimeToMusic );
2002-09-10 08:21:55 +00:00
m_soundMusic . SetPositionSeconds ( fStartSecond );
2002-07-23 01:41:40 +00:00
m_soundMusic . SetPlaybackRate ( GAMESTATE -> m_SongOptions . m_fMusicRate );
2002-12-29 23:31:29 +00:00
/* Keep the music playing after it's finished; we'll stop it. */
m_soundMusic . SetStopMode ( RageSound :: M_CONTINUE );
m_soundMusic . StartPlaying ();
2003-01-25 07:40:47 +00:00
/* Return the amount of time until the first beat. */
2003-01-25 08:10:35 +00:00
return fFirstSecond - fStartSecond ;
2002-06-14 22:25:22 +00:00
}
2002-07-27 19:29:51 +00:00
bool ScreenGameplay :: OneIsHot ()
{
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
if ( GAMESTATE -> IsPlayerEnabled ( PlayerNumber ( p )) )
2002-08-20 21:00:56 +00:00
if ( m_pLifeMeter [ p ] -> IsHot () )
2002-07-27 19:29:51 +00:00
return true ;
return false ;
}
bool ScreenGameplay :: AllAreInDanger ()
{
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
if ( GAMESTATE -> IsPlayerEnabled ( PlayerNumber ( p )) )
if ( ! m_pLifeMeter [ p ] -> IsInDanger () )
return false ;
return true ;
}
bool ScreenGameplay :: AllAreFailing ()
{
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
if ( GAMESTATE -> IsPlayerEnabled ( PlayerNumber ( p )) )
if ( ! m_pLifeMeter [ p ] -> IsFailing () )
return false ;
return true ;
}
bool ScreenGameplay :: AllFailedEarlier ()
{
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
if ( GAMESTATE -> IsPlayerEnabled ( p ) )
if ( ! m_pLifeMeter [ p ] -> FailedEarlier () )
return false ;
return true ;
}
2002-10-12 00:32:47 +00:00
// play assist ticks
2003-01-10 02:22:07 +00:00
bool ScreenGameplay :: IsTimeToPlayTicks () const
2002-10-12 00:32:47 +00:00
{
// 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 ( GAMESTATE -> m_SongOptions . m_AssistType != SongOptions :: ASSIST_TICK )
return false ;
float fPositionSeconds = GAMESTATE -> m_fMusicSeconds ;
// HACK: Play the sound a little bit early to account for the fact that the middle of the tick sounds occurs 0.015 seconds into playing.
2003-01-02 08:13:34 +00:00
fPositionSeconds += ( SOUNDMAN -> GetPlayLatency () + g_fTickEarlySecondsCache ) * m_soundMusic . GetPlaybackRate ();
2003-02-07 23:59:42 +00:00
float fSongBeat = GAMESTATE -> m_pCurSong -> GetBeatFromElapsedTime ( fPositionSeconds );
2002-10-12 00:32:47 +00:00
int iRowNow = BeatToNoteRowNotRounded ( fSongBeat );
iRowNow = max ( 0 , iRowNow );
static int iRowLastCrossed = 0 ;
bool bAnyoneHasANote = false ; // set this to true if any player has a note at one of the indicies we crossed
for ( int r = iRowLastCrossed + 1 ; r <= iRowNow ; r ++ ) // for each index we crossed since the last update
{
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
{
if ( ! GAMESTATE -> IsPlayerEnabled ( ( PlayerNumber ) p ) )
continue ; // skip
bAnyoneHasANote |= m_Player [ p ]. IsThereANoteAtRow ( r );
break ; // this will only play the tick for the first player that is joined
}
}
iRowLastCrossed = iRowNow ;
return bAnyoneHasANote ;
}
2002-06-14 22:25:22 +00:00
2002-10-29 01:26:10 +00:00
2002-05-20 08:59:37 +00:00
void ScreenGameplay :: Update ( float fDeltaTime )
{
2003-02-10 22:08:10 +00:00
/* Very important: Update GAMESTATE's song beat information
* -before- calling update on all the classes that depend on it.
* If you don't do this first, the classes are all acting on old
* information and will lag. -Chris */
2002-06-24 22:04:31 +00:00
2002-08-02 09:31:06 +00:00
// update the global music statistics for other classes to access
2003-02-09 06:08:03 +00:00
/* If ScreenJukebox is changing screens, it'll stop m_soundMusic to tell
* us not to update the time here. (In that case, we've already created
* a new ScreenJukebox and reset music statistics, and if we do this then
* we'll un-reset them.) */
if ( m_soundMusic . IsPlaying ())
GAMESTATE -> UpdateSongPosition ( m_soundMusic . GetPositionSeconds ());
2002-05-20 08:59:37 +00:00
2003-02-10 22:08:10 +00:00
Screen :: Update ( fDeltaTime );
2003-02-11 02:20:38 +00:00
if ( GAMESTATE -> m_MasterPlayerNumber != PLAYER_INVALID )
m_MaxCombo . SetText ( ssprintf ( "%d" , m_Player [ GAMESTATE -> m_MasterPlayerNumber ]. GetPlayersMaxCombo ()) ); /* MAKE THIS WORK FOR BOTH PLAYERS! */
2003-02-10 22:08:10 +00:00
2002-07-31 19:40:40 +00:00
//LOG->Trace( "m_fOffsetInBeats = %f, m_fBeatsPerSecond = %f, m_Music.GetPositionSeconds = %f", m_fOffsetInBeats, m_fBeatsPerSecond, m_Music.GetPositionSeconds() );
2002-05-20 08:59:37 +00:00
2003-02-10 22:08:10 +00:00
if ( GAMESTATE -> m_pCurSong == NULL )
return ;
2003-02-06 17:47:00 +00:00
int pn ;
2002-05-20 08:59:37 +00:00
switch ( m_DancingState )
{
case STATE_DANCING :
2003-01-24 02:43:07 +00:00
//
// Update players' alive time
//
2003-02-06 17:47:00 +00:00
for ( pn = 0 ; pn < NUM_PLAYERS ; pn ++ )
if ( GAMESTATE -> IsPlayerEnabled ( pn ) )
GAMESTATE -> m_CurStageStats . fAliveSeconds [ pn ] += fDeltaTime ;
2003-01-24 02:43:07 +00:00
2002-07-27 19:29:51 +00:00
//
2002-05-20 08:59:37 +00:00
// Check for end of song
2002-07-27 19:29:51 +00:00
//
2002-10-08 00:04:22 +00:00
float fSecondsToStop = GAMESTATE -> m_pCurSong -> GetElapsedTimeFromBeat ( GAMESTATE -> m_pCurSong -> m_fLastBeat ) + 1 ;
if ( GAMESTATE -> m_fMusicSeconds > fSecondsToStop && ! m_OniFade . IsClosing () )
2002-08-01 03:15:27 +00:00
{
GAMESTATE -> m_fSongBeat = 0 ;
2002-07-11 19:02:26 +00:00
this -> SendScreenMessage ( SM_NotesEnded , 0 );
2002-08-01 03:15:27 +00:00
}
2002-07-27 19:29:51 +00:00
//
// check for fail
//
2003-02-12 23:11:37 +00:00
switch ( GAMESTATE -> m_SongOptions . m_FailType )
2002-07-27 19:29:51 +00:00
{
2003-02-12 23:11:37 +00:00
case SongOptions :: FAIL_ARCADE :
2002-08-01 21:55:40 +00:00
switch ( GAMESTATE -> m_SongOptions . m_LifeType )
{
case SongOptions :: LIFE_BAR :
if ( AllAreFailing () ) SCREENMAN -> SendMessageToTopScreen ( SM_BeginFailed , 0 );
if ( AllAreInDanger () ) m_Background . TurnDangerOn ();
else m_Background . TurnDangerOff ();
2002-11-01 03:13:30 +00:00
// check for individual fail
for ( pn = 0 ; pn < NUM_PLAYERS ; pn ++ )
{
2003-01-24 02:43:07 +00:00
if ( m_pLifeMeter [ pn ] -> IsFailing () && ! GAMESTATE -> m_CurStageStats . bFailed [ pn ] )
GAMESTATE -> m_CurStageStats . bFailed [ pn ] = true ; // fail
2002-11-01 03:13:30 +00:00
}
2002-08-01 21:55:40 +00:00
break ;
case SongOptions :: LIFE_BATTERY :
if ( AllFailedEarlier () ) SCREENMAN -> SendMessageToTopScreen ( SM_BeginFailed , 0 );
if ( AllAreInDanger () ) m_Background . TurnDangerOn ();
else m_Background . TurnDangerOff ();
2002-07-27 19:29:51 +00:00
2002-08-01 21:55:40 +00:00
// check for individual fail
2003-01-24 02:43:07 +00:00
for ( pn = 0 ; pn < NUM_PLAYERS ; pn ++ )
{
2002-11-02 21:51:18 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( pn ) )
continue ;
if ( ! m_pLifeMeter [ pn ] -> IsFailing ())
2003-01-24 02:43:07 +00:00
continue ; /* isn't failing */
if ( GAMESTATE -> m_CurStageStats . bFailed [ pn ] )
2002-11-02 21:51:18 +00:00
continue ; /* failed and is already dead */
if ( ! AllFailedEarlier () ) // if not the last one to fail
{
// kill them!
m_soundOniDie . PlayRandom ();
ShowOniGameOver (( PlayerNumber ) pn );
m_Player [ pn ]. Init (); // remove all notes and scoring
m_Player [ pn ]. FadeToFail (); // tell the NoteField to fade to white
}
2003-02-17 00:30:55 +00:00
GAMESTATE -> m_CurStageStats . bFailed [ pn ] = true ;
2002-11-02 21:51:18 +00:00
}
2002-08-01 21:55:40 +00:00
break ;
}
2002-07-27 19:29:51 +00:00
break ;
2003-02-12 23:11:37 +00:00
case SongOptions :: FAIL_END_OF_SONG :
case SongOptions :: FAIL_OFF :
2002-07-27 19:29:51 +00:00
break ; // don't check for fail
default :
ASSERT ( 0 );
}
//
2002-05-20 08:59:37 +00:00
// Check to see if it's time to play a gameplay comment
2002-07-27 19:29:51 +00:00
//
2003-01-10 02:22:07 +00:00
m_fTimeLeftBeforeDancingComment -= fDeltaTime ;
if ( m_fTimeLeftBeforeDancingComment <= 0 )
2002-05-20 08:59:37 +00:00
{
2003-01-10 02:22:07 +00:00
switch ( GAMESTATE -> m_PlayMode )
2002-08-02 09:31:06 +00:00
{
2003-01-10 02:22:07 +00:00
case PLAY_MODE_ARCADE :
if ( OneIsHot () ) m_announcerHot . PlayRandom ();
else if ( AllAreInDanger () ) m_announcerDanger . PlayRandom ();
else m_announcerGood . PlayRandom ();
break ;
2003-01-21 05:14:59 +00:00
case PLAY_MODE_NONSTOP :
2003-01-10 02:22:07 +00:00
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
m_announcerOni . PlayRandom ();
break ;
default :
ASSERT ( 0 );
2002-08-02 09:31:06 +00:00
}
2002-08-20 21:00:56 +00:00
2003-01-10 02:22:07 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ; // reset for the next comment
2002-05-20 08:59:37 +00:00
}
}
2002-06-24 22:04:31 +00:00
//
// Send crossed row messages to Player
//
2003-02-10 22:08:10 +00:00
// Why was this originally "BeatToNoteRowNotRounded"? It should be rounded. -Chris
int iRowNow = BeatToNoteRow ( GAMESTATE -> m_fSongBeat );
2002-08-15 16:45:49 +00:00
if ( iRowNow >= 0 && iRowNow < MAX_TAP_NOTE_ROWS )
2002-06-24 22:04:31 +00:00
{
2002-08-15 16:45:49 +00:00
for ( int r = m_iRowLastCrossed + 1 ; r <= iRowNow ; r ++ ) // for each index we crossed since the last update
2002-06-24 22:04:31 +00:00
{
2003-02-06 17:47:00 +00:00
for ( pn = 0 ; pn < NUM_PLAYERS ; pn ++ )
2002-08-15 16:45:49 +00:00
{
2003-02-06 17:47:00 +00:00
if ( GAMESTATE -> IsPlayerEnabled ( pn ) )
m_Player [ pn ]. CrossedRow ( r );
2002-08-15 16:45:49 +00:00
}
2002-06-24 22:04:31 +00:00
}
2002-08-15 16:45:49 +00:00
m_iRowLastCrossed = iRowNow ;
2002-06-24 22:04:31 +00:00
}
2003-01-10 02:22:07 +00:00
if ( IsTimeToPlayTicks ())
2002-10-12 00:32:47 +00:00
m_soundAssistTick . Play ();
2002-05-20 08:59:37 +00:00
}
void ScreenGameplay :: DrawPrimitives ()
{
Screen :: DrawPrimitives ();
}
void ScreenGameplay :: Input ( const DeviceInput & DeviceI , const InputEventType type , const GameInput & GameI , const MenuInput & MenuI , const StyleInput & StyleI )
{
2002-07-31 19:40:40 +00:00
//LOG->Trace( "ScreenGameplay::Input()" );
2003-01-19 21:57:13 +00:00
if ( MenuI . IsValid () &&
MenuI . button == MENU_BUTTON_BACK &&
m_DancingState != STATE_OUTRO &&
! m_Fade . IsClosing () )
{
if ( PREFSMAN -> m_bDelayedEscape && type == IET_FIRST_PRESS )
{
m_textDebug . SetText ( "Continue holding BACK to quit" );
m_textDebug . StopTweening ();
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
m_textDebug . BeginTweening ( 1 / 8.f );
m_textDebug . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
return ;
}
if ( PREFSMAN -> m_bDelayedEscape && type == IET_RELEASE )
{
m_textDebug . StopTweening ();
m_textDebug . BeginTweening ( 1 / 8.f );
m_textDebug . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
return ;
}
if ( ( ! PREFSMAN -> m_bDelayedEscape && type == IET_FIRST_PRESS ) ||
( DeviceI . device == DEVICE_KEYBOARD && type == IET_SLOW_REPEAT ) ||
( DeviceI . device != DEVICE_KEYBOARD && type == IET_FAST_REPEAT ) )
{
m_DancingState = STATE_OUTRO ;
SOUNDMAN -> PlayOnce ( THEME -> GetPathTo ( "Sounds" , "menu back" ) );
/* Hmm. There are a bunch of subtly different ways we can
* tween out:
* 1. Keep rendering the song, and keep it moving. This might
* cause problems if the cancel and the end of the song overlap.
* 2. Stop the song completely, so all song motion under the tween
* ceases.
* 3. Stop the song, but keep effects (eg. Drunk) running.
* 4. Don't display the song at all.
*
* We're doing #3. I'm not sure which is best.
*/
m_soundMusic . StopPlaying ();
this -> ClearMessageQueue ();
m_Fade . CloseWipingLeft ( SM_SaveChangedBeforeGoingBack );
return ;
}
}
/* Nothing else cares about releases. */
if ( type == IET_RELEASE ) return ;
2002-05-20 08:59:37 +00:00
2002-06-24 22:04:31 +00:00
// Handle special keys to adjust the offset
2002-07-03 21:27:26 +00:00
if ( DeviceI . device == DEVICE_KEYBOARD )
2002-06-24 22:04:31 +00:00
{
switch ( DeviceI . button )
{
2002-11-29 20:37:12 +00:00
case SDLK_F6 :
2002-10-01 01:55:39 +00:00
m_bChangedOffsetOrBPM = true ;
2003-01-11 08:55:21 +00:00
GAMESTATE -> m_SongOptions . m_bAutoSync = ! GAMESTATE -> m_SongOptions . m_bAutoSync ; // toggle
PositionStatusIcons ();
2002-10-01 01:55:39 +00:00
break ;
2002-11-29 20:37:12 +00:00
case SDLK_F7 :
2002-08-25 05:07:47 +00:00
if ( GAMESTATE -> m_SongOptions . m_AssistType == SongOptions :: ASSIST_NONE )
GAMESTATE -> m_SongOptions . m_AssistType = SongOptions :: ASSIST_TICK ;
else
GAMESTATE -> m_SongOptions . m_AssistType = SongOptions :: ASSIST_NONE ;
2003-01-11 08:55:21 +00:00
m_textDebug . SetText ( ssprintf ( "Assist Tick is %s" , GAMESTATE -> m_SongOptions . m_AssistType == SongOptions :: ASSIST_TICK ? "ON" : "OFF" ) );
2002-10-28 05:30:45 +00:00
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-08-25 05:07:47 +00:00
m_textDebug . StopTweening ();
2002-09-02 21:59:58 +00:00
m_textDebug . BeginTweening ( 3 ); // sleep
m_textDebug . BeginTweening ( 0.5f ); // fade out
2002-10-28 05:30:45 +00:00
m_textDebug . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-08-25 05:07:47 +00:00
break ;
2002-11-29 20:37:12 +00:00
case SDLK_F8 :
2002-07-27 19:29:51 +00:00
PREFSMAN -> m_bAutoPlay = ! PREFSMAN -> m_bAutoPlay ;
2003-01-11 08:55:21 +00:00
PositionStatusIcons ();
2002-07-27 19:29:51 +00:00
break ;
2002-11-29 20:37:12 +00:00
case SDLK_F9 :
case SDLK_F10 :
2002-07-03 21:27:26 +00:00
{
2002-07-27 19:29:51 +00:00
m_bChangedOffsetOrBPM = true ;
2002-07-03 21:27:26 +00:00
float fOffsetDelta ;
switch ( DeviceI . button )
{
2002-11-29 20:37:12 +00:00
case SDLK_F9 : fOffsetDelta = - 0.025f ; break ;
case SDLK_F10 : fOffsetDelta = + 0.025f ; break ;
2002-09-07 10:43:16 +00:00
default : ASSERT ( 0 ); return ;
2002-07-27 19:29:51 +00:00
}
if ( type == IET_FAST_REPEAT )
2002-07-31 19:40:40 +00:00
fOffsetDelta *= 10 ;
2002-08-02 09:31:06 +00:00
BPMSegment & seg = GAMESTATE -> m_pCurSong -> GetBPMSegmentAtBeat ( GAMESTATE -> m_fSongBeat );
2002-07-27 19:29:51 +00:00
seg . m_fBPM += fOffsetDelta ;
2002-08-23 20:18:29 +00:00
m_textDebug . SetText ( ssprintf ( "Cur BPM = %f" , seg . m_fBPM ) );
2002-10-28 05:30:45 +00:00
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-07-27 19:29:51 +00:00
m_textDebug . StopTweening ();
2002-09-02 21:59:58 +00:00
m_textDebug . BeginTweening ( 3 ); // sleep
m_textDebug . BeginTweening ( 0.5f ); // fade out
2002-10-28 05:30:45 +00:00
m_textDebug . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-07-27 19:29:51 +00:00
}
break ;
2002-11-29 20:37:12 +00:00
case SDLK_F11 :
case SDLK_F12 :
2002-07-27 19:29:51 +00:00
{
m_bChangedOffsetOrBPM = true ;
float fOffsetDelta ;
switch ( DeviceI . button )
{
2002-11-29 20:37:12 +00:00
case SDLK_F11 : fOffsetDelta = - 0.02f ; break ;
case SDLK_F12 : fOffsetDelta = + 0.02f ; break ;
2002-09-07 10:43:16 +00:00
default : ASSERT ( 0 ); return ;
2002-07-03 21:27:26 +00:00
}
if ( type == IET_FAST_REPEAT )
2002-07-31 19:40:40 +00:00
fOffsetDelta *= 10 ;
2002-07-03 21:27:26 +00:00
2002-07-23 01:41:40 +00:00
GAMESTATE -> m_pCurSong -> m_fBeat0OffsetInSeconds += fOffsetDelta ;
2002-07-03 21:27:26 +00:00
2002-08-23 20:18:29 +00:00
m_textDebug . SetText ( ssprintf ( "Offset = %f" , GAMESTATE -> m_pCurSong -> m_fBeat0OffsetInSeconds ) );
2002-10-28 05:30:45 +00:00
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-07-03 21:27:26 +00:00
m_textDebug . StopTweening ();
2002-09-02 21:59:58 +00:00
m_textDebug . BeginTweening ( 3 ); // sleep
m_textDebug . BeginTweening ( 0.5f ); // fade out
2002-10-28 05:30:45 +00:00
m_textDebug . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-07-03 21:27:26 +00:00
}
2002-06-24 22:04:31 +00:00
break ;
}
}
2002-07-27 19:29:51 +00:00
//
// handle a step
//
2003-01-25 11:05:12 +00:00
if ( type == IET_FIRST_PRESS &&
! PREFSMAN -> m_bAutoPlay &&
StyleI . IsValid () &&
GAMESTATE -> IsPlayerEnabled ( StyleI . player ) )
m_Player [ StyleI . player ]. Step ( StyleI . col );
2002-05-20 08:59:37 +00:00
}
2003-01-11 08:55:21 +00:00
void ScreenGameplay :: PositionStatusIcons ()
{
bool status [ NUM_STATUS_ICONS ] = {
PREFSMAN -> m_bAutoPlay ,
GAMESTATE -> m_SongOptions . m_bAutoSync
};
vector < Actor *> vActorsToShow ;
for ( int i = 0 ; i < NUM_STATUS_ICONS ; i ++ )
{
m_sprStatusIcons [ i ]. SetDiffuse ( RageColor ( 1 , 1 , 1 , status [ i ] ? 1.f : 0.f ) );
if ( status [ i ] )
vActorsToShow . push_back ( & m_sprStatusIcons [ i ] );
}
float width_of_one = m_sprStatusIcons [ 0 ]. GetUnzoomedWidth ();
float center_x = STATUS_ICONS_X ;
float left_most_x = center_x - ( vActorsToShow . size () - 1 ) * width_of_one / 2 ;
float right_most_x = center_x + ( vActorsToShow . size () - 1 ) * width_of_one / 2 ;
for ( unsigned a = 0 ; a < vActorsToShow . size (); a ++ )
{
vActorsToShow [ a ] -> SetY ( STATUS_ICONS_Y );
if ( vActorsToShow . size () - 1 == 0 )
vActorsToShow [ a ] -> SetX ( center_x );
else
vActorsToShow [ a ] -> SetX ( SCALE ( a , 0.0f , vActorsToShow . size () - 1 , left_most_x , right_most_x ) );
}
}
2002-08-02 09:31:06 +00:00
void SaveChanges ()
2002-07-27 19:29:51 +00:00
{
2002-10-17 23:31:17 +00:00
/* XXX: Hmm. Better would be to make sure m_pCurCourse is only set when we're
* playing out of a course, and use that here, so these things wouldn't need to
* special case play modes. Need to make sure m_pCurCourse gets erased
* correctly, though. -glenn */
2003-02-14 21:42:44 +00:00
/* That's a very clever idea! I should look into this. -Chris */
2002-07-28 20:28:37 +00:00
switch ( GAMESTATE -> m_PlayMode )
{
case PLAY_MODE_ARCADE :
2002-09-11 04:49:07 +00:00
GAMESTATE -> m_pCurSong -> Save ();
2002-07-28 20:28:37 +00:00
break ;
2003-01-21 05:14:59 +00:00
case PLAY_MODE_NONSTOP :
2002-07-28 20:28:37 +00:00
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
{
2003-02-14 21:42:44 +00:00
// FIXME
//for( int i=0; i<m_apCourseSongs.size(); i++ )
// m_apCourseSongs[i]->Save();
2002-07-28 20:28:37 +00:00
}
break ;
default :
ASSERT ( 0 );
}
2002-07-27 19:29:51 +00:00
}
2002-08-02 09:31:06 +00:00
void DontSaveChanges ()
2002-07-27 19:29:51 +00:00
{
2002-09-06 23:36:04 +00:00
SMLoader ld ;
2002-07-28 20:28:37 +00:00
switch ( GAMESTATE -> m_PlayMode )
{
case PLAY_MODE_ARCADE :
2002-09-06 23:36:04 +00:00
ld . LoadFromSMFile ( GAMESTATE -> m_pCurSong -> GetCacheFilePath (),
* GAMESTATE -> m_pCurSong );
2002-07-28 20:28:37 +00:00
break ;
2003-01-21 05:14:59 +00:00
case PLAY_MODE_NONSTOP :
2002-07-28 20:28:37 +00:00
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
{
2003-02-14 21:42:44 +00:00
// FIXME
// for( int i=0; i<GAMESTATE->m_pCurCourse->GetNumStages(); i++ )
// {
// Song* pSong = GAMESTATE->m_pCurCourse->GetSong(i);
// ld.LoadFromSMFile( GAMESTATE->m_pCurSong->GetCacheFilePath(), *pSong );
// }
2002-07-28 20:28:37 +00:00
}
break ;
default :
ASSERT ( 0 );
}
2002-07-27 19:29:51 +00:00
}
void ShowSavePrompt ( ScreenMessage SM_SendWhenDone )
{
2002-07-28 20:28:37 +00:00
CString sMessage ;
switch ( GAMESTATE -> m_PlayMode )
{
case PLAY_MODE_ARCADE :
sMessage = ssprintf (
"You have changed the offset or BPM of \n "
"%s. \n "
"Would you like to save these changes back \n "
"to the song file? \n "
2002-08-20 06:26:34 +00:00
"Choosing NO will discard your changes." ,
2003-02-11 23:52:18 +00:00
GAMESTATE -> m_pCurSong -> GetFullDisplayTitle (). GetString () );
2002-07-28 20:28:37 +00:00
break ;
2003-01-21 05:14:59 +00:00
case PLAY_MODE_NONSTOP :
2002-07-28 20:28:37 +00:00
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
sMessage = ssprintf (
"You have changed the offset or BPM of \n "
"one or more songs in this course. \n "
"Would you like to save these changes back \n "
"to the song file(s)? \n "
2002-08-20 06:26:34 +00:00
"Choosing NO will discard your changes." );
2002-07-28 20:28:37 +00:00
break ;
default :
ASSERT ( 0 );
}
2002-08-27 03:59:22 +00:00
SCREENMAN -> Prompt ( SM_SendWhenDone , sMessage , true , true , SaveChanges , DontSaveChanges );
2002-07-27 19:29:51 +00:00
}
2002-05-20 08:59:37 +00:00
void ScreenGameplay :: HandleScreenMessage ( const ScreenMessage SM )
{
switch ( SM )
{
// received while STATE_INTRO
case SM_User + 0 :
2003-01-25 08:32:57 +00:00
{
m_StarWipe . OpenWipingRight ( SM_None );
2003-02-03 06:10:39 +00:00
/* It may just be me, but having Here We Go start so late into the song
* ruins the rhythm of the announcer. MAX/EX starts Here We Go
* a fixed amount of time after Are You Ready. However, 1-5th
* start HWG a certain amount of time before the notes.
* We may want to metric this, but for now, leave it like MAX/EX. -Chris */
2003-01-25 08:32:57 +00:00
/*
2003-02-05 23:05:48 +00:00
* Don't actually reach any notes for at least 5.5 seconds.
* "Here We Go" takes about two seconds, we want a half second or so of
* a clear view, so we don't want any notes for 2.5 seconds, plus three
* seconds until we actually begin the HWG.
*/
const float MinTimeToNotes = 5.5f ;
/*
* Tell the music to start, but don't actually make any noise for
* at least 2.5 (or 1.5) seconds. (This is so we scroll on screen smoothly.)
2003-01-25 08:32:57 +00:00
*
2003-02-05 23:05:48 +00:00
* Use 1.5 seconds to (try to) start when "Ready" is fading in;
* 2.5 for when it's fading out.
*
* The last set of timings was aiming for 1. fade in "Ready", 2. fade
* out "Ready", 3. music starts, 4. fade in "HWG"; the current timing
* is 1. fade in "Ready" and start music, 2. fade out "Ready", 3. fade
* in "HWG".
*
* This is only a minimum: the music might be started later, to meet
* the minimum-time-to-notes value. If you're writing song data,
* and you want to make sure we get ideal timing here, make sure there's
* a bit of space at the beginning of the music with no steps. */
const float MinTimeToMusic = 1.5f ;
float delay = StartPlayingSong ( MinTimeToNotes , MinTimeToMusic );
2003-01-25 08:32:57 +00:00
/* Start the Here We Go sequence 2.5 seconds before notes, so we
* have time to fade in and fade out. */
2003-02-03 06:10:39 +00:00
this -> SendScreenMessage ( SM_StartHereWeGo , 3.0f );
2003-02-05 23:05:48 +00:00
// use this for HWG right as the notes are starting
// this->SendScreenMessage( SM_StartHereWeGo, delay - 3.0f );
delay ; /* hush compiler */
2003-01-25 08:32:57 +00:00
}
2002-05-20 08:59:37 +00:00
break ;
case SM_User + 1 :
break ;
case SM_User + 2 :
2003-01-26 00:52:39 +00:00
m_sprReady . StartFocusing ();
2002-07-11 19:02:26 +00:00
m_announcerReady . PlayRandom ();
2002-05-20 08:59:37 +00:00
break ;
case SM_User + 3 :
break ;
case SM_User + 4 :
2003-01-26 00:52:39 +00:00
m_sprReady . StartBlurring ();
2002-05-20 08:59:37 +00:00
break ;
case SM_User + 5 :
2003-01-25 11:05:12 +00:00
m_Background . FadeIn ();
2002-05-20 08:59:37 +00:00
break ;
case SM_User + 6 :
break ;
case SM_User + 7 :
break ;
case SM_User + 8 :
break ;
case SM_User + 9 :
break ;
2003-01-25 07:40:47 +00:00
case SM_StartHereWeGo :
/* We have 2.5 seconds until the notes start. */
2003-01-26 00:52:39 +00:00
m_sprHereWeGo . StartFocusing ();
2003-01-25 07:40:47 +00:00
m_announcerHereWeGo . PlayRandom ();
2003-01-26 04:58:07 +00:00
GAMESTATE -> m_bPastHereWeGo = true ;
2003-01-26 00:52:39 +00:00
2003-01-25 07:40:47 +00:00
/* This gives the HWG about a second of screen time. */
this -> SendScreenMessage ( SM_StopHereWeGo , 1.5f );
break ;
case SM_StopHereWeGo :
/* We have one second until the notes start. */
2003-01-26 00:52:39 +00:00
m_sprHereWeGo . StartBlurring ();
2003-01-25 07:40:47 +00:00
m_DancingState = STATE_DANCING ; // STATE CHANGE! Now the user is allowed to press Back
break ;
2002-05-20 08:59:37 +00:00
// received while STATE_DANCING
2002-07-11 19:02:26 +00:00
case SM_NotesEnded :
2002-07-23 01:41:40 +00:00
{
2002-11-15 23:26:32 +00:00
// save any statistics
2002-11-16 20:21:00 +00:00
int p ;
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-07-27 19:29:51 +00:00
{
2002-07-28 20:28:37 +00:00
if ( GAMESTATE -> IsPlayerEnabled ( p ) )
{
for ( int r = 0 ; r < NUM_RADAR_CATEGORIES ; r ++ )
{
RadarCategory rc = ( RadarCategory ) r ;
2003-01-24 02:43:07 +00:00
GAMESTATE -> m_CurStageStats . fRadarPossible [ p ][ r ] = NoteDataUtil :: GetRadarValue ( m_Player [ p ], rc , GAMESTATE -> m_pCurSong -> m_fMusicLengthSeconds );
GAMESTATE -> m_CurStageStats . fRadarActual [ p ][ r ] = m_Player [ p ]. GetActualRadarValue ( rc , GAMESTATE -> m_pCurSong -> m_fMusicLengthSeconds );
2002-07-28 20:28:37 +00:00
}
}
2002-07-27 19:29:51 +00:00
}
2002-07-28 20:28:37 +00:00
2002-08-01 21:11:32 +00:00
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
2003-01-24 02:43:07 +00:00
if ( GAMESTATE -> IsPlayerEnabled ( p ) && ! GAMESTATE -> m_CurStageStats . bFailed [ p ] )
GAMESTATE -> m_CurStageStats . iSongsPassed [ p ] ++ ;
2002-07-28 20:28:37 +00:00
if ( ! IsLastSong () )
2002-07-27 19:29:51 +00:00
{
2002-08-01 03:15:27 +00:00
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
2003-01-24 02:43:07 +00:00
if ( GAMESTATE -> IsPlayerEnabled ( p ) && ! GAMESTATE -> m_CurStageStats . bFailed [ p ] )
m_pLifeMeter [ p ] -> OnSongEnded (); // give a little life back between stages
2002-08-01 03:15:27 +00:00
m_OniFade . CloseWipingRight ( SM_BeginLoadingNextSong );
2002-07-28 20:28:37 +00:00
}
else // IsLastSong
{
if ( m_DancingState == STATE_OUTRO ) // gameplay already ended
return ; // ignore
m_DancingState = STATE_OUTRO ;
2003-02-12 23:11:37 +00:00
if ( GAMESTATE -> m_SongOptions . m_FailType == SongOptions :: FAIL_END_OF_SONG && AllFailedEarlier () )
2002-07-28 20:28:37 +00:00
{
this -> SendScreenMessage ( SM_BeginFailed , 0 );
2003-02-04 21:45:42 +00:00
return ;
2002-07-28 20:28:37 +00:00
}
2003-02-04 21:45:42 +00:00
m_StarWipe . CloseWipingRight ( SM_None );
// do they deserve an extra stage?
if ( GAMESTATE -> HasEarnedExtraStage () )
this -> SendScreenMessage ( SM_ShowTryExtraStage , 1 );
2002-07-28 20:28:37 +00:00
else
{
2003-02-04 21:45:42 +00:00
this -> SendScreenMessage ( SM_ShowCleared , 1 );
SOUNDMAN -> PlayOnceFromDir ( ANNOUNCER -> GetPathTo ( "gameplay cleared" ) );
2002-07-28 20:28:37 +00:00
}
2002-07-27 19:29:51 +00:00
}
2002-05-20 08:59:37 +00:00
}
break ;
2002-08-01 03:15:27 +00:00
case SM_BeginLoadingNextSong :
2003-01-25 07:40:47 +00:00
LoadNextSong ();
2003-02-09 21:10:56 +00:00
GAMESTATE -> m_bPastHereWeGo = true ;
2003-02-05 20:50:12 +00:00
/* We're fading in, so don't hit any notes for a few seconds; they'll be
* obscured by the fade. */
StartPlayingSong ( 3 , 0 );
2002-08-01 03:15:27 +00:00
m_OniFade . OpenWipingRight ( SM_None );
break ;
2002-08-26 05:53:48 +00:00
case SM_BeginToasty :
2003-01-11 08:55:21 +00:00
if ( PREFSMAN -> m_bEasterEggs )
{
m_soundToasty . Play ();
2002-08-26 05:53:48 +00:00
2003-01-11 08:55:21 +00:00
// set off screen
m_sprToasty . StopTweening ();
m_sprToasty . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
m_sprToasty . SetX ( SCREEN_RIGHT + m_sprToasty . GetUnzoomedWidth () / 2 );
m_sprToasty . SetY ( SCREEN_BOTTOM - m_sprToasty . GetUnzoomedHeight () / 2 );
m_sprToasty . BeginTweening ( 0.2f , Actor :: TWEEN_BIAS_BEGIN ); // slide on
m_sprToasty . SetTweenX ( SCREEN_RIGHT - m_sprToasty . GetUnzoomedWidth () / 2 );
m_sprToasty . BeginTweening ( 0.6f ); // sleep
m_sprToasty . BeginTweening ( 0.3f , Actor :: TWEEN_BIAS_END ); // slide off
m_sprToasty . SetTweenX ( SCREEN_RIGHT + m_sprToasty . GetUnzoomedWidth () / 2 );
m_sprToasty . BeginTweening ( 0.001f ); // fade out
m_sprToasty . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
}
2002-08-26 05:53:48 +00:00
break ;
2002-07-11 19:02:26 +00:00
case SM_100Combo :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer100Combo . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
case SM_200Combo :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer200Combo . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
case SM_300Combo :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer300Combo . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
case SM_400Combo :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer400Combo . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
case SM_500Combo :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer500Combo . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
case SM_600Combo :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer600Combo . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
case SM_700Combo :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer700Combo . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
case SM_800Combo :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer800Combo . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
case SM_900Combo :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer900Combo . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
case SM_1000Combo :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer1000Combo . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
case SM_ComboStopped :
if ( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcerComboStopped . PlayRandom ();
2002-08-13 23:26:46 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS ;
2002-07-11 19:02:26 +00:00
}
break ;
// received while STATE_OUTRO
2002-05-20 08:59:37 +00:00
case SM_ShowCleared :
2002-08-26 05:53:48 +00:00
m_sprCleared . BeginTweening ( 1.0f );
2002-10-28 05:30:45 +00:00
m_sprCleared . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-09-10 01:13:45 +00:00
m_sprCleared . BeginTweening ( 1.5f ); // sleep
2002-08-27 16:53:25 +00:00
m_sprCleared . BeginTweening ( 0.7f );
2002-10-28 05:30:45 +00:00
m_sprCleared . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-09-10 03:20:31 +00:00
SCREENMAN -> SendMessageToTopScreen ( SM_GoToStateAfterCleared , 4 );
2002-05-20 08:59:37 +00:00
break ;
2002-09-10 01:13:45 +00:00
case SM_ShowTryExtraStage :
{
m_soundTryExtraStage . PlayRandom ();
// make the background invisible so we don't waste mem bandwidth drawing it
m_Background . BeginTweening ( 1 );
2002-10-28 05:30:45 +00:00
m_Background . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-09-10 01:13:45 +00:00
2002-10-28 05:30:45 +00:00
RageColor colorStage = GAMESTATE -> GetStageColor ();
2002-09-10 01:13:45 +00:00
colorStage . a *= 0.7f ;
m_sprTryExtraStage . SetZoom ( 4 );
m_sprTryExtraStage . BeginBlurredTweening ( 0.8f , TWEEN_BIAS_END );
2002-09-10 03:20:31 +00:00
m_sprTryExtraStage . SetTweenZoom ( 0.4f ); // zoom out
2002-09-10 01:13:45 +00:00
m_sprTryExtraStage . SetTweenDiffuse ( colorStage ); // and fade in
2002-09-10 03:20:31 +00:00
m_sprTryExtraStage . BeginTweening ( 0.2f );
m_sprTryExtraStage . SetTweenZoom ( 0.8f ); // bounce
2002-09-10 01:13:45 +00:00
m_sprTryExtraStage . SetTweenDiffuse ( colorStage ); // and fade in
m_sprTryExtraStage . BeginTweening ( 0.2f );
m_sprTryExtraStage . SetTweenZoom ( 1.0f ); // come to rest
m_sprTryExtraStage . SetTweenDiffuse ( colorStage ); // and fade in
colorStage . a = 0 ;
2002-09-10 03:20:31 +00:00
m_sprTryExtraStage . BeginTweening ( 2 ); // sleep
m_sprTryExtraStage . BeginTweening ( 1 ); // fade out
2002-09-10 01:13:45 +00:00
m_sprTryExtraStage . SetTweenDiffuse ( colorStage );
SCREENMAN -> SendMessageToTopScreen ( SM_GoToStateAfterCleared , 5 );
}
break ;
2002-08-01 05:11:11 +00:00
case SM_SaveChangedBeforeGoingBack :
if ( m_bChangedOffsetOrBPM )
{
m_bChangedOffsetOrBPM = false ;
ShowSavePrompt ( SM_GoToScreenAfterBack );
}
2002-08-01 13:42:56 +00:00
else
this -> SendScreenMessage ( SM_GoToScreenAfterBack , 0 );
2002-08-01 05:11:11 +00:00
break ;
2002-07-27 19:29:51 +00:00
case SM_GoToScreenAfterBack :
switch ( GAMESTATE -> m_PlayMode )
{
2002-07-29 03:06:55 +00:00
case PLAY_MODE_ARCADE :
2002-12-20 19:05:54 +00:00
// SCREENMAN->SetNewScreen( "ScreenSelectMusic" );
SCREENMAN -> SetNewScreen ( SONGSEL_SCREEN );
2002-07-29 03:06:55 +00:00
break ;
2003-01-21 05:14:59 +00:00
case PLAY_MODE_NONSTOP :
2002-07-29 03:06:55 +00:00
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
2002-08-27 03:59:22 +00:00
SCREENMAN -> SetNewScreen ( "ScreenSelectCourse" );
2002-07-29 03:06:55 +00:00
break ;
2002-07-27 19:29:51 +00:00
default : ASSERT ( 0 );
}
break ;
case SM_GoToStateAfterCleared :
if ( m_bChangedOffsetOrBPM )
{
m_bChangedOffsetOrBPM = false ;
ShowSavePrompt ( SM_GoToStateAfterCleared );
break ;
}
2002-08-27 03:59:22 +00:00
SCREENMAN -> SetNewScreen ( "ScreenEvaluation" );
2002-05-20 08:59:37 +00:00
break ;
case SM_BeginFailed :
m_DancingState = STATE_OUTRO ;
2002-12-29 22:57:38 +00:00
m_soundMusic . StopPlaying ();
2002-08-13 23:26:46 +00:00
m_StarWipe . SetTransitionTime ( 1.5f );
2002-05-20 08:59:37 +00:00
m_StarWipe . CloseWipingRight ( SM_None );
2002-08-02 09:31:06 +00:00
int p ;
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-08-01 21:55:40 +00:00
if ( GAMESTATE -> IsPlayerEnabled ( p ) )
m_Player [ p ]. FadeToFail ();
2002-08-01 13:42:56 +00:00
2002-05-20 08:59:37 +00:00
this -> SendScreenMessage ( SM_ShowFailed , 0.2f );
break ;
case SM_ShowFailed :
2002-07-11 19:02:26 +00:00
m_soundFail . PlayRandom ();
2002-05-20 08:59:37 +00:00
// make the background invisible so we don't waste mem bandwidth drawing it
m_Background . BeginTweening ( 1 );
2002-10-28 05:30:45 +00:00
m_Background . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-05-20 08:59:37 +00:00
m_sprFailed . SetZoom ( 4 );
m_sprFailed . BeginBlurredTweening ( 0.8f , TWEEN_BIAS_END );
m_sprFailed . SetTweenZoom ( 0.5f ); // zoom out
2002-10-28 05:30:45 +00:00
m_sprFailed . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0.7f ) ); // and fade in
2002-09-02 21:59:58 +00:00
m_sprFailed . BeginTweening ( 0.3f );
2002-05-20 08:59:37 +00:00
m_sprFailed . SetTweenZoom ( 1.1f ); // bounce
2002-10-28 05:30:45 +00:00
m_sprFailed . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0.7f ) ); // and fade in
2002-09-02 21:59:58 +00:00
m_sprFailed . BeginTweening ( 0.2f );
2002-05-20 08:59:37 +00:00
m_sprFailed . SetTweenZoom ( 1.0f ); // come to rest
2002-10-28 05:30:45 +00:00
m_sprFailed . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0.7f ) ); // and fade in
2002-09-10 01:13:45 +00:00
m_sprFailed . BeginTweening ( 2 ); // sleep
m_sprFailed . BeginTweening ( 1 );
2002-10-28 05:30:45 +00:00
m_sprFailed . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-05-20 08:59:37 +00:00
2002-08-01 13:42:56 +00:00
// show the survive time if extra stage
if ( GAMESTATE -> IsExtraStage () || GAMESTATE -> IsExtraStage2 () )
{
2003-01-24 02:43:07 +00:00
float fMaxSurviveSeconds = 0 ;
2002-08-01 13:42:56 +00:00
for ( int p = 0 ; p < NUM_PLAYERS ; p ++ )
if ( GAMESTATE -> IsPlayerEnabled ( p ) )
2003-01-24 02:43:07 +00:00
fMaxSurviveSeconds = max ( fMaxSurviveSeconds , GAMESTATE -> m_CurStageStats . fAliveSeconds [ p ] );
ASSERT ( fMaxSurviveSeconds > 0 );
2002-08-01 13:42:56 +00:00
m_textSurviveTime . SetText ( "TIME " + SecondsToTime ( fMaxSurviveSeconds ) );
m_textSurviveTime . BeginTweening ( 0.3f ); // sleep
2002-09-02 21:59:58 +00:00
m_textSurviveTime . BeginTweening ( 0.3f ); // fade in
2002-10-28 05:30:45 +00:00
m_textSurviveTime . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-09-10 01:13:45 +00:00
m_textSurviveTime . BeginTweening ( 3.5f ); // sleep
m_textSurviveTime . BeginTweening ( 0.5f ); // fade out
2002-10-28 05:30:45 +00:00
m_textSurviveTime . SetTweenDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-08-01 13:42:56 +00:00
}
2002-09-02 21:59:58 +00:00
SCREENMAN -> SendMessageToTopScreen ( SM_PlayFailComment , 1.0f );
2002-09-10 01:13:45 +00:00
SCREENMAN -> SendMessageToTopScreen ( SM_GoToScreenAfterFail , 5.0f );
2002-05-20 08:59:37 +00:00
break ;
case SM_PlayFailComment :
2003-01-02 08:13:34 +00:00
SOUNDMAN -> PlayOnceFromDir ( ANNOUNCER -> GetPathTo ( "gameplay failed" ) );
2002-05-20 08:59:37 +00:00
break ;
2002-05-27 08:23:27 +00:00
case SM_GoToScreenAfterFail :
2002-07-27 19:29:51 +00:00
if ( m_bChangedOffsetOrBPM )
{
m_bChangedOffsetOrBPM = false ;
ShowSavePrompt ( SM_GoToScreenAfterFail );
break ;
}
2003-01-27 06:49:02 +00:00
2003-01-21 05:14:59 +00:00
if ( GAMESTATE -> m_PlayMode == PLAY_MODE_NONSTOP ||
GAMESTATE -> m_PlayMode == PLAY_MODE_ONI ||
2003-01-27 06:49:02 +00:00
GAMESTATE -> m_PlayMode == PLAY_MODE_ENDLESS ||
GAMESTATE -> IsExtraStage () || GAMESTATE -> IsExtraStage2 ())
2002-08-27 03:59:22 +00:00
SCREENMAN -> SetNewScreen ( "ScreenEvaluation" );
2002-08-22 09:31:32 +00:00
else if ( PREFSMAN -> m_bEventMode )
2002-07-27 19:29:51 +00:00
this -> SendScreenMessage ( SM_GoToScreenAfterBack , 0 );
2002-05-27 08:23:27 +00:00
else
2002-08-27 03:59:22 +00:00
SCREENMAN -> SetNewScreen ( "ScreenGameOver" );
2002-05-20 08:59:37 +00:00
break ;
}
2002-06-14 22:25:22 +00:00
}
2002-05-20 08:59:37 +00:00
2002-06-14 22:25:22 +00:00
void ScreenGameplay :: TweenOnScreen ()
{
2002-10-31 02:20:11 +00:00
unsigned i , p ;
2002-06-14 22:25:22 +00:00
2003-01-03 05:56:28 +00:00
vector < Actor *> apActorsInLifeFrame ;
2002-10-31 04:23:39 +00:00
apActorsInLifeFrame . push_back ( & m_sprLifeFrame );
2002-08-28 22:42:40 +00:00
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-10-31 04:23:39 +00:00
apActorsInLifeFrame . push_back ( m_pLifeMeter [ p ] );
apActorsInLifeFrame . push_back ( & m_textStageNumber );
2002-08-28 22:42:40 +00:00
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
2002-10-31 04:23:39 +00:00
apActorsInLifeFrame . push_back ( & m_textCourseSongNumber [ p ] );
2002-10-31 02:20:11 +00:00
for ( i = 0 ; i < apActorsInLifeFrame . size (); i ++ )
2002-08-28 22:42:40 +00:00
{
2002-09-10 17:29:11 +00:00
float fOriginalY = apActorsInLifeFrame [ i ] -> GetY ();
apActorsInLifeFrame [ i ] -> SetY ( fOriginalY - 100 );
2003-01-10 02:22:07 +00:00
apActorsInLifeFrame [ i ] -> BeginTweening ( 0.5f ); // sleep
2002-09-10 17:29:11 +00:00
apActorsInLifeFrame [ i ] -> BeginTweening ( 1 );
apActorsInLifeFrame [ i ] -> SetTweenY ( fOriginalY );
2002-08-28 22:42:40 +00:00
}
2003-01-03 05:56:28 +00:00
vector < Actor *> apActorsInScoreFrame ;
2002-10-31 04:23:39 +00:00
apActorsInScoreFrame . push_back ( & m_sprScoreFrame );
2002-08-28 22:42:40 +00:00
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
{
if ( ! GAMESTATE -> IsPlayerEnabled ( p ) )
continue ;
2002-10-31 04:23:39 +00:00
apActorsInScoreFrame . push_back ( m_pScoreDisplay [ p ] );
apActorsInScoreFrame . push_back ( & m_textPlayerOptions [ p ] );
2002-08-28 22:42:40 +00:00
}
2002-10-31 04:23:39 +00:00
apActorsInScoreFrame . push_back ( & m_textSongOptions );
2002-10-31 02:20:11 +00:00
for ( i = 0 ; i < apActorsInScoreFrame . size (); i ++ )
2002-08-28 22:42:40 +00:00
{
2002-09-10 17:29:11 +00:00
float fOriginalY = apActorsInScoreFrame [ i ] -> GetY ();
apActorsInScoreFrame [ i ] -> SetY ( fOriginalY + 100 );
2003-01-10 02:22:07 +00:00
apActorsInScoreFrame [ i ] -> BeginTweening ( 0.5f ); // sleep
2002-09-10 17:29:11 +00:00
apActorsInScoreFrame [ i ] -> BeginTweening ( 1 );
apActorsInScoreFrame [ i ] -> SetTweenY ( fOriginalY );
2002-08-28 22:42:40 +00:00
}
for ( p = 0 ; p < NUM_PLAYERS ; p ++ )
{
2002-10-06 16:56:58 +00:00
float fOriginalX = m_DifficultyIcon [ p ]. GetX ();
m_DifficultyIcon [ p ]. SetX ( ( p == PLAYER_1 ) ? fOriginalX - 200 : fOriginalX + 200 );
2003-01-10 02:22:07 +00:00
m_DifficultyIcon [ p ]. BeginTweening ( 0.5f ); // sleep
2002-10-06 16:56:58 +00:00
m_DifficultyIcon [ p ]. BeginTweening ( 1 );
m_DifficultyIcon [ p ]. SetTweenX ( fOriginalX );
2002-08-28 22:42:40 +00:00
}
2002-05-20 08:59:37 +00:00
}
2002-06-14 22:25:22 +00:00
void ScreenGameplay :: TweenOffScreen ()
{
}
2002-09-04 03:49:08 +00:00
void ScreenGameplay :: ShowOniGameOver ( PlayerNumber pn )
2002-08-01 21:55:40 +00:00
{
2002-10-28 05:30:45 +00:00
m_sprOniGameOver [ pn ]. SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-09-04 03:49:08 +00:00
m_sprOniGameOver [ pn ]. BeginTweening ( 0.5f , Actor :: TWEEN_BOUNCE_END );
m_sprOniGameOver [ pn ]. SetTweenY ( CENTER_Y );
2002-10-28 05:30:45 +00:00
m_sprOniGameOver [ pn ]. SetEffectBobbing ( RageVector3 ( 0 , 6 , 0 ), 4 );
2002-08-01 21:55:40 +00:00
}