Etterna 0.74.4
Loading...
Searching...
No Matches
GameConstantsAndTypes.h
1/* GameConstantsAndTypes - Things used in many places that don't change often.
2 */
3
4#ifndef GAME_CONSTANTS_AND_TYPES_H
5#define GAME_CONSTANTS_AND_TYPES_H
6
7#include "EnumHelper.h"
8#include "Etterna/Models/NoteData/NoteDataStructures.h"
9#include <cfloat> // need the max for default.
10
11// Note definitions
13const int MIN_METER = 1;
20const int MAX_METER = 35;
21
22// some components of the game care about some negative number
23// and break if you pass it
24// so this defines the point at which behavior is undefined
25// usually you only reach this if you have a huge starting bpm
26const int ARBITRARY_MIN_GAMEPLAY_NUMBER = -200000;
27
28// the hard end of the boo window and start of the miss window
29// dont let anyone hit a note outside of this
30const float MISS_WINDOW_BEGIN_SEC = 0.18F;
31
32// 75ms in both directions, around a j5 great
33const float MINE_WINDOW_SEC = 0.075F;
34
35// taps within alive holds/rolls must be this far away from
36// the next note so that they do not count.
37// this prevents unwanted cbs from roll tapping
38const float TAP_IN_HOLD_REQ_SEC = 0.135F;
39
40// how long between each subsequent release on a hold a
41// repress must take place before the hold dies
42const float HOLD_DROP_SEC = 0.250F;
43
44// how long between each subsequent tap on a roll before death
45const float ROLL_DROP_SEC = 0.500F;
46
47const float MIN_MUSIC_RATE = 0.05F;
48const float MAX_MUSIC_RATE = 3.F;
49
50enum GameplayMode
51{
52 GameplayMode_Normal,
53 GameplayMode_Practice,
54 GameplayMode_Replay,
55 NUM_GameplayMode,
56 GameplayMode_Invalid
57};
58
59auto
60SkillsetToString(Skillset ss) -> const std::string&;
61
62auto CalcPatternModToString(CalcPatternMod) -> const std::string&;
63auto CalcDiffValueToString(CalcDiffValue) -> const std::string&;
64auto CalcDebugMiscToString(CalcDebugMisc) -> const std::string&;
65
66enum NSScoreBoardColumn
67{
68 NSSB_NAMES = 0,
69 NSSB_COMBO,
70 NSSB_GRADE,
71 NUM_NSScoreBoardColumn,
72 NSScoreBoardColumn_Invalid
73};
74
75enum ValidationKey
76{
77 ValidationKey_Brittle,
78 ValidationKey_Weak,
79 NUM_ValidationKey,
80 ValidationKey_Invalid,
81};
82
83auto
84ValidationKeyToString(ValidationKey ss) -> const std::string&;
85
91enum RadarCategory
92{
93 RadarCategory_Notes,
94 RadarCategory_TapsAndHolds,
95 RadarCategory_Jumps,
96 RadarCategory_Holds,
97 RadarCategory_Mines,
98 RadarCategory_Hands,
99 RadarCategory_Rolls,
100 RadarCategory_Lifts,
101 RadarCategory_Fakes,
102 NUM_RadarCategory,
103 RadarCategory_Invalid
104};
110auto
111RadarCategoryToString(RadarCategory cat) -> const std::string&;
117auto
118RadarCategoryToLocalizedString(RadarCategory cat) -> const std::string&;
119LuaDeclareType(RadarCategory);
120
122enum StepsTypeCategory
123{
124 StepsTypeCategory_Single,
125 StepsTypeCategory_Double,
126};
127
129enum StepsType
130{
131 StepsType_dance_single = 0,
132 StepsType_dance_double,
133 StepsType_dance_solo,
134 StepsType_dance_threepanel,
135 StepsType_pump_single,
136 StepsType_pump_halfdouble,
137 StepsType_pump_double,
138 StepsType_kb7_single,
139 StepsType_ez2_single,
140 StepsType_ez2_double,
141 StepsType_ez2_real,
142 StepsType_ds3ddx_single,
143 StepsType_beat_single5,
144 StepsType_beat_double5,
145 StepsType_beat_single7,
146 StepsType_beat_double7,
147 StepsType_maniax_single,
148 StepsType_maniax_double,
149 StepsType_popn_five,
150 StepsType_popn_nine,
151 NUM_StepsType, // leave this at the end
152 StepsType_Invalid,
153};
154LuaDeclareType(StepsType);
155
159enum SortOrder
160{
161 SORT_GROUP,
162 SORT_TITLE,
163 SORT_BPM,
164 SORT_TOP_GRADES,
165 SORT_ARTIST,
166 SORT_GENRE,
167 SORT_MODE_MENU,
168 SORT_FAVORITES,
169 SORT_Overall,
170 SORT_Stream,
171 SORT_Jumpstream,
172 SORT_Handstream,
173 SORT_Stamina,
174 SORT_JackSpeed,
175 SORT_Chordjack,
176 SORT_Technical,
177 SORT_LENGTH,
178 SORT_DATE_ADDED,
179 SORT_CHART_AUTHOR,
180 SORT_Ungrouped,
182 NUM_SortOrder,
183 SortOrder_Invalid
184};
185
191auto
192SortOrderToString(SortOrder so) -> const std::string&;
198auto
199SortOrderToLocalizedString(SortOrder so) -> const std::string&;
205auto
206StringToSortOrder(const std::string& str) -> SortOrder;
207LuaDeclareType(SortOrder);
213inline auto
214IsSongSort(SortOrder so) -> bool
215{
216 return so >= SORT_GROUP && so <= SORT_GENRE;
217}
218
220enum TapNoteScore
221{
222 TNS_None,
223 TNS_HitMine,
224 TNS_AvoidMine,
225 TNS_CheckpointMiss,
226 TNS_Miss,
227 TNS_W5,
228 TNS_W4,
229 TNS_W3,
230 TNS_W2,
232 TNS_W1,
233 TNS_CheckpointHit,
234 NUM_TapNoteScore,
235 TapNoteScore_Invalid,
236};
242auto
243TapNoteScoreToString(TapNoteScore tns) -> const std::string&;
249auto
250TapNoteScoreToLocalizedString(TapNoteScore tns) -> const std::string&;
256auto
257StringToTapNoteScore(const std::string& str) -> TapNoteScore;
258LuaDeclareType(TapNoteScore);
259
261enum HoldNoteScore
262{
263 HNS_None,
264 HNS_LetGo,
265 HNS_Held,
267 HNS_Missed,
268 NUM_HoldNoteScore,
269 HoldNoteScore_Invalid,
270};
276auto
277HoldNoteScoreToString(HoldNoteScore hns) -> const std::string&;
278
284auto
285HoldNoteScoreToLocalizedString(HoldNoteScore hns) -> const std::string&;
291auto
292StringToHoldNoteScore(const std::string& str) -> HoldNoteScore;
293LuaDeclareType(HoldNoteScore);
294
296enum TimingWindow
297{
298 TW_W1,
299 TW_W2,
300 TW_W3,
301 TW_W4,
302 TW_W5,
303 TW_Mine,
304 TW_Hold,
305 TW_Roll,
306 TW_Checkpoint,
307 NUM_TimingWindow
308};
309auto
310TimingWindowToString(TimingWindow tw) -> const std::string&;
311
313enum ScoreEvent
314{
315 SE_CheckpointHit,
316 SE_W1,
317 SE_W2,
318 SE_W3,
319 SE_W4,
320 SE_W5,
321 SE_Miss,
322 SE_HitMine,
323 SE_CheckpointMiss,
324 SE_Held,
325 SE_LetGo,
326 SE_Missed,
327 NUM_ScoreEvent
328};
329auto
330ScoreEventToString(ScoreEvent se) -> const std::string&;
331
333enum GameButtonType
334{
335 GameButtonType_Step,
336 GameButtonType_Menu
337};
338
340enum TapNoteScoreJudgeType
341{
342 TapNoteScoreJudgeType_MinimumScore,
343 TapNoteScoreJudgeType_LastScore,
344 NUM_TapNoteScoreJudgeType,
345 TapNoteScoreJudgeType_Invalid,
346};
347auto
348TapNoteScoreJudgeTypeToString(TapNoteScoreJudgeType jt) -> const std::string&;
349LuaDeclareType(TapNoteScoreJudgeType);
350
353enum ProfileSlot
354{
355 ProfileSlot_Player1,
356 ProfileSlot_Player2,
357 NUM_ProfileSlot,
358 ProfileSlot_Invalid
359};
360auto
361ProfileSlotToString(ProfileSlot ps) -> const std::string&;
362LuaDeclareType(ProfileSlot);
363
364extern const std::string RANKING_TO_FILL_IN_MARKER;
365inline auto
366IsRankingToFillIn(const std::string& sName) -> bool
367{
368 return !sName.empty() && sName[0] == '#';
369}
370
371// Group stuff
372extern const std::string GROUP_ALL;
373
375enum PlayerController
376{
377 PC_HUMAN,
378 PC_AUTOPLAY,
379 PC_CPU,
380 PC_REPLAY,
381 NUM_PlayerController,
382 PlayerController_Invalid
383};
384auto
385PlayerControllerToString(PlayerController pc) -> const std::string&;
386LuaDeclareType(PlayerController);
387
389enum HealthState
390{
391 HealthState_Hot,
392 HealthState_Alive,
393 HealthState_Danger,
394 HealthState_Dead,
395 NUM_HealthState,
396 HealthState_Invalid
397};
398LuaDeclareType(HealthState);
399
402{
407 void Add(float f);
412 [[nodiscard]] auto GetMin() const -> float;
417 [[nodiscard]] auto GetMax() const -> float;
424 [[nodiscard]] auto GetMaxWithin(float highest = FLT_MAX) const -> float;
429 [[nodiscard]] auto BpmIsConstant() const -> bool;
434 [[nodiscard]] auto IsSecret() const -> bool;
438 std::vector<float> vfBpms;
439};
440
442enum StyleType
443{
444 StyleType_OnePlayerOneSide,
445 StyleType_OnePlayerTwoSides,
446 NUM_StyleType,
447 StyleType_Invalid
448};
449auto
450StyleTypeToString(StyleType s) -> const std::string&;
451auto
452StringToStyleType(const std::string& s) -> StyleType;
453LuaDeclareType(StyleType);
454
468enum SampleMusicPreviewMode
469{
470 SampleMusicPreviewMode_Normal,
472 SampleMusicPreviewMode_StartToPreview,
473 SampleMusicPreviewMode_ScreenMusic,
476 SampleMusicPreviewMode_LastSong,
477 SampleMusicPreviewMode_Nothing, // music never plays
478 NUM_SampleMusicPreviewMode,
479 SampleMusicPreviewMode_Invalid,
480};
481auto SampleMusicPreviewModeToString(SampleMusicPreviewMode)
482 -> const std::string&;
483auto
484StringToSampleMusicPreviewMode(const std::string& s) -> SampleMusicPreviewMode;
485LuaDeclareType(SampleMusicPreviewMode);
486
493enum Stage
494{
495 Stage_1st,
496 Stage_2nd,
497 Stage_3rd,
498 Stage_4th,
499 Stage_5th,
500 Stage_6th,
501 Stage_Next,
504 Stage_Final,
505 Stage_Extra1,
506 Stage_Extra2,
507 Stage_Event,
508 Stage_Demo,
509 NUM_Stage,
510 Stage_Invalid,
511};
512auto
513StageToString(Stage s) -> const std::string&;
514LuaDeclareType(Stage);
515auto
516StageToLocalizedString(Stage i) -> const std::string&;
517
519enum ProfileLoadResult
520{
521 ProfileLoadResult_Success,
522 ProfileLoadResult_FailedNoProfile,
523 ProfileLoadResult_FailedTampered
524};
525
527enum MultiPlayerStatus
528{
529 MultiPlayerStatus_Joined,
530 MultiPlayerStatus_NotJoined,
531 MultiPlayerStatus_Unplugged,
532 MultiPlayerStatus_MissingMultitap,
533 NUM_MultiPlayerStatus,
534 MultiPlayerStatus_Invalid
535};
536auto
537MultiPlayerStatusToString(MultiPlayerStatus i) -> const std::string&;
538
540enum FailType
541{
542 FailType_Immediate,
543 FailType_ImmediateContinue,
545 FailType_Off,
546 NUM_FailType,
547 FailType_Invalid
548};
549
550auto
551FailTypeToString(FailType cat) -> const std::string&;
552auto
553FailTypeToLocalizedString(FailType cat) -> const std::string&;
554LuaDeclareType(FailType);
555
556#endif
The list of BPMs to display.
Definition GameConstantsAndTypes.h:402
auto GetMaxWithin(float highest=FLT_MAX) const -> float
Retrieve the maximum BPM of the set, but no higher than a certain value.
Definition GameConstantsAndTypes.cpp:362
auto GetMax() const -> float
Retrieve the maximum BPM of the set.
Definition GameConstantsAndTypes.cpp:356
void Add(float f)
Add a BPM to the list.
Definition GameConstantsAndTypes.cpp:337
auto BpmIsConstant() const -> bool
Determine if the BPM is really constant.
Definition GameConstantsAndTypes.cpp:373
std::vector< float > vfBpms
The list of the BPMs for the song.
Definition GameConstantsAndTypes.h:438
auto GetMin() const -> float
Retrieve the minimum BPM of the set.
Definition GameConstantsAndTypes.cpp:343
auto IsSecret() const -> bool
Determine if the BPM is meant to be a secret.
Definition GameConstantsAndTypes.cpp:379