OpenRCT2/src/openrct2/Game.h

191 lines
6.4 KiB
C
Raw Normal View History

/*****************************************************************************
* Copyright (c) 2014-2018 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"
struct ParkLoadResult;
struct rct_s6_data;
2015-03-07 12:13:10 +01:00
enum GAME_COMMAND
{
GAME_COMMAND_SET_RIDE_APPEARANCE,
GAME_COMMAND_SET_LAND_HEIGHT,
GAME_COMMAND_TOGGLE_PAUSE,
GAME_COMMAND_PLACE_TRACK,
GAME_COMMAND_REMOVE_TRACK,
GAME_COMMAND_LOAD_OR_QUIT,
2018-06-22 23:25:16 +02:00
GAME_COMMAND_CREATE_RIDE, // GA
GAME_COMMAND_DEMOLISH_RIDE,
GAME_COMMAND_SET_RIDE_STATUS, // GA
GAME_COMMAND_SET_RIDE_VEHICLES,
GAME_COMMAND_SET_RIDE_NAME, // GA
GAME_COMMAND_SET_RIDE_SETTING,
GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT,
GAME_COMMAND_REMOVE_RIDE_ENTRANCE_OR_EXIT,
GAME_COMMAND_REMOVE_SCENERY,
GAME_COMMAND_PLACE_SCENERY,
GAME_COMMAND_SET_WATER_HEIGHT,
GAME_COMMAND_PLACE_PATH,
GAME_COMMAND_PLACE_PATH_FROM_TRACK,
GAME_COMMAND_REMOVE_PATH,
GAME_COMMAND_CHANGE_SURFACE_STYLE,
GAME_COMMAND_SET_RIDE_PRICE,
GAME_COMMAND_SET_GUEST_NAME, // GA
GAME_COMMAND_SET_STAFF_NAME, // GA
GAME_COMMAND_RAISE_LAND,
GAME_COMMAND_LOWER_LAND,
GAME_COMMAND_EDIT_LAND_SMOOTH,
GAME_COMMAND_RAISE_WATER,
GAME_COMMAND_LOWER_WATER,
GAME_COMMAND_SET_BRAKES_SPEED,
GAME_COMMAND_HIRE_NEW_STAFF_MEMBER,
GAME_COMMAND_SET_STAFF_PATROL,
GAME_COMMAND_FIRE_STAFF_MEMBER,
GAME_COMMAND_SET_STAFF_ORDER,
2018-03-24 05:17:23 +01:00
GAME_COMMAND_SET_PARK_NAME, // GA
GAME_COMMAND_SET_PARK_OPEN,
GAME_COMMAND_BUY_LAND_RIGHTS,
GAME_COMMAND_PLACE_PARK_ENTRANCE, // GA
GAME_COMMAND_REMOVE_PARK_ENTRANCE,
GAME_COMMAND_SET_MAZE_TRACK,
GAME_COMMAND_SET_PARK_ENTRANCE_FEE, // GA
2018-06-22 23:25:16 +02:00
GAME_COMMAND_SET_STAFF_COLOUR, // GA
GAME_COMMAND_PLACE_WALL,
GAME_COMMAND_REMOVE_WALL, // GA
GAME_COMMAND_PLACE_LARGE_SCENERY,
GAME_COMMAND_REMOVE_LARGE_SCENERY,
2018-06-22 23:25:16 +02:00
GAME_COMMAND_SET_CURRENT_LOAN, // GA
GAME_COMMAND_SET_RESEARCH_FUNDING, // GA
GAME_COMMAND_PLACE_TRACK_DESIGN,
GAME_COMMAND_START_MARKETING_CAMPAIGN, // GA
GAME_COMMAND_PLACE_MAZE_DESIGN,
GAME_COMMAND_PLACE_BANNER,
GAME_COMMAND_REMOVE_BANNER,
GAME_COMMAND_SET_SCENERY_COLOUR,
GAME_COMMAND_SET_WALL_COLOUR,
GAME_COMMAND_SET_LARGE_SCENERY_COLOUR,
GAME_COMMAND_SET_BANNER_COLOUR,
GAME_COMMAND_SET_LAND_OWNERSHIP,
GAME_COMMAND_CLEAR_SCENERY,
GAME_COMMAND_SET_BANNER_NAME, // GA
2018-06-22 23:25:16 +02:00
GAME_COMMAND_SET_SIGN_NAME, // GA
GAME_COMMAND_SET_BANNER_STYLE,
GAME_COMMAND_SET_SIGN_STYLE,
GAME_COMMAND_SET_PLAYER_GROUP,
GAME_COMMAND_MODIFY_GROUPS,
GAME_COMMAND_KICK_PLAYER,
GAME_COMMAND_CHEAT,
GAME_COMMAND_PICKUP_GUEST,
GAME_COMMAND_PICKUP_STAFF,
GAME_COMMAND_BALLOON_PRESS,
GAME_COMMAND_MODIFY_TILE,
GAME_COMMAND_EDIT_SCENARIO_OPTIONS,
GAME_COMMAND_PLACE_PEEP_SPAWN, // GA, TODO: refactor to separate array for just game actions
GAME_COMMAND_SET_CLIMATE, // GA
GAME_COMMAND_SET_COLOUR_SCHEME, // GA
GAME_COMMAND_COUNT,
};
enum : uint32_t
{
2018-06-22 23:25:16 +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_2 = (1 << 2),
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED = (1 << 3), // Allow while paused
2018-06-22 23:25:16 +02:00
GAME_COMMAND_FLAG_4 = (1 << 4),
GAME_COMMAND_FLAG_5 = (1 << 5),
GAME_COMMAND_FLAG_GHOST = (1 << 6),
GAME_COMMAND_FLAG_PATH_SCENERY = (1 << 7),
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
};
using GAME_COMMAND_POINTER = void(
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
using GAME_COMMAND_CALLBACK_POINTER = void(
int32_t eax, int32_t ebx, int32_t ecx, int32_t edx, int32_t esi, int32_t edi, int32_t ebp);
2018-06-22 23:25:16 +02:00
extern GAME_COMMAND_CALLBACK_POINTER* game_command_callback;
int32_t game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback);
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_get_callback(uint32_t index);
extern int32_t game_command_playerid;
extern rct_string_id gGameCommandErrorTitle;
extern rct_string_id gGameCommandErrorText;
2018-06-22 23:25:16 +02:00
extern uint8_t gErrorType;
extern rct_string_id gErrorStringId;
2018-06-22 23:25:16 +02:00
extern GAME_COMMAND_POINTER* new_game_command_table[GAME_COMMAND_COUNT];
extern uint32_t gCurrentTicks;
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 int32_t gGameCommandNestLevel;
2018-06-22 23:25:16 +02:00
extern bool gGameCommandIsNetworked;
extern char gCurrentLoadedPath[260];
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;
extern uint8_t gUnk13CA740;
extern uint8_t gUnk141F568;
2016-09-10 15:46:53 +02:00
void game_increase_game_speed();
void game_reduce_game_speed();
2014-04-11 03:42:39 +02:00
void game_create_windows();
void reset_all_sprite_quadrant_placements();
2014-09-23 21:33:55 +02:00
void update_palette_effects();
int32_t game_do_command(int32_t eax, int32_t ebx, int32_t ecx, int32_t edx, int32_t esi, int32_t edi, int32_t ebp);
2018-06-22 23:25:16 +02:00
int32_t game_do_command_p(
uint32_t command, int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
2018-06-22 23:25:16 +02:00
void game_log_multiplayer_command(int command, const int* eax, const int* ebx, const int* ecx, int* edx, int* edi, int* ebp);
2014-05-02 23:21:08 +02:00
void game_load_or_quit_no_save_prompt();
2018-06-22 23:25:16 +02:00
void load_from_sv6(const char* path);
2015-07-05 17:19:01 +02:00
void game_load_init();
2018-06-22 23:25:16 +02:00
void game_pause_toggle(int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
void pause_toggle();
bool game_is_paused();
bool game_is_not_paused();
2015-08-22 12:56:32 +02:00
void save_game();
2018-06-22 23:25:16 +02:00
void* create_save_game_as_intent();
2015-08-22 12:56:32 +02:00
void save_game_as();
void save_game_cmd(const utf8* name = nullptr);
void save_game_with_name(const utf8* name);
2015-02-21 12:05:15 +01:00
void game_autosave();
2015-07-30 00:57:43 +02:00
void game_convert_strings_to_utf8();
void game_convert_news_items_to_utf8();
2018-06-22 23:25:16 +02:00
void game_convert_strings_to_rct2(rct_s6_data* s6);
void utf8_to_rct2_self(char* buffer, size_t length);
void rct2_to_utf8_self(char* buffer, size_t length);
void game_fix_save_vars();