mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
implement game_command_set_park_name and game_command_remove_park_entrance
This commit is contained in:
@@ -273,6 +273,8 @@
|
||||
#define RCT2_ADDRESS_SPRITES_START_TEXTFX 0x013573C2
|
||||
#define RCT2_ADDRESS_SPRITES_START_LITTER 0x013573C4
|
||||
|
||||
#define RCT2_ADDRESS_PARK_NAME 0x013573D4
|
||||
#define RCT2_ADDRESS_PARK_NAME_ARGS 0x013573D8
|
||||
#define RCT2_ADDRESS_INITIAL_CASH 0x013573DC
|
||||
#define RCT2_ADDRESS_CURRENT_LOAN 0x013573E0
|
||||
#define RCT2_ADDRESS_MAXIMUM_LOAN 0x013580F0
|
||||
@@ -344,6 +346,7 @@
|
||||
#define RCT2_ADDRESS_PARK_ENTRANCE_X 0x01359350
|
||||
#define RCT2_ADDRESS_PARK_ENTRANCE_Y 0x01359358
|
||||
#define RCT2_ADDRESS_PARK_ENTRANCE_Z 0x01359360
|
||||
#define RCT2_ADDRESS_PARK_ENTRANCE_DIRECTION 0x01359368
|
||||
|
||||
#define RCT2_ADDRESS_CURRENT_TICKS 0x013628F4
|
||||
#define RCT2_ADDRESS_RIDE_LIST 0x013628F8
|
||||
|
||||
@@ -896,7 +896,7 @@ static uint32 game_do_command_table[58] = {
|
||||
0,
|
||||
0x006649BD,
|
||||
0x006666E7,
|
||||
0x00666A63,
|
||||
0,
|
||||
0x006CD8CE,
|
||||
(uint32)game_command_set_park_entrance_fee,
|
||||
(uint32)game_command_update_staff_colour, // 40
|
||||
@@ -955,11 +955,11 @@ static GAME_COMMAND_POINTER* new_game_command_table[58] = {
|
||||
game_command_emptysub, // 30
|
||||
game_command_emptysub,
|
||||
game_command_emptysub,
|
||||
game_command_emptysub,
|
||||
game_command_set_park_name,
|
||||
game_command_set_park_open,
|
||||
game_command_emptysub,
|
||||
game_command_emptysub,
|
||||
game_command_emptysub,
|
||||
game_command_remove_park_entrance,
|
||||
game_command_emptysub,
|
||||
game_command_emptysub,
|
||||
game_command_emptysub, // 40
|
||||
|
||||
@@ -55,11 +55,11 @@ enum GAME_COMMAND {
|
||||
GAME_COMMAND_SET_STAFF_PATROL, //30
|
||||
GAME_COMMAND_FIRE_STAFF_MEMBER, // 31
|
||||
GAME_COMMAND_SET_STAFF_ORDER, // 32
|
||||
GAME_COMMAND_33,
|
||||
GAME_COMMAND_SET_PARK_NAME,
|
||||
GAME_COMMAND_SET_PARK_OPEN, // 34
|
||||
GAME_COMMAND_35,
|
||||
GAME_COMMAND_36,
|
||||
GAME_COMMAND_37,
|
||||
GAME_COMMAND_PLACE_PARK_ENTRANCE,
|
||||
GAME_COMMAND_REMOVE_PARK_ENTRANCE,
|
||||
GAME_COMMAND_38,
|
||||
GAME_COMMAND_SET_PARK_ENTRANCE_FEE, // 39
|
||||
GAME_COMMAND_SET_STAFF_COLOUR, // 40
|
||||
|
||||
@@ -81,8 +81,8 @@ int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info *
|
||||
ride_set_map_tooltip(mapElement);
|
||||
break;
|
||||
case VIEWPORT_INTERACTION_ITEM_PARK:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = RCT2_GLOBAL(0x013573D4, uint16);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
break;
|
||||
default:
|
||||
info->type = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
@@ -449,7 +449,7 @@ static void viewport_interaction_remove_park_entrance(rct_map_element *mapElemen
|
||||
break;
|
||||
}
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_REMOVE_THIS;
|
||||
game_do_command(x, GAME_COMMAND_FLAG_APPLY, y, mapElement->base_height / 2, GAME_COMMAND_37, 0, 0);
|
||||
game_do_command(x, GAME_COMMAND_FLAG_APPLY, y, mapElement->base_height / 2, GAME_COMMAND_REMOVE_PARK_ENTRANCE, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -485,6 +485,7 @@ enum {
|
||||
STR_YES = 1710,
|
||||
STR_FIRE_STAFF_ID = 1711,
|
||||
|
||||
STR_INVALID_NAME_FOR_PARK = 1716,
|
||||
STR_CANT_RENAME_PARK = 1717,
|
||||
STR_PARK_NAME = 1718,
|
||||
STR_ENTER_PARK_NAME = 1719,
|
||||
|
||||
@@ -271,13 +271,13 @@ int scenario_load_and_play_from_path(const char *path)
|
||||
|
||||
// Set park name
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_RENAME_PARK;
|
||||
game_do_command(1, 1, 0, *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 0)), GAME_COMMAND_33,
|
||||
game_do_command(1, 1, 0, *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 0)), GAME_COMMAND_SET_PARK_NAME,
|
||||
*((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 8)),
|
||||
*((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 4)));
|
||||
game_do_command(2, 1, 0, *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 12)), GAME_COMMAND_33,
|
||||
game_do_command(2, 1, 0, *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 12)), GAME_COMMAND_SET_PARK_NAME,
|
||||
*((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 20)),
|
||||
*((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 16)));
|
||||
game_do_command(0, 1, 0, *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 24)), GAME_COMMAND_33,
|
||||
game_do_command(0, 1, 0, *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 24)), GAME_COMMAND_SET_PARK_NAME,
|
||||
*((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 32)),
|
||||
*((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 28)));
|
||||
|
||||
@@ -721,7 +721,7 @@ int scenario_prepare_for_save()
|
||||
}
|
||||
|
||||
if (s6Info->name[0] == 0)
|
||||
format_string(s6Info->name, RCT2_GLOBAL(0x013573D4, rct_string_id), (void*)0x013573D8);
|
||||
format_string(s6Info->name, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), (void*)RCT2_ADDRESS_PARK_NAME_ARGS);
|
||||
|
||||
s6Info->objective_type = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8);
|
||||
s6Info->objective_arg_1 = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "../interface/widget.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../scenario.h"
|
||||
#include "../world/park.h"
|
||||
#include "dropdown.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -405,7 +406,7 @@ static void window_editor_objective_options_main_mouseup()
|
||||
break;
|
||||
case WIDX_PARK_NAME:
|
||||
RCT2_GLOBAL(0x013CE962, uint32) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
window_text_input_open(w, WIDX_PARK_NAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, RCT2_GLOBAL(0x013573D4, rct_string_id), 0, 32);
|
||||
window_text_input_open(w, WIDX_PARK_NAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), 0, 32);
|
||||
break;
|
||||
case WIDX_SCENARIO_NAME:
|
||||
strcpy((char*)0x009BC677, s6Info->name);
|
||||
@@ -799,13 +800,10 @@ static void window_editor_objective_options_main_textinput()
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_PARK_NAME:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_RENAME_PARK;
|
||||
game_do_command(1, 1, 0, *((int*)(text + 0)), GAME_COMMAND_33, *((int*)(text + 8)), *((int*)(text + 4)));
|
||||
game_do_command(2, 1, 0, *((int*)(text + 12)), GAME_COMMAND_33, *((int*)(text + 20)), *((int*)(text + 16)));
|
||||
game_do_command(0, 1, 0, *((int*)(text + 24)), GAME_COMMAND_33, *((int*)(text + 32)), *((int*)(text + 28)));
|
||||
park_set_name(text);
|
||||
|
||||
if (s6Info->name[0] == 0)
|
||||
format_string(s6Info->name, RCT2_GLOBAL(0x013573D4, uint16), (void*)0x013573D8);
|
||||
format_string(s6Info->name, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), (void*)RCT2_ADDRESS_PARK_NAME_ARGS);
|
||||
break;
|
||||
case WIDX_SCENARIO_NAME:
|
||||
strncpy(s6Info->name, text, 64);
|
||||
@@ -1018,7 +1016,7 @@ static void window_editor_objective_options_main_paint()
|
||||
if (stex != NULL) {
|
||||
RCT2_GLOBAL(0x013CE952 + 0, uint16) = stex->park_name;
|
||||
} else {
|
||||
RCT2_GLOBAL(0x013CE952 + 0, uint16) = RCT2_GLOBAL(0x013573D4, uint16);
|
||||
RCT2_GLOBAL(0x013CE952 + 0, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
}
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x0013573D8, uint32);
|
||||
gfx_draw_string_left_clipped(dpi, 3298, (void*)0x013CE952, 0, x, y, width);
|
||||
|
||||
@@ -1239,8 +1239,8 @@ static void window_finances_marketing_paint()
|
||||
continue;
|
||||
|
||||
noCampaignsActive = 0;
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
|
||||
// Set special parameters
|
||||
switch (i) {
|
||||
|
||||
@@ -611,12 +611,18 @@ rct_window *window_park_open()
|
||||
*
|
||||
* rct2: 0x00667F8B
|
||||
*/
|
||||
void window_park_set_disabled_tabs(rct_window *w)
|
||||
static void window_park_set_disabled_tabs(rct_window *w)
|
||||
{
|
||||
// Disable price tab if money is disabled
|
||||
w->disabled_widgets = (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) ? (1 << WIDX_TAB_4) : 0;
|
||||
}
|
||||
|
||||
static void window_park_prepare_window_title_text()
|
||||
{
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
}
|
||||
|
||||
#pragma region Entrance page
|
||||
|
||||
/**
|
||||
@@ -694,7 +700,7 @@ static void window_park_entrance_mouseup()
|
||||
break;
|
||||
case WIDX_RENAME:
|
||||
RCT2_GLOBAL(0x013CE962, uint32) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
window_text_input_open(w, WIDX_RENAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, RCT2_GLOBAL(0x013573D4, rct_string_id), 0, 32);
|
||||
window_text_input_open(w, WIDX_RENAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), 0, 32);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -867,14 +873,8 @@ static void window_park_entrance_textinput()
|
||||
|
||||
window_textinput_get_registers(w, widgetIndex, result, text);
|
||||
|
||||
if (widgetIndex == WIDX_RENAME) {
|
||||
if (result) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_RENAME_PARK;
|
||||
game_do_command(1, 1, 0, *((int*)(text + 0)), GAME_COMMAND_33, *((int*)(text + 8)), *((int*)(text + 4)));
|
||||
game_do_command(2, 1, 0, *((int*)(text + 12)), GAME_COMMAND_33, *((int*)(text + 20)), *((int*)(text + 16)));
|
||||
game_do_command(0, 1, 0, *((int*)(text + 24)), GAME_COMMAND_33, *((int*)(text + 32)), *((int*)(text + 28)));
|
||||
}
|
||||
}
|
||||
if (widgetIndex == WIDX_RENAME && result)
|
||||
park_set_name(text);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -894,8 +894,8 @@ static void window_park_entrance_invalidate()
|
||||
window_park_set_pressed_tab(w);
|
||||
|
||||
// Set open / close park button state
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
window_park_entrance_widgets[WIDX_OPEN_OR_CLOSE].image = park_is_open() ? SPR_OPEN : SPR_CLOSED;
|
||||
|
||||
// Only allow closing of park for guest / rating objective
|
||||
@@ -1131,9 +1131,7 @@ static void window_park_rating_invalidate()
|
||||
}
|
||||
|
||||
window_park_set_pressed_tab(w);
|
||||
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
window_park_prepare_window_title_text();
|
||||
|
||||
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7);
|
||||
window_park_anchor_border_widgets(w);
|
||||
@@ -1266,9 +1264,7 @@ static void window_park_guests_invalidate()
|
||||
}
|
||||
|
||||
window_park_set_pressed_tab(w);
|
||||
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
window_park_prepare_window_title_text();
|
||||
|
||||
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7);
|
||||
window_park_anchor_border_widgets(w);
|
||||
@@ -1403,9 +1399,7 @@ static void window_park_price_invalidate()
|
||||
}
|
||||
|
||||
window_park_set_pressed_tab(w);
|
||||
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
window_park_prepare_window_title_text();
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_FREE_ENTRY) {
|
||||
window_park_price_widgets[WIDX_PRICE].type = WWT_12;
|
||||
@@ -1525,9 +1519,7 @@ static void window_park_stats_invalidate()
|
||||
}
|
||||
|
||||
window_park_set_pressed_tab(w);
|
||||
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
window_park_prepare_window_title_text();
|
||||
|
||||
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7);
|
||||
window_park_anchor_border_widgets(w);
|
||||
@@ -1707,10 +1699,7 @@ static void window_park_objective_invalidate()
|
||||
window_get_register(w);
|
||||
|
||||
window_park_set_pressed_tab(w);
|
||||
|
||||
// Set window title arguments
|
||||
*((uint16*)0x013CE952) = RCT2_GLOBAL(0x013573D4, uint16);
|
||||
*((uint32*)0x013CE954) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
window_park_prepare_window_title_text();
|
||||
|
||||
//
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT)
|
||||
@@ -1861,9 +1850,7 @@ static void window_park_awards_invalidate()
|
||||
}
|
||||
|
||||
window_park_set_pressed_tab(w);
|
||||
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = RCT2_GLOBAL(0x013573D4, uint16);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = RCT2_GLOBAL(0x013573D8, uint32);
|
||||
window_park_prepare_window_title_text();
|
||||
|
||||
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7);
|
||||
window_park_anchor_border_widgets(w);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../addresses.h"
|
||||
#include "../game.h"
|
||||
#include "../localisation/date.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "climate.h"
|
||||
|
||||
165
src/world/park.c
165
src/world/park.c
@@ -61,7 +61,7 @@ void park_init()
|
||||
int i;
|
||||
|
||||
RCT2_GLOBAL(0x013CA740, uint8) = 0;
|
||||
RCT2_GLOBAL(0x013573D4, uint16) = 777;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, uint16) = 777;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) = 28;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MECHANIC_COLOUR, uint8) = 28;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SECURITY_COLOUR, uint8) = 28;
|
||||
@@ -331,7 +331,7 @@ money32 calculate_company_value()
|
||||
*/
|
||||
void reset_park_entrances()
|
||||
{
|
||||
RCT2_GLOBAL(0x013573D4, uint16) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id) = 0;
|
||||
|
||||
for (short i = 0; i < 4; i++) {
|
||||
RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, uint16)[i] = 0x8000;
|
||||
@@ -657,5 +657,166 @@ void game_command_set_park_open(int* eax, int* ebx, int* ecx, int* edx, int* esi
|
||||
break;
|
||||
}
|
||||
|
||||
*ebx = 0;
|
||||
}
|
||||
|
||||
int park_get_entrance_index(int x, int y, int z)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (
|
||||
x == RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, uint16)[i] &&
|
||||
y == RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_Y, uint16)[i] &&
|
||||
z == RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_Z, uint16)[i]
|
||||
) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void sub_6EC847(int x, int y, int z0, int z1)
|
||||
{
|
||||
RCT2_CALLPROC_X(0x006EC847, x, 0, y, 0, z1, z0, 0);
|
||||
}
|
||||
|
||||
void sub_664D05(int x, int y)
|
||||
{
|
||||
RCT2_CALLPROC_X(0x00664D05, x, 0, y, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void park_remove_entrance_segment(int x, int y, int z)
|
||||
{
|
||||
rct_map_element *mapElement;
|
||||
|
||||
mapElement = map_get_first_element_at(x / 32, y / 32);
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_ENTRANCE)
|
||||
continue;
|
||||
if (mapElement->base_height != z)
|
||||
continue;
|
||||
if (mapElement->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE)
|
||||
continue;
|
||||
|
||||
sub_6EC847(x, y, mapElement->base_height * 8, mapElement->clearance_height * 8);
|
||||
map_element_remove(mapElement);
|
||||
sub_664D05(x, y);
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00666A63
|
||||
*/
|
||||
void game_command_remove_park_entrance(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp)
|
||||
{
|
||||
int x, y, z, entranceIndex, direction;
|
||||
|
||||
x = *eax & 0xFFFF;
|
||||
y = *ecx & 0xFFFF;
|
||||
z = *edx * 16;
|
||||
|
||||
RCT2_GLOBAL(0x0141F56C, uint32) = 8;
|
||||
RCT2_GLOBAL(0x009DEA5E, uint16) = x;
|
||||
RCT2_GLOBAL(0x009DEA60, uint16) = y;
|
||||
RCT2_GLOBAL(0x009DEA62, uint16) = z;
|
||||
|
||||
if (!(*ebx & GAME_COMMAND_FLAG_APPLY)) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
entranceIndex = park_get_entrance_index(x, y, z);
|
||||
RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, uint16)[entranceIndex] = 0x8000;
|
||||
direction = (RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_DIRECTION, uint8)[entranceIndex] - 1) & 3;
|
||||
z = (*edx & 0xFF) * 2;
|
||||
|
||||
// Centre (sign)
|
||||
park_remove_entrance_segment(x, y, z);
|
||||
|
||||
// Left post
|
||||
park_remove_entrance_segment(
|
||||
x + TileDirectionDelta[direction].x,
|
||||
y + TileDirectionDelta[direction].y,
|
||||
z
|
||||
);
|
||||
|
||||
// Right post
|
||||
park_remove_entrance_segment(
|
||||
x - TileDirectionDelta[direction].x,
|
||||
y - TileDirectionDelta[direction].y,
|
||||
z
|
||||
);
|
||||
|
||||
*ebx = 0;
|
||||
}
|
||||
|
||||
void park_set_name(const char *name)
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_RENAME_PARK;
|
||||
game_do_command(1, GAME_COMMAND_FLAG_APPLY, 0, *((int*)(name + 0)), GAME_COMMAND_SET_PARK_NAME, *((int*)(name + 8)), *((int*)(name + 4)));
|
||||
game_do_command(2, GAME_COMMAND_FLAG_APPLY, 0, *((int*)(name + 12)), GAME_COMMAND_SET_PARK_NAME, *((int*)(name + 20)), *((int*)(name + 16)));
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 0, *((int*)(name + 24)), GAME_COMMAND_SET_PARK_NAME, *((int*)(name + 32)), *((int*)(name + 28)));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00669C6D
|
||||
*/
|
||||
void game_command_set_park_name(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp)
|
||||
{
|
||||
rct_string_id newUserStringId;
|
||||
char oldName[128];
|
||||
static char newName[128];
|
||||
|
||||
int nameChunkIndex = *eax & 0xFFFF;
|
||||
|
||||
RCT2_GLOBAL(0x0141F56C, uint8) = 12;
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
int nameChunkOffset = nameChunkIndex - 1;
|
||||
if (nameChunkOffset < 0)
|
||||
nameChunkOffset = 2;
|
||||
nameChunkOffset *= 12;
|
||||
RCT2_GLOBAL(newName + nameChunkOffset + 0, uint32) = *edx;
|
||||
RCT2_GLOBAL(newName + nameChunkOffset + 4, uint32) = *ebp;
|
||||
RCT2_GLOBAL(newName + nameChunkOffset + 8, uint32) = *edi;
|
||||
}
|
||||
|
||||
if (nameChunkIndex != 0) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
format_string(oldName, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), &RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32));
|
||||
if (strcmp(oldName, newName) == 0) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (newName[0] == 0) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_INVALID_RIDE_ATTRACTION_NAME;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
newUserStringId = user_string_allocate(4, newName);
|
||||
if (newUserStringId == 0) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_INVALID_NAME_FOR_PARK;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
// Free the old ride name
|
||||
user_string_free(RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id));
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id) = newUserStringId;
|
||||
|
||||
gfx_invalidate_screen();
|
||||
} else {
|
||||
user_string_free(newUserStringId);
|
||||
}
|
||||
|
||||
*ebx = 0;
|
||||
}
|
||||
@@ -62,8 +62,11 @@ void park_update_histories();
|
||||
uint8 calculate_guest_initial_happiness(uint8 percentage);
|
||||
|
||||
void park_set_open(int open);
|
||||
void park_set_name(const char *name);
|
||||
|
||||
void game_command_set_park_entrance_fee();
|
||||
void game_command_set_park_open(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
|
||||
void game_command_remove_park_entrance(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
|
||||
void game_command_set_park_name(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user