Files
OpenRCT2-Web/src/editor.c
T

572 lines
14 KiB
C
Raw Normal View History

#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
2014-04-09 14:43:27 +01:00
/*****************************************************************************
* 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
2014-04-09 14:43:27 +01:00
*
* 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
2014-04-09 14:43:27 +01:00
*****************************************************************************/
#pragma endregion
2014-04-09 14:43:27 +01:00
#include "addresses.h"
2014-10-06 17:36:58 +01:00
#include "audio/audio.h"
#include "drawing/drawing.h"
2014-04-09 14:43:27 +01:00
#include "editor.h"
2014-05-02 02:12:14 +01:00
#include "game.h"
2014-10-06 17:36:58 +01:00
#include "interface/window.h"
#include "interface/viewport.h"
#include "localisation/date.h"
#include "localisation/localisation.h"
#include "management/finance.h"
#include "management/news_item.h"
2014-05-24 18:07:29 +01:00
#include "object.h"
2016-07-07 22:58:48 +01:00
#include "object/ObjectManager.h"
#include "peep/staff.h"
2015-02-12 20:51:40 +00:00
#include "platform/platform.h"
2015-01-21 15:54:33 +00:00
#include "rct1.h"
2014-10-06 17:36:58 +01:00
#include "ride/ride.h"
2014-11-23 23:03:45 +00:00
#include "scenario.h"
#include "util/sawyercoding.h"
2014-10-11 01:18:08 +01:00
#include "util/util.h"
#include "world/banner.h"
2014-11-23 23:03:45 +00:00
#include "world/climate.h"
2015-07-06 14:40:37 +01:00
#include "world/footpath.h"
2014-10-06 17:36:58 +01:00
#include "world/map.h"
#include "world/park.h"
#include "world/scenery.h"
2014-10-06 17:36:58 +01:00
#include "world/sprite.h"
2014-04-09 17:06:47 +01:00
2016-09-05 22:26:02 +01:00
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,
};
void editor_convert_save_to_scenario_callback(int result);
2014-04-09 17:06:47 +01:00
static void set_all_land_owned();
static int editor_load_landscape_from_sv4(const char *path);
static int editor_load_landscape_from_sc4(const char *path);
2015-04-01 18:13:25 +01:00
static void editor_finalise_main_view();
static int editor_read_s6(const char *path);
2016-04-22 19:26:15 +01:00
static void editor_clear_map_for_editing();
2014-05-24 12:28:26 +09:00
2014-04-09 14:43:27 +01:00
/**
*
* rct2: 0x0066FFE1
*/
void editor_load()
{
2014-04-09 17:06:47 +01:00
rct_window *mainWindow;
2015-11-16 22:39:40 +00:00
audio_pause_sounds();
audio_unpause_sounds();
2016-07-07 22:58:48 +01:00
object_manager_unload_all_objects();
object_list_load();
2015-02-09 18:32:58 +00:00
map_init(150);
2015-02-17 19:40:54 -08:00
banner_init();
2014-05-05 23:10:28 +01:00
reset_park_entrances();
user_string_clear_all();
2014-06-21 13:31:28 +01:00
reset_sprite_list();
2014-04-09 17:06:47 +01:00
ride_init_all();
2014-05-06 22:04:09 +01:00
window_guest_list_init_vars_a();
staff_reset_modes();
2014-04-09 17:06:47 +01:00
park_init();
2014-05-05 23:10:28 +01:00
finance_init();
2014-04-09 17:06:47 +01:00
date_reset();
2014-05-06 22:04:09 +01:00
window_guest_list_init_vars_b();
window_staff_list_init_vars();
2016-04-23 11:16:46 +01:00
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
2016-05-20 23:26:19 +01:00
gS6Info->editor_step = EDITOR_STEP_OBJECT_SELECTION;
2016-04-23 00:51:22 +01:00
gParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
2014-05-09 23:11:51 +01:00
window_new_ride_init_vars();
2014-04-09 17:06:47 +01:00
RCT2_GLOBAL(0x0141F571, uint8) = 4;
viewport_init_all();
news_item_init_queue();
window_editor_main_open();
2014-04-09 17:06:47 +01:00
mainWindow = window_get_main();
2014-04-11 17:38:15 +01:00
window_scroll_to_location(mainWindow, 2400, 2400, 112);
2014-08-24 12:33:37 +01:00
mainWindow->flags &= ~WF_SCROLLING_TO_LOCATION;
load_palette();
2014-04-09 17:06:47 +01:00
gfx_invalidate_screen();
2016-04-23 11:16:46 +01:00
gScreenAge = 0;
2016-07-14 14:07:49 +02:00
safe_strcpy(gScenarioName, language_get_string(STR_MY_NEW_SCENARIO), 64);
2014-11-23 23:03:45 +00:00
}
2014-04-09 14:43:27 +01:00
/**
*
* rct2: 0x00672781
*/
void editor_convert_save_to_scenario()
{
2014-11-23 23:03:45 +00:00
tool_cancel();
window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, NULL);
gLoadSaveCallback = editor_convert_save_to_scenario_callback;
}
2014-11-23 23:03:45 +00:00
void editor_convert_save_to_scenario_callback(int result)
{
if (result != MODAL_RESULT_OK) {
2014-11-23 23:03:45 +00:00
return;
}
2016-05-20 23:26:19 +01:00
rct_s6_info *s6Info = gS6Info;
2014-11-23 23:03:45 +00:00
2016-04-23 00:51:22 +01:00
if (gParkFlags & PARK_FLAGS_NO_MONEY)
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
2014-11-23 23:03:45 +00:00
else
2016-04-23 00:51:22 +01:00
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
gParkFlags |= PARK_FLAGS_NO_MONEY;
2014-11-23 23:03:45 +00:00
safe_strcpy(s6Info->name, gScenarioName, 64);
safe_strcpy(s6Info->details, gScenarioDetails, 256);
2016-04-23 02:14:14 +01:00
s6Info->objective_type = gScenarioObjectiveType;
2016-04-23 02:16:32 +01:00
s6Info->objective_arg_1 = gScenarioObjectiveYear;
s6Info->objective_arg_2 = gScenarioObjectiveCurrency;
s6Info->objective_arg_3 = gScenarioObjectiveNumGuests;
2016-04-23 10:53:48 +01:00
climate_reset(gClimate);
2014-11-23 23:03:45 +00:00
2016-04-23 11:16:46 +01:00
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
2015-10-15 22:16:27 +01:00
s6Info->editor_step = EDITOR_STEP_OBJECTIVE_SELECTION;
2016-01-01 13:29:13 +00:00
s6Info->category = SCENARIO_CATEGORY_OTHER;
2014-11-23 23:03:45 +00:00
viewport_init_all();
news_item_init_queue();
window_editor_main_open();
2015-04-01 18:13:25 +01:00
editor_finalise_main_view();
2016-04-23 11:16:46 +01:00
gScreenAge = 0;
2014-04-09 14:43:27 +01:00
}
/**
*
* rct2: 0x00672957
*/
void trackdesigner_load()
{
2014-04-09 17:06:47 +01:00
rct_window *mainWindow;
2016-04-23 11:16:46 +01:00
gScreenFlags = SCREEN_FLAGS_TRACK_DESIGNER;
gScreenAge = 0;
2016-03-26 15:41:58 +00:00
2016-07-07 22:58:48 +01:00
object_manager_unload_all_objects();
object_list_load();
2015-02-09 18:32:58 +00:00
map_init(150);
2014-04-09 17:06:47 +01:00
set_all_land_owned();
2015-02-17 19:40:54 -08:00
banner_init();
2014-05-05 23:10:28 +01:00
reset_park_entrances();
user_string_clear_all();
2015-10-20 20:16:30 +02:00
reset_sprite_list();
2014-04-09 17:06:47 +01:00
ride_init_all();
2014-05-06 22:04:09 +01:00
window_guest_list_init_vars_a();
staff_reset_modes();
2014-04-09 17:06:47 +01:00
park_init();
2014-05-05 23:10:28 +01:00
finance_init();
2014-04-09 17:06:47 +01:00
date_reset();
2014-05-06 22:04:09 +01:00
window_guest_list_init_vars_b();
window_staff_list_init_vars();
2016-05-20 23:26:19 +01:00
gS6Info->editor_step = EDITOR_STEP_OBJECT_SELECTION;
2014-05-09 23:11:51 +01:00
window_new_ride_init_vars();
2014-04-09 17:06:47 +01:00
viewport_init_all();
news_item_init_queue();
window_editor_main_open();
2014-04-09 17:06:47 +01:00
mainWindow = window_get_main();
2014-04-11 17:38:15 +01:00
window_scroll_to_location(mainWindow, 2400, 2400, 112);
2014-08-24 12:33:37 +01:00
mainWindow->flags &= ~WF_SCROLLING_TO_LOCATION;
load_palette();
2014-04-09 17:06:47 +01:00
gfx_invalidate_screen();
2014-04-09 14:43:27 +01:00
}
/**
*
* rct2: 0x006729FD
*/
void trackmanager_load()
{
2014-04-09 17:06:47 +01:00
rct_window *mainWindow;
2016-04-23 11:16:46 +01:00
gScreenFlags = SCREEN_FLAGS_TRACK_MANAGER;
gScreenAge = 0;
2016-03-26 15:41:58 +00:00
2016-07-07 22:58:48 +01:00
object_manager_unload_all_objects();
object_list_load();
2015-02-09 18:32:58 +00:00
map_init(150);
2014-04-09 17:06:47 +01:00
set_all_land_owned();
2015-02-17 19:40:54 -08:00
banner_init();
2014-05-05 23:10:28 +01:00
reset_park_entrances();
user_string_clear_all();
2014-06-21 13:31:28 +01:00
reset_sprite_list();
2014-04-09 17:06:47 +01:00
ride_init_all();
2014-05-06 22:04:09 +01:00
window_guest_list_init_vars_a();
staff_reset_modes();
2014-04-09 17:06:47 +01:00
park_init();
2014-05-05 23:10:28 +01:00
finance_init();
2014-04-09 17:06:47 +01:00
date_reset();
2014-05-06 22:04:09 +01:00
window_guest_list_init_vars_b();
window_staff_list_init_vars();
2016-05-20 23:26:19 +01:00
gS6Info->editor_step = EDITOR_STEP_OBJECT_SELECTION;
2014-05-09 23:11:51 +01:00
window_new_ride_init_vars();
2014-04-09 17:06:47 +01:00
viewport_init_all();
news_item_init_queue();
window_editor_main_open();
2014-04-09 17:06:47 +01:00
mainWindow = window_get_main();
2014-04-11 17:38:15 +01:00
window_scroll_to_location(mainWindow, 2400, 2400, 112);
2014-08-24 12:33:37 +01:00
mainWindow->flags &= ~WF_SCROLLING_TO_LOCATION;
load_palette();
2014-04-09 17:06:47 +01:00
gfx_invalidate_screen();
2014-09-10 19:36:11 +01:00
}
2014-04-09 17:06:47 +01:00
/**
*
* rct2: 0x0068ABEC
*/
static void set_all_land_owned()
{
int mapSize = gMapSize;
2014-04-09 17:06:47 +01:00
2016-05-01 19:41:48 +01:00
game_do_command(64, 1, 64, 2, GAME_COMMAND_SET_LAND_OWNERSHIP, (mapSize - 3) * 32, (mapSize - 3) * 32);
}
/**
*
* rct2: 0x006758C0
*/
2016-01-09 00:25:09 +00:00
bool editor_load_landscape(const utf8 *path)
{
window_close_construction_windows();
2015-10-20 20:16:30 +02:00
char *extension = strrchr(path, '.');
if (extension != NULL) {
if (_stricmp(extension, ".sv4") == 0) {
2016-01-09 00:25:09 +00:00
return editor_load_landscape_from_sv4(path);
} else if (_stricmp(extension, ".sc4") == 0) {
2016-01-09 00:25:09 +00:00
return editor_load_landscape_from_sc4(path);
}
}
// Load SC6 / SV6
2016-01-09 00:25:09 +00:00
return editor_read_s6(path);
}
/**
*
* rct2: 0x006A2B02
*/
static int editor_load_landscape_from_sv4(const char *path)
{
2016-04-22 19:26:15 +01:00
rct1_load_saved_game(path);
editor_clear_map_for_editing();
2016-05-20 23:26:19 +01:00
gS6Info->editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
2016-04-23 11:16:46 +01:00
gScreenAge = 0;
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
2016-04-22 19:26:15 +01:00
viewport_init_all();
window_editor_main_open();
editor_finalise_main_view();
return 1;
}
static int editor_load_landscape_from_sc4(const char *path)
{
2016-04-22 19:26:15 +01:00
rct1_load_scenario(path);
editor_clear_map_for_editing();
2016-05-20 23:26:19 +01:00
gS6Info->editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
2016-04-23 11:16:46 +01:00
gScreenAge = 0;
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
2016-04-22 19:26:15 +01:00
viewport_init_all();
window_editor_main_open();
editor_finalise_main_view();
return 1;
}
/**
*
* rct2: 0x006758FE
*/
static int editor_read_s6(const char *path)
{
2016-08-14 15:50:52 +01:00
if (!scenario_load(path)) {
return 0;
}
2016-08-14 15:50:52 +01:00
editor_clear_map_for_editing();
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;
2014-10-21 17:59:47 +01:00
}
2016-04-22 19:26:15 +01:00
static void editor_clear_map_for_editing()
{
2016-08-06 22:38:46 +02:00
rct_s6_header *s6Header = RCT2_ADDRESS(0x009E34E4, rct_s6_header);
2016-04-22 19:26:15 +01:00
map_remove_all_rides();
//
for (int i = 0; i < MAX_BANNERS; i++) {
if (gBanners[i].type == 255) {
gBanners[i].flags &= ~BANNER_FLAG_2;
}
}
//
{
int i;
rct_ride *ride;
FOR_ALL_RIDES(i, ride) {
user_string_free(ride->name);
}
}
ride_init_all();
//
for (int i = 0; i < MAX_SPRITES; i++) {
2016-07-17 22:14:44 +02:00
rct_sprite *sprite = get_sprite(i);
2016-04-22 19:26:15 +01:00
user_string_free(sprite->unknown.name_string_idx);
}
reset_sprite_list();
staff_reset_modes();
2016-04-23 01:00:00 +01:00
gNumGuestsInPark = 0;
2016-04-23 02:56:55 +01:00
gNumGuestsHeadingForPark = 0;
2016-04-23 02:55:14 +01:00
gNumGuestsInParkLastWeek = 0;
2016-04-23 02:51:38 +01:00
gGuestChangeModifier = 0;
2016-04-22 19:26:15 +01:00
if (s6Header->type != S6_TYPE_SCENARIO) {
research_populate_list_random();
research_remove_non_separate_vehicle_types();
2016-04-23 00:51:22 +01:00
if (gParkFlags & PARK_FLAGS_NO_MONEY)
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
2016-04-22 19:26:15 +01:00
else
2016-04-23 00:51:22 +01:00
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
gParkFlags |= PARK_FLAGS_NO_MONEY;
2016-04-22 19:26:15 +01:00
2016-04-23 01:00:00 +01:00
if (gParkEntranceFee == 0)
2016-04-23 00:51:22 +01:00
gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY;
2016-04-22 19:26:15 +01:00
else
2016-04-23 00:51:22 +01:00
gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY;
2016-04-22 19:26:15 +01:00
2016-04-23 00:51:22 +01:00
gParkFlags &= ~PARK_FLAGS_18;
2016-04-22 19:26:15 +01:00
2016-04-23 02:35:03 +01:00
gGuestInitialCash = clamp(MONEY(10,00), gGuestInitialCash, MONEY(100,00));
2016-04-22 19:26:15 +01:00
gInitialCash = min(gInitialCash, 100000);
2016-04-22 19:26:15 +01:00
finance_reset_cash_to_initial();
2016-04-23 02:00:44 +01:00
gBankLoan = clamp(
2016-04-22 19:26:15 +01:00
MONEY(0,00),
2016-04-23 02:00:44 +01:00
gBankLoan,
2016-04-22 19:26:15 +01:00
MONEY(5000000,00)
);
gMaxBankLoan = clamp(
2016-04-22 19:26:15 +01:00
MONEY(0,00),
gMaxBankLoan,
2016-04-22 19:26:15 +01:00
MONEY(5000000,00)
);
2016-04-23 02:06:56 +01:00
gBankLoanInterestRate = clamp(5, gBankLoanInterestRate, 80);
2016-04-22 19:26:15 +01:00
}
2016-04-23 10:53:48 +01:00
climate_reset(gClimate);
2016-04-22 19:26:15 +01:00
news_item_init_queue();
}
/**
*
* rct2: 0x0067009A
*/
void editor_open_windows_for_current_step()
{
2016-04-23 11:16:46 +01:00
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
return;
2016-05-20 23:26:19 +01:00
switch (gS6Info->editor_step) {
case EDITOR_STEP_OBJECT_SELECTION:
if (window_find_by_class(WC_EDITOR_OBJECT_SELECTION))
return;
if (window_find_by_class(49))
return;
2016-04-23 11:16:46 +01:00
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) {
2016-07-07 22:58:48 +01:00
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;
window_editor_inventions_list_open();
break;
case EDITOR_STEP_OPTIONS_SELECTION:
if (window_find_by_class(WC_EDITOR_SCENARIO_OPTIONS))
return;
window_editor_scenario_options_open();
break;
case EDITOR_STEP_OBJECTIVE_SELECTION:
if (window_find_by_class(WC_EDTIOR_OBJECTIVE_OPTIONS))
return;
window_editor_objective_options_open();
break;
}
}
2015-03-31 13:06:34 +01:00
2015-04-01 18:13:25 +01:00
static void editor_finalise_main_view()
{
rct_window *w = window_get_main();
rct_viewport *viewport = w->viewport;
2015-03-31 13:06:34 +01:00
2015-04-01 18:13:25 +01:00
w->viewport_target_sprite = -1;
2016-04-25 21:37:48 +01:00
w->saved_view_x = gSavedViewX;
w->saved_view_y = gSavedViewY;
gCurrentRotation = gSavedViewRotation;
2015-03-31 13:06:34 +01:00
2016-04-25 21:37:48 +01:00
int zoom_difference = gSavedViewZoom - viewport->zoom;
viewport->zoom = gSavedViewZoom;
2015-04-01 18:13:25 +01:00
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;
2015-03-31 13:06:34 +01:00
2015-04-01 18:13:25 +01:00
window_invalidate(w);
2015-05-30 10:15:29 +01:00
reset_all_sprite_quadrant_placements();
2015-04-01 18:13:25 +01:00
scenery_set_default_placement_configuration();
window_new_ride_init_vars();
2016-08-06 01:35:46 +01:00
gWindowUpdateTicks = 0;
2015-04-01 18:13:25 +01:00
load_palette();
gfx_invalidate_screen();
2015-07-06 14:40:37 +01:00
}
/**
*
* rct2: 0x006AB9B8
*/
2015-07-06 15:37:40 +01:00
int editor_check_object_selection()
2015-07-06 14:40:37 +01:00
{
2015-07-06 15:37:40 +01:00
bool isTrackDesignerManager =
2016-04-23 11:16:46 +01:00
gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER);
2015-07-06 15:37:40 +01: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;
2015-07-06 15:37:40 +01:00
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;
2015-07-06 15:37:40 +01:00
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;
2015-07-06 15:37:40 +01:00
return OBJECT_TYPE_PARK_ENTRANCE;
}
if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_WATER)) {
gGameCommandErrorText = STR_WATER_TYPE_MUST_BE_SELECTED;
2015-07-06 15:37:40 +01:00
return OBJECT_TYPE_WATER;
}
}
return -1;
2015-07-06 14:40:37 +01:00
}
/**
*
* rct2: 0x0066FEAC
*/
bool editor_check_park()
{
int parkSize = park_calculate_size();
if (parkSize == 0) {
gGameCommandErrorText = STR_PARK_MUST_OWN_SOME_LAND;
2015-07-06 14:40:37 +01:00
return false;
}
for (int i = 0; i < 4; i++) {
2016-04-24 22:25:32 +01:00
if (gParkEntranceX[i] != (sint16)0x8000)
2015-07-06 14:40:37 +01:00
break;
if (i == 3) {
gGameCommandErrorText = STR_NO_PARK_ENTRANCES;
2015-07-06 14:40:37 +01:00
return false;
}
}
for (int i = 0; i < 4; i++) {
2016-04-24 22:25:32 +01:00
if (gParkEntranceX[i] == (sint16)0x8000)
2015-07-06 14:40:37 +01:00
continue;
int x = gParkEntranceX[i];
int y = gParkEntranceY[i];
int z = gParkEntranceZ[i] / 8;
int direction = gParkEntranceDirection[i] ^ 2;
2015-07-06 14:40:37 +01:00
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;
2015-07-06 14:40:37 +01:00
return false;
case FOOTPATH_SEARCH_INCOMPLETE:
case FOOTPATH_SEARCH_TOO_COMPLEX:
gGameCommandErrorText = STR_PARK_ENTRANCE_PATH_INCOMPLETE_OR_COMPLEX;
2015-07-06 14:40:37 +01:00
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));
2015-07-06 14:40:37 +01:00
break;
}
}
if (gPeepSpawns[0].x == 0xFFFF && gPeepSpawns[1].x == 0xFFFF) {
gGameCommandErrorText = STR_PEEP_SPAWNS_NOT_SET;
2015-07-06 14:40:37 +01:00
return false;
}
return true;
}