mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge branch 'pre-release-0.0.3' into develop
This commit is contained in:
commit
4d50c362ba
|
@ -368,7 +368,7 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<StructMemberAlignment>1Byte</StructMemberAlignment>
|
||||
<PreprocessorDefinitions>DEBUG;DEBUG_DESYNC;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>DEBUG;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ObjectFileName>$(IntDir)fake\%(RelativeDir)</ObjectFileName>
|
||||
|
|
|
@ -248,7 +248,10 @@ config_property_definition _networkDefinitions[] = {
|
|||
{ offsetof(network_configuration, maxplayers), "maxplayers", CONFIG_VALUE_TYPE_UINT8, 16, NULL },
|
||||
{ offsetof(network_configuration, server_name), "server_name", CONFIG_VALUE_TYPE_STRING, {.value_string = "Server" }, NULL },
|
||||
{ offsetof(network_configuration, server_description), "server_description", CONFIG_VALUE_TYPE_STRING, {.value_string = NULL }, NULL },
|
||||
{ offsetof(network_configuration, master_server_url), "master_server_url", CONFIG_VALUE_TYPE_STRING, {.value_string = NULL }, NULL }
|
||||
{ offsetof(network_configuration, master_server_url), "master_server_url", CONFIG_VALUE_TYPE_STRING, {.value_string = NULL }, NULL },
|
||||
{ offsetof(network_configuration, provider_name), "provider_name", CONFIG_VALUE_TYPE_STRING, {.value_string = NULL }, NULL },
|
||||
{ offsetof(network_configuration, provider_email), "provider_email", CONFIG_VALUE_TYPE_STRING, {.value_string = NULL }, NULL },
|
||||
{ offsetof(network_configuration, provider_website), "provider_website", CONFIG_VALUE_TYPE_STRING, {.value_string = NULL }, NULL }
|
||||
};
|
||||
|
||||
config_section_definition _sectionDefinitions[] = {
|
||||
|
|
|
@ -219,6 +219,9 @@ typedef struct {
|
|||
utf8string server_name;
|
||||
utf8string server_description;
|
||||
utf8string master_server_url;
|
||||
utf8string provider_name;
|
||||
utf8string provider_email;
|
||||
utf8string provider_website;
|
||||
} network_configuration;
|
||||
|
||||
typedef struct theme_window {
|
||||
|
|
18
src/game.c
18
src/game.c
|
@ -886,8 +886,7 @@ int game_load_save(const char *path)
|
|||
safe_strncpy((char*)0x0141EF68, path, MAX_PATH);
|
||||
safe_strncpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, path, MAX_PATH);
|
||||
|
||||
safe_strncpy(gScenarioSaveName, path_get_filename(path), MAX_PATH);
|
||||
path_remove_extension(gScenarioSaveName);
|
||||
safe_strncpy(gScenarioSavePath, path, MAX_PATH);
|
||||
|
||||
SDL_RWops* rw = SDL_RWFromFile(path, "rb");
|
||||
if (rw == NULL) {
|
||||
|
@ -1033,19 +1032,12 @@ static int show_save_game_dialog(char *resultPath)
|
|||
void save_game()
|
||||
{
|
||||
if (!gFirstTimeSave) {
|
||||
utf8 path[MAX_PATH];
|
||||
log_verbose("Saving to %s", gScenarioSavePath);
|
||||
|
||||
log_verbose("Saving to %s", gScenarioSaveName);
|
||||
|
||||
platform_get_user_directory(path, "save");
|
||||
|
||||
strcat(path, gScenarioSaveName);
|
||||
strcat(path, ".sv6");
|
||||
|
||||
SDL_RWops* rw = SDL_RWFromFile(path, "wb+");
|
||||
SDL_RWops* rw = SDL_RWFromFile(gScenarioSavePath, "wb+");
|
||||
if (rw != NULL) {
|
||||
scenario_save(rw, 0x80000000);
|
||||
log_verbose("Saved to %s", gScenarioSaveName);
|
||||
log_verbose("Saved to %s", gScenarioSavePath);
|
||||
SDL_RWclose(rw);
|
||||
}
|
||||
} else {
|
||||
|
@ -1055,7 +1047,7 @@ void save_game()
|
|||
}
|
||||
void save_game_as()
|
||||
{
|
||||
window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME, gScenarioSaveName);
|
||||
window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME, gScenarioSavePath);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -905,7 +905,6 @@ void Network::AdvertiseHeartbeat()
|
|||
|
||||
json_t *body = json_object();
|
||||
json_object_set(body, "token", json_string(advertise_token.c_str()));
|
||||
json_object_set(body, "dedicated", json_boolean(gOpenRCT2Headless));
|
||||
json_object_set(body, "players", json_integer(network_get_num_players()));
|
||||
|
||||
json_t *gameInfo = json_object();
|
||||
|
@ -1091,6 +1090,15 @@ void Network::Server_Send_GAMEINFO(NetworkConnection& connection)
|
|||
json_object_set(obj, "players", json_integer(player_list.size()));
|
||||
json_object_set(obj, "maxPlayers", json_integer(gConfigNetwork.maxplayers));
|
||||
json_object_set(obj, "description", json_string(gConfigNetwork.server_description));
|
||||
json_object_set(obj, "dedicated", json_boolean(gOpenRCT2Headless));
|
||||
|
||||
// Provider details
|
||||
json_t* jsonProvider = json_object();
|
||||
json_object_set(jsonProvider, "name", json_string(gConfigNetwork.provider_name));
|
||||
json_object_set(jsonProvider, "email", json_string(gConfigNetwork.provider_email));
|
||||
json_object_set(jsonProvider, "website", json_string(gConfigNetwork.provider_website));
|
||||
json_object_set(obj, "provider", jsonProvider);
|
||||
|
||||
packet->WriteString(json_dumps(obj, 0));
|
||||
json_decref(obj);
|
||||
#endif
|
||||
|
|
|
@ -5110,13 +5110,14 @@ static int ride_get_default_mode(rct_ride *ride)
|
|||
return availableModes[0];
|
||||
}
|
||||
|
||||
static bool ride_with_colour_config_exists(int rideType, const track_colour *colours)
|
||||
static bool ride_with_colour_config_exists(rct_ride *srcRide, const track_colour *colours)
|
||||
{
|
||||
rct_ride *ride;
|
||||
int i;
|
||||
|
||||
FOR_ALL_RIDES(i, ride) {
|
||||
if (ride->type != rideType) continue;
|
||||
if (ride != srcRide) continue;
|
||||
if (ride->type != srcRide->type) continue;
|
||||
if (ride->track_colour_main[0] != colours->main) continue;
|
||||
if (ride->track_colour_additional[0] != colours->additional) continue;
|
||||
if (ride->track_colour_supports[0] != colours->supports) continue;
|
||||
|
@ -5158,7 +5159,7 @@ static void ride_set_to_random_colour_preset(rct_ride *ride)
|
|||
int listIndex = scenario_rand() % colourPresets->count;
|
||||
colours = &colourPresets->list[listIndex];
|
||||
|
||||
if (!ride_with_colour_config_exists(ride->type, colours)) {
|
||||
if (!ride_with_colour_config_exists(ride, colours)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2654,14 +2654,22 @@ int tracked_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* tra
|
|||
}
|
||||
|
||||
int z = 0;
|
||||
//6ce69e
|
||||
// Find the start of the track.
|
||||
// It has to do this as a backwards loop incase this is an incomplete track.
|
||||
if (track_block_get_previous(trackElement.x, trackElement.y, trackElement.element, &trackBeginEnd)) {
|
||||
rct_map_element* initial_map = trackElement.element;
|
||||
do {
|
||||
rct_xy_element lastGood = {
|
||||
.element = trackBeginEnd.begin_element,
|
||||
.x = trackBeginEnd.begin_x,
|
||||
.y = trackBeginEnd.begin_y
|
||||
};
|
||||
|
||||
if (!track_block_get_previous(trackBeginEnd.begin_x, trackBeginEnd.begin_y, trackBeginEnd.begin_element, &trackBeginEnd)) {
|
||||
trackElement = lastGood;
|
||||
break;
|
||||
}
|
||||
} while (initial_map != trackElement.element);
|
||||
} while (initial_map != trackBeginEnd.begin_element);
|
||||
}
|
||||
|
||||
z = trackElement.element->base_height * 8;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
static char _scenarioPath[MAX_PATH];
|
||||
static const char *_scenarioFileName = "";
|
||||
|
||||
char gScenarioSaveName[MAX_PATH];
|
||||
char gScenarioSavePath[MAX_PATH];
|
||||
int gFirstTimeSave = 1;
|
||||
|
||||
static int scenario_create_ducks();
|
||||
|
@ -354,9 +354,15 @@ void scenario_begin()
|
|||
}
|
||||
|
||||
// Set the last saved game path
|
||||
format_string(gScenarioSaveName, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), (void*)RCT2_ADDRESS_PARK_NAME_ARGS);
|
||||
char parkName[128];
|
||||
format_string(parkName, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), (void*)RCT2_ADDRESS_PARK_NAME_ARGS);
|
||||
|
||||
platform_get_user_directory(gScenarioSavePath, "save");
|
||||
strncat(gScenarioSavePath, parkName, sizeof(gScenarioSavePath));
|
||||
strncat(gScenarioSavePath, ".sv6", sizeof(gScenarioSavePath));
|
||||
|
||||
strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*)RCT2_ADDRESS_SAVED_GAMES_PATH);
|
||||
strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2 + strlen((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2), gScenarioSaveName);
|
||||
strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2 + strlen((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2), gScenarioSavePath);
|
||||
strcat((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, ".SV6");
|
||||
|
||||
memset((void*)0x001357848, 0, 56);
|
||||
|
|
|
@ -412,7 +412,7 @@ extern int gScenarioListCount;
|
|||
extern int gScenarioListCapacity;
|
||||
extern rct_scenario_basic *gScenarioList;
|
||||
|
||||
extern char gScenarioSaveName[MAX_PATH];
|
||||
extern char gScenarioSavePath[MAX_PATH];
|
||||
extern int gFirstTimeSave;
|
||||
|
||||
int scenario_scores_save();
|
||||
|
|
|
@ -131,7 +131,7 @@ loadsave_list_item *_listItems = NULL;
|
|||
char _directory[MAX_PATH];
|
||||
char _shortenedDirectory[MAX_PATH];
|
||||
char _extension[32];
|
||||
char *_defaultName = NULL;
|
||||
char _defaultName[MAX_PATH];
|
||||
int _loadsaveType;
|
||||
int _type;
|
||||
|
||||
|
@ -153,7 +153,12 @@ rct_window *window_loadsave_open(int type, char *defaultName)
|
|||
int includeNewItem;
|
||||
rct_window* w;
|
||||
_type = type;
|
||||
_defaultName = defaultName;
|
||||
_defaultName[0] = 0;
|
||||
|
||||
if (!str_is_null_or_empty(defaultName)) {
|
||||
safe_strncpy(_defaultName, path_get_filename(defaultName), sizeof(_defaultName));
|
||||
path_remove_extension(_defaultName);
|
||||
}
|
||||
|
||||
w = window_bring_to_front_by_class(WC_LOADSAVE);
|
||||
if (w == NULL) {
|
||||
|
@ -769,8 +774,7 @@ static void window_loadsave_select(rct_window *w, const char *path)
|
|||
network_begin_server(gConfigNetwork.default_port);
|
||||
}
|
||||
|
||||
safe_strncpy(gScenarioSaveName, path_get_filename(path), MAX_PATH);
|
||||
path_remove_extension(gScenarioSaveName);
|
||||
safe_strncpy(gScenarioSavePath, path, MAX_PATH);
|
||||
gFirstTimeSave = 0;
|
||||
|
||||
window_close(w);
|
||||
|
@ -791,8 +795,7 @@ static void window_loadsave_select(rct_window *w, const char *path)
|
|||
SDL_RWclose(rw);
|
||||
if (success) {
|
||||
|
||||
safe_strncpy(gScenarioSaveName, path_get_filename(path), MAX_PATH);
|
||||
path_remove_extension(gScenarioSaveName);
|
||||
safe_strncpy(gScenarioSavePath, path, MAX_PATH);
|
||||
gFirstTimeSave = 0;
|
||||
|
||||
window_close_by_class(WC_LOADSAVE);
|
||||
|
|
|
@ -1326,6 +1326,17 @@ void footpath_chain_ride_queue(int rideIndex, int entranceIndex, int x, int y, r
|
|||
|
||||
foundNextPath:
|
||||
if (footpath_element_is_queue(mapElement)) {
|
||||
// Fix #2051: Stop queue paths that are already connected to two other tiles
|
||||
// from connecting to the tile we are coming from.
|
||||
int edges = mapElement->properties.path.edges;
|
||||
int numEdges = bitcount(edges);
|
||||
if (numEdges >= 2) {
|
||||
int requiredEdgeMask = 1 << (direction ^ 2);
|
||||
if (!(edges & requiredEdgeMask)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mapElement->properties.path.type &= ~(1 << 3);
|
||||
mapElement->properties.path.edges |= (1 << (direction ^ 2));
|
||||
mapElement->properties.path.ride_index = rideIndex;
|
||||
|
|
209
src/world/map.c
209
src/world/map.c
|
@ -994,6 +994,7 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i
|
|||
firstTile.x = x - firstTile.x;
|
||||
firstTile.y = y - firstTile.y;
|
||||
|
||||
bool calculate_cost = true;
|
||||
for (int i = 0; scenery_entry->large_scenery.tiles[i].x_offset != -1; i++){
|
||||
|
||||
rct_xyz16 currentTile = {
|
||||
|
@ -1016,8 +1017,14 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i
|
|||
}
|
||||
|
||||
// If not applying then no need to delete the actual element
|
||||
if (!(*ebx & GAME_COMMAND_FLAG_APPLY))
|
||||
if (!(*ebx & GAME_COMMAND_FLAG_APPLY)) {
|
||||
if (*ebx & (1 << 7)) {
|
||||
if (map_element->flags & (1 << 6))
|
||||
calculate_cost = false;
|
||||
map_element->flags |= (1 << 6);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
rct_map_element* sceneryElement = map_get_first_element_at(currentTile.x / 32, currentTile.y / 32);
|
||||
uint8 tile_not_found = 1;
|
||||
|
@ -1051,7 +1058,8 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i
|
|||
}
|
||||
|
||||
*ebx = scenery_entry->large_scenery.removal_price * 10;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY){
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY ||
|
||||
calculate_cost == false){
|
||||
*ebx = 0;
|
||||
}
|
||||
return;
|
||||
|
@ -1218,8 +1226,9 @@ void game_command_set_large_scenery_colour(int* eax, int* ebx, int* ecx, int* ed
|
|||
int x = *eax;
|
||||
int y = *ecx;
|
||||
uint8 map_element_direction = *ebx >> 8;
|
||||
uint8 flags = *ebx & 0xFF;
|
||||
uint8 base_height = *edx;
|
||||
uint8 scenerymultiple_index = *edx >> 8;
|
||||
uint8 tileIndex = *edx >> 8;
|
||||
uint8 color1 = *ebp;
|
||||
uint8 color2 = *ebp >> 8;
|
||||
int z = map_element_height(x, y);
|
||||
|
@ -1227,100 +1236,66 @@ void game_command_set_large_scenery_colour(int* eax, int* ebx, int* ecx, int* ed
|
|||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16) = y + 16;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = z;
|
||||
|
||||
rct_map_element *map_element = map_get_large_scenery_segment(x, y, base_height, map_element_direction, tileIndex);
|
||||
|
||||
rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32);
|
||||
while(map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SCENERY_MULTIPLE ||
|
||||
map_element->base_height != base_height ||
|
||||
map_element->properties.scenerymultiple.type >> 10 != scenerymultiple_index ||
|
||||
(map_element->type & MAP_ELEMENT_DIRECTION_MASK) != map_element_direction){
|
||||
map_element++;
|
||||
if((map_element - 1)->flags & MAP_ELEMENT_FLAG_LAST_TILE){
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if((*ebx & 0x40) && !(map_element->flags & MAP_ELEMENT_FLAG_GHOST)){
|
||||
if(map_element == NULL){
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
int ecx2 = map_element->properties.scenerymultiple.type >> 10;
|
||||
rct_scenery_entry* scenery_entry = RCT2_ADDRESS(RCT2_ADDRESS_LARGE_SCENERY_ENTRIES, rct_scenery_entry*)[map_element->properties.scenerymultiple.type & 0x3FF];
|
||||
int x2 = scenery_entry->large_scenery.tiles[ecx2].x_offset;
|
||||
int y2 = scenery_entry->large_scenery.tiles[ecx2].y_offset;
|
||||
int z2 = (base_height * 8) - scenery_entry->large_scenery.tiles[ecx2].z_offset;
|
||||
switch(map_element->type & MAP_ELEMENT_DIRECTION_MASK){
|
||||
case MAP_ELEMENT_DIRECTION_WEST:
|
||||
break;
|
||||
case MAP_ELEMENT_DIRECTION_NORTH:{
|
||||
int temp = x2;
|
||||
x2 = y2;
|
||||
y2 = -temp;
|
||||
}break;
|
||||
case MAP_ELEMENT_DIRECTION_EAST:
|
||||
x2 = -x2;
|
||||
y2 = -y2;
|
||||
break;
|
||||
case MAP_ELEMENT_DIRECTION_SOUTH:{
|
||||
int temp = y2;
|
||||
y2 = x2;
|
||||
x2 = -temp;
|
||||
}break;
|
||||
|
||||
if((flags & GAME_COMMAND_FLAG_GHOST) && !(map_element->flags & MAP_ELEMENT_FLAG_GHOST)){
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
x2 = -x2 + x;
|
||||
y2 = -y2 + y;
|
||||
int i = 0;
|
||||
while(1){
|
||||
if(scenery_entry->large_scenery.tiles[i].x_offset == -1){
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
int x3 = scenery_entry->large_scenery.tiles[i].x_offset;
|
||||
int y3 = scenery_entry->large_scenery.tiles[i].y_offset;
|
||||
int z3 = scenery_entry->large_scenery.tiles[i].z_offset;
|
||||
switch(map_element->type & MAP_ELEMENT_DIRECTION_MASK){
|
||||
case MAP_ELEMENT_DIRECTION_WEST:
|
||||
break;
|
||||
case MAP_ELEMENT_DIRECTION_NORTH:{
|
||||
int temp = x3;
|
||||
x3 = y3;
|
||||
y3 = -temp;
|
||||
}break;
|
||||
case MAP_ELEMENT_DIRECTION_EAST:
|
||||
x3 = -x3;
|
||||
y3 = -y3;
|
||||
break;
|
||||
case MAP_ELEMENT_DIRECTION_SOUTH:{
|
||||
int temp = y3;
|
||||
y3 = x3;
|
||||
x3 = -temp;
|
||||
}break;
|
||||
}
|
||||
x3 += x2;
|
||||
y3 += y2;
|
||||
z3 += z2;
|
||||
|
||||
rct_scenery_entry* scenery_entry = RCT2_ADDRESS(RCT2_ADDRESS_LARGE_SCENERY_ENTRIES, rct_scenery_entry*)[map_element->properties.scenerymultiple.type & 0x3FF];
|
||||
|
||||
// Work out the base tile coordinates (Tile with index 0)
|
||||
rct_xyz16 baseTile = {
|
||||
.x = scenery_entry->large_scenery.tiles[tileIndex].x_offset,
|
||||
.y = scenery_entry->large_scenery.tiles[tileIndex].y_offset,
|
||||
.z = (base_height * 8) - scenery_entry->large_scenery.tiles[tileIndex].z_offset
|
||||
};
|
||||
rotate_map_coordinates(&baseTile.x, &baseTile.y, map_element_direction);
|
||||
baseTile.x = x - baseTile.x;
|
||||
baseTile.y = y - baseTile.y;
|
||||
|
||||
for (int i = 0; scenery_entry->large_scenery.tiles[i].x_offset != -1; ++i) {
|
||||
assert(i < 256);
|
||||
|
||||
// Work out the current tile coordinates
|
||||
rct_xyz16 currentTile = {
|
||||
.x = scenery_entry->large_scenery.tiles[i].x_offset,
|
||||
.y = scenery_entry->large_scenery.tiles[i].y_offset,
|
||||
.z = scenery_entry->large_scenery.tiles[i].z_offset
|
||||
};
|
||||
rotate_map_coordinates(¤tTile.x, ¤tTile.y, map_element_direction);
|
||||
currentTile.x += baseTile.x;
|
||||
currentTile.y += baseTile.y;
|
||||
currentTile.z += baseTile.z;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode){
|
||||
if (!map_is_location_owned(x3, y3, z3)){
|
||||
if (!map_is_location_owned(currentTile.x, currentTile.y, currentTile.z)){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||
rct_map_element* map_element = map_get_first_element_at(x3 / 32, y3 / 32);
|
||||
while(map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SCENERY_MULTIPLE ||
|
||||
(map_element->type & MAP_ELEMENT_DIRECTION_MASK) != map_element_direction ||
|
||||
map_element->properties.scenerymultiple.type >> 10 != i ||
|
||||
map_element->base_height != base_height){
|
||||
map_element++;
|
||||
}
|
||||
map_element->properties.scenerymultiple.colour[0] &= 0xE0;
|
||||
map_element->properties.scenerymultiple.colour[0] |= color1;
|
||||
map_element->properties.scenerymultiple.colour[1] &= 0xE0;
|
||||
map_element->properties.scenerymultiple.colour[1] |= color2;
|
||||
map_invalidate_tile_full(x3, y3);
|
||||
}
|
||||
if(flags & GAME_COMMAND_FLAG_APPLY){
|
||||
rct_map_element* mapElement = map_get_large_scenery_segment(
|
||||
currentTile.x,
|
||||
currentTile.y,
|
||||
base_height,
|
||||
map_element_direction,
|
||||
i);
|
||||
|
||||
i++;
|
||||
mapElement->properties.scenerymultiple.colour[0] &= 0xE0;
|
||||
mapElement->properties.scenerymultiple.colour[0] |= color1;
|
||||
mapElement->properties.scenerymultiple.colour[1] &= 0xE0;
|
||||
mapElement->properties.scenerymultiple.colour[1] |= color2;
|
||||
|
||||
map_invalidate_tile_full(currentTile.x, currentTile.y);
|
||||
}
|
||||
}
|
||||
*ebx = 0;
|
||||
}
|
||||
|
@ -1351,14 +1326,24 @@ void game_command_set_banner_colour(int* eax, int* ebx, int* ecx, int* edx, int*
|
|||
|
||||
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||
rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32);
|
||||
while(map_element->type != MAP_ELEMENT_TYPE_BANNER ||
|
||||
map_element->properties.banner.position != banner_position){
|
||||
map_element++;
|
||||
if((map_element - 1)->flags & MAP_ELEMENT_FLAG_LAST_TILE){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
do {
|
||||
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_BANNER)
|
||||
continue;
|
||||
|
||||
if (map_element->properties.banner.position != banner_position)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
break;
|
||||
} while (!map_element_is_last_for_tile(map_element++));
|
||||
|
||||
if (found == false){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
rct_window* window = window_find_by_number(WC_BANNER, map_element->properties.banner.index);
|
||||
if(window){
|
||||
window_invalidate(window);
|
||||
|
@ -1448,7 +1433,7 @@ restart_from_beginning:
|
|||
int ecx = y * 32;
|
||||
int edx = mapElement->base_height | ((mapElement->properties.scenerymultiple.type >> 10) << 8);
|
||||
int edi = 0, ebp = 0;
|
||||
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_LARGE_SCENERY, edi, ebp);
|
||||
cost = game_do_command(eax, ebx | (1 << 7), ecx, edx, GAME_COMMAND_REMOVE_LARGE_SCENERY, edi, ebp);
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
@ -1465,6 +1450,24 @@ restart_from_beginning:
|
|||
return totalCost;
|
||||
}
|
||||
|
||||
/* Function to clear the flag that is set to prevent cost duplication
|
||||
* when using the clear scenery tool with large scenery.
|
||||
*/
|
||||
void map_reset_clear_large_scenery_flag(){
|
||||
rct_map_element* mapElement;
|
||||
// TODO: Improve efficiency of this
|
||||
for (int y = 0; y <= 255; y++) {
|
||||
for (int x = 0; x <= 255; x++) {
|
||||
mapElement = map_get_first_element_at(x, y);
|
||||
do {
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE) {
|
||||
mapElement->flags &= ~(1 << 6);
|
||||
}
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
money32 map_clear_scenery(int x0, int y0, int x1, int y1, int clear, int flags)
|
||||
{
|
||||
int x, y, z;
|
||||
|
@ -1501,6 +1504,10 @@ money32 map_clear_scenery(int x0, int y0, int x1, int y1, int clear, int flags)
|
|||
}
|
||||
}
|
||||
|
||||
if (clear & (1 << 1)) {
|
||||
map_reset_clear_large_scenery_flag();
|
||||
}
|
||||
|
||||
return noValidTiles ? MONEY32_UNDEFINED : totalCost;
|
||||
}
|
||||
|
||||
|
@ -1814,6 +1821,9 @@ money32 raise_land(int flags, int x, int y, int z, int ax, int ay, int bx, int b
|
|||
}
|
||||
}
|
||||
|
||||
// Force ride construction to recheck area
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_LANDSCAPING * 4;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint32) = x;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint32) = y;
|
||||
|
@ -1878,6 +1888,9 @@ money32 lower_land(int flags, int x, int y, int z, int ax, int ay, int bx, int b
|
|||
}
|
||||
}
|
||||
|
||||
// Force ride construction to recheck area
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_LANDSCAPING * 4;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint32) = x;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint32) = y;
|
||||
|
@ -1949,6 +1962,9 @@ money32 raise_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags)
|
|||
sound_play_panned(SOUND_LAYING_OUT_WATER, 0x8001, x, y, z);
|
||||
}
|
||||
|
||||
// Force ride construction to recheck area
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
|
||||
|
||||
return cost;
|
||||
}
|
||||
|
||||
|
@ -2011,6 +2027,9 @@ money32 lower_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags)
|
|||
sound_play_panned(SOUND_LAYING_OUT_WATER, 0x8001, x, y, z);
|
||||
}
|
||||
|
||||
// Force ride construction to recheck area
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
|
||||
|
||||
return cost;
|
||||
}
|
||||
|
||||
|
@ -3451,6 +3470,10 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in
|
|||
tile++;
|
||||
tile_num++;
|
||||
}while(1);
|
||||
|
||||
// Force ride construction to recheck area
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
|
||||
|
||||
*ebx = (scenery_entry->large_scenery.price * 10) + RCT2_GLOBAL(0x00F4389A, uint32);
|
||||
if(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY){
|
||||
*ebx = 0;
|
||||
|
|
Loading…
Reference in New Issue