1 /*****************************************************************************
2  * Copyright (c) 2014-2020 OpenRCT2 developers
3  *
4  * For a complete list of all authors, please refer to contributors.md
5  * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
6  *
7  * OpenRCT2 is licensed under the GNU General Public License version 3.
8  *****************************************************************************/
9 
10 #pragma once
11 
12 #include "common.h"
13 
14 #include <string>
15 
16 struct ParkLoadResult;
17 struct rct_s6_data;
18 
19 enum class GameCommand : int32_t
20 {
21     SetRideAppearance,        // GA
22     SetLandHeight,            // GA
23     TogglePause,              // GA
24     PlaceTrack,               // GA
25     RemoveTrack,              // GA
26     LoadOrQuit,               // GA
27     CreateRide,               // GA
28     DemolishRide,             // GA
29     SetRideStatus,            // GA
30     SetRideVehicles,          // GA
31     SetRideName,              // GA
32     SetRideSetting,           // GA
33     PlaceRideEntranceOrExit,  // GA
34     RemoveRideEntranceOrExit, // GA
35     RemoveScenery,            // GA
36     PlaceScenery,             // GA
37     SetWaterHeight,           // GA
38     PlacePath,                // GA
39     PlacePathFromTrack,       // GA
40     RemovePath,               // GA
41     ChangeSurfaceStyle,       // GA
42     SetRidePrice,             // GA
43     SetGuestName,             // GA
44     SetStaffName,             // GA
45     RaiseLand,                // GA
46     LowerLand,                // GA
47     EditLandSmooth,           // GA
48     RaiseWater,               // GA
49     LowerWater,               // GA
50     SetBrakesSpeed,           // GA
51     HireNewStaffMember,       // GA
52     SetStaffPatrol,           // GA
53     FireStaffMember,          // GA
54     SetStaffOrders,           // GA
55     SetParkName,              // GA
56     SetParkOpen,              // GA
57     BuyLandRights,            // GA
58     PlaceParkEntrance,        // GA
59     RemoveParkEntrance,       // GA
60     SetMazeTrack,             // GA
61     SetParkEntranceFee,       // GA
62     SetStaffColour,           // GA
63     PlaceWall,                // GA
64     RemoveWall,               // GA
65     PlaceLargeScenery,        // GA
66     RemoveLargeScenery,       // GA
67     SetCurrentLoan,           // GA
68     SetResearchFunding,       // GA
69     PlaceTrackDesign,         // GA
70     StartMarketingCampaign,   // GA
71     PlaceMazeDesign,          // GA
72     PlaceBanner,              // GA
73     RemoveBanner,             // GA
74     SetSceneryColour,         // GA
75     SetWallColour,            // GA
76     SetLargeSceneryColour,    // GA
77     SetBannerColour,          // GA
78     SetLandOwnership,         // GA
79     ClearScenery,             // GA
80     SetBannerName,            // GA
81     SetSignName,              // GA
82     SetBannerStyle,           // GA
83     SetSignStyle,             // GA
84     SetPlayerGroup,           // GA
85     ModifyGroups,             // GA
86     KickPlayer,               // GA
87     Cheat,                    // GA
88     PickupGuest,              // GA
89     PickupStaff,              // GA
90     BalloonPress,             // GA
91     ModifyTile,               // GA
92     EditScenarioOptions,      // GA
93     PlacePeepSpawn,           // GA
94     SetClimate,               // GA
95     SetColourScheme,          // GA
96     SetStaffCostume,          // GA
97     PlaceFootpathAddition,    // GA
98     RemoveFootpathAddition,   // GA
99     GuestSetFlags,            // GA
100     SetDate,                  // GA
101     Custom,                   // GA
102     ChangeMapSize,
103     Count,
104 };
105 
106 enum : uint32_t
107 {
108     GAME_COMMAND_FLAG_APPLY = (1 << 0),  // If this flag is set, the command is applied, otherwise only the cost is retrieved
109     GAME_COMMAND_FLAG_REPLAY = (1 << 1), // Command was issued from replay manager.
110     GAME_COMMAND_FLAG_2 = (1 << 2),      // Unused
111     GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED = (1 << 3), // Allow while paused
112     GAME_COMMAND_FLAG_4 = (1 << 4),                   // Unused
113     GAME_COMMAND_FLAG_NO_SPEND = (1 << 5),            // Game command is not networked
114     GAME_COMMAND_FLAG_GHOST = (1 << 6),               // Game command is not networked
115     GAME_COMMAND_FLAG_PATH_SCENERY = (1 << 7),
116     GAME_COMMAND_FLAG_NETWORKED = (1u << 31) // Game command is coming from network
117 };
118 
119 enum
120 {
121     GAME_PAUSED_NORMAL = 1 << 0,
122     GAME_PAUSED_MODAL = 1 << 1,
123     GAME_PAUSED_SAVING_TRACK = 1 << 2,
124 };
125 
126 enum
127 {
128     ERROR_TYPE_NONE = 0,
129     ERROR_TYPE_GENERIC = 254,
130     ERROR_TYPE_FILE_LOAD = 255
131 };
132 
133 extern rct_string_id gGameCommandErrorTitle;
134 extern rct_string_id gGameCommandErrorText;
135 
136 extern uint32_t gCurrentTicks;
137 extern uint32_t gCurrentRealTimeTicks;
138 
139 extern uint16_t gCurrentDeltaTime;
140 extern uint8_t gGamePaused;
141 extern int32_t gGameSpeed;
142 extern bool gDoSingleUpdate;
143 extern float gDayNightCycle;
144 extern bool gInUpdateCode;
145 extern bool gInMapInitCode;
146 extern std::string gCurrentLoadedPath;
147 
148 extern bool gLoadKeepWindowsOpen;
149 
150 void game_reset_speed();
151 void game_increase_game_speed();
152 void game_reduce_game_speed();
153 
154 void game_create_windows();
155 void reset_all_sprite_quadrant_placements();
156 void update_palette_effects();
157 
158 void game_load_or_quit_no_save_prompt();
159 void load_from_sv6(const char* path);
160 void game_load_init();
161 void game_load_scripts();
162 void game_unload_scripts();
163 void pause_toggle();
164 bool game_is_paused();
165 bool game_is_not_paused();
166 void save_game();
167 void* create_save_game_as_intent();
168 void save_game_as();
169 void save_game_cmd(const utf8* name = nullptr);
170 void save_game_with_name(const utf8* name);
171 void game_autosave();
172 void game_convert_strings_to_utf8();
173 void game_convert_strings_to_rct2(rct_s6_data* s6);
174 void utf8_to_rct2_self(char* buffer, size_t length);
175 void rct2_to_utf8_self(char* buffer, size_t length);
176 void game_fix_save_vars();
177 void start_silent_record();
178 bool stop_silent_record();
179