Etterna 0.75.1
Loading...
Searching...
No Matches
ScreenGameplay.h
1#ifndef SCREEN_GAMEPLAY_H
2#define SCREEN_GAMEPLAY_H
3
4#include "Etterna/Models/Misc/AutoKeysounds.h"
5#include "Etterna/Actor/Base/BitmapText.h"
6#include "Etterna/Models/Misc/GameplayAssist.h"
7#include "Etterna/Models/Misc/InputEventPlus.h"
8#include "Etterna/Models/Misc/LocalizedString.h"
9#include "Etterna/Actor/Gameplay/LyricDisplay.h"
10#include "RageUtil/Sound/RageSound.h"
11#include "Etterna/Screen/Others/ScreenWithMenuElements.h"
12#include "Etterna/Models/Misc/ThemeMetric.h"
13#include "Etterna/Actor/GameplayAndMenus/Transition.h"
14#include "Etterna/Models/Misc/PlayerInfo.h"
15
16class LifeMeter;
17class Background;
18class Foreground;
19
20AutoScreenMessage(SM_NotesEnded);
21AutoScreenMessage(SM_BeginFailed);
22AutoScreenMessage(SM_LeaveGameplay);
23
27{
28 public:
30 void Init() override;
31 ~ScreenGameplay() override;
32 void BeginScreen() override;
33
34 void Update(float fDeltaTime) override;
35 bool Input(const InputEventPlus& input) override;
36 void HandleScreenMessage(const ScreenMessage& SM) override;
37 void HandleMessage(const Message& msg) override;
38 void Cancel(ScreenMessage smSendWhenDone) override;
39
40 void DrawPrimitives() override;
41
45 ScreenType GetScreenType() const override { return gameplay; }
46
50 static bool Center1Player();
51
52 // Lua
53 void PushSelf(lua_State* L) override;
54 PlayerInfo* GetPlayerInfo();
55
56 void FailFadeRemovePlayer(PlayerInfo* pi);
57 void BeginBackingOutFromGameplay();
58
60 void RestartGameplayForLua() { RestartGameplay(); }
61
62 // Get current position of the song during gameplay
63 const float GetSongPosition();
64
65 protected:
66 virtual void UpdateStageStats(
67 MultiPlayer /* mp */){}; // overridden for multiplayer
68
69 virtual bool UseSongBackgroundAndForeground() const { return true; }
70 virtual void LoadPlayer();
71 virtual void ReloadPlayer();
72 virtual void LoadScoreKeeper();
73 virtual void RestartGameplay();
74
75 ThemeMetric<std::string> PLAYER_TYPE;
76 ThemeMetric<std::string> SCORE_DISPLAY_TYPE;
77 ThemeMetric<apActorCommands> PLAYER_INIT_COMMAND;
78 LocalizedString GIVE_UP_START_TEXT;
79 LocalizedString GIVE_UP_BACK_TEXT;
80 LocalizedString GIVE_UP_ABORTED_TEXT;
81 LocalizedString SKIP_SONG_TEXT;
82 ThemeMetric<float> GIVE_UP_SECONDS;
83 ThemeMetric<float> MUSIC_FADE_OUT_SECONDS;
84 ThemeMetric<float> OUT_TRANSITION_LENGTH;
85 ThemeMetric<float> BEGIN_FAILED_DELAY;
86 ThemeMetric<float> MIN_SECONDS_TO_STEP;
87 ThemeMetric<float> MIN_SECONDS_TO_MUSIC;
88 ThemeMetric<float> MIN_SECONDS_TO_STEP_NEXT_SONG;
89 ThemeMetric<std::string> SONG_NUMBER_FORMAT;
90
91 void SetupSong(int iSongIndex);
92 void ReloadCurrentSong();
93 virtual void LoadNextSong();
94 void StartPlayingSong(float fMinTimeToNotes, float fMinTimeToMusic);
95 void GetMusicEndTiming(float& fSecondsToStartFadingOutMusic,
96 float& fSecondsToStartTransitioningOut);
97 void PlayAnnouncer(const std::string& type,
98 float fSeconds,
99 float* fDeltaSeconds);
100 void PlayAnnouncer(const std::string& type, float fSeconds)
101 {
102 PlayAnnouncer(type, fSeconds, &m_fTimeSinceLastDancingComment);
103 }
104 void SendCrossedMessages();
105
106 void PlayTicks();
107 // Used to update some pointers
108 void UpdateSongPosition();
109 void SongFinished();
110 virtual void SaveStats();
111 virtual void StageFinished(bool bBackedOut);
112 bool AllAreFailing();
113
114 virtual void SetupNoteDataFromRow(Steps* pSteps, int minRow = 0,
115 int maxrow = MAX_NOTE_ROW);
116
117 virtual void InitSongQueues();
118
121 {
123 0,
126 NUM_DANCING_STATES
127 } m_DancingState;
128
133 std::vector<Song*> m_apSongsQueue;
134 std::vector<float> ratesqueue;
135 std::vector<std::string> playlistscorekeys;
136
137 // this counter is only running while
138 // STATE_DANCING
139 float m_fTimeSinceLastDancingComment;
140
141 LyricDisplay m_LyricDisplay;
142
143 Background* m_pSongBackground;
144 Foreground* m_pSongForeground;
145 RageTimer m_initTimer;
146
149
150 bool m_bShowScoreboard;
151
152 BitmapText m_textDebug;
153
154 RageTimer m_GiveUpTimer;
155 bool m_gave_up;
156 void AbortGiveUpText(bool show_abort_text);
157 void AbortGiveUp(bool bShowText);
158 void ResetGiveUpTimers(bool show_text);
159
160 RageTimer m_DiscordRPCCheckTimer;
161 void CheckDiscordRPCTimer();
162 void TriggerDiscordRPCUpdate();
163
164 Transition m_Ready;
165 Transition m_Go;
170
171 AutoKeysounds m_AutoKeysounds;
172
173 bool m_bZeroDeltaOnNextUpdate;
174
175 GameplayAssist m_GameplayAssist;
176 RageSound* m_pSoundMusic;
177
178 // filled by SGameplay derivatives in FillPlayerInfo
179 std::vector<PlayerInfo> m_vPlayerInfo{};
180 virtual void FillPlayerInfo(std::vector<PlayerInfo>& vPlayerInfoOut) = 0;
181
182 RageTimer m_timerGameplaySeconds;
183
184 // m_delaying_ready_announce is for handling a case where the ready
185 // announcer sound needs to be delayed. See HandleScreenMessage for more.
186 // -Kyz
187 bool m_delaying_ready_announce;
188
189 // True when the player hit RestartGameplay
190 bool m_bRestarted = false;
191};
192#endif
Handle playback of auto keysound notes.
Definition AutoKeysounds.h:13
the Background that is behind the notes while playing.
Definition Background.h:11
An actor that holds a Font and draws text to the screen.
Definition BitmapText.h:11
Foreground in front of notes while playing.
Definition Foreground.h:10
The handclaps and metronomes ready to assist the player.
Definition GameplayAssist.h:11
Holds a device input plus Game/Menu translations.
Definition InputEventPlus.h:9
The player's life.
Definition LifeMeter.h:13
Get a String based on the user's natural language.
Definition LocalizedString.h:13
Displays lyrics along with the song on Gameplay.
Definition LyricDisplay.h:8
Definition PlayerInfo.h:19
Definition RageSound.h:135
Definition RageTimer.h:9
The music plays, the notes scroll, and the Player is pressing buttons.
Definition ScreenGameplay.h:27
DancingState
The different game states of ScreenGameplay.
Definition ScreenGameplay.h:121
@ STATE_DANCING
Definition ScreenGameplay.h:124
@ STATE_OUTRO
Definition ScreenGameplay.h:125
@ STATE_INTRO
Definition ScreenGameplay.h:122
Transition m_Toasty
The transition to use when one player earns an easter egg.
Definition ScreenGameplay.h:169
void BeginScreen() override
This is called immediately before the screen is used.
Definition ScreenGameplay.cpp:838
std::vector< Song * > m_apSongsQueue
The songs left to play.
Definition ScreenGameplay.h:133
void RestartGameplayForLua()
This function exists because.
Definition ScreenGameplay.h:60
Transition m_Failed
The transition to use when all players have failed.
Definition ScreenGameplay.h:167
Transition m_NextSong
Used between songs in a course to show the next song.
Definition ScreenGameplay.h:148
static bool Center1Player()
Determine if we are to center the columns for just one player.
Definition ScreenGameplay.cpp:359
void Init() override
This is called immediately after construction, to allow initializing after all derived classes exist.
Definition ScreenGameplay.cpp:113
void DrawPrimitives() override
Draw the primitives of the Actor.
Definition ScreenGameplay.cpp:1192
ScreenType GetScreenType() const override
Retrieve the current ScreenType.
Definition ScreenGameplay.h:45
Definition ScreenWithMenuElements.h:12
Holds note information for a Song.
Definition Steps.h:42
The theme specific data.
Definition ThemeMetric.h:52
Definition Transition.h:11
Definition MessageManager.h:101