2017-09-22 07:56:24 +02:00
|
|
|
/*****************************************************************************
|
2018-06-15 14:07:34 +02:00
|
|
|
* Copyright (c) 2014-2018 OpenRCT2 developers
|
2017-09-22 07:56:24 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2017-09-22 07:56:24 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2017-09-22 07:56:24 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "Editor.h"
|
2018-06-22 23:25:16 +02:00
|
|
|
|
|
|
|
#include "Context.h"
|
2017-12-07 16:33:04 +01:00
|
|
|
#include "EditorObjectSelectionSession.h"
|
2017-09-22 07:56:24 +02:00
|
|
|
#include "FileClassifier.h"
|
2017-11-30 18:17:06 +01:00
|
|
|
#include "Game.h"
|
2018-05-30 13:50:25 +02:00
|
|
|
#include "GameState.h"
|
2017-12-07 16:33:04 +01:00
|
|
|
#include "OpenRCT2.h"
|
|
|
|
#include "ParkImporter.h"
|
|
|
|
#include "audio/audio.h"
|
2018-01-06 00:45:53 +01:00
|
|
|
#include "interface/Viewport.h"
|
2018-01-06 18:32:25 +01:00
|
|
|
#include "localisation/Localisation.h"
|
2018-12-05 21:33:45 +01:00
|
|
|
#include "localisation/LocalisationService.h"
|
2017-10-11 21:38:26 +02:00
|
|
|
#include "management/NewsItem.h"
|
2017-09-22 07:56:24 +02:00
|
|
|
#include "object/ObjectManager.h"
|
2018-12-05 21:33:45 +01:00
|
|
|
#include "object/ObjectRepository.h"
|
2017-10-13 10:06:36 +02:00
|
|
|
#include "peep/Staff.h"
|
2018-01-09 10:40:42 +01:00
|
|
|
#include "rct1/RCT1.h"
|
2018-03-19 23:28:40 +01:00
|
|
|
#include "scenario/Scenario.h"
|
2018-06-22 23:25:16 +02:00
|
|
|
#include "ui/UiContext.h"
|
|
|
|
#include "ui/WindowManager.h"
|
2017-12-13 13:02:24 +01:00
|
|
|
#include "util/Util.h"
|
2017-10-19 10:01:05 +02:00
|
|
|
#include "windows/Intent.h"
|
2017-09-22 07:56:24 +02:00
|
|
|
#include "world/Climate.h"
|
2018-03-13 13:14:02 +01:00
|
|
|
#include "world/Entrance.h"
|
|
|
|
#include "world/Footpath.h"
|
2018-03-19 23:28:40 +01:00
|
|
|
#include "world/Park.h"
|
2018-06-22 23:25:16 +02:00
|
|
|
#include "world/Scenery.h"
|
|
|
|
|
2018-08-12 13:50:40 +02:00
|
|
|
#include <algorithm>
|
2018-06-22 23:25:16 +02:00
|
|
|
#include <array>
|
|
|
|
#include <vector>
|
2018-06-02 01:07:14 +02:00
|
|
|
|
|
|
|
using namespace OpenRCT2;
|
2017-09-22 07:56:24 +02:00
|
|
|
|
|
|
|
namespace Editor
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
static std::array<std::vector<uint8_t>, OBJECT_TYPE_COUNT> _editorSelectedObjectFlags;
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
static void ConvertSaveToScenarioCallback(int32_t result, const utf8* path);
|
2017-09-22 07:56:24 +02:00
|
|
|
static void SetAllLandOwned();
|
2018-06-22 23:25:16 +02:00
|
|
|
static bool LoadLandscapeFromSV4(const char* path);
|
|
|
|
static bool LoadLandscapeFromSC4(const char* path);
|
2017-09-22 07:56:24 +02:00
|
|
|
static void FinaliseMainView();
|
2018-06-22 23:25:16 +02:00
|
|
|
static bool ReadS6(const char* path);
|
2017-09-22 07:56:24 +02:00
|
|
|
static void ClearMapForEditing(bool fromSave);
|
|
|
|
|
2018-12-05 21:33:45 +01:00
|
|
|
static void object_list_load()
|
|
|
|
{
|
|
|
|
// Scan objects if necessary
|
|
|
|
auto context = GetContext();
|
|
|
|
const auto& localisationService = context->GetLocalisationService();
|
|
|
|
auto& objectRepository = context->GetObjectRepository();
|
|
|
|
objectRepository.LoadOrConstruct(localisationService.GetCurrentLanguage());
|
|
|
|
|
|
|
|
// Reset loaded objects to just defaults
|
|
|
|
auto& objectManager = context->GetObjectManager();
|
|
|
|
objectManager.UnloadAll();
|
|
|
|
objectManager.LoadDefaultObjects();
|
|
|
|
}
|
|
|
|
|
2017-09-22 07:56:24 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066FFE1
|
|
|
|
*/
|
|
|
|
void Load()
|
|
|
|
{
|
|
|
|
audio_stop_all_music_and_sounds();
|
|
|
|
object_manager_unload_all_objects();
|
|
|
|
object_list_load();
|
2018-05-27 17:11:54 +02:00
|
|
|
OpenRCT2::GetContext()->GetGameState()->InitAll(150);
|
2017-09-22 07:56:24 +02:00
|
|
|
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();
|
2018-06-22 23:25:16 +02:00
|
|
|
rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN);
|
2017-09-22 07:56:24 +02:00
|
|
|
window_set_location(mainWindow, 2400, 2400, 112);
|
|
|
|
load_palette();
|
|
|
|
gScreenAge = 0;
|
2018-12-15 19:39:00 +01:00
|
|
|
gScenarioName = language_get_string(STR_MY_NEW_SCENARIO);
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00672781
|
|
|
|
*/
|
|
|
|
void ConvertSaveToScenario()
|
|
|
|
{
|
|
|
|
tool_cancel();
|
2017-09-12 00:04:03 +02:00
|
|
|
auto intent = Intent(WC_LOADSAVE);
|
2017-09-12 21:21:39 +02:00
|
|
|
intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME);
|
2018-06-22 23:25:16 +02:00
|
|
|
intent.putExtra(INTENT_EXTRA_CALLBACK, (void*)ConvertSaveToScenarioCallback);
|
2017-09-12 00:04:03 +02:00
|
|
|
context_open_intent(&intent);
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
static void ConvertSaveToScenarioCallback(int32_t result, const utf8* path)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
2018-12-15 19:39:00 +01:00
|
|
|
safe_strcpy(gS6Info.name, gScenarioName.c_str(), sizeof(gS6Info.name));
|
|
|
|
safe_strcpy(gS6Info.details, gScenarioDetails.c_str(), sizeof(gS6Info.details));
|
2018-06-22 23:25:16 +02:00
|
|
|
gS6Info.objective_type = gScenarioObjectiveType;
|
2017-09-22 07:56:24 +02:00
|
|
|
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;
|
2018-06-22 23:25:16 +02:00
|
|
|
gS6Info.category = SCENARIO_CATEGORY_OTHER;
|
2017-09-22 07:56:24 +02:00
|
|
|
viewport_init_all();
|
|
|
|
news_item_init_queue();
|
2017-11-15 02:35:05 +01:00
|
|
|
context_open_window_view(WV_EDITOR_MAIN);
|
2017-09-22 07:56:24 +02:00
|
|
|
FinaliseMainView();
|
|
|
|
gScreenAge = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00672957
|
|
|
|
*/
|
|
|
|
void LoadTrackDesigner()
|
|
|
|
{
|
|
|
|
audio_stop_all_music_and_sounds();
|
|
|
|
gScreenFlags = SCREEN_FLAGS_TRACK_DESIGNER;
|
2018-06-22 23:25:16 +02:00
|
|
|
gScreenAge = 0;
|
2017-09-22 07:56:24 +02:00
|
|
|
|
|
|
|
object_manager_unload_all_objects();
|
|
|
|
object_list_load();
|
2018-05-27 17:11:54 +02:00
|
|
|
OpenRCT2::GetContext()->GetGameState()->InitAll(150);
|
2017-09-22 07:56:24 +02:00
|
|
|
SetAllLandOwned();
|
|
|
|
gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION;
|
|
|
|
viewport_init_all();
|
2018-06-22 23:25:16 +02:00
|
|
|
rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN);
|
2017-09-22 07:56:24 +02:00
|
|
|
window_set_location(mainWindow, 2400, 2400, 112);
|
|
|
|
load_palette();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006729FD
|
|
|
|
*/
|
|
|
|
void LoadTrackManager()
|
|
|
|
{
|
|
|
|
audio_stop_all_music_and_sounds();
|
|
|
|
gScreenFlags = SCREEN_FLAGS_TRACK_MANAGER;
|
2018-06-22 23:25:16 +02:00
|
|
|
gScreenAge = 0;
|
2017-09-22 07:56:24 +02:00
|
|
|
|
|
|
|
object_manager_unload_all_objects();
|
|
|
|
object_list_load();
|
2018-05-27 17:11:54 +02:00
|
|
|
OpenRCT2::GetContext()->GetGameState()->InitAll(150);
|
2017-09-22 07:56:24 +02:00
|
|
|
SetAllLandOwned();
|
|
|
|
gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION;
|
|
|
|
viewport_init_all();
|
2018-06-22 23:25:16 +02:00
|
|
|
rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN);
|
2017-09-22 07:56:24 +02:00
|
|
|
window_set_location(mainWindow, 2400, 2400, 112);
|
|
|
|
load_palette();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0068ABEC
|
|
|
|
*/
|
|
|
|
static void SetAllLandOwned()
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t mapSize = gMapSize;
|
2017-09-22 07:56:24 +02:00
|
|
|
|
|
|
|
game_do_command(64, 1, 64, 2, GAME_COMMAND_SET_LAND_OWNERSHIP, (mapSize - 3) * 32, (mapSize - 3) * 32);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006758C0
|
|
|
|
*/
|
2018-06-22 23:25:16 +02:00
|
|
|
bool LoadLandscape(const utf8* path)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
|
|
|
// #4996: Make sure the object selection window closes here to prevent unload objects
|
|
|
|
// after we have loaded a new park.
|
|
|
|
window_close_all();
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t extension = get_file_extension_type(path);
|
2017-09-22 07:56:24 +02:00
|
|
|
switch (extension)
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
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;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006A2B02
|
|
|
|
*/
|
2018-06-22 23:25:16 +02:00
|
|
|
static bool LoadLandscapeFromSV4(const char* path)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
|
|
|
load_from_sv4(path);
|
|
|
|
ClearMapForEditing(true);
|
|
|
|
|
|
|
|
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
|
2018-06-22 23:25:16 +02:00
|
|
|
gScreenAge = 0;
|
2017-09-22 07:56:24 +02:00
|
|
|
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
|
|
|
|
viewport_init_all();
|
2017-11-15 02:35:05 +01:00
|
|
|
context_open_window_view(WV_EDITOR_MAIN);
|
2017-09-22 07:56:24 +02:00
|
|
|
FinaliseMainView();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
static bool LoadLandscapeFromSC4(const char* path)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
|
|
|
load_from_sc4(path);
|
|
|
|
ClearMapForEditing(false);
|
|
|
|
|
|
|
|
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
|
2018-06-22 23:25:16 +02:00
|
|
|
gScreenAge = 0;
|
2017-09-22 07:56:24 +02:00
|
|
|
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
|
|
|
|
viewport_init_all();
|
2017-11-15 02:35:05 +01:00
|
|
|
context_open_window_view(WV_EDITOR_MAIN);
|
2017-09-22 07:56:24 +02:00
|
|
|
FinaliseMainView();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006758FE
|
|
|
|
*/
|
2018-06-22 23:25:16 +02:00
|
|
|
static bool ReadS6(const char* path)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
auto extension = path_get_extension(path);
|
2017-09-22 07:56:24 +02:00
|
|
|
if (_stricmp(extension, ".sc6") == 0)
|
|
|
|
{
|
2018-05-21 01:11:42 +02:00
|
|
|
load_from_sc6(path);
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
2018-08-16 16:16:56 +02:00
|
|
|
else if (_stricmp(extension, ".sv6") == 0 || _stricmp(extension, ".sv7") == 0)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2018-05-21 01:11:42 +02:00
|
|
|
load_from_sv6(path);
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ClearMapForEditing(true);
|
|
|
|
|
|
|
|
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
|
2018-06-22 23:25:16 +02:00
|
|
|
gScreenAge = 0;
|
2017-09-22 07:56:24 +02:00
|
|
|
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
|
|
|
|
viewport_init_all();
|
2017-11-15 02:35:05 +01:00
|
|
|
context_open_window_view(WV_EDITOR_MAIN);
|
2017-09-22 07:56:24 +02:00
|
|
|
FinaliseMainView();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ClearMapForEditing(bool fromSave)
|
|
|
|
{
|
|
|
|
map_remove_all_rides();
|
|
|
|
|
|
|
|
//
|
2018-06-22 23:25:16 +02:00
|
|
|
for (auto& banner : gBanners)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2017-12-20 02:50:18 +01:00
|
|
|
if (banner.type == 255)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2017-12-20 02:50:18 +01:00
|
|
|
banner.flags &= ~BANNER_FLAG_LINKED_TO_RIDE;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t i;
|
2018-06-22 23:25:16 +02:00
|
|
|
Ride* ride;
|
|
|
|
FOR_ALL_RIDES (i, ride)
|
|
|
|
{
|
|
|
|
user_string_free(ride->name);
|
|
|
|
}
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ride_init_all();
|
|
|
|
|
|
|
|
//
|
2018-06-20 17:28:51 +02:00
|
|
|
for (int32_t i = 0; i < MAX_SPRITES; i++)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
rct_sprite* sprite = get_sprite(i);
|
2018-08-20 18:27:40 +02:00
|
|
|
user_string_free(sprite->generic.name_string_idx);
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
reset_sprite_list();
|
|
|
|
staff_reset_modes();
|
2018-06-22 23:25:16 +02:00
|
|
|
gNumGuestsInPark = 0;
|
2017-09-22 07:56:24 +02:00
|
|
|
gNumGuestsHeadingForPark = 0;
|
|
|
|
gNumGuestsInParkLastWeek = 0;
|
2018-06-22 23:25:16 +02:00
|
|
|
gGuestChangeModifier = 0;
|
2017-09-22 07:56:24 +02:00
|
|
|
if (fromSave)
|
|
|
|
{
|
|
|
|
research_populate_list_random();
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2018-08-12 13:50:40 +02:00
|
|
|
gGuestInitialCash = std::clamp(gGuestInitialCash, (money16)MONEY(10, 00), (money16)MAX_ENTRANCE_FEE);
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-06-20 17:11:35 +02:00
|
|
|
gInitialCash = std::min(gInitialCash, 100000);
|
2017-09-22 07:56:24 +02:00
|
|
|
finance_reset_cash_to_initial();
|
|
|
|
|
2018-08-12 13:50:40 +02:00
|
|
|
gBankLoan = std::clamp(gBankLoan, MONEY(0, 00), MONEY(5000000, 00));
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-08-12 13:50:40 +02:00
|
|
|
gMaxBankLoan = std::clamp(gMaxBankLoan, MONEY(0, 00), MONEY(5000000, 00));
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-08-12 13:50:40 +02:00
|
|
|
gBankLoanInterestRate = std::clamp<uint8_t>(gBankLoanInterestRate, 5, 80);
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
climate_reset(gClimate);
|
|
|
|
|
|
|
|
news_item_init_queue();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0067009A
|
|
|
|
*/
|
|
|
|
void OpenWindowsForCurrentStep()
|
|
|
|
{
|
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (gS6Info.editor_step)
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
case EDITOR_STEP_OBJECT_SELECTION:
|
|
|
|
if (window_find_by_class(WC_EDITOR_OBJECT_SELECTION))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
if (window_find_by_class(WC_INSTALL_TRACK))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)
|
|
|
|
{
|
|
|
|
object_manager_unload_all_objects();
|
|
|
|
}
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
context_open_window(WC_EDITOR_OBJECT_SELECTION);
|
|
|
|
break;
|
|
|
|
case EDITOR_STEP_INVENTIONS_LIST_SET_UP:
|
|
|
|
if (window_find_by_class(WC_EDITOR_INVENTION_LIST))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
context_open_window(WC_EDITOR_INVENTION_LIST);
|
|
|
|
break;
|
|
|
|
case EDITOR_STEP_OPTIONS_SELECTION:
|
|
|
|
if (window_find_by_class(WC_EDITOR_SCENARIO_OPTIONS))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
context_open_window(WC_EDITOR_SCENARIO_OPTIONS);
|
|
|
|
break;
|
|
|
|
case EDITOR_STEP_OBJECTIVE_SELECTION:
|
|
|
|
if (window_find_by_class(WC_EDTIOR_OBJECTIVE_OPTIONS))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
context_open_window(WC_EDTIOR_OBJECTIVE_OPTIONS);
|
|
|
|
break;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void FinaliseMainView()
|
|
|
|
{
|
2018-06-02 01:07:14 +02:00
|
|
|
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
|
|
|
windowManager->SetMainView(gSavedViewX, gSavedViewY, gSavedViewZoom, gSavedViewRotation);
|
2017-09-22 07:56:24 +02:00
|
|
|
|
|
|
|
reset_all_sprite_quadrant_placements();
|
|
|
|
scenery_set_default_placement_configuration();
|
2017-10-07 01:28:00 +02:00
|
|
|
|
2018-06-02 01:07:14 +02:00
|
|
|
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_NEW_RIDES));
|
2017-10-07 01:28:00 +02:00
|
|
|
|
2017-09-22 07:56:24 +02:00
|
|
|
gWindowUpdateTicks = 0;
|
|
|
|
load_palette();
|
2017-11-23 00:42:12 +01:00
|
|
|
|
2018-06-02 01:07:14 +02:00
|
|
|
windowManager->BroadcastIntent(Intent(INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD));
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006AB9B8
|
|
|
|
*/
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t CheckObjectSelection()
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
bool isTrackDesignerManager = gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER);
|
2017-09-22 07:56:24 +02:00
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t parkSize = park_calculate_size();
|
2017-09-22 07:56:24 +02:00
|
|
|
if (parkSize == 0)
|
|
|
|
{
|
|
|
|
gGameCommandErrorText = STR_PARK_MUST_OWN_SOME_LAND;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-12-15 18:57:23 +01:00
|
|
|
if (gParkEntrances.size() == 0)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2018-12-15 18:57:23 +01:00
|
|
|
gGameCommandErrorText = STR_NO_PARK_ENTRANCES;
|
|
|
|
return false;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
for (const auto& parkEntrance : gParkEntrances)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
int32_t x = parkEntrance.x;
|
|
|
|
int32_t y = parkEntrance.y;
|
|
|
|
int32_t z = parkEntrance.z / 8;
|
2019-01-05 16:41:19 +01:00
|
|
|
int32_t direction = direction_reverse(parkEntrance.direction);
|
2017-09-22 07:56:24 +02:00
|
|
|
|
|
|
|
switch (footpath_is_connected_to_map_edge(x, y, z, direction, 0))
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
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;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-15 19:23:40 +01:00
|
|
|
if (gPeepSpawns.size() == 0)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2018-12-15 19:23:40 +01:00
|
|
|
gGameCommandErrorText = STR_PEEP_SPAWNS_NOT_SET;
|
|
|
|
return false;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-04-20 13:56:37 +02:00
|
|
|
void GameCommandEditScenarioOptions(
|
2018-07-21 13:51:54 +02:00
|
|
|
[[maybe_unused]] int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, [[maybe_unused]] int32_t* esi,
|
|
|
|
[[maybe_unused]] int32_t* edi, [[maybe_unused]] int32_t* ebp)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
|
|
|
if (!(*ebx & GAME_COMMAND_FLAG_APPLY))
|
|
|
|
{
|
|
|
|
*ebx = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (*ecx)
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
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:
|
2018-08-12 13:50:40 +02:00
|
|
|
gInitialCash = std::clamp(*edx, MONEY(0, 00), MONEY(1000000, 00));
|
2018-06-22 23:25:16 +02:00
|
|
|
gCash = gInitialCash;
|
|
|
|
window_invalidate_by_class(WC_FINANCES);
|
|
|
|
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
|
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETINITIALLOAN:
|
2018-08-12 13:50:40 +02:00
|
|
|
gBankLoan = std::clamp(*edx, MONEY(0, 00), MONEY(5000000, 00));
|
2018-06-22 23:25:16 +02:00
|
|
|
gMaxBankLoan = std::max(gBankLoan, gMaxBankLoan);
|
|
|
|
window_invalidate_by_class(WC_FINANCES);
|
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETMAXIMUMLOANSIZE:
|
2018-08-12 13:50:40 +02:00
|
|
|
gMaxBankLoan = std::clamp(*edx, MONEY(0, 00), MONEY(5000000, 00));
|
2018-06-22 23:25:16 +02:00
|
|
|
gBankLoan = std::min(gBankLoan, gMaxBankLoan);
|
|
|
|
window_invalidate_by_class(WC_FINANCES);
|
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETANNUALINTERESTRATE:
|
2018-08-12 13:50:40 +02:00
|
|
|
gBankLoanInterestRate = std::clamp(*edx, 0, 80);
|
2018-06-22 23:25:16 +02:00
|
|
|
window_invalidate_by_class(WC_FINANCES);
|
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETFORBIDMARKETINGCAMPAIGNS:
|
2017-09-22 07:56:24 +02:00
|
|
|
if (*edx != 0)
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
gParkFlags |= PARK_FLAGS_FORBID_MARKETING_CAMPAIGN;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
gParkFlags &= ~PARK_FLAGS_FORBID_MARKETING_CAMPAIGN;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
2018-06-22 23:25:16 +02:00
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETAVERAGECASHPERGUEST:
|
2018-08-12 13:50:40 +02:00
|
|
|
gGuestInitialCash = std::clamp(*edx, MONEY(0, 00), MONEY(1000, 00));
|
2018-06-22 23:25:16 +02:00
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETGUESTINITIALHAPPINESS:
|
2018-08-12 13:50:40 +02:00
|
|
|
gGuestInitialHappiness = std::clamp(*edx, 40, 250);
|
2018-06-22 23:25:16 +02:00
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETGUESTINITIALHUNGER:
|
2018-08-12 13:50:40 +02:00
|
|
|
gGuestInitialHunger = std::clamp(*edx, 40, 250);
|
2018-06-22 23:25:16 +02:00
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETGUESTINITIALTHIRST:
|
2018-08-12 13:50:40 +02:00
|
|
|
gGuestInitialThirst = std::clamp(*edx, 40, 250);
|
2018-06-22 23:25:16 +02:00
|
|
|
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:
|
2017-09-22 07:56:24 +02:00
|
|
|
if (*edx != 0)
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
gParkFlags |= PARK_FLAGS_PREF_MORE_INTENSE_RIDES;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gParkFlags &= ~PARK_FLAGS_PREF_MORE_INTENSE_RIDES;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETCOSTTOBUYLAND:
|
2018-08-12 13:50:40 +02:00
|
|
|
gLandPrice = std::clamp(*edx, MONEY(5, 00), MONEY(200, 00));
|
2018-06-22 23:25:16 +02:00
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETCOSTTOBUYCONSTRUCTIONRIGHTS:
|
2018-08-12 13:50:40 +02:00
|
|
|
gConstructionRightsPrice = std::clamp(*edx, MONEY(5, 00), MONEY(200, 00));
|
2018-06-22 23:25:16 +02:00
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETPARKCHARGEMETHOD:
|
|
|
|
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
|
|
|
|
{
|
|
|
|
if (*edx == 0)
|
|
|
|
{
|
|
|
|
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
|
|
|
|
gParkFlags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES;
|
|
|
|
gParkEntranceFee = MONEY(0, 00);
|
|
|
|
}
|
|
|
|
else if (*edx == 1)
|
|
|
|
{
|
|
|
|
gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
|
|
|
|
gParkFlags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES;
|
|
|
|
gParkEntranceFee = MONEY(10, 00);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
|
|
|
|
gParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES;
|
|
|
|
gParkEntranceFee = MONEY(10, 00);
|
|
|
|
}
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
if (*edx == 0)
|
|
|
|
{
|
|
|
|
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
|
|
|
|
gParkFlags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES;
|
|
|
|
}
|
|
|
|
else if (*edx == 1)
|
|
|
|
{
|
|
|
|
gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
|
|
|
|
gParkFlags &= ~PARK_FLAGS_UNLOCK_ALL_PRICES;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
|
|
|
|
gParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES;
|
|
|
|
}
|
|
|
|
window_invalidate_by_class(WC_PARK_INFORMATION);
|
|
|
|
window_invalidate_by_class(WC_RIDE);
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
2018-06-22 23:25:16 +02:00
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETPARKCHARGEENTRYFEE:
|
2018-08-12 13:50:40 +02:00
|
|
|
gParkEntranceFee = std::clamp(*edx, MONEY(0, 00), MAX_ENTRANCE_FEE);
|
2017-09-22 07:56:24 +02:00
|
|
|
window_invalidate_by_class(WC_PARK_INFORMATION);
|
2018-06-22 23:25:16 +02:00
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETFORBIDTREEREMOVAL:
|
|
|
|
if (*edx != 0)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
gParkFlags |= PARK_FLAGS_FORBID_TREE_REMOVAL;
|
2017-10-10 11:57:25 +02:00
|
|
|
}
|
2018-06-22 23:25:16 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gParkFlags &= ~PARK_FLAGS_FORBID_TREE_REMOVAL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETFORBIDLANDSCAPECHANGES:
|
|
|
|
if (*edx != 0)
|
2017-10-10 11:57:25 +02:00
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
gParkFlags |= PARK_FLAGS_FORBID_LANDSCAPE_CHANGES;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
gParkFlags &= ~PARK_FLAGS_FORBID_LANDSCAPE_CHANGES;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
2018-06-22 23:25:16 +02:00
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETFORBIDHIGHCONSTRUCTION:
|
|
|
|
if (*edx != 0)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
gParkFlags |= PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
|
2017-10-10 11:57:25 +02:00
|
|
|
}
|
2018-06-22 23:25:16 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gParkFlags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETPARKRATINGHIGHERDIFFICULTLEVEL:
|
|
|
|
if (*edx != 0)
|
2017-10-10 11:57:25 +02:00
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
gParkFlags |= PARK_FLAGS_DIFFICULT_PARK_RATING;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
gParkFlags &= ~PARK_FLAGS_DIFFICULT_PARK_RATING;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
2018-06-22 23:25:16 +02:00
|
|
|
break;
|
|
|
|
case EDIT_SCENARIOOPTIONS_SETGUESTGENERATIONHIGHERDIFFICULTLEVEL:
|
|
|
|
if (*edx != 0)
|
|
|
|
{
|
|
|
|
gParkFlags |= PARK_FLAGS_DIFFICULT_GUEST_GENERATION;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gParkFlags &= ~PARK_FLAGS_DIFFICULT_GUEST_GENERATION;
|
|
|
|
}
|
|
|
|
break;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
window_invalidate_by_class(WC_EDITOR_SCENARIO_OPTIONS);
|
|
|
|
*ebx = 0;
|
|
|
|
}
|
2018-02-11 18:56:12 +01:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint8_t GetSelectedObjectFlags(int32_t objectType, size_t index)
|
2018-02-11 18:56:12 +01:00
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
uint8_t result = 0;
|
2018-06-22 23:25:16 +02:00
|
|
|
auto& list = _editorSelectedObjectFlags[objectType];
|
2018-02-11 18:56:12 +01:00
|
|
|
if (list.size() > index)
|
|
|
|
{
|
|
|
|
result = list[index];
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
void ClearSelectedObject(int32_t objectType, size_t index, uint32_t flags)
|
2018-02-11 18:56:12 +01:00
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
auto& list = _editorSelectedObjectFlags[objectType];
|
2018-02-11 18:56:12 +01:00
|
|
|
if (list.size() <= index)
|
|
|
|
{
|
|
|
|
list.resize(index + 1);
|
|
|
|
}
|
|
|
|
list[index] &= ~flags;
|
|
|
|
}
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
void SetSelectedObject(int32_t objectType, size_t index, uint32_t flags)
|
2018-02-11 18:56:12 +01:00
|
|
|
{
|
2018-06-22 23:25:16 +02:00
|
|
|
auto& list = _editorSelectedObjectFlags[objectType];
|
2018-02-11 18:56:12 +01:00
|
|
|
if (list.size() <= index)
|
|
|
|
{
|
|
|
|
list.resize(index + 1);
|
|
|
|
}
|
|
|
|
list[index] |= flags;
|
|
|
|
}
|
2018-06-22 23:25:16 +02:00
|
|
|
} // namespace Editor
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
void editor_open_windows_for_current_step()
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
Editor::OpenWindowsForCurrentStep();
|
|
|
|
}
|
2017-09-22 07:56:24 +02:00
|
|
|
|
2018-06-22 23:25:16 +02:00
|
|
|
void game_command_edit_scenario_options(
|
|
|
|
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
Editor::GameCommandEditScenarioOptions(eax, ebx, ecx, edx, esi, edi, ebp);
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|