Merge pull request #1025 from duncanspumpkin/scenery

Scenery tool down
This commit is contained in:
Ted John 2015-04-24 20:57:39 +01:00
commit 67b5a1e5a5
14 changed files with 1040 additions and 218 deletions

View File

@ -316,6 +316,15 @@
#define RCT2_ADDRESS_TRACK_LIST 0x00F441EC
#define RCT2_ADDRESS_CTRL_PRESS_Z_COORDINATE 0x00F64ECC
#define RCT2_ADDRESS_SHIFT_PRESS_X_COORDINATE 0x00F64ECE
#define RCT2_ADDRESS_SHIFT_PRESS_Y_COORDINATE 0x00F64ED0
#define RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR 0x00F64ED2
#define RCT2_ADDRESS_SCENERY_Z_COORDINATE 0x00F64ED4
#define RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED 0x00F64F12
#define RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED 0x00F64F13
#define RCT2_ADDRESS_CURRENT_MONTH_YEAR 0x00F663A8
#define RCT2_ADDRESS_CURRENT_MONTH_TICKS 0x00F663AA
#define RCT2_ADDRESS_SCENARIO_TICKS 0x00F663AC

View File

@ -105,5 +105,6 @@ int viewport_interaction_left_click(int x, int y);
int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info *info);
int viewport_interaction_right_over(int x, int y);
int viewport_interaction_right_click(int x, int y);
void sub_68A15E(int screenX, int screenY, short *x, short *y, int *direction, rct_map_element **mapElement);
#endif

View File

@ -283,7 +283,7 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info
return info->type;
case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
sceneryEntry = RCT2_ADDRESS(0x9ADA50, rct_scenery_entry*)[mapElement->properties.path.additions & 0x0F];
sceneryEntry = g_pathBitSceneryEntries[(mapElement->properties.path.additions & 0x0F) - 1];
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1164;
if (mapElement->flags & 0x20) {
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 3124;
@ -473,7 +473,7 @@ static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, i
{
rct_scenery_entry* sceneryEntry;
sceneryEntry = g_wallSceneryEntries[mapElement->properties.fence.slope];
sceneryEntry = g_wallSceneryEntries[mapElement->properties.fence.type];
if (sceneryEntry->wall.var_0D != 0xFF){
window_sign_small_open(mapElement->properties.fence.item[0]);
} else {
@ -496,12 +496,9 @@ static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, i
*/
static void viewport_interaction_remove_large_scenery(rct_map_element *mapElement, int x, int y)
{
int ebx;
rct_scenery_entry* sceneryEntry;
ebx = mapElement->properties.scenerymultiple.type;
ebx |= (mapElement->properties.scenerymultiple.index & 0x3) << 8;
sceneryEntry = g_largeSceneryEntries[ebx];
sceneryEntry = g_largeSceneryEntries[mapElement->properties.scenerymultiple.type & MAP_ELEMENT_LARGE_TYPE_MASK];
if (sceneryEntry->large_scenery.var_11 != 0xFF){
int id = (mapElement->type & 0xC0) |
@ -514,7 +511,7 @@ static void viewport_interaction_remove_large_scenery(rct_map_element *mapElemen
x,
1 | ((mapElement->type & 0x3) << 8),
y,
mapElement->base_height | ((mapElement->properties.scenerymultiple.index >> 2) << 8),
mapElement->base_height | ((mapElement->properties.scenerymultiple.type >> 10) << 8),
GAME_COMMAND_44,
0,
0
@ -560,4 +557,73 @@ static rct_peep *viewport_interaction_get_closest_peep(int x, int y, int maxDist
}
return closestPeep;
}
/**
*
* rct2: 0x0068A15E
*/
void sub_68A15E(int screenX, int screenY, short *x, short *y, int *direction, rct_map_element **mapElement)
{
int my_x, my_y, z;
rct_map_element *myMapElement;
rct_viewport *viewport;
get_map_coordinates_from_pos(screenX, screenY, 0xFFF6, &my_x, &my_y, &z, &myMapElement, &viewport);
if (z == 0) {
*x = 0x8000;
return;
}
RCT2_GLOBAL(0x00F1AD3E, uint8) = z;
RCT2_GLOBAL(0x00F1AD30, rct_map_element*) = myMapElement;
if (z == 4) {
// myMapElement appears to be water
z = myMapElement->properties.surface.terrain;
z = (z & MAP_ELEMENT_WATER_HEIGHT_MASK) << 4;
}
RCT2_GLOBAL(0x00F1AD3C, uint16) = z;
RCT2_GLOBAL(0x00F1AD34, sint16) = my_x;
RCT2_GLOBAL(0x00F1AD36, sint16) = my_y;
RCT2_GLOBAL(0x00F1AD38, sint16) = my_x + 31;
RCT2_GLOBAL(0x00F1AD3A, sint16) = my_y + 31;
rct_xy16 start_vp_pos = screen_coord_to_viewport_coord(viewport, screenX, screenY);
rct_xy16 map_pos = { my_x + 16, my_y + 16 };
for (int i = 0; i < 5; i++) {
if (RCT2_GLOBAL(0x00F1AD3E, uint8) != 4) {
z = map_element_height(map_pos.x, map_pos.y);
} else {
z = RCT2_GLOBAL(0x00F1AD3C, uint16);
}
map_pos = viewport_coord_to_map_coord(start_vp_pos.x, start_vp_pos.y, z);
map_pos.x = clamp(RCT2_GLOBAL(0x00F1AD34, sint16), map_pos.x, RCT2_GLOBAL(0x00F1AD38, sint16));
map_pos.y = clamp(RCT2_GLOBAL(0x00F1AD36, sint16), map_pos.y, RCT2_GLOBAL(0x00F1AD3A, sint16));
}
// Determine to which edge the cursor is closest
int myDirection;
int mod_x = map_pos.x & 0x1F;
int mod_y = map_pos.y & 0x1F;
if (mod_x < mod_y) {
if (mod_x + mod_y < 32) {
myDirection = 0;
} else {
myDirection = 1;
}
} else {
if (mod_x + mod_y < 32) {
myDirection = 3;
} else {
myDirection = 2;
}
}
*x = map_pos.x & ~0x1F;
*y = map_pos.y & ~0x1F;
if (direction != NULL) *direction = myDirection;
if (mapElement != NULL) *mapElement = myMapElement;
}

View File

@ -3107,7 +3107,7 @@ static int peep_update_walking_find_bench(rct_peep* peep){
uint8 additions = map_element->properties.path.additions & 0xF;
if (!additions) return 0;
rct_scenery_entry* sceneryEntry = RCT2_ADDRESS(0x9ADA50, rct_scenery_entry*)[additions];
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (!(sceneryEntry->path_bit.var_06 & 0x2))return 0;
@ -3184,7 +3184,7 @@ static int peep_update_walking_find_bin(rct_peep* peep){
uint8 additions = map_element->properties.path.additions & 0xF;
if (!additions) return 0;
rct_scenery_entry* sceneryEntry = RCT2_ADDRESS(0x9ADA50, rct_scenery_entry*)[additions];
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (!(sceneryEntry->path_bit.var_06 & 0x1))return 0;
@ -3261,7 +3261,7 @@ static void peep_update_walking_break_scenery(rct_peep* peep){
uint8 additions = map_element->properties.path.additions & 0xF;
if (!additions) return;
rct_scenery_entry* sceneryEntry = RCT2_ADDRESS(0x9ADA50, rct_scenery_entry*)[additions];
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (!(sceneryEntry->path_bit.var_06 & 0x4))return;
@ -3437,7 +3437,7 @@ static void peep_update_using_bin(rct_peep* peep){
return;
}
rct_scenery_entry* sceneryEntry = RCT2_ADDRESS(0x9ADA50, rct_scenery_entry*)[additions];
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (!(sceneryEntry->path_bit.var_06 & 1)){
peep_state_reset(peep);
return;
@ -3828,7 +3828,7 @@ static int peep_update_patrolling_find_bin(rct_peep* peep){
if (additions == 0)return 0;
rct_scenery_entry* sceneryEntry = RCT2_ADDRESS(0x9ADA50, rct_scenery_entry*)[additions];
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (!(sceneryEntry->path_bit.var_06 & 1))
return 0;
@ -4121,7 +4121,7 @@ static void peep_update_walking(rct_peep* peep){
if (additions){
if (!(map_element->properties.path.additions & 0x80)){
rct_scenery_entry* sceneryEntry = RCT2_ADDRESS(0x9ADA50, rct_scenery_entry*)[additions];
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (!(sceneryEntry->path_bit.var_06 & 0x2)) ebp = 9;
}

View File

@ -411,6 +411,17 @@ void window_dropdown_show_colour_available(rct_window *w, rct_widget *widget, ui
if (availableColours & (1 << i))
numItems++;
// Set items
for (i = 0; i < 32; i++) {
if (availableColours & (1 << i)) {
if (selectedColour == i)
RCT2_GLOBAL(0x009DEBA2, sint16) = i;
gDropdownItemsFormat[i] = 0xFFFE;
gDropdownItemsArgs[i] = ((uint64)i << 32) | (0x20000000 | (i << 19) | 5059);
}
}
// Show dropdown
window_dropdown_show_image(
w->x + widget->left,
@ -424,14 +435,4 @@ void window_dropdown_show_colour_available(rct_window *w, rct_widget *widget, ui
gAppropriateImageDropdownItemsPerRow[numItems]
);
// Set items
for (i = 0; i < 32; i++) {
if (availableColours & (1 << i)) {
if (selectedColour == i)
RCT2_GLOBAL(0x009DEBA2, sint16) = i;
gDropdownItemsFormat[i] = 0xFFFE;
gDropdownItemsArgs[i] = ((uint64)i << 32) | (0x20000000 | (i << 19) | 5059);
}
}
}

View File

@ -458,8 +458,8 @@ void window_scenery_open()
window_scenery_update_scroll(window);
show_gridlines();
window_scenery_rotation = 3;
RCT2_GLOBAL(0x00F64F12, uint8) = 0;
RCT2_GLOBAL(0x00F64F13, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) = 0;
window->scenery.selected_scenery_id = -1;
window->scenery.hover_counter = 0;
window_push_others_below(window);
@ -503,9 +503,9 @@ void window_scenery_close() {
window_get_register(w);
RCT2_CALLPROC_EBPSAFE(0x006E2712);
scenery_remove_ghost_tool_placement();
hide_gridlines();
RCT2_CALLPROC_X(0x006CB70A, 0, 0, 0, 0, 0, 0, 0);
viewport_set_visibility(0);
if (window_scenery_is_scenery_tool_active())
tool_cancel();
@ -543,7 +543,7 @@ static void window_scenery_mouseup()
case WIDX_SCENERY_ROTATE_OBJECTS_BUTTON:
window_scenery_rotation++;
window_scenery_rotation = window_scenery_rotation % 4;
RCT2_CALLPROC_EBPSAFE(0x006E2712);
scenery_remove_ghost_tool_placement();
window_invalidate(w);
break;
case WIDX_SCENERY_REPAINT_SCENERY_BUTTON:

View File

@ -174,9 +174,7 @@ void window_sign_open(rct_windownumber number)
while (1){
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE) {
int ebx = map_element->properties.scenerymultiple.type;
ebx |= (map_element->properties.scenerymultiple.index & 0x3) << 8;
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[ebx];
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[map_element->properties.scenerymultiple.type & MAP_ELEMENT_LARGE_TYPE_MASK];
if (scenery_entry->large_scenery.var_11 != 0xFF){
int id = (map_element->type & 0xC0) |
((map_element->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
@ -242,9 +240,7 @@ static void window_sign_mouseup()
case WIDX_SIGN_DEMOLISH:
while (1){
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE) {
int ebx = map_element->properties.scenerymultiple.type;
ebx |= (map_element->properties.scenerymultiple.index & 0x3) << 8;
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[ebx];
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[map_element->properties.scenerymultiple.type & MAP_ELEMENT_LARGE_TYPE_MASK];
if (scenery_entry->large_scenery.var_11 != 0xFF){
int id = (map_element->type & 0xC0) |
((map_element->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
@ -259,7 +255,7 @@ static void window_sign_mouseup()
x,
1 | ((map_element->type&0x3) << 8),
y,
map_element->base_height | ((map_element->properties.scenerymultiple.index >> 2) << 8),
map_element->base_height | ((map_element->properties.scenerymultiple.type >> 10) << 8),
GAME_COMMAND_44,
0,
0);
@ -323,9 +319,7 @@ static void window_sign_dropdown()
while (1){
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE) {
int ebx = map_element->properties.scenerymultiple.type;
ebx |= (map_element->properties.scenerymultiple.index & 0x3) << 8;
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[ebx];
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[map_element->properties.scenerymultiple.type & MAP_ELEMENT_LARGE_TYPE_MASK];
if (scenery_entry->large_scenery.var_11 != 0xFF){
int id = (map_element->type & 0xC0) |
((map_element->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
@ -337,7 +331,7 @@ static void window_sign_dropdown()
map_element++;
}
int edx = map_element->base_height | ((map_element->properties.scenerymultiple.index >> 2) << 8);
int edx = map_element->base_height | ((map_element->properties.scenerymultiple.type >> 10) << 8);
int ebp = w->list_information_type | (w->var_492 << 8);
int ebx = (map_element->type & 0x3) << 8;
RCT2_CALLPROC_X(0x6B9B05, x, ebx, y, edx, 0, w->number, ebp);
@ -501,7 +495,7 @@ void window_sign_small_open(rct_windownumber number){
while (1){
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_FENCE) {
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.slope];
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.type];
if (scenery_entry->wall.var_0D != 0xFF){
if (map_element->properties.fence.item[0] == w->number)
break;
@ -515,7 +509,7 @@ void window_sign_small_open(rct_windownumber number){
w->list_information_type = map_element->properties.fence.item[1] & 0x1F;
w->var_492 = (map_element->properties.fence.item[1] >> 5) | ((map_element->flags&0x60) >> 2);
w->var_48C = map_element->properties.fence.slope;
w->var_48C = map_element->properties.fence.type;
view_x += 16;
view_y += 16;
@ -564,7 +558,7 @@ static void window_sign_small_mouseup()
case WIDX_SIGN_DEMOLISH:
while (1){
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_FENCE) {
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.slope];
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.type];
if (scenery_entry->wall.var_0D != 0xFF){
if (map_element->properties.fence.item[0] == w->number)
break;
@ -626,7 +620,7 @@ static void window_sign_small_dropdown()
while (1){
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_FENCE) {
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.slope];
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.type];
if (scenery_entry->wall.var_0D != 0xFF){
if (map_element->properties.fence.item[0] == w->number)
break;

File diff suppressed because it is too large Load Diff

View File

@ -300,75 +300,6 @@ static void window_track_place_draw_mini_preview()
}
}
/**
*
* rct2: 0x0068A15E
*/
static void sub_68A15E(int screenX, int screenY, short *x, short *y, int *direction, rct_map_element **mapElement)
{
int my_x, my_y, z;
rct_map_element *myMapElement;
rct_viewport *viewport;
get_map_coordinates_from_pos(screenX, screenY, 0xFFF6, &my_x, &my_y, &z, &myMapElement, &viewport);
if (z == 0) {
*x = 0x8000;
return;
}
RCT2_GLOBAL(0x00F1AD3E, uint8) = z;
RCT2_GLOBAL(0x00F1AD30, rct_map_element*) = myMapElement;
if (z == 4) {
// myMapElement appears to be water
z = myMapElement->properties.surface.terrain;
z = (z & MAP_ELEMENT_WATER_HEIGHT_MASK) << 4;
}
RCT2_GLOBAL(0x00F1AD3C, uint16) = z;
RCT2_GLOBAL(0x00F1AD34, sint16) = my_x;
RCT2_GLOBAL(0x00F1AD36, sint16) = my_y;
RCT2_GLOBAL(0x00F1AD38, sint16) = my_x + 31;
RCT2_GLOBAL(0x00F1AD3A, sint16) = my_y + 31;
rct_xy16 start_vp_pos = screen_coord_to_viewport_coord(viewport, screenX, screenY);
rct_xy16 map_pos = { my_x + 16, my_y + 16 };
for (int i = 0; i < 5; i++) {
if (RCT2_GLOBAL(0x00F1AD3E, uint8) != 4) {
z = map_element_height(map_pos.x, map_pos.y);
} else {
z = RCT2_GLOBAL(0x00F1AD3C, uint16);
}
map_pos = viewport_coord_to_map_coord(start_vp_pos.x, start_vp_pos.y, z);
map_pos.x = clamp(RCT2_GLOBAL(0x00F1AD34, sint16), map_pos.x, RCT2_GLOBAL(0x00F1AD38, sint16));
map_pos.y = clamp(RCT2_GLOBAL(0x00F1AD36, sint16), map_pos.y, RCT2_GLOBAL(0x00F1AD3A, sint16));
}
// Determine to which edge the cursor is closest
int myDirection;
int mod_x = map_pos.x & 0x1F;
int mod_y = map_pos.y & 0x1F;
if (mod_x < mod_y) {
if (mod_x + mod_y < 32) {
myDirection = 0;
} else {
myDirection = 1;
}
} else {
if (mod_x + mod_y < 32) {
myDirection = 3;
} else {
myDirection = 2;
}
}
*x = map_pos.x & ~0x1F;
*y = map_pos.y & ~0x1F;
if (direction != NULL) *direction = myDirection;
if (mapElement != NULL) *mapElement = myMapElement;
}
/**
*
* rct2: 0x006D017F

View File

@ -24,6 +24,7 @@
#include "../util/util.h"
#include "footpath.h"
#include "map.h"
#include "scenery.h"
void sub_673883(int x, int y, int z);
void sub_69A48B(int x, int y, int z);
@ -201,8 +202,8 @@ static money32 footpath_element_update(int x, int y, rct_map_element *mapElement
}
if (RCT2_GLOBAL(0x00F3EF88, uint16) != 0) {
uint8 *unk = RCT2_ADDRESS(0x009ADA50, uint8*)[RCT2_GLOBAL(0x00F3EF88, uint16)];
uint16 unk6 = RCT2_GLOBAL(unk + 6, uint16);
rct_scenery_entry* scenery_entry = g_pathBitSceneryEntries[RCT2_GLOBAL(0x00F3EF88, uint16) - 1];
uint16 unk6 = scenery_entry->path_bit.var_06;
if ((unk6 & 0x80) && (mapElement->properties.path.type & 4)) {
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CANT_BUILD_THIS_ON_SLOPED_FOOTPATH;
@ -224,13 +225,13 @@ static money32 footpath_element_update(int x, int y, rct_map_element *mapElement
return MONEY32_UNDEFINED;
}
RCT2_GLOBAL(0x00F3EFD9, money32) += RCT2_GLOBAL(unk + 10, money16);
RCT2_GLOBAL(0x00F3EFD9, money32) += scenery_entry->path_bit.price;
}
if (flags & (1 << 4))
return MONEY32_UNDEFINED;
if (!(flags & (1 << 6))) {
if (flags & (1 << 6)) {
if (mapElement->properties.path.additions & 0x0F) {
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_NONE;
return MONEY32_UNDEFINED;
@ -259,8 +260,8 @@ static money32 footpath_element_update(int x, int y, rct_map_element *mapElement
mapElement->properties.path.additions = (mapElement->properties.path.additions & 0xF0) | RCT2_GLOBAL(0x00F3EF88, uint8);
mapElement->flags &= ~0x20;
if (RCT2_GLOBAL(0x00F3EF88, uint16) != 0) {
uint8 *unk = RCT2_ADDRESS(0x009ADA50, uint8*)[RCT2_GLOBAL(0x00F3EF88, uint16)];
uint16 unk6 = RCT2_GLOBAL(unk + 6, uint16);
rct_scenery_entry* scenery_entry = g_pathBitSceneryEntries[RCT2_GLOBAL(0x00F3EF88, uint16) - 1];
uint16 unk6 = scenery_entry->path_bit.var_06;
if (unk6 & 1)
mapElement->properties.path.addition_status = 255;
}
@ -288,7 +289,7 @@ static money32 footpath_element_update(int x, int y, rct_map_element *mapElement
return RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY ? 0 : RCT2_GLOBAL(0x00F3EFD9, money32);
}
static money32 footpath_place_real(int type, int x, int y, int z, int slope, int flags)
static money32 footpath_place_real(int type, int x, int y, int z, int slope, int flags, uint8 path_bit_type)
{
rct_map_element *mapElement;
@ -307,7 +308,7 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int
RCT2_GLOBAL(0x00F3EFD9, money32) = 0;
RCT2_GLOBAL(0x00F3EFA4, uint8) = 0;
RCT2_GLOBAL(0x00F3EF88, uint16) = 0; // di
RCT2_GLOBAL(0x00F3EF88, uint16) = path_bit_type; // di
if (x >= RCT2_GLOBAL(0x01358830, uint16) || y >= RCT2_GLOBAL(0x01358830, uint16)) {
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_OFF_EDGE_OF_MAP;
@ -393,7 +394,7 @@ void game_command_place_footpath(int *eax, int *ebx, int *ecx, int *edx, int *es
if (*ebx & (1 << 5))
RCT2_CALLFUNC_X(0x006A61DE, eax, ebx, ecx, edx, esi, edi, ebp);
else
*ebx = footpath_place_real((*edx >> 8) & 0xFF, *eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, (*ebx >> 8) & 0xFF, *ebx & 0xFF);
*ebx = footpath_place_real((*edx >> 8) & 0xFF, *eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, (*ebx >> 8) & 0xFF, *ebx & 0xFF, *edi & 0xFF);
}
/**

View File

@ -1105,7 +1105,7 @@ void map_remove_intersecting_walls(int x, int y, int z0, int z1, int direction)
if (direction != (mapElement->type & 3))
continue;
sceneryEntry = g_wallSceneryEntries[mapElement->properties.fence.slope];
sceneryEntry = g_wallSceneryEntries[mapElement->properties.fence.type];
if (sceneryEntry->wall.var_0D != 255) {
bannerIndex = mapElement->properties.fence.item[0];
banner = &gBanners[bannerIndex];

View File

@ -64,13 +64,12 @@ typedef struct {
} rct_map_element_entrance_properties;
typedef struct {
uint8 slope; //4
uint8 type; //4
uint8 item[3]; //5
} rct_map_element_fence_properties;
typedef struct {
uint8 type; //4
uint8 index; //5
uint16 type; //4
uint8 colour[2]; //6
} rct_map_element_scenerymultiple_properties;
@ -212,6 +211,8 @@ enum {
#define MAX_MAP_ELEMENTS 196608
#define MAX_TILE_MAP_ELEMENT_POINTERS (256 * 256)
#define MAP_ELEMENT_LARGE_TYPE_MASK 0x3FF
#define TILE_UNDEFINED_MAP_ELEMENT (rct_map_element*)-1
typedef struct {

View File

@ -109,4 +109,90 @@ void scenery_increase_age(int x, int y, rct_map_element *mapElement)
mapElement->properties.scenery.age++;
map_invalidate_tile(x, y, mapElement->base_height * 8, mapElement->clearance_height * 8);
}
}
/* 0x006E2712 */
void scenery_remove_ghost_tool_placement(){
sint16 x, y, z;
x = RCT2_GLOBAL(0x00F64EC4, sint16);
y = RCT2_GLOBAL(0x00F64EC6, sint16);
z = RCT2_GLOBAL(0x00F64F09, uint8);
if (RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 0)){
RCT2_GLOBAL(0x00F64F0D, uint8) &= ~(1 << 0);
game_do_command(
x,
105 | (RCT2_GLOBAL(0x00F64F0C, uint8) << 8),
y,
z | (RCT2_GLOBAL(0x00F64EDA, uint8) << 8),
GAME_COMMAND_REMOVE_SCENERY,
0,
0);
}
if (RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 1)){
RCT2_GLOBAL(0x00F64F0D, uint8) &= ~(1 << 1);
rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32);
do{
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_PATH)
continue;
if (map_element->base_height != z)
continue;
game_do_command(
x,
233 | (RCT2_GLOBAL(0x00F64F0F, uint8) << 8),
y,
z | (RCT2_GLOBAL(0x00F64F10, uint8) << 8),
GAME_COMMAND_PLACE_PATH,
RCT2_GLOBAL(0x00F64EAC, uint32) & 0xFFFF0000,
0);
break;
} while (!map_element_is_last_for_tile(map_element++));
}
if (RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 2)){
RCT2_GLOBAL(0x00F64F0D, uint8) &= ~(1 << 2);
game_do_command(
x,
105 | (RCT2_GLOBAL(0x00F64F0C, uint8) << 8),
y,
RCT2_GLOBAL(0x00F64F11, uint8) |(z << 8),
GAME_COMMAND_REMOVE_FENCE,
0,
0);
}
if (RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 3)){
RCT2_GLOBAL(0x00F64F0D, uint8) &= ~(1 << 3);
game_do_command(
x,
105 | (RCT2_GLOBAL(0x00F64EC0, uint8) << 8),
y,
z,
GAME_COMMAND_44,
0,
0);
}
if (RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 4)){
RCT2_GLOBAL(0x00F64F0D, uint8) &= ~(1 << 4);
game_do_command(
x,
105,
y,
z | (RCT2_GLOBAL(0x00F64EC0, uint8) << 8),
GAME_COMMAND_51,
0,
0);
}
}

View File

@ -141,6 +141,9 @@ enum {
#define g_largeSceneryEntries ((rct_scenery_entry**)object_entry_groups[OBJECT_TYPE_LARGE_SCENERY].chunks)
#define g_wallSceneryEntries ((rct_scenery_entry**)object_entry_groups[OBJECT_TYPE_WALLS].chunks)
#define g_bannerSceneryEntries ((rct_scenery_entry**)object_entry_groups[OBJECT_TYPE_BANNERS].chunks)
// Often 0x009ADA50 is used for pathBits this is 1 entry before g_pathBitSceneryEntries and is used
// because 0 represents no path bits on a path. So remember to remove 1 when using it for 0x009ADA50
#define g_pathBitSceneryEntries ((rct_scenery_entry**)object_entry_groups[OBJECT_TYPE_PATH_BITS].chunks)
#define g_scenerySetEntries ((rct_scenery_set_entry**)object_entry_groups[OBJECT_TYPE_SCENERY_SETS].chunks)
@ -159,5 +162,6 @@ void init_scenery();
void scenery_update_tile(int x, int y);
void scenery_update_age(int x, int y, rct_map_element *mapElement);
void scenery_set_default_placement_configuration();
void scenery_remove_ghost_tool_placement();
#endif