2002-11-16 08:07:38 +00:00
|
|
|
#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"
|
2002-08-13 23:26:46 +00:00
|
|
|
#include "Game.h"
|
|
|
|
|
#include "Style.h"
|
2002-09-10 01:13:45 +00:00
|
|
|
#include "Grade.h"
|
2003-01-24 02:43:07 +00:00
|
|
|
#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();
|
2003-02-03 05:53:59 +00:00
|
|
|
void ResetLastRanking();
|
2002-07-23 01:41:40 +00:00
|
|
|
|
2003-02-26 23:26:57 +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;
|
2002-08-27 23:31:41 +00:00
|
|
|
bool m_bPlayersCanJoin; // true if it's not too late for a player to join - this only has an effect on the credits message
|
2003-01-24 02:43:07 +00:00
|
|
|
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
|
2003-01-24 02:43:07 +00:00
|
|
|
int m_iCoins; // not "credits"
|
|
|
|
|
PlayerNumber m_MasterPlayerNumber; // used in Styles where one player controls both sides
|
2003-02-12 06:25:51 +00:00
|
|
|
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;
|
2003-01-24 02:43:07 +00:00
|
|
|
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
|
|
|
|
2003-04-07 03:25:44 +00:00
|
|
|
void GetPlayerInfo( PlayerNumber pn, bool& bIsEnabledOut, bool& bIsHumanOut );
|
2002-07-23 01:41:40 +00:00
|
|
|
bool IsPlayerEnabled( PlayerNumber pn );
|
2003-04-07 03:25:44 +00:00
|
|
|
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
|
|
|
|
2003-01-24 02:43:07 +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
|
2003-01-11 08:55:21 +00:00
|
|
|
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;
|
2003-02-14 21:42:44 +00:00
|
|
|
int m_iCurrentStageIndex; // incremented on Eval screen. For a Course, this is always 0
|
2002-07-23 01:41:40 +00:00
|
|
|
|
|
|
|
|
int GetStageIndex();
|
2003-02-10 05:30:12 +00:00
|
|
|
int GetNumStagesLeft();
|
2002-07-23 01:41:40 +00:00
|
|
|
bool IsFinalStage();
|
|
|
|
|
bool IsExtraStage();
|
|
|
|
|
bool IsExtraStage2();
|
|
|
|
|
CString GetStageText();
|
2003-02-14 21:42:44 +00:00
|
|
|
int GetCourseSongIndex();
|
2002-07-23 01:41:40 +00:00
|
|
|
|
2003-02-24 03:26:00 +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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2003-01-24 02:43:07 +00:00
|
|
|
// 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;
|
2003-02-07 23:49:07 +00:00
|
|
|
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
|
|
|
//
|
2003-01-24 02:43:07 +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
|
|
|
//
|
2003-01-24 02:43:07 +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
|
|
|
|
|
|
|
|
|
2003-02-26 23:26:57 +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
|
|
|
|
2003-02-26 23:26:57 +00:00
|
|
|
void StoreSelectedOptions();
|
|
|
|
|
void RestoreSelectedOptions();
|
|
|
|
|
|
|
|
|
|
|
2003-04-07 05:14:27 +00:00
|
|
|
// used in PLAY_MODE_RAVE
|
2003-04-07 03:25:44 +00:00
|
|
|
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
|
2003-04-07 03:25:44 +00:00
|
|
|
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
|
2003-04-07 03:25:44 +00:00
|
|
|
struct ActiveAttack
|
|
|
|
|
{
|
|
|
|
|
float fSecsRemaining;
|
|
|
|
|
CString sModifier;
|
|
|
|
|
};
|
2003-04-07 05:14:27 +00:00
|
|
|
ActiveAttack m_ActiveAttacks[NUM_PLAYERS][NUM_INVENTORY_SLOTS];
|
2003-04-07 03:25:44 +00:00
|
|
|
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 );
|
2003-04-07 03:25:44 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2003-01-24 02:43:07 +00:00
|
|
|
bool HasEarnedExtraStage();
|
2003-02-05 09:01:09 +00:00
|
|
|
bool m_bAllow2ndExtraStage; //only used when "Allow Selection of Extra Stage is on"
|
2003-01-26 02:21:47 +00:00
|
|
|
|
|
|
|
|
|
2003-02-26 23:26:57 +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
|
2003-02-16 10:12:03 +00:00
|
|
|
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
|
2002-11-16 08:07:38 +00:00
|
|
|
|
|
|
|
|
#endif
|