Etterna 0.74.4
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 LifeMeter* GetLifeMeter(PlayerNumber pn);
55 PlayerInfo* GetPlayerInfo(PlayerNumber pn);
56
57 void FailFadeRemovePlayer(PlayerInfo* pi);
58 void FailFadeRemovePlayer(PlayerNumber pn);
59 void BeginBackingOutFromGameplay();
60
62 void RestartGameplayForLua() { RestartGameplay(); }
63
64 // Get current position of the song during gameplay
65 const float GetSongPosition();
66
67 protected:
68 virtual void UpdateStageStats(
69 MultiPlayer /* mp */){}; // overridden for multiplayer
70
71 virtual bool UseSongBackgroundAndForeground() const { return true; }
72 virtual void LoadPlayer();
73 virtual void ReloadPlayer();
74 virtual void LoadScoreKeeper();
75 virtual void RestartGameplay();
76
77 ThemeMetric<std::string> PLAYER_TYPE;
78 ThemeMetric<std::string> SCORE_DISPLAY_TYPE;
79 ThemeMetric<apActorCommands> PLAYER_INIT_COMMAND;
80 LocalizedString GIVE_UP_START_TEXT;
81 LocalizedString GIVE_UP_BACK_TEXT;
82 LocalizedString GIVE_UP_ABORTED_TEXT;
83 LocalizedString SKIP_SONG_TEXT;
84 ThemeMetric<float> GIVE_UP_SECONDS;
85 ThemeMetric<float> MUSIC_FADE_OUT_SECONDS;
86 ThemeMetric<float> OUT_TRANSITION_LENGTH;
87 ThemeMetric<float> BEGIN_FAILED_DELAY;
88 ThemeMetric<float> MIN_SECONDS_TO_STEP;
89 ThemeMetric<float> MIN_SECONDS_TO_MUSIC;
90 ThemeMetric<float> MIN_SECONDS_TO_STEP_NEXT_SONG;
91 ThemeMetric<std::string> SONG_NUMBER_FORMAT;
92
93 void SetupSong(int iSongIndex);
94 void ReloadCurrentSong();
95 virtual void LoadNextSong();
96 void StartPlayingSong(float fMinTimeToNotes, float fMinTimeToMusic);
97 void GetMusicEndTiming(float& fSecondsToStartFadingOutMusic,
98 float& fSecondsToStartTransitioningOut);
99 void PlayAnnouncer(const std::string& type,
100 float fSeconds,
101 float* fDeltaSeconds);
102 void PlayAnnouncer(const std::string& type, float fSeconds)
103 {
104 PlayAnnouncer(type, fSeconds, &m_fTimeSinceLastDancingComment);
105 }
106 void SendCrossedMessages();
107
108 void PlayTicks();
109 // Used to update some pointers
110 void UpdateSongPosition();
111 void SongFinished();
112 virtual void SaveStats();
113 virtual void StageFinished(bool bBackedOut);
114 bool AllAreFailing();
115
116 virtual void SetupNoteDataFromRow(Steps* pSteps, int minRow = 0,
117 int maxrow = MAX_NOTE_ROW);
118
119 virtual void InitSongQueues();
120
123 {
125 0,
128 NUM_DANCING_STATES
130
131 private:
132 protected:
137 std::vector<Song*> m_apSongsQueue;
138 std::vector<float> ratesqueue;
139 std::vector<std::string> playlistscorekeys;
140
141 float m_fTimeSinceLastDancingComment; // this counter is only running while
142 // STATE_DANCING
143
144 LyricDisplay m_LyricDisplay;
145
146 Background* m_pSongBackground;
147 Foreground* m_pSongForeground;
148 RageTimer m_initTimer;
149
152
153 BitmapText m_Scoreboard[NUM_NSScoreBoardColumn]; // for NSMAN, so we can
154 // have a scoreboard
155
156 bool m_bShowScoreboard;
157
158 BitmapText m_textDebug;
159
160 RageTimer m_GiveUpTimer;
161 bool m_gave_up;
162 void AbortGiveUpText(bool show_abort_text);
163 void AbortGiveUp(bool bShowText);
164 void ResetGiveUpTimers(bool show_text);
165
166 Transition m_Ready;
167 Transition m_Go;
172
173 AutoKeysounds m_AutoKeysounds;
174
175 RageSound m_soundBattleTrickLevel1;
176 RageSound m_soundBattleTrickLevel2;
177 RageSound m_soundBattleTrickLevel3;
178
179 bool m_bZeroDeltaOnNextUpdate;
180
181 GameplayAssist m_GameplayAssist;
182 RageSound* m_pSoundMusic;
183
185 m_vPlayerInfo; // filled by SGameplay derivatives in FillPlayerInfo
186 virtual void FillPlayerInfo(PlayerInfo* vPlayerInfoOut) = 0;
187 virtual PlayerInfo& GetPlayerInfoForInput(const InputEventPlus& iep)
188 {
189 return m_vPlayerInfo;
190 }
191
192 RageTimer m_timerGameplaySeconds;
193
194 // m_delaying_ready_announce is for handling a case where the ready
195 // announcer sound needs to be delayed. See HandleScreenMessage for more.
196 // -Kyz
197 bool m_delaying_ready_announce;
198
199 // True when the player hit RestartGameplay
200 bool m_bRestarted = false;
201};
202#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:130
Definition RageTimer.h:9
The music plays, the notes scroll, and the Player is pressing buttons.
Definition ScreenGameplay.h:27
enum ScreenGameplay::DancingState m_DancingState
The specific point within ScreenGameplay.
DancingState
The different game states of ScreenGameplay.
Definition ScreenGameplay.h:123
@ STATE_DANCING
Definition ScreenGameplay.h:126
@ STATE_OUTRO
Definition ScreenGameplay.h:127
@ STATE_INTRO
Definition ScreenGameplay.h:124
Transition m_Toasty
The transition to use when one player earns an easter egg.
Definition ScreenGameplay.h:171
void BeginScreen() override
This is called immediately before the screen is used.
Definition ScreenGameplay.cpp:829
std::vector< Song * > m_apSongsQueue
The songs left to play.
Definition ScreenGameplay.h:137
void RestartGameplayForLua()
This function exists because.
Definition ScreenGameplay.h:62
Transition m_Failed
The transition to use when all players have failed.
Definition ScreenGameplay.h:169
Transition m_NextSong
Used between songs in a course to show the next song.
Definition ScreenGameplay.h:151
static bool Center1Player()
Determine if we are to center the columns for just one player.
Definition ScreenGameplay.cpp:353
void Init() override
This is called immediately after construction, to allow initializing after all derived classes exist.
Definition ScreenGameplay.cpp:112
void DrawPrimitives() override
Draw the primitives of the Actor.
Definition ScreenGameplay.cpp:1142
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:96