Move editor to C++; add defines for object limits

This commit is contained in:
Michael Steenbeek 2017-09-22 07:56:24 +02:00 committed by GitHub
parent 08eef61eb4
commit 1fd1d8c26b
25 changed files with 1017 additions and 901 deletions

View File

@ -200,7 +200,7 @@
F76C86021EC4E88300FA49E2 /* scrolling_text.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C83AE1EC4E7CC00FA49E2 /* scrolling_text.c */; };
F76C86031EC4E88300FA49E2 /* Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83AF1EC4E7CC00FA49E2 /* Sprite.cpp */; };
F76C86041EC4E88300FA49E2 /* string.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C83B01EC4E7CC00FA49E2 /* string.c */; };
F76C86051EC4E88300FA49E2 /* editor.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C83B11EC4E7CC00FA49E2 /* editor.c */; };
F76C86051EC4E88300FA49E2 /* Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83B11EC4E7CC00FA49E2 /* Editor.cpp */; };
F76C86071EC4E88300FA49E2 /* FileClassifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83B31EC4E7CC00FA49E2 /* FileClassifier.cpp */; };
F76C86091EC4E88300FA49E2 /* game.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C83B51EC4E7CC00FA49E2 /* game.c */; };
F76C860B1EC4E88300FA49E2 /* Imaging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83B71EC4E7CC00FA49E2 /* Imaging.cpp */; };
@ -978,8 +978,8 @@
F76C83AE1EC4E7CC00FA49E2 /* scrolling_text.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scrolling_text.c; sourceTree = "<group>"; };
F76C83AF1EC4E7CC00FA49E2 /* Sprite.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Sprite.cpp; sourceTree = "<group>"; };
F76C83B01EC4E7CC00FA49E2 /* string.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = string.c; sourceTree = "<group>"; };
F76C83B11EC4E7CC00FA49E2 /* editor.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = editor.c; sourceTree = "<group>"; };
F76C83B21EC4E7CC00FA49E2 /* editor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = editor.h; sourceTree = "<group>"; };
F76C83B11EC4E7CC00FA49E2 /* Editor.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; path = Editor.cpp; sourceTree = "<group>"; };
F76C83B21EC4E7CC00FA49E2 /* Editor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Editor.h; sourceTree = "<group>"; };
F76C83B31EC4E7CC00FA49E2 /* FileClassifier.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FileClassifier.cpp; sourceTree = "<group>"; };
F76C83B41EC4E7CC00FA49E2 /* FileClassifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FileClassifier.h; sourceTree = "<group>"; };
F76C83B51EC4E7CC00FA49E2 /* game.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = game.c; sourceTree = "<group>"; };
@ -1791,8 +1791,8 @@
F76C83771EC4E7CC00FA49E2 /* Context.h */,
F76C839B1EC4E7CC00FA49E2 /* diagnostic.c */,
F76C839C1EC4E7CC00FA49E2 /* diagnostic.h */,
F76C83B11EC4E7CC00FA49E2 /* editor.c */,
F76C83B21EC4E7CC00FA49E2 /* editor.h */,
F76C83B11EC4E7CC00FA49E2 /* Editor.cpp */,
F76C83B21EC4E7CC00FA49E2 /* Editor.h */,
F76C83B31EC4E7CC00FA49E2 /* FileClassifier.cpp */,
F76C83B41EC4E7CC00FA49E2 /* FileClassifier.h */,
F76C83B51EC4E7CC00FA49E2 /* game.c */,
@ -3148,7 +3148,7 @@
C666EE181F33E3800061AA04 /* EditorMain.cpp in Sources */,
F76C86031EC4E88300FA49E2 /* Sprite.cpp in Sources */,
F76C86041EC4E88300FA49E2 /* string.c in Sources */,
F76C86051EC4E88300FA49E2 /* editor.c in Sources */,
F76C86051EC4E88300FA49E2 /* Editor.cpp in Sources */,
F76C86071EC4E88300FA49E2 /* FileClassifier.cpp in Sources */,
F76C86091EC4E88300FA49E2 /* game.c in Sources */,
F76C860B1EC4E88300FA49E2 /* Imaging.cpp in Sources */,

View File

@ -16,7 +16,7 @@
#include <openrct2/audio/audio.h>
#include <openrct2/config/Config.h>
#include <openrct2/editor.h>
#include <openrct2/Editor.h>
#include <openrct2/game.h>
#include <openrct2/input.h>
#include <openrct2/interface/chat.h>

View File

@ -21,7 +21,7 @@
#include <openrct2/core/Util.hpp>
#include <openrct2-ui/windows/Window.h>
#include <openrct2/editor.h>
#include <openrct2/Editor.h>
#include <openrct2/input.h>
#include <openrct2/interface/widget.h>
#include <openrct2/localisation/localisation.h>
@ -181,7 +181,7 @@ static sint32 research_item_is_always_researched(rct_research_item *researchItem
static void research_rides_setup(){
// Reset all objects to not required
for (uint8 object_type = OBJECT_TYPE_RIDE; object_type < 11; object_type++){
uint8* in_use = gEditorSelectedObjects[object_type];
uint8* in_use = Editor::SelectedObjects[object_type];
for (uint8 num_objects = object_entry_group_counts[object_type]; num_objects != 0; num_objects--){
*in_use++ = 0;
}
@ -191,7 +191,7 @@ static void research_rides_setup(){
for (uint16 rideIndex = 0; rideIndex < 255; rideIndex++){
Ride * ride = get_ride(rideIndex);
if (ride->type == RIDE_TYPE_NULL)continue;
gEditorSelectedObjects[OBJECT_TYPE_RIDE][ride->subtype] |= 1;
Editor::SelectedObjects[OBJECT_TYPE_RIDE][ride->subtype] |= 1;
}
for (rct_research_item* research = gResearchItems; research->entryIndex != RESEARCHED_ITEMS_END; research++)
@ -221,7 +221,7 @@ static void research_rides_setup(){
continue;
// If master ride not in use
if (!(gEditorSelectedObjects[OBJECT_TYPE_RIDE][rideType] & (1 << 0)))
if (!(Editor::SelectedObjects[OBJECT_TYPE_RIDE][rideType] & (1 << 0)))
continue;
for (uint8 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++)
@ -242,7 +242,7 @@ static void research_rides_setup(){
if (!master_found){
// If not in use
if (!(gEditorSelectedObjects[OBJECT_TYPE_RIDE][object_index] & (1 << 0))) {
if (!(Editor::SelectedObjects[OBJECT_TYPE_RIDE][object_index] & (1 << 0))) {
continue;
}

View File

@ -18,7 +18,7 @@
#include <openrct2/core/Math.hpp>
#include <openrct2-ui/windows/Window.h>
#include <openrct2/editor.h>
#include <openrct2/Editor.h>
#include <openrct2/game.h>
#include <openrct2/interface/widget.h>
#include <openrct2/localisation/localisation.h>

View File

@ -19,7 +19,7 @@
#include <openrct2/ParkImporter.h>
#include <openrct2-ui/windows/Window.h>
#include <openrct2/editor.h>
#include <openrct2/Editor.h>
#include <openrct2/game.h>
#include <openrct2/input.h>
#include <openrct2/interface/widget.h>
@ -198,16 +198,16 @@ static void window_title_menu_dropdown(rct_window *w, rct_widgetindex widgetInde
if (widgetIndex == WIDX_GAME_TOOLS) {
switch (dropdownIndex) {
case 0:
editor_load();
Editor::Load();
break;
case 1:
editor_convert_save_to_scenario();
Editor::ConvertSaveToScenario();
break;
case 2:
trackdesigner_load();
Editor::LoadTrackDesigner();
break;
case 3:
trackmanager_load();
Editor::LoadTrackManager();
break;
}
}

View File

@ -50,7 +50,7 @@
#include "audio/audio.h"
#include "config/Config.h"
#include "drawing/lightfx.h"
#include "editor.h"
#include "Editor.h"
#include "game.h"
#include "input.h"
#include "interface/chat.h"
@ -512,9 +512,9 @@ namespace OpenRCT2
case STARTUP_ACTION_EDIT:
if (String::SizeOf(gOpenRCT2StartupActionPath) == 0)
{
editor_load();
Editor::Load();
}
else if (!editor_load_landscape(gOpenRCT2StartupActionPath))
else if (!Editor::LoadLandscape(gOpenRCT2StartupActionPath))
{
title_load();
}

810
src/openrct2/Editor.cpp Normal file
View File

@ -0,0 +1,810 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include "audio/audio.h"
#include "Context.h"
#include "core/Math.hpp"
#include "Editor.h"
#include "FileClassifier.h"
#include "game.h"
#include "interface/viewport.h"
#include "localisation/localisation.h"
#include "management/news_item.h"
#include "object_list.h"
#include "object/ObjectManager.h"
#include "OpenRCT2.h"
#include "peep/staff.h"
#include "rct1.h"
#include "ParkImporter.h"
#include "util/util.h"
#include "world/Climate.h"
namespace Editor
{
uint8 _editorSelectedRides[MAX_RIDE_OBJECTS];
uint8 _editorSelectedSmallScenery[MAX_SMALL_SCENERY_OBJECTS];
uint8 _editorSelectedLargeScenery[MAX_LARGE_SCENERY_OBJECTS];
uint8 _editorSelectedWalls[MAX_WALL_SCENERY_OBJECTS];
uint8 _editorSelectedBanners[MAX_BANNER_OBJECTS];
uint8 _editorSelectedFootpaths[MAX_PATH_OBJECTS];
uint8 _editorSelectedFootpathAdditions[MAX_PATH_ADDITION_OBJECTS];
uint8 _editorSelectedSceneryGroups[MAX_SCENERY_GROUP_OBJECTS];
uint8 _editorSelectedParkEntrances[MAX_PARK_ENTRANCE_OBJECTS];
uint8 _editorSelectedWaters[MAX_WATER_OBJECTS];
uint8 _editorSelectedStexs[MAX_SCENARIO_TEXT_OBJECTS];
uint8 * SelectedObjects[OBJECT_ENTRY_GROUP_COUNT] =
{
_editorSelectedRides,
_editorSelectedSmallScenery,
_editorSelectedLargeScenery,
_editorSelectedWalls,
_editorSelectedBanners,
_editorSelectedFootpaths,
_editorSelectedFootpathAdditions,
_editorSelectedSceneryGroups,
_editorSelectedParkEntrances,
_editorSelectedWaters,
_editorSelectedStexs,
};
static void ConvertSaveToScenarioCallback(sint32 result, const utf8 * path);
static void SetAllLandOwned();
static bool LoadLandscapeFromSV4(const char * path);
static bool LoadLandscapeFromSC4(const char * path);
static void FinaliseMainView();
static bool ReadS6(const char * path);
static void ClearMapForEditing(bool fromSave);
/**
*
* rct2: 0x0066FFE1
*/
void Load()
{
audio_stop_all_music_and_sounds();
object_manager_unload_all_objects();
object_list_load();
game_init_all(150);
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION;
gParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
gS6Info.category = SCENARIO_CATEGORY_OTHER;
viewport_init_all();
rct_window * mainWindow = window_editor_main_open();
window_set_location(mainWindow, 2400, 2400, 112);
load_palette();
gScreenAge = 0;
safe_strcpy(gScenarioName, language_get_string(STR_MY_NEW_SCENARIO), 64);
}
/**
*
* rct2: 0x00672781
*/
void ConvertSaveToScenario()
{
tool_cancel();
window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, NULL);
window_loadsave_set_loadsave_callback(ConvertSaveToScenarioCallback);
}
static void ConvertSaveToScenarioCallback(sint32 result, const utf8 * path)
{
if (result != MODAL_RESULT_OK)
{
return;
}
if (!context_load_park_from_file(path))
{
return;
}
if (gParkFlags & PARK_FLAGS_NO_MONEY)
{
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
}
else
{
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
}
gParkFlags |= PARK_FLAGS_NO_MONEY;
safe_strcpy(gS6Info.name, gScenarioName, 64);
safe_strcpy(gS6Info.details, gScenarioDetails, 256);
gS6Info.objective_type = gScenarioObjectiveType;
gS6Info.objective_arg_1 = gScenarioObjectiveYear;
gS6Info.objective_arg_2 = gScenarioObjectiveCurrency;
gS6Info.objective_arg_3 = gScenarioObjectiveNumGuests;
climate_reset(gClimate);
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
gS6Info.editor_step = EDITOR_STEP_OBJECTIVE_SELECTION;
gS6Info.category = SCENARIO_CATEGORY_OTHER;
viewport_init_all();
news_item_init_queue();
window_editor_main_open();
FinaliseMainView();
gScreenAge = 0;
}
/**
*
* rct2: 0x00672957
*/
void LoadTrackDesigner()
{
audio_stop_all_music_and_sounds();
gScreenFlags = SCREEN_FLAGS_TRACK_DESIGNER;
gScreenAge = 0;
object_manager_unload_all_objects();
object_list_load();
game_init_all(150);
SetAllLandOwned();
gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION;
viewport_init_all();
rct_window * mainWindow = window_editor_main_open();
window_set_location(mainWindow, 2400, 2400, 112);
load_palette();
}
/**
*
* rct2: 0x006729FD
*/
void LoadTrackManager()
{
audio_stop_all_music_and_sounds();
gScreenFlags = SCREEN_FLAGS_TRACK_MANAGER;
gScreenAge = 0;
object_manager_unload_all_objects();
object_list_load();
game_init_all(150);
SetAllLandOwned();
gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION;
viewport_init_all();
rct_window * mainWindow = window_editor_main_open();
window_set_location(mainWindow, 2400, 2400, 112);
load_palette();
}
/**
*
* rct2: 0x0068ABEC
*/
static void SetAllLandOwned()
{
sint32 mapSize = gMapSize;
game_do_command(64, 1, 64, 2, GAME_COMMAND_SET_LAND_OWNERSHIP, (mapSize - 3) * 32, (mapSize - 3) * 32);
}
/**
*
* rct2: 0x006758C0
*/
bool LoadLandscape(const utf8 * path)
{
// #4996: Make sure the object selection window closes here to prevent unload objects
// after we have loaded a new park.
window_close_all();
uint32 extension = get_file_extension_type(path);
switch (extension)
{
case FILE_EXTENSION_SC6:
case FILE_EXTENSION_SV6:
return ReadS6(path);
case FILE_EXTENSION_SC4:
return LoadLandscapeFromSC4(path);
case FILE_EXTENSION_SV4:
return LoadLandscapeFromSV4(path);
default:
return false;
}
}
/**
*
* rct2: 0x006A2B02
*/
static bool LoadLandscapeFromSV4(const char * path)
{
load_from_sv4(path);
ClearMapForEditing(true);
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
gScreenAge = 0;
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
viewport_init_all();
window_editor_main_open();
FinaliseMainView();
return true;
}
static bool LoadLandscapeFromSC4(const char * path)
{
load_from_sc4(path);
ClearMapForEditing(false);
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
gScreenAge = 0;
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
viewport_init_all();
window_editor_main_open();
FinaliseMainView();
return true;
}
/**
*
* rct2: 0x006758FE
*/
static bool ReadS6(const char * path)
{
ParkLoadResult * loadResult = NULL;
const char * extension = path_get_extension(path);
if (_stricmp(extension, ".sc6") == 0)
{
loadResult = load_from_sc6(path);
}
else if (_stricmp(extension, ".sv6") == 0)
{
loadResult = load_from_sv6(path);
}
if (ParkLoadResult_GetError(loadResult) != PARK_LOAD_ERROR_OK)
{
ParkLoadResult_Delete(loadResult);
return false;
}
ParkLoadResult_Delete(loadResult);
ClearMapForEditing(true);
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
gScreenAge = 0;
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
viewport_init_all();
window_editor_main_open();
FinaliseMainView();
return true;
}
static void ClearMapForEditing(bool fromSave)
{
map_remove_all_rides();
//
for (sint32 i = 0; i < MAX_BANNERS; i++)
{
if (gBanners[i].type == 255)
{
gBanners[i].flags &= ~BANNER_FLAG_LINKED_TO_RIDE;
}
}
//
{
sint32 i;
Ride * ride;
FOR_ALL_RIDES(i, ride)
{
user_string_free(ride->name);
}
}
ride_init_all();
//
for (sint32 i = 0; i < MAX_SPRITES; i++)
{
rct_sprite * sprite = get_sprite(i);
user_string_free(sprite->unknown.name_string_idx);
}
reset_sprite_list();
staff_reset_modes();
gNumGuestsInPark = 0;
gNumGuestsHeadingForPark = 0;
gNumGuestsInParkLastWeek = 0;
gGuestChangeModifier = 0;
if (fromSave)
{
research_populate_list_random();
research_remove_non_separate_vehicle_types();
if (gParkFlags & PARK_FLAGS_NO_MONEY)
{
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
}
else
{
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
}
gParkFlags |= PARK_FLAGS_NO_MONEY;
if (gParkEntranceFee == 0)
{
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
}
else
{
gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
}
gParkFlags &= ~PARK_FLAGS_SPRITES_INITIALISED;
gGuestInitialCash = Math::Clamp((money16)MONEY(10, 00), gGuestInitialCash, (money16)MONEY(100, 00));
gInitialCash = Math::Min(gInitialCash, 100000);
finance_reset_cash_to_initial();
gBankLoan = Math::Clamp(
MONEY(0, 00),
gBankLoan,
MONEY(5000000, 00)
);
gMaxBankLoan = Math::Clamp(
MONEY(0, 00),
gMaxBankLoan,
MONEY(5000000, 00)
);
gBankLoanInterestRate = Math::Clamp((uint8)5, gBankLoanInterestRate, (uint8)80);
}
climate_reset(gClimate);
news_item_init_queue();
}
/**
*
* rct2: 0x0067009A
*/
void OpenWindowsForCurrentStep()
{
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
{
return;
}
switch (gS6Info.editor_step)
{
case EDITOR_STEP_OBJECT_SELECTION:
if (window_find_by_class(WC_EDITOR_OBJECT_SELECTION))
{
return;
}
if (window_find_by_class(WC_INSTALL_TRACK))
{
return;
}
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)
{
object_manager_unload_all_objects();
}
window_editor_object_selection_open();
break;
case EDITOR_STEP_INVENTIONS_LIST_SET_UP:
if (window_find_by_class(WC_EDITOR_INVENTION_LIST))
{
return;
}
context_open_window(WC_EDITOR_INVENTION_LIST);
break;
case EDITOR_STEP_OPTIONS_SELECTION:
if (window_find_by_class(WC_EDITOR_SCENARIO_OPTIONS))
{
return;
}
context_open_window(WC_EDITOR_SCENARIO_OPTIONS);
break;
case EDITOR_STEP_OBJECTIVE_SELECTION:
if (window_find_by_class(WC_EDTIOR_OBJECTIVE_OPTIONS))
{
return;
}
context_open_window(WC_EDTIOR_OBJECTIVE_OPTIONS);
break;
}
}
static void FinaliseMainView()
{
rct_window * w = window_get_main();
rct_viewport * viewport = w->viewport;
w->viewport_target_sprite = SPRITE_INDEX_NULL;
w->saved_view_x = gSavedViewX;
w->saved_view_y = gSavedViewY;
gCurrentRotation = gSavedViewRotation;
sint32 zoom_difference = gSavedViewZoom - viewport->zoom;
viewport->zoom = gSavedViewZoom;
if (zoom_difference != 0)
{
if (zoom_difference >= 0)
{
viewport->view_width <<= zoom_difference;
viewport->view_height <<= zoom_difference;
}
else
{
zoom_difference = -zoom_difference;
viewport->view_width >>= zoom_difference;
viewport->view_height >>= zoom_difference;
}
}
w->saved_view_x -= viewport->view_width >> 1;
w->saved_view_y -= viewport->view_height >> 1;
window_invalidate(w);
reset_all_sprite_quadrant_placements();
scenery_set_default_placement_configuration();
window_new_ride_init_vars();
gWindowUpdateTicks = 0;
load_palette();
window_tile_inspector_clear_clipboard();
}
/**
*
* rct2: 0x006AB9B8
*/
sint32 CheckObjectSelection()
{
bool isTrackDesignerManager =
gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER);
if (!isTrackDesignerManager)
{
if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_PATHS))
{
gGameCommandErrorText = STR_AT_LEAST_ONE_PATH_OBJECT_MUST_BE_SELECTED;
return OBJECT_TYPE_PATHS;
}
}
if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_RIDE))
{
gGameCommandErrorText = STR_AT_LEAST_ONE_RIDE_OBJECT_MUST_BE_SELECTED;
return OBJECT_TYPE_RIDE;
}
if (!isTrackDesignerManager)
{
if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_PARK_ENTRANCE))
{
gGameCommandErrorText = STR_PARK_ENTRANCE_TYPE_MUST_BE_SELECTED;
return OBJECT_TYPE_PARK_ENTRANCE;
}
if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_WATER))
{
gGameCommandErrorText = STR_WATER_TYPE_MUST_BE_SELECTED;
return OBJECT_TYPE_WATER;
}
}
return -1;
}
/**
*
* rct2: 0x0066FEAC
*/
bool CheckPark()
{
sint32 parkSize = park_calculate_size();
if (parkSize == 0)
{
gGameCommandErrorText = STR_PARK_MUST_OWN_SOME_LAND;
return false;
}
for (sint32 i = 0; i < MAX_PARK_ENTRANCES; i++)
{
if (gParkEntrances[i].x != MAP_LOCATION_NULL)
{
break;
}
if (i == MAX_PARK_ENTRANCES - 1)
{
gGameCommandErrorText = STR_NO_PARK_ENTRANCES;
return false;
}
}
for (sint32 i = 0; i < MAX_PARK_ENTRANCES; i++)
{
if (gParkEntrances[i].x == MAP_LOCATION_NULL)
{
continue;
}
sint32 x = gParkEntrances[i].x;
sint32 y = gParkEntrances[i].y;
sint32 z = gParkEntrances[i].z / 8;
sint32 direction = gParkEntrances[i].direction ^2;
switch (footpath_is_connected_to_map_edge(x, y, z, direction, 0))
{
case FOOTPATH_SEARCH_NOT_FOUND:
gGameCommandErrorText = STR_PARK_ENTRANCE_WRONG_DIRECTION_OR_NO_PATH;
return false;
case FOOTPATH_SEARCH_INCOMPLETE:
case FOOTPATH_SEARCH_TOO_COMPLEX:
gGameCommandErrorText = STR_PARK_ENTRANCE_PATH_INCOMPLETE_OR_COMPLEX;
return false;
case FOOTPATH_SEARCH_SUCCESS:
// Run the search again and unown the path
footpath_is_connected_to_map_edge(x, y, z, direction, (1 << 5));
break;
}
}
for (sint32 i = 0; i < MAX_PEEP_SPAWNS; i++)
{
if (gPeepSpawns[i].x != PEEP_SPAWN_UNDEFINED)
{
break;
}
if (i == MAX_PEEP_SPAWNS - 1)
{
gGameCommandErrorText = STR_PEEP_SPAWNS_NOT_SET;
return false;
}
}
return true;
}
void GameCommandEditScenarioOptions(sint32 * eax, sint32 * ebx, sint32 * ecx, sint32 * edx, sint32 * esi, sint32 * edi, sint32 * ebp)
{
if (!(*ebx & GAME_COMMAND_FLAG_APPLY))
{
*ebx = 0;
return;
}
switch (*ecx)
{
case EDIT_SCENARIOOPTIONS_SETNOMONEY:
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
{
if (*edx != 0)
{
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
}
else
{
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
}
}
else
{
if (*edx != 0)
{
gParkFlags |= PARK_FLAGS_NO_MONEY;
}
else
{
gParkFlags &= ~PARK_FLAGS_NO_MONEY;
}
// Invalidate all windows that have anything to do with finance
window_invalidate_by_class(WC_RIDE);
window_invalidate_by_class(WC_PEEP);
window_invalidate_by_class(WC_PARK_INFORMATION);
window_invalidate_by_class(WC_FINANCES);
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
window_invalidate_by_class(WC_TOP_TOOLBAR);
}
break;
case EDIT_SCENARIOOPTIONS_SETINITIALCASH:
gInitialCash = Math::Clamp(MONEY(0, 00), *edx, MONEY(1000000, 00));
gCashEncrypted = ENCRYPT_MONEY(gInitialCash);
window_invalidate_by_class(WC_FINANCES);
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
break;
case EDIT_SCENARIOOPTIONS_SETINITIALLOAN:
gBankLoan = Math::Clamp(MONEY(0, 00), *edx, MONEY(5000000, 00));
gMaxBankLoan = Math::Max(gBankLoan, gMaxBankLoan);
window_invalidate_by_class(WC_FINANCES);
break;
case EDIT_SCENARIOOPTIONS_SETMAXIMUMLOANSIZE:
gMaxBankLoan = Math::Clamp(MONEY(0, 00), *edx, MONEY(5000000, 00));
gBankLoan = Math::Min(gBankLoan, gMaxBankLoan);
window_invalidate_by_class(WC_FINANCES);
break;
case EDIT_SCENARIOOPTIONS_SETANNUALINTERESTRATE:
gBankLoanInterestRate = Math::Clamp(0, *edx, 80);
window_invalidate_by_class(WC_FINANCES);
break;
case EDIT_SCENARIOOPTIONS_SETFORBIDMARKETINGCAMPAIGNS:
if (*edx != 0)
{
gParkFlags |= PARK_FLAGS_FORBID_MARKETING_CAMPAIGN;
}
else
{
gParkFlags &= ~PARK_FLAGS_FORBID_MARKETING_CAMPAIGN;
}
break;
case EDIT_SCENARIOOPTIONS_SETAVERAGECASHPERGUEST:
gGuestInitialCash = Math::Clamp(MONEY(0, 00), *edx, MONEY(1000, 00));
break;
case EDIT_SCENARIOOPTIONS_SETGUESTINITIALHAPPINESS:
gGuestInitialHappiness = Math::Clamp(40, *edx, 250);
break;
case EDIT_SCENARIOOPTIONS_SETGUESTINITIALHUNGER:
gGuestInitialHunger = Math::Clamp(40, *edx, 250);
break;
case EDIT_SCENARIOOPTIONS_SETGUESTINITIALTHIRST:
gGuestInitialThirst = Math::Clamp(40, *edx, 250);
break;
case EDIT_SCENARIOOPTIONS_SETGUESTSPREFERLESSINTENSERIDES:
if (*edx != 0)
{
gParkFlags |= PARK_FLAGS_PREF_LESS_INTENSE_RIDES;
}
else
{
gParkFlags &= ~PARK_FLAGS_PREF_LESS_INTENSE_RIDES;
}
break;
case EDIT_SCENARIOOPTIONS_SETGUESTSPREFERMOREINTENSERIDES:
if (*edx != 0)
{
gParkFlags |= PARK_FLAGS_PREF_MORE_INTENSE_RIDES;
}
else
{
gParkFlags &= ~PARK_FLAGS_PREF_MORE_INTENSE_RIDES;
}
break;
case EDIT_SCENARIOOPTIONS_SETCOSTTOBUYLAND:
gLandPrice = Math::Clamp(MONEY(5, 00), *edx, MONEY(200, 00));
break;
case EDIT_SCENARIOOPTIONS_SETCOSTTOBUYCONSTRUCTIONRIGHTS:
gConstructionRightsPrice = Math::Clamp(MONEY(5, 00), *edx, MONEY(200, 00));
break;
case EDIT_SCENARIOOPTIONS_SETPARKCHARGEMETHOD:
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
{
if (*edx == 0)
{
if (!(gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY))
{
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
gParkEntranceFee = MONEY(0, 00);
}
}
else
{
if (gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY)
{
gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
gParkEntranceFee = MONEY(10, 00);
}
}
}
else
{
if (*edx == 0)
{
if (!(gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY))
{
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
}
}
else
{
if (gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY)
{
gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
}
}
window_invalidate_by_class(WC_PARK_INFORMATION);
window_invalidate_by_class(WC_RIDE);
}
break;
case EDIT_SCENARIOOPTIONS_SETPARKCHARGEENTRYFEE:
gParkEntranceFee = Math::Clamp(MONEY(0, 00), *edx, MONEY(100, 00));
window_invalidate_by_class(WC_PARK_INFORMATION);
break;
case EDIT_SCENARIOOPTIONS_SETFORBIDTREEREMOVAL:
if (*edx != 0)
{
gParkFlags |= PARK_FLAGS_FORBID_TREE_REMOVAL;
}
else
{
gParkFlags &= ~PARK_FLAGS_FORBID_TREE_REMOVAL;
}
break;
case EDIT_SCENARIOOPTIONS_SETFORBIDLANDSCAPECHANGES:
if (*edx != 0)
{
gParkFlags |= PARK_FLAGS_FORBID_LANDSCAPE_CHANGES;
}
else
{
gParkFlags &= ~PARK_FLAGS_FORBID_LANDSCAPE_CHANGES;
}
break;
case EDIT_SCENARIOOPTIONS_SETFORBIDHIGHCONSTRUCTION:
if (*edx != 0)
{
gParkFlags |= PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
}
else
{
gParkFlags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
}
break;
case EDIT_SCENARIOOPTIONS_SETPARKRATINGHIGHERDIFFICULTLEVEL:
if (*edx != 0)
{
gParkFlags |= PARK_FLAGS_DIFFICULT_PARK_RATING;
}
else
{
gParkFlags &= ~PARK_FLAGS_DIFFICULT_PARK_RATING;
}
break;
case EDIT_SCENARIOOPTIONS_SETGUESTGENERATIONHIGHERDIFFICULTLEVEL:
if (*edx != 0)
{
gParkFlags |= PARK_FLAGS_DIFFICULT_GUEST_GENERATION;
}
else
{
gParkFlags &= ~PARK_FLAGS_DIFFICULT_GUEST_GENERATION;
}
break;
}
window_invalidate_by_class(WC_EDITOR_SCENARIO_OPTIONS);
*ebx = 0;
}
}
extern "C"
{
void editor_open_windows_for_current_step()
{
Editor::OpenWindowsForCurrentStep();
}
void game_command_edit_scenario_options(sint32 * eax, sint32 * ebx, sint32 * ecx, sint32 * edx, sint32 * esi, sint32 * edi, sint32 * ebp)
{
Editor::GameCommandEditScenarioOptions(eax, ebx, ecx, edx, esi, edi, ebp);
}
}

93
src/openrct2/Editor.h Normal file
View File

@ -0,0 +1,93 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#ifndef _EDITOR_H_
#define _EDITOR_H_
#include "common.h"
#include "object.h"
#ifdef __cplusplus
#include "object.h"
namespace Editor
{
extern uint8 * SelectedObjects[OBJECT_ENTRY_GROUP_COUNT];
void Load();
void ConvertSaveToScenario();
void LoadTrackDesigner();
void LoadTrackManager();
bool LoadLandscape(const utf8 *path);
bool CheckPark();
sint32 CheckObjectSelection();
void OpenWindowsForCurrentStep();
void GameCommandEditScenarioOptions(sint32*, sint32*, sint32*, sint32*, sint32*, sint32*, sint32*);
}
bool editor_check_object_group_at_least_one_selected(sint32 objectType);
extern "C"
{
#endif
typedef enum
{
EDITOR_STEP_OBJECT_SELECTION, // 0
EDITOR_STEP_LANDSCAPE_EDITOR, // 1
EDITOR_STEP_INVENTIONS_LIST_SET_UP, // 2
EDITOR_STEP_OPTIONS_SELECTION, // 3
EDITOR_STEP_OBJECTIVE_SELECTION, // 4
EDITOR_STEP_SAVE_SCENARIO, // 5
EDITOR_STEP_ROLLERCOASTER_DESIGNER, // 6
EDITOR_STEP_TRACK_DESIGNS_MANAGER // 7
} RCT2_EDITOR_STEP;
enum
{
EDIT_SCENARIOOPTIONS_SETNOMONEY,
EDIT_SCENARIOOPTIONS_SETINITIALCASH,
EDIT_SCENARIOOPTIONS_SETINITIALLOAN,
EDIT_SCENARIOOPTIONS_SETMAXIMUMLOANSIZE,
EDIT_SCENARIOOPTIONS_SETANNUALINTERESTRATE,
EDIT_SCENARIOOPTIONS_SETFORBIDMARKETINGCAMPAIGNS,
EDIT_SCENARIOOPTIONS_SETAVERAGECASHPERGUEST,
EDIT_SCENARIOOPTIONS_SETGUESTINITIALHAPPINESS,
EDIT_SCENARIOOPTIONS_SETGUESTINITIALHUNGER,
EDIT_SCENARIOOPTIONS_SETGUESTINITIALTHIRST,
EDIT_SCENARIOOPTIONS_SETGUESTSPREFERLESSINTENSERIDES,
EDIT_SCENARIOOPTIONS_SETGUESTSPREFERMOREINTENSERIDES,
EDIT_SCENARIOOPTIONS_SETCOSTTOBUYLAND,
EDIT_SCENARIOOPTIONS_SETCOSTTOBUYCONSTRUCTIONRIGHTS,
EDIT_SCENARIOOPTIONS_SETPARKCHARGEMETHOD,
EDIT_SCENARIOOPTIONS_SETPARKCHARGEENTRYFEE,
EDIT_SCENARIOOPTIONS_SETFORBIDTREEREMOVAL,
EDIT_SCENARIOOPTIONS_SETFORBIDLANDSCAPECHANGES,
EDIT_SCENARIOOPTIONS_SETFORBIDHIGHCONSTRUCTION,
EDIT_SCENARIOOPTIONS_SETPARKRATINGHIGHERDIFFICULTLEVEL,
EDIT_SCENARIOOPTIONS_SETGUESTGENERATIONHIGHERDIFFICULTLEVEL,
};
void editor_open_windows_for_current_step();
void game_command_edit_scenario_options(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -16,7 +16,7 @@
#include "cheats.h"
#include "config/Config.h"
#include "editor.h"
#include "Editor.h"
#include "game.h"
#include "interface/window.h"
#include "localisation/localisation.h"

View File

@ -1,714 +0,0 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include "audio/audio.h"
#include "Context.h"
#include "drawing/drawing.h"
#include "editor.h"
#include "FileClassifier.h"
#include "game.h"
#include "interface/viewport.h"
#include "interface/window.h"
#include "localisation/date.h"
#include "localisation/localisation.h"
#include "management/finance.h"
#include "management/news_item.h"
#include "network/network.h"
#include "object.h"
#include "object/ObjectManager.h"
#include "OpenRCT2.h"
#include "peep/staff.h"
#include "platform/platform.h"
#include "rct1.h"
#include "rct2/addresses.h"
#include "ride/ride.h"
#include "ParkImporter.h"
#include "scenario/scenario.h"
#include "util/sawyercoding.h"
#include "util/util.h"
#include "world/Climate.h"
#include "world/banner.h"
#include "world/entrance.h"
#include "world/footpath.h"
#include "world/map.h"
#include "world/park.h"
#include "world/scenery.h"
#include "world/sprite.h"
#include "Context.h"
uint8 _editorSelectedRides[128];
uint8 _editorSelectedSmallScenery[252];
uint8 _editorSelectedLargeScenery[128];
uint8 _editorSelectedWalls[128];
uint8 _editorSelectedBanners[32];
uint8 _editorSelectedFootpaths[16];
uint8 _editorSelectedFootpathAdditions[15];
uint8 _editorSelectedSceneryGroups[19];
uint8 _editorSelectedParkEntrances[1];
uint8 _editorSelectedWaters[1];
uint8 _editorSelectedStexs[1];
uint8 * gEditorSelectedObjects[OBJECT_ENTRY_GROUP_COUNT] = {
_editorSelectedRides,
_editorSelectedSmallScenery,
_editorSelectedLargeScenery,
_editorSelectedWalls,
_editorSelectedBanners,
_editorSelectedFootpaths,
_editorSelectedFootpathAdditions,
_editorSelectedSceneryGroups,
_editorSelectedParkEntrances,
_editorSelectedWaters,
_editorSelectedStexs,
};
static void editor_convert_save_to_scenario_callback(sint32 result, const utf8 * path);
static void set_all_land_owned();
static sint32 editor_load_landscape_from_sv4(const char *path);
static sint32 editor_load_landscape_from_sc4(const char *path);
static void editor_finalise_main_view();
static sint32 editor_read_s6(const char *path);
static void editor_clear_map_for_editing(bool fromSave);
/**
*
* rct2: 0x0066FFE1
*/
void editor_load()
{
audio_stop_all_music_and_sounds();
object_manager_unload_all_objects();
object_list_load();
game_init_all(150);
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION;
gParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
gS6Info.category = SCENARIO_CATEGORY_OTHER;
viewport_init_all();
rct_window *mainWindow = window_editor_main_open();
window_set_location(mainWindow, 2400, 2400, 112);
load_palette();
gScreenAge = 0;
safe_strcpy(gScenarioName, language_get_string(STR_MY_NEW_SCENARIO), 64);
}
/**
*
* rct2: 0x00672781
*/
void editor_convert_save_to_scenario()
{
tool_cancel();
window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, NULL);
window_loadsave_set_loadsave_callback(editor_convert_save_to_scenario_callback);
}
static void editor_convert_save_to_scenario_callback(sint32 result, const utf8 * path)
{
if (result != MODAL_RESULT_OK) {
return;
}
if (!context_load_park_from_file(path)) {
return;
}
if (gParkFlags & PARK_FLAGS_NO_MONEY)
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
else
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
gParkFlags |= PARK_FLAGS_NO_MONEY;
safe_strcpy(gS6Info.name, gScenarioName, 64);
safe_strcpy(gS6Info.details, gScenarioDetails, 256);
gS6Info.objective_type = gScenarioObjectiveType;
gS6Info.objective_arg_1 = gScenarioObjectiveYear;
gS6Info.objective_arg_2 = gScenarioObjectiveCurrency;
gS6Info.objective_arg_3 = gScenarioObjectiveNumGuests;
climate_reset(gClimate);
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
gS6Info.editor_step = EDITOR_STEP_OBJECTIVE_SELECTION;
gS6Info.category = SCENARIO_CATEGORY_OTHER;
viewport_init_all();
news_item_init_queue();
window_editor_main_open();
editor_finalise_main_view();
gScreenAge = 0;
}
/**
*
* rct2: 0x00672957
*/
void trackdesigner_load()
{
audio_stop_all_music_and_sounds();
gScreenFlags = SCREEN_FLAGS_TRACK_DESIGNER;
gScreenAge = 0;
object_manager_unload_all_objects();
object_list_load();
game_init_all(150);
set_all_land_owned();
gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION;
viewport_init_all();
rct_window * mainWindow = window_editor_main_open();
window_set_location(mainWindow, 2400, 2400, 112);
load_palette();
}
/**
*
* rct2: 0x006729FD
*/
void trackmanager_load()
{
audio_stop_all_music_and_sounds();
gScreenFlags = SCREEN_FLAGS_TRACK_MANAGER;
gScreenAge = 0;
object_manager_unload_all_objects();
object_list_load();
game_init_all(150);
set_all_land_owned();
gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION;
viewport_init_all();
rct_window *mainWindow = window_editor_main_open();
window_set_location(mainWindow, 2400, 2400, 112);
load_palette();
}
/**
*
* rct2: 0x0068ABEC
*/
static void set_all_land_owned()
{
sint32 mapSize = gMapSize;
game_do_command(64, 1, 64, 2, GAME_COMMAND_SET_LAND_OWNERSHIP, (mapSize - 3) * 32, (mapSize - 3) * 32);
}
/**
*
* rct2: 0x006758C0
*/
bool editor_load_landscape(const utf8 *path)
{
// #4996: Make sure the object selection window closes here to prevent unload objects
// after we have loaded a new park.
window_close_all();
uint32 extension = get_file_extension_type(path);
switch (extension) {
case FILE_EXTENSION_SC6:
case FILE_EXTENSION_SV6:
return editor_read_s6(path);
case FILE_EXTENSION_SC4:
return editor_load_landscape_from_sc4(path);
case FILE_EXTENSION_SV4:
return editor_load_landscape_from_sv4(path);
default:
return 0;
}
}
/**
*
* rct2: 0x006A2B02
*/
static sint32 editor_load_landscape_from_sv4(const char *path)
{
load_from_sv4(path);
editor_clear_map_for_editing(true);
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
gScreenAge = 0;
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
viewport_init_all();
window_editor_main_open();
editor_finalise_main_view();
return 1;
}
static sint32 editor_load_landscape_from_sc4(const char *path)
{
load_from_sc4(path);
editor_clear_map_for_editing(false);
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
gScreenAge = 0;
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
viewport_init_all();
window_editor_main_open();
editor_finalise_main_view();
return 1;
}
/**
*
* rct2: 0x006758FE
*/
static sint32 editor_read_s6(const char *path)
{
ParkLoadResult * loadResult = NULL;
const char *extension = path_get_extension(path);
if (_stricmp(extension, ".sc6") == 0) {
loadResult = load_from_sc6(path);
} else if (_stricmp(extension, ".sv6") == 0) {
loadResult = load_from_sv6(path);
}
if (ParkLoadResult_GetError(loadResult) != PARK_LOAD_ERROR_OK) {
ParkLoadResult_Delete(loadResult);
return 0;
}
ParkLoadResult_Delete(loadResult);
editor_clear_map_for_editing(true);
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
gScreenAge = 0;
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
viewport_init_all();
window_editor_main_open();
editor_finalise_main_view();
return 1;
}
static void editor_clear_map_for_editing(bool fromSave)
{
map_remove_all_rides();
//
for (sint32 i = 0; i < MAX_BANNERS; i++) {
if (gBanners[i].type == 255) {
gBanners[i].flags &= ~BANNER_FLAG_LINKED_TO_RIDE;
}
}
//
{
sint32 i;
Ride *ride;
FOR_ALL_RIDES(i, ride) {
user_string_free(ride->name);
}
}
ride_init_all();
//
for (sint32 i = 0; i < MAX_SPRITES; i++) {
rct_sprite *sprite = get_sprite(i);
user_string_free(sprite->unknown.name_string_idx);
}
reset_sprite_list();
staff_reset_modes();
gNumGuestsInPark = 0;
gNumGuestsHeadingForPark = 0;
gNumGuestsInParkLastWeek = 0;
gGuestChangeModifier = 0;
if (fromSave) {
research_populate_list_random();
research_remove_non_separate_vehicle_types();
if (gParkFlags & PARK_FLAGS_NO_MONEY)
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
else
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
gParkFlags |= PARK_FLAGS_NO_MONEY;
if (gParkEntranceFee == 0)
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
else
gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
gParkFlags &= ~PARK_FLAGS_SPRITES_INITIALISED;
gGuestInitialCash = clamp(MONEY(10,00), gGuestInitialCash, MONEY(100,00));
gInitialCash = min(gInitialCash, 100000);
finance_reset_cash_to_initial();
gBankLoan = clamp(
MONEY(0,00),
gBankLoan,
MONEY(5000000,00)
);
gMaxBankLoan = clamp(
MONEY(0,00),
gMaxBankLoan,
MONEY(5000000,00)
);
gBankLoanInterestRate = clamp(5, gBankLoanInterestRate, 80);
}
climate_reset(gClimate);
news_item_init_queue();
}
/**
*
* rct2: 0x0067009A
*/
void editor_open_windows_for_current_step()
{
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
return;
switch (gS6Info.editor_step) {
case EDITOR_STEP_OBJECT_SELECTION:
if (window_find_by_class(WC_EDITOR_OBJECT_SELECTION))
return;
if (window_find_by_class(WC_INSTALL_TRACK))
return;
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) {
object_manager_unload_all_objects();
}
window_editor_object_selection_open();
break;
case EDITOR_STEP_INVENTIONS_LIST_SET_UP:
if (window_find_by_class(WC_EDITOR_INVENTION_LIST))
return;
context_open_window(WC_EDITOR_INVENTION_LIST);
break;
case EDITOR_STEP_OPTIONS_SELECTION:
if (window_find_by_class(WC_EDITOR_SCENARIO_OPTIONS))
return;
context_open_window(WC_EDITOR_SCENARIO_OPTIONS);
break;
case EDITOR_STEP_OBJECTIVE_SELECTION:
if (window_find_by_class(WC_EDTIOR_OBJECTIVE_OPTIONS))
return;
context_open_window(WC_EDTIOR_OBJECTIVE_OPTIONS);
break;
}
}
static void editor_finalise_main_view()
{
rct_window *w = window_get_main();
rct_viewport *viewport = w->viewport;
w->viewport_target_sprite = SPRITE_INDEX_NULL;
w->saved_view_x = gSavedViewX;
w->saved_view_y = gSavedViewY;
gCurrentRotation = gSavedViewRotation;
sint32 zoom_difference = gSavedViewZoom - viewport->zoom;
viewport->zoom = gSavedViewZoom;
if (zoom_difference != 0) {
if (zoom_difference >= 0) {
viewport->view_width <<= zoom_difference;
viewport->view_height <<= zoom_difference;
} else {
zoom_difference = -zoom_difference;
viewport->view_width >>= zoom_difference;
viewport->view_height >>= zoom_difference;
}
}
w->saved_view_x -= viewport->view_width >> 1;
w->saved_view_y -= viewport->view_height >> 1;
window_invalidate(w);
reset_all_sprite_quadrant_placements();
scenery_set_default_placement_configuration();
window_new_ride_init_vars();
gWindowUpdateTicks = 0;
load_palette();
window_tile_inspector_clear_clipboard();
}
/**
*
* rct2: 0x006AB9B8
*/
sint32 editor_check_object_selection()
{
bool isTrackDesignerManager =
gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER);
if (!isTrackDesignerManager) {
if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_PATHS)) {
gGameCommandErrorText = STR_AT_LEAST_ONE_PATH_OBJECT_MUST_BE_SELECTED;
return OBJECT_TYPE_PATHS;
}
}
if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_RIDE)) {
gGameCommandErrorText = STR_AT_LEAST_ONE_RIDE_OBJECT_MUST_BE_SELECTED;
return OBJECT_TYPE_RIDE;
}
if (!isTrackDesignerManager) {
if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_PARK_ENTRANCE)) {
gGameCommandErrorText = STR_PARK_ENTRANCE_TYPE_MUST_BE_SELECTED;
return OBJECT_TYPE_PARK_ENTRANCE;
}
if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_WATER)) {
gGameCommandErrorText = STR_WATER_TYPE_MUST_BE_SELECTED;
return OBJECT_TYPE_WATER;
}
}
return -1;
}
/**
*
* rct2: 0x0066FEAC
*/
bool editor_check_park()
{
sint32 parkSize = park_calculate_size();
if (parkSize == 0) {
gGameCommandErrorText = STR_PARK_MUST_OWN_SOME_LAND;
return false;
}
for (sint32 i = 0; i < MAX_PARK_ENTRANCES; i++) {
if (gParkEntrances[i].x != MAP_LOCATION_NULL)
break;
if (i == MAX_PARK_ENTRANCES - 1) {
gGameCommandErrorText = STR_NO_PARK_ENTRANCES;
return false;
}
}
for (sint32 i = 0; i < MAX_PARK_ENTRANCES; i++) {
if (gParkEntrances[i].x == MAP_LOCATION_NULL)
continue;
sint32 x = gParkEntrances[i].x;
sint32 y = gParkEntrances[i].y;
sint32 z = gParkEntrances[i].z / 8;
sint32 direction = gParkEntrances[i].direction ^ 2;
switch (footpath_is_connected_to_map_edge(x, y, z, direction, 0)) {
case FOOTPATH_SEARCH_NOT_FOUND:
gGameCommandErrorText = STR_PARK_ENTRANCE_WRONG_DIRECTION_OR_NO_PATH;
return false;
case FOOTPATH_SEARCH_INCOMPLETE:
case FOOTPATH_SEARCH_TOO_COMPLEX:
gGameCommandErrorText = STR_PARK_ENTRANCE_PATH_INCOMPLETE_OR_COMPLEX;
return false;
case FOOTPATH_SEARCH_SUCCESS:
// Run the search again and unown the path
footpath_is_connected_to_map_edge(x, y, z, direction, (1 << 5));
break;
}
}
for (sint32 i = 0; i < MAX_PEEP_SPAWNS; i++) {
if (gPeepSpawns[i].x != PEEP_SPAWN_UNDEFINED)
break;
if (i == MAX_PEEP_SPAWNS - 1) {
gGameCommandErrorText = STR_PEEP_SPAWNS_NOT_SET;
return false;
}
}
return true;
}
void game_command_edit_scenario_options(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp)
{
if (!(*ebx & GAME_COMMAND_FLAG_APPLY)) {
*ebx = 0;
return;
}
switch (*ecx) {
case EDIT_SCENARIOOPTIONS_SETNOMONEY:
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) {
if (*edx != 0) {
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
}
else {
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
}
}
else {
if (*edx != 0) {
gParkFlags |= PARK_FLAGS_NO_MONEY;
}
else {
gParkFlags &= ~PARK_FLAGS_NO_MONEY;
}
// Invalidate all windows that have anything to do with finance
window_invalidate_by_class(WC_RIDE);
window_invalidate_by_class(WC_PEEP);
window_invalidate_by_class(WC_PARK_INFORMATION);
window_invalidate_by_class(WC_FINANCES);
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
window_invalidate_by_class(WC_TOP_TOOLBAR);
}
break;
case EDIT_SCENARIOOPTIONS_SETINITIALCASH:
gInitialCash = clamp(MONEY(0, 00), *edx, MONEY(1000000, 00));
gCashEncrypted = ENCRYPT_MONEY(gInitialCash);
window_invalidate_by_class(WC_FINANCES);
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
break;
case EDIT_SCENARIOOPTIONS_SETINITIALLOAN:
gBankLoan = clamp(MONEY(0,00), *edx, MONEY(5000000,00));
gMaxBankLoan = max(gBankLoan, gMaxBankLoan);
window_invalidate_by_class(WC_FINANCES);
break;
case EDIT_SCENARIOOPTIONS_SETMAXIMUMLOANSIZE:
gMaxBankLoan = clamp(MONEY(0,00), *edx, MONEY(5000000,00));
gBankLoan = min(gBankLoan, gMaxBankLoan);
window_invalidate_by_class(WC_FINANCES);
break;
case EDIT_SCENARIOOPTIONS_SETANNUALINTERESTRATE:
gBankLoanInterestRate = clamp(0, *edx, 80);
window_invalidate_by_class(WC_FINANCES);
break;
case EDIT_SCENARIOOPTIONS_SETFORBIDMARKETINGCAMPAIGNS:
if (*edx != 0) {
gParkFlags |= PARK_FLAGS_FORBID_MARKETING_CAMPAIGN;
}
else {
gParkFlags &= ~PARK_FLAGS_FORBID_MARKETING_CAMPAIGN;
}
break;
case EDIT_SCENARIOOPTIONS_SETAVERAGECASHPERGUEST:
gGuestInitialCash = clamp(MONEY(0, 00), *edx, MONEY(1000, 00));
break;
case EDIT_SCENARIOOPTIONS_SETGUESTINITIALHAPPINESS:
gGuestInitialHappiness = clamp(40, *edx, 250);
break;
case EDIT_SCENARIOOPTIONS_SETGUESTINITIALHUNGER:
gGuestInitialHunger = clamp(40, *edx, 250);
break;
case EDIT_SCENARIOOPTIONS_SETGUESTINITIALTHIRST:
gGuestInitialThirst = clamp(40, *edx, 250);
break;
case EDIT_SCENARIOOPTIONS_SETGUESTSPREFERLESSINTENSERIDES:
if (*edx != 0) {
gParkFlags |= PARK_FLAGS_PREF_LESS_INTENSE_RIDES;
}
else {
gParkFlags &= ~PARK_FLAGS_PREF_LESS_INTENSE_RIDES;
}
break;
case EDIT_SCENARIOOPTIONS_SETGUESTSPREFERMOREINTENSERIDES:
if (*edx != 0) {
gParkFlags |= PARK_FLAGS_PREF_MORE_INTENSE_RIDES;
}
else {
gParkFlags &= ~PARK_FLAGS_PREF_MORE_INTENSE_RIDES;
}
break;
case EDIT_SCENARIOOPTIONS_SETCOSTTOBUYLAND:
gLandPrice = clamp(MONEY(5, 00), *edx, MONEY(200, 00));
break;
case EDIT_SCENARIOOPTIONS_SETCOSTTOBUYCONSTRUCTIONRIGHTS:
gConstructionRightsPrice = clamp(MONEY(5,00), *edx, MONEY(200,00));
break;
case EDIT_SCENARIOOPTIONS_SETPARKCHARGEMETHOD:
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) {
if (*edx == 0) {
if (!(gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY)) {
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
gParkEntranceFee = MONEY(0, 00);
}
}
else {
if (gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY) {
gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
gParkEntranceFee = MONEY(10, 00);
}
}
}
else {
if (*edx == 0) {
if (!(gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY)) {
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
}
}
else {
if (gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY) {
gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
}
}
window_invalidate_by_class(WC_PARK_INFORMATION);
window_invalidate_by_class(WC_RIDE);
}
break;
case EDIT_SCENARIOOPTIONS_SETPARKCHARGEENTRYFEE:
gParkEntranceFee = clamp(MONEY(0, 00), *edx, MONEY(100, 00));
window_invalidate_by_class(WC_PARK_INFORMATION);
break;
case EDIT_SCENARIOOPTIONS_SETFORBIDTREEREMOVAL:
if (*edx != 0) {
gParkFlags |= PARK_FLAGS_FORBID_TREE_REMOVAL;
}
else {
gParkFlags &= ~PARK_FLAGS_FORBID_TREE_REMOVAL;
}
break;
case EDIT_SCENARIOOPTIONS_SETFORBIDLANDSCAPECHANGES:
if (*edx != 0) {
gParkFlags |= PARK_FLAGS_FORBID_LANDSCAPE_CHANGES;
}
else {
gParkFlags &= ~PARK_FLAGS_FORBID_LANDSCAPE_CHANGES;
}
break;
case EDIT_SCENARIOOPTIONS_SETFORBIDHIGHCONSTRUCTION:
if (*edx != 0) {
gParkFlags |= PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
}
else {
gParkFlags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
}
break;
case EDIT_SCENARIOOPTIONS_SETPARKRATINGHIGHERDIFFICULTLEVEL:
if (*edx != 0) {
gParkFlags |= PARK_FLAGS_DIFFICULT_PARK_RATING;
}
else {
gParkFlags &= ~PARK_FLAGS_DIFFICULT_PARK_RATING;
}
break;
case EDIT_SCENARIOOPTIONS_SETGUESTGENERATIONHIGHERDIFFICULTLEVEL:
if (*edx != 0) {
gParkFlags |= PARK_FLAGS_DIFFICULT_GUEST_GENERATION;
}
else {
gParkFlags &= ~PARK_FLAGS_DIFFICULT_GUEST_GENERATION;
}
break;
}
window_invalidate_by_class(WC_EDITOR_SCENARIO_OPTIONS);
*ebx = 0;
}

View File

@ -1,83 +0,0 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#ifndef _EDITOR_H_
#define _EDITOR_H_
#include "object.h"
typedef enum {
EDITOR_STEP_OBJECT_SELECTION, // 0
EDITOR_STEP_LANDSCAPE_EDITOR, // 1
EDITOR_STEP_INVENTIONS_LIST_SET_UP, // 2
EDITOR_STEP_OPTIONS_SELECTION, // 3
EDITOR_STEP_OBJECTIVE_SELECTION, // 4
EDITOR_STEP_SAVE_SCENARIO, // 5
EDITOR_STEP_ROLLERCOASTER_DESIGNER, // 6
EDITOR_STEP_TRACK_DESIGNS_MANAGER // 7
} RCT2_EDITOR_STEP;
enum
{
EDIT_SCENARIOOPTIONS_SETNOMONEY,
EDIT_SCENARIOOPTIONS_SETINITIALCASH,
EDIT_SCENARIOOPTIONS_SETINITIALLOAN,
EDIT_SCENARIOOPTIONS_SETMAXIMUMLOANSIZE,
EDIT_SCENARIOOPTIONS_SETANNUALINTERESTRATE,
EDIT_SCENARIOOPTIONS_SETFORBIDMARKETINGCAMPAIGNS,
EDIT_SCENARIOOPTIONS_SETAVERAGECASHPERGUEST,
EDIT_SCENARIOOPTIONS_SETGUESTINITIALHAPPINESS,
EDIT_SCENARIOOPTIONS_SETGUESTINITIALHUNGER,
EDIT_SCENARIOOPTIONS_SETGUESTINITIALTHIRST,
EDIT_SCENARIOOPTIONS_SETGUESTSPREFERLESSINTENSERIDES,
EDIT_SCENARIOOPTIONS_SETGUESTSPREFERMOREINTENSERIDES,
EDIT_SCENARIOOPTIONS_SETCOSTTOBUYLAND,
EDIT_SCENARIOOPTIONS_SETCOSTTOBUYCONSTRUCTIONRIGHTS,
EDIT_SCENARIOOPTIONS_SETPARKCHARGEMETHOD,
EDIT_SCENARIOOPTIONS_SETPARKCHARGEENTRYFEE,
EDIT_SCENARIOOPTIONS_SETFORBIDTREEREMOVAL,
EDIT_SCENARIOOPTIONS_SETFORBIDLANDSCAPECHANGES,
EDIT_SCENARIOOPTIONS_SETFORBIDHIGHCONSTRUCTION,
EDIT_SCENARIOOPTIONS_SETPARKRATINGHIGHERDIFFICULTLEVEL,
EDIT_SCENARIOOPTIONS_SETGUESTGENERATIONHIGHERDIFFICULTLEVEL,
};
#ifdef __cplusplus
extern "C" {
#endif
extern uint8 * gEditorSelectedObjects[OBJECT_ENTRY_GROUP_COUNT];
void editor_load();
void editor_convert_save_to_scenario();
void trackdesigner_load();
void trackmanager_load();
bool editor_load_landscape(const utf8 *path);
void editor_open_windows_for_current_step();
bool editor_check_park();
sint32 editor_check_object_selection();
bool editor_check_object_group_at_least_one_selected(sint32 objectType);
void game_command_edit_scenario_options(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -18,7 +18,7 @@
#include "cheats.h"
#include "config/Config.h"
#include "Context.h"
#include "editor.h"
#include "Editor.h"
#include "FileClassifier.h"
#include "game.h"
#include "input.h"

View File

@ -15,7 +15,7 @@
#pragma endregion
#include "../cheats.h"
#include "../editor.h"
#include "../Editor.h"
#include "../game.h"
#include "../input.h"
#include "../localisation/localisation.h"

View File

@ -19,7 +19,7 @@
#include "../Context.h"
#include "../core/Guard.hpp"
#include "../drawing/drawing.h"
#include "../editor.h"
#include "../Editor.h"
#include "../game.h"
#include "../input.h"
#include "../interface/Cursors.h"

View File

@ -23,17 +23,17 @@
// 98DA00
sint32 object_entry_group_counts[] = {
128, // rides
252, // small scenery
128, // large scenery
128, // walls
32, // banners
16, // paths
15, // path bits
19, // scenery sets
1, // park entrance
1, // water
1 // scenario text
MAX_RIDE_OBJECTS, // rides
MAX_SMALL_SCENERY_OBJECTS, // small scenery
MAX_LARGE_SCENERY_OBJECTS, // large scenery
MAX_WALL_SCENERY_OBJECTS, // walls
MAX_BANNER_OBJECTS, // banners
MAX_PATH_OBJECTS, // paths
MAX_PATH_ADDITION_OBJECTS, // path bits
MAX_SCENERY_GROUP_OBJECTS, // scenery sets
MAX_PARK_ENTRANCE_OBJECTS, // park entrance
MAX_WATER_OBJECTS, // water
MAX_SCENARIO_TEXT_OBJECTS // scenario text
};
// 98DA2C
@ -52,31 +52,31 @@ sint32 object_entry_group_encoding[] = {
};
#ifdef NO_RCT2
rct_ride_entry *gRideEntries[128];
rct_small_scenery_entry *gSmallSceneryEntries[252];
rct_large_scenery_entry *gLargeSceneryEntries[128];
rct_wall_scenery_entry *gWallSceneryEntries[128];
rct_banner *gBannerSceneryEntries[32];
rct_footpath_entry *gFootpathEntries[16];
rct_path_bit_scenery_entry *gFootpathAdditionEntries[15];
rct_scenery_set_entry *gSceneryGroupEntries[19];
rct_entrance_type *gParkEntranceEntries[1];
rct_water_type *gWaterEntries[1];
rct_stex_entry *gStexEntries[1];
rct_ride_entry *gRideEntries[MAX_RIDE_OBJECTS];
rct_small_scenery_entry *gSmallSceneryEntries[MAX_SMALL_SCENERY_OBJECTS];
rct_large_scenery_entry *gLargeSceneryEntries[MAX_LARGE_SCENERY_OBJECTS];
rct_wall_scenery_entry *gWallSceneryEntries[MAX_WALL_SCENERY_OBJECTS];
rct_banner *gBannerSceneryEntries[MAX_BANNER_OBJECTS];
rct_footpath_entry *gFootpathEntries[MAX_PATH_OBJECTS];
rct_path_bit_scenery_entry *gFootpathAdditionEntries[MAX_PATH_ADDITION_OBJECTS];
rct_scenery_set_entry *gSceneryGroupEntries[MAX_SCENERY_GROUP_OBJECTS];
rct_entrance_type *gParkEntranceEntries[MAX_PARK_ENTRANCE_OBJECTS];
rct_water_type *gWaterEntries[MAX_WATER_OBJECTS];
rct_stex_entry *gStexEntries[MAX_SCENARIO_TEXT_OBJECTS];
#endif
#ifdef NO_RCT2
rct_object_entry_extended _objectEntriesRides[128];
rct_object_entry_extended _objectEntriesSmallScenery[252];
rct_object_entry_extended _objectEntriesLargeScenery[128];
rct_object_entry_extended _objectEntriesWalls[128];
rct_object_entry_extended _objectEntriesBanners[32];
rct_object_entry_extended _objectEntriesFootpaths[16];
rct_object_entry_extended _objectEntriesFootpathAdditions[15];
rct_object_entry_extended _objectEntriesSceneryGroups[19];
rct_object_entry_extended _objectEntriesParkEntrances[1];
rct_object_entry_extended _objectEntriesWaters[1];
rct_object_entry_extended _objectEntriesStexs[1];
rct_object_entry_extended _objectEntriesRides[MAX_RIDE_OBJECTS];
rct_object_entry_extended _objectEntriesSmallScenery[MAX_SMALL_SCENERY_OBJECTS];
rct_object_entry_extended _objectEntriesLargeScenery[MAX_LARGE_SCENERY_OBJECTS];
rct_object_entry_extended _objectEntriesWalls[MAX_WALL_SCENERY_OBJECTS];
rct_object_entry_extended _objectEntriesBanners[MAX_BANNER_OBJECTS];
rct_object_entry_extended _objectEntriesFootpaths[MAX_PATH_OBJECTS];
rct_object_entry_extended _objectEntriesFootpathAdditions[MAX_PATH_ADDITION_OBJECTS];
rct_object_entry_extended _objectEntriesSceneryGroups[MAX_SCENERY_GROUP_OBJECTS];
rct_object_entry_extended _objectEntriesParkEntrances[MAX_PARK_ENTRANCE_OBJECTS];
rct_object_entry_extended _objectEntriesWaters[MAX_WATER_OBJECTS];
rct_object_entry_extended _objectEntriesStexs[MAX_SCENARIO_TEXT_OBJECTS];
#else
#define _objectEntriesRides RCT2_ADDRESS(0x00F3F03C ,rct_object_entry_extended)
#define _objectEntriesSmallScenery RCT2_ADDRESS(0x00F3F03C + (128 * 20),rct_object_entry_extended)

View File

@ -12,18 +12,30 @@
extern "C" {
#endif
#define MAX_RIDE_OBJECTS 128
#define MAX_SMALL_SCENERY_OBJECTS 252
#define MAX_LARGE_SCENERY_OBJECTS 128
#define MAX_WALL_SCENERY_OBJECTS 128
#define MAX_BANNER_OBJECTS 32
#define MAX_PATH_OBJECTS 16
#define MAX_PATH_ADDITION_OBJECTS 15
#define MAX_SCENERY_GROUP_OBJECTS 19
#define MAX_PARK_ENTRANCE_OBJECTS 1
#define MAX_WATER_OBJECTS 1
#define MAX_SCENARIO_TEXT_OBJECTS 1
#ifdef NO_RCT2
extern rct_ride_entry *gRideEntries[128];
extern rct_small_scenery_entry *gSmallSceneryEntries[252];
extern rct_large_scenery_entry *gLargeSceneryEntries[128];
extern rct_wall_scenery_entry *gWallSceneryEntries[128];
extern rct_banner *gBannerSceneryEntries[32];
extern rct_footpath_entry *gFootpathEntries[16];
extern rct_path_bit_scenery_entry *gFootpathAdditionEntries[15];
extern rct_scenery_set_entry *gSceneryGroupEntries[19];
extern rct_entrance_type *gParkEntranceEntries[1];
extern rct_water_type *gWaterEntries[1];
extern rct_stex_entry *gStexEntries[1];
extern rct_ride_entry *gRideEntries[MAX_RIDE_OBJECTS];
extern rct_small_scenery_entry *gSmallSceneryEntries[MAX_SMALL_SCENERY_OBJECTS];
extern rct_large_scenery_entry *gLargeSceneryEntries[MAX_LARGE_SCENERY_OBJECTS];
extern rct_wall_scenery_entry *gWallSceneryEntries[MAX_WALL_SCENERY_OBJECTS];
extern rct_banner *gBannerSceneryEntries[MAX_BANNER_OBJECTS];
extern rct_footpath_entry *gFootpathEntries[MAX_PATH_OBJECTS];
extern rct_path_bit_scenery_entry *gFootpathAdditionEntries[MAX_PATH_ADDITION_OBJECTS];
extern rct_scenery_set_entry *gSceneryGroupEntries[MAX_SCENERY_GROUP_OBJECTS];
extern rct_entrance_type *gParkEntranceEntries[MAX_PARK_ENTRANCE_OBJECTS];
extern rct_water_type *gWaterEntries[MAX_WATER_OBJECTS];
extern rct_stex_entry *gStexEntries[MAX_SCENARIO_TEXT_OBJECTS];
#else

View File

@ -1225,8 +1225,6 @@ bool rideTypeShouldLoseSeparateFlag(const rct_ride_entry *rideEntry);
ParkLoadResult * load_from_sv4(const char *path);
ParkLoadResult * load_from_sc4(const char *path);
colour_t rct1_get_colour(colour_t colour);
#ifdef __cplusplus
}
#endif

View File

@ -38,7 +38,7 @@ extern "C"
{
#include "../audio/audio.h"
#include "../cheats.h"
#include "../editor.h"
#include "../Editor.h"
#include "../game.h"
#include "../interface/window.h"
#include "../localisation/date.h"
@ -2735,9 +2735,4 @@ extern "C"
}
return result;
}
colour_t rct1_get_colour(colour_t colour)
{
return RCT1::GetColour(colour);
}
}

View File

@ -20,7 +20,7 @@
#include "../common.h"
#include "../config/Config.h"
#include "../Context.h"
#include "../editor.h"
#include "../Editor.h"
#include "../game.h"
#include "../input.h"
#include "../interface/window.h"

View File

@ -18,7 +18,7 @@
#include "../audio/AudioMixer.h"
#include "../config/Config.h"
#include "../Context.h"
#include "../editor.h"
#include "../Editor.h"
#include "../game.h"
#include "../interface/viewport.h"
#include "../localisation/localisation.h"

View File

@ -19,7 +19,7 @@
#include "../audio/audio.h"
#include "../game.h"
#include "../editor.h"
#include "../Editor.h"
#include "../input.h"
#include "../sprites.h"
#include "../localisation/localisation.h"
@ -197,7 +197,7 @@ static bool window_editor_bottom_toolbar_check_object_selection()
{
rct_window *w;
sint32 missingObjectType = editor_check_object_selection();
sint32 missingObjectType = Editor::CheckObjectSelection();
if (missingObjectType < 0) {
window_close_by_class(WC_EDITOR_OBJECT_SELECTION);
return true;
@ -239,12 +239,16 @@ void window_editor_bottom_toolbar_jump_forward_from_object_selection()
*
* rct2: 0x0066F758
*/
void window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up() {
if (editor_check_park()) {
void window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up()
{
if (Editor::CheckPark())
{
window_close_all();
context_open_window(WC_EDITOR_INVENTION_LIST);
gS6Info.editor_step = EDITOR_STEP_INVENTIONS_LIST_SET_UP;
} else {
}
else
{
window_error_open(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, gGameCommandErrorText);
}
@ -255,7 +259,8 @@ void window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up() {
*
* rct2: 0x0066f790
*/
void window_editor_bottom_toolbar_jump_forward_to_options_selection() {
void window_editor_bottom_toolbar_jump_forward_to_options_selection()
{
window_close_all();
context_open_window(WC_EDITOR_SCENARIO_OPTIONS);
gS6Info.editor_step = EDITOR_STEP_OPTIONS_SELECTION;

View File

@ -25,7 +25,7 @@
#include <ctype.h>
#include "../audio/audio.h"
#include "../game.h"
#include "../editor.h"
#include "../Editor.h"
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include "../object_list.h"
@ -503,14 +503,14 @@ static void setup_in_use_selection_flags()
{
for (uint8 object_type = 0; object_type < 11; object_type++){
for (uint16 i = 0; i < object_entry_group_counts[object_type]; i++){
gEditorSelectedObjects[object_type][i] = 0;
Editor::SelectedObjects[object_type][i] = 0;
}
}
for (uint8 object_type = 0; object_type < 11; object_type++){
for (uint16 i = 0; i < object_entry_group_counts[object_type]; i++){
if (object_entry_groups[object_type].chunks[i] != (uint8*)-1) {
gEditorSelectedObjects[object_type][i] |= (1 << 1);
Editor::SelectedObjects[object_type][i] |= (1 << 1);
}
}
}
@ -530,43 +530,43 @@ static void setup_in_use_selection_flags()
type = iter.element->properties.path.type;
type >>= 4;
assert(type < object_entry_group_counts[OBJECT_TYPE_PATHS]);
gEditorSelectedObjects[OBJECT_TYPE_PATHS][type] |= (1 << 0);
Editor::SelectedObjects[OBJECT_TYPE_PATHS][type] |= (1 << 0);
if (footpath_element_has_path_scenery(iter.element)) {
uint8 path_additions = footpath_element_get_path_scenery_index(iter.element);
gEditorSelectedObjects[OBJECT_TYPE_PATH_BITS][path_additions] |= 1;
Editor::SelectedObjects[OBJECT_TYPE_PATH_BITS][path_additions] |= 1;
}
break;
case MAP_ELEMENT_TYPE_SCENERY:
type = iter.element->properties.scenery.type;
assert(type < object_entry_group_counts[OBJECT_TYPE_SMALL_SCENERY]);
gEditorSelectedObjects[OBJECT_TYPE_SMALL_SCENERY][type] |= (1 << 0);
Editor::SelectedObjects[OBJECT_TYPE_SMALL_SCENERY][type] |= (1 << 0);
break;
case MAP_ELEMENT_TYPE_ENTRANCE:
if (iter.element->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE)
break;
gEditorSelectedObjects[OBJECT_TYPE_PARK_ENTRANCE][0] |= (1 << 0);
Editor::SelectedObjects[OBJECT_TYPE_PARK_ENTRANCE][0] |= (1 << 0);
type = iter.element->properties.entrance.path_type;
assert(type < object_entry_group_counts[OBJECT_TYPE_PATHS]);
gEditorSelectedObjects[OBJECT_TYPE_PATHS][type] |= (1 << 0);
Editor::SelectedObjects[OBJECT_TYPE_PATHS][type] |= (1 << 0);
break;
case MAP_ELEMENT_TYPE_WALL:
type = iter.element->properties.wall.type;
assert(type < object_entry_group_counts[OBJECT_TYPE_WALLS]);
gEditorSelectedObjects[OBJECT_TYPE_WALLS][type] |= (1 << 0);
Editor::SelectedObjects[OBJECT_TYPE_WALLS][type] |= (1 << 0);
break;
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
type = iter.element->properties.scenerymultiple.type & 0x3FF;
assert(type < object_entry_group_counts[OBJECT_TYPE_LARGE_SCENERY]);
gEditorSelectedObjects[OBJECT_TYPE_LARGE_SCENERY][type] |= (1 << 0);
Editor::SelectedObjects[OBJECT_TYPE_LARGE_SCENERY][type] |= (1 << 0);
break;
case MAP_ELEMENT_TYPE_BANNER:
banner = &gBanners[iter.element->properties.banner.index];
type = banner->type;
assert(type < object_entry_group_counts[OBJECT_TYPE_BANNERS]);
gEditorSelectedObjects[OBJECT_TYPE_BANNERS][type] |= (1 << 0);
Editor::SelectedObjects[OBJECT_TYPE_BANNERS][type] |= (1 << 0);
break;
}
} while (map_element_iterator_next(&iter));
@ -575,7 +575,7 @@ static void setup_in_use_selection_flags()
Ride* ride = get_ride(ride_index);
if (ride->type != RIDE_TYPE_NULL) {
uint8 type = ride->subtype;
gEditorSelectedObjects[OBJECT_TYPE_RIDE][type] |= (1 << 0);
Editor::SelectedObjects[OBJECT_TYPE_RIDE][type] |= (1 << 0);
}
}
@ -588,12 +588,12 @@ static void setup_in_use_selection_flags()
uint8 entryType, entryIndex;
if (find_object_in_entry_group(&item->ObjectEntry, &entryType, &entryIndex)) {
if (gEditorSelectedObjects[entryType][entryIndex] & (1 << 0)) {
if (Editor::SelectedObjects[entryType][entryIndex] & (1 << 0)) {
*selectionFlags |=
OBJECT_SELECTION_FLAG_IN_USE |
OBJECT_SELECTION_FLAG_SELECTED;
}
if (gEditorSelectedObjects[entryType][entryIndex] & (1 << 1)) {
if (Editor::SelectedObjects[entryType][entryIndex] & (1 << 1)) {
*selectionFlags |= OBJECT_SELECTION_FLAG_SELECTED;
}
}

View File

@ -20,7 +20,7 @@
#include <time.h>
#include "../core/Guard.hpp"
#include "../editor.h"
#include "../Editor.h"
#include "../game.h"
#include "../interface/widget.h"
#include "../localisation/localisation.h"
@ -785,7 +785,7 @@ static void window_loadsave_select(rct_window *w, const char *path)
break;
case (LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE) :
save_path(&gConfigGeneral.last_save_landscape_directory, pathBuffer);
if (editor_load_landscape(pathBuffer)) {
if (Editor::LoadLandscape(pathBuffer)) {
safe_strcpy(gCurrentLoadedPath, pathBuffer, MAX_PATH);
gfx_invalidate_screen();
window_loadsave_invoke_callback(MODAL_RESULT_OK, pathBuffer);

View File

@ -25,7 +25,7 @@
#include "../audio/audio.h"
#include "../cheats.h"
#include "../editor.h"
#include "../Editor.h"
#include "../input.h"
#include "../interface/console.h"
#include "../interface/land_tool.h"

View File

@ -22,7 +22,7 @@
#include "../core/Memory.hpp"
#include "../audio/audio.h"
#include "../editor.h"
#include "../Editor.h"
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include "../rct1.h"
@ -184,7 +184,7 @@ static void window_track_list_close(rct_window *w)
if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && gScreenAge != 0){
window_close_by_number(WC_MANAGE_TRACK_DESIGN, w->number);
window_close_by_number(WC_TRACK_DELETE_PROMPT, w->number);
trackmanager_load();
Editor::LoadTrackManager();
}
}