mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-23 10:51:58 -05:00
Merge pull request #2808 from zsilencer/multiplayer
fix some issues with multiplayer
This commit is contained in:
commit
38df0fed3e
8 changed files with 265 additions and 18 deletions
|
@ -547,11 +547,6 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
|
|||
|
||||
if (network_get_mode() == NETWORK_MODE_SERVER && !(flags & GAME_COMMAND_FLAG_NETWORKED) && !(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
network_set_player_last_action(network_get_player_index(network_get_current_player_id()), command);
|
||||
rct_xyz16 coord;
|
||||
coord.x = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16);
|
||||
coord.y = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16);
|
||||
coord.z = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16);
|
||||
network_set_player_last_action_coord(network_get_player_index(network_get_current_player_id()), coord);
|
||||
network_add_player_money_spent(network_get_current_player_id(), cost);
|
||||
}
|
||||
|
||||
|
@ -904,6 +899,7 @@ bool game_load_save(const utf8 *path)
|
|||
|
||||
if (result) {
|
||||
game_load_init();
|
||||
network_free_string_ids();
|
||||
if (network_get_mode() == NETWORK_MODE_SERVER) {
|
||||
network_send_map();
|
||||
}
|
||||
|
|
|
@ -1239,6 +1239,13 @@ void Network::LoadGroups()
|
|||
SDL_RWclose(file);
|
||||
}
|
||||
|
||||
void Network::FreeStringIds()
|
||||
{
|
||||
for (auto it = group_list.begin(); it != group_list.end(); it++) {
|
||||
(*it)->FreeNameStringId();
|
||||
}
|
||||
}
|
||||
|
||||
void Network::Client_Send_AUTH(const char* name, const char* password)
|
||||
{
|
||||
std::unique_ptr<NetworkPacket> packet = std::move(NetworkPacket::Allocate());
|
||||
|
@ -1511,11 +1518,6 @@ void Network::ProcessGameCommandQueue()
|
|||
if (player) {
|
||||
player->last_action = gNetworkActions.FindCommand(command);
|
||||
player->last_action_time = SDL_GetTicks();
|
||||
rct_xyz16 coord;
|
||||
coord.x = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16);
|
||||
coord.y = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16);
|
||||
coord.z = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16);
|
||||
player->last_action_coord = coord;
|
||||
player->AddMoneySpent(cost);
|
||||
}
|
||||
}
|
||||
|
@ -1795,11 +1797,6 @@ void Network::Server_Handle_GAMECMD(NetworkConnection& connection, NetworkPacket
|
|||
|
||||
connection.player->last_action = gNetworkActions.FindCommand(commandCommand);
|
||||
connection.player->last_action_time = SDL_GetTicks();
|
||||
rct_xyz16 coord;
|
||||
coord.x = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16);
|
||||
coord.y = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16);
|
||||
coord.z = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16);
|
||||
connection.player->last_action_coord = coord;
|
||||
connection.player->AddMoneySpent(cost);
|
||||
Server_Send_GAMECMD(args[0], args[1], args[2], args[3], args[4], args[5], args[6], playerid, callback);
|
||||
}
|
||||
|
@ -2023,7 +2020,9 @@ rct_xyz16 network_get_player_last_action_coord(unsigned int index)
|
|||
|
||||
void network_set_player_last_action_coord(unsigned int index, rct_xyz16 coord)
|
||||
{
|
||||
gNetwork.player_list[index]->last_action_coord = coord;
|
||||
if (index >= 0 && index < gNetwork.player_list.size()) {
|
||||
gNetwork.player_list[index]->last_action_coord = coord;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int network_get_player_commands_ran(unsigned int index)
|
||||
|
@ -2270,6 +2269,11 @@ int network_can_perform_action(unsigned int groupindex, unsigned int index)
|
|||
return gNetwork.group_list[groupindex]->CanPerformAction(index);
|
||||
}
|
||||
|
||||
void network_free_string_ids()
|
||||
{
|
||||
gNetwork.FreeStringIds();
|
||||
}
|
||||
|
||||
void network_send_map()
|
||||
{
|
||||
gNetwork.Server_Send_MAP();
|
||||
|
@ -2347,6 +2351,7 @@ uint8 network_get_default_group() { return 0; }
|
|||
int network_get_num_actions() { return 0; }
|
||||
rct_string_id network_get_action_name_string_id(unsigned int index) { return -1; }
|
||||
int network_can_perform_action(unsigned int groupindex, unsigned int index) { return 0; }
|
||||
void network_free_string_ids() {}
|
||||
void network_send_chat(const char* text) {}
|
||||
void network_send_password(const char* password) {}
|
||||
void network_close() {}
|
||||
|
|
|
@ -306,6 +306,7 @@ public:
|
|||
void SetDefaultGroup(uint8 id);
|
||||
void SaveGroups();
|
||||
void LoadGroups();
|
||||
void FreeStringIds();
|
||||
|
||||
void Client_Send_AUTH(const char* name, const char* password);
|
||||
void Server_Send_AUTH(NetworkConnection& connection);
|
||||
|
@ -445,6 +446,7 @@ uint8 network_get_default_group();
|
|||
int network_get_num_actions();
|
||||
rct_string_id network_get_action_name_string_id(unsigned int index);
|
||||
int network_can_perform_action(unsigned int groupindex, unsigned int index);
|
||||
void network_free_string_ids();
|
||||
|
||||
void network_send_map();
|
||||
void network_send_chat(const char* text);
|
||||
|
|
|
@ -3668,6 +3668,14 @@ void game_command_set_ride_setting(int *eax, int *ebx, int *ecx, int *edx, int *
|
|||
return;
|
||||
}
|
||||
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
switch (setting){
|
||||
case 0:
|
||||
// Alteration: only check if the ride mode exists, and fall back to the default if it doesn't.
|
||||
|
@ -5261,6 +5269,16 @@ void game_command_set_ride_status(int *eax, int *ebx, int *ecx, int *edx, int *e
|
|||
}
|
||||
RCT2_GLOBAL(0x00F43484, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32);
|
||||
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
}
|
||||
|
||||
switch (targetStatus) {
|
||||
case RIDE_STATUS_CLOSED:
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
|
@ -5382,6 +5400,14 @@ void game_command_set_ride_name(int *eax, int *ebx, int *ecx, int *edx, int *esi
|
|||
}
|
||||
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
// Free the old ride name
|
||||
user_string_free(ride->name);
|
||||
|
||||
|
@ -6052,6 +6078,14 @@ void game_command_demolish_ride(int *eax, int *ebx, int *ecx, int *edx, int *esi
|
|||
return;
|
||||
}else{
|
||||
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
if(!(*ebx & 8)){
|
||||
window_close_by_number(WC_RIDE_CONSTRUCTION, ride_id);
|
||||
}
|
||||
|
@ -6185,6 +6219,16 @@ void game_command_set_ride_appearance(int *eax, int *ebx, int *ecx, int *edx, in
|
|||
return;
|
||||
}
|
||||
|
||||
if (apply && RCT2_GLOBAL(0x009A8C28, uint8) == 1) {
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
}
|
||||
|
||||
*ebx = 0;
|
||||
switch(type) {
|
||||
case 0:
|
||||
|
@ -6325,6 +6369,15 @@ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *es
|
|||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_PARK_RIDE_TICKETS * 4;
|
||||
if (flags & 0x1) {
|
||||
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
if (!secondary_price) {
|
||||
shop_item = 0x1F;
|
||||
if (ride->type != RIDE_TYPE_TOILETS) {
|
||||
|
@ -7440,6 +7493,14 @@ void game_command_set_ride_vehicles(int *eax, int *ebx, int *ecx, int *edx, int
|
|||
return;
|
||||
}
|
||||
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
ride_clear_for_construction(rideIndex);
|
||||
ride_remove_peeps(rideIndex);
|
||||
ride->var_1CA = 100;
|
||||
|
@ -7711,6 +7772,12 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio
|
|||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
|
||||
rct_map_element* mapElement = map_element_insert(x / 32, y / 32, z / 8, 0xF);
|
||||
mapElement->clearance_height = clear_z;
|
||||
mapElement->properties.entrance.type = is_exit;
|
||||
|
@ -7819,6 +7886,12 @@ money32 remove_ride_entrance_or_exit(sint16 x, sint16 y, uint8 rideIndex, uint8
|
|||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
|
||||
sub_6A7594();
|
||||
maze_entrance_hedge_replacement(x, y, mapElement);
|
||||
footpath_remove_edges_at(x, y, mapElement);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "../interface/viewport.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../management/finance.h"
|
||||
#include "../network/network.h"
|
||||
#include "../platform/platform.h"
|
||||
#include "../rct1.h"
|
||||
#include "../util/sawyercoding.h"
|
||||
|
@ -3482,6 +3483,14 @@ money32 place_maze_design(uint8 flags, uint8 rideIndex, uint16 mazeEntry, sint16
|
|||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 8;
|
||||
coord.y = y + 8;
|
||||
coord.z = z;
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
// Place track element
|
||||
int fx = floor2(x, 32);
|
||||
int fy = floor2(y, 32);
|
||||
|
@ -4099,6 +4108,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
|
|||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16) = originX + 16;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16) = originY + 16;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = originZ;
|
||||
sint16 trackpieceZ = originZ;
|
||||
direction &= 3;
|
||||
RCT2_GLOBAL(0x00F441D5, uint32) = properties_1;
|
||||
RCT2_GLOBAL(0x00F441D9, uint32) = properties_2;
|
||||
|
@ -4251,6 +4261,8 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
|
|||
y = originY + offsetY;
|
||||
z = originZ + trackBlock->z;
|
||||
|
||||
trackpieceZ = z;
|
||||
|
||||
if (z < 16) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_LOW;
|
||||
return MONEY32_UNDEFINED;
|
||||
|
@ -4566,6 +4578,14 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
|
|||
map_invalidate_tile_full(x, y);
|
||||
}
|
||||
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = originX + 16;
|
||||
coord.y = originY + 16;
|
||||
coord.z = trackpieceZ;
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
money32 price = RCT2_ADDRESS(0x0097DD78, money16)[ride->type * 2];
|
||||
price *= (rideTypeFlags & RIDE_TYPE_FLAG_FLAT_RIDE) ?
|
||||
RCT2_ADDRESS(0x0099DE34, money32)[type] :
|
||||
|
@ -4617,6 +4637,7 @@ money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 originY,
|
|||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, sint16) = originX + 16;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, sint16) = originY + 16;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, sint16) = originZ;
|
||||
sint16 trackpieceZ = originZ;
|
||||
RCT2_GLOBAL(0x00F440E1, uint8) = sequence;
|
||||
|
||||
switch (type){
|
||||
|
@ -4740,6 +4761,8 @@ money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 originY,
|
|||
RCT2_GLOBAL(0x00F441C4, sint16) = x;
|
||||
RCT2_GLOBAL(0x00F441C6, sint16) = y;
|
||||
|
||||
trackpieceZ = z;
|
||||
|
||||
found = 0;
|
||||
mapElement = map_get_first_element_at(x / 32, y / 32);
|
||||
do{
|
||||
|
@ -4866,6 +4889,14 @@ money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 originY,
|
|||
else
|
||||
price *= -10;
|
||||
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = originX + 16;
|
||||
coord.y = originY + 16;
|
||||
coord.z = trackpieceZ;
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)
|
||||
return 0;
|
||||
else
|
||||
|
|
|
@ -220,8 +220,12 @@ void window_player_overview_mouse_up(rct_window *w, int widgetIndex)
|
|||
case WIDX_LOCATE:{
|
||||
rct_window* mainWindow = window_get_main();
|
||||
if (mainWindow != NULL) {
|
||||
rct_xyz16 coord = network_get_player_last_action_coord(w->number);
|
||||
if (coord.x && coord.y && coord.z) {
|
||||
int player = network_get_player_index((uint8)w->number);
|
||||
if (player == -1) {
|
||||
return;
|
||||
}
|
||||
rct_xyz16 coord = network_get_player_last_action_coord(player);
|
||||
if (coord.x || coord.y || coord.z) {
|
||||
window_scroll_to_location(mainWindow, coord.x, coord.y, coord.z);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "../game.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../management/finance.h"
|
||||
#include "../network/network.h"
|
||||
#include "../util/util.h"
|
||||
#include "footpath.h"
|
||||
#include "map.h"
|
||||
|
@ -350,6 +351,14 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int
|
|||
// Force ride construction to recheck area
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
|
||||
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
footpath_provisional_remove();
|
||||
mapElement = map_get_footpath_element_slope((x / 32), (y / 32), z, slope);
|
||||
if (mapElement == NULL) {
|
||||
|
@ -397,6 +406,14 @@ money32 footpath_remove_real(int x, int y, int z, int flags)
|
|||
|
||||
mapElement = map_get_footpath_element(x / 32, y / 32, z);
|
||||
if (mapElement != NULL && (flags & GAME_COMMAND_FLAG_APPLY)) {
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(0x00F3EFF4, uint32) = 0x00F3EFF8;
|
||||
remove_banners_at_element(x, y, mapElement);
|
||||
footpath_remove_edges_at(x, y, mapElement);
|
||||
|
@ -498,6 +515,14 @@ static money32 footpath_place_from_track(int type, int x, int y, int z, int slop
|
|||
RCT2_GLOBAL(0x00F3EFD9, money32) += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / 2) * MONEY(5, 00);
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
mapElement = map_element_insert(x / 32, y / 32, z, 0x0F);
|
||||
mapElement->type = MAP_ELEMENT_TYPE_PATH;
|
||||
mapElement->clearance_height = z + 4 + (slope & 4 ? 2 : 0);
|
||||
|
|
111
src/world/map.c
111
src/world/map.c
|
@ -28,6 +28,7 @@
|
|||
#include "../localisation/date.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../management/finance.h"
|
||||
#include "../network/network.h"
|
||||
#include "../openrct2.h"
|
||||
#include "../ride/ride_data.h"
|
||||
#include "../ride/track.h"
|
||||
|
@ -770,6 +771,14 @@ void game_command_remove_scenery(int* eax, int* ebx, int* ecx, int* edx, int* es
|
|||
|
||||
// Remove element
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(*ebx & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
map_invalidate_tile_full(x, y);
|
||||
map_element_remove(map_element);
|
||||
}
|
||||
|
@ -911,6 +920,14 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i
|
|||
}
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY && RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
*ebx = scenery_entry->large_scenery.removal_price * 10;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY ||
|
||||
calculate_cost == false){
|
||||
|
@ -959,6 +976,14 @@ void game_command_remove_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi
|
|||
rct_scenery_entry *scenery_entry = g_bannerSceneryEntries[banner->type];
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(*ebx & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
map_element_remove_banner_entry(map_element);
|
||||
map_invalidate_tile_zoom1(x, y, z, z + 32);
|
||||
map_element_remove(map_element);
|
||||
|
@ -1372,6 +1397,14 @@ money32 map_clear_scenery(int x0, int y0, int x1, int y1, int clear, int flags)
|
|||
}
|
||||
}
|
||||
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = ((x0 + x1) / 2) + 16;
|
||||
coord.y = ((y0 + y1) / 2) + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
if (clear & (1 << 1)) {
|
||||
map_reset_clear_large_scenery_flag();
|
||||
}
|
||||
|
@ -1501,6 +1534,14 @@ money32 map_change_surface_style(int x0, int y0, int x1, int y1, uint8 surfaceSt
|
|||
}
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY && RCT2_GLOBAL(0x009A8C28, uint8) == 1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = ((x0 + x1) / 2) + 16;
|
||||
coord.y = ((y0 + y1) / 2) + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
cost *= 100;
|
||||
cost += RCT2_GLOBAL(0x009E32B4, uint32);
|
||||
return (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) ? 0 : cost;
|
||||
|
@ -1714,6 +1755,14 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl
|
|||
|
||||
if(flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
surfaceElement = map_get_surface_element_at(x / 32, y / 32);
|
||||
surfaceElement->base_height = height;
|
||||
surfaceElement->clearance_height = height;
|
||||
|
@ -1990,6 +2039,13 @@ money32 raise_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags)
|
|||
z = water_height_z;
|
||||
if (z != 0)
|
||||
z = base_height_z;
|
||||
|
||||
rct_xyz16 coord;
|
||||
coord.x = x;
|
||||
coord.y = y;
|
||||
coord.z = z;
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16) = x;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16) = y;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = z;
|
||||
|
@ -2055,6 +2111,13 @@ money32 lower_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags)
|
|||
z = water_height_z;
|
||||
if (z == 0)
|
||||
z = base_height_z;
|
||||
|
||||
rct_xyz16 coord;
|
||||
coord.x = x;
|
||||
coord.y = y;
|
||||
coord.z = z;
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16) = x;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16) = y;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = z;
|
||||
|
@ -2244,6 +2307,15 @@ money32 smooth_land(int flags, int centreX, int centreY, int mapLeft, int mapTop
|
|||
log_warning("Invalid coordinates for land smoothing, x = %d, y = %d", x, y);
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = centreX + 16;
|
||||
coord.y = centreY + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
int slope = mapElement->properties.surface.slope & MAP_ELEMENT_SLOPE_MASK;
|
||||
if (slope != 0) {
|
||||
commandType = command == 0xFFFF ? GAME_COMMAND_RAISE_LAND : GAME_COMMAND_LOWER_LAND;
|
||||
|
@ -2594,6 +2666,14 @@ void game_command_remove_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi,
|
|||
return;
|
||||
}
|
||||
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(*ebx & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
map_element_remove_banner_entry(map_element);
|
||||
map_invalidate_tile_zoom1(x, y, map_element->base_height * 8, (map_element->base_height * 8) + 72);
|
||||
map_element_remove(map_element);
|
||||
|
@ -2649,6 +2729,14 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi,
|
|||
}
|
||||
*edi = banner_index;
|
||||
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(*ebx & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
rct_map_element* new_map_element = map_element_insert(x / 32, y / 32, (base_height + 1) * 2, 0);
|
||||
gBanners[banner_index].type = type;
|
||||
gBanners[banner_index].colour = colour;
|
||||
|
@ -2823,6 +2911,13 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi
|
|||
if(gCheatsDisableClearanceChecks || map_can_construct_with_clear_at(x, y, zLow, zHigh, (void*)0x006E0D6E, bl)){
|
||||
RCT2_GLOBAL(0x00F64F14, uint8) = RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & 0x3;
|
||||
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(*ebx & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
int flags = (bl & 0xf);
|
||||
rct_map_element* new_map_element = map_element_insert(x / 32, y / 32, zLow, flags);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_MAP_ELEMENT, rct_map_element*) = new_map_element;
|
||||
|
@ -3252,6 +3347,14 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi,
|
|||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY){
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(*ebx & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = position.x + 16;
|
||||
coord.y = position.y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
map_element = map_element_insert(position.x / 32, position.y / 32, position.z / 8, 0);
|
||||
|
||||
map_animation_create(MAP_ANIMATION_TYPE_WALL, position.x, position.y, position.z / 8);
|
||||
|
@ -3492,6 +3595,14 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in
|
|||
map_remove_walls_at(curTile.x, curTile.y, zLow * 8, zHigh * 8);
|
||||
}
|
||||
}
|
||||
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(*ebx & GAME_COMMAND_FLAG_GHOST)) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = x + 16;
|
||||
coord.y = y + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
rct_map_element *new_map_element = map_element_insert(curTile.x / 32, curTile.y / 32, zLow, F43887);
|
||||
map_animation_create(MAP_ANIMATION_TYPE_LARGE_SCENERY, curTile.x, curTile.y, zLow);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue