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"
2002-07-23 01:41:40 +00:00
#include "LifeMeterBar.h"
#include "LifeMeterBattery.h"
#include "GameState.h"
#include "ScoreDisplayNormal.h"
2003-10-05 05:24:50 +00:00
#include "ScoreDisplayPercentage.h"
2002-07-23 01:41:40 +00:00
#include "ScoreDisplayOni.h"
2003-02-25 00:33:42 +00:00
#include "ScoreDisplayBattle.h"
2003-04-07 05:14:27 +00:00
#include "ScoreDisplayRave.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"
2003-01-25 07:40:47 +00:00
#include "RageTimer.h"
2003-03-16 18:57:34 +00:00
#include "ScoreKeeperMAX2.h"
2003-06-30 18:08:27 +00:00
#include "ScoreKeeperRave.h"
2003-04-02 21:57:25 +00:00
#include "NoteFieldPositioning.h"
2003-03-19 12:43:49 +00:00
#include "LyricsLoader.h"
2003-04-13 21:17:14 +00:00
#include "ActorUtil.h"
2003-04-22 04:54:04 +00:00
#include "NoteSkinManager.h"
#include "RageTextureManager.h"
2003-07-26 23:05:16 +00:00
#include "RageSounds.h"
2003-06-30 18:08:27 +00:00
#include "CombinedLifeMeterTug.h"
2003-07-08 19:56:56 +00:00
#include "Inventory.h"
2003-07-17 20:10:07 +00:00
#include "Course.h"
2003-08-07 06:36:34 +00:00
#include "NoteDataUtil.h"
2003-08-07 10:15:16 +00:00
#include "UnlockSystem.h"
2003-11-16 04:45:12 +00:00
#include "LightsManager.h"
2003-12-17 10:21:31 +00:00
#include "ProfileManager.h"
2003-12-23 00:26:00 +00:00
#include "StageStats.h"
2004-01-11 23:33:56 +00:00
#include "PlayerAI.h" // for NUM_SKILL_LEVELS
2004-03-16 22:10:45 +00:00
#include "NetworkSyncManager.h"
2003-03-19 12:43:49 +00:00
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
//
2004-04-18 05:15:22 +00:00
#define PREV_SCREEN THEME->GetMetric ("ScreenGameplay","PrevScreen")
#define NEXT_SCREEN THEME->GetMetric ("ScreenGameplay","NextScreen")
2003-07-08 19:56:56 +00:00
#define SHOW_LIFE_METER_FOR_DISABLED_PLAYERS THEME->GetMetricB("ScreenGameplay","ShowLifeMeterForDisabledPlayers")
2003-11-24 02:03:09 +00:00
#define EVAL_ON_FAIL THEME->GetMetricB("ScreenGameplay","ShowEvaluationOnFail")
2003-12-22 05:20:13 +00:00
#define SHOW_SCORE_IN_RAVE THEME->GetMetricB("ScreenGameplay","ShowScoreInRave")
2003-12-25 05:53:30 +00:00
#define SONG_POSITION_METER_WIDTH THEME->GetMetricF("ScreenGameplay","SongPositionMeterWidth")
2004-04-08 00:18:13 +00:00
/* XXX: This is ugly; most people don't need to override this per-mode. This will
* go away eventually, once metrics can redirect to Lua calls. */
#define INITIAL_BACKGROUND_BRIGHTNESS( play_mode ) THEME->GetMetricF("ScreenGameplay","InitialBackgroundBrightness"+Capitalize(PlayModeToString(play_mode)))
2003-04-22 14:32:48 +00:00
2004-01-12 09:36:01 +00:00
static CachedThemeMetricF SECONDS_BETWEEN_COMMENTS ( "ScreenGameplay" , "SecondsBetweenComments" );
static CachedThemeMetricF TICK_EARLY_SECONDS ( "ScreenGameplay" , "TickEarlySeconds" );
2003-04-13 21:17:14 +00:00
2003-08-12 00:05:01 +00:00
/* Global, so it's accessible from ShowSavePrompt: */
static float g_fOldOffset ; // used on offset screen to calculate difference
2003-04-13 21:17:14 +00:00
2003-03-09 00:55:49 +00:00
const ScreenMessage SM_PlayReady = ScreenMessage ( SM_User + 0 );
const ScreenMessage SM_PlayGo = ScreenMessage ( SM_User + 1 );
2002-05-20 08:59:37 +00:00
// received while STATE_DANCING
2003-03-09 00:55:49 +00:00
const ScreenMessage SM_NotesEnded = ScreenMessage ( SM_User + 10 );
2003-04-13 00:44:50 +00:00
const ScreenMessage SM_LoadNextSong = ScreenMessage ( SM_User + 11 );
2002-05-20 08:59:37 +00:00
// received while STATE_OUTRO
2003-03-09 00:55:49 +00:00
const ScreenMessage SM_SaveChangedBeforeGoingBack = ScreenMessage ( SM_User + 20 );
const ScreenMessage SM_GoToScreenAfterBack = ScreenMessage ( SM_User + 21 );
const ScreenMessage SM_GoToStateAfterCleared = ScreenMessage ( SM_User + 22 );
2002-05-20 08:59:37 +00:00
2003-03-09 00:55:49 +00:00
const ScreenMessage SM_BeginFailed = ScreenMessage ( SM_User + 30 );
const ScreenMessage SM_GoToScreenAfterFail = ScreenMessage ( SM_User + 31 );
2002-05-20 08:59:37 +00:00
2003-01-25 07:40:47 +00:00
// received while STATE_INTRO
2003-03-09 00:55:49 +00:00
const ScreenMessage SM_StartHereWeGo = ScreenMessage ( SM_User + 40 );
const ScreenMessage SM_StopHereWeGo = ScreenMessage ( SM_User + 41 );
2002-05-20 08:59:37 +00:00
2003-10-25 07:58:10 +00:00
2004-02-15 09:34:13 +00:00
ScreenGameplay :: ScreenGameplay ( CString sName , bool bDemonstration ) : Screen ( sName )
2002-05-20 08:59:37 +00:00
{
2004-03-13 22:41:31 +00:00
m_bDemonstration = bDemonstration ;
2004-02-18 02:31:43 +00:00
Init (); // work around horrible gcc bug 3187
}
2002-05-20 08:59:37 +00:00
2004-02-18 02:31:43 +00:00
void ScreenGameplay :: Init ()
{
2003-11-16 04:45:12 +00:00
if ( m_bDemonstration )
2004-03-23 06:11:10 +00:00
LIGHTSMAN -> SetLightsMode ( LIGHTSMODE_DEMONSTRATION );
2003-11-16 04:45:12 +00:00
else
2004-03-30 04:44:09 +00:00
LIGHTSMAN -> SetLightsMode ( LIGHTSMODE_GAMEPLAY );
2003-11-16 04:45:12 +00:00
2004-01-20 06:08:56 +00:00
m_soundMusic = NULL ;
2003-12-18 08:53:38 +00:00
2003-03-09 00:55:49 +00:00
SECONDS_BETWEEN_COMMENTS . Refresh ();
2004-01-12 09:36:01 +00:00
TICK_EARLY_SECONDS . Refresh ();
2003-03-09 00:55:49 +00:00
2003-11-13 00:39:36 +00:00
//need to initialize these before checking for demonstration mode
//otherwise destructor will try to delete possibly invalid pointers
2004-05-16 12:34:02 +00:00
FOREACH_PlayerNumber ( p )
2003-11-13 00:39:36 +00:00
{
m_pLifeMeter [ p ] = NULL ;
2003-11-26 06:40:03 +00:00
m_pPrimaryScoreDisplay [ p ] = NULL ;
m_pSecondaryScoreDisplay [ p ] = NULL ;
2003-11-13 00:39:36 +00:00
m_pPrimaryScoreKeeper [ p ] = NULL ;
m_pSecondaryScoreKeeper [ p ] = NULL ;
m_pInventory [ p ] = NULL ;
}
m_pCombinedLifeMeter = NULL ;
2003-03-09 00:55:49 +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.
2004-02-01 03:00:48 +00:00
/* This is usually done already, but we might have come here without going through
* ScreenSelectMusic or the options menus at all. */
GAMESTATE -> AdjustFailType ();
2003-02-24 03:26:33 +00:00
/* Save selected options before we change them. */
GAMESTATE -> StoreSelectedOptions ();
2004-03-30 03:55:54 +00:00
/* Save settings to the profile now. Don't do this on extra stages, since the
* user doesn't have full control; saving would force profiles to DIFFICULTY_HARD
* and save over their default modifiers every time someone got an extra stage.
* Do this before course modifiers are set up. */
if ( ! GAMESTATE -> IsExtraStage () && ! GAMESTATE -> IsExtraStage2 () )
{
FOREACH_HumanPlayer ( pn )
GAMESTATE -> SaveCurrentSettingsToProfile ( pn );
}
2003-07-03 06:38:57 +00:00
GAMESTATE -> ResetStageStatistics ();
2003-04-14 22:12:54 +00:00
2003-04-07 21:24:14 +00:00
2002-08-28 22:42:40 +00:00
2003-01-10 02:22:07 +00:00
2003-04-07 21:24:14 +00:00
// fill in difficulty of CPU players with that of the first human player
2004-05-16 23:15:17 +00:00
FOREACH_PotentialCpuPlayer ( p )
2004-05-16 12:34:02 +00:00
GAMESTATE -> m_pCurNotes [ p ] = GAMESTATE -> m_pCurNotes [ GAMESTATE -> GetFirstHumanPlayer () ];
2003-04-07 21:24:14 +00:00
2003-04-22 04:54:04 +00:00
switch ( GAMESTATE -> m_PlayMode )
{
2003-08-19 04:27:50 +00:00
case PLAY_MODE_BATTLE :
2003-04-22 04:54:04 +00:00
case PLAY_MODE_RAVE :
{
// cache NoteSkin graphics
CStringArray asNames ;
NOTESKIN -> GetNoteSkinNames ( asNames );
for ( unsigned i = 0 ; i < asNames . size (); i ++ )
{
CString sDir = NOTESKIN -> GetNoteSkinDir ( asNames [ i ] );
CStringArray asGraphicPaths ;
GetDirListing ( sDir + "*.png" , asGraphicPaths , false , true );
GetDirListing ( sDir + "*.jpg" , asGraphicPaths , false , true );
GetDirListing ( sDir + "*.gif" , asGraphicPaths , false , true );
GetDirListing ( sDir + "*.bmp" , asGraphicPaths , false , true );
for ( unsigned j = 0 ; j < asGraphicPaths . size (); j ++ )
TEXTUREMAN -> CacheTexture ( asGraphicPaths [ j ] );
}
}
break ;
}
2003-03-16 18:57:34 +00:00
2003-03-26 23:08:05 +00:00
//
// fill in m_apSongsQueue, m_apNotesQueue, m_asModifiersQueue
//
if ( GAMESTATE -> IsCourseMode () )
{
2003-11-01 07:28:55 +00:00
const StepsType st = GAMESTATE -> GetCurrentStyleDef () -> m_StepsType ;
/* Increment the play count. */
2003-12-02 19:11:51 +00:00
if ( ! m_bDemonstration )
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
PROFILEMAN -> IncrementCoursePlayCount ( GAMESTATE -> m_pCurCourse , st , GAMESTATE -> m_PreferredCourseDifficulty [ p ], ( PlayerNumber ) p );
2003-11-01 07:28:55 +00:00
2004-05-16 12:34:02 +00:00
FOREACH_PlayerNumber ( p )
2003-03-26 23:08:05 +00:00
{
2004-01-21 01:35:54 +00:00
vector < Course :: Info > ci ;
2004-03-13 22:18:09 +00:00
GAMESTATE -> m_pCurCourse -> GetCourseInfo ( GAMESTATE -> GetCurrentStyleDef () -> m_StepsType , ci , GAMESTATE -> m_PreferredCourseDifficulty [ p ] );
2004-01-21 01:35:54 +00:00
2003-07-21 21:54:07 +00:00
m_apNotesQueue [ p ]. clear ();
m_asModifiersQueue [ p ]. clear ();
for ( unsigned c = 0 ; c < ci . size (); ++ c )
{
2003-07-21 23:52:01 +00:00
m_apNotesQueue [ p ]. push_back ( ci [ c ]. pNotes );
2003-10-25 22:00:58 +00:00
AttackArray a ;
2003-10-26 03:02:30 +00:00
ci [ c ]. GetAttackArray ( a );
2003-10-25 07:58:10 +00:00
m_asModifiersQueue [ p ]. push_back ( a );
2004-02-14 00:39:24 +00:00
const CString path = THEME -> GetPathToG ( ssprintf ( "ScreenGameplay course song %i" , c + 1 ), true );
if ( path != "" )
TEXTUREMAN -> CacheTexture ( path );
2003-07-21 21:54:07 +00:00
}
2004-01-21 01:35:54 +00:00
if ( p == 0 )
{
m_apSongsQueue . clear ();
for ( unsigned c = 0 ; c < ci . size (); ++ c )
m_apSongsQueue . push_back ( ci [ c ]. pSong );
}
2003-03-26 23:08:05 +00:00
}
}
else
{
m_apSongsQueue . push_back ( GAMESTATE -> m_pCurSong );
2004-05-16 12:34:02 +00:00
FOREACH_PlayerNumber ( p )
2003-03-26 23:08:05 +00:00
{
m_apNotesQueue [ p ]. push_back ( GAMESTATE -> m_pCurNotes [ p ] );
2003-10-25 22:00:58 +00:00
m_asModifiersQueue [ p ]. push_back ( AttackArray () );
2003-03-26 23:08:05 +00:00
}
}
2004-01-22 06:59:56 +00:00
/* Called once per stage (single song or single course). */
GAMESTATE -> BeginStage ();
2003-09-06 01:20:56 +00:00
2003-12-23 00:26:00 +00:00
g_CurStageStats . pSong = NULL ; // set in LoadNextSong
g_CurStageStats . playMode = GAMESTATE -> m_PlayMode ;
g_CurStageStats . style = GAMESTATE -> m_CurStyle ;
2003-09-06 01:20:56 +00:00
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
2003-09-06 01:20:56 +00:00
{
ASSERT ( ! m_apNotesQueue [ p ]. empty () );
2003-12-23 00:26:00 +00:00
g_CurStageStats . pSteps [ p ] = m_apNotesQueue [ p ][ 0 ];
g_CurStageStats . iMeter [ p ] = m_apNotesQueue [ p ][ 0 ] -> GetMeter ();
2003-12-23 04:44:34 +00:00
/* Record combo rollover. */
g_CurStageStats . UpdateComboList ( ( PlayerNumber ) p , 0 , true );
2003-09-06 01:20:56 +00:00
}
2003-09-06 01:35:29 +00:00
if ( GAMESTATE -> IsExtraStage () )
2003-12-23 00:26:00 +00:00
g_CurStageStats . StageType = StageStats :: STAGE_EXTRA ;
2003-09-06 01:35:29 +00:00
else if ( GAMESTATE -> IsExtraStage2 () )
2003-12-23 00:26:00 +00:00
g_CurStageStats . StageType = StageStats :: STAGE_EXTRA2 ;
2003-09-06 01:35:29 +00:00
else
2003-12-23 00:26:00 +00:00
g_CurStageStats . StageType = StageStats :: STAGE_NORMAL ;
2003-09-06 01:35:29 +00:00
2003-03-26 23:08:05 +00:00
//
// Init ScoreKeepers
//
2004-05-16 12:34:02 +00:00
2004-05-16 12:42:16 +00:00
FOREACH_EnabledPlayer ( p )
2003-03-16 18:57:34 +00:00
{
2004-05-16 12:34:02 +00:00
switch ( PREFSMAN -> m_iScoringType )
2003-08-11 09:58:18 +00:00
{
2003-08-11 23:12:01 +00:00
case PrefsManager :: SCORING_MAX2 :
2003-09-08 21:50:05 +00:00
case PrefsManager :: SCORING_5TH :
2003-10-25 07:58:10 +00:00
m_pPrimaryScoreKeeper [ p ] = new ScoreKeeperMAX2 ( m_apSongsQueue , m_apNotesQueue [ p ], m_asModifiersQueue [ p ], ( PlayerNumber ) p );
2003-08-11 09:58:18 +00:00
break ;
2003-08-11 23:12:01 +00:00
default : ASSERT ( 0 );
2003-08-11 09:58:18 +00:00
}
2003-06-30 18:08:27 +00:00
switch ( GAMESTATE -> m_PlayMode )
{
case PLAY_MODE_RAVE :
m_pSecondaryScoreKeeper [ p ] = new ScoreKeeperRave ( ( PlayerNumber ) p );
break ;
}
2003-03-16 18:57:34 +00:00
}
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 ;
2003-08-07 07:34:42 +00:00
// Set this in LoadNextSong()
//m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2003-02-27 10:56:37 +00:00
2003-04-13 00:44:50 +00:00
m_bZeroDeltaOnNextUpdate = false ;
2003-08-20 09:19:46 +00:00
const bool bExtra = GAMESTATE -> IsExtraStage () || GAMESTATE -> IsExtraStage2 ();
2003-08-10 13:34:55 +00:00
// init old offset in case offset changes in song
2003-08-12 00:05:01 +00:00
if ( GAMESTATE -> IsCourseMode () )
g_fOldOffset = - 1000 ;
else
2003-12-18 04:48:26 +00:00
g_fOldOffset = GAMESTATE -> m_pCurSong -> m_Timing . m_fBeat0OffsetInSeconds ;
2003-03-08 08:03:22 +00:00
2003-02-27 10:56:37 +00:00
2004-05-02 03:01:27 +00:00
m_Background . SetDrawOrder ( DRAW_ORDER_BEFORE_EVERYTHING );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_Background );
2004-01-07 00:13:32 +00:00
2004-05-02 03:01:27 +00:00
m_Foreground . SetDrawOrder ( DRAW_ORDER_AFTER_EVERYTHING ); // on top of everything else, including transitions
2004-01-07 00:13:32 +00:00
this -> AddChild ( & m_Foreground );
2003-10-08 23:32:08 +00:00
2003-10-09 06:43:51 +00:00
m_sprStaticBackground . SetName ( "StaticBG" );
2003-10-08 23:32:08 +00:00
m_sprStaticBackground . Load ( THEME -> GetPathToG ( "ScreenGameplay Static Background" ));
2003-10-09 06:43:51 +00:00
SET_XY ( m_sprStaticBackground );
2004-05-02 03:01:27 +00:00
m_sprStaticBackground . SetDrawOrder ( DRAW_ORDER_BEFORE_EVERYTHING ); // behind everything else
2003-10-08 23:32:08 +00:00
this -> AddChild ( & m_sprStaticBackground );
2002-05-20 08:59:37 +00:00
2004-02-18 02:31:43 +00:00
if ( ! m_bDemonstration ) // only load if we're going to use it
2003-04-13 23:22:27 +00:00
{
m_Toasty . Load ( THEME -> GetPathToB ( "ScreenGameplay toasty" ) );
this -> AddChild ( & m_Toasty );
}
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
2002-05-27 08:23:27 +00:00
{
2002-08-01 21:55:40 +00:00
float fPlayerX = ( float ) GAMESTATE -> GetCurrentStyleDef () -> m_iCenterX [ p ];
2003-03-02 06:16:03 +00:00
2003-09-08 01:38:19 +00:00
/* Perhaps this should be handled better by defining a new
* StyleType for ONE_PLAYER_ONE_CREDIT_AND_ONE_COMPUTER,
* but for now just ignore SoloSingles when it's Battle or Rave
* Mode. This doesn't begin to address two-player solo (6 arrows) */
2003-03-02 06:16:03 +00:00
if ( PREFSMAN -> m_bSoloSingle &&
2003-09-08 01:38:19 +00:00
GAMESTATE -> m_PlayMode != PLAY_MODE_BATTLE &&
GAMESTATE -> m_PlayMode != PLAY_MODE_RAVE &&
2003-08-24 16:40:45 +00:00
GAMESTATE -> GetCurrentStyleDef () -> m_StyleType == StyleDef :: ONE_PLAYER_ONE_CREDIT )
2003-03-02 06:16:03 +00:00
fPlayerX = SCREEN_WIDTH / 2 ;
2002-08-01 21:55:40 +00:00
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
2003-04-12 17:39:27 +00:00
m_sprOniGameOver [ p ]. Load ( THEME -> GetPathToG ( "ScreenGameplay 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
2004-05-02 03:01:27 +00:00
m_NextSongIn . SetDrawOrder ( DRAW_ORDER_TRANSITIONS - 1 );
2003-04-13 00:44:50 +00:00
this -> AddChild ( & m_NextSongIn );
2004-05-02 03:01:27 +00:00
m_NextSongOut . SetDrawOrder ( DRAW_ORDER_TRANSITIONS - 1 );
2003-04-13 00:44:50 +00:00
this -> AddChild ( & m_NextSongOut );
2002-08-01 21:55:40 +00:00
2004-05-02 03:01:27 +00:00
m_SongFinished . SetDrawOrder ( DRAW_ORDER_TRANSITIONS - 1 );
2004-03-06 10:07:17 +00:00
this -> AddChild ( & m_SongFinished );
2002-06-14 22:25:22 +00:00
2003-11-19 12:33:52 +00:00
//
// Add LifeFrame
//
2002-10-18 19:01:32 +00:00
CString sLifeFrameName ;
if ( bExtra )
2003-03-09 00:55:49 +00:00
sLifeFrameName = "ScreenGameplay extra life frame" ;
2002-10-18 19:01:32 +00:00
else if ( GAMESTATE -> m_SongOptions . m_LifeType == SongOptions :: LIFE_BATTERY )
2003-03-09 00:55:49 +00:00
sLifeFrameName = "ScreenGameplay oni life frame" ;
2002-10-18 19:01:32 +00:00
else
2003-03-09 00:55:49 +00:00
sLifeFrameName = "ScreenGameplay life frame" ;
2003-04-12 17:39:27 +00:00
m_sprLifeFrame . Load ( THEME -> GetPathToG ( sLifeFrameName ) );
2003-04-13 21:17:14 +00:00
m_sprLifeFrame . SetName ( bExtra ? "LifeFrameExtra" : "LifeFrame" );
SET_XY ( m_sprLifeFrame );
2002-10-18 19:01:32 +00:00
this -> AddChild ( & m_sprLifeFrame );
2003-07-08 19:56:56 +00:00
//
2003-11-19 12:33:52 +00:00
// Add score frame
//
CString sScoreFrameName ;
if ( bExtra )
sScoreFrameName = "ScreenGameplay extra score frame" ;
else if ( GAMESTATE -> m_SongOptions . m_LifeType == SongOptions :: LIFE_BATTERY )
sScoreFrameName = "ScreenGameplay oni score frame" ;
else
sScoreFrameName = "ScreenGameplay score frame" ;
m_sprScoreFrame . Load ( THEME -> GetPathToG ( sScoreFrameName ) );
m_sprScoreFrame . SetName ( ssprintf ( "ScoreFrame%s" , bExtra ? "Extra" : "" ) );
SET_XY ( m_sprScoreFrame );
this -> AddChild ( & m_sprScoreFrame );
//
// Add combined life meter
2003-07-08 19:56:56 +00:00
//
switch ( GAMESTATE -> m_PlayMode )
{
2003-08-19 04:27:50 +00:00
case PLAY_MODE_BATTLE :
2003-07-08 19:56:56 +00:00
case PLAY_MODE_RAVE :
2003-08-19 04:27:50 +00:00
m_pCombinedLifeMeter = new CombinedLifeMeterTug ;
2003-07-08 19:56:56 +00:00
m_pCombinedLifeMeter -> SetName ( ssprintf ( "CombinedLife%s" , bExtra ? "Extra" : "" ) );
SET_XY ( * m_pCombinedLifeMeter );
this -> AddChild ( m_pCombinedLifeMeter );
break ;
}
2004-04-06 02:05:34 +00:00
//
// Before the lifemeter loads, if Networking is required
// we need to wait, so that there is no Dead On Start issues.
// if you wait too long at the second checkpoint, you will
// appear dead when you begin your game.
//
NSMAN -> StartRequest ();
2003-07-08 19:56:56 +00:00
//
2003-11-19 12:33:52 +00:00
// Add individual life meter
2003-07-08 19:56:56 +00:00
//
2003-06-30 18:08:27 +00:00
switch ( GAMESTATE -> m_PlayMode )
2002-05-20 08:59:37 +00:00
{
2003-06-30 18:08:27 +00:00
case PLAY_MODE_ARCADE :
case PLAY_MODE_ONI :
case PLAY_MODE_NONSTOP :
case PLAY_MODE_ENDLESS :
2004-05-16 19:22:37 +00:00
FOREACH_PlayerNumber ( p )
2002-07-23 01:41:40 +00:00
{
2004-05-16 19:22:37 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( p ) && ! SHOW_LIFE_METER_FOR_DISABLED_PLAYERS )
2003-07-08 19:56:56 +00:00
continue ; // skip
2003-06-30 18:08:27 +00:00
switch ( GAMESTATE -> m_SongOptions . m_LifeType )
{
case SongOptions :: LIFE_BAR :
m_pLifeMeter [ p ] = new LifeMeterBar ;
break ;
case SongOptions :: LIFE_BATTERY :
m_pLifeMeter [ p ] = new LifeMeterBattery ;
break ;
default :
ASSERT ( 0 );
}
m_pLifeMeter [ p ] -> Load ( ( PlayerNumber ) p );
m_pLifeMeter [ p ] -> SetName ( ssprintf ( "LifeP%d%s" , p + 1 , bExtra ? "Extra" : "" ) );
SET_XY ( * m_pLifeMeter [ p ] );
this -> AddChild ( m_pLifeMeter [ p ] );
}
break ;
2003-11-19 12:33:52 +00:00
case PLAY_MODE_BATTLE :
case PLAY_MODE_RAVE :
break ;
2002-05-20 08:59:37 +00:00
}
2002-06-14 22:25:22 +00:00
2003-06-30 18:08:27 +00:00
2002-05-20 08:59:37 +00:00
2003-04-12 17:39:27 +00:00
m_textSongTitle . LoadFromFont ( THEME -> GetPathToF ( "ScreenGameplay song title" ) );
2004-03-20 02:59:08 +00:00
m_textSongTitle . SetShadowLength ( 0 );
2003-04-13 21:17:14 +00:00
m_textSongTitle . SetName ( "SongTitle" );
SET_XY ( m_textSongTitle );
2003-03-30 18:12:57 +00:00
this -> AddChild ( & m_textSongTitle );
2002-10-30 00:14:47 +00:00
2003-12-25 05:53:30 +00:00
2004-01-18 20:43:36 +00:00
m_meterSongPosition . Load ( THEME -> GetPathToG ( "ScreenGameplay song position meter" ), SONG_POSITION_METER_WIDTH , THEME -> GetPathToG ( "ScreenGameplay song position tip" ) );
2003-12-25 05:53:30 +00:00
m_meterSongPosition . SetName ( "SongPositionMeter" );
SET_XY ( m_meterSongPosition );
this -> AddChild ( & m_meterSongPosition );
2003-04-12 17:39:27 +00:00
m_MaxCombo . LoadFromNumbers ( THEME -> GetPathToN ( "ScreenGameplay max combo" ) );
2003-04-13 21:17:14 +00:00
m_MaxCombo . SetName ( "MaxCombo" );
SET_XY ( m_MaxCombo );
2003-12-23 00:26:00 +00:00
m_MaxCombo . SetText ( ssprintf ( "%d" , g_CurStageStats . iMaxCombo [ GAMESTATE -> m_MasterPlayerNumber ]) ); // TODO: Make this work for both players
2002-11-07 19:42:39 +00:00
this -> AddChild ( & m_MaxCombo );
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
2002-05-20 08:59:37 +00:00
{
2003-11-26 06:40:03 +00:00
//
// primary score display
//
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 :
2003-03-26 19:15:38 +00:00
case PLAY_MODE_NONSTOP :
2003-11-19 12:33:52 +00:00
case PLAY_MODE_BATTLE :
2003-11-26 06:40:03 +00:00
case PLAY_MODE_RAVE :
2003-10-05 05:24:50 +00:00
if ( PREFSMAN -> m_bPercentageScoring )
2003-11-26 06:40:03 +00:00
m_pPrimaryScoreDisplay [ p ] = new ScoreDisplayPercentage ;
2003-10-05 05:24:50 +00:00
else
2003-11-26 06:40:03 +00:00
m_pPrimaryScoreDisplay [ p ] = new ScoreDisplayNormal ;
2002-08-28 22:42:40 +00:00
break ;
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
2003-11-26 06:40:03 +00:00
m_pPrimaryScoreDisplay [ p ] = new ScoreDisplayOni ;
2003-04-07 05:14:27 +00:00
break ;
2002-08-28 22:42:40 +00:00
default :
ASSERT ( 0 );
}
2003-11-26 06:40:03 +00:00
m_pPrimaryScoreDisplay [ p ] -> Init ( ( PlayerNumber ) p );
m_pPrimaryScoreDisplay [ p ] -> SetName ( ssprintf ( "ScoreP%d%s" , p + 1 , bExtra ? "Extra" : "" ) );
SET_XY ( * m_pPrimaryScoreDisplay [ p ] );
2003-12-22 05:20:13 +00:00
if ( GAMESTATE -> m_PlayMode != PLAY_MODE_RAVE || SHOW_SCORE_IN_RAVE ) /* XXX: ugly */
this -> AddChild ( m_pPrimaryScoreDisplay [ p ] );
2003-11-26 06:40:03 +00:00
//
// secondary score display
//
switch ( GAMESTATE -> m_PlayMode )
{
case PLAY_MODE_RAVE :
m_pSecondaryScoreDisplay [ p ] = new ScoreDisplayRave ;
break ;
}
if ( m_pSecondaryScoreDisplay [ p ] )
{
m_pSecondaryScoreDisplay [ p ] -> Init ( ( PlayerNumber ) p );
m_pSecondaryScoreDisplay [ p ] -> SetName ( ssprintf ( "SecondaryScoreP%d%s" , p + 1 , bExtra ? "Extra" : "" ) );
SET_XY ( * m_pSecondaryScoreDisplay [ p ] );
this -> AddChild ( m_pSecondaryScoreDisplay [ p ] );
}
2003-07-08 19:56:56 +00:00
}
2003-11-29 11:16:36 +00:00
//
// Add stage / SongNumber
//
m_sprStage . SetName ( ssprintf ( "Stage%s" , bExtra ? "Extra" : "" ) );
SET_XY ( m_sprStage );
2003-12-18 23:19:02 +00:00
m_sprCourseSongNumber . SetName ( "CourseSongNumber" );
SET_XY ( m_sprCourseSongNumber );
2003-11-29 11:16:36 +00:00
2004-05-16 02:51:55 +00:00
FOREACH_EnabledPlayer ( p )
2003-11-29 11:16:36 +00:00
{
m_textCourseSongNumber [ p ]. LoadFromNumbers ( THEME -> GetPathToN ( "ScreenGameplay song num" ) );
2004-03-20 02:59:08 +00:00
m_textCourseSongNumber [ p ]. SetShadowLength ( 0 );
2003-11-29 11:16:36 +00:00
m_textCourseSongNumber [ p ]. SetName ( ssprintf ( "SongNumberP%d%s" , p + 1 , bExtra ? "Extra" : "" ) );
SET_XY ( m_textCourseSongNumber [ p ] );
m_textCourseSongNumber [ p ]. SetText ( "" );
m_textCourseSongNumber [ p ]. SetDiffuse ( RageColor ( 0 , 0.5f , 1 , 1 ) ); // light blue
2003-12-17 10:21:31 +00:00
if ( GAMESTATE -> m_PlayMode == PLAY_MODE_RAVE )
{
m_textPlayerName [ p ]. LoadFromFont ( THEME -> GetPathToF ( "ScreenGameplay player" ) );
m_textPlayerName [ p ]. SetName ( ssprintf ( "PlayerNameP%i" , p + 1 ) );
2004-05-16 02:51:55 +00:00
m_textPlayerName [ p ]. SetText ( GAMESTATE -> GetPlayerDisplayName (( PlayerNumber ) p ) );
2003-12-17 10:21:31 +00:00
SET_XY ( m_textPlayerName [ p ] );
this -> AddChild ( & m_textPlayerName [ p ] );
}
2003-11-29 11:16:36 +00:00
}
2004-05-16 02:51:55 +00:00
FOREACH_EnabledPlayer ( p )
2004-01-23 06:20:28 +00:00
{
m_textStepsDescription [ p ]. LoadFromFont ( THEME -> GetPathToF ( "ScreenGameplay StepsDescription" ) );
m_textStepsDescription [ p ]. SetName ( ssprintf ( "StepsDescriptionP%i" , p + 1 ) );
SET_XY ( m_textStepsDescription [ p ] );
this -> AddChild ( & m_textStepsDescription [ p ] );
}
2003-11-29 11:16:36 +00:00
switch ( GAMESTATE -> m_PlayMode )
{
case PLAY_MODE_ARCADE :
case PLAY_MODE_BATTLE :
case PLAY_MODE_RAVE :
m_sprStage . Load ( THEME -> GetPathToG ( "ScreenGameplay stage " + GAMESTATE -> GetStageText ()) );
this -> AddChild ( & m_sprStage );
break ;
case PLAY_MODE_NONSTOP :
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
2003-12-18 23:19:02 +00:00
this -> AddChild ( & m_sprCourseSongNumber );
2004-05-16 08:48:54 +00:00
FOREACH_PlayerNumber ( p )
2003-11-29 11:16:36 +00:00
if ( GAMESTATE -> IsPlayerEnabled ( p ) )
{
this -> AddChild ( & m_textCourseSongNumber [ p ] );
}
break ;
default :
ASSERT ( 0 ); // invalid GameMode
}
2004-02-14 00:39:24 +00:00
m_sprStageFrame . Load ( THEME -> GetPathToG ( "ScreenGameplay stage frame" ) );
2004-02-15 00:48:24 +00:00
m_sprStageFrame -> SetName ( "StageFrame" );
2004-02-14 00:39:24 +00:00
SET_XY ( m_sprStageFrame );
2004-02-15 00:48:24 +00:00
this -> AddChild ( m_sprStageFrame );
2003-11-29 11:16:36 +00:00
//
// Player/Song options
//
2004-05-16 08:48:54 +00:00
FOREACH_PlayerNumber ( p )
2003-07-08 19:56:56 +00:00
{
if ( ! GAMESTATE -> IsPlayerEnabled ( p ) )
continue ;
2003-12-31 22:03:47 +00:00
m_textPlayerOptions [ p ]. LoadFromFont ( THEME -> GetPathToF ( "ScreenGameplay player options" ) );
2004-03-20 02:59:08 +00:00
m_textPlayerOptions [ p ]. SetShadowLength ( 0 );
2003-04-13 21:17:14 +00:00
m_textPlayerOptions [ p ]. SetName ( ssprintf ( "PlayerOptionsP%d%s" , p + 1 , bExtra ? "Extra" : "" ) );
SET_XY ( m_textPlayerOptions [ p ] );
2002-09-02 21:59:58 +00:00
this -> AddChild ( & m_textPlayerOptions [ p ] );
2002-05-20 08:59:37 +00:00
}
2003-12-31 22:03:47 +00:00
m_textSongOptions . LoadFromFont ( THEME -> GetPathToF ( "ScreenGameplay song options" ) );
2004-03-20 02:59:08 +00:00
m_textSongOptions . SetShadowLength ( 0 );
2003-04-13 21:17:14 +00:00
m_textSongOptions . SetName ( ssprintf ( "SongOptions%s" , bExtra ? "Extra" : "" ) );
SET_XY ( m_textSongOptions );
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
2004-03-17 06:01:17 +00:00
{
FOREACH_EnabledPlayer ( pn )
{
m_ActiveAttackList [ pn ]. LoadFromFont ( THEME -> GetPathF ( m_sName , "ActiveAttackList" ) );
m_ActiveAttackList [ pn ]. Init ( pn );
m_ActiveAttackList [ pn ]. SetName ( ssprintf ( "ActiveAttackListP%d" , pn + 1 ) );
SET_XY ( m_ActiveAttackList [ pn ] );
this -> AddChild ( & m_ActiveAttackList [ pn ] );
}
}
2002-06-14 22:25:22 +00:00
2003-11-29 11:16:36 +00:00
2004-05-16 08:48:54 +00:00
FOREACH_PlayerNumber ( p )
2002-06-14 22:25:22 +00:00
{
2003-07-10 03:39:30 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( p ) )
2002-06-14 22:25:22 +00:00
continue ;
2002-07-23 01:41:40 +00:00
2004-02-08 01:05:53 +00:00
m_DifficultyIcon [ p ]. Load ( THEME -> GetPathToG ( ssprintf ( "ScreenGameplay difficulty icons 2x%d" , NUM_DIFFICULTIES )) );
2003-07-10 03:39:30 +00:00
2003-02-28 20:50:28 +00:00
/* Position it in LoadNextSong. */
2002-10-06 16:56:58 +00:00
this -> AddChild ( & m_DifficultyIcon [ p ] );
2002-06-14 22:25:22 +00:00
}
2003-03-20 18:51:14 +00:00
if ( PREFSMAN -> m_bShowLyrics )
this -> AddChild ( & m_LyricDisplay );
2002-08-23 20:18:29 +00:00
2003-01-11 08:55:21 +00:00
2003-04-12 17:39:27 +00:00
m_textAutoPlay . LoadFromFont ( THEME -> GetPathToF ( "ScreenGameplay autoplay" ) );
2003-04-13 21:17:14 +00:00
m_textAutoPlay . SetName ( "AutoPlay" );
SET_XY ( m_textAutoPlay );
2004-02-18 02:31:43 +00:00
if ( ! m_bDemonstration ) // only load if we're not in demonstration of jukebox
2003-03-13 08:47:43 +00:00
this -> AddChild ( & m_textAutoPlay );
2003-03-12 01:26:44 +00:00
UpdateAutoPlayText ();
2002-05-20 08:59:37 +00:00
2003-02-04 21:36:30 +00:00
2003-11-17 03:34:13 +00:00
m_BPMDisplay . SetName ( "BPMDisplay" );
2003-11-14 18:31:28 +00:00
m_BPMDisplay . Load ();
2003-04-13 21:17:14 +00:00
SET_XY ( m_BPMDisplay );
2003-01-10 02:22:07 +00:00
this -> AddChild ( & m_BPMDisplay );
2003-07-15 20:05:00 +00:00
ZERO ( m_pInventory );
2004-05-16 08:48:54 +00:00
FOREACH_PlayerNumber ( p )
2003-04-07 03:25:44 +00:00
{
2003-11-20 06:50:05 +00:00
// switch( GAMESTATE->m_PlayMode )
// {
// case PLAY_MODE_BATTLE:
// m_pInventory[p] = new Inventory;
// m_pInventory[p]->Load( (PlayerNumber)p );
// this->AddChild( m_pInventory[p] );
// break;
// }
2003-04-07 03:25:44 +00:00
}
2003-03-09 00:55:49 +00:00
2004-02-18 02:31:43 +00:00
if ( ! m_bDemonstration ) // only load if we're going to use it
2003-03-09 00:55:49 +00:00
{
2003-04-12 17:39:27 +00:00
m_Ready . Load ( THEME -> GetPathToB ( "ScreenGameplay ready" ) );
2003-03-09 00:55:49 +00:00
this -> AddChild ( & m_Ready );
2003-04-12 17:39:27 +00:00
m_Go . Load ( THEME -> GetPathToB ( "ScreenGameplay go" ) );
2003-03-09 00:55:49 +00:00
this -> AddChild ( & m_Go );
2003-04-12 17:39:27 +00:00
m_Cleared . Load ( THEME -> GetPathToB ( "ScreenGameplay cleared" ) );
2004-05-02 03:01:27 +00:00
m_Cleared . SetDrawOrder ( DRAW_ORDER_TRANSITIONS - 1 ); // on top of everything else
2003-03-09 00:55:49 +00:00
this -> AddChild ( & m_Cleared );
2003-04-12 17:39:27 +00:00
m_Failed . Load ( THEME -> GetPathToB ( "ScreenGameplay failed" ) );
2004-05-02 03:01:27 +00:00
m_Failed . SetDrawOrder ( DRAW_ORDER_TRANSITIONS - 1 ); // on top of everything else
2003-03-09 00:55:49 +00:00
this -> AddChild ( & m_Failed );
2003-10-17 08:03:46 +00:00
if ( PREFSMAN -> m_bAllowExtraStage && GAMESTATE -> IsFinalStage () ) // only load if we're going to use it
2003-04-12 17:39:27 +00:00
m_Extra . Load ( THEME -> GetPathToB ( "ScreenGameplay extra1" ) );
2003-10-17 08:03:46 +00:00
if ( PREFSMAN -> m_bAllowExtraStage && GAMESTATE -> IsExtraStage () ) // only load if we're going to use it
2003-04-12 17:39:27 +00:00
m_Extra . Load ( THEME -> GetPathToB ( "ScreenGameplay extra2" ) );
2003-03-09 00:55:49 +00:00
this -> AddChild ( & m_Extra );
2003-04-14 22:12:54 +00:00
// only load if we're going to use it
switch ( GAMESTATE -> m_PlayMode )
{
2003-08-19 04:27:50 +00:00
case PLAY_MODE_BATTLE :
2003-04-21 02:41:10 +00:00
case PLAY_MODE_RAVE :
2004-05-16 08:48:54 +00:00
FOREACH_PlayerNumber ( p )
2003-04-14 22:12:54 +00:00
{
m_Win [ p ]. Load ( THEME -> GetPathToB ( ssprintf ( "ScreenGameplay win p%d" , p + 1 )) );
this -> AddChild ( & m_Win [ p ] );
}
2003-04-21 02:41:10 +00:00
m_Draw . Load ( THEME -> GetPathToB ( "ScreenGameplay draw" ) );
this -> AddChild ( & m_Draw );
2003-04-14 22:12:54 +00:00
break ;
}
2003-04-12 17:39:27 +00:00
m_textDebug . LoadFromFont ( THEME -> GetPathToF ( "Common normal" ) );
2003-04-13 21:17:14 +00:00
m_textDebug . SetName ( "Debug" );
SET_XY ( m_textDebug );
2003-03-16 23:17:48 +00:00
this -> AddChild ( & m_textDebug );
2004-05-02 03:01:27 +00:00
m_Overlay . LoadFromAniDir ( THEME -> GetPathToB ( "ScreenGameplay Overlay" ) );
m_Overlay . SetDrawOrder ( DRAW_ORDER_TRANSITIONS - 1 );
this -> AddChild ( & m_Overlay );
m_In . Load ( THEME -> GetPathToB ( "ScreenGameplay in" ) );
m_In . SetDrawOrder ( DRAW_ORDER_TRANSITIONS );
this -> AddChild ( & m_In );
2003-03-16 23:17:48 +00:00
2003-04-12 17:39:27 +00:00
m_Back . Load ( THEME -> GetPathToB ( "Common back" ) );
2004-05-02 03:01:27 +00:00
m_Back . SetDrawOrder ( DRAW_ORDER_TRANSITIONS ); // on top of everything else
2003-03-13 01:26:50 +00:00
this -> AddChild ( & m_Back );
2003-03-09 00:55:49 +00:00
2003-03-30 20:18:46 +00:00
if ( GAMESTATE -> IsExtraStage () || GAMESTATE -> IsExtraStage2 () ) // only load if we're going to use it
2003-03-09 00:55:49 +00:00
{
2003-04-12 17:39:27 +00:00
m_textSurviveTime . LoadFromFont ( THEME -> GetPathToF ( "ScreenGameplay survive time" ) );
2004-03-20 02:59:08 +00:00
m_textSurviveTime . SetShadowLength ( 0 );
2003-04-13 21:17:14 +00:00
m_textSurviveTime . SetName ( "SurviveTime" );
SET_XY ( m_textSurviveTime );
2004-05-02 03:01:27 +00:00
m_textSurviveTime . SetDrawOrder ( DRAW_ORDER_TRANSITIONS - 1 );
2003-03-09 00:55:49 +00:00
m_textSurviveTime . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
this -> AddChild ( & m_textSurviveTime );
}
}
2003-02-28 20:50:28 +00:00
/* LoadNextSong first, since that positions some elements which need to be
* positioned before we TweenOnScreen. */
LoadNextSong ();
2002-08-28 22:42:40 +00:00
TweenOnScreen ();
2002-05-20 08:59:37 +00:00
2004-05-02 03:01:27 +00:00
this -> SortByDrawOrder ();
2003-01-19 04:44:22 +00:00
2004-02-18 02:31:43 +00:00
if ( ! m_bDemonstration ) // only load if we're going to use it
2003-01-19 04:44:22 +00:00
{
2004-02-16 05:29:33 +00:00
m_soundAssistTick . Load ( THEME -> GetPathToS ( "ScreenGameplay assist tick" ), true );
2003-05-13 13:35:32 +00:00
2003-07-08 19:56:56 +00:00
switch ( GAMESTATE -> m_PlayMode )
2003-05-13 13:35:32 +00:00
{
2003-08-19 04:27:50 +00:00
case PLAY_MODE_BATTLE :
2003-11-20 06:50:05 +00:00
m_soundBattleTrickLevel1 . Load ( THEME -> GetPathToS ( "ScreenGameplay battle trick level1" ), true );
m_soundBattleTrickLevel2 . Load ( THEME -> GetPathToS ( "ScreenGameplay battle trick level2" ), true );
m_soundBattleTrickLevel3 . Load ( THEME -> GetPathToS ( "ScreenGameplay battle trick level3" ), true );
2003-07-08 19:56:56 +00:00
break ;
2003-05-13 13:35:32 +00:00
}
2003-03-09 00:55:49 +00:00
}
2003-09-06 03:25:45 +00:00
m_GiveUpTimer . SetZero ();
2003-03-12 01:26:44 +00:00
// Get the transitions rolling on the first update.
// We can't do this in the constructor because ScreenGameplay is constructed
// in the middle of ScreenStage.
2002-05-20 08:59:37 +00:00
}
ScreenGameplay ::~ ScreenGameplay ()
{
2004-04-25 23:17:08 +00:00
if ( this -> IsFirstUpdate () )
{
/* We never received any updates. That means we were deleted without being
* used, and never actually played. (This can happen when backing out of
* ScreenStage.) Cancel the stage. */
GAMESTATE -> CancelStage ();
}
2002-07-31 19:40:40 +00:00
LOG -> Trace ( "ScreenGameplay::~ScreenGameplay()" );
2002-07-23 01:41:40 +00:00
2004-05-16 08:48:54 +00:00
FOREACH_PlayerNumber ( p )
2002-07-23 01:41:40 +00:00
{
2002-08-28 22:42:40 +00:00
SAFE_DELETE ( m_pLifeMeter [ p ] );
2003-11-26 06:40:03 +00:00
SAFE_DELETE ( m_pPrimaryScoreDisplay [ p ] );
SAFE_DELETE ( m_pSecondaryScoreDisplay [ p ] );
SAFE_DELETE ( m_pSecondaryScoreDisplay [ p ] );
2003-06-30 18:08:27 +00:00
SAFE_DELETE ( m_pPrimaryScoreKeeper [ p ] );
SAFE_DELETE ( m_pSecondaryScoreKeeper [ p ] );
2003-07-08 19:56:56 +00:00
SAFE_DELETE ( m_pInventory [ p ] );
2002-07-23 01:41:40 +00:00
}
2003-06-30 18:08:27 +00:00
SAFE_DELETE ( m_pCombinedLifeMeter );
2003-05-13 13:35:32 +00:00
2004-01-12 09:36:01 +00:00
m_soundAssistTick . StopPlaying (); /* Stop any queued assist ticks. */
2004-03-16 22:10:45 +00:00
2004-03-17 05:49:37 +00:00
NSMAN -> ReportSongOver ();
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
{
2003-03-26 23:08:05 +00:00
if ( GAMESTATE -> m_pCurCourse && GAMESTATE -> m_pCurCourse -> m_bRepeat )
return false ;
return GAMESTATE -> GetCourseSongIndex () + 1 == ( int ) m_apSongsQueue . size (); // GetCourseSongIndex() is 0-based but size() is not
2002-07-28 20:28:37 +00:00
}
2003-12-23 02:18:27 +00:00
void ScreenGameplay :: SetupSong ( int p , int iSongIndex )
{
/* This is the first beat that can be changed without it being visible. Until
* we draw for the first time, any beat can be changed. */
GAMESTATE -> m_fLastDrawnBeat [ p ] = - 100 ;
GAMESTATE -> m_pCurNotes [ p ] = m_apNotesQueue [ p ][ iSongIndex ];
// Put course options into effect.
GAMESTATE -> m_ModsToApply [ p ]. clear ();
for ( unsigned i = 0 ; i < m_asModifiersQueue [ p ][ iSongIndex ]. size (); ++ i )
{
2004-03-21 18:27:25 +00:00
/* Hack: Course modifiers that are set to start immediately shouldn't tween on. */
Attack a = m_asModifiersQueue [ p ][ iSongIndex ][ i ];
if ( a . fStartSecond == 0 )
a . fStartSecond = - 1 ; // now
GAMESTATE -> LaunchAttack ( ( PlayerNumber ) p , a );
GAMESTATE -> m_SongOptions . FromString ( a . sModifier );
2003-12-23 02:18:27 +00:00
}
2004-02-07 06:11:36 +00:00
/* Update attack bOn flags. */
GAMESTATE -> Update ( 0 );
2003-12-23 02:18:27 +00:00
GAMESTATE -> RebuildPlayerOptionsFromActiveAttacks ( ( PlayerNumber ) p );
2004-02-07 06:11:36 +00:00
/* Snap. */
2003-12-23 02:18:27 +00:00
GAMESTATE -> m_CurrentPlayerOptions [ p ] = GAMESTATE -> m_PlayerOptions [ p ];
NoteData pOriginalNoteData ;
GAMESTATE -> m_pCurNotes [ p ] -> GetNoteData ( & pOriginalNoteData );
const StyleDef * pStyleDef = GAMESTATE -> GetCurrentStyleDef ();
NoteData pNewNoteData ;
pStyleDef -> GetTransformedNoteDataForStyle ( ( PlayerNumber ) p , & pOriginalNoteData , & pNewNoteData );
m_Player [ p ]. Load ( ( PlayerNumber ) p , & pNewNoteData , m_pLifeMeter [ p ], m_pCombinedLifeMeter , m_pPrimaryScoreDisplay [ p ], m_pSecondaryScoreDisplay [ p ], m_pInventory [ p ], m_pPrimaryScoreKeeper [ p ], m_pSecondaryScoreKeeper [ p ] );
}
2004-02-14 00:39:24 +00:00
static int GetMaxSongsPlayed ()
{
int SongNumber = 0 ;
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
SongNumber = max ( SongNumber , g_CurStageStats . iSongsPlayed [ p ] );
2004-02-14 00:39:24 +00:00
return SongNumber ;
}
void ScreenGameplay :: LoadCourseSongNumber ( int SongNumber )
{
if ( ! GAMESTATE -> IsCourseMode () )
return ;
const CString path = THEME -> GetPathToG ( ssprintf ( "ScreenGameplay course song %i" , SongNumber ), true );
if ( path != "" )
m_sprCourseSongNumber . Load ( path );
else
m_sprCourseSongNumber . UnloadTexture ();
}
2003-01-25 07:40:47 +00:00
void ScreenGameplay :: LoadNextSong ()
2002-07-28 20:28:37 +00:00
{
GAMESTATE -> ResetMusicStatistics ();
2004-04-18 18:42:42 +00:00
{
FOREACH_EnabledPlayer ( p )
2003-04-13 21:17:14 +00:00
{
2003-12-23 00:26:00 +00:00
g_CurStageStats . iSongsPlayed [ p ] ++ ;
m_textCourseSongNumber [ p ]. SetText ( ssprintf ( "%d" , g_CurStageStats . iSongsPlayed [ p ]) );
2003-04-13 21:17:14 +00:00
}
2004-04-18 18:42:42 +00:00
}
2003-02-24 02:45:01 +00:00
2004-02-14 00:39:24 +00:00
LoadCourseSongNumber ( GetMaxSongsPlayed () );
2003-12-18 23:19:02 +00:00
2003-03-26 23:08:05 +00:00
int iPlaySongIndex = GAMESTATE -> GetCourseSongIndex ();
iPlaySongIndex %= m_apSongsQueue . size ();
GAMESTATE -> m_pCurSong = m_apSongsQueue [ iPlaySongIndex ];
2002-07-28 20:28:37 +00:00
2003-12-23 00:26:00 +00:00
g_CurStageStats . pSong = GAMESTATE -> m_pCurSong ;
2003-12-15 06:24:59 +00:00
2003-03-26 23:08:05 +00:00
// Restore the player's originally selected options.
2003-10-24 09:39:00 +00:00
GAMESTATE -> RemoveAllActiveAttacks ();
2003-03-26 23:08:05 +00:00
GAMESTATE -> RestoreSelectedOptions ();
2002-06-24 22:04:31 +00:00
2003-02-17 19:52:16 +00:00
m_textSongOptions . SetText ( GAMESTATE -> m_SongOptions . GetString () );
2002-06-24 22:04:31 +00:00
2004-04-18 18:42:42 +00:00
2002-06-14 22:25:22 +00:00
{
2004-04-18 18:42:42 +00:00
FOREACH_EnabledPlayer ( p )
2003-07-31 15:07:48 +00:00
{
2004-04-18 18:42:42 +00:00
SetupSong ( p , iPlaySongIndex );
2002-08-01 21:55:40 +00:00
2004-04-18 18:42:42 +00:00
Song * pSong = GAMESTATE -> m_pCurSong ;
Steps * pSteps = GAMESTATE -> m_pCurNotes [ p ];
2002-06-14 22:25:22 +00:00
2004-04-18 18:42:42 +00:00
ASSERT ( GAMESTATE -> m_pCurNotes [ p ] );
m_textStepsDescription [ p ]. SetText ( GAMESTATE -> m_pCurNotes [ p ] -> GetDescription () );
2003-07-21 19:07:10 +00:00
2004-04-18 18:42:42 +00:00
/* Increment the play count even if the player fails. (It's still popular,
* even if the people playing it aren't good at it.) */
if ( ! m_bDemonstration )
PROFILEMAN -> IncrementStepsPlayCount ( pSong , pSteps , p );
m_textPlayerOptions [ p ]. SetText ( GAMESTATE -> m_PlayerOptions [ p ]. GetString () );
// reset oni game over graphic
m_sprOniGameOver [ p ]. SetY ( SCREEN_TOP - m_sprOniGameOver [ p ]. GetZoomedHeight () / 2 );
m_sprOniGameOver [ p ]. SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) ); // 0 alpha so we don't waste time drawing while not visible
if ( GAMESTATE -> m_SongOptions . m_LifeType == SongOptions :: LIFE_BATTERY && g_CurStageStats . bFailed [ p ] ) // already failed
ShowOniGameOver (( PlayerNumber ) p );
if ( GAMESTATE -> m_SongOptions . m_LifeType == SongOptions :: LIFE_BAR && GAMESTATE -> m_PlayMode == PLAY_MODE_ARCADE && ! PREFSMAN -> m_bEventMode && ! m_bDemonstration )
{
m_pLifeMeter [ p ] -> UpdateNonstopLifebar (
GAMESTATE -> GetStageIndex (),
PREFSMAN -> m_iNumArcadeStages ,
PREFSMAN -> m_iProgressiveStageLifebar );
}
if ( GAMESTATE -> m_SongOptions . m_LifeType == SongOptions :: LIFE_BAR && GAMESTATE -> m_PlayMode == PLAY_MODE_NONSTOP )
{
m_pLifeMeter [ p ] -> UpdateNonstopLifebar (
GAMESTATE -> GetCourseSongIndex (),
GAMESTATE -> m_pCurCourse -> GetEstimatedNumStages (),
PREFSMAN -> m_iProgressiveNonstopLifebar );
}
m_DifficultyIcon [ p ]. SetFromNotes ( PlayerNumber ( p ), GAMESTATE -> m_pCurNotes [ p ] );
/* The actual note data for scoring is the base class of Player. This includes
* transforms, like Wide. Otherwise, the scoring will operate on the wrong data. */
m_pPrimaryScoreKeeper [ p ] -> OnNextSong ( GAMESTATE -> GetCourseSongIndex (), GAMESTATE -> m_pCurNotes [ p ], & m_Player [ p ] );
if ( m_pSecondaryScoreKeeper [ p ] )
m_pSecondaryScoreKeeper [ p ] -> OnNextSong ( GAMESTATE -> GetCourseSongIndex (), GAMESTATE -> m_pCurNotes [ p ], & m_Player [ p ] );
if ( m_bDemonstration )
{
GAMESTATE -> m_PlayerController [ p ] = PC_CPU ;
GAMESTATE -> m_iCpuSkill [ p ] = 5 ;
}
else if ( GAMESTATE -> IsCpuPlayer ( p ) )
{
GAMESTATE -> m_PlayerController [ p ] = PC_CPU ;
int iMeter = GAMESTATE -> m_pCurNotes [ p ] -> GetMeter ();
int iNewSkill = SCALE ( iMeter , MIN_METER , MAX_METER , 0 , NUM_SKILL_LEVELS - 1 );
/* Watch out: songs aren't actually bound by MAX_METER. */
iNewSkill = clamp ( iNewSkill , 0 , NUM_SKILL_LEVELS - 1 );
GAMESTATE -> m_iCpuSkill [ p ] = iNewSkill ;
}
else if ( PREFSMAN -> m_bAutoPlay )
GAMESTATE -> m_PlayerController [ p ] = PC_AUTOPLAY ;
else
GAMESTATE -> m_PlayerController [ p ] = PC_HUMAN ;
2003-04-21 02:41:10 +00:00
}
2002-06-14 22:25:22 +00:00
}
2003-03-30 18:12:57 +00:00
m_textSongTitle . SetText ( GAMESTATE -> m_pCurSong -> m_sMainTitle );
2003-02-04 21:36:30 +00:00
/* XXX: set it to the current BPM, not the range */
2003-05-23 01:25:01 +00:00
/* What does this comment mean? -Chris
*
* We're in gameplay. A BPM display should display the current BPM, updating
* it as it changes, instead of the "BPM preview" of ScreenSelectMusic. That'd
* be used in IIDX, anyway. (Havn't done this since I don't know what this is
* currently actually used for and don't feel like investigating it until it's
* needed.)
* -glenn
*/
2003-05-23 01:14:43 +00:00
m_BPMDisplay . SetBPM ( GAMESTATE -> m_pCurSong );
2003-02-04 21:36:30 +00:00
2003-02-28 20:50:28 +00:00
const bool bExtra = GAMESTATE -> IsExtraStage () || GAMESTATE -> IsExtraStage2 ();
const bool bReverse [ NUM_PLAYERS ] = {
2003-08-17 00:15:54 +00:00
GAMESTATE -> m_PlayerOptions [ 0 ]. m_fScrolls [ PlayerOptions :: SCROLL_REVERSE ] == 1 ,
GAMESTATE -> m_PlayerOptions [ 1 ]. m_fScrolls [ PlayerOptions :: SCROLL_REVERSE ] == 1
2003-02-28 20:50:28 +00:00
};
{
2004-04-18 18:42:42 +00:00
FOREACH_EnabledPlayer ( p )
{
if ( ! GAMESTATE -> IsPlayerEnabled ( PlayerNumber ( p )) )
continue ;
2003-02-28 20:50:28 +00:00
2004-04-18 18:42:42 +00:00
m_DifficultyIcon [ p ]. SetName ( ssprintf ( "DifficultyP%d%s%s" , p + 1 , bExtra ? "Extra" : "" , bReverse [ p ] ? "Reverse" : "" ) );
SET_XY ( m_DifficultyIcon [ p ] );
}
2003-02-28 20:50:28 +00:00
}
2003-06-04 20:40:32 +00:00
const bool bBothReverse = bReverse [ PLAYER_1 ] && bReverse [ PLAYER_2 ];
const bool bOneReverse = ! bBothReverse && ( bReverse [ PLAYER_1 ] || bReverse [ PLAYER_2 ]);
/* XXX: We want to put the lyrics out of the way, but it's likely that one
* player is in reverse and the other isn't. What to do? */
m_LyricDisplay . SetName ( ssprintf ( "Lyrics%s" , bBothReverse ? "Reverse" : bOneReverse ? "OneReverse" : "" ) );
SET_XY ( m_LyricDisplay );
2003-04-13 00:44:50 +00:00
/* Load the Oni transitions */
m_NextSongIn . Load ( THEME -> GetPathToB ( "ScreenGameplay next song in" ) );
// Instead, load this right before it's used
// m_NextSongOut.Load( THEME->GetPathToB("ScreenGameplay next song out") );
2004-03-06 10:07:17 +00:00
m_SongFinished . Load ( THEME -> GetPathToB ( "ScreenGameplay song finished" ) );
2003-03-19 19:58:22 +00:00
// Load lyrics
// XXX: don't load this here
2003-03-20 18:51:14 +00:00
LyricsLoader LL ;
if ( GAMESTATE -> m_pCurSong -> HasLyrics () )
LL . LoadFromLRCFile ( GAMESTATE -> m_pCurSong -> GetLyricsPath (), * GAMESTATE -> m_pCurSong );
2003-04-13 00:44:50 +00:00
2004-01-20 06:08:56 +00:00
m_soundMusic = new RageSound ;
m_soundMusic -> Load ( GAMESTATE -> m_pCurSong -> GetMusicPath () );
2003-04-13 00:44:50 +00:00
/* Set up song-specific graphics. */
2003-08-20 09:19:46 +00:00
2003-08-27 13:36:22 +00:00
// Check to see if any players are in beginner mode.
// Note: steps can be different if turn modifiers are used.
2003-12-02 19:11:51 +00:00
if ( PREFSMAN -> m_bShowBeginnerHelper )
2003-08-24 23:18:20 +00:00
{
2004-04-18 18:42:42 +00:00
FOREACH_HumanPlayer ( p )
{
if ( GAMESTATE -> m_pCurNotes [ p ] -> GetDifficulty () == DIFFICULTY_BEGINNER )
2003-12-02 19:11:51 +00:00
m_BeginnerHelper . AddPlayer ( p , & m_Player [ p ] );
2004-04-18 18:42:42 +00:00
}
2003-12-02 19:11:51 +00:00
}
2003-08-27 13:36:22 +00:00
2003-12-02 19:11:51 +00:00
if ( m_BeginnerHelper . Initialize ( 2 ) ) // Init for doubles
{
m_Background . Unload (); // BeginnerHelper has its own BG control.
m_Background . StopAnimating ();
m_BeginnerHelper . SetX ( CENTER_X );
m_BeginnerHelper . SetY ( CENTER_Y );
2003-08-20 09:19:46 +00:00
}
else
{
2003-12-02 19:11:51 +00:00
/* BeginnerHelper disabled/failed to load. */
2003-08-20 09:19:46 +00:00
m_Background . LoadFromSong ( GAMESTATE -> m_pCurSong );
2004-04-19 20:28:10 +00:00
if ( ! m_bDemonstration )
{
/* This will fade from a preset brightness to the actual brightness (based
* on prefs and "cover"). The preset brightness may be 0 (to fade from
* black), or it might be 1, if the stage screen has the song BG and we're
* coming from it (like Pump). This used to be done in SM_PlayReady, but
* that means it's impossible to snap to the new brightness immediately. */
m_Background . SetBrightness ( INITIAL_BACKGROUND_BRIGHTNESS ( GAMESTATE -> m_PlayMode ) );
m_Background . FadeToActualBrightness ();
}
2003-08-20 09:19:46 +00:00
}
2004-01-07 00:13:32 +00:00
m_Foreground . LoadFromSong ( GAMESTATE -> m_pCurSong );
2003-04-13 00:44:50 +00:00
2004-02-16 05:29:33 +00:00
m_fTimeSinceLastDancingComment = 0 ;
2003-08-07 07:34:42 +00:00
2003-04-13 00:44:50 +00:00
/* m_soundMusic and m_Background take a very long time to load,
* so cap fDelta at 0 so m_NextSongIn will show up on screen.
2003-08-01 11:41:13 +00:00
* -Chris */
2003-04-13 00:44:50 +00:00
m_bZeroDeltaOnNextUpdate = true ;
2004-03-30 07:44:29 +00:00
//
2004-04-22 05:25:58 +00:00
// Load cabinet lights data
2004-03-30 07:44:29 +00:00
//
2004-04-20 02:35:30 +00:00
{
2004-05-20 07:44:57 +00:00
int i ;
2004-04-20 02:35:30 +00:00
m_CabinetLightsNoteData . Init ();
ASSERT ( GAMESTATE -> m_pCurSong );
vector < Steps *> vSteps ;
2004-05-20 07:44:57 +00:00
StepsType lightsSteps = STEPS_TYPE_LIGHTS_CABINET ;
lightsSteps = GAMEMAN -> StringToNotesType ( PREFSMAN -> m_sLightsStepsType );
GAMESTATE -> m_pCurSong -> GetSteps ( vSteps , lightsSteps );
2004-04-20 02:35:30 +00:00
if ( ! vSteps . empty () )
vSteps [ 0 ] -> GetNoteData ( & m_CabinetLightsNoteData );
2004-05-20 07:44:57 +00:00
for ( i = 0 ; i < vSteps . size (); i ++ )
{
Difficulty DC = StringToDifficulty ( PREFSMAN -> m_sLightsStepsDifficulty );
Difficulty DC2 = vSteps [ i ] -> GetDifficulty ();
if ( DC == DC2 )
vSteps [ i ] -> GetNoteData ( & m_CabinetLightsNoteData );
}
2004-04-20 02:35:30 +00:00
// Convert to 4s so that we can check if we're inside a hold with just
// GetTapNote().
m_CabinetLightsNoteData . ConvertHoldNotesTo4s ();
}
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 );
2004-01-20 06:08:56 +00:00
ASSERT ( m_soundMusic );
2002-12-29 23:31:29 +00:00
2004-02-28 02:09:46 +00:00
RageSoundParams p ;
p . AccurateSync = true ;
p . SetPlaybackRate ( GAMESTATE -> m_SongOptions . m_fMusicRate );
p . StopMode = RageSoundParams :: M_CONTINUE ;
p . m_StartSecond = fStartSecond ;
2004-04-06 02:05:34 +00:00
//Secondary (Precice) start request
//used for syncing up songs.
NSMAN -> StartRequest ();
2004-03-16 22:10:45 +00:00
2004-02-28 02:09:46 +00:00
m_soundMusic -> Play ( & p );
2004-01-20 06:08:56 +00:00
SOUND -> TakeOverSound ( m_soundMusic , & GAMESTATE -> m_pCurSong -> m_Timing );
m_soundMusic = NULL ; // SOUND owns it now
2003-01-25 07:40:47 +00:00
2004-01-29 05:20:27 +00:00
/* Make sure GAMESTATE->m_fMusicSeconds is set up. */
GAMESTATE -> m_fMusicSeconds = - 5000 ;
SOUND -> Update ( 0 );
ASSERT ( GAMESTATE -> m_fMusicSeconds > - 4000 ); /* make sure the "fake timer" code doesn't trigger */
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-10-12 00:32:47 +00:00
// play assist ticks
2004-01-12 09:36:01 +00:00
void ScreenGameplay :: PlayTicks ()
2002-10-12 00:32:47 +00:00
{
2004-01-12 09:36:01 +00:00
if ( ! GAMESTATE -> m_SongOptions . m_bAssistTick )
return ;
2002-10-12 00:32:47 +00:00
2004-01-12 09:36:01 +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. This is just to make sure that we request the sound early enough for it to
* come out on time; the actual precise timing is handled by SetStartTime. */
float fPositionSeconds = GAMESTATE -> m_fMusicSeconds ;
fPositionSeconds += SOUND -> GetPlayLatency () + ( float ) TICK_EARLY_SECONDS + 0.250f ;
const float fSongBeat = GAMESTATE -> m_pCurSong -> GetBeatFromElapsedTime ( fPositionSeconds );
const int iSongRow = max ( 0 , BeatToNoteRowNotRounded ( fSongBeat ) );
2004-04-04 04:12:26 +00:00
static int iRowLastCrossed = - 1 ;
if ( iSongRow < iRowLastCrossed )
iRowLastCrossed = - 1 ;
2002-10-12 00:32:47 +00:00
2004-01-12 09:36:01 +00:00
int iTickRow = - 1 ;
for ( int r = iRowLastCrossed + 1 ; r <= iSongRow ; r ++ ) // for each index we crossed since the last update
if ( m_Player [ GAMESTATE -> m_MasterPlayerNumber ]. IsThereATapOrHoldHeadAtRow ( r ) )
iTickRow = r ;
2002-10-12 00:32:47 +00:00
2004-01-12 09:36:01 +00:00
iRowLastCrossed = iSongRow ;
if ( iTickRow != - 1 )
2002-10-12 00:32:47 +00:00
{
2004-01-12 09:36:01 +00:00
const float fTickBeat = NoteRowToBeat ( iTickRow );
const float fTickSecond = GAMESTATE -> m_pCurSong -> m_Timing . GetElapsedTimeFromBeat ( fTickBeat );
float fSecondsUntil = fTickSecond - GAMESTATE -> m_fMusicSeconds ;
2004-01-20 03:10:55 +00:00
fSecondsUntil /= GAMESTATE -> m_SongOptions . m_fMusicRate ; /* 2x music rate means the time until the tick is halved */
2002-10-12 00:32:47 +00:00
2004-02-28 02:09:46 +00:00
RageSoundParams p ;
2004-04-04 04:11:43 +00:00
p . StartTime = GAMESTATE -> m_LastBeatUpdate + ( fSecondsUntil - ( float ) TICK_EARLY_SECONDS );
2004-02-28 02:09:46 +00:00
m_soundAssistTick . Play ( & p );
2002-10-12 00:32:47 +00:00
}
}
2002-06-14 22:25:22 +00:00
2004-02-16 05:29:33 +00:00
/* Play announcer "type" if it's been at least fSeconds since the last announcer. */
void ScreenGameplay :: PlayAnnouncer ( CString type , float fSeconds )
{
if ( GAMESTATE -> m_fOpponentHealthPercent == 0 )
return ; // Shut the announcer up
2004-03-08 04:30:57 +00:00
/* Don't play in demonstration. */
if ( GAMESTATE -> m_bDemonstrationOrJukebox )
return ;
2004-02-16 05:29:33 +00:00
/* Don't play before the first beat, or after we're finished. */
if ( m_DancingState != STATE_DANCING )
return ;
2004-02-21 17:21:03 +00:00
if ( GAMESTATE -> m_pCurSong == NULL || // this will be true on ScreenDemonstration sometimes
GAMESTATE -> m_fSongBeat < GAMESTATE -> m_pCurSong -> m_fFirstBeat )
2004-02-16 05:29:33 +00:00
return ;
if ( m_fTimeSinceLastDancingComment < fSeconds )
return ;
m_fTimeSinceLastDancingComment = 0 ;
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( type );
2004-02-16 05:29:33 +00:00
if ( m_pCombinedLifeMeter )
m_pCombinedLifeMeter -> OnTaunt ();
}
2002-10-29 01:26:10 +00:00
2002-05-20 08:59:37 +00:00
void ScreenGameplay :: Update ( float fDeltaTime )
{
2003-03-24 21:26:12 +00:00
if ( GAMESTATE -> m_pCurSong == NULL )
{
/* ScreenDemonstration will move us to the next screen. We just need to
* survive for one update without crashing. We need to call Screen::Update
* to make sure we receive the next-screen message. */
Screen :: Update ( fDeltaTime );
return ;
}
2003-03-12 01:26:44 +00:00
if ( m_bFirstUpdate )
{
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( "gameplay intro" ); // crowd cheer
2003-03-16 07:30:50 +00:00
2003-03-12 01:26:44 +00:00
//
// Get the transitions rolling
//
if ( m_bDemonstration )
{
StartPlayingSong ( 0 , 0 ); // *kick* (no transitions)
}
else
{
float fMinTimeToMusic = m_In . GetLengthSeconds (); // start of m_Ready
float fMinTimeToNotes = fMinTimeToMusic + m_Ready . GetLengthSeconds () + m_Go . GetLengthSeconds () + 2 ; // end of Go
/*
* 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.)
*
* 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.
*/
/*float delay =*/ StartPlayingSong ( fMinTimeToNotes , fMinTimeToMusic );
m_In . StartTransitioning ( SM_PlayReady );
}
}
2003-04-13 00:44:50 +00:00
if ( m_bZeroDeltaOnNextUpdate )
{
Screen :: Update ( 0 );
m_bZeroDeltaOnNextUpdate = false ;
}
else
Screen :: Update ( fDeltaTime );
2003-02-10 22:08:10 +00:00
2004-02-16 05:30:31 +00:00
/* This happens if ScreenDemonstration::HandleScreenMessage sets a new screen when
* PREFSMAN->m_bDelayedScreenLoad. */
2003-03-24 21:29:06 +00:00
if ( GAMESTATE -> m_pCurSong == NULL )
return ;
2004-02-16 05:30:31 +00:00
/* This can happen if ScreenDemonstration::HandleScreenMessage sets a new screen when
* !PREFSMAN->m_bDelayedScreenLoad. (The new screen was loaded when we called Screen::Update,
* and the ctor might set a new GAMESTATE->m_pCurSong, so the above check can fail.) */
if ( SCREENMAN -> GetTopScreen () != this )
return ;
2003-02-10 22:08:10 +00:00
2003-02-11 02:20:38 +00:00
if ( GAMESTATE -> m_MasterPlayerNumber != PLAYER_INVALID )
2003-12-23 00:26:00 +00:00
m_MaxCombo . SetText ( ssprintf ( "%d" , g_CurStageStats . iMaxCombo [ GAMESTATE -> m_MasterPlayerNumber ]) ); /* 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-08-25 06:20:44 +00:00
m_BeginnerHelper . Update ( fDeltaTime );
2003-08-20 09:19:46 +00:00
2003-12-07 20:29:42 +00:00
//
// update GameState HealthState
//
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
2003-12-07 20:29:42 +00:00
{
2004-05-16 12:34:02 +00:00
if (
( m_pLifeMeter [ p ] && m_pLifeMeter [ p ] -> IsHot ()) ||
( m_pCombinedLifeMeter && m_pCombinedLifeMeter -> IsHot (( PlayerNumber ) p )) )
2003-12-07 20:29:42 +00:00
{
2004-05-16 12:34:02 +00:00
GAMESTATE -> m_HealthState [ p ] = GameState :: HOT ;
}
else if (
( m_pLifeMeter [ p ] && m_pLifeMeter [ p ] -> IsFailing ()) ||
( m_pCombinedLifeMeter && m_pCombinedLifeMeter -> IsFailing (( PlayerNumber ) p )) )
{
GAMESTATE -> m_HealthState [ p ] = GameState :: DEAD ;
}
else if (
( m_pLifeMeter [ p ] && m_pLifeMeter [ p ] -> IsInDanger ()) ||
( m_pCombinedLifeMeter && m_pCombinedLifeMeter -> IsInDanger (( PlayerNumber ) p )) )
{
GAMESTATE -> m_HealthState [ p ] = GameState :: DANGER ;
}
else
{
GAMESTATE -> m_HealthState [ p ] = GameState :: ALIVE ;
2003-12-07 20:29:42 +00:00
}
}
2002-05-20 08:59:37 +00:00
switch ( m_DancingState )
{
case STATE_DANCING :
2003-01-24 02:43:07 +00:00
//
2003-03-30 20:54:37 +00:00
// Update living players' alive time
2003-01-24 02:43:07 +00:00
//
2004-05-16 12:42:16 +00:00
FOREACH_EnabledPlayer ( pn )
if ( ! g_CurStageStats . bFailed [ pn ])
2003-12-23 00:26:00 +00:00
g_CurStageStats . fAliveSeconds [ pn ] += fDeltaTime * GAMESTATE -> m_SongOptions . m_fMusicRate ;
2003-01-24 02:43:07 +00:00
2003-12-09 10:20:18 +00:00
// update fGameplaySeconds
2003-12-23 00:26:00 +00:00
g_CurStageStats . fGameplaySeconds += fDeltaTime ;
2003-12-09 10:20:18 +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
//
2004-03-03 08:03:47 +00:00
float fSecondsToStop = GAMESTATE -> m_pCurSong -> GetElapsedTimeFromBeat ( GAMESTATE -> m_pCurSong -> m_fLastBeat );
2004-03-13 22:41:31 +00:00
/* Make sure we keep going long enough to register a miss for the last note. */
fSecondsToStop += PlayerMinus :: GetMaxStepDistanceSeconds ();
2004-03-06 10:07:17 +00:00
if ( GAMESTATE -> m_fMusicSeconds > fSecondsToStop && ! m_SongFinished . IsTransitioning () && ! m_NextSongOut . IsTransitioning () )
m_SongFinished . StartTransitioning ( SM_NotesEnded );
2002-08-01 03:15:27 +00:00
2002-07-27 19:29:51 +00:00
//
// check for fail
//
2003-09-15 21:00:59 +00:00
UpdateCheckFail ();
2003-11-10 23:25:44 +00:00
//
// update 2d dancing characters
//
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
2003-11-10 23:25:44 +00:00
{
if ( m_Background . GetDancingCharacters () != NULL )
{
if ( m_Player [ p ]. GetDancingCharacterState () != AS2D_IGNORE ) // grab the state of play from player and update the character
m_Background . GetDancingCharacters () -> Change2DAnimState ( p , m_Player [ p ]. GetDancingCharacterState ());
m_Player [ p ]. SetCharacterState ( AS2D_IGNORE ); // set to ignore as we've already grabbed the latest change
}
}
2003-07-08 19:56:56 +00:00
//
// Check for enemy death in enemy battle
//
static float fLastSeenEnemyHealth = 1 ;
if ( fLastSeenEnemyHealth != GAMESTATE -> m_fOpponentHealthPercent )
{
fLastSeenEnemyHealth = GAMESTATE -> m_fOpponentHealthPercent ;
if ( GAMESTATE -> m_fOpponentHealthPercent == 0 )
{
2004-02-16 05:29:33 +00:00
// HACK: Load incorrect directory on purpose for now.
PlayAnnouncer ( "gameplay battle damage level3" , 0 );
2003-07-09 02:27:05 +00:00
2003-07-08 19:56:56 +00:00
GAMESTATE -> RemoveAllActiveAttacks ();
2004-05-16 12:34:02 +00:00
FOREACH_CpuPlayer ( p )
2003-07-08 19:56:56 +00:00
{
2004-05-16 12:34:02 +00:00
SOUND -> PlayOnceFromDir ( THEME -> GetPathToS ( "ScreenGameplay oni die" ) );
ShowOniGameOver (( PlayerNumber ) p );
m_Player [ p ]. Init (); // remove all notes and scoring
m_Player [ p ]. FadeToFail (); // tell the NoteField to fade to white
2003-07-08 19:56:56 +00:00
}
}
}
2002-07-27 19:29:51 +00:00
//
2003-03-09 00:55:49 +00:00
// Check to see if it's time to play a ScreenGameplay comment
2002-07-27 19:29:51 +00:00
//
2004-02-16 05:29:33 +00:00
m_fTimeSinceLastDancingComment += fDeltaTime ;
switch ( GAMESTATE -> m_PlayMode )
2002-05-20 08:59:37 +00:00
{
2004-02-16 05:29:33 +00:00
case PLAY_MODE_ARCADE :
case PLAY_MODE_BATTLE :
case PLAY_MODE_RAVE :
if ( GAMESTATE -> OneIsHot () )
PlayAnnouncer ( "gameplay comment hot" , SECONDS_BETWEEN_COMMENTS );
else if ( GAMESTATE -> AllAreInDangerOrWorse () )
PlayAnnouncer ( "gameplay comment danger" , SECONDS_BETWEEN_COMMENTS );
else
PlayAnnouncer ( "gameplay comment good" , SECONDS_BETWEEN_COMMENTS );
break ;
case PLAY_MODE_NONSTOP :
case PLAY_MODE_ONI :
case PLAY_MODE_ENDLESS :
PlayAnnouncer ( "gameplay comment oni" , SECONDS_BETWEEN_COMMENTS );
break ;
default :
ASSERT ( 0 );
2002-05-20 08:59:37 +00:00
}
}
2003-09-06 03:25:45 +00:00
2003-12-25 05:53:30 +00:00
//
// update give up timer
//
2003-09-06 03:25:45 +00:00
if ( ! m_GiveUpTimer . IsZero () && m_GiveUpTimer . Ago () > 4.0f )
{
m_GiveUpTimer . SetZero ();
/* Unless we're in FailOff, giving up means failing the song. */
switch ( GAMESTATE -> m_SongOptions . m_FailType )
{
case SongOptions :: FAIL_ARCADE :
case SongOptions :: FAIL_END_OF_SONG :
2004-05-16 12:11:58 +00:00
FOREACH_EnabledPlayer ( pn )
2003-12-23 00:26:00 +00:00
g_CurStageStats . bFailed [ pn ] = true ; // fail
2003-09-06 03:25:45 +00:00
}
this -> PostScreenMessage ( SM_NotesEnded , 0 );
}
2003-12-25 05:53:30 +00:00
//
2004-01-12 09:36:01 +00:00
// play assist ticks
2003-12-25 05:53:30 +00:00
//
2004-01-12 09:36:01 +00:00
PlayTicks ();
2003-11-20 11:55:45 +00:00
2003-12-25 05:53:30 +00:00
//
// update lights
//
2004-04-22 05:25:58 +00:00
const StyleDef * pStyleDef = GAMESTATE -> GetCurrentStyleDef ();
bool bBlinkCabinetLight [ NUM_CABINET_LIGHTS ];
bool bBlinkGameButton [ MAX_GAME_CONTROLLERS ][ MAX_GAME_BUTTONS ];
ZERO ( bBlinkCabinetLight );
ZERO ( bBlinkGameButton );
2004-03-30 07:44:29 +00:00
bool bCrossedABeat = false ;
2004-01-12 09:36:01 +00:00
{
2004-04-20 02:35:30 +00:00
float fPositionSeconds = GAMESTATE -> m_fMusicSeconds - LIGHTS_FALLOFF_SECONDS / 2 ; // trigger the light a tiny bit early
2004-01-12 09:36:01 +00:00
float fSongBeat = GAMESTATE -> m_pCurSong -> GetBeatFromElapsedTime ( fPositionSeconds );
int iRowNow = BeatToNoteRowNotRounded ( fSongBeat );
iRowNow = max ( 0 , iRowNow );
static int iRowLastCrossed = 0 ;
2004-03-30 07:44:29 +00:00
float fBeatLast = roundf ( NoteRowToBeat ( iRowLastCrossed ));
float fBeatNow = roundf ( NoteRowToBeat ( iRowNow ));
bCrossedABeat = fBeatLast != fBeatNow ;
2004-01-12 09:36:01 +00:00
2004-04-23 08:31:38 +00:00
// const int iSongRow = BeatToNoteRow( fSongBeat );
2004-04-22 05:25:58 +00:00
2004-01-12 09:36:01 +00:00
for ( int r = iRowLastCrossed + 1 ; r <= iRowNow ; r ++ ) // for each index we crossed since the last update
{
2004-04-20 02:35:30 +00:00
FOREACH_CabinetLight ( cl )
2004-04-22 05:25:58 +00:00
{
bool bBlink = ( m_CabinetLightsNoteData . GetTapNote ( cl , r ) != TAP_EMPTY );
bBlinkCabinetLight [ cl ] |= bBlink ;
}
FOREACH_EnabledPlayer ( pn )
{
for ( int t = 0 ; t < m_Player [ pn ]. GetNumTracks (); t ++ )
{
bool bBlink = ( m_Player [ pn ]. GetTapNote ( t , r ) != TAP_EMPTY );
if ( bBlink )
{
StyleInput si ( pn , t );
GameInput gi = pStyleDef -> StyleInputToGameInput ( si );
bBlinkGameButton [ gi . controller ][ gi . button ] |= bBlink ;
}
}
}
2004-01-12 09:36:01 +00:00
}
iRowLastCrossed = iRowNow ;
}
2004-04-22 05:25:58 +00:00
{
// check for active HoldNotes
float fPositionSeconds = GAMESTATE -> m_fMusicSeconds - LIGHTS_FALLOFF_SECONDS / 2 ; // trigger the light a tiny bit early
float fSongBeat = GAMESTATE -> m_pCurSong -> GetBeatFromElapsedTime ( fPositionSeconds );
const int iSongRow = BeatToNoteRow ( fSongBeat );
FOREACH_EnabledPlayer ( pn )
{
// check if a hold should be active
for ( int i = 0 ; i < m_Player [ pn ]. GetNumHoldNotes (); i ++ ) // for each HoldNote
{
const HoldNote & hn = m_Player [ pn ]. GetHoldNote ( i );
if ( hn . iStartRow <= iSongRow && iSongRow <= hn . iEndRow )
{
StyleInput si ( pn , hn . iTrack );
GameInput gi = pStyleDef -> StyleInputToGameInput ( si );
bBlinkGameButton [ gi . controller ][ gi . button ] |= true ;
}
}
}
}
// send blink data
bool bOverrideCabinetBlink = ( GAMESTATE -> m_fSongBeat < GAMESTATE -> m_pCurSong -> m_fFirstBeat ) && bCrossedABeat ;
2004-03-30 07:44:29 +00:00
2004-04-20 02:35:30 +00:00
FOREACH_CabinetLight ( cl )
{
2004-04-22 05:25:58 +00:00
if ( bOverrideCabinetBlink || bBlinkCabinetLight [ cl ] )
LIGHTSMAN -> BlinkCabinetLight ( cl );
}
FOREACH_GameController ( gc )
{
FOREACH_GameButton ( gb )
{
if ( bBlinkGameButton [ gc ][ gb ] )
LIGHTSMAN -> BlinkGameButton ( GameInput ( gc , gb ) );
}
2004-04-20 02:35:30 +00:00
}
2003-12-25 05:53:30 +00:00
//
// update song position meter
//
2003-12-31 10:32:52 +00:00
float fMusicLengthSeconds = GAMESTATE -> m_pCurSong -> m_fMusicLengthSeconds ;
// HACK: most songs have a lead out, so the meter never makes
// it all the way to the right. Fudge by guessing that there's 5 seconds of lead out
fMusicLengthSeconds -= 5 ;
float fPercentPositionSong = GAMESTATE -> m_fMusicSeconds / fMusicLengthSeconds ;
2003-12-25 05:53:30 +00:00
CLAMP ( fPercentPositionSong , 0 , 1 );
m_meterSongPosition . SetPercent ( fPercentPositionSong );
2004-03-30 05:50:36 +00:00
2004-04-05 21:15:54 +00:00
//FIXED!!!!
//I figured it out!
//The problem was the pn is already taken.
//Sorry, I wasn't too smart about the way I handled it.
FOREACH_EnabledPlayer ( pn2 )
2004-03-30 09:30:30 +00:00
{
2004-04-05 21:15:54 +00:00
if ( m_pLifeMeter [ pn2 ] )
NSMAN -> m_playerLife [ pn2 ] = int ( m_pLifeMeter [ pn2 ] -> GetLife () * 10000 );
2004-03-30 09:30:30 +00:00
}
2004-04-05 21:15:54 +00:00
2002-05-20 08:59:37 +00:00
}
2003-12-23 00:26:00 +00:00
/* Set g_CurStageStats.bFailed for failed players. In, FAIL_ARCADE, send
2003-10-13 03:24:28 +00:00
* SM_BeginFailed if all players failed, and kill dead Oni players. */
2003-09-15 21:00:59 +00:00
void ScreenGameplay :: UpdateCheckFail ()
{
2003-11-04 04:22:17 +00:00
if ( GAMESTATE -> m_SongOptions . m_FailType == SongOptions :: FAIL_OFF )
return ;
2003-09-16 01:25:34 +00:00
// check for individual fail
for ( int pn = 0 ; pn < NUM_PLAYERS ; pn ++ )
2003-09-15 22:48:37 +00:00
{
2003-09-16 01:25:34 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( pn ) )
continue ;
if ( ( m_pLifeMeter [ pn ] && ! m_pLifeMeter [ pn ] -> IsFailing ()) ||
( m_pCombinedLifeMeter && ! m_pCombinedLifeMeter -> IsFailing (( PlayerNumber ) pn )) )
continue ; /* isn't failing */
2003-12-23 00:26:00 +00:00
if ( g_CurStageStats . bFailed [ pn ] )
2003-09-16 01:25:34 +00:00
continue ; /* failed and is already dead */
2003-12-01 21:12:07 +00:00
/* If recovery is enabled, only set fail if both are failing.
* There's no way to recover mid-song in battery mode. */
if ( GAMESTATE -> m_SongOptions . m_LifeType != SongOptions :: LIFE_BATTERY &&
2003-12-07 20:29:42 +00:00
PREFSMAN -> m_bTwoPlayerRecovery && ! GAMESTATE -> AllAreDead () )
2003-10-13 03:24:28 +00:00
continue ;
2003-09-16 01:25:34 +00:00
LOG -> Trace ( "Player %d failed" , ( int ) pn );
2003-12-23 00:26:00 +00:00
g_CurStageStats . bFailed [ pn ] = true ; // fail
2003-09-15 22:48:37 +00:00
2003-10-13 03:24:28 +00:00
if ( GAMESTATE -> m_SongOptions . m_LifeType == SongOptions :: LIFE_BATTERY &&
GAMESTATE -> m_SongOptions . m_FailType == SongOptions :: FAIL_ARCADE )
2003-09-15 22:48:37 +00:00
{
2003-12-31 20:58:14 +00:00
if ( ! g_CurStageStats . AllFailedEarlier () ) // if not the last one to fail
2003-09-15 22:48:37 +00:00
{
// kill them!
2004-02-16 05:29:33 +00:00
SOUND -> PlayOnceFromDir ( THEME -> GetPathToS ( "ScreenGameplay oni die" ) );
2003-09-15 22:48:37 +00:00
ShowOniGameOver (( PlayerNumber ) pn );
m_Player [ pn ]. Init (); // remove all notes and scoring
m_Player [ pn ]. FadeToFail (); // tell the NoteField to fade to white
}
}
2003-09-15 21:00:59 +00:00
}
2003-10-13 03:24:28 +00:00
/* If FAIL_ARCADE and everyone is failing, start SM_BeginFailed. */
if ( GAMESTATE -> m_SongOptions . m_FailType == SongOptions :: FAIL_ARCADE &&
2003-12-07 20:29:42 +00:00
GAMESTATE -> AllAreDead () )
2003-10-13 03:24:28 +00:00
SCREENMAN -> PostMessageToTopScreen ( SM_BeginFailed , 0 );
2003-09-15 21:00:59 +00:00
}
2003-09-06 03:25:45 +00:00
void ScreenGameplay :: AbortGiveUp ()
{
if ( m_GiveUpTimer . IsZero () )
return ;
m_textDebug . StopTweening ();
m_textDebug . SetText ( "Don't give up!" );
m_textDebug . BeginTweening ( 1 / 2.f );
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
m_GiveUpTimer . SetZero ();
}
2002-05-20 08:59:37 +00:00
void ScreenGameplay :: DrawPrimitives ()
{
2003-08-20 09:19:46 +00:00
m_BeginnerHelper . DrawPrimitives ();
2002-05-20 08:59:37 +00:00
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 () &&
m_DancingState != STATE_OUTRO &&
2003-03-09 00:55:49 +00:00
! m_Back . IsTransitioning () )
2003-01-19 21:57:13 +00:00
{
2003-11-24 02:03:09 +00:00
/* Allow bailing out by holding the START button of all active players. This
* gives a way to "give up" when a back button isn't available. Doing this is
* treated as failing the song, unlike BACK, since it's always available.
*
* However, if this is also a style button, don't do this. (pump center = start) */
2003-09-19 20:45:27 +00:00
if ( MenuI . button == MENU_BUTTON_START && ! StyleI . IsValid () )
2003-09-06 03:25:45 +00:00
{
/* No PREFSMAN->m_bDelayedEscape; always delayed. */
if ( type == IET_RELEASE )
AbortGiveUp ();
2003-11-24 02:03:09 +00:00
else if ( type == IET_FIRST_PRESS && m_GiveUpTimer . IsZero () )
2003-09-06 03:25:45 +00:00
{
m_textDebug . SetText ( "Continue holding START to give up" );
m_textDebug . StopTweening ();
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
m_textDebug . BeginTweening ( 1 / 8.f );
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
m_GiveUpTimer . Touch (); /* start the timer */
}
return ;
}
if ( MenuI . button == MENU_BUTTON_BACK &&
2003-09-06 03:55:32 +00:00
(( ! PREFSMAN -> m_bDelayedEscape && type == IET_FIRST_PRESS ) ||
2004-02-20 03:38:39 +00:00
( DeviceI . device == DEVICE_KEYBOARD && ( type == IET_SLOW_REPEAT || type == IET_FAST_REPEAT )) ||
2003-09-06 03:55:32 +00:00
( DeviceI . device != DEVICE_KEYBOARD && type == IET_FAST_REPEAT )) )
2003-01-19 21:57:13 +00:00
{
2004-02-16 01:35:59 +00:00
/* I had battle mode back out on me mysteriously once. -glenn */
LOG -> Trace ( "Player %i went back" , MenuI . player + 1 );
2003-01-19 21:57:13 +00:00
m_DancingState = STATE_OUTRO ;
2004-05-01 23:30:30 +00:00
SCREENMAN -> PlayBackSound ();
2003-01-19 21:57:13 +00:00
/* 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.
*/
2004-01-20 06:08:56 +00:00
SOUND -> StopMusic ();
2004-02-09 19:56:28 +00:00
SOUND -> HandleSongTimer ( false );
2004-01-12 09:36:01 +00:00
m_soundAssistTick . StopPlaying (); /* Stop any queued assist ticks. */
2003-01-19 21:57:13 +00:00
this -> ClearMessageQueue ();
2003-03-09 00:55:49 +00:00
m_Back . StartTransitioning ( SM_SaveChangedBeforeGoingBack );
2003-01-19 21:57:13 +00:00
return ;
}
2004-02-15 02:06:39 +00:00
if ( MenuI . button == MENU_BUTTON_BACK && 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 . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
return ;
}
if ( MenuI . button == MENU_BUTTON_BACK && PREFSMAN -> m_bDelayedEscape && type == IET_RELEASE )
{
m_textDebug . StopTweening ();
m_textDebug . BeginTweening ( 1 / 8.f );
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
return ;
}
2003-01-19 21:57:13 +00:00
}
/* 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 )
{
2004-03-07 04:34:49 +00:00
case SDLK_F5 :
this -> HandleScreenMessage ( SM_NotesEnded );
break ;
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
2003-03-12 01:26:44 +00:00
UpdateAutoPlayText ();
2002-10-01 01:55:39 +00:00
break ;
2002-11-29 20:37:12 +00:00
case SDLK_F7 :
2003-03-27 02:10:20 +00:00
GAMESTATE -> m_SongOptions . m_bAssistTick ^= 1 ;
2003-06-14 22:58:21 +00:00
/* Store this change, so it sticks if we change songs: */
GAMESTATE -> m_StoredSongOptions . m_bAssistTick = GAMESTATE -> m_SongOptions . m_bAssistTick ;
2003-01-11 08:55:21 +00:00
2003-03-27 02:10:20 +00:00
m_textDebug . SetText ( ssprintf ( "Assist Tick is %s" , GAMESTATE -> m_SongOptions . m_bAssistTick ? "ON" : "OFF" ) );
2002-08-25 05:07:47 +00:00
m_textDebug . StopTweening ();
2003-11-03 02:10:03 +00:00
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-09-02 21:59:58 +00:00
m_textDebug . BeginTweening ( 3 ); // sleep
m_textDebug . BeginTweening ( 0.5f ); // fade out
2003-04-12 06:16:12 +00:00
m_textDebug . SetDiffuse ( 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 :
2003-04-07 21:24:14 +00:00
{
PREFSMAN -> m_bAutoPlay = ! PREFSMAN -> m_bAutoPlay ;
UpdateAutoPlayText ();
2004-02-01 03:14:37 +00:00
bool bIsHoldingShift =
INPUTFILTER -> IsBeingPressed ( DeviceInput ( DEVICE_KEYBOARD , SDLK_RSHIFT )) ||
INPUTFILTER -> IsBeingPressed ( DeviceInput ( DEVICE_KEYBOARD , SDLK_LSHIFT ));
2004-05-16 12:34:02 +00:00
FOREACH_HumanPlayer ( p )
2004-02-01 03:14:37 +00:00
{
2004-05-16 12:34:02 +00:00
if ( bIsHoldingShift )
GAMESTATE -> m_PlayerController [ p ] = PREFSMAN -> m_bAutoPlay ? PC_CPU : PC_HUMAN ;
else
GAMESTATE -> m_PlayerController [ p ] = PREFSMAN -> m_bAutoPlay ? PC_AUTOPLAY : PC_HUMAN ;
2004-02-01 03:14:37 +00:00
}
2003-04-07 21:24:14 +00:00
}
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 )
{
2003-06-17 06:24:13 +00:00
case SDLK_F9 : fOffsetDelta = - 0.020f ; break ;
case SDLK_F10 : fOffsetDelta = + 0.020f ; break ;
2002-09-07 10:43:16 +00:00
default : ASSERT ( 0 ); return ;
2002-07-27 19:29:51 +00:00
}
2003-06-17 06:24:13 +00:00
if ( INPUTFILTER -> IsBeingPressed ( DeviceInput ( DEVICE_KEYBOARD , SDLK_RALT )) ||
INPUTFILTER -> IsBeingPressed ( DeviceInput ( DEVICE_KEYBOARD , SDLK_LALT )) )
fOffsetDelta /= 2 ; /* .010 */
else 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 ;
2003-06-17 06:24:13 +00:00
m_textDebug . SetText ( ssprintf ( "Cur BPM = %.2f" , seg . m_fBPM ) );
2002-07-27 19:29:51 +00:00
m_textDebug . StopTweening ();
2003-11-03 02:10:03 +00:00
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-09-02 21:59:58 +00:00
m_textDebug . BeginTweening ( 3 ); // sleep
m_textDebug . BeginTweening ( 0.5f ); // fade out
2003-04-12 06:16:12 +00:00
m_textDebug . SetDiffuse ( 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
}
2003-06-10 22:14:09 +00:00
if ( INPUTFILTER -> IsBeingPressed ( DeviceInput ( DEVICE_KEYBOARD , SDLK_RALT )) ||
INPUTFILTER -> IsBeingPressed ( DeviceInput ( DEVICE_KEYBOARD , SDLK_LALT )) )
fOffsetDelta /= 20 ; /* 1ms */
else switch ( type )
{
case IET_SLOW_REPEAT : fOffsetDelta *= 10 ; break ;
case IET_FAST_REPEAT : fOffsetDelta *= 40 ; break ;
}
2002-07-03 21:27:26 +00:00
2003-12-18 04:48:26 +00:00
GAMESTATE -> m_pCurSong -> m_Timing . m_fBeat0OffsetInSeconds += fOffsetDelta ;
2002-07-03 21:27:26 +00:00
2003-12-18 04:48:26 +00:00
m_textDebug . SetText ( ssprintf ( "Offset = %.3f" , GAMESTATE -> m_pCurSong -> m_Timing . m_fBeat0OffsetInSeconds ) );
2002-07-03 21:27:26 +00:00
m_textDebug . StopTweening ();
2003-11-03 02:10:03 +00:00
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 1 ) );
2002-09-02 21:59:58 +00:00
m_textDebug . BeginTweening ( 3 ); // sleep
m_textDebug . BeginTweening ( 0.5f ); // fade out
2003-04-12 06:16:12 +00:00
m_textDebug . SetDiffuse ( 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
//
2003-02-25 00:33:42 +00:00
// handle a step or battle item activate
2002-07-27 19:29:51 +00:00
//
2003-01-25 11:05:12 +00:00
if ( type == IET_FIRST_PRESS &&
StyleI . IsValid () &&
2004-01-01 04:11:18 +00:00
GAMESTATE -> IsHumanPlayer ( StyleI . player ) )
2003-02-27 10:56:37 +00:00
{
2003-11-24 02:03:09 +00:00
AbortGiveUp ();
if ( ! PREFSMAN -> m_bAutoPlay )
m_Player [ StyleI . player ]. Step ( StyleI . col , DeviceI . ts );
2003-02-27 10:56:37 +00:00
}
2003-11-20 06:50:05 +00:00
// else if( type==IET_FIRST_PRESS &&
// !PREFSMAN->m_bAutoPlay &&
// MenuI.IsValifd() &&
// GAMESTATE->IsPlayerEnabled( MenuI.player ) &&
// GAMESTATE->IsBattleMode() )
// {
// int iItemSlot;
// switch( MenuI.button )
// {
// case MENU_BUTTON_LEFT: iItemSlot = 0; break;
// case MENU_BUTTON_START: iItemSlot = 1; break;
// case MENU_BUTTON_RIGHT: iItemSlot = 2; break;
// default: iItemSlot = -1; break;
// }
//
// if( iItemSlot != -1 )
// m_pInventory[MenuI.player]->UseItem( iItemSlot );
// }
2002-05-20 08:59:37 +00:00
}
2003-03-12 01:26:44 +00:00
void ScreenGameplay :: UpdateAutoPlayText ()
2003-01-11 08:55:21 +00:00
{
2003-03-09 00:55:49 +00:00
CString sText ;
2003-01-11 08:55:21 +00:00
2003-03-09 00:55:49 +00:00
if ( PREFSMAN -> m_bAutoPlay )
sText += "AutoPlay " ;
if ( GAMESTATE -> m_SongOptions . m_bAutoSync )
sText += "AutoSync " ;
2003-01-11 08:55:21 +00:00
2003-03-09 00:55:49 +00:00
if ( sText . length () > 0 )
sText . resize ( sText . length () - 5 );
2003-03-12 01:26:44 +00:00
m_textAutoPlay . SetText ( sText );
2003-01-11 08:55:21 +00:00
}
2003-08-23 18:33:49 +00:00
void SaveChanges ( void * papSongsQueue )
2002-07-27 19:29:51 +00:00
{
2003-08-23 18:33:49 +00:00
vector < Song *>& apSongsQueue = * ( vector < Song *>* ) papSongsQueue ;
2003-09-01 01:47:47 +00:00
for ( unsigned i = 0 ; i < apSongsQueue . size (); i ++ )
2003-08-23 18:33:49 +00:00
apSongsQueue [ i ] -> Save ();
2002-07-27 19:29:51 +00:00
}
2003-08-23 18:33:49 +00:00
void RevertChanges ( void * papSongsQueue )
2002-07-27 19:29:51 +00:00
{
2003-08-23 18:33:49 +00:00
vector < Song *>& apSongsQueue = * ( vector < Song *>* ) papSongsQueue ;
2003-09-01 01:47:47 +00:00
for ( unsigned i = 0 ; i < apSongsQueue . size (); i ++ )
2003-08-23 18:33:49 +00:00
apSongsQueue [ i ] -> RevertFromDisk ();
2002-07-27 19:29:51 +00:00
}
2003-08-23 18:33:49 +00:00
void ScreenGameplay :: ShowSavePrompt ( ScreenMessage SM_SendWhenDone )
2002-07-27 19:29:51 +00:00
{
2002-07-28 20:28:37 +00:00
CString sMessage ;
switch ( GAMESTATE -> m_PlayMode )
{
case PLAY_MODE_ARCADE :
2003-08-19 04:27:50 +00:00
case PLAY_MODE_BATTLE :
2003-04-07 05:14:27 +00:00
case PLAY_MODE_RAVE :
2002-07-28 20:28:37 +00:00
sMessage = ssprintf (
"You have changed the offset or BPM of \n "
2003-08-12 00:40:38 +00:00
"%s \n " ,
GAMESTATE -> m_pCurSong -> GetFullDisplayTitle (). c_str () );
2003-12-18 04:48:26 +00:00
if ( fabs ( GAMESTATE -> m_pCurSong -> m_Timing . m_fBeat0OffsetInSeconds - g_fOldOffset ) > 0.001 )
2003-08-12 00:40:38 +00:00
{
sMessage += ssprintf (
" \n "
"Offset was changed from %.3f to %.3f (%.3f). \n " ,
g_fOldOffset ,
2003-12-18 04:48:26 +00:00
GAMESTATE -> m_pCurSong -> m_Timing . m_fBeat0OffsetInSeconds ,
GAMESTATE -> m_pCurSong -> m_Timing . m_fBeat0OffsetInSeconds - g_fOldOffset );
2003-08-12 00:40:38 +00:00
}
sMessage +=
" \n "
2002-07-28 20:28:37 +00:00
"Would you like to save these changes back \n "
"to the song file? \n "
2003-08-12 00:40:38 +00:00
"Choosing NO will discard your changes." ;
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 );
}
2003-08-23 18:33:49 +00:00
SCREENMAN -> Prompt ( SM_SendWhenDone , sMessage , true , false , SaveChanges , RevertChanges , & m_apSongsQueue );
2002-07-27 19:29:51 +00:00
}
2003-12-23 02:18:27 +00:00
/*
* Saving StageStats that are affected by the note pattern is a little tricky:
*
* Stats are cumulative for course play.
*
* For regular songs, it doesn't matter how we do it; the pattern doesn't change
* during play.
*
* The pattern changes during play in battle and course mode. We want to include these
* changes, so run stats for a song after the song finishes.
*
* If we fail, be sure to include the current song in stats, with the current modifier set.
*
* So:
*
* 1. At the end of a song in any mode, pass or fail, add stats for that song (from m_Player).
* 2. At the end of gameplay in course mode, add stats for any songs that weren't played,
* applying the modifiers the song would have been played with. This doesn't include songs
* that were played but failed; that was done in #1.
*/
2003-12-15 06:24:59 +00:00
void ScreenGameplay :: SongFinished ()
{
2003-12-23 02:18:27 +00:00
LOG -> Trace ( "SongFinished" );
2003-12-15 06:24:59 +00:00
// save any statistics
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
2003-12-15 06:24:59 +00:00
{
for ( int r = 0 ; r < NUM_RADAR_CATEGORIES ; r ++ )
{
2003-12-23 02:18:27 +00:00
/* Note that adding stats is only meaningful for the counters (eg. RADAR_NUM_JUMPS),
* not for the percentages (RADAR_AIR). */
2003-12-15 06:24:59 +00:00
RadarCategory rc = ( RadarCategory ) r ;
2003-12-23 02:18:27 +00:00
g_CurStageStats . fRadarPossible [ p ][ r ] += NoteDataUtil :: GetRadarValue ( m_Player [ p ], rc , GAMESTATE -> m_pCurSong -> m_fMusicLengthSeconds );
g_CurStageStats . fRadarActual [ p ][ r ] += m_Player [ p ]. GetActualRadarValue ( rc , ( PlayerNumber ) p , GAMESTATE -> m_pCurSong -> m_fMusicLengthSeconds );
2003-12-15 06:24:59 +00:00
}
}
2004-02-16 10:22:18 +00:00
/* Extremely important: if we don't remove attacks before moving on to the next
* screen, they'll still be turned on eventually. */
GAMESTATE -> RemoveAllActiveAttacks ();
2003-12-23 02:18:27 +00:00
}
2003-12-15 06:24:59 +00:00
2004-02-21 21:00:49 +00:00
void ScreenGameplay :: StageFinished ( bool bBackedOut )
2003-12-23 02:18:27 +00:00
{
if ( GAMESTATE -> IsCourseMode () && GAMESTATE -> m_PlayMode != PLAY_MODE_ENDLESS )
{
2004-01-03 04:38:17 +00:00
LOG -> Trace ( "Stage finished at index %i/%i" , GAMESTATE -> GetCourseSongIndex (), ( int ) m_apSongsQueue . size () );
2003-12-23 02:18:27 +00:00
/* +1 to skip the current song; that's done already. */
for ( unsigned iPlaySongIndex = GAMESTATE -> GetCourseSongIndex () + 1 ;
iPlaySongIndex < m_apSongsQueue . size (); ++ iPlaySongIndex )
{
LOG -> Trace ( "Running stats for %i" , iPlaySongIndex );
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
2003-12-23 02:18:27 +00:00
{
SetupSong ( p , iPlaySongIndex );
m_Player [ p ]. ApplyWaitingTransforms ();
SongFinished ();
}
}
}
2003-12-15 06:24:59 +00:00
// save current stage stats
2004-02-21 21:00:49 +00:00
if ( ! bBackedOut )
g_vPlayedStageStats . push_back ( g_CurStageStats );
2004-01-23 02:04:34 +00:00
/* Reset options. */
GAMESTATE -> RestoreSelectedOptions ();
2003-12-15 06:24:59 +00:00
}
2002-05-20 08:59:37 +00:00
void ScreenGameplay :: HandleScreenMessage ( const ScreenMessage SM )
{
2003-11-14 18:33:12 +00:00
CHECKPOINT_M ( ssprintf ( "HandleScreenMessage(%i)" , SM ) );
2002-05-20 08:59:37 +00:00
switch ( SM )
{
2003-03-09 00:55:49 +00:00
case SM_PlayReady :
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( "gameplay ready" );
2003-03-09 00:55:49 +00:00
m_Ready . StartTransitioning ( SM_PlayGo );
2002-05-20 08:59:37 +00:00
break ;
2003-03-09 00:55:49 +00:00
case SM_PlayGo :
2004-02-16 05:29:33 +00:00
if ( GAMESTATE -> IsExtraStage () || GAMESTATE -> IsExtraStage2 () )
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( "gameplay here we go extra" );
2004-02-16 05:29:33 +00:00
else if ( GAMESTATE -> IsFinalStage () )
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( "gameplay here we go final" );
2004-02-16 05:29:33 +00:00
else
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( "gameplay here we go normal" );
2004-02-16 05:29:33 +00:00
2003-03-09 00:55:49 +00:00
m_Go . StartTransitioning ( SM_None );
2003-01-26 04:58:07 +00:00
GAMESTATE -> m_bPastHereWeGo = true ;
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
{
2003-10-24 09:39:00 +00:00
/* Do this in LoadNextSong, so we don't tween off old attacks until
* m_NextSongOut finishes. */
// GAMESTATE->RemoveAllActiveAttacks();
2003-02-26 00:20:00 +00:00
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
2003-02-24 02:45:01 +00:00
{
2003-11-03 19:42:06 +00:00
/* If either player's passmark is enabled, check it. */
if ( GAMESTATE -> m_PlayerOptions [ p ]. m_fPassmark > 0 &&
m_pLifeMeter [ p ] &&
m_pLifeMeter [ p ] -> GetLife () < GAMESTATE -> m_PlayerOptions [ p ]. m_fPassmark )
{
LOG -> Trace ( "Player %i failed: life %f is under %f" ,
p + 1 , m_pLifeMeter [ p ] -> GetLife (), GAMESTATE -> m_PlayerOptions [ p ]. m_fPassmark );
2003-12-23 00:26:00 +00:00
g_CurStageStats . bFailed [ p ] = true ;
2003-11-03 19:42:06 +00:00
}
2003-12-15 06:24:59 +00:00
/* Mark failure. This hasn't been done yet if m_bTwoPlayerRecovery is set. */
if ( GAMESTATE -> m_SongOptions . m_FailType != SongOptions :: FAIL_OFF &&
( m_pLifeMeter [ p ] && m_pLifeMeter [ p ] -> IsFailing ()) ||
( m_pCombinedLifeMeter && m_pCombinedLifeMeter -> IsFailing (( PlayerNumber ) p )) )
2003-12-23 00:26:00 +00:00
g_CurStageStats . bFailed [ p ] = true ;
2003-12-15 06:24:59 +00:00
2003-12-23 00:26:00 +00:00
if ( ! g_CurStageStats . bFailed [ p ] )
g_CurStageStats . iSongsPassed [ p ] ++ ;
2003-02-24 02:45:01 +00:00
}
2002-07-28 20:28:37 +00:00
2003-11-03 19:42:06 +00:00
/* If all players have *really* failed (bFailed, not the life meter or
* bFailedEarlier): */
2003-12-23 00:26:00 +00:00
const bool bAllReallyFailed = g_CurStageStats . AllFailed ();
2003-11-03 19:42:06 +00:00
if ( ! bAllReallyFailed && ! IsLastSong () )
2002-07-27 19:29:51 +00:00
{
2003-11-03 19:42:06 +00:00
/* Next song. */
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
{
if ( ! g_CurStageStats . bFailed [ p ] )
{
// give a little life back between stages
if ( m_pLifeMeter [ p ] )
m_pLifeMeter [ p ] -> OnSongEnded ();
if ( m_pCombinedLifeMeter )
m_pCombinedLifeMeter -> OnSongEnded ();
}
}
2003-04-13 00:44:50 +00:00
// HACK: Temporarily set the song pointer to the next song so that
// this m_NextSongOut will show the next song banner
Song * pCurSong = GAMESTATE -> m_pCurSong ;
int iPlaySongIndex = GAMESTATE -> GetCourseSongIndex () + 1 ;
iPlaySongIndex %= m_apSongsQueue . size ();
GAMESTATE -> m_pCurSong = m_apSongsQueue [ iPlaySongIndex ];
m_NextSongOut . Load ( THEME -> GetPathToB ( "ScreenGameplay next song out" ) );
GAMESTATE -> m_pCurSong = pCurSong ;
m_NextSongOut . StartTransitioning ( SM_LoadNextSong );
2004-02-14 00:39:24 +00:00
LoadCourseSongNumber ( GetMaxSongsPlayed () + 1 );
COMMAND ( m_sprCourseSongNumber , "ChangeIn" );
2003-11-03 19:42:06 +00:00
return ;
2002-07-28 20:28:37 +00:00
}
2003-11-10 23:25:44 +00:00
// update dancing characters for win / lose
2003-11-14 18:33:12 +00:00
DancingCharacters * Dancers = m_Background . GetDancingCharacters ();
if ( Dancers )
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
2003-11-10 23:25:44 +00:00
{
2003-11-14 18:33:12 +00:00
/* XXX: In battle modes, switch( GAMESTATE->GetStageResult(p) ). */
2003-12-23 00:26:00 +00:00
if ( g_CurStageStats . bFailed [ p ] )
2003-11-14 18:33:12 +00:00
Dancers -> Change2DAnimState ( p , AS2D_FAIL ); // fail anim
else if ( m_pLifeMeter [ p ] && m_pLifeMeter [ p ] -> GetLife () == 1.0f ) // full life
Dancers -> Change2DAnimState ( p , AS2D_WINFEVER ); // full life pass anim
else
Dancers -> Change2DAnimState ( p , AS2D_WIN ); // pass anim
}
2003-11-03 19:42:06 +00:00
/* End round. */
if ( m_DancingState == STATE_OUTRO ) // ScreenGameplay already ended
return ; // ignore
m_DancingState = STATE_OUTRO ;
GAMESTATE -> RemoveAllActiveAttacks ();
2004-03-23 06:11:10 +00:00
LIGHTSMAN -> SetLightsMode ( LIGHTSMODE_ALL_CLEARED );
2003-11-16 04:45:12 +00:00
2003-11-03 19:42:06 +00:00
if ( bAllReallyFailed )
2002-07-28 20:28:37 +00:00
{
2003-11-03 19:42:06 +00:00
this -> PostScreenMessage ( SM_BeginFailed , 0 );
return ;
}
2002-07-28 20:28:37 +00:00
2003-11-03 19:42:06 +00:00
// do they deserve an extra stage?
if ( GAMESTATE -> HasEarnedExtraStage () )
{
TweenOffScreen ();
m_Extra . StartTransitioning ( SM_GoToStateAfterCleared );
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( "gameplay extra" );
2003-11-03 19:42:06 +00:00
}
else
{
TweenOffScreen ();
switch ( GAMESTATE -> m_PlayMode )
2002-07-28 20:28:37 +00:00
{
2003-11-03 19:42:06 +00:00
case PLAY_MODE_BATTLE :
case PLAY_MODE_RAVE :
2003-03-09 00:55:49 +00:00
{
2003-11-03 19:42:06 +00:00
PlayerNumber winner = GAMESTATE -> GetBestPlayer ();
switch ( winner )
2003-04-14 22:12:54 +00:00
{
2003-11-03 19:42:06 +00:00
case PLAYER_INVALID :
m_Draw . StartTransitioning ( SM_GoToStateAfterCleared );
break ;
default :
m_Win [ winner ]. StartTransitioning ( SM_GoToStateAfterCleared );
break ;
2003-04-14 22:12:54 +00:00
}
2003-03-09 00:55:49 +00:00
}
2003-11-03 19:42:06 +00:00
break ;
default :
m_Cleared . StartTransitioning ( SM_GoToStateAfterCleared );
break ;
2002-07-28 20:28:37 +00:00
}
2003-11-03 19:42:06 +00:00
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( "gameplay cleared" );
2002-07-27 19:29:51 +00:00
}
2002-05-20 08:59:37 +00:00
}
2003-11-10 23:25:44 +00:00
2002-05-20 08:59:37 +00:00
break ;
2003-04-13 00:44:50 +00:00
case SM_LoadNextSong :
2003-12-15 06:24:59 +00:00
SongFinished ();
2004-02-14 00:39:24 +00:00
COMMAND ( m_sprCourseSongNumber , "ChangeOut" );
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. */
2003-04-13 00:44:50 +00:00
StartPlayingSong ( m_NextSongIn . GetLengthSeconds () + 2 , 0 );
m_NextSongIn . StartTransitioning ( SM_None );
2002-08-01 03:15:27 +00:00
break ;
2003-03-16 19:11:51 +00:00
case SM_PlayToasty :
2003-01-11 08:55:21 +00:00
if ( PREFSMAN -> m_bEasterEggs )
2003-03-16 19:11:51 +00:00
if ( ! m_Toasty . IsTransitioning () && ! m_Toasty . IsFinished () ) // don't play if we've already played it once
m_Toasty . StartTransitioning ();
2002-08-26 05:53:48 +00:00
break ;
2003-05-13 13:35:32 +00:00
#define SECS_SINCE_LAST_COMMENT (SECONDS_BETWEEN_COMMENTS-m_fTimeLeftBeforeDancingComment)
2002-07-11 19:02:26 +00:00
case SM_100Combo :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay 100 combo" , 2 );
2002-07-11 19:02:26 +00:00
break ;
case SM_200Combo :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay 200 combo" , 2 );
2002-07-11 19:02:26 +00:00
break ;
case SM_300Combo :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay 300 combo" , 2 );
2002-07-11 19:02:26 +00:00
break ;
case SM_400Combo :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay 400 combo" , 2 );
2002-07-11 19:02:26 +00:00
break ;
case SM_500Combo :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay 500 combo" , 2 );
2002-07-11 19:02:26 +00:00
break ;
case SM_600Combo :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay 600 combo" , 2 );
2002-07-11 19:02:26 +00:00
break ;
case SM_700Combo :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay 700 combo" , 2 );
2002-07-11 19:02:26 +00:00
break ;
case SM_800Combo :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay 800 combo" , 2 );
2002-07-11 19:02:26 +00:00
break ;
case SM_900Combo :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay 900 combo" , 2 );
2002-07-11 19:02:26 +00:00
break ;
case SM_1000Combo :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay 1000 combo" , 2 );
2002-07-11 19:02:26 +00:00
break ;
case SM_ComboStopped :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay combo stopped" , 2 );
2002-07-11 19:02:26 +00:00
break ;
2003-08-25 17:15:47 +00:00
case SM_ComboContinuing :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay combo overflow" , 2 );
2003-08-25 17:15:47 +00:00
break ;
2003-05-13 13:35:32 +00:00
case SM_BattleTrickLevel1 :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay battle trick level1" , 3 );
2003-11-20 06:50:05 +00:00
m_soundBattleTrickLevel1 . Play ();
2003-05-13 13:35:32 +00:00
break ;
case SM_BattleTrickLevel2 :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay battle trick level2" , 3 );
2003-11-20 06:50:05 +00:00
m_soundBattleTrickLevel2 . Play ();
2003-05-13 13:35:32 +00:00
break ;
case SM_BattleTrickLevel3 :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay battle trick level3" , 3 );
2003-11-20 06:50:05 +00:00
m_soundBattleTrickLevel3 . Play ();
2003-05-13 13:35:32 +00:00
break ;
case SM_BattleDamageLevel1 :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay battle damage level1" , 3 );
2003-05-13 13:35:32 +00:00
break ;
case SM_BattleDamageLevel2 :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay battle damage level2" , 3 );
2003-05-13 13:35:32 +00:00
break ;
case SM_BattleDamageLevel3 :
2004-02-16 05:29:33 +00:00
PlayAnnouncer ( "gameplay battle damage level3" , 3 );
2003-05-13 13:35:32 +00:00
break ;
2002-08-01 05:11:11 +00:00
case SM_SaveChangedBeforeGoingBack :
if ( m_bChangedOffsetOrBPM )
{
m_bChangedOffsetOrBPM = false ;
ShowSavePrompt ( SM_GoToScreenAfterBack );
2004-02-16 09:11:25 +00:00
break ;
2002-08-01 05:11:11 +00:00
}
2004-02-16 09:11:25 +00:00
HandleScreenMessage ( SM_GoToScreenAfterBack );
2002-08-01 05:11:11 +00:00
break ;
2003-03-09 00:55:49 +00:00
2002-07-27 19:29:51 +00:00
case SM_GoToScreenAfterBack :
2003-12-15 06:24:59 +00:00
SongFinished ();
2004-02-21 21:00:49 +00:00
StageFinished ( true );
2003-12-15 06:24:59 +00:00
2004-01-23 02:04:34 +00:00
GAMESTATE -> CancelStage ();
2004-04-18 05:15:22 +00:00
SCREENMAN -> SetNewScreen ( PREV_SCREEN );
2002-07-27 19:29:51 +00:00
break ;
2003-03-09 00:55:49 +00:00
2002-07-27 19:29:51 +00:00
case SM_GoToStateAfterCleared :
if ( m_bChangedOffsetOrBPM )
{
m_bChangedOffsetOrBPM = false ;
ShowSavePrompt ( SM_GoToStateAfterCleared );
break ;
}
2003-08-01 11:41:13 +00:00
2004-02-16 09:11:25 +00:00
SongFinished ();
2004-02-21 21:00:49 +00:00
StageFinished ( false );
2004-02-16 09:11:25 +00:00
2004-04-18 05:15:22 +00:00
SCREENMAN -> SetNewScreen ( NEXT_SCREEN );
2002-05-20 08:59:37 +00:00
break ;
2004-02-09 19:56:28 +00:00
case SM_LoseFocus :
/* We might have turned the song timer off. Be sure to turn it back on. */
SOUND -> HandleSongTimer ( true );
break ;
2002-05-20 08:59:37 +00:00
case SM_BeginFailed :
m_DancingState = STATE_OUTRO ;
2004-01-20 06:08:56 +00:00
SOUND -> StopMusic ();
2004-02-09 19:56:28 +00:00
SOUND -> HandleSongTimer ( false );
2004-01-12 09:36:01 +00:00
m_soundAssistTick . StopPlaying (); /* Stop any queued assist ticks. */
2003-04-13 21:17:14 +00:00
TweenOffScreen ();
2003-03-09 00:55:49 +00:00
m_Failed . StartTransitioning ( SM_GoToScreenAfterFail );
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 ;
2004-05-16 12:34:02 +00:00
FOREACH_EnabledPlayer ( p )
fMaxSurviveSeconds = max ( fMaxSurviveSeconds , g_CurStageStats . fAliveSeconds [ p ] );
2003-01-24 02:43:07 +00:00
ASSERT ( fMaxSurviveSeconds > 0 );
2004-02-22 19:51:46 +00:00
m_textSurviveTime . SetText ( "TIME: " + SecondsToMMSSMsMs ( fMaxSurviveSeconds ) );
2003-08-07 10:15:16 +00:00
SET_XY_AND_ON_COMMAND ( m_textSurviveTime );
2002-08-01 13:42:56 +00:00
}
2003-08-25 17:15:47 +00:00
// Feels hackish. Feel free to make cleaner.
2004-02-15 23:10:40 +00:00
if ( GAMESTATE -> IsCourseMode () )
if ( GAMESTATE -> GetCourseSongIndex () > ( int ( m_apSongsQueue . size () / 2 ) - 1 ) )
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( "gameplay oni failed halfway" );
2003-08-25 17:15:47 +00:00
else
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( "gameplay oni failed" );
2003-08-25 17:15:47 +00:00
else
2004-04-12 20:11:36 +00:00
SOUND -> PlayOnceFromAnnouncer ( "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
2004-02-16 09:11:25 +00:00
SongFinished ();
2004-02-21 21:00:49 +00:00
StageFinished ( false );
2004-02-16 09:11:25 +00:00
2003-03-25 21:17:29 +00:00
switch ( GAMESTATE -> m_PlayMode )
{
case PLAY_MODE_ARCADE :
2003-08-19 04:27:50 +00:00
case PLAY_MODE_BATTLE :
2003-04-07 05:14:27 +00:00
case PLAY_MODE_RAVE :
2003-04-19 19:05:25 +00:00
if ( PREFSMAN -> m_bEventMode )
2003-11-10 23:25:44 +00:00
{
if ( EVAL_ON_FAIL ) // go to the eval screen if we fail
SCREENMAN -> SetNewScreen ( "ScreenEvaluationStage" );
else // the theme says just fail and go back to the song select for event mode
2004-04-18 05:15:22 +00:00
SCREENMAN -> SetNewScreen ( PREV_SCREEN );
2003-11-10 23:25:44 +00:00
}
2003-03-25 21:17:29 +00:00
else if ( GAMESTATE -> IsExtraStage () || GAMESTATE -> IsExtraStage2 () )
2003-04-16 22:49:40 +00:00
SCREENMAN -> SetNewScreen ( "ScreenEvaluationStage" );
2003-03-25 21:17:29 +00:00
else
2003-11-10 23:25:44 +00:00
{
if ( EVAL_ON_FAIL ) // go to the eval screen if we fail
SCREENMAN -> SetNewScreen ( "ScreenEvaluationStage" );
else // if not just game over now
SCREENMAN -> SetNewScreen ( "ScreenGameOver" );
}
2003-03-25 21:17:29 +00:00
break ;
case PLAY_MODE_NONSTOP :
2003-03-28 05:47:42 +00:00
SCREENMAN -> SetNewScreen ( "ScreenEvaluationNonstop" );
break ;
2003-03-25 21:17:29 +00:00
case PLAY_MODE_ONI :
2003-03-28 05:47:42 +00:00
SCREENMAN -> SetNewScreen ( "ScreenEvaluationOni" );
break ;
2003-03-25 21:17:29 +00:00
case PLAY_MODE_ENDLESS :
2003-03-28 05:47:42 +00:00
SCREENMAN -> SetNewScreen ( "ScreenEvaluationEndless" );
2003-03-25 21:17:29 +00:00
break ;
default :
ASSERT ( 0 );
}
2002-05-20 08:59:37 +00:00
}
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 ()
{
2003-04-13 21:17:14 +00:00
ON_COMMAND ( m_sprLifeFrame );
ON_COMMAND ( m_sprStage );
2003-12-18 23:19:02 +00:00
ON_COMMAND ( m_sprCourseSongNumber );
2004-02-14 00:39:24 +00:00
ON_COMMAND ( m_sprStageFrame );
2003-04-13 21:17:14 +00:00
ON_COMMAND ( m_textSongOptions );
ON_COMMAND ( m_sprScoreFrame );
2003-11-26 00:17:54 +00:00
ON_COMMAND ( m_textSongTitle );
2003-12-25 05:53:30 +00:00
ON_COMMAND ( m_meterSongPosition );
2003-06-30 18:08:27 +00:00
if ( m_pCombinedLifeMeter )
ON_COMMAND ( * m_pCombinedLifeMeter );
2004-05-16 12:34:02 +00:00
FOREACH_PlayerNumber ( p )
2002-08-28 22:42:40 +00:00
{
2003-06-30 18:08:27 +00:00
if ( m_pLifeMeter [ p ] )
ON_COMMAND ( * m_pLifeMeter [ p ] );
2002-08-28 22:42:40 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( p ) )
continue ;
2003-04-13 21:17:14 +00:00
ON_COMMAND ( m_textCourseSongNumber [ p ] );
2003-12-17 10:21:31 +00:00
if ( GAMESTATE -> m_PlayMode == PLAY_MODE_RAVE )
ON_COMMAND ( m_textPlayerName [ p ] );
2004-01-23 06:20:28 +00:00
ON_COMMAND ( m_textStepsDescription [ p ] );
2003-11-26 06:40:03 +00:00
if ( m_pPrimaryScoreDisplay [ p ] )
ON_COMMAND ( * m_pPrimaryScoreDisplay [ p ] );
if ( m_pSecondaryScoreDisplay [ p ] )
ON_COMMAND ( * m_pSecondaryScoreDisplay [ p ] );
2003-04-13 21:17:14 +00:00
ON_COMMAND ( m_textPlayerOptions [ p ] );
2004-03-17 06:01:17 +00:00
ON_COMMAND ( m_ActiveAttackList [ p ] );
2003-04-13 21:17:14 +00:00
ON_COMMAND ( m_DifficultyIcon [ p ] );
2002-08-28 22:42:40 +00:00
}
2004-01-25 01:59:57 +00:00
m_Overlay . PlayCommand ( "On" );
2002-05-20 08:59:37 +00:00
}
2002-06-14 22:25:22 +00:00
void ScreenGameplay :: TweenOffScreen ()
{
2003-04-13 21:17:14 +00:00
OFF_COMMAND ( m_sprLifeFrame );
OFF_COMMAND ( m_sprStage );
2003-12-18 23:19:02 +00:00
OFF_COMMAND ( m_sprCourseSongNumber );
2004-02-14 00:39:24 +00:00
OFF_COMMAND ( m_sprStageFrame );
2003-04-13 21:17:14 +00:00
OFF_COMMAND ( m_textSongOptions );
OFF_COMMAND ( m_sprScoreFrame );
2003-11-26 00:17:54 +00:00
OFF_COMMAND ( m_textSongTitle );
2003-12-25 05:53:30 +00:00
OFF_COMMAND ( m_meterSongPosition );
2003-06-30 18:08:27 +00:00
if ( m_pCombinedLifeMeter )
OFF_COMMAND ( * m_pCombinedLifeMeter );
2004-05-16 12:34:02 +00:00
FOREACH_PlayerNumber ( p )
2003-04-13 21:17:14 +00:00
{
2003-06-30 18:08:27 +00:00
if ( m_pLifeMeter [ p ] )
OFF_COMMAND ( * m_pLifeMeter [ p ] );
2003-04-13 21:17:14 +00:00
if ( ! GAMESTATE -> IsPlayerEnabled ( p ) )
continue ;
OFF_COMMAND ( m_textCourseSongNumber [ p ] );
2003-12-17 10:21:31 +00:00
if ( GAMESTATE -> m_PlayMode == PLAY_MODE_RAVE )
OFF_COMMAND ( m_textPlayerName [ p ] );
2004-01-23 06:20:28 +00:00
OFF_COMMAND ( m_textStepsDescription [ p ] );
2003-11-26 06:40:03 +00:00
if ( m_pPrimaryScoreDisplay [ p ] )
OFF_COMMAND ( * m_pPrimaryScoreDisplay [ p ] );
if ( m_pSecondaryScoreDisplay [ p ] )
OFF_COMMAND ( * m_pSecondaryScoreDisplay [ p ] );
2003-04-13 21:17:14 +00:00
OFF_COMMAND ( m_textPlayerOptions [ p ] );
2004-03-17 06:01:17 +00:00
OFF_COMMAND ( m_ActiveAttackList [ p ] );
2003-04-13 21:17:14 +00:00
OFF_COMMAND ( m_DifficultyIcon [ p ] );
}
2004-01-25 01:59:57 +00:00
m_Overlay . PlayCommand ( "Off" );
2003-04-18 04:00:24 +00:00
2003-06-13 02:54:58 +00:00
m_textDebug . StopTweening ();
m_textDebug . BeginTweening ( 1 / 8.f );
m_textDebug . SetDiffuse ( RageColor ( 1 , 1 , 1 , 0 ) );
2002-06-14 22:25:22 +00:00
}
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 );
2003-04-12 06:16:12 +00:00
m_sprOniGameOver [ pn ]. SetY ( CENTER_Y );
2003-03-02 01:43:33 +00:00
m_sprOniGameOver [ pn ]. SetEffectBob ( 4 , RageVector3 ( 0 , 6 , 0 ) );
2002-08-01 21:55:40 +00:00
}