Etterna 0.74.4
Loading...
Searching...
No Matches
GameCommand.h
1/* GameCommand */
2
3#ifndef GameCommand_H
4#define GameCommand_H
5
6#include "Command.h"
7#include "Difficulty.h"
8#include "GameConstantsAndTypes.h"
9#include "Etterna/Models/Lua/LuaReference.h"
10#include "PlayerNumber.h"
11#include <map>
12
13class Song;
14class Steps;
15class Style;
16struct Game;
17struct lua_State;
18
20{
21 public:
23 : m_sName("")
24 , m_sText("")
25 , m_sInvalidReason("")
26 , m_sAnnouncer("")
27 , m_sPreferredModifiers("")
28 , m_sStageModifiers("")
29 , m_sScreen("")
30 , m_sSongGroup("")
31 , m_sSoundPath("")
32 , m_sProfileID("")
33 {
34 m_LuaFunction.Unset();
35 }
36 void Init();
37
38 void Load(int iIndex, const Commands& cmds);
39 void LoadOne(const Command& cmd);
40
41 void ApplyToAllPlayers() const;
42 void Apply(PlayerNumber pn) const;
43
44 private:
45 void Apply(const std::vector<PlayerNumber>& vpns) const;
46 void ApplySelf(const std::vector<PlayerNumber>& vpns) const;
47
48 public:
49 [[nodiscard]] auto DescribesCurrentMode(PlayerNumber pn) const -> bool;
50 [[nodiscard]] auto DescribesCurrentModeForAllPlayers() const -> bool;
51 auto IsPlayable(std::string* why = nullptr) const -> bool;
52 [[nodiscard]] auto IsZero() const -> bool;
53
54 /* If true, Apply() will apply m_sScreen. If false, it won't, and you need
55 * to do it yourself. */
56 void ApplyCommitsScreens(bool bOn) { m_bApplyCommitsScreens = bOn; }
57
58 // Same as what was passed to Load. We need to keep the original commands
59 // so that we know the order of commands when it comes time to Apply.
60 Commands m_Commands;
61
62 std::string m_sName; // choice name
63 std::string m_sText; // display text
64 bool m_bInvalid{ true };
65 std::string m_sInvalidReason;
66 int m_iIndex{ -1 };
67 MultiPlayer m_MultiPlayer{ MultiPlayer_Invalid };
68 const Style* m_pStyle{ nullptr };
69 Difficulty m_dc{ Difficulty_Invalid };
70 std::string m_sAnnouncer;
71 std::string m_sPreferredModifiers;
72 std::string m_sStageModifiers;
73 std::string m_sScreen;
74 LuaReference m_LuaFunction;
75 Song* m_pSong{ nullptr };
76 Steps* m_pSteps{ nullptr };
77 std::map<std::string, std::string> m_SetEnv;
78 std::map<std::string, std::string> m_SetPref;
79 std::string m_sSongGroup;
80 SortOrder m_SortOrder{ SortOrder_Invalid };
81 std::string m_sSoundPath; // "" for no sound
82 std::vector<std::string> m_vsScreensToPrepare;
83 std::string m_sProfileID;
84 // sm-ssc adds:
85 bool m_bUrlExits{ true }; // for making stepmania not exit on url
86
87 bool m_bStopMusic{ false };
88 bool m_bApplyDefaultOptions{ false };
89 // sm-ssc also adds:
90 bool m_bFadeMusic{ false };
91 float m_fMusicFadeOutVolume{ -1 };
92 // currently, GameSoundManager uses consts for fade out/in times, so this
93 // is kind of pointless, but I want to have it working eventually. -aj
94 float m_fMusicFadeOutSeconds{ -1 };
95
96 // Lua
97 void PushSelf(lua_State* L);
98
99 private:
100 bool m_bApplyCommitsScreens{ true };
101};
102
103#endif
Definition Command.h:10
Definition Command.h:38
Definition GameCommand.h:20
A self-cleaning Lua reference.
Definition LuaReference.h:10
Holds all music metadata and steps for one song.
Definition Song.h:65
Holds note information for a Song.
Definition Steps.h:42
Definition Style.h:22
Holds information about a particular style of a game (e.g. "single", "double").
Definition Game.h:33