2004-06-08 05:22:33 +00:00
/* ScreenGameplay - The music plays, the notes scroll, and the Player is pressing buttons. */
2002-05-20 08:59:37 +00:00
2005-08-23 21:38:51 +00:00
#ifndef ScreenGameplay_H
#define ScreenGameplay_H
2002-05-20 08:59:37 +00:00
2005-04-01 12:35:49 +00:00
#include "ScreenWithMenuElements.h"
2002-05-20 08:59:37 +00:00
#include "Sprite.h"
2003-04-13 01:09:19 +00:00
#include "Transition.h"
2002-05-20 08:59:37 +00:00
#include "BitmapText.h"
2002-12-29 00:20:57 +00:00
#include "RageSound.h"
2002-05-20 08:59:37 +00:00
#include "Background.h"
2004-01-07 00:13:32 +00:00
#include "Foreground.h"
2002-10-29 01:26:10 +00:00
#include "BPMDisplay.h"
2003-08-20 09:19:46 +00:00
#include "BeginnerHelper.h"
2003-03-19 19:58:22 +00:00
#include "LyricDisplay.h"
2003-10-25 22:00:58 +00:00
#include "Attack.h"
2004-08-13 08:24:11 +00:00
#include "NetworkSyncManager.h"
2004-10-24 10:45:30 +00:00
#include "AutoKeysounds.h"
2005-03-10 02:45:40 +00:00
#include "ThemeMetric.h"
2005-08-23 21:38:51 +00:00
#include "PlayerStageStats.h"
#include "PlayerState.h"
2005-09-05 02:26:50 +00:00
#include "GameInput.h"
2005-08-23 21:38:51 +00:00
class LyricsLoader ;
class ActiveAttackList ;
class CombinedLifeMeter ;
class Player ;
class LifeMeter ;
class ScoreDisplay ;
class DifficultyIcon ;
class DifficultyMeter ;
class Inventory ;
class ScoreKeeper ;
2005-08-26 17:39:53 +00:00
class PlayerScoreList ;
2002-05-20 08:59:37 +00:00
2005-03-28 08:01:36 +00:00
AutoScreenMessage ( SM_NotesEnded )
2005-09-09 21:49:29 +00:00
AutoScreenMessage ( SM_BeginFailed )
AutoScreenMessage ( SM_LeaveGameplay )
2005-03-14 13:29:19 +00:00
2005-08-23 23:48:23 +00:00
class PlayerInfo
{
public :
PlayerInfo ();
~ PlayerInfo ();
void Load ( PlayerNumber pn , MultiPlayer mp , bool bShowNoteField );
void LoadDummyP1 ();
void ShowOniGameOver ();
MultiPlayer GetPlayerStateAndStageStatsIndex () { return m_pn == PLAYER_INVALID ? m_mp : ( MultiPlayer ) m_pn ; }
PlayerState * GetPlayerState ();
PlayerStageStats * GetPlayerStageStats ();
PlayerNumber GetStepsAndTrailIndex () { return m_pn == PLAYER_INVALID ? PLAYER_1 : m_pn ; }
bool IsEnabled ();
bool IsMultiPlayer () { return m_mp != MultiPlayer_INVALID ; }
CString GetName ()
{
if ( m_bIsDummy )
return "Dummy" ;
if ( IsMultiPlayer () )
return MultiPlayerToString ( m_mp );
else
return PlayerNumberToString ( m_pn );
}
PlayerNumber m_pn ;
MultiPlayer m_mp ;
bool m_bIsDummy ;
PlayerState m_PlayerStateDummy ;
PlayerStageStats m_PlayerStageStatsDummy ;
vector < Steps *> m_vpStepsQueue ; // size may be >1 if playing a course
vector < AttackArray > m_asModifiersQueue ; // size may be >1 if playing a course
LifeMeter * m_pLifeMeter ;
BitmapText * m_ptextCourseSongNumber ;
BitmapText * m_ptextStepsDescription ;
ScoreDisplay * m_pPrimaryScoreDisplay ;
ScoreDisplay * m_pSecondaryScoreDisplay ;
ScoreKeeper * m_pPrimaryScoreKeeper ;
ScoreKeeper * m_pSecondaryScoreKeeper ;
BitmapText * m_ptextPlayerOptions ;
ActiveAttackList * m_pActiveAttackList ;
Transition * m_pWin ;
Player * m_pPlayer ;
// used in PLAY_MODE_BATTLE
Inventory * m_pInventory ;
DifficultyIcon * m_pDifficultyIcon ;
DifficultyMeter * m_pDifficultyMeter ;
AutoActor m_sprOniGameOver ;
};
2005-04-01 12:35:49 +00:00
class ScreenGameplay : public ScreenWithMenuElements
2002-05-20 08:59:37 +00:00
{
public :
2005-01-03 23:20:11 +00:00
ScreenGameplay ( CString sName );
2005-01-03 22:44:19 +00:00
virtual void Init ();
2002-05-20 08:59:37 +00:00
virtual ~ ScreenGameplay ();
2003-01-19 04:44:22 +00:00
2002-05-20 08:59:37 +00:00
virtual void Update ( float fDeltaTime );
2005-09-05 02:26:50 +00:00
virtual void Input ( const InputEventPlus & input );
2002-05-20 08:59:37 +00:00
virtual void HandleScreenMessage ( const ScreenMessage SM );
2005-09-10 20:07:13 +00:00
virtual void Cancel ( ScreenMessage smSendWhenDone );
2002-05-20 08:59:37 +00:00
2004-12-11 10:23:06 +00:00
virtual bool UsesBackground () const { return false ; }
2005-05-19 23:29:39 +00:00
virtual ScreenType GetScreenType () const { return gameplay ; }
2002-05-20 08:59:37 +00:00
2005-07-12 21:12:12 +00:00
//
// Lua
//
virtual void PushSelf ( lua_State * L );
Song * GetNextCourseSong () const ;
2003-01-10 02:22:07 +00:00
protected :
2005-03-12 00:04:27 +00:00
ThemeMetric < CString > PLAYER_TYPE ;
2006-01-07 04:11:29 +00:00
LocalizedString GIVE_UP_TEXT ;
LocalizedString GIVE_UP_ABORTED_TEXT ;
2005-03-23 02:11:33 +00:00
ThemeMetric < float > MUSIC_FADE_OUT_SECONDS ;
2005-03-10 02:45:40 +00:00
ThemeMetric < bool > START_GIVES_UP ;
ThemeMetric < bool > BACK_GIVES_UP ;
2005-04-27 06:34:53 +00:00
ThemeMetric < bool > GIVING_UP_GOES_TO_PREV_SCREEN ;
2005-04-10 06:21:59 +00:00
ThemeMetric < bool > GIVING_UP_GOES_TO_NEXT_SCREEN ;
2005-05-09 15:14:19 +00:00
ThemeMetric < bool > FAIL_AFTER_30_MISSES ;
2005-04-24 11:03:02 +00:00
ThemeMetric < bool > USE_FORCED_MODIFIERS_IN_BEGINNER ;
ThemeMetric < CString > FORCED_MODIFIERS_IN_BEGINNER ;
2005-03-10 02:45:40 +00:00
2005-10-14 03:11:50 +00:00
void TweenOnScreen ();
2005-10-13 22:52:25 +00:00
void TweenOffScreen ();
2002-07-23 01:41:40 +00:00
2002-07-28 20:28:37 +00:00
bool IsLastSong ();
2005-04-11 07:59:27 +00:00
void SetupSong ( int iSongIndex );
2005-09-09 21:49:29 +00:00
void ReloadCurrentSong ();
2003-01-25 07:40:47 +00:00
void LoadNextSong ();
2004-02-14 00:39:24 +00:00
void LoadCourseSongNumber ( int SongNumber );
2003-01-25 08:32:57 +00:00
float StartPlayingSong ( float MinTimeToNotes , float MinTimeToMusic );
2005-05-04 06:48:34 +00:00
void LoadLights ();
2005-04-21 02:07:02 +00:00
void PauseGame ( bool bPause , GameController gc = GAME_CONTROLLER_INVALID );
2004-02-16 05:29:33 +00:00
void PlayAnnouncer ( CString type , float fSeconds );
2004-12-03 23:30:50 +00:00
void UpdateLights ();
2005-04-24 11:03:02 +00:00
void SendCrossedMessages ();
2005-09-12 08:04:47 +00:00
void BeginBackingOutFromGameplay ();
2002-05-20 08:59:37 +00:00
2004-01-12 09:36:01 +00:00
void PlayTicks ();
2004-05-21 00:58:48 +00:00
void UpdateSongPosition ( float fDeltaTime );
2003-03-19 17:43:11 +00:00
void UpdateLyrics ( float fDeltaTime );
2003-12-15 06:24:59 +00:00
void SongFinished ();
2004-02-21 21:00:49 +00:00
void StageFinished ( bool bBackedOut );
2005-11-22 21:18:45 +00:00
void SaveRecordedResults ();
2002-05-20 08:59:37 +00:00
2005-01-03 23:29:40 +00:00
virtual void InitSongQueues ();
2002-07-27 19:29:51 +00:00
enum DancingState {
STATE_INTRO = 0 , // not allowed to press Back
STATE_DANCING ,
STATE_OUTRO , // not allowed to press Back
NUM_DANCING_STATES
2003-02-14 21:42:44 +00:00
} m_DancingState ;
2005-03-11 02:52:40 +00:00
bool m_bPaused ;
2005-08-23 21:38:51 +00:00
2005-04-21 02:07:02 +00:00
GameController m_PauseController ;
2003-03-26 23:08:05 +00:00
vector < Song *> m_apSongsQueue ; // size may be >1 if playing a course
2003-02-14 21:42:44 +00:00
2004-02-16 05:29:33 +00:00
float m_fTimeSinceLastDancingComment ; // this counter is only running while STATE_DANCING
2002-05-20 08:59:37 +00:00
2003-03-19 19:58:22 +00:00
LyricDisplay m_LyricDisplay ;
2002-05-20 08:59:37 +00:00
2005-03-11 02:12:21 +00:00
Background m_SongBackground ;
2005-03-11 02:52:40 +00:00
Foreground m_SongForeground ;
2002-05-20 08:59:37 +00:00
2005-03-19 00:03:53 +00:00
Transition m_NextSong ; // shows between songs in a course
2004-03-06 10:07:17 +00:00
Transition m_SongFinished ; // shows after each song, course or not
2002-08-01 03:15:27 +00:00
2005-05-06 10:48:32 +00:00
AutoActor m_sprLifeFrame ;
2003-06-30 18:08:27 +00:00
CombinedLifeMeter * m_pCombinedLifeMeter ;
2005-05-07 09:58:23 +00:00
Sprite m_sprCourseSongNumber ;
2002-06-14 22:25:22 +00:00
2003-01-11 08:55:21 +00:00
BPMDisplay m_BPMDisplay ;
2004-12-18 08:15:19 +00:00
float m_fLastBPS ;
2002-08-13 23:26:46 +00:00
2003-01-11 08:55:21 +00:00
Sprite m_sprScoreFrame ;
BitmapText m_textSongOptions ;
2004-08-13 08:24:11 +00:00
BitmapText m_Scoreboard [ NUM_NSSB_CATEGORIES ]; // for NSMAN, so we can have a scoreboard
2002-05-20 08:59:37 +00:00
2005-08-24 20:45:57 +00:00
bool m_bShowScoreboard ;
2004-08-13 08:40:53 +00:00
2003-01-11 08:55:21 +00:00
BitmapText m_textDebug ;
2003-09-06 03:25:45 +00:00
RageTimer m_GiveUpTimer ;
2005-03-15 08:44:35 +00:00
void AbortGiveUp ( bool bShowText );
2003-09-06 03:25:45 +00:00
2005-08-26 17:39:53 +00:00
BitmapText m_MaxCombo ; // TODO: move this into an overlay
PlayerScoreList * m_pPlayerScoreList ;
2002-05-20 08:59:37 +00:00
2003-04-13 01:09:19 +00:00
Transition m_Ready ;
Transition m_Go ;
Transition m_Cleared ;
Transition m_Failed ;
Transition m_Extra ;
Transition m_Toasty ; // easter egg
2003-04-21 02:41:10 +00:00
Transition m_Draw ;
2002-05-20 08:59:37 +00:00
2005-08-26 17:39:53 +00:00
BitmapText m_textSurviveTime ; // used in extra stage. TODO: Move this into a BGA
2002-08-01 13:42:56 +00:00
2002-05-20 08:59:37 +00:00
2004-10-24 10:45:30 +00:00
AutoKeysounds m_AutoKeysounds ;
2003-11-20 06:50:05 +00:00
RageSound m_soundBattleTrickLevel1 ;
RageSound m_soundBattleTrickLevel2 ;
RageSound m_soundBattleTrickLevel3 ;
2002-05-20 08:59:37 +00:00
2003-04-13 00:44:50 +00:00
bool m_bZeroDeltaOnNextUpdate ;
2002-08-26 05:53:48 +00:00
2003-01-02 08:13:34 +00:00
RageSound m_soundAssistTick ;
2004-10-25 03:47:22 +00:00
RageSound * m_pSoundMusic ;
2003-08-20 09:19:46 +00:00
BeginnerHelper m_BeginnerHelper ;
2004-03-30 07:44:29 +00:00
2004-04-20 02:35:30 +00:00
NoteData m_CabinetLightsNoteData ;
2005-08-23 21:38:51 +00:00
vector < PlayerInfo > m_vPlayerInfo ; // filled by SGameplay derivatives in Init
virtual void FillPlayerInfo ( vector < PlayerInfo > & vPlayerInfoOut ) = 0 ;
2002-05-20 08:59:37 +00:00
};
2005-08-23 23:48:23 +00:00
vector < PlayerInfo >:: iterator GetNextEnabledPlayerInfo ( vector < PlayerInfo >:: iterator iter , vector < PlayerInfo > & v );
vector < PlayerInfo >:: iterator GetNextEnabledPlayerInfoNotDummy ( vector < PlayerInfo >:: iterator iter , vector < PlayerInfo > & v );
vector < PlayerInfo >:: iterator GetNextEnabledPlayerNumberInfo ( vector < PlayerInfo >:: iterator iter , vector < PlayerInfo > & v );
vector < PlayerInfo >:: iterator GetNextPlayerNumberInfo ( vector < PlayerInfo >:: iterator iter , vector < PlayerInfo > & v );
vector < PlayerInfo >:: iterator GetNextVisiblePlayerInfo ( vector < PlayerInfo >:: iterator iter , vector < PlayerInfo > & v );
2005-08-23 21:38:51 +00:00
#define FOREACH_EnabledPlayerInfo( v, pi ) for( vector<PlayerInfo>::iterator pi = GetNextEnabledPlayerInfo (v.begin()-1,v); pi != v.end(); pi = GetNextEnabledPlayerInfo(pi,v) )
#define FOREACH_EnabledPlayerInfoNotDummy( v, pi ) for( vector<PlayerInfo>::iterator pi = GetNextEnabledPlayerInfoNotDummy (v.begin()-1,v); pi != v.end(); pi = GetNextEnabledPlayerInfoNotDummy(pi,v) )
#define FOREACH_EnabledPlayerNumberInfo( v, pi ) for( vector<PlayerInfo>::iterator pi = GetNextEnabledPlayerNumberInfo (v.begin()-1,v); pi != v.end(); pi = GetNextEnabledPlayerNumberInfo(pi,v) )
#define FOREACH_PlayerNumberInfo( v, pi ) for( vector<PlayerInfo>::iterator pi = GetNextPlayerNumberInfo (v.begin()-1,v); pi != v.end(); pi = GetNextPlayerNumberInfo(pi,v) )
#define FOREACH_VisiblePlayerInfo( v, pi ) for( vector<PlayerInfo>::iterator pi = GetNextVisiblePlayerInfo (v.begin()-1,v); pi != v.end(); pi = GetNextVisiblePlayerInfo(pi,v) )
2002-05-20 08:59:37 +00:00
2003-02-14 22:25:14 +00:00
#endif
2004-06-08 05:22:33 +00:00
/*
* (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/