Etterna 0.75.1
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 GameplayMode_Spectate,
56 NUM_GameplayMode,
57 GameplayMode_Invalid
58};
59
60auto
61SkillsetToString(Skillset ss) -> const std::string&;
62
63auto CalcPatternModToString(CalcPatternMod) -> const std::string&;
64auto CalcDiffValueToString(CalcDiffValue) -> const std::string&;
65auto CalcDebugMiscToString(CalcDebugMisc) -> const std::string&;
66
67enum NSScoreBoardColumn
68{
69 NSSB_NAMES = 0,
70 NSSB_COMBO,
71 NSSB_GRADE,
72 NUM_NSScoreBoardColumn,
73 NSScoreBoardColumn_Invalid
74};
75
76enum ValidationKey
77{
78 ValidationKey_Brittle,
79 ValidationKey_Weak,
80 NUM_ValidationKey,
81 ValidationKey_Invalid,
82};
83
84auto
85ValidationKeyToString(ValidationKey ss) -> const std::string&;
86
92enum RadarCategory
93{
94 RadarCategory_Notes,
95 RadarCategory_TapsAndHolds,
96 RadarCategory_Jumps,
97 RadarCategory_Holds,
98 RadarCategory_Mines,
99 RadarCategory_Hands,
100 RadarCategory_Rolls,
101 RadarCategory_Lifts,
102 RadarCategory_Fakes,
103 NUM_RadarCategory,
104 RadarCategory_Invalid
105};
111auto
112RadarCategoryToString(RadarCategory cat) -> const std::string&;
118auto
119RadarCategoryToLocalizedString(RadarCategory cat) -> const std::string&;
120LuaDeclareType(RadarCategory);
121
123enum StepsTypeCategory
124{
125 StepsTypeCategory_Single,
126 StepsTypeCategory_Double,
127};
128
130enum StepsType
131{
132 StepsType_dance_single = 0,
133 StepsType_dance_double,
134 StepsType_dance_solo,
135 StepsType_dance_threepanel,
136 StepsType_pump_single,
137 StepsType_pump_halfdouble,
138 StepsType_pump_double,
139 StepsType_kb7_single,
140 StepsType_ez2_single,
141 StepsType_ez2_double,
142 StepsType_ez2_real,
143 StepsType_ds3ddx_single,
144 StepsType_beat_single5,
145 StepsType_beat_double5,
146 StepsType_beat_single7,
147 StepsType_beat_double7,
148 StepsType_maniax_single,
149 StepsType_maniax_double,
150 StepsType_popn_five,
151 StepsType_popn_nine,
152 NUM_StepsType, // leave this at the end
153 StepsType_Invalid,
154};
155LuaDeclareType(StepsType);
156
160enum SortOrder
161{
162 SORT_GROUP,
163 SORT_TITLE,
164 SORT_BPM,
165 SORT_TOP_GRADES,
166 SORT_ARTIST,
167 SORT_GENRE,
168 SORT_MODE_MENU,
169 SORT_FAVORITES,
170 SORT_Overall,
171 SORT_Stream,
172 SORT_Jumpstream,
173 SORT_Handstream,
174 SORT_Stamina,
175 SORT_JackSpeed,
176 SORT_Chordjack,
177 SORT_Technical,
178 SORT_LENGTH,
179 SORT_DATE_ADDED,
180 SORT_CHART_AUTHOR,
181 SORT_Ungrouped,
183 NUM_SortOrder,
184 SortOrder_Invalid
185};
186
192auto
193SortOrderToString(SortOrder so) -> const std::string&;
199auto
200SortOrderToLocalizedString(SortOrder so) -> const std::string&;
206auto
207StringToSortOrder(const std::string& str) -> SortOrder;
208LuaDeclareType(SortOrder);
214inline auto
215IsSongSort(SortOrder so) -> bool
216{
217 return so >= SORT_GROUP && so <= SORT_GENRE;
218}
219
221enum TapNoteScore
222{
223 TNS_None,
224 TNS_HitMine,
225 TNS_AvoidMine,
226 TNS_CheckpointMiss,
227 TNS_Miss,
228 TNS_W5,
229 TNS_W4,
230 TNS_W3,
231 TNS_W2,
233 TNS_W1,
234 TNS_CheckpointHit,
235 NUM_TapNoteScore,
236 TapNoteScore_Invalid,
237};
243auto
244TapNoteScoreToString(TapNoteScore tns) -> const std::string&;
250auto
251TapNoteScoreToLocalizedString(TapNoteScore tns) -> const std::string&;
257auto
258StringToTapNoteScore(const std::string& str) -> TapNoteScore;
259LuaDeclareType(TapNoteScore);
260
262enum HoldNoteScore
263{
264 HNS_None,
265 HNS_LetGo,
266 HNS_Held,
268 HNS_Missed,
269 NUM_HoldNoteScore,
270 HoldNoteScore_Invalid,
271};
277auto
278HoldNoteScoreToString(HoldNoteScore hns) -> const std::string&;
279
285auto
286HoldNoteScoreToLocalizedString(HoldNoteScore hns) -> const std::string&;
292auto
293StringToHoldNoteScore(const std::string& str) -> HoldNoteScore;
294LuaDeclareType(HoldNoteScore);
295
297enum TimingWindow
298{
299 TW_W1,
300 TW_W2,
301 TW_W3,
302 TW_W4,
303 TW_W5,
304 TW_Mine,
305 TW_Hold,
306 TW_Roll,
307 TW_Checkpoint,
308 NUM_TimingWindow
309};
310auto
311TimingWindowToString(TimingWindow tw) -> const std::string&;
312
314enum ScoreEvent
315{
316 SE_CheckpointHit,
317 SE_W1,
318 SE_W2,
319 SE_W3,
320 SE_W4,
321 SE_W5,
322 SE_Miss,
323 SE_HitMine,
324 SE_CheckpointMiss,
325 SE_Held,
326 SE_LetGo,
327 SE_Missed,
328 NUM_ScoreEvent
329};
330auto
331ScoreEventToString(ScoreEvent se) -> const std::string&;
332
334enum GameButtonType
335{
336 GameButtonType_Step,
337 GameButtonType_Menu
338};
339
341enum TapNoteScoreJudgeType
342{
343 TapNoteScoreJudgeType_MinimumScore,
344 TapNoteScoreJudgeType_LastScore,
345 NUM_TapNoteScoreJudgeType,
346 TapNoteScoreJudgeType_Invalid,
347};
348auto
349TapNoteScoreJudgeTypeToString(TapNoteScoreJudgeType jt) -> const std::string&;
350LuaDeclareType(TapNoteScoreJudgeType);
351
354enum ProfileSlot
355{
356 ProfileSlot_Player1,
357 ProfileSlot_Player2,
358 NUM_ProfileSlot,
359 ProfileSlot_Invalid
360};
361auto
362ProfileSlotToString(ProfileSlot ps) -> const std::string&;
363LuaDeclareType(ProfileSlot);
364
365extern const std::string RANKING_TO_FILL_IN_MARKER;
366inline auto
367IsRankingToFillIn(const std::string& sName) -> bool
368{
369 return !sName.empty() && sName[0] == '#';
370}
371
372// Group stuff
373extern const std::string GROUP_ALL;
374
376enum PlayerController
377{
378 PC_HUMAN,
379 PC_AUTOPLAY,
380 PC_CPU,
381 PC_REPLAY,
382 PC_SPECTATE,
383 NUM_PlayerController,
384 PlayerController_Invalid
385};
386auto
387PlayerControllerToString(PlayerController pc) -> const std::string&;
388LuaDeclareType(PlayerController);
389
391enum HealthState
392{
393 HealthState_Hot,
394 HealthState_Alive,
395 HealthState_Danger,
396 HealthState_Dead,
397 NUM_HealthState,
398 HealthState_Invalid
399};
400LuaDeclareType(HealthState);
401
404{
409 void Add(float f);
414 [[nodiscard]] auto GetMin() const -> float;
419 [[nodiscard]] auto GetMax() const -> float;
426 [[nodiscard]] auto GetMaxWithin(float highest = FLT_MAX) const -> float;
431 [[nodiscard]] auto BpmIsConstant() const -> bool;
436 [[nodiscard]] auto IsSecret() const -> bool;
440 std::vector<float> vfBpms;
441};
442
444enum StyleType
445{
446 StyleType_OnePlayerOneSide,
447 StyleType_OnePlayerTwoSides,
448 NUM_StyleType,
449 StyleType_Invalid
450};
451auto
452StyleTypeToString(StyleType s) -> const std::string&;
453auto
454StringToStyleType(const std::string& s) -> StyleType;
455LuaDeclareType(StyleType);
456
470enum SampleMusicPreviewMode
471{
472 SampleMusicPreviewMode_Normal,
474 SampleMusicPreviewMode_StartToPreview,
475 SampleMusicPreviewMode_ScreenMusic,
478 SampleMusicPreviewMode_LastSong,
479 SampleMusicPreviewMode_Nothing, // music never plays
480 NUM_SampleMusicPreviewMode,
481 SampleMusicPreviewMode_Invalid,
482};
483auto SampleMusicPreviewModeToString(SampleMusicPreviewMode)
484 -> const std::string&;
485auto
486StringToSampleMusicPreviewMode(const std::string& s) -> SampleMusicPreviewMode;
487LuaDeclareType(SampleMusicPreviewMode);
488
495enum Stage
496{
497 Stage_1st,
498 Stage_2nd,
499 Stage_3rd,
500 Stage_4th,
501 Stage_5th,
502 Stage_6th,
503 Stage_Next,
506 Stage_Final,
507 Stage_Extra1,
508 Stage_Extra2,
509 Stage_Event,
510 Stage_Demo,
511 NUM_Stage,
512 Stage_Invalid,
513};
514auto
515StageToString(Stage s) -> const std::string&;
516LuaDeclareType(Stage);
517auto
518StageToLocalizedString(Stage i) -> const std::string&;
519
521enum ProfileLoadResult
522{
523 ProfileLoadResult_Success,
524 ProfileLoadResult_FailedNoProfile,
525 ProfileLoadResult_FailedTampered
526};
527
529enum MultiPlayerStatus
530{
531 MultiPlayerStatus_Joined,
532 MultiPlayerStatus_NotJoined,
533 MultiPlayerStatus_Unplugged,
534 MultiPlayerStatus_MissingMultitap,
535 NUM_MultiPlayerStatus,
536 MultiPlayerStatus_Invalid
537};
538auto
539MultiPlayerStatusToString(MultiPlayerStatus i) -> const std::string&;
540
542enum FailType
543{
544 FailType_Immediate,
545 FailType_ImmediateContinue,
547 FailType_Off,
548 NUM_FailType,
549 FailType_Invalid
550};
551
552auto
553FailTypeToString(FailType cat) -> const std::string&;
554auto
555FailTypeToLocalizedString(FailType cat) -> const std::string&;
556LuaDeclareType(FailType);
557
558#endif
The list of BPMs to display.
Definition GameConstantsAndTypes.h:404
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:367
auto GetMax() const -> float
Retrieve the maximum BPM of the set.
Definition GameConstantsAndTypes.cpp:361
void Add(float f)
Add a BPM to the list.
Definition GameConstantsAndTypes.cpp:342
auto BpmIsConstant() const -> bool
Determine if the BPM is really constant.
Definition GameConstantsAndTypes.cpp:378
std::vector< float > vfBpms
The list of the BPMs for the song.
Definition GameConstantsAndTypes.h:440
auto GetMin() const -> float
Retrieve the minimum BPM of the set.
Definition GameConstantsAndTypes.cpp:348
auto IsSecret() const -> bool
Determine if the BPM is meant to be a secret.
Definition GameConstantsAndTypes.cpp:384