Files
itgmania212121/stepmania/src/ScreenGameplay.cpp
T

1443 lines
44 KiB
C++
Raw Normal View History

2002-05-20 08:59:37 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
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 "ScreenSelectMusic.h"
2002-07-27 19:29:51 +00:00
#include "ScreenSelectCourse.h"
2002-06-24 22:04:31 +00:00
#include "ScreenEvaluation.h"
2002-05-20 08:59:37 +00:00
#include "GameConstantsAndTypes.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2002-05-20 08:59:37 +00:00
#include "GameManager.h"
#include "SongManager.h"
#include "RageLog.h"
#include "AnnouncerManager.h"
2002-05-27 08:23:27 +00:00
#include "ScreenGameOver.h"
2002-07-23 01:41:40 +00:00
#include "LifeMeterBar.h"
#include "LifeMeterBattery.h"
#include "GameState.h"
#include "ScoreDisplayNormal.h"
#include "ScoreDisplayOni.h"
2002-07-27 19:29:51 +00:00
#include "ScreenPrompt.h"
2002-08-02 09:31:06 +00:00
#include "ScreenTitleMenu.h"
2002-05-20 08:59:37 +00:00
//
2002-07-23 01:41:40 +00:00
// Defines
2002-05-20 08:59:37 +00:00
//
#define TOP_FRAME_X THEME->GetMetricF("Gameplay","TopFrameX")
#define TOP_FRAME_Y THEME->GetMetricF("Gameplay","TopFrameY")
#define TOP_FRAME_EXTRA_Y THEME->GetMetricF("Gameplay","TopFrameExtraY")
#define BOTTOM_FRAME_X THEME->GetMetricF("Gameplay","BottomFrameX")
#define BOTTOM_FRAME_Y THEME->GetMetricF("Gameplay","BottomFrameY")
#define BOTTOM_FRAME_EXTRA_Y THEME->GetMetricF("Gameplay","BottomFrameExtraY")
#define MIDDLE_FRAME_X THEME->GetMetricF("Gameplay","MiddleFrameX")
#define MIDDLE_FRAME_Y THEME->GetMetricF("Gameplay","MiddleFrameY")
#define LIFE_P1_X THEME->GetMetricF("Gameplay","LifeP1X")
#define LIFE_P1_Y THEME->GetMetricF("Gameplay","LifeP1Y")
#define LIFE_P1_EXTRA_Y THEME->GetMetricF("Gameplay","LifeP1ExtraY")
#define LIFE_P2_X THEME->GetMetricF("Gameplay","LifeP2X")
#define LIFE_P2_Y THEME->GetMetricF("Gameplay","LifeP2Y")
#define LIFE_P2_EXTRA_Y THEME->GetMetricF("Gameplay","LifeP2ExtraY")
#define STAGE_X THEME->GetMetricF("Gameplay","StageX")
#define STAGE_Y THEME->GetMetricF("Gameplay","StageY")
#define STAGE_EXTRA_Y THEME->GetMetricF("Gameplay","StageExtraY")
#define SONG_NUMBER_P1_X THEME->GetMetricF("Gameplay","SongNumberP1X")
#define SONG_NUMBER_P1_Y THEME->GetMetricF("Gameplay","SongNumberP1Y")
#define SONG_NUMBER_P1_EXTRA_Y THEME->GetMetricF("Gameplay","SongNumberP1ExtraY")
#define SONG_NUMBER_P2_X THEME->GetMetricF("Gameplay","SongNumberP2X")
#define SONG_NUMBER_P2_Y THEME->GetMetricF("Gameplay","SongNumberP2Y")
#define SONG_NUMBER_P2_EXTRA_Y THEME->GetMetricF("Gameplay","SongNumberP2ExtraY")
#define SCORE_P1_X THEME->GetMetricF("Gameplay","ScoreP1X")
#define SCORE_P1_Y THEME->GetMetricF("Gameplay","ScoreP1Y")
#define SCORE_P1_EXTRA_Y THEME->GetMetricF("Gameplay","ScoreP1ExtraY")
#define SCORE_P2_X THEME->GetMetricF("Gameplay","ScoreP2X")
#define SCORE_P2_Y THEME->GetMetricF("Gameplay","ScoreP2Y")
#define SCORE_P2_EXTRA_Y THEME->GetMetricF("Gameplay","ScoreP2ExtraY")
#define PLAYER_OPTIONS_P1_X THEME->GetMetricF("Gameplay","PlayerOptionsP1X")
#define PLAYER_OPTIONS_P1_Y THEME->GetMetricF("Gameplay","PlayerOptionsP1Y")
#define PLAYER_OPTIONS_P1_EXTRA_Y THEME->GetMetricF("Gameplay","PlayerOptionsP1ExtraY")
#define PLAYER_OPTIONS_P2_X THEME->GetMetricF("Gameplay","PlayerOptionsP2X")
#define PLAYER_OPTIONS_P2_Y THEME->GetMetricF("Gameplay","PlayerOptionsP2Y")
#define PLAYER_OPTIONS_P2_EXTRA_Y THEME->GetMetricF("Gameplay","PlayerOptionsP2ExtraY")
#define SONG_OPTIONS_X THEME->GetMetricF("Gameplay","SongOptionsX")
#define SONG_OPTIONS_Y THEME->GetMetricF("Gameplay","SongOptionsY")
#define SONG_OPTIONS_EXTRA_Y THEME->GetMetricF("Gameplay","SongOptionsExtraY")
#define DIFFICULTY_P1_X THEME->GetMetricF("Gameplay","DifficultyP1X")
#define DIFFICULTY_P1_Y THEME->GetMetricF("Gameplay","DifficultyP1Y")
#define DIFFICULTY_P1_REVERSE_Y THEME->GetMetricF("Gameplay","DifficultyP1ReverseY")
#define DIFFICULTY_P1_EXTRA_Y THEME->GetMetricF("Gameplay","DifficultyP1ExtraY")
#define DIFFICULTY_P1_EXTRA_REVERSE_Y THEME->GetMetricF("Gameplay","DifficultyP1ExtraReverseY")
#define DIFFICULTY_P2_X THEME->GetMetricF("Gameplay","DifficultyP2X")
#define DIFFICULTY_P2_Y THEME->GetMetricF("Gameplay","DifficultyP2Y")
#define DIFFICULTY_P2_REVERSE_Y THEME->GetMetricF("Gameplay","DifficultyP2ReverseY")
#define DIFFICULTY_P2_EXTRA_Y THEME->GetMetricF("Gameplay","DifficultyP2ExtraY")
#define DIFFICULTY_P2_EXTRA_REVERSE_Y THEME->GetMetricF("Gameplay","DifficultyP2ExtraReverseY")
#define DEBUG_X THEME->GetMetricF("Gameplay","DebugX")
#define DEBUG_Y THEME->GetMetricF("Gameplay","DebugY")
#define AUTOPLAY_X THEME->GetMetricF("Gameplay","AutoPlayX")
#define AUTOPLAY_Y THEME->GetMetricF("Gameplay","AutoPlayY")
#define SURVIVE_TIME_X THEME->GetMetricF("Gameplay","SurviveTimeX")
#define SURVIVE_TIME_Y THEME->GetMetricF("Gameplay","SurviveTimeY")
#define SECONDS_BETWEEN_COMMENTS THEME->GetMetricF("Gameplay","SecondsBetweenComments")
#define DEMONSTRATION_SECONDS THEME->GetMetricF("Gameplay","DemonstrationSeconds")
float LIFE_X( int p ) {
switch( p ) {
case PLAYER_1: return LIFE_P1_X;
case PLAYER_2: return LIFE_P2_X;
default: ASSERT(0); return 0;
}
}
float LIFE_Y( int p, bool bExtra ) {
switch( p ) {
case PLAYER_1: return bExtra ? LIFE_P1_EXTRA_Y : LIFE_P1_Y;
case PLAYER_2: return bExtra ? LIFE_P2_EXTRA_Y : LIFE_P2_Y;
default: ASSERT(0); return 0;
}
}
float SONG_NUMBER_X( int p ) {
switch( p ) {
case PLAYER_1: return SONG_NUMBER_P1_X;
case PLAYER_2: return SONG_NUMBER_P2_X;
default: ASSERT(0); return 0;
}
}
float SONG_NUMBER_Y( int p, bool bExtra ) {
switch( p ) {
case PLAYER_1: return bExtra ? SONG_NUMBER_P1_EXTRA_Y : SONG_NUMBER_P1_Y;
case PLAYER_2: return bExtra ? SONG_NUMBER_P2_EXTRA_Y : SONG_NUMBER_P2_Y;
default: ASSERT(0); return 0;
}
}
float SCORE_X( int p ) {
switch( p ) {
case PLAYER_1: return SCORE_P1_X;
case PLAYER_2: return SCORE_P2_X;
default: ASSERT(0); return 0;
}
}
float SCORE_Y( int p, bool bExtra ) {
switch( p ) {
case PLAYER_1: return bExtra ? SCORE_P1_EXTRA_Y : SCORE_P1_Y;
case PLAYER_2: return bExtra ? SCORE_P2_EXTRA_Y : SCORE_P2_Y;
default: ASSERT(0); return 0;
}
}
float DIFFICULTY_X( int p ) {
switch( p ) {
case PLAYER_1: return DIFFICULTY_P1_X;
case PLAYER_2: return DIFFICULTY_P2_X;
default: ASSERT(0); return 0;
}
}
float DIFFICULTY_Y( int p, bool bReverse, bool bExtra ) {
switch( p ) {
case PLAYER_1:
if( bExtra && bReverse ) return DIFFICULTY_P1_EXTRA_REVERSE_Y;
if( !bExtra && bReverse ) return DIFFICULTY_P1_REVERSE_Y;
if( bExtra && !bReverse ) return DIFFICULTY_P1_EXTRA_Y;
if( !bExtra && !bReverse ) return DIFFICULTY_P1_Y;
else ASSERT(0);
case PLAYER_2:
if( bExtra && bReverse ) return DIFFICULTY_P2_EXTRA_REVERSE_Y;
if( !bExtra && bReverse ) return DIFFICULTY_P2_REVERSE_Y;
if( bExtra && !bReverse ) return DIFFICULTY_P2_EXTRA_Y;
if( !bExtra && !bReverse ) return DIFFICULTY_P2_Y;
else ASSERT(0);
}
ASSERT(0); return 0;
}
float PLAYER_OPTIONS_X( int p ) {
switch( p ) {
case PLAYER_1: return PLAYER_OPTIONS_P1_X;
case PLAYER_2: return PLAYER_OPTIONS_P2_X;
default: ASSERT(0); return 0;
}
}
float PLAYER_OPTIONS_Y( int p, bool bExtra ) {
switch( p ) {
case PLAYER_1: return bExtra ? PLAYER_OPTIONS_P1_EXTRA_Y : PLAYER_OPTIONS_P1_Y;
case PLAYER_2: return bExtra ? PLAYER_OPTIONS_P2_EXTRA_Y : PLAYER_OPTIONS_P2_Y;
default: ASSERT(0); return 0;
}
}
2002-08-02 09:31:06 +00:00
2002-05-20 08:59:37 +00:00
// received while STATE_DANCING
2002-08-01 03:15:27 +00:00
const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+101);
const ScreenMessage SM_BeginLoadingNextSong = ScreenMessage(SM_User+102);
2002-08-02 09:31:06 +00:00
const ScreenMessage SM_BeginFadingToTitleMenu = ScreenMessage(SM_User+103);
2002-05-20 08:59:37 +00:00
// received while STATE_OUTRO
const ScreenMessage SM_ShowCleared = ScreenMessage(SM_User+111);
const ScreenMessage SM_HideCleared = ScreenMessage(SM_User+112);
2002-08-01 05:11:11 +00:00
const ScreenMessage SM_SaveChangedBeforeGoingBack = ScreenMessage(SM_User+113);
const ScreenMessage SM_GoToScreenAfterBack = ScreenMessage(SM_User+114);
const ScreenMessage SM_GoToStateAfterCleared= ScreenMessage(SM_User+115);
2002-05-20 08:59:37 +00:00
const ScreenMessage SM_BeginFailed = ScreenMessage(SM_User+121);
const ScreenMessage SM_ShowFailed = ScreenMessage(SM_User+122);
const ScreenMessage SM_PlayFailComment = ScreenMessage(SM_User+123);
const ScreenMessage SM_HideFailed = ScreenMessage(SM_User+124);
2002-07-27 19:29:51 +00:00
const ScreenMessage SM_GoToScreenAfterFail = ScreenMessage(SM_User+125);
2002-08-02 09:31:06 +00:00
const ScreenMessage SM_GoToTitleMenu = ScreenMessage(SM_User+126);
2002-05-20 08:59:37 +00:00
ScreenGameplay::ScreenGameplay()
{
LOG->Trace( "ScreenGameplay::ScreenGameplay()" );
2002-05-20 08:59:37 +00:00
2002-07-27 19:29:51 +00:00
2002-07-28 20:28:37 +00:00
GAMESTATE->ResetStageStatistics(); // clear values
2002-08-02 09:31:06 +00:00
const bool bExtra = GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2();
const bool bReverse[NUM_PLAYERS] = {
GAMESTATE->m_PlayerOptions[0].m_bReverseScroll,
GAMESTATE->m_PlayerOptions[1].m_bReverseScroll
};
2002-07-28 20:28:37 +00:00
// Update possible dance points
for( int p=0; p<NUM_PLAYERS; p++ )
2002-06-14 22:25:22 +00:00
{
2002-07-28 20:28:37 +00:00
if( !GAMESTATE->IsPlayerEnabled(p) )
continue; // skip
2002-07-04 21:05:18 +00:00
2002-07-28 20:28:37 +00:00
NoteData notedata;
switch( GAMESTATE->m_PlayMode )
{
case PLAY_MODE_ARCADE:
GAMESTATE->m_pCurNotes[p]->GetNoteData( &notedata );
GAMESTATE->m_iPossibleDancePoints[p] = notedata.GetPossibleDancePoints();
break;
case PLAY_MODE_ONI:
2002-07-29 03:06:55 +00:00
case PLAY_MODE_ENDLESS:
2002-07-28 20:28:37 +00:00
{
GAMESTATE->m_iPossibleDancePoints[p] = 0;
2002-07-23 01:41:40 +00:00
2002-07-28 20:28:37 +00:00
Course* pCourse = GAMESTATE->m_pCurCourse;
CArray<Song*,Song*> apSongs;
2002-08-01 13:42:56 +00:00
CArray<Notes*,Notes*> apNotes;
CStringArray asModifiers;
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes, asModifiers );
2002-07-23 01:41:40 +00:00
2002-08-01 13:42:56 +00:00
for( int i=0; i<apNotes.GetSize(); i++ )
2002-07-28 20:28:37 +00:00
{
2002-08-01 13:42:56 +00:00
apNotes[i]->GetNoteData( &notedata );
2002-07-28 20:28:37 +00:00
int iPossibleDancePoints = notedata.GetPossibleDancePoints();
GAMESTATE->m_iPossibleDancePoints[p] += iPossibleDancePoints;
}
2002-06-14 22:25:22 +00:00
}
2002-07-28 20:28:37 +00:00
break;
2002-06-14 22:25:22 +00:00
}
2002-07-28 20:28:37 +00:00
2002-06-14 22:25:22 +00:00
}
2002-07-28 20:28:37 +00:00
m_bChangedOffsetOrBPM = false;
2002-05-20 08:59:37 +00:00
m_DancingState = STATE_INTRO;
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-05-20 08:59:37 +00:00
2002-05-27 08:23:27 +00:00
m_Background.SetDiffuseColor( D3DXCOLOR(0.4f,0.4f,0.4f,1) );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_Background );
2002-05-27 08:23:27 +00:00
2002-05-20 08:59:37 +00:00
2002-07-28 20:28:37 +00:00
for( p=0; p<NUM_PLAYERS; p++ )
2002-05-20 08:59:37 +00:00
{
2002-07-23 01:41:40 +00:00
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
2002-05-20 08:59:37 +00:00
continue;
2002-08-01 21:55:40 +00:00
float fPlayerX = (float) GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p];
m_Player[p].SetX( fPlayerX );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_Player[p] );
2002-08-01 21:55:40 +00:00
m_sprOniGameOver[p].Load( THEME->GetPathTo("Graphics","gameplay oni gameover") );
2002-08-01 21:55:40 +00:00
m_sprOniGameOver[p].SetX( fPlayerX );
m_sprOniGameOver[p].SetY( SCREEN_TOP - m_sprOniGameOver[p].GetZoomedHeight()/2 );
m_sprOniGameOver[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // 0 alpha so we don't waste time drawing while not visible
this->AddSubActor( &m_sprOniGameOver[p] );
2002-05-20 08:59:37 +00:00
}
2002-08-01 21:55:40 +00:00
m_OniFade.SetOpened();
this->AddSubActor( &m_OniFade );
m_sprMiddleFrame.Load( THEME->GetPathTo("Graphics","Gameplay Middle Frame") );
m_sprMiddleFrame.SetXY( MIDDLE_FRAME_X, MIDDLE_FRAME_Y );
2002-06-14 22:25:22 +00:00
2002-05-20 08:59:37 +00:00
for( p=0; p<NUM_PLAYERS; p++ )
{
2002-07-28 20:28:37 +00:00
switch( GAMESTATE->m_SongOptions.m_LifeType )
2002-07-23 01:41:40 +00:00
{
2002-07-28 20:28:37 +00:00
case SongOptions::LIFE_BAR:
2002-07-23 01:41:40 +00:00
m_pLifeMeter[p] = new LifeMeterBar;
break;
2002-07-28 20:28:37 +00:00
case SongOptions::LIFE_BATTERY:
2002-07-23 01:41:40 +00:00
m_pLifeMeter[p] = new LifeMeterBattery;
break;
default:
ASSERT(0);
}
2002-05-20 08:59:37 +00:00
2002-07-28 20:28:37 +00:00
m_pLifeMeter[p]->Load( (PlayerNumber)p );
m_pLifeMeter[p]->SetXY( LIFE_X(p), LIFE_Y(p,bExtra) );
this->AddSubActor( m_pLifeMeter[p] );
/*
Chris: EZ2 should change positions via Theme metrics
2002-07-27 19:29:51 +00:00
if( GAMESTATE->m_CurGame == GAME_EZ2 )
{
m_pScoreDisplay[p] = new ScoreDisplayNormal;
2002-07-23 01:41:40 +00:00
m_pScoreDisplay[p]->SetXY( SCORE_LOCALEZ2_X[p], SCORE_LOCALEZ2_Y[p] );
m_pScoreDisplay[p]->SetZoom( 0.5f );
m_pScoreDisplay[p]->SetDiffuseColor( PlayerToColor(p) );
m_frameTop.AddSubActor( m_pScoreDisplay[p] );
}
*/
2002-05-20 08:59:37 +00:00
}
2002-06-14 22:25:22 +00:00
// TopFrame goes above LifeMeter
m_sprTopFrame.Load( THEME->GetPathTo("Graphics",bExtra?"gameplay extra top frame":"gameplay top frame") );
m_sprTopFrame.SetXY( TOP_FRAME_X, bExtra ? TOP_FRAME_EXTRA_Y : TOP_FRAME_Y );
this->AddSubActor( &m_sprTopFrame );
2002-05-20 08:59:37 +00:00
m_textStageNumber.LoadFromFont( THEME->GetPathTo("Fonts","Header2") );
2002-05-28 20:01:22 +00:00
m_textStageNumber.TurnShadowOff();
m_textStageNumber.SetXY( STAGE_X, bExtra ? STAGE_EXTRA_Y : STAGE_Y );
2002-07-23 01:41:40 +00:00
m_textStageNumber.SetText( GAMESTATE->GetStageText() );
m_textStageNumber.SetDiffuseColor( GAMESTATE->GetStageColor() );
for( p=0; p<NUM_PLAYERS; p++ )
2002-08-01 03:15:27 +00:00
{
m_textCourseSongNumber[p].LoadFromFont( THEME->GetPathTo("Fonts","Header2") );
2002-08-01 03:15:27 +00:00
m_textCourseSongNumber[p].TurnShadowOff();
m_textCourseSongNumber[p].SetXY( SONG_NUMBER_X(p), SONG_NUMBER_Y(p,bExtra) );
2002-08-01 03:15:27 +00:00
m_textCourseSongNumber[p].SetText( "" );
m_textCourseSongNumber[p].SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,1,1) ); // light blue
}
switch( GAMESTATE->m_PlayMode )
{
case PLAY_MODE_ARCADE:
this->AddSubActor( &m_textStageNumber );
2002-08-01 03:15:27 +00:00
break;
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
for( p=0; p<NUM_PLAYERS; p++ )
2002-08-01 13:42:56 +00:00
if( GAMESTATE->IsPlayerEnabled(p) )
this->AddSubActor( &m_textCourseSongNumber[p] );
2002-08-01 03:15:27 +00:00
break;
default:
ASSERT(0); // invalid GameMode
}
2002-06-14 22:25:22 +00:00
//////////////////////////////////
// Add all Actors to m_frameBottom
//////////////////////////////////
m_sprBottomFrame.Load( THEME->GetPathTo("Graphics",bExtra?"gameplay extra bottom frame":"gameplay bottom frame") );
m_sprBottomFrame.SetXY( BOTTOM_FRAME_X, bExtra ? BOTTOM_FRAME_EXTRA_Y : BOTTOM_FRAME_Y );
this->AddSubActor( &m_sprBottomFrame );
2002-07-23 01:41:40 +00:00
2002-06-14 22:25:22 +00:00
/*
Chris: Change this position using theme metrics
2002-07-23 01:41:40 +00:00
2002-07-27 19:29:51 +00:00
if( GAMESTATE->m_CurGame != GAME_EZ2 )
{
m_sprBottomFrame.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_BOTTOM_FRAME) );
2002-07-23 01:41:40 +00:00
m_frameBottom.AddSubActor( &m_sprBottomFrame );
m_frameBottom.SetXY( CENTER_X, SCREEN_BOTTOM - m_sprBottomFrame.GetZoomedHeight()/2 );
}
*/
2002-05-20 08:59:37 +00:00
2002-07-23 01:41:40 +00:00
2002-05-20 08:59:37 +00:00
for( p=0; p<NUM_PLAYERS; p++ )
{
/* Chris: I don't understand why EZ2 wouldn't want this.
if( GAMESTATE->m_CurGame != GAME_EZ2 )
2002-07-23 01:41:40 +00:00
{
*/
switch( GAMESTATE->m_PlayMode )
{
case PLAY_MODE_ARCADE:
m_pScoreDisplay[p] = new ScoreDisplayNormal;
break;
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
m_pScoreDisplay[p] = new ScoreDisplayOni;
break;
default:
ASSERT(0);
}
2002-07-23 01:41:40 +00:00
m_pScoreDisplay[p]->Init( (PlayerNumber)p );
m_pScoreDisplay[p]->SetXY( SCORE_X(p), SCORE_Y(p,bExtra) );
m_pScoreDisplay[p]->SetZoom( 0.8f );
m_pScoreDisplay[p]->SetDiffuseColor( PlayerToColor(p) );
this->AddSubActor( m_pScoreDisplay[p] );
/*
}
*/
2002-07-23 01:41:40 +00:00
m_textPlayerOptions[p].LoadFromFont( THEME->GetPathTo("Fonts","normal") );
2002-07-23 01:41:40 +00:00
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
2002-05-20 08:59:37 +00:00
continue;
/* Chris: EZ2 should control this with theme metrics
2002-07-27 19:29:51 +00:00
if( GAMESTATE->m_CurGame != GAME_EZ2 )
{
*/
m_pScoreDisplay[p]->SetXY( SCORE_X(p), SCORE_Y(p,bExtra) );
2002-07-23 01:41:40 +00:00
m_pScoreDisplay[p]->SetZoom( 0.8f );
m_pScoreDisplay[p]->SetDiffuseColor( PlayerToColor(p) );
this->AddSubActor( m_pScoreDisplay[p] );
// }
m_textPlayerOptions[p].LoadFromFont( THEME->GetPathTo("Fonts","normal") );
2002-05-28 20:01:22 +00:00
m_textPlayerOptions[p].TurnShadowOff();
m_textPlayerOptions[p].SetXY( PLAYER_OPTIONS_X(p), PLAYER_OPTIONS_Y(p,bExtra) );
2002-05-28 20:01:22 +00:00
m_textPlayerOptions[p].SetZoom( 0.5f );
m_textPlayerOptions[p].SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
2002-07-23 01:41:40 +00:00
m_textPlayerOptions[p].SetText( GAMESTATE->m_PlayerOptions[p].GetString() );
this->AddSubActor( &m_textPlayerOptions[p] );
//}
2002-05-20 08:59:37 +00:00
}
m_textSongOptions.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
m_textSongOptions.TurnShadowOff();
m_textSongOptions.SetXY( SONG_OPTIONS_X, bExtra?SONG_OPTIONS_EXTRA_Y:SONG_OPTIONS_Y );
m_textSongOptions.SetZoom( 0.5f );
m_textSongOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_textSongOptions.SetText( GAMESTATE->m_SongOptions.GetString() );
this->AddSubActor( &m_textSongOptions );
2002-06-14 22:25:22 +00:00
// Get the current StyleDef definition (used below)
2002-08-22 23:03:39 +00:00
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
2002-06-14 22:25:22 +00:00
for( p=0; p<NUM_PLAYERS; p++ )
{
2002-07-23 01:41:40 +00:00
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
2002-06-14 22:25:22 +00:00
continue;
2002-07-23 01:41:40 +00:00
// CONFLICT RESOLUTION:
// BY ANDY
// <<<<<<< ScreenGameplay.cpp
// =======
// YOURS:
/*
2002-07-23 01:41:40 +00:00
float fDifficultyY = DIFFICULTY_Y[p];
if( GAMESTATE->m_PlayerOptions[p].m_bReverseScroll )
2002-08-01 13:42:56 +00:00
fDifficultyY = SCREEN_HEIGHT - DIFFICULTY_Y[p] -10; // HACK: move difficulty banner up 10 if reverse
2002-07-23 01:41:40 +00:00
m_DifficultyBanner[p].SetXY( DIFFICULTY_X[p], fDifficultyY );
this->AddSubActor( &m_DifficultyBanner[p] );
*/
//>>>>>>> 1.32 MINE
/*
2002-07-27 19:29:51 +00:00
if( GAMESTATE->m_CurGame != GAME_EZ2 )
{
float fDifficultyY = DIFFICULTY_Y[p];
2002-07-23 01:41:40 +00:00
if( GAMESTATE->m_PlayerOptions[p].m_bReverseScroll )
fDifficultyY = SCREEN_HEIGHT - DIFFICULTY_Y[p];
m_DifficultyBanner[p].SetXY( DIFFICULTY_X[p], fDifficultyY );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_DifficultyBanner[p] );
}
*/
// HOW I THINK IT SHOULD BE FIXED:
m_DifficultyBanner[p].SetXY( DIFFICULTY_X(p), DIFFICULTY_Y(p,bReverse[p],bExtra) );
this->AddSubActor( &m_DifficultyBanner[p] );
2002-06-14 22:25:22 +00:00
}
m_textDebug.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
2002-06-24 22:04:31 +00:00
m_textDebug.SetXY( DEBUG_X, DEBUG_Y );
m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_textDebug );
m_textAutoPlay.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
m_textAutoPlay.SetXY( AUTOPLAY_X, AUTOPLAY_Y );
m_textAutoPlay.SetText( "AutoPlay is ON" );
m_textAutoPlay.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
this->AddSubActor( &m_textAutoPlay );
2002-05-20 08:59:37 +00:00
2002-06-24 22:04:31 +00:00
2002-05-20 08:59:37 +00:00
m_StarWipe.SetClosed();
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_StarWipe );
2002-05-20 08:59:37 +00:00
m_sprReady.Load( THEME->GetPathTo("Graphics","gameplay ready") );
2002-05-20 08:59:37 +00:00
m_sprReady.SetXY( CENTER_X, CENTER_Y );
m_sprReady.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_sprReady );
2002-05-20 08:59:37 +00:00
m_sprHereWeGo.Load( THEME->GetPathTo("Graphics","gameplay here we go") );
2002-05-20 08:59:37 +00:00
m_sprHereWeGo.SetXY( CENTER_X, CENTER_Y );
m_sprHereWeGo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_sprHereWeGo );
2002-05-20 08:59:37 +00:00
m_sprCleared.Load( THEME->GetPathTo("Graphics","gameplay cleared") );
2002-05-20 08:59:37 +00:00
m_sprCleared.SetXY( CENTER_X, CENTER_Y );
m_sprCleared.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_sprCleared );
2002-05-20 08:59:37 +00:00
m_sprFailed.Load( THEME->GetPathTo("Graphics","gameplay failed") );
2002-05-20 08:59:37 +00:00
m_sprFailed.SetXY( CENTER_X, CENTER_Y );
m_sprFailed.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
2002-07-23 01:41:40 +00:00
this->AddSubActor( &m_sprFailed );
2002-05-20 08:59:37 +00:00
2002-08-02 09:31:06 +00:00
if( GAMESTATE->m_bDemonstration )
{
m_quadDemonstrationBox.SetDiffuseColor( D3DXCOLOR(0,0,0,0.7f) );
m_quadDemonstrationBox.StretchTo( CRect(SCREEN_LEFT, int(CENTER_Y-60), SCREEN_RIGHT, int(CENTER_Y+60)) );
this->AddSubActor( &m_quadDemonstrationBox );
m_sprDemonstration.Load( THEME->GetPathTo("Graphics","gameplay demonstration") );
2002-08-02 09:31:06 +00:00
m_sprDemonstration.SetXY( CENTER_X, CENTER_Y );
m_sprDemonstration.SetEffectBlinking();
this->AddSubActor( &m_sprDemonstration );
m_Fade.OpenWipingRight();
}
2002-07-27 19:29:51 +00:00
m_Fade.SetOpened();
this->AddSubActor( &m_Fade );
2002-05-20 08:59:37 +00:00
m_textSurviveTime.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
2002-08-01 13:42:56 +00:00
m_textSurviveTime.TurnShadowOff();
m_textSurviveTime.SetXY( SURVIVE_TIME_X, SURVIVE_TIME_Y );
m_textSurviveTime.SetText( "" );
m_textSurviveTime.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
this->AddSubActor( &m_textSurviveTime );
2002-05-20 08:59:37 +00:00
2002-08-02 09:31:06 +00:00
if( !GAMESTATE->m_bDemonstration ) // don't load sounds if just playing demonstration
{
m_soundFail.Load( THEME->GetPathTo("Sounds","gameplay failed") );
m_soundOniDie.Load( THEME->GetPathTo("Sounds","gameplay oni die") );
2002-08-02 09:31:06 +00:00
m_announcerReady.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_READY) );
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_HERE_WE_GO_EXTRA) );
else if( GAMESTATE->IsFinalStage() )
m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_HERE_WE_GO_FINAL) );
else
m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_HERE_WE_GO_NORMAL) );
m_announcerDanger.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_COMMENT_DANGER) );
m_announcerGood.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_COMMENT_GOOD) );
m_announcerHot.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_COMMENT_HOT) );
m_announcer100Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_100_COMBO) );
m_announcer200Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_200_COMBO) );
m_announcer300Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_300_COMBO) );
m_announcer400Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_400_COMBO) );
m_announcer500Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_500_COMBO) );
m_announcer600Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_600_COMBO) );
m_announcer700Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_700_COMBO) );
m_announcer800Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_800_COMBO) );
m_announcer900Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_900_COMBO) );
m_announcer1000Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_1000_COMBO) );
m_announcerComboStopped.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_COMBO_STOPPED) );
}
2002-05-20 08:59:37 +00:00
2002-08-15 16:45:49 +00:00
m_iRowLastCrossed = -1;
m_soundAssistTick.Load( THEME->GetPathTo("Sounds","gameplay assist tick") );
2002-05-20 08:59:37 +00:00
2002-07-28 20:28:37 +00:00
LoadNextSong( true );
2002-06-14 22:25:22 +00:00
2002-08-02 09:31:06 +00:00
if( GAMESTATE->m_bDemonstration )
{
m_StarWipe.SetOpened();
m_DancingState = STATE_DANCING;
m_soundMusic.Play();
this->SendScreenMessage( SM_BeginFadingToTitleMenu, DEMONSTRATION_SECONDS );
2002-08-02 09:31:06 +00:00
}
else
{
for( int i=0; i<30; i++ )
this->SendScreenMessage( ScreenMessage(SM_User+i), i/2.0f ); // Send messages to we can get the introduction rolling
}
2002-05-20 08:59:37 +00:00
}
ScreenGameplay::~ScreenGameplay()
{
LOG->Trace( "ScreenGameplay::~ScreenGameplay()" );
2002-07-23 01:41:40 +00:00
for( int p=0; p<NUM_PLAYERS; p++ )
{
delete m_pLifeMeter[p];
delete m_pScoreDisplay[p];
}
2002-05-20 08:59:37 +00:00
m_soundMusic.Stop();
}
2002-07-28 20:28:37 +00:00
bool ScreenGameplay::IsLastSong()
2002-06-24 22:04:31 +00:00
{
2002-07-28 20:28:37 +00:00
switch( GAMESTATE->m_PlayMode )
2002-06-24 22:04:31 +00:00
{
2002-07-28 20:28:37 +00:00
case PLAY_MODE_ARCADE:
return true;
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
{
Course* pCourse = GAMESTATE->m_pCurCourse;
2002-07-29 03:06:55 +00:00
if( pCourse->m_bRepeat )
return false;
2002-07-28 20:28:37 +00:00
CArray<Song*,Song*> apSongs;
2002-08-01 13:42:56 +00:00
CArray<Notes*,Notes*> apNotes;
CStringArray asModifiers;
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes, asModifiers );
2002-06-14 22:25:22 +00:00
2002-08-01 03:15:27 +00:00
return GAMESTATE->m_iSongsIntoCourse >= apSongs.GetSize(); // there are no more songs left
2002-07-28 20:28:37 +00:00
}
break;
default:
ASSERT(0);
return true;
}
}
2002-06-24 22:04:31 +00:00
2002-07-28 20:28:37 +00:00
void ScreenGameplay::LoadNextSong( bool bFirstLoad )
{
GAMESTATE->ResetMusicStatistics();
2002-06-14 22:25:22 +00:00
2002-07-28 20:28:37 +00:00
switch( GAMESTATE->m_PlayMode )
2002-06-14 22:25:22 +00:00
{
2002-07-28 20:28:37 +00:00
case PLAY_MODE_ARCADE:
break;
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
{
2002-08-01 05:11:11 +00:00
for( int p=0; p<NUM_PLAYERS; p++ )
m_textCourseSongNumber[p].SetText( ssprintf("%d", GAMESTATE->m_iSongsBeforeFail[p]+1) );
2002-07-28 20:28:37 +00:00
Course* pCourse = GAMESTATE->m_pCurCourse;
CArray<Song*,Song*> apSongs;
2002-08-01 13:42:56 +00:00
CArray<Notes*,Notes*> apNotes;
CStringArray asModifiers;
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes, asModifiers );
2002-07-28 20:28:37 +00:00
2002-07-29 03:06:55 +00:00
int iPlaySongIndex = -1;
if( pCourse->m_bRandomize )
iPlaySongIndex = rand() % apSongs.GetSize();
else
2002-08-01 03:15:27 +00:00
iPlaySongIndex = GAMESTATE->m_iSongsIntoCourse;
2002-07-29 03:06:55 +00:00
GAMESTATE->m_pCurSong = apSongs[iPlaySongIndex];
for( p=0; p<NUM_PLAYERS; p++ )
2002-08-01 13:42:56 +00:00
{
GAMESTATE->m_pCurNotes[p] = apNotes[iPlaySongIndex];
if( asModifiers[iPlaySongIndex] != "" ) // some modifiers specified
GAMESTATE->m_PlayerOptions[p].FromString( asModifiers[iPlaySongIndex] ); // put them into effect
}
2002-07-28 20:28:37 +00:00
}
break;
default:
ASSERT(0);
break;
2002-06-14 22:25:22 +00:00
}
2002-07-28 20:28:37 +00:00
m_textStageNumber.SetText( GAMESTATE->GetStageText() );
2002-06-14 22:25:22 +00:00
2002-07-28 20:28:37 +00:00
for( int p=0; p<NUM_PLAYERS; p++ )
2002-06-14 22:25:22 +00:00
{
2002-07-28 20:28:37 +00:00
if( !GAMESTATE->IsPlayerEnabled(p) )
2002-06-14 22:25:22 +00:00
continue;
2002-08-01 21:55:40 +00:00
// reset oni game over graphic
m_sprOniGameOver[p].SetY( SCREEN_TOP - m_sprOniGameOver[p].GetZoomedHeight()/2 );
m_sprOniGameOver[p].SetDiffuseColor( D3DXCOLOR(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 && GAMESTATE->m_fSecondsBeforeFail[p] != -1 ) // already failed
ShowOniGameOver((PlayerNumber)p);
2002-07-23 01:41:40 +00:00
m_DifficultyBanner[p].SetFromNotes( PlayerNumber(p), GAMESTATE->m_pCurNotes[p] );
2002-06-14 22:25:22 +00:00
2002-07-03 03:13:13 +00:00
NoteData originalNoteData;
2002-07-23 01:41:40 +00:00
GAMESTATE->m_pCurNotes[p]->GetNoteData( &originalNoteData );
2002-06-14 22:25:22 +00:00
2002-08-22 23:03:39 +00:00
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
2002-06-14 22:25:22 +00:00
NoteData newNoteData;
2002-07-03 03:13:13 +00:00
pStyleDef->GetTransformedNoteDataForStyle( (PlayerNumber)p, &originalNoteData, &newNoteData );
2002-06-14 22:25:22 +00:00
2002-07-28 20:28:37 +00:00
m_Player[p].Load( (PlayerNumber)p, &newNoteData, m_pLifeMeter[p], m_pScoreDisplay[p] );
2002-06-14 22:25:22 +00:00
}
2002-08-22 09:31:32 +00:00
m_Background.LoadFromSong( GAMESTATE->m_pCurSong );
2002-06-14 22:25:22 +00:00
m_Background.SetDiffuseColor( D3DXCOLOR(0.5f,0.5f,0.5f,1) );
m_Background.BeginTweeningQueued( 2 );
m_Background.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) );
2002-07-23 01:41:40 +00:00
m_soundMusic.Load( GAMESTATE->m_pCurSong->GetMusicPath(), true ); // enable accurate sync
float fStartSeconds = min( 0, -4+GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(GAMESTATE->m_pCurSong->m_fFirstBeat) );
m_soundMusic.SetPositionSeconds( fStartSeconds );
m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate );
2002-07-28 20:28:37 +00:00
if( !bFirstLoad )
2002-07-23 01:41:40 +00:00
m_soundMusic.Play();
2002-06-14 22:25:22 +00:00
}
2002-07-27 19:29:51 +00:00
bool ScreenGameplay::OneIsHot()
{
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
2002-08-20 21:00:56 +00:00
if( m_pLifeMeter[p]->IsHot() )
2002-07-27 19:29:51 +00:00
return true;
return false;
}
bool ScreenGameplay::AllAreInDanger()
{
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
if( !m_pLifeMeter[p]->IsInDanger() )
return false;
return true;
}
bool ScreenGameplay::AllAreFailing()
{
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
if( !m_pLifeMeter[p]->IsFailing() )
return false;
return true;
}
bool ScreenGameplay::AllFailedEarlier()
{
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) )
if( !m_pLifeMeter[p]->FailedEarlier() )
return false;
return true;
}
2002-06-14 22:25:22 +00:00
2002-05-20 08:59:37 +00:00
void ScreenGameplay::Update( float fDeltaTime )
{
//LOG->Trace( "ScreenGameplay::Update(%f)", fDeltaTime );
2002-05-20 08:59:37 +00:00
2002-07-11 19:02:26 +00:00
m_soundMusic.Update( fDeltaTime );
2002-05-20 08:59:37 +00:00
2002-07-23 01:41:40 +00:00
if( GAMESTATE->m_pCurSong == NULL )
2002-06-24 22:04:31 +00:00
return;
2002-08-02 09:31:06 +00:00
// update the global music statistics for other classes to access
2002-05-20 08:59:37 +00:00
float fPositionSeconds = m_soundMusic.GetPositionSeconds();
2002-06-30 23:19:33 +00:00
float fSongBeat, fBPS;
bool bFreeze;
2002-07-23 01:41:40 +00:00
GAMESTATE->m_pCurSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS, bFreeze );
2002-05-20 08:59:37 +00:00
2002-07-23 01:41:40 +00:00
GAMESTATE->m_fMusicSeconds = fPositionSeconds;
2002-07-28 20:28:37 +00:00
GAMESTATE->m_fSongBeat = fSongBeat;
2002-07-23 01:41:40 +00:00
GAMESTATE->m_fCurBPS = fBPS;
GAMESTATE->m_bFreeze = bFreeze;
2002-08-02 09:31:06 +00:00
// LOG->Trace( "GAMESTATE->m_fMusicSeconds = %f", GAMESTATE->m_fMusicSeconds );
2002-05-20 08:59:37 +00:00
2002-07-23 01:41: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
switch( m_DancingState )
{
case STATE_DANCING:
2002-07-27 19:29:51 +00:00
//
2002-05-20 08:59:37 +00:00
// Check for end of song
2002-07-27 19:29:51 +00:00
//
2002-08-20 21:00:56 +00:00
if( fSongBeat > GAMESTATE->m_pCurSong->m_fLastBeat+4 && !m_soundMusic.IsPlaying() )
2002-08-01 03:15:27 +00:00
{
GAMESTATE->m_fSongBeat = 0;
2002-08-20 21:00:56 +00:00
m_soundMusic.Stop();
2002-07-11 19:02:26 +00:00
this->SendScreenMessage( SM_NotesEnded, 0 );
2002-08-01 03:15:27 +00:00
}
2002-07-27 19:29:51 +00:00
//
// check for fail
//
switch( GAMESTATE->m_SongOptions.m_FailType )
{
case SongOptions::FAIL_ARCADE:
2002-08-01 21:55:40 +00:00
switch( GAMESTATE->m_SongOptions.m_LifeType )
{
case SongOptions::LIFE_BAR:
if( AllAreFailing() ) SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 );
if( AllAreInDanger() ) m_Background.TurnDangerOn();
else m_Background.TurnDangerOff();
break;
case SongOptions::LIFE_BATTERY:
if( AllFailedEarlier() )SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 );
if( AllAreInDanger() ) m_Background.TurnDangerOn();
else m_Background.TurnDangerOff();
2002-07-27 19:29:51 +00:00
2002-08-01 21:55:40 +00:00
// check for individual fail
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) )
if( m_pLifeMeter[p]->IsFailing() && GAMESTATE->m_fSecondsBeforeFail[p] == -1 ) // not yet failed
2002-08-02 09:31:06 +00:00
if( !AllFailedEarlier() ) // if not the last one to fail
{
// kill them!
GAMESTATE->m_fSecondsBeforeFail[p] = GAMESTATE->GetElapsedSeconds();
m_soundOniDie.PlayRandom();
ShowOniGameOver((PlayerNumber)p);
m_Player[p].Init(); // remove all notes and scoring
m_Player[p].FadeToFail(); // tell the NoteField to fade to white
}
2002-08-01 21:55:40 +00:00
break;
}
2002-07-27 19:29:51 +00:00
break;
case SongOptions::FAIL_END_OF_SONG:
case SongOptions::FAIL_OFF:
break; // don't check for fail
default:
ASSERT(0);
}
//
2002-05-20 08:59:37 +00:00
// Check to see if it's time to play a gameplay comment
2002-07-27 19:29:51 +00:00
//
2002-08-02 09:31:06 +00:00
if( !GAMESTATE->m_bDemonstration ) // don't play announcer comments in demonstration
2002-05-20 08:59:37 +00:00
{
2002-08-02 09:31:06 +00:00
m_fTimeLeftBeforeDancingComment -= fDeltaTime;
if( m_fTimeLeftBeforeDancingComment <= 0 )
{
if( OneIsHot() )
m_announcerHot.PlayRandom();
else if( AllAreInDanger() )
m_announcerDanger.PlayRandom();
else
m_announcerGood.PlayRandom();
2002-08-20 21:00:56 +00:00
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS; // reset for the next comment
2002-08-02 09:31:06 +00:00
}
2002-08-20 21:00:56 +00:00
2002-05-20 08:59:37 +00:00
}
}
2002-06-24 22:04:31 +00:00
//
// Send crossed row messages to Player
//
int iRowNow = BeatToNoteRowNotRounded( fSongBeat );
2002-08-15 16:45:49 +00:00
if( iRowNow >= 0 && iRowNow < MAX_TAP_NOTE_ROWS )
2002-06-24 22:04:31 +00:00
{
2002-08-15 16:45:49 +00:00
for( int r=m_iRowLastCrossed+1; r<=iRowNow; r++ ) // for each index we crossed since the last update
2002-06-24 22:04:31 +00:00
{
2002-08-15 16:45:49 +00:00
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( GAMESTATE->IsPlayerEnabled(p) )
m_Player[p].CrossedRow( r );
}
2002-06-24 22:04:31 +00:00
}
2002-08-15 16:45:49 +00:00
m_iRowLastCrossed = iRowNow;
}
2002-06-24 22:04:31 +00:00
2002-05-20 08:59:37 +00:00
2002-06-24 22:04:31 +00:00
//
// play assist ticks
//
// 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
2002-07-23 01:41:40 +00:00
if( GAMESTATE->m_SongOptions.m_AssistType == SongOptions::ASSIST_TICK )
2002-05-20 08:59:37 +00:00
{
fPositionSeconds += (SOUND->GetPlayLatency()+0.01f) * m_soundMusic.GetPlaybackRate(); // HACK: Add 0.02 seconds to account for the fact that the sound file has 0.01 seconds of silence at the beginning
2002-07-23 01:41:40 +00:00
GAMESTATE->m_pCurSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS, bFreeze );
2002-05-20 08:59:37 +00:00
2002-06-24 22:04:31 +00:00
int iRowNow = BeatToNoteRowNotRounded( fSongBeat );
iRowNow = max( 0, iRowNow );
2002-06-24 22:04:31 +00:00
static int iRowLastCrossed = 0;
2002-05-20 08:59:37 +00:00
bool bAnyoneHasANote = false; // set this to true if any player has a note at one of the indicies we crossed
2002-06-24 22:04:31 +00:00
for( int r=iRowLastCrossed+1; r<=iRowNow; r++ ) // for each index we crossed since the last update
2002-05-20 08:59:37 +00:00
{
for( int p=0; p<NUM_PLAYERS; p++ )
{
2002-07-23 01:41:40 +00:00
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
2002-05-20 08:59:37 +00:00
continue; // skip
2002-07-28 20:28:37 +00:00
m_Player[p].CrossedRow( r );
2002-06-24 22:04:31 +00:00
bAnyoneHasANote |= m_Player[p].IsThereANoteAtRow( r );
2002-05-27 08:23:27 +00:00
break; // this will only play the tick for the first player that is joined
2002-05-20 08:59:37 +00:00
}
}
if( bAnyoneHasANote )
m_soundAssistTick.PlayRandom();
2002-06-24 22:04:31 +00:00
iRowLastCrossed = iRowNow;
2002-05-20 08:59:37 +00:00
}
2002-08-02 09:31:06 +00:00
if( PREFSMAN->m_bAutoPlay && !GAMESTATE->m_bDemonstration )
m_textAutoPlay.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
else
m_textAutoPlay.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
2002-08-02 09:31:06 +00:00
Screen::Update( fDeltaTime );
2002-05-20 08:59:37 +00:00
}
void ScreenGameplay::DrawPrimitives()
{
Screen::DrawPrimitives();
}
void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
//LOG->Trace( "ScreenGameplay::Input()" );
if(type == IET_RELEASE) return; // don't care
2002-05-20 08:59:37 +00:00
2002-08-02 09:31:06 +00:00
if( GAMESTATE->m_bDemonstration )
{
2002-08-22 09:31:32 +00:00
if( MenuI.button==MENU_BUTTON_START && !m_Fade.IsClosing() )
2002-08-02 09:31:06 +00:00
{
m_soundMusic.Stop();
SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","insert coin") );
::Sleep( 1000 ); // do a little pause, like the arcade does
this->SendScreenMessage( SM_GoToTitleMenu, 0 );
// m_Fade.CloseWipingRight( SM_GoToTitleMenu );
2002-08-02 09:31:06 +00:00
}
2002-08-22 09:31:32 +00:00
else if( DeviceI.device==DEVICE_KEYBOARD && DeviceI.button==DIK_ESCAPE && !m_Fade.IsClosing() )
{
this->SendScreenMessage( SM_BeginFadingToTitleMenu, 0 );
}
2002-08-02 09:31:06 +00:00
return; // don't fall through below
}
2002-05-20 08:59:37 +00:00
2002-06-24 22:04:31 +00:00
// Handle special keys to adjust the offset
2002-07-03 21:27:26 +00:00
if( DeviceI.device == DEVICE_KEYBOARD )
2002-06-24 22:04:31 +00:00
{
switch( DeviceI.button )
{
2002-07-27 19:29:51 +00:00
case DIK_F8:
PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay;
break;
case DIK_F9:
case DIK_F10:
{
m_bChangedOffsetOrBPM = true;
float fOffsetDelta;
switch( DeviceI.button )
{
case DIK_F9: fOffsetDelta = -0.025f; break;
case DIK_F10: fOffsetDelta = +0.025f; break;
default: ASSERT(0);
}
if( type == IET_FAST_REPEAT )
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;
m_textDebug.SetText( ssprintf("Cur BPM = %f", seg.m_fBPM) );
2002-07-27 19:29:51 +00:00
m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_textDebug.StopTweening();
m_textDebug.BeginTweeningQueued( 3 ); // sleep
m_textDebug.BeginTweeningQueued( 0.5f ); // fade out
m_textDebug.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
}
break;
2002-06-24 22:04:31 +00:00
case DIK_F11:
case DIK_F12:
2002-07-03 21:27:26 +00:00
{
2002-07-27 19:29:51 +00:00
m_bChangedOffsetOrBPM = true;
2002-07-03 21:27:26 +00:00
float fOffsetDelta;
switch( DeviceI.button )
{
2002-07-27 19:29:51 +00:00
case DIK_F11: fOffsetDelta = -0.02f; break;
case DIK_F12: fOffsetDelta = +0.02f; break;
2002-07-03 21:27:26 +00:00
default: ASSERT(0);
}
if( type == IET_FAST_REPEAT )
fOffsetDelta *= 10;
2002-07-03 21:27:26 +00:00
2002-07-23 01:41:40 +00:00
GAMESTATE->m_pCurSong->m_fBeat0OffsetInSeconds += fOffsetDelta;
2002-07-03 21:27:26 +00:00
m_textDebug.SetText( ssprintf("Offset = %f", GAMESTATE->m_pCurSong->m_fBeat0OffsetInSeconds) );
2002-07-03 21:27:26 +00:00
m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_textDebug.StopTweening();
m_textDebug.BeginTweeningQueued( 3 ); // sleep
m_textDebug.BeginTweeningQueued( 0.5f ); // fade out
m_textDebug.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
}
2002-06-24 22:04:31 +00:00
break;
}
}
2002-07-28 20:28:37 +00:00
if( MenuI.IsValid() &&
MenuI.button == MENU_BUTTON_BACK &&
m_DancingState != STATE_OUTRO &&
!m_Fade.IsClosing() )
2002-05-20 08:59:37 +00:00
{
2002-08-01 13:42:56 +00:00
if( (DeviceI.device==DEVICE_KEYBOARD && type==IET_SLOW_REPEAT) ||
(DeviceI.device!=DEVICE_KEYBOARD && type==IET_FAST_REPEAT) )
{
m_DancingState = STATE_OUTRO;
SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","menu back") );
2002-08-01 13:42:56 +00:00
m_soundMusic.Stop();
this->ClearMessageQueue();
m_Fade.CloseWipingLeft( SM_SaveChangedBeforeGoingBack );
}
2002-05-20 08:59:37 +00:00
}
2002-07-27 19:29:51 +00:00
//
// handle a step
//
if( m_DancingState == STATE_DANCING && type == IET_FIRST_PRESS && !PREFSMAN->m_bAutoPlay && StyleI.IsValid() )
if( GAMESTATE->IsPlayerEnabled( StyleI.player ) )
m_Player[StyleI.player].Step( StyleI.col );
2002-05-20 08:59:37 +00:00
}
2002-08-02 09:31:06 +00:00
void SaveChanges()
2002-07-27 19:29:51 +00:00
{
2002-07-28 20:28:37 +00:00
switch( GAMESTATE->m_PlayMode )
{
case PLAY_MODE_ARCADE:
GAMESTATE->m_pCurSong->SaveToSMFile();
break;
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
{
for( int i=0; i<GAMESTATE->m_pCurCourse->m_iStages; i++ )
{
Song* pSong = GAMESTATE->m_pCurCourse->m_apSongs[i];
pSong->SaveToSMFile();
}
}
break;
default:
ASSERT(0);
}
2002-07-27 19:29:51 +00:00
}
2002-08-02 09:31:06 +00:00
void DontSaveChanges()
2002-07-27 19:29:51 +00:00
{
2002-07-28 20:28:37 +00:00
switch( GAMESTATE->m_PlayMode )
{
case PLAY_MODE_ARCADE:
GAMESTATE->m_pCurSong->LoadFromSMFile( GAMESTATE->m_pCurSong->GetCacheFilePath() );
break;
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
{
for( int i=0; i<GAMESTATE->m_pCurCourse->m_iStages; i++ )
{
Song* pSong = GAMESTATE->m_pCurCourse->m_apSongs[i];
pSong->LoadFromSMFile( GAMESTATE->m_pCurSong->GetCacheFilePath() );
}
}
break;
default:
ASSERT(0);
}
2002-07-27 19:29:51 +00:00
}
void ShowSavePrompt( ScreenMessage SM_SendWhenDone )
{
2002-07-28 20:28:37 +00:00
CString sMessage;
switch( GAMESTATE->m_PlayMode )
{
case PLAY_MODE_ARCADE:
sMessage = ssprintf(
"You have changed the offset or BPM of\n"
"%s.\n"
"Would you like to save these changes back\n"
"to the song file?\n"
2002-08-20 06:26:34 +00:00
"Choosing NO will discard your changes.",
2002-07-28 20:28:37 +00:00
GAMESTATE->m_pCurSong->GetFullTitle() );
break;
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
sMessage = ssprintf(
"You have changed the offset or BPM of\n"
"one or more songs in this course.\n"
"Would you like to save these changes back\n"
"to the song file(s)?\n"
2002-08-20 06:26:34 +00:00
"Choosing NO will discard your changes." );
2002-07-28 20:28:37 +00:00
break;
default:
ASSERT(0);
}
2002-07-27 19:29:51 +00:00
SCREENMAN->AddScreenToTop( new ScreenPrompt(
SM_SendWhenDone,
2002-08-01 05:11:11 +00:00
sMessage,
2002-07-27 19:29:51 +00:00
PROMPT_YES_NO,
true,
SaveChanges,
DontSaveChanges
)
);
}
2002-05-20 08:59:37 +00:00
void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
// received while STATE_INTRO
case SM_User+0:
m_StarWipe.OpenWipingRight(SM_None);
break;
case SM_User+1:
break;
case SM_User+2:
m_sprReady.StartFocusing();
2002-07-11 19:02:26 +00:00
m_announcerReady.PlayRandom();
2002-05-20 08:59:37 +00:00
break;
case SM_User+3:
break;
case SM_User+4:
m_sprReady.StartBlurring();
break;
case SM_User+5:
2002-07-23 01:41:40 +00:00
{
m_sprHereWeGo.StartFocusing();
m_announcerHereWeGo.PlayRandom();
m_Background.FadeIn();
m_soundMusic.Play();
}
2002-05-20 08:59:37 +00:00
break;
case SM_User+6:
break;
case SM_User+7:
break;
case SM_User+8:
m_sprHereWeGo.StartBlurring();
m_DancingState = STATE_DANCING; // STATE CHANGE! Now the user is allowed to press Back
break;
case SM_User+9:
break;
// received while STATE_DANCING
2002-07-11 19:02:26 +00:00
case SM_NotesEnded:
2002-07-23 01:41:40 +00:00
{
2002-07-28 20:28:37 +00:00
// save any statistics
2002-07-23 01:41:40 +00:00
for( int p=0; p<NUM_PLAYERS; p++ )
2002-07-28 20:28:37 +00:00
{
if( GAMESTATE->IsPlayerEnabled(p) )
{
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
RadarCategory rc = (RadarCategory)r;
GAMESTATE->m_fRadarPossible[p][r] = m_Player[p].GetRadarValue( rc, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
GAMESTATE->m_fRadarActual[p][r] = m_Player[p].GetActualRadarValue( rc, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
}
}
}
GAMESTATE->m_apSongsPlayed.Add( GAMESTATE->m_pCurSong );
2002-08-01 03:15:27 +00:00
GAMESTATE->m_iSongsIntoCourse++;
for( p=0; p<NUM_PLAYERS; p++ )
2002-08-01 03:15:27 +00:00
if( GAMESTATE->IsPlayerEnabled(p) )
if( !m_pLifeMeter[p]->FailedEarlier() )
GAMESTATE->m_iSongsBeforeFail[p]++;
2002-07-27 19:29:51 +00:00
2002-07-28 20:28:37 +00:00
if( !IsLastSong() )
2002-07-27 19:29:51 +00:00
{
2002-08-01 03:15:27 +00:00
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) )
if( !m_pLifeMeter[p]->FailedEarlier() )
m_pLifeMeter[p]->SongEnded(); // let the oni life meter give them back a life
m_OniFade.CloseWipingRight( SM_BeginLoadingNextSong );
2002-07-27 19:29:51 +00:00
}
2002-07-28 20:28:37 +00:00
else // IsLastSong
2002-07-27 19:29:51 +00:00
{
2002-07-28 20:28:37 +00:00
if( m_DancingState == STATE_OUTRO ) // gameplay already ended
return; // ignore
m_DancingState = STATE_OUTRO;
GAMESTATE->AccumulateStageStatistics(); // accumulate values for final evaluation
if( GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_END_OF_SONG && AllFailedEarlier() )
{
this->SendScreenMessage( SM_BeginFailed, 0 );
}
else
{
m_StarWipe.CloseWipingRight( SM_None );
this->SendScreenMessage( SM_ShowCleared, 1 );
2002-08-01 21:55:40 +00:00
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_CLEARED) );
2002-07-28 20:28:37 +00:00
}
2002-07-27 19:29:51 +00:00
}
2002-05-20 08:59:37 +00:00
}
break;
2002-08-01 03:15:27 +00:00
case SM_BeginLoadingNextSong:
LoadNextSong( false );
m_OniFade.OpenWipingRight( SM_None );
break;
2002-08-02 09:31:06 +00:00
case SM_BeginFadingToTitleMenu:
m_Fade.CloseWipingRight( SM_GoToTitleMenu );
break;
2002-08-01 03:15:27 +00:00
2002-07-11 19:02:26 +00:00
case SM_100Combo:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer100Combo.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
case SM_200Combo:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer200Combo.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
case SM_300Combo:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer300Combo.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
case SM_400Combo:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer400Combo.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
case SM_500Combo:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer500Combo.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
case SM_600Combo:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer600Combo.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
case SM_700Combo:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer700Combo.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
case SM_800Combo:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer800Combo.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
case SM_900Combo:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer900Combo.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
case SM_1000Combo:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcer1000Combo.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
case SM_ComboStopped:
if( m_fTimeLeftBeforeDancingComment < 12 )
{
m_announcerComboStopped.PlayRandom();
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
2002-07-11 19:02:26 +00:00
}
break;
// received while STATE_OUTRO
2002-05-20 08:59:37 +00:00
case SM_ShowCleared:
m_sprCleared.StartFocusing();
SCREENMAN->SendMessageToTopScreen( SM_HideCleared, 2.5 );
break;
case SM_HideCleared:
m_sprCleared.StartBlurring();
2002-07-27 19:29:51 +00:00
SCREENMAN->SendMessageToTopScreen( SM_GoToStateAfterCleared, 1 );
break;
2002-08-01 05:11:11 +00:00
case SM_SaveChangedBeforeGoingBack:
if( m_bChangedOffsetOrBPM )
{
m_bChangedOffsetOrBPM = false;
ShowSavePrompt( SM_GoToScreenAfterBack );
}
2002-08-01 13:42:56 +00:00
else
this->SendScreenMessage( SM_GoToScreenAfterBack, 0 );
2002-08-01 05:11:11 +00:00
break;
2002-07-27 19:29:51 +00:00
case SM_GoToScreenAfterBack:
switch( GAMESTATE->m_PlayMode )
{
2002-07-29 03:06:55 +00:00
case PLAY_MODE_ARCADE:
SCREENMAN->SetNewScreen( new ScreenSelectMusic );
break;
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
SCREENMAN->SetNewScreen( new ScreenSelectCourse );
break;
2002-07-27 19:29:51 +00:00
default: ASSERT(0);
}
2002-05-20 08:59:37 +00:00
break;
2002-07-27 19:29:51 +00:00
case SM_GoToStateAfterCleared:
if( m_bChangedOffsetOrBPM )
{
m_bChangedOffsetOrBPM = false;
ShowSavePrompt( SM_GoToStateAfterCleared );
break;
}
2002-07-23 01:41:40 +00:00
SCREENMAN->SetNewScreen( new ScreenEvaluation(false) );
2002-05-20 08:59:37 +00:00
break;
case SM_BeginFailed:
m_DancingState = STATE_OUTRO;
m_soundMusic.Pause();
m_StarWipe.SetTransitionTime( 1.5f );
2002-05-20 08:59:37 +00:00
m_StarWipe.CloseWipingRight( SM_None );
2002-08-02 09:31:06 +00:00
int p;
for( p=0; p<NUM_PLAYERS; p++ )
2002-08-01 21:55:40 +00:00
if( GAMESTATE->IsPlayerEnabled(p) )
m_Player[p].FadeToFail();
2002-08-01 13:42:56 +00:00
2002-05-20 08:59:37 +00:00
this->SendScreenMessage( SM_ShowFailed, 0.2f );
break;
case SM_ShowFailed:
2002-07-11 19:02:26 +00:00
m_soundFail.PlayRandom();
2002-05-20 08:59:37 +00:00
// make the background invisible so we don't waste mem bandwidth drawing it
m_Background.BeginTweening( 1 );
m_Background.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
m_sprFailed.SetZoom( 4 );
m_sprFailed.BeginBlurredTweening( 0.8f, TWEEN_BIAS_END );
m_sprFailed.SetTweenZoom( 0.5f ); // zoom out
m_sprFailed.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0.7f) ); // and fade in
m_sprFailed.BeginTweeningQueued( 0.3f );
m_sprFailed.SetTweenZoom( 1.1f ); // bounce
m_sprFailed.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0.7f) ); // and fade in
m_sprFailed.BeginTweeningQueued( 0.2f );
m_sprFailed.SetTweenZoom( 1.0f ); // come to rest
m_sprFailed.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0.7f) ); // and fade in
2002-08-01 13:42:56 +00:00
// show the survive time if extra stage
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
{
float fMaxSurviveSeconds = -1;
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) )
fMaxSurviveSeconds = max( fMaxSurviveSeconds, GAMESTATE->GetPlayerSurviveTime((PlayerNumber)p) );
ASSERT( fMaxSurviveSeconds != -1 );
m_textSurviveTime.SetText( "TIME " + SecondsToTime(fMaxSurviveSeconds) );
m_textSurviveTime.BeginTweening( 0.3f ); // sleep
m_textSurviveTime.BeginTweeningQueued( 0.3f ); // fade in
m_textSurviveTime.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) );
}
2002-05-20 08:59:37 +00:00
SCREENMAN->SendMessageToTopScreen( SM_PlayFailComment, 1.5f );
SCREENMAN->SendMessageToTopScreen( SM_HideFailed, 3.0f );
break;
case SM_PlayFailComment:
2002-08-01 21:55:40 +00:00
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_FAILED) );
2002-05-20 08:59:37 +00:00
break;
case SM_HideFailed:
m_sprFailed.StopTweening();
m_sprFailed.BeginTweening(1.0f);
m_sprFailed.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
2002-08-01 13:42:56 +00:00
m_textSurviveTime.BeginTweening( 0.5f ); // sleep
m_textSurviveTime.BeginTweeningQueued( 0.5f ); // fade out
m_textSurviveTime.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
2002-05-27 08:23:27 +00:00
SCREENMAN->SendMessageToTopScreen( SM_GoToScreenAfterFail, 1.5f );
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;
}
2002-08-22 09:31:32 +00:00
if( GAMESTATE->m_PlayMode == PLAY_MODE_ONI || GAMESTATE->m_PlayMode == PLAY_MODE_ENDLESS )
SCREENMAN->SetNewScreen( new ScreenEvaluation(false) );
else if( PREFSMAN->m_bEventMode )
2002-07-27 19:29:51 +00:00
this->SendScreenMessage( SM_GoToScreenAfterBack, 0 );
2002-08-01 13:42:56 +00:00
else if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
SCREENMAN->SetNewScreen( new ScreenEvaluation(true) );
2002-05-27 08:23:27 +00:00
else
SCREENMAN->SetNewScreen( new ScreenGameOver );
2002-05-20 08:59:37 +00:00
break;
2002-08-02 09:31:06 +00:00
case SM_GoToTitleMenu:
SCREENMAN->SetNewScreen( new ScreenTitleMenu );
break;
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()
{
2002-05-20 08:59:37 +00:00
}
2002-06-14 22:25:22 +00:00
void ScreenGameplay::TweenOffScreen()
{
}
2002-08-01 21:55:40 +00:00
void ScreenGameplay::ShowOniGameOver( PlayerNumber p )
{
m_sprOniGameOver[p].SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_sprOniGameOver[p].BeginTweening( 0.5f, Actor::TWEEN_BOUNCE_END );
m_sprOniGameOver[p].SetTweenY( CENTER_Y );
m_sprOniGameOver[p].SetEffectBobbing( D3DXVECTOR3(0,6,0), 4 );
}