Etterna 0.74.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
GameState Class Reference

Holds game data that is not saved between sessions. More...

#include <GameState.h>

Collaboration diagram for GameState:
Collaboration graph
[legend]

Public Member Functions

 GameState ()
 Set up the GameState with initial values.
 
void Reset ()
 Reset the GameState back to initial values.
 
void ResetPlayer (PlayerNumber pn)
 
void ResetPlayerOptions (PlayerNumber pn)
 
void ApplyCmdline ()
 
void ApplyGameCommand (const std::string &sCommand, PlayerNumber pn=PLAYER_INVALID)
 
void BeginGame ()
 Start the game when the first player joins in.
 
void JoinPlayer (PlayerNumber pn)
 
void UnjoinPlayer (PlayerNumber pn)
 
auto JoinInput (PlayerNumber pn) -> bool
 
auto JoinPlayers () -> bool
 
void LoadProfiles (bool bLoadEdits=true)
 
void SavePlayerProfile ()
 
auto HaveProfileToLoad () -> bool
 
auto HaveProfileToSave () -> bool
 
void AddStageToPlayer (PlayerNumber pn)
 
void LoadCurrentSettingsFromProfile (PlayerNumber pn)
 
void SaveCurrentSettingsToProfile (PlayerNumber pn)
 Save the specified player's settings to his/her profile.
 
auto GetDefaultSong () const -> Song *
 
auto CanSafelyEnterGameplay (std::string &reason) -> bool
 
void SetCompatibleStylesForPlayers ()
 
void ForceOtherPlayersToCompatibleSteps (PlayerNumber main)
 
void Update (float fDelta)
 
void SetCurGame (const Game *pGame)
 State what the current game is.
 
auto ChangePreferredDifficultyAndStepsType (PlayerNumber pn, Difficulty dc, StepsType st) -> bool
 
auto ChangePreferredDifficulty (PlayerNumber pn, int dir) -> bool
 
auto GetClosestShownDifficulty (PlayerNumber pn) const -> Difficulty
 
auto GetEasiestStepsDifficulty () const -> Difficulty
 
auto GetHardestStepsDifficulty () const -> Difficulty
 
void SetNewStageSeed ()
 
auto PlayersCanJoin () const -> bool
 Determine if a second player can join in at this time.
 
auto GetCurrentGame () const -> const Game *
 
auto GetCurrentStyle (PlayerNumber pn) const -> const Style *
 
void SetCurrentStyle (const Style *style, PlayerNumber pn)
 
auto SetCompatibleStyle (StepsType stype, PlayerNumber pn) -> bool
 
auto IsPlayerEnabled (PlayerNumber pn) const -> bool
 
auto IsMultiPlayerEnabled (MultiPlayer mp) const -> bool
 
auto IsPlayerEnabled (const PlayerState *pPlayerState) const -> bool
 
auto GetNumPlayersEnabled () const -> int
 
auto IsHumanPlayer (PlayerNumber pn) const -> bool
 Is the specified Player a human Player?
 
auto GetNumHumanPlayers () const -> int
 
auto GetFirstHumanPlayer () const -> PlayerNumber
 
auto GetFirstDisabledPlayer () const -> PlayerNumber
 
auto IsCpuPlayer (PlayerNumber pn) const -> bool
 
auto AnyPlayersAreCpu () const -> bool
 
auto GetMasterPlayerNumber () const -> PlayerNumber
 Retrieve the present master player number.
 
void SetMasterPlayerNumber (PlayerNumber p)
 Set the master player number.
 
auto GetProcessedTimingData () const -> TimingData *
 Retrieve the present timing data being processed.
 
void SetProcessedTimingData (TimingData *t)
 Set the timing data to be used with processing.
 
auto GetNumStagesForCurrentSongAndStepsOrCourse () const -> int
 
void BeginStage ()
 
void CancelStage ()
 
void CommitStageStats ()
 
void FinishStage ()
 
auto GetCourseSongIndex () const -> int
 
auto GetPlayerDisplayName (PlayerNumber pn) const -> std::string
 
auto GetLoadingCourseSongIndex () const -> int
 
auto IsPlaylistCourse () const -> bool
 
auto CountNotesSeparately () -> bool
 
void GetAllUsedNoteSkins (std::vector< std::string > &out) const
 
void ResetMusicStatistics ()
 
void SetPaused (bool p)
 
auto GetPaused () const -> bool
 
void UpdateSongPosition (float fPositionSeconds, const TimingData &timing, const RageTimer &timestamp=RageZeroTimer)
 
auto GetSongPercent (float beat) const -> float
 
auto AllAreInDangerOrWorse () const -> bool
 
auto OneIsHot () const -> bool
 
void ResetStageStatistics ()
 Call this function when it's time to play a new stage.
 
void GetDefaultPlayerOptions (PlayerOptions &po)
 
void GetDefaultSongOptions (SongOptions &so)
 
void ResetToDefaultSongOptions (ModsLevel l)
 
void ApplyPreferredModifiers (PlayerNumber pn, const std::string &sModifiers)
 
void ApplyStageModifiers (PlayerNumber pn, const std::string &sModifiers)
 
auto CurrentOptionsDisqualifyPlayer (PlayerNumber pn) -> bool
 
auto PlayerIsUsingModifier (PlayerNumber pn, const std::string &sModifier) -> bool
 
auto GetPlayerFailType (const PlayerState *pPlayerState) const -> FailType
 
auto GetNumSidesJoined () const -> int
 
auto GetNumCols (int pn) -> int
 
auto IsEventMode () const -> bool
 
auto GetEditLocalProfile () -> Profile *
 
auto GetGameplayMode () const -> GameplayMode
 
void TogglePracticeModeSafe (bool set)
 
void TogglePracticeMode (bool set)
 
auto IsPracticeMode () -> bool
 
void discordInit ()
 
void updateDiscordPresence (const std::string &largeImageText, const std::string &details, const std::string &state, int64_t endTime)
 
void updateDiscordPresenceMenu (const std::string &largeImageText)
 
void PushSelf (lua_State *L)
 

Static Public Member Functions

static auto GetNumStagesMultiplierForSong (const Song *pSong) -> int
 
static auto GetEtternaVersion () -> std::string
 

Public Attributes

BroadcastOnChangePtr< const Gamem_pCurGame
 
bool m_bSideIsJoined
 Determine which side is joined.
 
MultiPlayerStatus m_MultiPlayerStatus [NUM_MultiPlayer]
 
bool m_bPlayingMulti = false
 
int m_iNumMultiplayerNoteFields
 
RageTimer m_timeGameStarted
 
LuaTablem_Environment
 
int m_iGameSeed
 
int m_iStageSeed
 
BroadcastOnChange< std::string > m_sPreferredSongGroup
 
bool m_bFailTypeWasExplicitlySet
 
BroadcastOnChange< StepsType > m_PreferredStepsType
 
BroadcastOnChange< Difficulty > m_PreferredDifficulty
 
BroadcastOnChange< SortOrder > m_SortOrder
 
SortOrder m_PreferredSortOrder
 
int m_iNumStagesOfThisSong
 
bool m_bInNetGameplay = false
 
int m_iCurrentStageIndex
 Increase this every stage while not resetting on a continue.
 
int m_iPlayerStageTokens
 The number of stages available for the players.
 
std::string sExpandedSectionName
 
std::string m_sLastSongGroup
 
bool m_bLoadingNextSong
 
std::vector< float > timingscales
 
bool isplaylistcourse = false
 
BroadcastOnChangePtrWithSelf< Songm_pCurSong
 
Songm_pPreferredSong
 
BroadcastOnChangePtrWithSelf< Stepsm_pCurSteps
 
SongPosition m_Position
 
BroadcastOnChange< bool > m_bGameplayLeadIn
 
RageTimer m_DanceStartTime
 
float m_DanceDuration
 
ModsGroup< SongOptionsm_SongOptions
 
bool m_bDidModeChangeNoteSkin { false }
 Did the current game mode change the default Noteskin?
 
PlayerStatem_pPlayerState
 Allow access to each player's PlayerState.
 
PlayerStatem_pMultiPlayerState [NUM_MultiPlayer]
 
bool m_bTemporaryEventMode
 
bool m_bIsUsingStepTiming { true }
 Is the game right now using Song timing or Steps timing?
 
BroadcastOnChange< std::string > m_sEditLocalProfileID
 
BroadcastOnChange< GameplayMode > m_gameplayMode
 
bool m_bRestartedGameplay
 
std::string ProgramHash {}
 

Static Public Attributes

static const float MUSIC_SECONDS_INVALID = -5000.0f
 
static Preference< bool > m_bAutoJoin
 
static Preference< bool > DisableChordCohesion
 

Detailed Description

Holds game data that is not saved between sessions.

Member Function Documentation

◆ GetMasterPlayerNumber()

PlayerNumber GameState::GetMasterPlayerNumber ( ) const -> PlayerNumber

Retrieve the present master player number.

Returns
The master player number.

◆ GetProcessedTimingData()

TimingData * GameState::GetProcessedTimingData ( ) const -> TimingData*

Retrieve the present timing data being processed.

Returns
the timing data pointer.

◆ IsHumanPlayer()

bool GameState::IsHumanPlayer ( PlayerNumber  pn) const -> bool

Is the specified Player a human Player?

Parameters
pnthe numbered Player to check.
Returns
true if it's a human Player, or false otherwise.

◆ PlayersCanJoin()

bool GameState::PlayersCanJoin ( ) const -> bool

Determine if a second player can join in at this time.

Returns
true if a player can still enter the game, false otherwise.

◆ SaveCurrentSettingsToProfile()

void GameState::SaveCurrentSettingsToProfile ( PlayerNumber  pn)

Save the specified player's settings to his/her profile.

This is called at the beginning of each stage.

Parameters
pnthe PlayerNumber to save the stats to.

◆ SetCurGame()

void GameState::SetCurGame ( const Game pGame)

State what the current game is.

Call this instead of m_pCurGame.Set to make sure that PREFSMAN->m_sCurrentGame stays in sync.

Parameters
pGamethe game to start using.

◆ SetMasterPlayerNumber()

void GameState::SetMasterPlayerNumber ( PlayerNumber  p)

Set the master player number.

Parameters
pthe master player number.

◆ SetProcessedTimingData()

void GameState::SetProcessedTimingData ( TimingData t)

Set the timing data to be used with processing.

Parameters
tthe timing data.

Member Data Documentation

◆ m_bDidModeChangeNoteSkin

bool GameState::m_bDidModeChangeNoteSkin { false }

Did the current game mode change the default Noteskin?

This is true if it has: see Edit/Sync Songs for a common example. Note: any mode that wants to use this must set it explicitly.

◆ m_bIsUsingStepTiming

bool GameState::m_bIsUsingStepTiming { true }

Is the game right now using Song timing or Steps timing?

Different options are available depending on this setting.

◆ m_bSideIsJoined

bool GameState::m_bSideIsJoined

Determine which side is joined.

The left side is player 1, and the right side is player 2.

◆ m_iCurrentStageIndex

int GameState::m_iCurrentStageIndex

Increase this every stage while not resetting on a continue.

This is cosmetic: it's not use for Stage or Screen branching logic.

◆ m_iPlayerStageTokens

int GameState::m_iPlayerStageTokens

The number of stages available for the players.

This resets whenever a player joins or continues.

◆ timingscales

std::vector<float> GameState::timingscales
Initial value:
= { 1.00F, 1.00F, 1.00F, 1.00F, 0.84F,
0.66F, 0.50F, 0.33F, 0.20F }

The documentation for this class was generated from the following files: