OpenRCT2/src/openrct2/Game.h

180 lines
4.2 KiB
C
Raw Normal View History

/*****************************************************************************
* Copyright (c) 2014-2024 OpenRCT2 developers
2015-10-20 20:16:30 +02:00
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2015-10-20 20:16:30 +02:00
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
2015-10-20 20:16:30 +02:00
2017-11-30 18:17:06 +01:00
#pragma once
2015-03-07 12:13:10 +01:00
#include "common.h"
#include "core/String.hpp"
#include <memory>
#include <string>
class Intent;
struct ParkLoadResult;
2015-03-07 12:13:10 +01:00
enum class GameCommand : int32_t
{
SetRideAppearance,
SetLandHeight,
TogglePause,
PlaceTrack,
RemoveTrack,
LoadOrQuit,
CreateRide,
DemolishRide,
SetRideStatus,
SetRideVehicles,
SetRideName,
SetRideSetting,
PlaceRideEntranceOrExit,
RemoveRideEntranceOrExit,
RemoveScenery,
PlaceScenery,
SetWaterHeight,
PlacePath,
PlacePathLayout,
RemovePath,
ChangeSurfaceStyle,
SetRidePrice,
SetGuestName,
SetStaffName,
RaiseLand,
LowerLand,
EditLandSmooth,
RaiseWater,
LowerWater,
SetBrakesSpeed,
HireNewStaffMember,
SetStaffPatrol,
FireStaffMember,
SetStaffOrders,
SetParkName,
SetParkOpen,
BuyLandRights,
PlaceParkEntrance,
RemoveParkEntrance,
SetMazeTrack,
SetParkEntranceFee,
SetStaffColour,
PlaceWall,
RemoveWall,
PlaceLargeScenery,
RemoveLargeScenery,
SetCurrentLoan,
SetResearchFunding,
PlaceTrackDesign,
StartMarketingCampaign,
PlaceMazeDesign,
PlaceBanner,
RemoveBanner,
SetSceneryColour,
SetWallColour,
SetLargeSceneryColour,
SetBannerColour,
SetLandOwnership,
ClearScenery,
SetBannerName,
SetSignName,
SetBannerStyle,
SetSignStyle,
SetPlayerGroup,
ModifyGroups,
KickPlayer,
Cheat,
PickupGuest,
PickupStaff,
BalloonPress,
ModifyTile,
EditScenarioOptions,
PlacePeepSpawn,
SetClimate,
SetColourScheme,
SetStaffCostume,
PlaceFootpathAddition,
RemoveFootpathAddition,
GuestSetFlags,
SetDate,
Custom,
ChangeMapSize,
FreezeRideRating,
SetGameSpeed,
SetRestrictedScenery,
Count,
};
enum : uint32_t
{
2019-04-02 19:17:37 +02:00
GAME_COMMAND_FLAG_APPLY = (1 << 0), // If this flag is set, the command is applied, otherwise only the cost is retrieved
GAME_COMMAND_FLAG_REPLAY = (1 << 1), // Command was issued from replay manager.
GAME_COMMAND_FLAG_2 = (1 << 2), // Unused
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED = (1 << 3), // Allow while paused
2019-04-01 19:58:16 +02:00
GAME_COMMAND_FLAG_4 = (1 << 4), // Unused
GAME_COMMAND_FLAG_NO_SPEND = (1 << 5), // Game command is not networked
GAME_COMMAND_FLAG_GHOST = (1 << 6), // Game command is not networked
GAME_COMMAND_FLAG_TRACK_DESIGN = (1 << 7),
2018-06-22 23:25:16 +02:00
GAME_COMMAND_FLAG_NETWORKED = (1u << 31) // Game command is coming from network
};
enum
{
2018-06-22 23:25:16 +02:00
GAME_PAUSED_NORMAL = 1 << 0,
GAME_PAUSED_MODAL = 1 << 1,
GAME_PAUSED_SAVING_TRACK = 1 << 2,
};
enum
{
2018-06-22 23:25:16 +02:00
ERROR_TYPE_NONE = 0,
ERROR_TYPE_GENERIC = 254,
ERROR_TYPE_FILE_LOAD = 255
};
extern uint32_t gCurrentRealTimeTicks;
2016-04-23 03:49:24 +02:00
extern uint16_t gCurrentDeltaTime;
2018-06-22 23:25:16 +02:00
extern uint8_t gGamePaused;
extern int32_t gGameSpeed;
extern bool gDoSingleUpdate;
2018-06-22 23:25:16 +02:00
extern float gDayNightCycle;
extern bool gInUpdateCode;
extern bool gInMapInitCode;
extern std::string gCurrentLoadedPath;
extern bool gIsAutosave;
extern bool gIsAutosaveLoaded;
Feature: Preview title sequences in-game Title sequences can now be played back in-game, allowing for much easier editing. Improved title sequence playback in general. Clicking play while on a different title sequence will play the new one. Clicking stop will make the title screen go back to the config title sequence. And the closing the title sequence window will also make the game go back to the config title sequence, and reload the sequence if it was modified. Changes made to title sequences in-game are now correctly loaded in the title screen. Starting a title sequence within the editor will now always reset it even if it's the current playing sequence. (Not for playing in the editor though). Get Location in title sequence command editor now has 100% accuracy compared to before where it would usually get some offset value. Added `get_map_coordinates_from_pos_window` which will allow getting the viewport coordinates of a specific window even if the input coordinates are under another window. This has use with getting 2D positions from the main window without the other windows getting in the way. Options window will now always specify the config title sequence in the dropdown and not the current title sequence. Made a global variable `gLoadKeepWindowsOpen`, in game.h to keep windows open when loading a park. When loading a title sequence park in-game. The sequence player will force-close all park-specific windows ahead of time. Skipping while testing title sequences no longer needs to reload the park if the current playback position is already before the target position and ahead of the load position. Added changelog entry.
2017-10-30 12:07:01 +01:00
extern bool gLoadKeepWindowsOpen;
void GameResetSpeed();
void GameIncreaseGameSpeed();
void GameReduceGameSpeed();
void GameCreateWindows();
void ResetAllSpriteQuadrantPlacements();
void GameLoadOrQuitNoSavePrompt();
void GameLoadInit();
void GameLoadScripts();
void GameUnloadScripts();
void GameNotifyMapChange();
void GameNotifyMapChanged();
void PauseToggle();
bool GameIsPaused();
bool GameIsNotPaused();
void SaveGame();
std::unique_ptr<Intent> CreateSaveGameAsIntent();
void SaveGameAs();
void SaveGameCmd(u8string_view name = {});
void SaveGameWithName(u8string_view name);
void GameAutosave();
void RCT2StringToUTF8Self(char* buffer, size_t length);
void GameFixSaveVars();
void StartSilentRecord();
bool StopSilentRecord();
2022-03-07 21:40:48 +01:00
void PrepareMapForSave();