Files
itgmania212121/stepmania/src/ScreenGameplay.h
T

266 lines
8.7 KiB
C++
Raw Normal View History

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
#ifndef ScreenGameplay_H
#define ScreenGameplay_H
2002-05-20 08:59:37 +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"
#include "BPMDisplay.h"
#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"
#include "ThemeMetric.h"
#include "PlayerStageStats.h"
#include "PlayerState.h"
#include "GameInput.h"
class LyricsLoader;
class ActiveAttackList;
class CombinedLifeMeter;
class Player;
class LifeMeter;
class ScoreDisplay;
class DifficultyIcon;
class DifficultyMeter;
class Inventory;
class ScoreKeeper;
class PlayerScoreList;
2002-05-20 08:59:37 +00:00
AutoScreenMessage( SM_NotesEnded )
AutoScreenMessage( SM_BeginFailed )
AutoScreenMessage( SM_LeaveGameplay )
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();
2006-01-18 19:58:35 +00:00
PlayerNumber GetStepsAndTrailIndex() { return m_pn == PLAYER_INVALID ? PLAYER_1 : m_pn; }
2005-08-23 23:48:23 +00:00
bool IsEnabled();
2006-01-18 19:59:14 +00:00
bool IsMultiPlayer() const { return m_mp != MultiPlayer_INVALID; }
2006-01-22 01:00:06 +00:00
RString GetName() const
2005-08-23 23:48:23 +00:00
{
if( m_bIsDummy )
return "Dummy";
if( IsMultiPlayer() )
return MultiPlayerToString( m_mp );
else
return PlayerNumberToString( m_pn );
}
2006-01-18 19:58:35 +00:00
PlayerNumber m_pn;
MultiPlayer m_mp;
bool m_bIsDummy;
PlayerState m_PlayerStateDummy;
PlayerStageStats m_PlayerStageStatsDummy;
2005-08-23 23:48:23 +00:00
vector<Steps*> m_vpStepsQueue; // size may be >1 if playing a course
vector<AttackArray> m_asModifiersQueue;// size may be >1 if playing a course
2006-01-18 19:58:35 +00:00
LifeMeter *m_pLifeMeter;
BitmapText *m_ptextCourseSongNumber;
BitmapText *m_ptextStepsDescription;
2005-08-23 23:48:23 +00:00
ScoreDisplay *m_pPrimaryScoreDisplay;
ScoreDisplay *m_pSecondaryScoreDisplay;
2006-01-18 19:58:35 +00:00
ScoreKeeper *m_pPrimaryScoreKeeper;
ScoreKeeper *m_pSecondaryScoreKeeper;
BitmapText *m_ptextPlayerOptions;
2005-08-23 23:48:23 +00:00
ActiveAttackList *m_pActiveAttackList;
2006-01-18 19:58:35 +00:00
Player *m_pPlayer;
2005-08-23 23:48:23 +00:00
// used in PLAY_MODE_BATTLE
2006-01-18 19:58:35 +00:00
Inventory *m_pInventory;
2005-08-23 23:48:23 +00:00
DifficultyIcon *m_pDifficultyIcon;
DifficultyMeter *m_pDifficultyMeter;
2006-01-18 19:58:35 +00:00
AutoActor m_sprOniGameOver;
2005-08-23 23:48:23 +00:00
};
class ScreenGameplay : public ScreenWithMenuElements
2002-05-20 08:59:37 +00:00
{
public:
2006-01-15 19:49:02 +00:00
ScreenGameplay();
2005-01-03 22:44:19 +00:00
virtual void Init();
2002-05-20 08:59:37 +00:00
virtual ~ScreenGameplay();
virtual void BeginScreen();
2003-01-19 04:44:22 +00:00
2002-05-20 08:59:37 +00:00
virtual void Update( float fDeltaTime );
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;
protected:
2006-01-22 01:00:06 +00:00
ThemeMetric<RString> 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;
ThemeMetric<bool> START_GIVES_UP;
ThemeMetric<bool> BACK_GIVES_UP;
ThemeMetric<bool> GIVING_UP_GOES_TO_PREV_SCREEN;
ThemeMetric<bool> GIVING_UP_GOES_TO_NEXT_SCREEN;
ThemeMetric<bool> FAIL_AFTER_30_MISSES;
ThemeMetric<bool> USE_FORCED_MODIFIERS_IN_BEGINNER;
2006-01-22 01:00:06 +00:00
ThemeMetric<RString> FORCED_MODIFIERS_IN_BEGINNER;
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();
void SetupSong( int iSongIndex );
void ReloadCurrentSong();
virtual 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 );
2006-01-22 01:00:06 +00:00
void PlayAnnouncer( RString type, float fSeconds );
void UpdateLights();
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();
void UpdateSongPosition( float fDeltaTime );
void UpdateLyrics( float fDeltaTime );
void SongFinished();
void StageFinished( bool bBackedOut );
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
} m_DancingState;
2006-01-18 19:58:35 +00:00
bool m_bPaused;
2006-01-18 19:58:35 +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
2006-01-18 19:58:35 +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
2006-01-18 19:58:35 +00:00
Background m_SongBackground;
Foreground m_SongForeground;
2002-05-20 08:59:37 +00:00
2006-01-18 19:58:35 +00:00
Transition m_NextSong; // shows between songs in a course
Transition m_SongFinished; // shows after each song, course or not
2002-08-01 03:15:27 +00:00
2006-01-18 19:58:35 +00:00
AutoActor m_sprLifeFrame;
2003-06-30 18:08:27 +00:00
CombinedLifeMeter* m_pCombinedLifeMeter;
2006-01-18 19:58:35 +00:00
Sprite m_sprCourseSongNumber;
2002-06-14 22:25:22 +00:00
2006-01-18 19:58:35 +00:00
BPMDisplay m_BPMDisplay;
float m_fLastBPS;
2006-01-18 19:58:35 +00:00
Sprite m_sprScoreFrame;
BitmapText m_textSongOptions;
BitmapText m_Scoreboard[NUM_NSSB_CATEGORIES]; // for NSMAN, so we can have a scoreboard
2002-05-20 08:59:37 +00:00
2006-01-18 19:58:35 +00:00
bool m_bShowScoreboard;
2006-01-18 19:58:35 +00:00
BitmapText m_textDebug;
2006-01-18 19:58:35 +00:00
RageTimer m_GiveUpTimer;
void AbortGiveUp( bool bShowText );
2006-01-18 19:58:35 +00:00
BitmapText m_MaxCombo; // TODO: move this into an overlay
PlayerScoreList *m_pPlayerScoreList;
2002-05-20 08:59:37 +00:00
2006-01-18 19:58:35 +00:00
Transition m_Ready;
Transition m_Go;
Transition m_Failed;
Transition m_Toasty; // easter egg
2002-05-20 08:59:37 +00:00
2006-01-18 19:58:35 +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
2006-01-18 19:58:35 +00:00
AutoKeysounds m_AutoKeysounds;
2004-10-24 10:45:30 +00:00
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;
2003-01-02 08:13:34 +00:00
RageSound m_soundAssistTick;
2004-10-25 03:47:22 +00:00
RageSound *m_pSoundMusic;
2006-01-18 19:58:35 +00:00
BeginnerHelper m_BeginnerHelper;
2004-03-30 07:44:29 +00:00
2004-04-20 02:35:30 +00:00
NoteData m_CabinetLightsNoteData;
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 );
#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.
*/