Files
itgmania212121/stepmania/src/GameState.h
T

197 lines
6.1 KiB
C++
Raw Normal View History

#ifndef GAMESTATE_H
#define GAMESTATE_H
2002-07-23 01:41:40 +00:00
/*
-----------------------------------------------------------------------------
Class: GameState
Desc: Holds game data that is not saved between sessions.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "GameConstantsAndTypes.h"
2002-07-27 19:29:51 +00:00
#include "PlayerOptions.h"
#include "SongOptions.h"
#include "Game.h"
#include "Style.h"
#include "Grade.h"
#include "StageStats.h"
2002-07-23 01:41:40 +00:00
class Song;
2003-03-26 23:08:05 +00:00
class Notes;
2002-07-23 01:41:40 +00:00
class Course;
class GameDef;
class StyleDef;
2003-03-02 01:43:33 +00:00
struct ModeChoice;
2003-04-02 21:57:05 +00:00
class NoteFieldPositioning;
2002-07-23 01:41:40 +00:00
class GameState
{
public:
GameState();
~GameState();
void Reset();
void ResetLastRanking();
2002-07-23 01:41:40 +00:00
void Update( float fDelta );
2002-07-28 20:28:37 +00:00
//
// Main State Info
//
2002-07-23 01:41:40 +00:00
Game m_CurGame;
Style m_CurStyle;
bool m_bPlayersCanJoin; // true if it's not too late for a player to join - this only has an effect on the credits message
bool m_bSideIsJoined[NUM_PLAYERS]; // left side, right side
2003-03-02 01:43:33 +00:00
PlayMode m_PlayMode; // many screens display different info depending on this value
int m_iCoins; // not "credits"
PlayerNumber m_MasterPlayerNumber; // used in Styles where one player controls both sides
bool m_bIsOnSystemMenu; // system screens will not be effected by the operator key -- Miryokuteki
2003-03-07 05:24:52 +00:00
bool m_bDifficultCourses; //used in nonstop
2002-09-29 05:06:18 +00:00
int GetNumSidesJoined()
{
int iNumSidesJoined = 0;
for( int c=0; c<NUM_PLAYERS; c++ )
2002-09-29 05:06:18 +00:00
if( m_bSideIsJoined[c] )
iNumSidesJoined++; // left side, and right side
return iNumSidesJoined;
};
2002-07-23 01:41:40 +00:00
GameDef* GetCurrentGameDef();
2002-08-22 23:05:49 +00:00
const StyleDef* GetCurrentStyleDef();
2002-07-23 01:41:40 +00:00
2003-03-03 10:03:02 +00:00
void ApplyModeChoice( const ModeChoice& mc, PlayerNumber pn );
bool IsPlayable( const ModeChoice& mc );
2003-03-02 01:43:33 +00:00
void GetPlayerInfo( PlayerNumber pn, bool& bIsEnabledOut, bool& bIsHumanOut );
2002-07-23 01:41:40 +00:00
bool IsPlayerEnabled( PlayerNumber pn );
bool IsPlayerEnabled( int p ) { return IsPlayerEnabled( (PlayerNumber)p ); };
bool IsHumanPlayer( PlayerNumber pn );
bool IsHumanPlayer( int p ) { return IsHumanPlayer( (PlayerNumber)p ); };
bool IsCpuPlayer( PlayerNumber pn );
bool IsCpuPlayer( int p ) { return IsCpuPlayer( (PlayerNumber)p ); };
bool AnyPlayersAreCpu()
{
for( int p=0; p<NUM_PLAYERS; p++ )
if( IsCpuPlayer(p) )
return true;
return false;
}
2003-02-28 07:26:43 +00:00
bool IsCourseMode() const;
2002-07-23 01:41:40 +00:00
CString m_sLoadingMessage; // used in loading screen
2003-02-25 00:33:42 +00:00
CString m_sPreferredGroup; // GROUP_ALL_MUSIC denotes no preferred group
Difficulty m_PreferredDifficulty[NUM_PLAYERS];
2002-07-23 01:41:40 +00:00
SongSortOrder m_SongSortOrder; // used by MusicWheel
2002-08-02 09:31:06 +00:00
bool m_bEditing; // NoteField does special stuff when this is true
2003-03-09 00:55:49 +00:00
bool m_bDemonstrationOrJukebox; // ScreenGameplay does special stuff when this is true
2003-02-11 02:20:38 +00:00
bool m_bJukeboxUsesModifiers;
int m_iCurrentStageIndex; // incremented on Eval screen. For a Course, this is always 0
2002-07-23 01:41:40 +00:00
int GetStageIndex();
int GetNumStagesLeft();
2002-07-23 01:41:40 +00:00
bool IsFinalStage();
bool IsExtraStage();
bool IsExtraStage2();
CString GetStageText();
int GetCourseSongIndex();
2002-07-23 01:41:40 +00:00
2002-07-28 20:28:37 +00:00
//
// State Info used during gameplay
//
Song* m_pCurSong;
Notes* m_pCurNotes[NUM_PLAYERS];
Course* m_pCurCourse;
//
// Music statistics: Arcade: the current stage (one song). Oni/Endles: a single song in a course
2002-08-01 05:11:11 +00:00
//
// Let a lot of classes access this info here so the don't have to keep their own copies.
//
2002-07-28 20:28:37 +00:00
float m_fMusicSeconds; // time into the current song
float m_fSongBeat;
float m_fCurBPS;
bool m_bFreeze; // in the middle of a freeze
2003-01-25 11:05:12 +00:00
bool m_bPastHereWeGo;
static const float MUSIC_SECONDS_INVALID;
2002-07-28 20:28:37 +00:00
2002-08-01 05:11:11 +00:00
void ResetMusicStatistics(); // Call this when it's time to play a new song. Clears the values above.
2003-02-06 17:40:06 +00:00
void UpdateSongPosition(float fPositionSeconds);
2002-07-28 20:28:37 +00:00
//
// Stage Statistics:
// Arcade: for the current stage (one song).
// Nonstop/Oni/Endless: for current course (which usually contains multiple songs)
2002-07-28 20:28:37 +00:00
//
StageStats m_CurStageStats; // current stage (not necessarily passed if Extra Stage)
vector<StageStats> m_vPassedStageStats; // Only useful in Arcade for final evaluation
// A song is only inserted here if at least one player passed.
// StageStats are added by the Evaluation screen
2003-01-27 02:00:38 +00:00
void GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>& vSongsOut ); // shown on arcade final evaluation
2002-08-01 05:11:11 +00:00
//
// Options stuff
//
PlayerOptions m_CurrentPlayerOptions[NUM_PLAYERS]; // current approaches destination
PlayerOptions m_PlayerOptions[NUM_PLAYERS]; // change this, and current will move gradually toward it
PlayerOptions m_StoredPlayerOptions[NUM_PLAYERS]; // user's choices on the PlayerOptions screen
2002-07-23 01:41:40 +00:00
SongOptions m_SongOptions;
2003-03-26 23:08:05 +00:00
SongOptions m_StoredSongOptions;
2002-12-02 05:25:44 +00:00
void StoreSelectedOptions();
void RestoreSelectedOptions();
2003-04-07 05:14:27 +00:00
// used in PLAY_MODE_RAVE
CString m_sCharacterName[NUM_PLAYERS];
AttackLevel m_MaxAttackLevel[NUM_PLAYERS];
CString m_sAttacks[NUM_PLAYERS][NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL];
2003-04-07 05:14:27 +00:00
// used in PLAY_MODE_BATTLE
CString m_sInventory[NUM_PLAYERS][NUM_INVENTORY_SLOTS];
2003-04-07 05:14:27 +00:00
// used in PLAY_MODE_RAVE and PLAY_MODE_BATTLE
struct ActiveAttack
{
float fSecsRemaining;
CString sModifier;
};
2003-04-07 05:14:27 +00:00
ActiveAttack m_ActiveAttacks[NUM_PLAYERS][NUM_INVENTORY_SLOTS];
bool m_bActiveAttackEndedThisUpdate[NUM_PLAYERS]; // flag so we can play sounds
2003-04-07 05:14:27 +00:00
void LaunchAttack( PlayerNumber target, ActiveAttack aa );
void RebuildPlayerOptionsFromActiveAttacks( PlayerNumber pn );
void RemoveAllActiveAttacks(); // called on end of song
2002-12-02 05:25:44 +00:00
2003-04-07 05:14:27 +00:00
bool HasEarnedExtraStage();
bool m_bAllow2ndExtraStage; //only used when "Allow Selection of Extra Stage is on"
2003-01-26 02:21:47 +00:00
//
// Ranking Stuff
//
2003-01-27 02:00:38 +00:00
// Filled in by ScreenNameEntry and used by ScreenRanking to flash the recent high scores
NotesType m_RankingNotesType; // meaningless if a course was played
RankingCategory m_RankingCategory[NUM_PLAYERS]; // meaningless if a course was played
Course* m_pRankingCourse; // meaningless unless Course was played
int m_iRankingIndex[NUM_PLAYERS]; // -1 if no new high score
2003-04-02 21:57:05 +00:00
//
// Arrow positioning
//
NoteFieldPositioning *m_Position[NUM_PLAYERS];
2002-07-23 01:41:40 +00:00
};
extern GameState* GAMESTATE; // global and accessable from anywhere in our program
#endif