forked from rosebudai/OpenRCT2-Web
Merge pull request #5236 from duncanspumpkin/refactor
Refactor fence to wall
This commit is contained in:
commit
1654ba4fe4
33 files changed
+1186
-951
No files matched your search
@@ -243,6 +243,7 @@
|
||||
D41B73EF1C2101890080A7B9 /* libcurl.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = D41B73EE1C2101890080A7B9 /* libcurl.tbd */; };
|
||||
D41B741D1C210A7A0080A7B9 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = D41B741C1C210A7A0080A7B9 /* libiconv.tbd */; };
|
||||
D41B74731C2125E50080A7B9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D41B74721C2125E50080A7B9 /* Assets.xcassets */; };
|
||||
D41FA8641E5EA1E200215624 /* wall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D41FA8631E5EA1E200215624 /* wall.cpp */; };
|
||||
D429FF421E36ABCD009342A6 /* tile_inspector.c in Sources */ = {isa = PBXBuildFile; fileRef = D429FF401E36ABCD009342A6 /* tile_inspector.c */; };
|
||||
D42E337D1E5C27D600D630AF /* Config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D42E33751E5C27D600D630AF /* Config.cpp */; };
|
||||
D42E337E1E5C27D600D630AF /* IniReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D42E33781E5C27D600D630AF /* IniReader.cpp */; };
|
||||
@@ -719,6 +720,7 @@
|
||||
D41B73EE1C2101890080A7B9 /* libcurl.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcurl.tbd; path = usr/lib/libcurl.tbd; sourceTree = SDKROOT; };
|
||||
D41B741C1C210A7A0080A7B9 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; };
|
||||
D41B74721C2125E50080A7B9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = distribution/macos/Assets.xcassets; sourceTree = SOURCE_ROOT; };
|
||||
D41FA8631E5EA1E200215624 /* wall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wall.cpp; sourceTree = "<group>"; };
|
||||
D429FF3F1E36ABB3009342A6 /* tile_inspector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tile_inspector.h; sourceTree = "<group>"; };
|
||||
D429FF401E36ABCD009342A6 /* tile_inspector.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tile_inspector.c; sourceTree = "<group>"; };
|
||||
D429FF411E36ABCD009342A6 /* tile_inspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tile_inspector.h; sourceTree = "<group>"; };
|
||||
@@ -2060,6 +2062,7 @@
|
||||
D44271F31CC81B3200D84D28 /* sprite.h */,
|
||||
D429FF401E36ABCD009342A6 /* tile_inspector.c */,
|
||||
D429FF411E36ABCD009342A6 /* tile_inspector.h */,
|
||||
D41FA8631E5EA1E200215624 /* wall.cpp */,
|
||||
D44271F41CC81B3200D84D28 /* water.h */,
|
||||
);
|
||||
path = world;
|
||||
@@ -2943,6 +2946,7 @@
|
||||
C686F9491CDBC3B7009F9BFC /* chairlift.c in Sources */,
|
||||
C686F9501CDBC3B7009F9BFC /* log_flume.c in Sources */,
|
||||
D464FEE81D31A6AA00CBABAC /* FootpathObject.cpp in Sources */,
|
||||
D41FA8641E5EA1E200215624 /* wall.cpp in Sources */,
|
||||
D43407D61D0E14BE00C2B3D4 /* CopyFramebufferShader.cpp in Sources */,
|
||||
C6E96E231E04070E0076A04F /* scenario.c in Sources */,
|
||||
D44272241CC81B3200D84D28 /* intro.c in Sources */,
|
||||
|
||||
@@ -4237,7 +4237,7 @@ STR_5925 :Path details
|
||||
STR_5926 :Track details
|
||||
STR_5927 :Scenery details
|
||||
STR_5928 :Entrance details
|
||||
STR_5929 :Fence details
|
||||
STR_5929 :Wall details
|
||||
STR_5930 :Large scenery details
|
||||
STR_5931 :Banner details
|
||||
STR_5932 :Corrupt element details
|
||||
@@ -4287,7 +4287,7 @@ STR_5975 :Slope:
|
||||
STR_5976 :Flat
|
||||
STR_5977 :Right side up
|
||||
STR_5978 :Left side up
|
||||
STR_5979 :{WINDOW_COLOUR_2}Fence type: {BLACK}{COMMA16}
|
||||
STR_5979 :{WINDOW_COLOUR_2}Wall type: {BLACK}{COMMA16}
|
||||
STR_5980 :{WINDOW_COLOUR_2}Banner text: {BLACK}{STRINGID}
|
||||
STR_5981 :{WINDOW_COLOUR_2}Not a banner
|
||||
STR_5982 :{WINDOW_COLOUR_2}Large scenery type: {BLACK}{COMMA16}
|
||||
|
||||
+4
-4
@@ -494,7 +494,7 @@ sint32 game_do_command_p(sint32 command, sint32 *eax, sint32 *ebx, sint32 *ecx,
|
||||
|
||||
// Remove ghost scenery so it doesn't interfere with incoming network command
|
||||
if ((flags & GAME_COMMAND_FLAG_NETWORKED) && !(flags & GAME_COMMAND_FLAG_GHOST) &&
|
||||
(command == GAME_COMMAND_PLACE_FENCE ||
|
||||
(command == GAME_COMMAND_PLACE_WALL ||
|
||||
command == GAME_COMMAND_PLACE_SCENERY ||
|
||||
command == GAME_COMMAND_PLACE_LARGE_SCENERY ||
|
||||
command == GAME_COMMAND_PLACE_BANNER ||
|
||||
@@ -1217,8 +1217,8 @@ GAME_COMMAND_POINTER* new_game_command_table[GAME_COMMAND_COUNT] = {
|
||||
game_command_set_maze_track,
|
||||
game_command_set_park_entrance_fee,
|
||||
game_command_update_staff_colour,
|
||||
game_command_place_fence,
|
||||
game_command_remove_fence,
|
||||
game_command_place_wall,
|
||||
game_command_remove_wall,
|
||||
game_command_place_large_scenery,
|
||||
game_command_remove_large_scenery,
|
||||
game_command_set_current_loan,
|
||||
@@ -1229,7 +1229,7 @@ GAME_COMMAND_POINTER* new_game_command_table[GAME_COMMAND_COUNT] = {
|
||||
game_command_place_banner,
|
||||
game_command_remove_banner,
|
||||
game_command_set_scenery_colour,
|
||||
game_command_set_fence_colour,
|
||||
game_command_set_wall_colour,
|
||||
game_command_set_large_scenery_colour,
|
||||
game_command_set_banner_colour,
|
||||
game_command_set_land_ownership,
|
||||
|
||||
+3
-3
@@ -65,8 +65,8 @@ enum GAME_COMMAND {
|
||||
GAME_COMMAND_SET_MAZE_TRACK,
|
||||
GAME_COMMAND_SET_PARK_ENTRANCE_FEE,
|
||||
GAME_COMMAND_SET_STAFF_COLOUR,
|
||||
GAME_COMMAND_PLACE_FENCE,
|
||||
GAME_COMMAND_REMOVE_FENCE,
|
||||
GAME_COMMAND_PLACE_WALL,
|
||||
GAME_COMMAND_REMOVE_WALL,
|
||||
GAME_COMMAND_PLACE_LARGE_SCENERY,
|
||||
GAME_COMMAND_REMOVE_LARGE_SCENERY,
|
||||
GAME_COMMAND_SET_CURRENT_LOAN,
|
||||
@@ -77,7 +77,7 @@ enum GAME_COMMAND {
|
||||
GAME_COMMAND_PLACE_BANNER,
|
||||
GAME_COMMAND_REMOVE_BANNER,
|
||||
GAME_COMMAND_SET_SCENERY_COLOUR,
|
||||
GAME_COMMAND_SET_FENCE_COLOUR,
|
||||
GAME_COMMAND_SET_WALL_COLOUR,
|
||||
GAME_COMMAND_SET_LARGE_SCENERY_COLOUR,
|
||||
GAME_COMMAND_SET_BANNER_COLOUR,
|
||||
GAME_COMMAND_SET_LAND_OWNERSHIP,
|
||||
|
||||
@@ -490,9 +490,9 @@ void viewport_interaction_remove_park_entrance(rct_map_element *mapElement, sint
|
||||
*/
|
||||
static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, sint32 x, sint32 y)
|
||||
{
|
||||
rct_scenery_entry *sceneryEntry = get_wall_entry(mapElement->properties.fence.type);
|
||||
rct_scenery_entry *sceneryEntry = get_wall_entry(mapElement->properties.wall.type);
|
||||
if (sceneryEntry->wall.scrolling_mode != 0xFF){
|
||||
window_sign_small_open(mapElement->properties.fence.item[0]);
|
||||
window_sign_small_open(mapElement->properties.wall.banner_index);
|
||||
} else {
|
||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
||||
game_do_command(
|
||||
@@ -500,7 +500,7 @@ static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, s
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
y,
|
||||
(mapElement->type & 0x3) | (mapElement->base_height << 8),
|
||||
GAME_COMMAND_REMOVE_FENCE,
|
||||
GAME_COMMAND_REMOVE_WALL,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
@@ -415,6 +415,7 @@
|
||||
<ClCompile Include="world\scenery.c" />
|
||||
<ClCompile Include="world\sprite.c" />
|
||||
<ClCompile Include="world\tile_inspector.c" />
|
||||
<ClCompile Include="world\wall.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\resources\resource.h" />
|
||||
|
||||
@@ -3577,7 +3577,7 @@ enum {
|
||||
STR_TILE_INSPECTOR_GROUPBOX_TRACK_INFO = 5926,
|
||||
STR_TILE_INSPECTOR_GROUPBOX_SCENERY_INFO = 5927,
|
||||
STR_TILE_INSPECTOR_GROUPBOX_ENTRANCE_INFO = 5928,
|
||||
STR_TILE_INSPECTOR_GROUPBOX_FENCE_INFO = 5929,
|
||||
STR_TILE_INSPECTOR_GROUPBOX_WALL_INFO = 5929,
|
||||
STR_TILE_INSPECTOR_GROUPBOX_LARGE_SCENERY_INFO = 5930,
|
||||
STR_TILE_INSPECTOR_GROUPBOX_BANNER_INFO = 5931,
|
||||
STR_TILE_INSPECTOR_GROUPBOX_CORRUPT_INFO = 5932,
|
||||
@@ -3623,11 +3623,11 @@ enum {
|
||||
STR_TILE_INSPECTOR_ENTRANCE_RIDE_ID = 5972,
|
||||
STR_TILE_INSPECTOR_CLAMP_TO_NEXT = 5973,
|
||||
STR_TILE_INSPECTOR_CLAMP_TO_NEXT_TIP = 5974,
|
||||
STR_TILE_INSPECTOR_FENCE_SLOPE = 5975,
|
||||
STR_TILE_INSPECTOR_FENCE_FLAT = 5976,
|
||||
STR_TILE_INSPECTOR_FENCE_SLOPED_LEFT = 5977,
|
||||
STR_TILE_INSPECTOR_FENCE_SLOPED_RIGHT = 5978,
|
||||
STR_TILE_INSPECTOR_FENCE_TYPE = 5979,
|
||||
STR_TILE_INSPECTOR_WALL_SLOPE = 5975,
|
||||
STR_TILE_INSPECTOR_WALL_FLAT = 5976,
|
||||
STR_TILE_INSPECTOR_WALL_SLOPED_LEFT = 5977,
|
||||
STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT = 5978,
|
||||
STR_TILE_INSPECTOR_WALL_TYPE = 5979,
|
||||
STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT = 5980,
|
||||
STR_TILE_INSPECTOR_ENTRY_BANNER_NONE = 5981,
|
||||
STR_TILE_INSPECTOR_LARGE_SCENERY_TYPE = 5982,
|
||||
|
||||
@@ -128,14 +128,14 @@ const std::vector<NetworkAction> NetworkActions::Actions =
|
||||
GAME_COMMAND_REMOVE_SCENERY,
|
||||
GAME_COMMAND_PLACE_SCENERY,
|
||||
GAME_COMMAND_SET_BRAKES_SPEED,
|
||||
GAME_COMMAND_REMOVE_FENCE,
|
||||
GAME_COMMAND_PLACE_FENCE,
|
||||
GAME_COMMAND_REMOVE_WALL,
|
||||
GAME_COMMAND_PLACE_WALL,
|
||||
GAME_COMMAND_REMOVE_LARGE_SCENERY,
|
||||
GAME_COMMAND_PLACE_LARGE_SCENERY,
|
||||
GAME_COMMAND_PLACE_BANNER,
|
||||
GAME_COMMAND_REMOVE_BANNER,
|
||||
GAME_COMMAND_SET_SCENERY_COLOUR,
|
||||
GAME_COMMAND_SET_FENCE_COLOUR,
|
||||
GAME_COMMAND_SET_WALL_COLOUR,
|
||||
GAME_COMMAND_SET_LARGE_SCENERY_COLOUR,
|
||||
GAME_COMMAND_SET_BANNER_COLOUR,
|
||||
GAME_COMMAND_SET_BANNER_NAME,
|
||||
|
||||
@@ -134,7 +134,7 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element)
|
||||
{
|
||||
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_WALL;
|
||||
|
||||
rct_scenery_entry * sceneryEntry = get_wall_entry(map_element->properties.fence.type);
|
||||
rct_scenery_entry * sceneryEntry = get_wall_entry(map_element->properties.wall.type);
|
||||
if (sceneryEntry == NULL || sceneryEntry == (rct_scenery_entry *)-1) {
|
||||
return;
|
||||
}
|
||||
@@ -145,18 +145,18 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element)
|
||||
}
|
||||
|
||||
|
||||
sint32 primaryColour = map_element->properties.fence.item[1] & 0x1F;
|
||||
sint32 primaryColour = map_element->properties.wall.colour_1 & 0x1F;
|
||||
uint32 imageColourFlags = primaryColour << 19 | 0x20000000;
|
||||
uint32 dword_141F718 = imageColourFlags + 0x23800006;
|
||||
|
||||
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) {
|
||||
uint8 secondaryColour = (map_element->properties.fence.item[1] >> 5) | ((map_element->flags & 0x60) >> 2);
|
||||
uint8 secondaryColour = wall_element_get_secondary_colour(map_element);
|
||||
imageColourFlags |= secondaryColour << 24 | 0x80000000;
|
||||
}
|
||||
|
||||
uint32 tertiaryColour = 0;
|
||||
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR) {
|
||||
tertiaryColour = map_element->properties.fence.item[0];
|
||||
tertiaryColour = map_element->properties.wall.colour_3;
|
||||
imageColourFlags &= 0x0DFFFFFFF;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,9 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element)
|
||||
if (sceneryEntry->wall.flags & WALL_SCENERY_IS_DOOR) {
|
||||
rct_xyz16 offset;
|
||||
rct_xyz16 boundsR1, boundsR1_, boundsR2, boundsR2_, boundsL1, boundsL1_;
|
||||
uint8 animationFrame = (map_element->properties.fence.item[2] >> 3) & 0x1F;
|
||||
uint8 animationFrame = wall_element_get_animation_frame(map_element);
|
||||
// Add the direction as well
|
||||
animationFrame |= (map_element->properties.wall.animation & WALL_ANIMATION_FLAG_DIRECTION_BACKWARD) >> 3;
|
||||
uint32 imageId;
|
||||
switch (direction) {
|
||||
case 0:
|
||||
@@ -343,21 +345,21 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element)
|
||||
set_format_arg(0, uint32, 0);
|
||||
set_format_arg(4, uint32, 0);
|
||||
|
||||
uint8 al_2 = map_element->properties.fence.item[1] >> 5 | (map_element->flags & 0x60) >> 2;
|
||||
uint8 secondaryColour = wall_element_get_secondary_colour(map_element);
|
||||
|
||||
if (dword_141F710 != 0) {
|
||||
al_2 = COLOUR_GREY;
|
||||
secondaryColour = COLOUR_GREY;
|
||||
}
|
||||
|
||||
if (direction == 0) {
|
||||
al_2 |= 0x80;
|
||||
secondaryColour |= 0x80;
|
||||
}
|
||||
|
||||
set_format_arg(7, uint8, al_2);
|
||||
set_format_arg(7, uint8, secondaryColour);
|
||||
|
||||
uint16 scrollingMode = sceneryEntry->wall.scrolling_mode + ((direction + 1) & 0x3);
|
||||
|
||||
uint8 bannerIndex = map_element->properties.fence.item[0];
|
||||
uint8 bannerIndex = map_element->properties.wall.banner_index;
|
||||
rct_banner * banner = &gBanners[bannerIndex];
|
||||
|
||||
set_format_arg(0, rct_string_id, banner->string_idx);
|
||||
|
||||
@@ -273,7 +273,7 @@ static void sub_68B3FB(sint32 x, sint32 y)
|
||||
case MAP_ELEMENT_TYPE_ENTRANCE:
|
||||
entrance_paint(direction, height, map_element);
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
fence_paint(direction, height, map_element);
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
||||
|
||||
+12
-12
@@ -11278,9 +11278,9 @@ static bool peep_find_ride_to_look_at(rct_peep *peep, uint8 edge, uint8 *rideToV
|
||||
|
||||
mapElement = surfaceElement;
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE) continue;
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_WALL) continue;
|
||||
if (map_element_get_direction(mapElement) != edge) continue;
|
||||
if (get_wall_entry(mapElement->properties.fence.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) continue;
|
||||
if (get_wall_entry(mapElement->properties.wall.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) continue;
|
||||
if (peep->next_z + 4 <= mapElement->base_height) continue;
|
||||
if (peep->next_z + 1 >= mapElement->clearance_height) continue;
|
||||
|
||||
@@ -11299,9 +11299,9 @@ static bool peep_find_ride_to_look_at(rct_peep *peep, uint8 edge, uint8 *rideToV
|
||||
|
||||
mapElement = surfaceElement;
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE) continue;
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_WALL) continue;
|
||||
if ((map_element_get_direction(mapElement) ^ 0x2) != edge) continue;
|
||||
if (get_wall_entry(mapElement->properties.fence.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) continue;
|
||||
if (get_wall_entry(mapElement->properties.wall.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) continue;
|
||||
// TODO: Check whether this shouldn't be <=, as the other loops use. If so, also extract as loop A.
|
||||
if (peep->next_z + 4 >= mapElement->base_height) continue;
|
||||
if (peep->next_z + 1 >= mapElement->clearance_height) continue;
|
||||
@@ -11347,8 +11347,8 @@ static bool peep_find_ride_to_look_at(rct_peep *peep, uint8 edge, uint8 *rideToV
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_SURFACE) continue;
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_PATH) continue;
|
||||
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_FENCE) {
|
||||
if (get_wall_entry(mapElement->properties.fence.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) {
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_WALL) {
|
||||
if (get_wall_entry(mapElement->properties.wall.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -11369,9 +11369,9 @@ static bool peep_find_ride_to_look_at(rct_peep *peep, uint8 edge, uint8 *rideToV
|
||||
// TODO: extract loop A
|
||||
mapElement = surfaceElement;
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE) continue;
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_WALL) continue;
|
||||
if ((map_element_get_direction(mapElement) ^ 0x2) != edge) continue;
|
||||
if (get_wall_entry(mapElement->properties.fence.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) continue;
|
||||
if (get_wall_entry(mapElement->properties.wall.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) continue;
|
||||
if (peep->next_z + 6 <= mapElement->base_height) continue;
|
||||
if (peep->next_z >= mapElement->clearance_height) continue;
|
||||
|
||||
@@ -11416,8 +11416,8 @@ static bool peep_find_ride_to_look_at(rct_peep *peep, uint8 edge, uint8 *rideToV
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_SURFACE) continue;
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_PATH) continue;
|
||||
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_FENCE) {
|
||||
if (get_wall_entry(mapElement->properties.fence.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) {
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_WALL) {
|
||||
if (get_wall_entry(mapElement->properties.wall.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -11437,9 +11437,9 @@ static bool peep_find_ride_to_look_at(rct_peep *peep, uint8 edge, uint8 *rideToV
|
||||
// TODO: extract loop A
|
||||
mapElement = surfaceElement;
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE) continue;
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_WALL) continue;
|
||||
if ((map_element_get_direction(mapElement) ^ 0x2) != edge) continue;
|
||||
if (get_wall_entry(mapElement->properties.fence.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) continue;
|
||||
if (get_wall_entry(mapElement->properties.wall.type)->wall.flags2 & WALL_SCENERY_2_FLAG4) continue;
|
||||
if (peep->next_z + 8 <= mapElement->base_height) continue;
|
||||
if (peep->next_z >= mapElement->clearance_height) continue;
|
||||
|
||||
|
||||
@@ -418,11 +418,11 @@ private:
|
||||
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
||||
AddEntryForLargeScenery(mapElement->properties.scenerymultiple.type & MAP_ELEMENT_LARGE_TYPE_MASK);
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
{
|
||||
uint8 var_05 = mapElement->properties.fence.item[0];
|
||||
uint16 var_06 = mapElement->properties.fence.item[1] |
|
||||
(mapElement->properties.fence.item[2] << 8);
|
||||
uint8 var_05 = mapElement->properties.wall.colour_3;
|
||||
uint16 var_06 = mapElement->properties.wall.colour_1 |
|
||||
(mapElement->properties.wall.animation << 8);
|
||||
|
||||
for (sint32 edge = 0; edge < 4; edge++)
|
||||
{
|
||||
@@ -2114,15 +2114,15 @@ private:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
colour = ((mapElement->type & 0xC0) >> 3) |
|
||||
((mapElement->properties.fence.type & 0xE0) >> 5);
|
||||
((mapElement->properties.wall.type & 0xE0) >> 5);
|
||||
colour = RCT1::GetColour(colour);
|
||||
|
||||
mapElement->type &= 0x3F;
|
||||
mapElement->properties.fence.type &= 0x1F;
|
||||
mapElement->properties.wall.type &= 0x1F;
|
||||
mapElement->type |= (colour & 0x18) << 3;
|
||||
mapElement->properties.fence.type |= (colour & 7) << 5;
|
||||
mapElement->properties.wall.type |= (colour & 7) << 5;
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
||||
colour = RCT1::GetColour(mapElement->properties.scenerymultiple.colour[0] & 0x1F);
|
||||
@@ -2220,14 +2220,14 @@ private:
|
||||
rct_map_element * mapElement = map_get_first_element_at(x, y);
|
||||
do
|
||||
{
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_FENCE)
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_WALL)
|
||||
{
|
||||
rct_map_element originalMapElement = *mapElement;
|
||||
map_element_remove(mapElement);
|
||||
|
||||
uint8 var_05 = originalMapElement.properties.fence.item[0];
|
||||
uint16 var_06 = originalMapElement.properties.fence.item[1] |
|
||||
(originalMapElement.properties.fence.item[2] << 8);
|
||||
uint8 var_05 = originalMapElement.properties.wall.colour_3;
|
||||
uint16 var_06 = originalMapElement.properties.wall.colour_1 |
|
||||
(originalMapElement.properties.wall.animation << 8);
|
||||
|
||||
for (sint32 edge = 0; edge < 4; edge++)
|
||||
{
|
||||
@@ -2237,13 +2237,13 @@ private:
|
||||
{
|
||||
sint32 type = typeA | (typeB << 2);
|
||||
sint32 colourA = ((originalMapElement.type & 0xC0) >> 3) |
|
||||
(originalMapElement.properties.fence.type >> 5);
|
||||
(originalMapElement.properties.wall.type >> 5);
|
||||
sint32 colourB = 0;
|
||||
sint32 colourC = 0;
|
||||
ConvertWall(&type, &colourA, &colourB, &colourC);
|
||||
|
||||
type = _wallTypeToEntryMap[type];
|
||||
map_place_fence(type, x * 32, y * 32, 0, edge, colourA, colourB, colourC, 169);
|
||||
wall_place(type, x * 32, y * 32, 0, edge, colourA, colourB, colourC, 169);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -8268,7 +8268,7 @@ static money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 d
|
||||
!(flags & GAME_COMMAND_FLAG_GHOST)
|
||||
) {
|
||||
footpath_remove_litter(x, y, z);
|
||||
map_remove_walls_at_z(x, y, z);
|
||||
wall_remove_at_z(x, y, z);
|
||||
}
|
||||
|
||||
if (!gCheatsSandboxMode && !map_is_location_owned(x, y, z)) {
|
||||
|
||||
@@ -1121,20 +1121,20 @@ static money32 track_place(sint32 rideIndex, sint32 type, sint32 originX, sint32
|
||||
if ((flags & GAME_COMMAND_FLAG_APPLY) && !(flags & GAME_COMMAND_FLAG_GHOST) && !gCheatsDisableClearanceChecks) {
|
||||
footpath_remove_litter(x, y, z);
|
||||
if (rideTypeFlags & RIDE_TYPE_FLAG_TRACK_NO_WALLS) {
|
||||
map_remove_walls_at(x, y, baseZ * 8, clearanceZ * 8);
|
||||
wall_remove_at(x, y, baseZ * 8, clearanceZ * 8);
|
||||
} else {
|
||||
// Remove walls in the directions this track intersects
|
||||
uint8 intersectingDirections = (*wallEdges)[blockIndex];
|
||||
intersectingDirections ^= 0x0F;
|
||||
for (sint32 i = 0; i < 4; i++) {
|
||||
if (intersectingDirections & (1 << i)) {
|
||||
map_remove_intersecting_walls(x, y, baseZ, clearanceZ, i);
|
||||
wall_remove_intersecting_walls(x, y, baseZ, clearanceZ, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bh = gMapGroundFlags & (ELEMENT_IS_1 | ELEMENT_IS_UNDERGROUND);
|
||||
bh = gMapGroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
|
||||
if (gTrackGroundFlags != 0 && (gTrackGroundFlags & bh) == 0) {
|
||||
gGameCommandErrorText = STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND;
|
||||
return MONEY32_UNDEFINED;
|
||||
@@ -1228,7 +1228,7 @@ static money32 track_place(sint32 rideIndex, sint32 type, sint32 originX, sint32
|
||||
temp_x += TileDirectionDelta[temp_direction].x;
|
||||
temp_y += TileDirectionDelta[temp_direction].y;
|
||||
temp_direction ^= (1 << 1);
|
||||
map_remove_intersecting_walls(temp_x, temp_y, baseZ, clearanceZ, temp_direction & 3);
|
||||
wall_remove_intersecting_walls(temp_x, temp_y, baseZ, clearanceZ, temp_direction & 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1779,7 +1779,7 @@ static money32 set_maze_track(uint16 x, uint8 flags, uint8 direction, uint16 y,
|
||||
if ((flags & GAME_COMMAND_FLAG_APPLY) != 0) {
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST) && !(flags & GAME_COMMAND_FLAG_2)) {
|
||||
footpath_remove_litter(x, y, z);
|
||||
map_remove_walls_at(floor2(x, 32), floor2(y, 32), z, z + 32);
|
||||
wall_remove_at(floor2(x, 32), floor2(y, 32), z, z + 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -682,7 +682,7 @@ static sint32 track_design_place_scenery(rct_td6_scenery_element *scenery_start,
|
||||
0x69,
|
||||
mapCoord.y,
|
||||
(z << 8) | ((rotation + scenery->flags) & 0x3),
|
||||
GAME_COMMAND_REMOVE_FENCE,
|
||||
GAME_COMMAND_REMOVE_WALL,
|
||||
0,
|
||||
0);
|
||||
break;
|
||||
@@ -819,7 +819,7 @@ static sint32 track_design_place_scenery(rct_td6_scenery_element *scenery_start,
|
||||
bl | (entry_index << 8),
|
||||
mapCoord.y,
|
||||
rotation | (scenery->primary_colour << 8),
|
||||
GAME_COMMAND_PLACE_FENCE,
|
||||
GAME_COMMAND_PLACE_WALL,
|
||||
z,
|
||||
scenery->secondary_colour | ((scenery->flags & 0xFC) << 6)
|
||||
);
|
||||
@@ -1536,7 +1536,7 @@ static money32 place_maze_design(uint8 flags, uint8 rideIndex, uint16 mazeEntry,
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
footpath_remove_litter(x, y, z);
|
||||
map_remove_walls_at(floor2(x, 32), floor2(y, 32), z, z + 32);
|
||||
wall_remove_at(floor2(x, 32), floor2(y, 32), z, z + 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ static sint32 map_element_get_total_element_count(rct_map_element *mapElement)
|
||||
switch (map_element_get_type(mapElement)) {
|
||||
case MAP_ELEMENT_TYPE_PATH:
|
||||
case MAP_ELEMENT_TYPE_SCENERY:
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
return 1;
|
||||
|
||||
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
||||
@@ -332,15 +332,15 @@ static void track_design_save_add_large_scenery(sint32 x, sint32 y, rct_map_elem
|
||||
|
||||
static void track_design_save_add_wall(sint32 x, sint32 y, rct_map_element *mapElement)
|
||||
{
|
||||
sint32 entryType = mapElement->properties.fence.type;
|
||||
sint32 entryType = mapElement->properties.wall.type;
|
||||
rct_object_entry *entry = (rct_object_entry*)&object_entry_groups[OBJECT_TYPE_WALLS].entries[entryType];
|
||||
|
||||
uint8 flags = 0;
|
||||
flags |= mapElement->type & 3;
|
||||
flags |= mapElement->properties.fence.item[0] << 2;
|
||||
flags |= mapElement->properties.wall.colour_3 << 2;
|
||||
|
||||
uint8 secondaryColour = ((mapElement->flags & 0x60) >> 2) | (mapElement->properties.fence.item[1] >> 5);
|
||||
uint8 primaryColour = mapElement->properties.fence.item[1] & 0x1F;
|
||||
uint8 secondaryColour = wall_element_get_secondary_colour(mapElement);
|
||||
uint8 primaryColour = mapElement->properties.wall.colour_1 & 0x1F;
|
||||
|
||||
track_design_save_push_map_element(x, y, mapElement);
|
||||
track_design_save_push_map_element_desc(entry, x, y, mapElement->base_height, flags, primaryColour, secondaryColour);
|
||||
@@ -515,15 +515,15 @@ static void track_design_save_remove_large_scenery(sint32 x, sint32 y, rct_map_e
|
||||
|
||||
static void track_design_save_remove_wall(sint32 x, sint32 y, rct_map_element *mapElement)
|
||||
{
|
||||
sint32 entryType = mapElement->properties.fence.type;
|
||||
sint32 entryType = mapElement->properties.wall.type;
|
||||
rct_object_entry *entry = (rct_object_entry*)&object_entry_groups[OBJECT_TYPE_WALLS].entries[entryType];
|
||||
|
||||
uint8 flags = 0;
|
||||
flags |= mapElement->type & 3;
|
||||
flags |= mapElement->properties.fence.item[0] << 2;
|
||||
flags |= mapElement->properties.wall.colour_3 << 2;
|
||||
|
||||
uint8 secondaryColour = ((mapElement->flags & 0x60) >> 2) | (mapElement->properties.fence.item[1] >> 5);
|
||||
uint8 primaryColour = mapElement->properties.fence.item[1] & 0x1F;
|
||||
uint8 secondaryColour = wall_element_get_secondary_colour(mapElement);
|
||||
uint8 primaryColour = mapElement->properties.wall.colour_1 & 0x1F;
|
||||
|
||||
track_design_save_pop_map_element(x, y, mapElement);
|
||||
track_design_save_pop_map_element_desc(entry, x, y, mapElement->base_height, flags, primaryColour, secondaryColour);
|
||||
@@ -608,7 +608,7 @@ static void track_design_save_select_nearby_scenery_for_tile(sint32 rideIndex, s
|
||||
case MAP_ELEMENT_TYPE_SCENERY:
|
||||
interactionType = VIEWPORT_INTERACTION_ITEM_SCENERY;
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
interactionType = VIEWPORT_INTERACTION_ITEM_WALL;
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
||||
|
||||
+12
-12
@@ -6804,7 +6804,7 @@ static void sub_6D63D4(rct_vehicle *vehicle)
|
||||
*/
|
||||
static void vehicle_play_scenery_door_open_sound(rct_vehicle *vehicle, rct_map_element *mapElement)
|
||||
{
|
||||
rct_scenery_entry *wallEntry = get_wall_entry(mapElement->properties.fence.type);
|
||||
rct_scenery_entry *wallEntry = get_wall_entry(mapElement->properties.wall.type);
|
||||
sint32 doorSoundType = (wallEntry->wall.flags2 >> 1) & 3;
|
||||
if (doorSoundType != 0) {
|
||||
sint32 soundId = DoorOpenSoundIds[doorSoundType - 1];
|
||||
@@ -6820,7 +6820,7 @@ static void vehicle_play_scenery_door_open_sound(rct_vehicle *vehicle, rct_map_e
|
||||
*/
|
||||
static void vehicle_play_scenery_door_close_sound(rct_vehicle *vehicle, rct_map_element *mapElement)
|
||||
{
|
||||
rct_scenery_entry *wallEntry = get_wall_entry(mapElement->properties.fence.type);
|
||||
rct_scenery_entry *wallEntry = get_wall_entry(mapElement->properties.wall.type);
|
||||
sint32 doorSoundType = (wallEntry->wall.flags2 >> 1) & 3;
|
||||
if (doorSoundType != 0) {
|
||||
sint32 soundId = DoorCloseSoundIds[doorSoundType - 1];
|
||||
@@ -6847,19 +6847,19 @@ static void vehicle_update_scenery_door(rct_vehicle *vehicle)
|
||||
sint32 z = (vehicle->track_z - trackBlock->z + trackCoordinates->z_end) >> 3;
|
||||
sint32 direction = (vehicle->track_direction + trackCoordinates->rotation_end) & 3;
|
||||
|
||||
rct_map_element *mapElement = map_get_fence_element_at(x, y, z, direction);
|
||||
rct_map_element *mapElement = map_get_wall_element_at(x, y, z, direction);
|
||||
if (mapElement == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (vehicle->next_vehicle_on_train != SPRITE_INDEX_NULL) {
|
||||
mapElement->properties.fence.item[2] &= 7;
|
||||
mapElement->properties.fence.item[2] |= 8;
|
||||
mapElement->properties.wall.animation &= ~(WALL_ANIMATION_FLAG_DIRECTION_BACKWARD);
|
||||
wall_element_set_animation_frame(mapElement, 1);
|
||||
map_animation_create(MAP_ANIMATION_TYPE_WALL_DOOR, x, y, z);
|
||||
vehicle_play_scenery_door_open_sound(vehicle, mapElement);
|
||||
} else {
|
||||
mapElement->properties.fence.item[2] &= 7;
|
||||
mapElement->properties.fence.item[2] |= 0x30;
|
||||
mapElement->properties.wall.animation &= ~(WALL_ANIMATION_FLAG_DIRECTION_BACKWARD);
|
||||
wall_element_set_animation_frame(mapElement, 12);
|
||||
vehicle_play_scenery_door_close_sound(vehicle, mapElement);
|
||||
}
|
||||
}
|
||||
@@ -6930,19 +6930,19 @@ static void sub_6DEDE8(rct_vehicle *vehicle)
|
||||
sint32 direction = (vehicle->track_direction + trackCoordinates->rotation_begin) & 3;
|
||||
direction ^= 2;
|
||||
|
||||
rct_map_element *mapElement = map_get_fence_element_at(x, y, z, direction);
|
||||
rct_map_element *mapElement = map_get_wall_element_at(x, y, z, direction);
|
||||
if (mapElement == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (vehicle->next_vehicle_on_train != SPRITE_INDEX_NULL) {
|
||||
mapElement->properties.fence.item[2] &= 7;
|
||||
mapElement->properties.fence.item[2] |= 0x88;
|
||||
mapElement->properties.wall.animation |= WALL_ANIMATION_FLAG_DIRECTION_BACKWARD;
|
||||
wall_element_set_animation_frame(mapElement, 1);
|
||||
map_animation_create(MAP_ANIMATION_TYPE_WALL_DOOR, x, y, z);
|
||||
vehicle_play_scenery_door_open_sound(vehicle, mapElement);
|
||||
} else {
|
||||
mapElement->properties.fence.item[2] &= 7;
|
||||
mapElement->properties.fence.item[2] |= 0xB0;
|
||||
mapElement->properties.wall.animation &= ~(WALL_ANIMATION_FLAG_DIRECTION_BACKWARD);
|
||||
wall_element_set_animation_frame(mapElement, 12);
|
||||
vehicle_play_scenery_door_close_sound(vehicle, mapElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,8 +596,8 @@ static void setup_in_use_selection_flags()
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_PATHS]);
|
||||
gEditorSelectedObjects[OBJECT_TYPE_PATHS][type] |= (1 << 0);
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
type = iter.element->properties.fence.type;
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
type = iter.element->properties.wall.type;
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_WALLS]);
|
||||
gEditorSelectedObjects[OBJECT_TYPE_WALLS][type] |= (1 << 0);
|
||||
break;
|
||||
|
||||
@@ -894,8 +894,8 @@ static void window_footpath_construct()
|
||||
if (cost != MONEY32_UNDEFINED && !gCheatsDisableClearanceChecks) {
|
||||
// It is possible, let's remove walls between the old and new piece of path
|
||||
uint8 direction = gFootpathConstructDirection;
|
||||
map_remove_intersecting_walls(x, y, z, z + 4 + ((slope & 0xf) ? 2 : 0), direction ^ 2);
|
||||
map_remove_intersecting_walls(
|
||||
wall_remove_intersecting_walls(x, y, z, z + 4 + ((slope & 0xf) ? 2 : 0), direction ^ 2);
|
||||
wall_remove_intersecting_walls(
|
||||
x - TileDirectionDelta[direction].x,
|
||||
y - TileDirectionDelta[direction].y,
|
||||
z, z + 4, direction
|
||||
|
||||
@@ -1448,7 +1448,7 @@ static const uint16 ElementTypeMaskColour[] = {
|
||||
0x00FF, // MAP_ELEMENT_TYPE_TRACK
|
||||
0xFF00, // MAP_ELEMENT_TYPE_SCENERY
|
||||
0x0000, // MAP_ELEMENT_TYPE_ENTRANCE
|
||||
0xFFFF, // MAP_ELEMENT_TYPE_FENCE
|
||||
0xFFFF, // MAP_ELEMENT_TYPE_WALL
|
||||
0x0000, // MAP_ELEMENT_TYPE_SCENERY_MULTIPLE
|
||||
0xFFFF, // MAP_ELEMENT_TYPE_BANNER
|
||||
0x0000, // MAP_ELEMENT_TYPE_CORRUPT
|
||||
@@ -1460,7 +1460,7 @@ static const uint16 ElementTypeAddColour[] = {
|
||||
0xB700, // MAP_ELEMENT_TYPE_TRACK
|
||||
0x0063, // MAP_ELEMENT_TYPE_SCENERY
|
||||
0xBABA, // MAP_ELEMENT_TYPE_ENTRANCE
|
||||
0x0000, // MAP_ELEMENT_TYPE_FENCE
|
||||
0x0000, // MAP_ELEMENT_TYPE_WALL
|
||||
0x6363, // MAP_ELEMENT_TYPE_SCENERY_MULTIPLE
|
||||
0x0000, // MAP_ELEMENT_TYPE_BANNER
|
||||
0x4444, // MAP_ELEMENT_TYPE_CORRUPT
|
||||
|
||||
+10
-11
@@ -434,10 +434,10 @@ void window_sign_small_open(rct_windownumber number){
|
||||
rct_map_element* map_element = map_get_first_element_at(view_x / 32, view_y / 32);
|
||||
|
||||
while (1){
|
||||
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_FENCE) {
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.fence.type);
|
||||
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_WALL) {
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.wall.type);
|
||||
if (scenery_entry->wall.scrolling_mode != 0xFF){
|
||||
if (map_element->properties.fence.item[0] == w->number)
|
||||
if (map_element->properties.wall.banner_index == w->number)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -447,10 +447,9 @@ void window_sign_small_open(rct_windownumber number){
|
||||
sint32 view_z = map_element->base_height << 3;
|
||||
w->frame_no = view_z;
|
||||
|
||||
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.type;
|
||||
w->list_information_type = map_element->properties.wall.colour_1 & 0x1F;
|
||||
w->var_492 = wall_element_get_secondary_colour(map_element);
|
||||
w->var_48C = map_element->properties.wall.type;
|
||||
|
||||
view_x += 16;
|
||||
view_y += 16;
|
||||
@@ -496,10 +495,10 @@ static void window_sign_small_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
break;
|
||||
case WIDX_SIGN_DEMOLISH:
|
||||
while (1){
|
||||
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_FENCE) {
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.fence.type);
|
||||
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_WALL) {
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.wall.type);
|
||||
if (scenery_entry->wall.scrolling_mode != 0xFF){
|
||||
if (map_element->properties.fence.item[0] == w->number)
|
||||
if (map_element->properties.wall.banner_index == w->number)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -511,7 +510,7 @@ static void window_sign_small_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
1 | ((map_element->type & 0x3) << 8),
|
||||
y,
|
||||
(map_element->base_height << 8) | (map_element->type & 0x3),
|
||||
GAME_COMMAND_REMOVE_FENCE,
|
||||
GAME_COMMAND_REMOVE_WALL,
|
||||
0,
|
||||
0);
|
||||
break;
|
||||
|
||||
@@ -70,10 +70,10 @@ static const rct_string_id ParkEntrancePartStringIds[] = {
|
||||
STR_TILE_INSPECTOR_ENTRANCE_RIGHT
|
||||
};
|
||||
|
||||
static const rct_string_id FenceSlopeStringIds[] = {
|
||||
STR_TILE_INSPECTOR_FENCE_FLAT,
|
||||
STR_TILE_INSPECTOR_FENCE_SLOPED_LEFT,
|
||||
STR_TILE_INSPECTOR_FENCE_SLOPED_RIGHT
|
||||
static const rct_string_id WallSlopeStringIds[] = {
|
||||
STR_TILE_INSPECTOR_WALL_FLAT,
|
||||
STR_TILE_INSPECTOR_WALL_SLOPED_LEFT,
|
||||
STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT
|
||||
};
|
||||
|
||||
enum WINDOW_TILE_INSPECTOR_WIDGET_IDX {
|
||||
@@ -157,12 +157,12 @@ enum WINDOW_TILE_INSPECTOR_WIDGET_IDX {
|
||||
WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE,
|
||||
WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE,
|
||||
|
||||
// Fence
|
||||
WIDX_FENCE_SPINNER_HEIGHT = PAGE_WIDGETS,
|
||||
WIDX_FENCE_SPINNER_HEIGHT_INCREASE,
|
||||
WIDX_FENCE_SPINNER_HEIGHT_DECREASE,
|
||||
WIDX_FENCE_DROPDOWN_SLOPE,
|
||||
WIDX_FENCE_DROPDOWN_SLOPE_BUTTON,
|
||||
// Wall
|
||||
WIDX_WALL_SPINNER_HEIGHT = PAGE_WIDGETS,
|
||||
WIDX_WALL_SPINNER_HEIGHT_INCREASE,
|
||||
WIDX_WALL_SPINNER_HEIGHT_DECREASE,
|
||||
WIDX_WALL_DROPDOWN_SLOPE,
|
||||
WIDX_WALL_DROPDOWN_SLOPE_BUTTON,
|
||||
|
||||
// Large
|
||||
WIDX_LARGE_SCENERY_SPINNER_HEIGHT = PAGE_WIDGETS,
|
||||
@@ -356,17 +356,17 @@ static rct_widget EntranceWidgets[] = {
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
#define FEN_GBPB PADDING_BOTTOM // Fence group box properties bottom
|
||||
#define FEN_GBPT (FEN_GBPB + 16 + 2 * 21) // Fence group box properties top
|
||||
#define FEN_GBDB (FEN_GBPT + GROUPBOX_PADDING) // Fence group box info bottom
|
||||
#define FEN_GBDT (FEN_GBDB + 20 + 2 * 11) // Fence group box info top
|
||||
static rct_widget FenceWidgets[] = {
|
||||
#define WALL_GBPB PADDING_BOTTOM // Wall group box properties bottom
|
||||
#define WALL_GBPT (WALL_GBPB + 16 + 2 * 21) // Wall group box properties top
|
||||
#define WALL_GBDB (WALL_GBPT + GROUPBOX_PADDING) // Wall group box info bottom
|
||||
#define WALL_GBDT (WALL_GBDB + 20 + 2 * 11) // Wall group box info top
|
||||
static rct_widget WallWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WWT_SPINNER, 1, GBS(WH - FEN_GBPT, 1, 0), STR_NONE, STR_NONE }, // WIDX_FENCE_SPINNER_HEIGHT
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - FEN_GBPT, 1, 0), STR_NUMERIC_UP, STR_NONE }, // WIDX_FENCE_SPINNER_HEIGHT_INCREASE
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSD(WH - FEN_GBPT, 1, 0), STR_NUMERIC_DOWN, STR_NONE }, // WIDX_FENCE_SPINNER_HEIGHT_DECREASE
|
||||
{ WWT_DROPDOWN, 1, GBS(WH - FEN_GBPT, 1, 1), STR_NONE, STR_NONE }, // WIDX_FENCE_DROPDOWN_SLOPE
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBDB(WH - FEN_GBPT, 1, 1), STR_DROPDOWN_GLYPH, STR_NONE }, // WIDX_FENCE_DROPDOWN_SLOPE_BUTTON
|
||||
{ WWT_SPINNER, 1, GBS(WH - WALL_GBPT, 1, 0), STR_NONE, STR_NONE }, // WIDX_WALL_SPINNER_HEIGHT
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - WALL_GBPT, 1, 0), STR_NUMERIC_UP, STR_NONE }, // WIDX_WALL_SPINNER_HEIGHT_INCREASE
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSD(WH - WALL_GBPT, 1, 0), STR_NUMERIC_DOWN, STR_NONE }, // WIDX_WALL_SPINNER_HEIGHT_DECREASE
|
||||
{ WWT_DROPDOWN, 1, GBS(WH - WALL_GBPT, 1, 1), STR_NONE, STR_NONE }, // WIDX_WALL_DROPDOWN_SLOPE
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBDB(WH - WALL_GBPT, 1, 1), STR_DROPDOWN_GLYPH, STR_NONE }, // WIDX_WALL_DROPDOWN_SLOPE_BUTTON
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
@@ -419,7 +419,7 @@ static rct_widget *PageWidgets[] = {
|
||||
TrackWidgets,
|
||||
SceneryWidgets,
|
||||
EntranceWidgets,
|
||||
FenceWidgets,
|
||||
WallWidgets,
|
||||
LargeSceneryWidgets,
|
||||
BannerWidgets,
|
||||
CorruptWidgets,
|
||||
@@ -437,7 +437,7 @@ static struct {
|
||||
{ TRA_GBDT, TRA_GBDB, TRA_GBPT, TRA_GBPB, STR_TILE_INSPECTOR_GROUPBOX_TRACK_INFO },
|
||||
{ SCE_GBDT, SCE_GBDB, SCE_GBPT, SCE_GBPB, STR_TILE_INSPECTOR_GROUPBOX_SCENERY_INFO },
|
||||
{ ENT_GBDT, ENT_GBDB, ENT_GBPT, ENT_GBPB, STR_TILE_INSPECTOR_GROUPBOX_ENTRANCE_INFO },
|
||||
{ FEN_GBDT, FEN_GBDB, FEN_GBPT, FEN_GBPB, STR_TILE_INSPECTOR_GROUPBOX_FENCE_INFO },
|
||||
{ WALL_GBDT, WALL_GBDB, WALL_GBPT, WALL_GBPB, STR_TILE_INSPECTOR_GROUPBOX_WALL_INFO },
|
||||
{ LAR_GBDT, LAR_GBDB, LAR_GBPT, LAR_GBPB, STR_TILE_INSPECTOR_GROUPBOX_LARGE_SCENERY_INFO },
|
||||
{ BAN_GBDT, BAN_GBDB, BAN_GBPT, BAN_GBPB, STR_TILE_INSPECTOR_GROUPBOX_BANNER_INFO },
|
||||
{ COR_GBDT, COR_GBDB, COR_GBPT, COR_GBPB, STR_TILE_INSPECTOR_GROUPBOX_CORRUPT_INFO }
|
||||
@@ -510,7 +510,7 @@ static uint64 PageEnabledWidgets[] = {
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_TRACK_CHECK_APPLY_TO_ALL) | (1ULL << WIDX_TRACK_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_TRACK_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_TRACK_CHECK_CHAIN_LIFT),
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_SCENERY_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_SCENERY_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_SCENERY_CHECK_QUARTER_N) | (1ULL << WIDX_SCENERY_CHECK_QUARTER_E) | (1ULL << WIDX_SCENERY_CHECK_QUARTER_S) | (1ULL << WIDX_SCENERY_CHECK_QUARTER_W) | (1ULL << WIDX_SCENERY_CHECK_COLLISION_N) | (1ULL << WIDX_SCENERY_CHECK_COLLISION_E) | (1ULL << WIDX_SCENERY_CHECK_COLLISION_S) | (1ULL << WIDX_SCENERY_CHECK_COLLISION_W),
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE),
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_FENCE_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_FENCE_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_FENCE_DROPDOWN_SLOPE) | (1ULL << WIDX_FENCE_DROPDOWN_SLOPE_BUTTON),
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_WALL_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_WALL_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_WALL_DROPDOWN_SLOPE) | (1ULL << WIDX_WALL_DROPDOWN_SLOPE_BUTTON),
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_LARGE_SCENERY_SPINNER_HEIGHT) | (1ULL << WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE),
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_BANNER_SPINNER_HEIGHT) | (1ULL << WIDX_BANNER_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_BANNER_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_BANNER_CHECK_BLOCK_NE) | (1ULL << WIDX_BANNER_CHECK_BLOCK_SE) | (1ULL << WIDX_BANNER_CHECK_BLOCK_SW) | (1ULL << WIDX_BANNER_CHECK_BLOCK_NW),
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_CORRUPT_SPINNER_HEIGHT) | (1ULL << WIDX_CORRUPT_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_CORRUPT_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_CORRUPT_BUTTON_CLAMP),
|
||||
@@ -778,13 +778,13 @@ static void window_tile_inspector_path_toggle_edge(sint32 elementIndex, sint32 c
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_fence_set_slope(sint32 elementIndex, sint32 slopeValue)
|
||||
static void window_tile_inspector_wall_set_slope(sint32 elementIndex, sint32 slopeValue)
|
||||
{
|
||||
// Make sure only the correct bits are set
|
||||
openrct2_assert((slopeValue & 0xC0) == slopeValue, "slopeValue doesn't match its mask");
|
||||
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_FENCE_SET_SLOPE,
|
||||
TILE_INSPECTOR_WALL_SET_SLOPE,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
elementIndex,
|
||||
@@ -1075,12 +1075,12 @@ static void window_tile_inspector_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
} // switch widget index
|
||||
break;
|
||||
|
||||
case TILE_INSPECTOR_PAGE_FENCE:
|
||||
case TILE_INSPECTOR_PAGE_WALL:
|
||||
switch (widgetIndex) {
|
||||
case WIDX_FENCE_SPINNER_HEIGHT_INCREASE:
|
||||
case WIDX_WALL_SPINNER_HEIGHT_INCREASE:
|
||||
window_tile_inspector_base_height_offset(w->selected_list_item, 1);
|
||||
break;
|
||||
case WIDX_FENCE_SPINNER_HEIGHT_DECREASE:
|
||||
case WIDX_WALL_SPINNER_HEIGHT_DECREASE:
|
||||
window_tile_inspector_base_height_offset(w->selected_list_item, -1);
|
||||
break;
|
||||
} // switch widget index
|
||||
@@ -1147,9 +1147,9 @@ static void window_tile_inspector_resize(rct_window *w)
|
||||
static void window_tile_inspector_mousedown(sint32 widgetIndex, rct_window *w, rct_widget* widget)
|
||||
{
|
||||
switch (w->page) {
|
||||
case TILE_INSPECTOR_PAGE_FENCE:
|
||||
case TILE_INSPECTOR_PAGE_WALL:
|
||||
switch (widgetIndex) {
|
||||
case WIDX_FENCE_DROPDOWN_SLOPE_BUTTON:
|
||||
case WIDX_WALL_DROPDOWN_SLOPE_BUTTON:
|
||||
// Use dropdown instead of dropdown button
|
||||
widget--;
|
||||
|
||||
@@ -1157,9 +1157,9 @@ static void window_tile_inspector_mousedown(sint32 widgetIndex, rct_window *w, r
|
||||
gDropdownItemsFormat[0] = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItemsFormat[1] = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItemsFormat[2] = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItemsArgs[0] = STR_TILE_INSPECTOR_FENCE_FLAT;
|
||||
gDropdownItemsArgs[1] = STR_TILE_INSPECTOR_FENCE_SLOPED_LEFT;
|
||||
gDropdownItemsArgs[2] = STR_TILE_INSPECTOR_FENCE_SLOPED_RIGHT;
|
||||
gDropdownItemsArgs[0] = STR_TILE_INSPECTOR_WALL_FLAT;
|
||||
gDropdownItemsArgs[1] = STR_TILE_INSPECTOR_WALL_SLOPED_LEFT;
|
||||
gDropdownItemsArgs[2] = STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT;
|
||||
window_dropdown_show_text_custom_width(
|
||||
w->x + widget->left,
|
||||
w->y + widget->top,
|
||||
@@ -1202,12 +1202,12 @@ static void window_tile_inspector_dropdown(rct_window *w, sint32 widgetIndex, si
|
||||
rct_map_element *const mapElement = window_tile_inspector_get_selected_element(w);
|
||||
|
||||
switch (w->page) {
|
||||
case TILE_INSPECTOR_PAGE_FENCE:
|
||||
openrct2_assert(map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_FENCE, "Element is not a fence");
|
||||
case TILE_INSPECTOR_PAGE_WALL:
|
||||
openrct2_assert(map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_WALL, "Element is not a wall");
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_FENCE_DROPDOWN_SLOPE_BUTTON:
|
||||
window_tile_inspector_fence_set_slope(w->selected_list_item, dropdownIndex << 6);
|
||||
case WIDX_WALL_DROPDOWN_SLOPE_BUTTON:
|
||||
window_tile_inspector_wall_set_slope(w->selected_list_item, dropdownIndex << 6);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -1325,16 +1325,16 @@ void window_tile_inspector_auto_set_buttons(rct_window *w)
|
||||
|
||||
// Page widgets
|
||||
switch (w->page) {
|
||||
case TILE_INSPECTOR_PAGE_FENCE: {
|
||||
case TILE_INSPECTOR_PAGE_WALL: {
|
||||
const rct_map_element *const mapElement = window_tile_inspector_get_selected_element(w);
|
||||
const uint8 fenceType = mapElement->properties.fence.type;
|
||||
const rct_wall_scenery_entry wallEntry = get_wall_entry(fenceType)->wall;
|
||||
const uint8 wallType = mapElement->properties.wall.type;
|
||||
const rct_wall_scenery_entry wallEntry = get_wall_entry(wallType)->wall;
|
||||
const bool canBeSloped = !(wallEntry.flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE);
|
||||
// Fence slope dropdown
|
||||
widget_set_enabled(w, WIDX_FENCE_DROPDOWN_SLOPE, canBeSloped);
|
||||
widget_invalidate(w, WIDX_FENCE_DROPDOWN_SLOPE);
|
||||
widget_set_enabled(w, WIDX_FENCE_DROPDOWN_SLOPE_BUTTON, canBeSloped);
|
||||
widget_invalidate(w, WIDX_FENCE_DROPDOWN_SLOPE_BUTTON);
|
||||
// Wall slope dropdown
|
||||
widget_set_enabled(w, WIDX_WALL_DROPDOWN_SLOPE, canBeSloped);
|
||||
widget_invalidate(w, WIDX_WALL_DROPDOWN_SLOPE);
|
||||
widget_set_enabled(w, WIDX_WALL_DROPDOWN_SLOPE_BUTTON, canBeSloped);
|
||||
widget_invalidate(w, WIDX_WALL_DROPDOWN_SLOPE_BUTTON);
|
||||
break;
|
||||
}
|
||||
} // switch page
|
||||
@@ -1539,18 +1539,18 @@ static void window_tile_inspector_invalidate(rct_window *w)
|
||||
w->widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE].top = GBBB(propertiesAnchor, 0) - 8;
|
||||
w->widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4;
|
||||
break;
|
||||
case TILE_INSPECTOR_PAGE_FENCE:
|
||||
w->widgets[WIDX_FENCE_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3;
|
||||
w->widgets[WIDX_FENCE_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3;
|
||||
w->widgets[WIDX_FENCE_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4;
|
||||
w->widgets[WIDX_FENCE_SPINNER_HEIGHT_INCREASE].bottom = GBBT(propertiesAnchor, 0) + 8;
|
||||
w->widgets[WIDX_FENCE_SPINNER_HEIGHT_DECREASE].top = GBBB(propertiesAnchor, 0) - 8;
|
||||
w->widgets[WIDX_FENCE_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4;
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE].top = GBBT(propertiesAnchor, 1) + 3;
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE].bottom = GBBB(propertiesAnchor, 1) - 3;
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE].text = FenceSlopeStringIds[(mapElement->type & 0xC0) >> 6];
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE_BUTTON].top = GBBT(propertiesAnchor, 1) + 4;
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE_BUTTON].bottom = GBBB(propertiesAnchor, 1) - 4;
|
||||
case TILE_INSPECTOR_PAGE_WALL:
|
||||
w->widgets[WIDX_WALL_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3;
|
||||
w->widgets[WIDX_WALL_SPINNER_HEIGHT].bottom = GBBB(propertiesAnchor, 0) - 3;
|
||||
w->widgets[WIDX_WALL_SPINNER_HEIGHT_INCREASE].top = GBBT(propertiesAnchor, 0) + 4;
|
||||
w->widgets[WIDX_WALL_SPINNER_HEIGHT_INCREASE].bottom = GBBT(propertiesAnchor, 0) + 8;
|
||||
w->widgets[WIDX_WALL_SPINNER_HEIGHT_DECREASE].top = GBBB(propertiesAnchor, 0) - 8;
|
||||
w->widgets[WIDX_WALL_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4;
|
||||
w->widgets[WIDX_WALL_DROPDOWN_SLOPE].top = GBBT(propertiesAnchor, 1) + 3;
|
||||
w->widgets[WIDX_WALL_DROPDOWN_SLOPE].bottom = GBBB(propertiesAnchor, 1) - 3;
|
||||
w->widgets[WIDX_WALL_DROPDOWN_SLOPE].text = WallSlopeStringIds[(mapElement->type & 0xC0) >> 6];
|
||||
w->widgets[WIDX_WALL_DROPDOWN_SLOPE_BUTTON].top = GBBT(propertiesAnchor, 1) + 4;
|
||||
w->widgets[WIDX_WALL_DROPDOWN_SLOPE_BUTTON].bottom = GBBB(propertiesAnchor, 1) - 4;
|
||||
break;
|
||||
case TILE_INSPECTOR_PAGE_LARGE_SCENERY:
|
||||
w->widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3;
|
||||
@@ -1831,16 +1831,16 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
break;
|
||||
}
|
||||
|
||||
case TILE_INSPECTOR_PAGE_FENCE: {
|
||||
case TILE_INSPECTOR_PAGE_WALL: {
|
||||
// Details
|
||||
// Type
|
||||
sint16 fenceType = mapElement->properties.fence.type;
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_FENCE_TYPE, &fenceType, COLOUR_DARK_GREEN, x, y);
|
||||
sint16 wallType = mapElement->properties.wall.type;
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_WALL_TYPE, &wallType, COLOUR_DARK_GREEN, x, y);
|
||||
|
||||
// Banner info
|
||||
rct_wall_scenery_entry fenceEntry = get_wall_entry(fenceType)->wall;
|
||||
if (fenceEntry.flags & WALL_SCENERY_IS_BANNER) {
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, &gBanners[mapElement->properties.fence.item[0]].string_idx, COLOUR_DARK_GREEN, x, y + 11);
|
||||
rct_wall_scenery_entry wallEntry = get_wall_entry(wallType)->wall;
|
||||
if (wallEntry.flags & WALL_SCENERY_IS_BANNER) {
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, &gBanners[mapElement->properties.wall.banner_index].string_idx, COLOUR_DARK_GREEN, x, y + 11);
|
||||
}
|
||||
else {
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE, NULL, COLOUR_DARK_GREEN, x, y + 11);
|
||||
@@ -1848,18 +1848,18 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
|
||||
// Properties
|
||||
// Raise / lower label
|
||||
y = w->y + w->widgets[WIDX_FENCE_SPINNER_HEIGHT].top;
|
||||
y = w->y + w->widgets[WIDX_WALL_SPINNER_HEIGHT].top;
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_FULL, NULL, COLOUR_DARK_GREEN, x, y);
|
||||
|
||||
// Current base height
|
||||
x = w->x + w->widgets[WIDX_FENCE_SPINNER_HEIGHT].left + 3;
|
||||
x = w->x + w->widgets[WIDX_WALL_SPINNER_HEIGHT].left + 3;
|
||||
sint32 baseHeight = mapElement->base_height;
|
||||
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &baseHeight, COLOUR_DARK_GREEN, x, y);
|
||||
|
||||
// Slope label
|
||||
x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7;
|
||||
y = w->y + w->widgets[WIDX_FENCE_DROPDOWN_SLOPE].top;
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_FENCE_SLOPE, NULL, COLOUR_DARK_GREEN, x, y);
|
||||
y = w->y + w->widgets[WIDX_WALL_DROPDOWN_SLOPE].top;
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_WALL_SLOPE, NULL, COLOUR_DARK_GREEN, x, y);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1994,10 +1994,10 @@ static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *
|
||||
case MAP_ELEMENT_TYPE_ENTRANCE:
|
||||
typeName = "Entrance";
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
snprintf(
|
||||
buffer, sizeof(buffer),
|
||||
"Fence (%s)",
|
||||
"Wall (%s)",
|
||||
language_get_string(get_wall_entry(mapElement->properties.scenery.type)->name)
|
||||
);
|
||||
typeName = buffer;
|
||||
|
||||
@@ -27,7 +27,7 @@ typedef enum tile_inspector_page
|
||||
TILE_INSPECTOR_PAGE_TRACK,
|
||||
TILE_INSPECTOR_PAGE_SCENERY,
|
||||
TILE_INSPECTOR_PAGE_ENTRANCE,
|
||||
TILE_INSPECTOR_PAGE_FENCE,
|
||||
TILE_INSPECTOR_PAGE_WALL,
|
||||
TILE_INSPECTOR_PAGE_LARGE_SCENERY,
|
||||
TILE_INSPECTOR_PAGE_BANNER,
|
||||
TILE_INSPECTOR_PAGE_CORRUPT
|
||||
|
||||
@@ -935,7 +935,7 @@ static void repaint_scenery_tool_down(sint16 x, sint16 y, sint16 widgetIndex){
|
||||
}
|
||||
case VIEWPORT_INTERACTION_ITEM_WALL:
|
||||
{
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.fence.type);
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.wall.type);
|
||||
|
||||
// If can't repaint
|
||||
if (!(scenery_entry->wall.flags &
|
||||
@@ -949,7 +949,7 @@ static void repaint_scenery_tool_down(sint16 x, sint16 y, sint16 widgetIndex){
|
||||
1 | (gWindowSceneryPrimaryColour << 8),
|
||||
grid_y,
|
||||
(map_element->type & MAP_ELEMENT_DIRECTION_MASK) | (map_element->base_height << 8),
|
||||
GAME_COMMAND_SET_FENCE_COLOUR,
|
||||
GAME_COMMAND_SET_WALL_COLOUR,
|
||||
0,
|
||||
gWindowScenerySecondaryColour | (gWindowSceneryTertiaryColour << 8));
|
||||
break;
|
||||
@@ -1573,7 +1573,7 @@ static void window_top_toolbar_scenery_tool_down(sint16 x, sint16 y, rct_window
|
||||
|
||||
gDisableErrorWindowSound = true;
|
||||
gGameCommandErrorTitle = STR_CANT_BUILD_PARK_ENTRANCE_HERE;
|
||||
sint32 cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_FENCE, gSceneryPlaceZ, _unkF64F15);
|
||||
sint32 cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_WALL, gSceneryPlaceZ, _unkF64F15);
|
||||
gDisableErrorWindowSound = false;
|
||||
|
||||
if (cost != MONEY32_UNDEFINED){
|
||||
@@ -2182,7 +2182,7 @@ static money32 try_place_ghost_scenery(rct_xy16 map_tile, uint32 parameter_1, ui
|
||||
parameter_1 | 0x69,
|
||||
map_tile.y,
|
||||
parameter_2,
|
||||
GAME_COMMAND_PLACE_FENCE,
|
||||
GAME_COMMAND_PLACE_WALL,
|
||||
gSceneryPlaceZ,
|
||||
_unkF64F15);
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ assert_struct_size(rct_banner, 8);
|
||||
enum{
|
||||
BANNER_FLAG_NO_ENTRY = (1 << 0),
|
||||
BANNER_FLAG_IS_LARGE_SCENERY = (1 << 1),
|
||||
BANNER_FLAG_LINKED_TO_RIDE = (1 << 2)
|
||||
BANNER_FLAG_LINKED_TO_RIDE = (1 << 2),
|
||||
BANNER_FLAG_4 = (1 << 3)
|
||||
};
|
||||
|
||||
extern rct_banner gBanners[MAX_BANNERS];
|
||||
|
||||
@@ -153,8 +153,8 @@ static void loc_6A6620(sint32 flags, sint32 x, sint32 y, rct_map_element *mapEle
|
||||
if ((mapElement->properties.path.type & 4) && !(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
sint32 direction = mapElement->properties.path.type & 3;
|
||||
sint32 z = mapElement->base_height;
|
||||
map_remove_intersecting_walls(x, y, z, z + 6, direction ^ 2);
|
||||
map_remove_intersecting_walls(x, y, z, z + 6, direction);
|
||||
wall_remove_intersecting_walls(x, y, z, z + 6, direction ^ 2);
|
||||
wall_remove_intersecting_walls(x, y, z, z + 6, direction);
|
||||
mapElement = map_get_footpath_element(x / 32, y / 32, z);
|
||||
}
|
||||
|
||||
@@ -852,7 +852,7 @@ bool fence_in_the_way(sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 direction
|
||||
if (mapElement == NULL)
|
||||
return false;
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE)
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
if (mapElement->flags & MAP_ELEMENT_FLAG_GHOST)
|
||||
continue;
|
||||
|
||||
+48
-715
@@ -128,13 +128,10 @@ rct_xyz16 gCommandPosition;
|
||||
|
||||
uint8 gUnk9E2E28;
|
||||
|
||||
static uint8 _unk141F725;
|
||||
|
||||
static void map_update_grass_length(sint32 x, sint32 y, rct_map_element *mapElement);
|
||||
static void map_set_grass_length(sint32 x, sint32 y, rct_map_element *mapElement, sint32 length);
|
||||
static void clear_elements_at(sint32 x, sint32 y);
|
||||
static void translate_3d_to_2d(sint32 rotation, sint32 *x, sint32 *y);
|
||||
static void map_obstruction_set_error_text(rct_map_element *mapElement);
|
||||
|
||||
void rotate_map_coordinates(sint16 *x, sint16 *y, sint32 rotation)
|
||||
{
|
||||
@@ -1201,65 +1198,6 @@ void game_command_set_scenery_colour(sint32* eax, sint32* ebx, sint32* ecx, sint
|
||||
*ebx = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E56B5
|
||||
*/
|
||||
void game_command_set_fence_colour(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp)
|
||||
{
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
sint32 x = *eax;
|
||||
sint32 y = *ecx;
|
||||
uint8 map_element_direction = *edx;
|
||||
uint8 base_height = *edx >> 8;
|
||||
uint8 colour1 = *ebx >> 8;
|
||||
uint8 colour2 = *ebp;
|
||||
uint8 colour3 = *ebp >> 8;
|
||||
uint8 flags = *ebx & 0xFF;
|
||||
sint32 z = base_height * 8;
|
||||
|
||||
gCommandPosition.x = x + 16;
|
||||
gCommandPosition.y = y + 16;
|
||||
gCommandPosition.z = z;
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) &&
|
||||
!map_is_location_in_park(x, y) &&
|
||||
!gCheatsSandboxMode) {
|
||||
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
rct_map_element* map_element = map_get_fence_element_at(x, y, base_height, map_element_direction);
|
||||
|
||||
if (map_element == NULL) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((flags & GAME_COMMAND_FLAG_GHOST) && !(map_element->flags & MAP_ELEMENT_FLAG_GHOST)) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if(flags & GAME_COMMAND_FLAG_APPLY){
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.fence.type);
|
||||
map_element->properties.fence.item[1] &= 0xE0;
|
||||
map_element->properties.fence.item[1] |= colour1;
|
||||
map_element->properties.fence.item[1] &= 0x1F;
|
||||
map_element->flags &= 0x9F;
|
||||
map_element->properties.fence.item[1] |= (colour2 & 0x7) * 32;
|
||||
map_element->flags |= (colour2 & 0x18) * 4;
|
||||
|
||||
if(scenery_entry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR){
|
||||
map_element->properties.fence.item[0] = colour3;
|
||||
}
|
||||
map_invalidate_tile_zoom1(x, y, z, z + 72);
|
||||
}
|
||||
|
||||
*ebx = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B909A
|
||||
@@ -1453,14 +1391,14 @@ restart_from_beginning:
|
||||
goto restart_from_beginning;
|
||||
|
||||
} break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
if (clear & (1 << 0)) {
|
||||
sint32 eax = x * 32;
|
||||
sint32 ebx = flags;
|
||||
sint32 ecx = y * 32;
|
||||
sint32 edx = (mapElement->base_height << 8) | (mapElement->type & MAP_ELEMENT_DIRECTION_MASK);
|
||||
sint32 edi = 0, ebp = 0;
|
||||
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_FENCE, edi, ebp);
|
||||
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_WALL, edi, ebp);
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
@@ -1804,7 +1742,7 @@ static money32 map_set_land_height(sint32 flags, sint32 x, sint32 y, sint32 heig
|
||||
{
|
||||
footpath_remove_litter(x, y, map_element_height(x, y));
|
||||
if(!gCheatsDisableClearanceChecks)
|
||||
map_remove_walls_at(x, y, height * 8 - 16, height * 8 + 32);
|
||||
wall_remove_at(x, y, height * 8 - 16, height * 8 + 32);
|
||||
}
|
||||
cost += MONEY(20, 0);
|
||||
|
||||
@@ -1895,7 +1833,7 @@ static money32 map_set_land_height(sint32 flags, sint32 x, sint32 y, sint32 heig
|
||||
do {
|
||||
sint32 elementType = map_element_get_type(mapElement);
|
||||
|
||||
if (elementType == MAP_ELEMENT_TYPE_FENCE)
|
||||
if (elementType == MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
if (elementType == MAP_ELEMENT_TYPE_SCENERY)
|
||||
continue;
|
||||
@@ -2765,7 +2703,7 @@ void game_command_set_water_height(sint32* eax, sint32* ebx, sint32* ecx, sint32
|
||||
sint32 element_height = map_element_height(x, y);
|
||||
footpath_remove_litter(x, y, element_height);
|
||||
if(!gCheatsDisableClearanceChecks)
|
||||
map_remove_walls_at_z(x, y, element_height);
|
||||
wall_remove_at_z(x, y, element_height);
|
||||
}
|
||||
|
||||
rct_map_element* map_element = map_get_surface_element_at(x / 32, y / 32);
|
||||
@@ -2803,68 +2741,6 @@ void game_command_set_water_height(sint32* eax, sint32* ebx, sint32* ecx, sint32
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E5597
|
||||
*/
|
||||
void game_command_remove_fence(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp)
|
||||
{
|
||||
sint32 x = *eax;
|
||||
sint32 y = *ecx;
|
||||
if (!map_is_location_valid(x, y)) {
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
uint8 base_height = (*edx >> 8);
|
||||
uint8 direction = *edx;
|
||||
uint8 flags = *ebx & 0xFF;
|
||||
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
if(!(flags & GAME_COMMAND_FLAG_GHOST) && game_is_paused() && !gCheatsBuildInPauseMode){
|
||||
gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
if(!(flags & GAME_COMMAND_FLAG_GHOST) && !(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && !map_is_location_owned(x, y, base_height * 8)){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
bool sceneryFound = false;
|
||||
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_FENCE)
|
||||
continue;
|
||||
if (map_element->base_height != base_height)
|
||||
continue;
|
||||
if ((map_element->type & MAP_ELEMENT_DIRECTION_MASK) != direction)
|
||||
continue;
|
||||
if ((flags & GAME_COMMAND_FLAG_GHOST) && !(map_element->flags & MAP_ELEMENT_FLAG_GHOST))
|
||||
continue;
|
||||
|
||||
sceneryFound = true;
|
||||
break;
|
||||
} while (!map_element_is_last_for_tile(map_element++));
|
||||
|
||||
if (!(*ebx & GAME_COMMAND_FLAG_APPLY) || (sceneryFound == false)) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gGameCommandNestLevel == 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);
|
||||
}
|
||||
|
||||
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);
|
||||
*ebx = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B9E6D
|
||||
@@ -3147,7 +3023,7 @@ void game_command_place_scenery(sint32* eax, sint32* ebx, sint32* ecx, sint32* e
|
||||
if(flags & GAME_COMMAND_FLAG_APPLY && !(flags & GAME_COMMAND_FLAG_GHOST)){
|
||||
footpath_remove_litter(x, y, targetHeight);
|
||||
if(!gCheatsDisableClearanceChecks && (scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_ALLOW_WALLS)) {
|
||||
map_remove_walls_at(x, y, targetHeight, targetHeight + scenery_entry->small_scenery.height);
|
||||
wall_remove_at(x, y, targetHeight, targetHeight + scenery_entry->small_scenery.height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3237,7 +3113,7 @@ void game_command_place_scenery(sint32* eax, sint32* ebx, sint32* ecx, sint32* e
|
||||
return;
|
||||
}
|
||||
|
||||
gSceneryGroundFlags = gMapGroundFlags & (ELEMENT_IS_1 | ELEMENT_IS_UNDERGROUND);
|
||||
gSceneryGroundFlags = gMapGroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
|
||||
|
||||
*ebx = (scenery_entry->small_scenery.price * 10) + clearCost;
|
||||
if(gParkFlags & PARK_FLAGS_NO_MONEY){
|
||||
@@ -3283,488 +3159,11 @@ void game_command_place_scenery(sint32* eax, sint32* ebx, sint32* ecx, sint32* e
|
||||
}
|
||||
}
|
||||
|
||||
static bool map_is_location_at_edge(sint32 x, sint32 y)
|
||||
bool map_is_location_at_edge(sint32 x, sint32 y)
|
||||
{
|
||||
return x < 32 || y < 32 || x >= ((256 - 1) * 32) || y >= ((256 - 1) * 32);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E5CBA
|
||||
*/
|
||||
static bool map_place_fence_check_obstruction_with_track(rct_scenery_entry *wall, sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 edge, rct_map_element *trackElement)
|
||||
{
|
||||
const rct_preview_track *trackBlock;
|
||||
sint32 z, direction;
|
||||
|
||||
sint32 trackType = trackElement->properties.track.type;
|
||||
sint32 sequence = trackElement->properties.track.sequence & 0x0F;
|
||||
direction = (edge - trackElement->type) & 3;
|
||||
rct_ride *ride = get_ride(trackElement->properties.track.ride_index);
|
||||
|
||||
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) {
|
||||
if (FlatRideTrackSequenceElementAllowedWallEdges[trackType][sequence] & (1 << direction)) {
|
||||
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_TRACK_NO_WALLS)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (TrackSequenceElementAllowedWallEdges[trackType][sequence] & (1 << direction)) {
|
||||
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_TRACK_NO_WALLS)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(wall->wall.flags & WALL_SCENERY_IS_DOOR)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(RideData4[ride->type].flags & RIDE_TYPE_FLAG4_0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rct_ride_entry *rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry->flags & RIDE_ENTRY_FLAG_16) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_unk141F725 |= 1;
|
||||
if (z0 & 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sequence == 0) {
|
||||
if (TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_DISALLOW_DOORS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TrackDefinitions[trackType].bank_start == 0) {
|
||||
if (!(TrackCoordinates[trackType].rotation_begin & 4)) {
|
||||
direction = (trackElement->type & 3) ^ 2;
|
||||
if (direction == edge) {
|
||||
trackBlock = &TrackBlocks[trackType][sequence];
|
||||
z = TrackCoordinates[trackType].z_begin;
|
||||
z = trackElement->base_height + ((z - trackBlock->z) * 8);
|
||||
if (z == z0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trackBlock = &TrackBlocks[trackType][sequence + 1];
|
||||
if (trackBlock->index != 0xFF) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TrackDefinitions[trackType].bank_end != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
direction = TrackCoordinates[trackType].rotation_end;
|
||||
if (direction & 4) {
|
||||
return false;
|
||||
}
|
||||
|
||||
direction = (trackElement->type + direction) & 3;
|
||||
if (direction != edge) {
|
||||
return false;
|
||||
}
|
||||
|
||||
trackBlock = &TrackBlocks[trackType][sequence];
|
||||
z = TrackCoordinates[trackType].z_end;
|
||||
z = trackElement->base_height + ((z - trackBlock->z) * 8);
|
||||
if (z != z0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E5C1A
|
||||
*/
|
||||
static bool map_place_fence_check_obstruction(rct_scenery_entry *wall, sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 edge)
|
||||
{
|
||||
sint32 entryType, sequence;
|
||||
rct_scenery_entry *entry;
|
||||
rct_large_scenery_tile *tile;
|
||||
|
||||
_unk141F725 = 0;
|
||||
gMapGroundFlags = ELEMENT_IS_1;
|
||||
if (map_is_location_at_edge(x, y)) {
|
||||
gGameCommandErrorText = STR_OFF_EDGE_OF_MAP;
|
||||
return false;
|
||||
}
|
||||
|
||||
rct_map_element *mapElement = map_get_first_element_at(x / 32, y / 32);
|
||||
do {
|
||||
sint32 elementType = map_element_get_type(mapElement);
|
||||
if (elementType == MAP_ELEMENT_TYPE_SURFACE) continue;
|
||||
if (z0 >= mapElement->clearance_height) continue;
|
||||
if (z1 <= mapElement->base_height) continue;
|
||||
if (elementType == MAP_ELEMENT_TYPE_FENCE) {
|
||||
sint32 direction = mapElement->type & 3;
|
||||
if (edge == direction) {
|
||||
map_obstruction_set_error_text(mapElement);
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ((mapElement->flags & 0x0F) == 0) continue;
|
||||
|
||||
switch (elementType) {
|
||||
case MAP_ELEMENT_TYPE_ENTRANCE:
|
||||
map_obstruction_set_error_text(mapElement);
|
||||
return false;
|
||||
case MAP_ELEMENT_TYPE_PATH:
|
||||
if (mapElement->properties.path.edges & (1 << edge)) {
|
||||
map_obstruction_set_error_text(mapElement);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
||||
entryType = mapElement->properties.scenerymultiple.type & 0x3FF;
|
||||
sequence = mapElement->properties.scenerymultiple.type >> 10;
|
||||
entry = get_large_scenery_entry(entryType);
|
||||
tile = &entry->large_scenery.tiles[sequence];
|
||||
|
||||
sint32 direction = ((edge - mapElement->type) & 3) + 8;
|
||||
if (!(tile->var_7 & (1 << direction))) {
|
||||
map_obstruction_set_error_text(mapElement);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY:
|
||||
entryType = mapElement->properties.scenery.type;
|
||||
entry = get_small_scenery_entry(entryType);
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_ALLOW_WALLS) {
|
||||
map_obstruction_set_error_text(mapElement);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_TRACK:
|
||||
if (!map_place_fence_check_obstruction_with_track(wall, x, y, z0, z1, edge, mapElement)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
return true;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
EDGE_SLOPE_ELEVATED = (1 << 0), // 0x01
|
||||
EDGE_SLOPE_UPWARDS = (1 << 6), // 0x40
|
||||
EDGE_SLOPE_DOWNWARDS = (1 << 7), // 0x80
|
||||
|
||||
EDGE_SLOPE_UPWARDS_ELEVATED = EDGE_SLOPE_UPWARDS | EDGE_SLOPE_ELEVATED,
|
||||
EDGE_SLOPE_DOWNWARDS_ELEVATED = EDGE_SLOPE_DOWNWARDS | EDGE_SLOPE_ELEVATED,
|
||||
};
|
||||
|
||||
/** rct2: 0x009A3FEC */
|
||||
static const uint8 EdgeSlopes[][4] = {
|
||||
// Top right Bottom right Bottom left Top left
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS, 0 },
|
||||
{ 0, 0, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS },
|
||||
{ 0, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS },
|
||||
{ EDGE_SLOPE_DOWNWARDS, 0, 0, EDGE_SLOPE_UPWARDS },
|
||||
{ EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS },
|
||||
{ EDGE_SLOPE_DOWNWARDS, 0, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED },
|
||||
{ EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED },
|
||||
{ EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS, 0, 0 },
|
||||
{ EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS, 0 },
|
||||
{ EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS },
|
||||
{ EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS },
|
||||
{ EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS, 0, EDGE_SLOPE_UPWARDS },
|
||||
{ EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS },
|
||||
{ EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED },
|
||||
{ EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_UPWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS_ELEVATED },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ EDGE_SLOPE_UPWARDS, EDGE_SLOPE_UPWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ EDGE_SLOPE_UPWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS },
|
||||
{ EDGE_SLOPE_DOWNWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_UPWARDS_ELEVATED },
|
||||
{ 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E519A
|
||||
*/
|
||||
void game_command_place_fence(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp){
|
||||
rct_xyz16 position = {
|
||||
.x = *eax & 0xFFFF,
|
||||
.y = *ecx & 0xFFFF,
|
||||
.z = *edi & 0xFFFF
|
||||
};
|
||||
|
||||
uint8 flags = *ebx & 0xFF;
|
||||
uint8 fence_type = (*ebx >> 8) & 0xFF;
|
||||
uint8 primary_colour = (*edx >> 8) & 0xFF;
|
||||
uint8 secondary_colour = *ebp & 0xFF;
|
||||
uint8 tertiary_colour = (*ebp >> 8) & 0xFF;
|
||||
uint8 edge = *edx & 0xFF;
|
||||
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
gCommandPosition.x = position.x + 16;
|
||||
gCommandPosition.y = position.y + 16;
|
||||
gCommandPosition.z = position.z;
|
||||
|
||||
if (position.z == 0){
|
||||
gCommandPosition.z = map_element_height(position.x, position.y) & 0xFFFF;
|
||||
}
|
||||
|
||||
if (game_is_paused() && !gCheatsBuildInPauseMode){
|
||||
gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) &&
|
||||
!(flags & GAME_COMMAND_FLAG_7) && !gCheatsSandboxMode){
|
||||
|
||||
if (position.z == 0){
|
||||
if (!map_is_location_in_park(position.x, position.y)){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!map_is_location_owned(position.x, position.y, position.z)){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
uint8 bp = 0;
|
||||
if (position.z == 0){
|
||||
rct_map_element* map_element = map_get_surface_element_at(position.x / 32, position.y / 32);
|
||||
if (map_element == NULL){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
position.z = map_element->base_height * 8;
|
||||
|
||||
uint8 slope = map_element->properties.surface.slope & MAP_ELEMENT_SLOPE_MASK;
|
||||
bp = EdgeSlopes[slope][edge & 3];
|
||||
if (bp & EDGE_SLOPE_ELEVATED) {
|
||||
position.z += 16;
|
||||
bp &= ~(1 << 0);
|
||||
}
|
||||
}
|
||||
|
||||
rct_map_element* map_element = map_get_surface_element_at(position.x / 32, position.y / 32);
|
||||
if (map_element == NULL){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (map_element->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK){
|
||||
uint16 water_height = map_element->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK;
|
||||
water_height *= 16;
|
||||
|
||||
if (position.z < water_height){
|
||||
gGameCommandErrorText = STR_CANT_BUILD_THIS_UNDERWATER;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (position.z / 8 < map_element->base_height){
|
||||
gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(bp & 0xC0)){
|
||||
uint8 new_edge = (edge + 2) & 3;
|
||||
uint8 new_base_height = map_element->base_height;
|
||||
new_base_height += 2;
|
||||
if (map_element->properties.surface.slope & (1 << new_edge)){
|
||||
if (position.z / 8 < new_base_height){
|
||||
gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (map_element->properties.surface.slope & (1 << 4)){
|
||||
new_edge = (new_edge - 1) & 3;
|
||||
|
||||
if (map_element->properties.surface.slope & (1 << new_edge)){
|
||||
new_edge = (new_edge + 2) & 3;
|
||||
if (map_element->properties.surface.slope & (1 << new_edge)){
|
||||
new_base_height += 2;
|
||||
if (position.z / 8 < new_base_height){
|
||||
gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
new_base_height -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new_edge = (edge + 3) & 3;
|
||||
if (map_element->properties.surface.slope & (1 << new_edge)){
|
||||
if (position.z / 8 < new_base_height){
|
||||
gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (map_element->properties.surface.slope & (1 << 4)){
|
||||
new_edge = (new_edge - 1) & 3;
|
||||
|
||||
if (map_element->properties.surface.slope & (1 << new_edge)){
|
||||
new_edge = (new_edge + 2) & 3;
|
||||
if (map_element->properties.surface.slope & (1 << new_edge)){
|
||||
new_base_height += 2;
|
||||
if (position.z / 8 < new_base_height){
|
||||
gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sint32 banner_index = 0xFF;
|
||||
rct_scenery_entry* fence = get_wall_entry(fence_type);
|
||||
// Have to check both -1 and NULL, as one can be a invalid object,
|
||||
// while the other can be invalid index
|
||||
if ((uintptr_t)fence == (uintptr_t)-1 || fence == NULL) {
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
if (fence->wall.scrolling_mode != 0xFF){
|
||||
banner_index = create_new_banner(flags);
|
||||
|
||||
if (banner_index == 0xFF){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
rct_banner* banner = &gBanners[banner_index];
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY){
|
||||
banner->flags |= (1 << 3);
|
||||
banner->type = 0;
|
||||
banner->x = position.x / 32;
|
||||
banner->y = position.y / 32;
|
||||
|
||||
sint32 rideIndex = banner_get_closest_ride_index(position.x, position.y, position.z);
|
||||
if (rideIndex != -1) {
|
||||
banner->colour = rideIndex & 0xFF;
|
||||
banner->flags |= BANNER_FLAG_LINKED_TO_RIDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8 clearanceHeight = position.z / 8;
|
||||
if (bp & (EDGE_SLOPE_UPWARDS | EDGE_SLOPE_DOWNWARDS)) {
|
||||
if (fence->wall.flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE){
|
||||
gGameCommandErrorText = STR_ERR_UNABLE_TO_BUILD_THIS_ON_SLOPE;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
clearanceHeight += 2;
|
||||
}
|
||||
clearanceHeight += fence->wall.height;
|
||||
|
||||
if (!(flags & GAME_COMMAND_FLAG_7) && !gCheatsDisableClearanceChecks){
|
||||
if (!map_place_fence_check_obstruction(fence, position.x, position.y, position.z / 8, clearanceHeight, edge)) {
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!map_check_free_elements_and_reorganise(1)){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY){
|
||||
if (gGameCommandNestLevel == 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);
|
||||
assert(map_element != NULL);
|
||||
|
||||
map_animation_create(MAP_ANIMATION_TYPE_WALL, position.x, position.y, position.z / 8);
|
||||
|
||||
map_element->clearance_height = clearanceHeight;
|
||||
|
||||
map_element->type = bp | edge | MAP_ELEMENT_TYPE_FENCE;
|
||||
|
||||
map_element->properties.fence.item[1] = primary_colour;
|
||||
map_element->properties.fence.item[1] |= (secondary_colour & 7) << 5;
|
||||
map_element->flags |= (secondary_colour & 0x18) << 2;
|
||||
|
||||
if (_unk141F725 & 1) {
|
||||
map_element->properties.fence.item[2] |= (1 << 2);
|
||||
}
|
||||
|
||||
map_element->properties.fence.type = fence_type;
|
||||
if (banner_index != 0xFF){
|
||||
map_element->properties.fence.item[0] = banner_index;
|
||||
}
|
||||
|
||||
if (fence->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR){
|
||||
map_element->properties.fence.item[0] = tertiary_colour;
|
||||
}
|
||||
|
||||
if (flags & (1 << 6)){
|
||||
map_element->flags |= MAP_ELEMENT_FLAG_GHOST;
|
||||
}
|
||||
|
||||
gSceneryMapElement = map_element;
|
||||
map_invalidate_tile_zoom1(position.x, position.y, map_element->base_height * 8, map_element->base_height * 8 + 72);
|
||||
}
|
||||
|
||||
if (gParkFlags & PARK_FLAGS_NO_MONEY){
|
||||
*ebx = 0;
|
||||
}
|
||||
else{
|
||||
*ebx = fence->wall.price;
|
||||
}
|
||||
}
|
||||
|
||||
money32 map_place_fence(
|
||||
sint32 type, sint32 x, sint32 y, sint32 z, sint32 edge, sint32 primaryColour, sint32 secondaryColour, sint32 tertiaryColour, sint32 flags
|
||||
) {
|
||||
sint32 eax, ebx, ecx, edx, esi, edi, ebp;
|
||||
|
||||
eax = x;
|
||||
ebx = flags | (type << 8);
|
||||
ecx = y;
|
||||
edx = edge | (primaryColour << 8);
|
||||
edi = z;
|
||||
ebp = secondaryColour | (tertiaryColour << 8);
|
||||
game_command_place_fence(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
return ebx;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B893C
|
||||
@@ -3915,7 +3314,7 @@ void game_command_place_large_scenery(sint32* eax, sint32* ebx, sint32* ecx, sin
|
||||
return;
|
||||
}
|
||||
|
||||
sint32 b = gMapGroundFlags & (ELEMENT_IS_1 | ELEMENT_IS_UNDERGROUND);
|
||||
sint32 b = gMapGroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
|
||||
if (!gCheatsDisableClearanceChecks) {
|
||||
if (gSceneryGroundFlags && !(gSceneryGroundFlags & b)) {
|
||||
gGameCommandErrorText = STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND;
|
||||
@@ -3942,7 +3341,7 @@ void game_command_place_large_scenery(sint32* eax, sint32* ebx, sint32* ecx, sin
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
footpath_remove_litter(curTile.x, curTile.y, zLow * 8);
|
||||
if (!gCheatsDisableClearanceChecks) {
|
||||
map_remove_walls_at(curTile.x, curTile.y, zLow * 8, zHigh * 8);
|
||||
wall_remove_at(curTile.x, curTile.y, zLow * 8, zHigh * 8);
|
||||
}
|
||||
}
|
||||
if (gGameCommandNestLevel == 1 && !(*ebx & GAME_COMMAND_FLAG_GHOST)) {
|
||||
@@ -4277,7 +3676,7 @@ bool map_element_check_address(const rct_map_element * const element)
|
||||
*
|
||||
* rct2: 0x0068BB18
|
||||
*/
|
||||
static void map_obstruction_set_error_text(rct_map_element *mapElement)
|
||||
void map_obstruction_set_error_text(rct_map_element *mapElement)
|
||||
{
|
||||
rct_string_id errorStringId;
|
||||
rct_ride *ride;
|
||||
@@ -4315,7 +3714,7 @@ static void map_obstruction_set_error_text(rct_map_element *mapElement)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
sceneryEntry = get_wall_entry(mapElement->properties.scenery.type);
|
||||
errorStringId = STR_X_IN_THE_WAY;
|
||||
set_format_arg(0, rct_string_id, sceneryEntry->name);
|
||||
@@ -4342,7 +3741,7 @@ static void map_obstruction_set_error_text(rct_map_element *mapElement)
|
||||
*/
|
||||
sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 zHigh, CLEAR_FUNC *clearFunc, uint8 bl, uint8 flags, money32 *price)
|
||||
{
|
||||
gMapGroundFlags = ELEMENT_IS_1;
|
||||
gMapGroundFlags = ELEMENT_IS_ABOVE_GROUND;
|
||||
if (x >= gMapSizeUnits || y >= gMapSizeUnits || x < 32 || y < 32) {
|
||||
gGameCommandErrorText = STR_OFF_EDGE_OF_MAP;
|
||||
return false;
|
||||
@@ -4378,7 +3777,7 @@ sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 z
|
||||
if (map_element->base_height >= zHigh) {
|
||||
// loc_68BA81
|
||||
gMapGroundFlags |= ELEMENT_IS_UNDERGROUND;
|
||||
gMapGroundFlags &= ~ELEMENT_IS_1;
|
||||
gMapGroundFlags &= ~ELEMENT_IS_ABOVE_GROUND;
|
||||
} else {
|
||||
sint32 al = map_element->base_height;
|
||||
sint32 ah = al;
|
||||
@@ -4447,32 +3846,6 @@ sint32 map_can_construct_at(sint32 x, sint32 y, sint32 zLow, sint32 zHigh, uint8
|
||||
return map_can_construct_with_clear_at(x, y, zLow, zHigh, NULL, bl, 0, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E5935
|
||||
*/
|
||||
void map_remove_intersecting_walls(sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 direction)
|
||||
{
|
||||
rct_map_element *mapElement;
|
||||
|
||||
mapElement = map_get_first_element_at(x >> 5, y >> 5);
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE)
|
||||
continue;
|
||||
|
||||
if (mapElement->clearance_height <= z0 || mapElement->base_height >= z1)
|
||||
continue;
|
||||
|
||||
if (direction != (mapElement->type & 3))
|
||||
continue;
|
||||
|
||||
map_element_remove_banner_entry(mapElement);
|
||||
map_invalidate_tile_zoom1(x, y, mapElement->base_height * 8, mapElement->base_height * 8 + 72);
|
||||
map_element_remove(mapElement);
|
||||
mapElement--;
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates grass length, scenery age and jumping fountains.
|
||||
*
|
||||
@@ -4562,7 +3935,7 @@ static void map_update_grass_length(sint32 x, sint32 y, rct_map_element *mapElem
|
||||
}
|
||||
} else {
|
||||
mapElementAbove++;
|
||||
if (map_element_get_type(mapElementAbove) == MAP_ELEMENT_TYPE_FENCE)
|
||||
if (map_element_get_type(mapElementAbove) == MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
if (z0 >= mapElementAbove->clearance_height)
|
||||
continue;
|
||||
@@ -4632,12 +4005,12 @@ sint32 map_element_get_banner_index(rct_map_element *mapElement)
|
||||
(mapElement->type & MAP_ELEMENT_QUADRANT_MASK) |
|
||||
((mapElement->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
|
||||
((mapElement->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
sceneryEntry = get_wall_entry(mapElement->properties.fence.type);
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
sceneryEntry = get_wall_entry(mapElement->properties.wall.type);
|
||||
if (sceneryEntry->wall.scrolling_mode == 0xFF)
|
||||
return -1;
|
||||
|
||||
return mapElement->properties.fence.item[0];
|
||||
return mapElement->properties.wall.banner_index;
|
||||
case MAP_ELEMENT_TYPE_BANNER:
|
||||
return mapElement->properties.banner.index;
|
||||
default:
|
||||
@@ -4781,14 +4154,14 @@ static void clear_element_at(sint32 x, sint32 y, rct_map_element **elementPtr)
|
||||
case MAP_ELEMENT_TYPE_ENTRANCE:
|
||||
viewport_interaction_remove_park_entrance(element, x, y);
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
||||
game_do_command(
|
||||
x,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
y,
|
||||
(element->type & MAP_ELEMENT_DIRECTION_MASK) | (element->base_height << 8),
|
||||
GAME_COMMAND_REMOVE_FENCE,
|
||||
GAME_COMMAND_REMOVE_WALL,
|
||||
0,
|
||||
0
|
||||
);
|
||||
@@ -4900,22 +4273,6 @@ rct_map_element *map_get_large_scenery_segment(sint32 x, sint32 y, sint32 z, sin
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rct_map_element *map_get_fence_element_at(sint32 x, sint32 y, sint32 z, sint32 direction)
|
||||
{
|
||||
rct_map_element *mapElement = map_get_first_element_at(x >> 5, y >> 5);
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE)
|
||||
continue;
|
||||
if (mapElement->base_height != z)
|
||||
continue;
|
||||
if (map_element_get_direction(mapElement) != direction)
|
||||
continue;
|
||||
|
||||
return mapElement;
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rct_map_element *map_get_park_entrance_element_at(sint32 x, sint32 y, sint32 z, bool ghost)
|
||||
{
|
||||
rct_map_element* mapElement = map_get_first_element_at(x >> 5, y >> 5);
|
||||
@@ -5026,42 +4383,6 @@ bool sign_set_colour(sint32 x, sint32 y, sint32 z, sint32 direction, sint32 sequ
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E588E
|
||||
*/
|
||||
void map_remove_walls_at(sint32 x, sint32 y, sint32 z0, sint32 z1)
|
||||
{
|
||||
rct_map_element *mapElement;
|
||||
|
||||
z0 /= 8;
|
||||
z1 /= 8;
|
||||
repeat:
|
||||
mapElement = map_get_first_element_at(x >> 5, y >> 5);
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE)
|
||||
continue;
|
||||
if (z0 >= mapElement->clearance_height)
|
||||
continue;
|
||||
if (z1 <= mapElement->base_height)
|
||||
continue;
|
||||
|
||||
map_element_remove_banner_entry(mapElement);
|
||||
map_invalidate_tile_zoom1(x, y, mapElement->base_height * 8, mapElement->base_height * 8 + 72);
|
||||
map_element_remove(mapElement);
|
||||
goto repeat;
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E57E6
|
||||
*/
|
||||
void map_remove_walls_at_z(sint32 x, sint32 y, sint32 z)
|
||||
{
|
||||
map_remove_walls_at(x, y, z, z + 48);
|
||||
}
|
||||
|
||||
static void translate_3d_to_2d(sint32 rotation, sint32 *x, sint32 *y)
|
||||
{
|
||||
sint32 rx, ry;
|
||||
@@ -5231,7 +4552,7 @@ bool map_surface_is_blocked(sint16 x, sint16 y){
|
||||
continue;
|
||||
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_PATH ||
|
||||
map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_FENCE)
|
||||
map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_SCENERY)
|
||||
@@ -5586,21 +4907,21 @@ void game_command_set_sign_style(sint32* eax, sint32* ebx, sint32* ecx, sint32*
|
||||
if (*ebp == 0) { // small sign
|
||||
|
||||
rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32);
|
||||
bool fence_found = false;
|
||||
bool wall_found = false;
|
||||
do{
|
||||
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_FENCE)
|
||||
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.fence.type);
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.wall.type);
|
||||
if (scenery_entry->wall.scrolling_mode == 0xFF)
|
||||
continue;
|
||||
if (map_element->properties.fence.item[0] != bannerId)
|
||||
if (map_element->properties.wall.banner_index != bannerId)
|
||||
continue;
|
||||
fence_found = true;
|
||||
wall_found = true;
|
||||
break;
|
||||
} while (!map_element_is_last_for_tile(map_element++));
|
||||
|
||||
if (fence_found == false) {
|
||||
if (wall_found == false) {
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
@@ -5609,13 +4930,9 @@ void game_command_set_sign_style(sint32* eax, sint32* ebx, sint32* ecx, sint32*
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
map_element->flags &= 0x9F;
|
||||
map_element->properties.fence.item[1] =
|
||||
mainColour |
|
||||
((textColour & 0x7) << 5);
|
||||
map_element->flags |= ((textColour & 0x18) << 2);
|
||||
|
||||
map_element->properties.wall.colour_1 = mainColour;
|
||||
wall_element_set_secondary_colour(map_element, textColour);
|
||||
|
||||
map_invalidate_tile(x, y, map_element->base_height * 8, map_element->clearance_height * 8);
|
||||
} else { // large sign
|
||||
rct_map_element *mapElement = banner_get_map_element(bannerId);
|
||||
@@ -5738,11 +5055,11 @@ void game_command_modify_tile(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx
|
||||
*ebx = tile_inspector_path_toggle_edge(x, y, elementIndex, edgeIndex, flags);
|
||||
break;
|
||||
}
|
||||
case TILE_INSPECTOR_FENCE_SET_SLOPE:
|
||||
case TILE_INSPECTOR_WALL_SET_SLOPE:
|
||||
{
|
||||
const sint32 elementIndex = *edx;
|
||||
const sint32 slopeValue = *edi;
|
||||
*ebx = tile_inspector_fence_set_slope(x, y, elementIndex, slopeValue, flags);
|
||||
*ebx = tile_inspector_wall_set_slope(x, y, elementIndex, slopeValue, flags);
|
||||
break;
|
||||
}
|
||||
case TILE_INSPECTOR_TRACK_BASE_HEIGHT_OFFSET:
|
||||
@@ -5956,3 +5273,19 @@ void map_offset_with_rotation(sint16 *x, sint16 *y, sint16 offsetX, sint16 offse
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rct_map_element *map_get_wall_element_at(sint32 x, sint32 y, sint32 z, sint32 direction)
|
||||
{
|
||||
rct_map_element *mapElement = map_get_first_element_at(x >> 5, y >> 5);
|
||||
do {
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
if (mapElement->base_height != z)
|
||||
continue;
|
||||
if (map_element_get_direction(mapElement) != direction)
|
||||
continue;
|
||||
|
||||
return mapElement;
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
return NULL;
|
||||
}
|
||||
+34
-15
@@ -68,11 +68,16 @@ typedef struct rct_map_element_entrance_properties {
|
||||
} rct_map_element_entrance_properties;
|
||||
assert_struct_size(rct_map_element_entrance_properties, 4);
|
||||
|
||||
typedef struct rct_map_element_fence_properties {
|
||||
typedef struct rct_map_element_wall_properties {
|
||||
uint8 type; //4
|
||||
uint8 item[3]; //5
|
||||
} rct_map_element_fence_properties;
|
||||
assert_struct_size(rct_map_element_fence_properties, 4);
|
||||
union {
|
||||
uint8 colour_3; //5
|
||||
uint8 banner_index; //5
|
||||
};
|
||||
uint8 colour_1; //6 0b_2221_1111 2 = colour_2 (uses flags for rest of colour2), 1 = colour_1
|
||||
uint8 animation; //7 0b_dfff_ft00 d = direction, f = frame num, t = across track flag (not used)
|
||||
} rct_map_element_wall_properties;
|
||||
assert_struct_size(rct_map_element_wall_properties, 4);
|
||||
|
||||
typedef struct rct_map_element_scenerymultiple_properties {
|
||||
uint16 type; //4
|
||||
@@ -94,7 +99,7 @@ typedef union {
|
||||
rct_map_element_track_properties track;
|
||||
rct_map_element_scenery_properties scenery;
|
||||
rct_map_element_entrance_properties entrance;
|
||||
rct_map_element_fence_properties fence;
|
||||
rct_map_element_wall_properties wall;
|
||||
rct_map_element_scenerymultiple_properties scenerymultiple;
|
||||
rct_map_element_banner_properties banner;
|
||||
} rct_map_element_properties;
|
||||
@@ -127,7 +132,7 @@ enum {
|
||||
MAP_ELEMENT_TYPE_TRACK = (2 << 2),
|
||||
MAP_ELEMENT_TYPE_SCENERY = (3 << 2),
|
||||
MAP_ELEMENT_TYPE_ENTRANCE = (4 << 2),
|
||||
MAP_ELEMENT_TYPE_FENCE = (5 << 2),
|
||||
MAP_ELEMENT_TYPE_WALL = (5 << 2),
|
||||
MAP_ELEMENT_TYPE_SCENERY_MULTIPLE = (6 << 2),
|
||||
MAP_ELEMENT_TYPE_BANNER = (7 << 2),
|
||||
// The corrupt element type is used for skipping drawing other following
|
||||
@@ -210,6 +215,13 @@ enum {
|
||||
PATH_FLAG_QUEUE_BANNER = 1 << 3
|
||||
};
|
||||
|
||||
enum {
|
||||
WALL_ANIMATION_FLAG_ACROSS_TRACK = (1 << 2),
|
||||
// 3 - 6 animation frame number
|
||||
WALL_ANIMATION_FLAG_DIRECTION_BACKWARD = (1 << 7),
|
||||
WALL_ANIMATION_FLAG_ALL_FLAGS = WALL_ANIMATION_FLAG_ACROSS_TRACK | WALL_ANIMATION_FLAG_DIRECTION_BACKWARD
|
||||
};
|
||||
|
||||
enum {
|
||||
ENTRANCE_TYPE_RIDE_ENTRANCE,
|
||||
ENTRANCE_TYPE_RIDE_EXIT,
|
||||
@@ -217,7 +229,7 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
ELEMENT_IS_1 = 1 << 0,
|
||||
ELEMENT_IS_ABOVE_GROUND = 1 << 0,
|
||||
ELEMENT_IS_UNDERGROUND = 1 << 1,
|
||||
ELEMENT_IS_UNDERWATER = 1 << 2,
|
||||
};
|
||||
@@ -413,7 +425,7 @@ sint32 map_height_from_slope(sint32 x, sint32 y, sint32 slope);
|
||||
rct_map_element* map_get_banner_element_at(sint32 x, sint32 y, sint32 z, uint8 direction);
|
||||
rct_map_element *map_get_surface_element_at(sint32 x, sint32 y);
|
||||
rct_map_element* map_get_path_element_at(sint32 x, sint32 y, sint32 z);
|
||||
rct_map_element *map_get_fence_element_at(sint32 x, sint32 y, sint32 z, sint32 direction);
|
||||
rct_map_element *map_get_wall_element_at(sint32 x, sint32 y, sint32 z, sint32 direction);
|
||||
rct_map_element *map_get_small_scenery_element_at(sint32 x, sint32 y, sint32 z, sint32 type, uint8 quadrant);
|
||||
rct_map_element *map_get_park_entrance_element_at(sint32 x, sint32 y, sint32 z, bool ghost);
|
||||
sint32 map_element_height(sint32 x, sint32 y);
|
||||
@@ -446,7 +458,7 @@ rct_xy16 coordinate_3d_to_2d(const rct_xyz16* coordinate_3d, sint32 rotation);
|
||||
money32 map_clear_scenery(sint32 x0, sint32 y0, sint32 x1, sint32 y1, sint32 clear, sint32 flags);
|
||||
money32 lower_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags);
|
||||
money32 raise_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags);
|
||||
money32 map_place_fence(sint32 type, sint32 x, sint32 y, sint32 z, sint32 edge, sint32 primaryColour, sint32 secondaryColour, sint32 tertiaryColour, sint32 flags);
|
||||
money32 wall_place(sint32 type, sint32 x, sint32 y, sint32 z, sint32 edge, sint32 primaryColour, sint32 secondaryColour, sint32 tertiaryColour, sint32 flags);
|
||||
|
||||
void game_command_set_land_height(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp);
|
||||
void game_command_set_land_ownership(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp);
|
||||
@@ -454,7 +466,7 @@ void game_command_remove_scenery(sint32* eax, sint32* ebx, sint32* ecx, sint32*
|
||||
void game_command_remove_large_scenery(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_remove_banner(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_set_scenery_colour(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_set_fence_colour(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_set_wall_colour(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_set_large_scenery_colour(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_set_banner_colour(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_clear_scenery(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
@@ -465,10 +477,10 @@ void game_command_smooth_land(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx
|
||||
void game_command_raise_water(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_lower_water(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_set_water_height(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_remove_fence(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_remove_wall(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_place_banner(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_place_scenery(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_place_fence(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_place_wall(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_place_large_scenery(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_place_park_entrance(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
void game_command_set_banner_name(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
@@ -490,7 +502,7 @@ void map_element_iterator_begin(map_element_iterator *it);
|
||||
sint32 map_element_iterator_next(map_element_iterator *it);
|
||||
void map_element_iterator_restart_for_tile(map_element_iterator *it);
|
||||
|
||||
void map_remove_intersecting_walls(sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 direction);
|
||||
void wall_remove_intersecting_walls(sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 direction);
|
||||
void map_update_tiles();
|
||||
sint32 map_get_highest_z(sint32 tileX, sint32 tileY);
|
||||
|
||||
@@ -503,8 +515,8 @@ void map_remove_out_of_range_elements();
|
||||
void map_extend_boundary_surface();
|
||||
|
||||
bool sign_set_colour(sint32 x, sint32 y, sint32 z, sint32 direction, sint32 sequence, uint8 mainColour, uint8 textColour);
|
||||
void map_remove_walls_at(sint32 x, sint32 y, sint32 z0, sint32 z1);
|
||||
void map_remove_walls_at_z(sint32 x, sint32 y, sint32 z);
|
||||
void wall_remove_at(sint32 x, sint32 y, sint32 z0, sint32 z1);
|
||||
void wall_remove_at_z(sint32 x, sint32 y, sint32 z);
|
||||
|
||||
void map_invalidate_tile(sint32 x, sint32 y, sint32 z0, sint32 z1);
|
||||
void map_invalidate_tile_zoom1(sint32 x, sint32 y, sint32 z0, sint32 z1);
|
||||
@@ -533,4 +545,11 @@ rct_map_element *map_get_track_element_at_of_type_from_ride(sint32 x, sint32 y,
|
||||
rct_map_element *map_get_track_element_at_from_ride(sint32 x, sint32 y, sint32 z, sint32 rideIndex);
|
||||
rct_map_element *map_get_track_element_at_with_direction_from_ride(sint32 x, sint32 y, sint32 z, sint32 direction, sint32 rideIndex);
|
||||
|
||||
bool map_is_location_at_edge(sint32 x, sint32 y);
|
||||
void map_obstruction_set_error_text(rct_map_element *mapElement);
|
||||
uint8 wall_element_get_animation_frame(rct_map_element *fenceElement);
|
||||
void wall_element_set_animation_frame(rct_map_element * wallElement, uint8 frameNum);
|
||||
uint8 wall_element_get_secondary_colour(rct_map_element * wallElement);
|
||||
void wall_element_set_secondary_colour(rct_map_element * wallElement, uint8 secondaryColour);
|
||||
|
||||
#endif
|
||||
@@ -456,50 +456,47 @@ static bool map_animation_invalidate_wall_door(sint32 x, sint32 y, sint32 baseZ)
|
||||
if (gCurrentTicks & 1)
|
||||
return false;
|
||||
|
||||
bool wasInvalidated = false;
|
||||
bool removeAnimation = true;
|
||||
mapElement = map_get_first_element_at(x >> 5, y >> 5);
|
||||
do {
|
||||
if (mapElement->base_height != baseZ)
|
||||
continue;
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE)
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
|
||||
sceneryEntry = get_wall_entry(mapElement->properties.scenery.type);
|
||||
if (!(sceneryEntry->wall.flags & WALL_SCENERY_IS_DOOR))
|
||||
continue;
|
||||
|
||||
uint8 di = 0;
|
||||
uint8 bl = mapElement->properties.fence.item[2];
|
||||
uint8 bh = bl & 0x78;
|
||||
if (bh != 0) {
|
||||
if (bh == 0x78) {
|
||||
bl &= 0x87;
|
||||
} else {
|
||||
di |= 2;
|
||||
if (bh != 40) {
|
||||
bh += 8;
|
||||
if (bh == 104 && !(sceneryEntry->wall.flags & WALL_SCENERY_FLAG6))
|
||||
bh = 120;
|
||||
|
||||
di |= 1;
|
||||
bl &= 135;
|
||||
bl |= bh;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (game_is_paused()) {
|
||||
return false;
|
||||
}
|
||||
mapElement->properties.fence.item[2] = bl;
|
||||
if (di & 1) {
|
||||
|
||||
bool invalidate = false;
|
||||
|
||||
uint8 currentFrame = wall_element_get_animation_frame(mapElement);
|
||||
if (currentFrame != 0) {
|
||||
if (currentFrame == 15) {
|
||||
currentFrame = 0;
|
||||
} else {
|
||||
removeAnimation = false;
|
||||
if (currentFrame != 5) {
|
||||
currentFrame++;
|
||||
if (currentFrame == 13 && !(sceneryEntry->wall.flags & WALL_SCENERY_FLAG6))
|
||||
currentFrame = 15;
|
||||
|
||||
invalidate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
wall_element_set_animation_frame(mapElement, currentFrame);
|
||||
if (invalidate) {
|
||||
sint32 z = mapElement->base_height * 8;
|
||||
map_invalidate_tile_zoom1(x, y, z, z + 32);
|
||||
}
|
||||
if (di & 2)
|
||||
wasInvalidated = true;
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
|
||||
return !wasInvalidated;
|
||||
return removeAnimation;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -516,7 +513,7 @@ static bool map_animation_invalidate_wall(sint32 x, sint32 y, sint32 baseZ)
|
||||
do {
|
||||
if (mapElement->base_height != baseZ)
|
||||
continue;
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_FENCE)
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
|
||||
sceneryEntry = get_wall_entry(mapElement->properties.scenery.type);
|
||||
|
||||
@@ -210,7 +210,7 @@ void scenery_remove_ghost_tool_placement(){
|
||||
105 | (gSceneryMapElementType << 8),
|
||||
y,
|
||||
gSceneryGhostWallRotation |(z << 8),
|
||||
GAME_COMMAND_REMOVE_FENCE,
|
||||
GAME_COMMAND_REMOVE_WALL,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ sint32 tile_inspector_rotate_element_at(sint32 x, sint32 y, sint32 elementIndex,
|
||||
case MAP_ELEMENT_TYPE_TRACK:
|
||||
case MAP_ELEMENT_TYPE_SCENERY:
|
||||
case MAP_ELEMENT_TYPE_ENTRANCE:
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
case MAP_ELEMENT_TYPE_WALL:
|
||||
newRotation = (mapElement->type + 1) & MAP_ELEMENT_DIRECTION_MASK;
|
||||
mapElement->type &= ~MAP_ELEMENT_DIRECTION_MASK;
|
||||
mapElement->type |= newRotation;
|
||||
@@ -549,11 +549,11 @@ sint32 tile_inspector_path_toggle_edge(sint32 x, sint32 y, sint32 elementIndex,
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 elementIndex, sint32 slopeValue, sint32 flags)
|
||||
sint32 tile_inspector_wall_set_slope(sint32 x, sint32 y, sint32 elementIndex, sint32 slopeValue, sint32 flags)
|
||||
{
|
||||
rct_map_element *const fenceElement = map_get_nth_element_at(x, y, elementIndex);
|
||||
rct_map_element *const wallElement = map_get_nth_element_at(x, y, elementIndex);
|
||||
|
||||
if (!fenceElement || map_element_get_type(fenceElement) != MAP_ELEMENT_TYPE_FENCE)
|
||||
if (!wallElement || map_element_get_type(wallElement) != MAP_ELEMENT_TYPE_WALL)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
@@ -561,8 +561,8 @@ sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 elementIndex, s
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
// Set new slope value
|
||||
fenceElement->type &= ~0xC0;
|
||||
fenceElement->type |= slopeValue;
|
||||
wallElement->type &= ~0xC0;
|
||||
wallElement->type |= slopeValue;
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef enum {
|
||||
TILE_INSPECTOR_ELEMENT_TRACK,
|
||||
TILE_INSPECTOR_ELEMENT_SCENERY,
|
||||
TILE_INSPECTOR_ELEMENT_ENTRANCE,
|
||||
TILE_INSPECTOR_ELEMENT_FENCE,
|
||||
TILE_INSPECTOR_ELEMENT_WALL,
|
||||
TILE_INSPECTOR_ELEMENT_SCENERYMULTIPLE,
|
||||
TILE_INSPECTOR_ELEMENT_BANNER,
|
||||
TILE_INSPECTOR_ELEMENT_CORRUPT,
|
||||
@@ -45,7 +45,7 @@ typedef enum {
|
||||
TILE_INSPECTOR_SURFACE_TOGGLE_DIAGONAL,
|
||||
TILE_INSPECTOR_PATH_SET_SLOPE,
|
||||
TILE_INSPECTOR_PATH_TOGGLE_EDGE,
|
||||
TILE_INSPECTOR_FENCE_SET_SLOPE,
|
||||
TILE_INSPECTOR_WALL_SET_SLOPE,
|
||||
TILE_INSPECTOR_TRACK_BASE_HEIGHT_OFFSET,
|
||||
TILE_INSPECTOR_TRACK_SET_CHAIN,
|
||||
TILE_INSPECTOR_SCENERY_SET_QUARTER_LOCATION,
|
||||
@@ -66,7 +66,7 @@ sint32 tile_inspector_surface_toggle_corner(sint32 x, sint32 y, sint32 cornerInd
|
||||
sint32 tile_inspector_surface_toggle_diagonal(sint32 x, sint32 y, sint32 flags);
|
||||
sint32 tile_inspector_path_set_sloped(sint32 x, sint32 y, sint32 elementIndex, bool sloped, sint32 flags);
|
||||
sint32 tile_inspector_path_toggle_edge(sint32 x, sint32 y, sint32 elementIndex, sint32 cornerIndex, sint32 flags);
|
||||
sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 elementIndex, sint32 slopeValue, sint32 flags);
|
||||
sint32 tile_inspector_wall_set_slope(sint32 x, sint32 y, sint32 elementIndex, sint32 slopeValue, sint32 flags);
|
||||
sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 elementIndex, sint8 offset, sint32 flags);
|
||||
sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 elementIndex, bool entireTrackBlock, bool setChain, sint32 flags);
|
||||
sint32 tile_inspector_scenery_set_quarter_location(sint32 x, sint32 y, sint32 elementIndex, sint32 quarterIndex, sint32 flags);
|
||||
|
||||
@@ -0,0 +1,879 @@
|
||||
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../common.h"
|
||||
#include "../network/network.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "map.h"
|
||||
#include "park.h"
|
||||
#include "scenery.h"
|
||||
#include "../cheats.h"
|
||||
#include "../game.h"
|
||||
#include "../ride/track.h"
|
||||
#include "../ride/track_data.h"
|
||||
#include "../localisation/string_ids.h"
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E5CBA
|
||||
*/
|
||||
static bool WallCheckObstructionWithTrack(rct_scenery_entry *wall,
|
||||
sint32 x,
|
||||
sint32 y,
|
||||
sint32 z0,
|
||||
sint32 z1,
|
||||
sint32 edge,
|
||||
rct_map_element * trackElement,
|
||||
bool * wallAcrossTrack)
|
||||
{
|
||||
const rct_preview_track *trackBlock;
|
||||
sint32 z, direction;
|
||||
|
||||
sint32 trackType = trackElement->properties.track.type;
|
||||
sint32 sequence = trackElement->properties.track.sequence & 0x0F;
|
||||
direction = (edge - trackElement->type) & 3;
|
||||
rct_ride * ride = get_ride(trackElement->properties.track.ride_index);
|
||||
|
||||
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE))
|
||||
{
|
||||
if (FlatRideTrackSequenceElementAllowedWallEdges[trackType][sequence] & (1 << direction))
|
||||
{
|
||||
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_TRACK_NO_WALLS))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TrackSequenceElementAllowedWallEdges[trackType][sequence] & (1 << direction))
|
||||
{
|
||||
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_TRACK_NO_WALLS))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(wall->wall.flags & WALL_SCENERY_IS_DOOR))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(RideData4[ride->type].flags & RIDE_TYPE_FLAG4_0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
rct_ride_entry * rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry->flags & RIDE_ENTRY_FLAG_16)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
*wallAcrossTrack = true;
|
||||
if (z0 & 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sequence == 0)
|
||||
{
|
||||
if (TrackSequenceProperties[trackType][0] & TRACK_SEQUENCE_FLAG_DISALLOW_DOORS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TrackDefinitions[trackType].bank_start == 0)
|
||||
{
|
||||
if (!(TrackCoordinates[trackType].rotation_begin & 4))
|
||||
{
|
||||
direction = (trackElement->type & 3) ^ 2;
|
||||
if (direction == edge)
|
||||
{
|
||||
trackBlock = &TrackBlocks[trackType][sequence];
|
||||
z = TrackCoordinates[trackType].z_begin;
|
||||
z = trackElement->base_height + ((z - trackBlock->z) * 8);
|
||||
if (z == z0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trackBlock = &TrackBlocks[trackType][sequence + 1];
|
||||
if (trackBlock->index != 0xFF)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TrackDefinitions[trackType].bank_end != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
direction = TrackCoordinates[trackType].rotation_end;
|
||||
if (direction & 4)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
direction = (trackElement->type + direction) & 3;
|
||||
if (direction != edge)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
trackBlock = &TrackBlocks[trackType][sequence];
|
||||
z = TrackCoordinates[trackType].z_end;
|
||||
z = trackElement->base_height + ((z - trackBlock->z) * 8);
|
||||
if (z != z0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E5C1A
|
||||
*/
|
||||
static bool WallCheckObstruction(rct_scenery_entry * wall,
|
||||
sint32 x,
|
||||
sint32 y,
|
||||
sint32 z0,
|
||||
sint32 z1,
|
||||
sint32 edge,
|
||||
bool * wallAcrossTrack)
|
||||
{
|
||||
sint32 entryType, sequence;
|
||||
rct_scenery_entry * entry;
|
||||
rct_large_scenery_tile * tile;
|
||||
|
||||
*wallAcrossTrack = false;
|
||||
gMapGroundFlags = ELEMENT_IS_ABOVE_GROUND;
|
||||
if (map_is_location_at_edge(x, y))
|
||||
{
|
||||
gGameCommandErrorText = STR_OFF_EDGE_OF_MAP;
|
||||
return false;
|
||||
}
|
||||
|
||||
rct_map_element * mapElement = map_get_first_element_at(x / 32, y / 32);
|
||||
do
|
||||
{
|
||||
sint32 elementType = map_element_get_type(mapElement);
|
||||
if (elementType == MAP_ELEMENT_TYPE_SURFACE) continue;
|
||||
if (z0 >= mapElement->clearance_height) continue;
|
||||
if (z1 <= mapElement->base_height) continue;
|
||||
if (elementType == MAP_ELEMENT_TYPE_WALL)
|
||||
{
|
||||
sint32 direction = mapElement->type & 3;
|
||||
if (edge == direction)
|
||||
{
|
||||
map_obstruction_set_error_text(mapElement);
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ((mapElement->flags & 0x0F) == 0) continue;
|
||||
|
||||
switch (elementType)
|
||||
{
|
||||
case MAP_ELEMENT_TYPE_ENTRANCE:
|
||||
map_obstruction_set_error_text(mapElement);
|
||||
return false;
|
||||
case MAP_ELEMENT_TYPE_PATH:
|
||||
if (mapElement->properties.path.edges & (1 << edge))
|
||||
{
|
||||
map_obstruction_set_error_text(mapElement);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
||||
entryType = mapElement->properties.scenerymultiple.type & 0x3FF;
|
||||
sequence = mapElement->properties.scenerymultiple.type >> 10;
|
||||
entry = get_large_scenery_entry(entryType);
|
||||
tile = &entry->large_scenery.tiles[sequence];
|
||||
{
|
||||
sint32 direction = ((edge - mapElement->type) & 3) + 8;
|
||||
if (!(tile->var_7 & (1 << direction)))
|
||||
{
|
||||
map_obstruction_set_error_text(mapElement);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY:
|
||||
entryType = mapElement->properties.scenery.type;
|
||||
entry = get_small_scenery_entry(entryType);
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_ALLOW_WALLS)
|
||||
{
|
||||
map_obstruction_set_error_text(mapElement);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_TRACK:
|
||||
if (!WallCheckObstructionWithTrack(wall, x, y, z0, z1, edge, mapElement, wallAcrossTrack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (!map_element_is_last_for_tile(mapElement++));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma region Edge Slopes Table
|
||||
|
||||
enum
|
||||
{
|
||||
EDGE_SLOPE_ELEVATED = (1 << 0), // 0x01
|
||||
EDGE_SLOPE_UPWARDS = (1 << 6), // 0x40
|
||||
EDGE_SLOPE_DOWNWARDS = (1 << 7), // 0x80
|
||||
|
||||
EDGE_SLOPE_UPWARDS_ELEVATED = EDGE_SLOPE_UPWARDS | EDGE_SLOPE_ELEVATED,
|
||||
EDGE_SLOPE_DOWNWARDS_ELEVATED = EDGE_SLOPE_DOWNWARDS | EDGE_SLOPE_ELEVATED,
|
||||
};
|
||||
|
||||
/** rct2: 0x009A3FEC */
|
||||
static const uint8 EdgeSlopes[][4] = {
|
||||
// Top right Bottom right Bottom left Top left
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS, 0 },
|
||||
{ 0, 0, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS },
|
||||
{ 0, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS },
|
||||
{ EDGE_SLOPE_DOWNWARDS, 0, 0, EDGE_SLOPE_UPWARDS },
|
||||
{ EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS },
|
||||
{ EDGE_SLOPE_DOWNWARDS, 0, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED },
|
||||
{ EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED },
|
||||
{ EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS, 0, 0 },
|
||||
{ EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS, 0 },
|
||||
{ EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_DOWNWARDS },
|
||||
{ EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS },
|
||||
{ EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS, 0, EDGE_SLOPE_UPWARDS },
|
||||
{ EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS },
|
||||
{ EDGE_SLOPE_ELEVATED, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_ELEVATED },
|
||||
{ EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED, EDGE_SLOPE_ELEVATED },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_UPWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS_ELEVATED },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ EDGE_SLOPE_UPWARDS, EDGE_SLOPE_UPWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ EDGE_SLOPE_UPWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS },
|
||||
{ EDGE_SLOPE_DOWNWARDS_ELEVATED, EDGE_SLOPE_DOWNWARDS, EDGE_SLOPE_UPWARDS, EDGE_SLOPE_UPWARDS_ELEVATED },
|
||||
{ 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
static money32 WallPlace(uint8 wallType,
|
||||
sint16 x,
|
||||
sint16 y,
|
||||
sint16 z,
|
||||
uint8 edge,
|
||||
uint8 primaryColour,
|
||||
uint8 secondaryColour,
|
||||
uint8 tertiaryColour,
|
||||
uint8 flags)
|
||||
{
|
||||
rct_xyz16 position =
|
||||
{
|
||||
x,
|
||||
y,
|
||||
z
|
||||
};
|
||||
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
gCommandPosition.x = position.x + 16;
|
||||
gCommandPosition.y = position.y + 16;
|
||||
gCommandPosition.z = position.z;
|
||||
|
||||
if (position.z == 0)
|
||||
{
|
||||
gCommandPosition.z = map_element_height(position.x, position.y) & 0xFFFF;
|
||||
}
|
||||
|
||||
if (game_is_paused() && !gCheatsBuildInPauseMode)
|
||||
{
|
||||
gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) &&
|
||||
!(flags & GAME_COMMAND_FLAG_7) &&
|
||||
!gCheatsSandboxMode)
|
||||
{
|
||||
|
||||
if (position.z == 0)
|
||||
{
|
||||
if (!map_is_location_in_park(position.x, position.y))
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
else if (!map_is_location_owned(position.x, position.y, position.z))
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
uint8 edgeSlope = 0;
|
||||
if (position.z == 0)
|
||||
{
|
||||
rct_map_element * surfaceElement = map_get_surface_element_at(position.x / 32, position.y / 32);
|
||||
if (surfaceElement == NULL)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
position.z = surfaceElement->base_height * 8;
|
||||
|
||||
uint8 slope = surfaceElement->properties.surface.slope & MAP_ELEMENT_SLOPE_MASK;
|
||||
edgeSlope = EdgeSlopes[slope][edge & 3];
|
||||
if (edgeSlope & EDGE_SLOPE_ELEVATED)
|
||||
{
|
||||
position.z += 16;
|
||||
edgeSlope &= ~EDGE_SLOPE_ELEVATED;
|
||||
}
|
||||
}
|
||||
|
||||
rct_map_element * surfaceElement = map_get_surface_element_at(position.x / 32, position.y / 32);
|
||||
if (surfaceElement == NULL)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (surfaceElement->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK)
|
||||
{
|
||||
uint16 waterHeight = surfaceElement->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK;
|
||||
waterHeight *= 16;
|
||||
|
||||
if (position.z < waterHeight)
|
||||
{
|
||||
gGameCommandErrorText = STR_CANT_BUILD_THIS_UNDERWATER;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
if (position.z / 8 < surfaceElement->base_height)
|
||||
{
|
||||
gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (!(edgeSlope & (EDGE_SLOPE_UPWARDS | EDGE_SLOPE_DOWNWARDS)))
|
||||
{
|
||||
uint8 newEdge = (edge + 2) & 3;
|
||||
uint8 newBaseHeight = surfaceElement->base_height;
|
||||
newBaseHeight += 2;
|
||||
if (surfaceElement->properties.surface.slope & (1 << newEdge))
|
||||
{
|
||||
if (position.z / 8 < newBaseHeight)
|
||||
{
|
||||
gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (surfaceElement->properties.surface.slope & (1 << 4))
|
||||
{
|
||||
newEdge = (newEdge - 1) & 3;
|
||||
|
||||
if (surfaceElement->properties.surface.slope & (1 << newEdge))
|
||||
{
|
||||
newEdge = (newEdge + 2) & 3;
|
||||
if (surfaceElement->properties.surface.slope & (1 << newEdge))
|
||||
{
|
||||
newBaseHeight += 2;
|
||||
if (position.z / 8 < newBaseHeight)
|
||||
{
|
||||
gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
newBaseHeight -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newEdge = (edge + 3) & 3;
|
||||
if (surfaceElement->properties.surface.slope & (1 << newEdge))
|
||||
{
|
||||
if (position.z / 8 < newBaseHeight)
|
||||
{
|
||||
gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (surfaceElement->properties.surface.slope & (1 << 4))
|
||||
{
|
||||
newEdge = (newEdge - 1) & 3;
|
||||
|
||||
if (surfaceElement->properties.surface.slope & (1 << newEdge))
|
||||
{
|
||||
newEdge = (newEdge + 2) & 3;
|
||||
if (surfaceElement->properties.surface.slope & (1 << newEdge))
|
||||
{
|
||||
newBaseHeight += 2;
|
||||
if (position.z / 8 < newBaseHeight)
|
||||
{
|
||||
gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sint32 bannerIndex = 0xFF;
|
||||
rct_scenery_entry * wallEntry = get_wall_entry(wallType);
|
||||
// Have to check both -1 and NULL, as one can be a invalid object,
|
||||
// while the other can be invalid index
|
||||
if ((uintptr_t)wallEntry == (uintptr_t)-1 || wallEntry == NULL)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (wallEntry->wall.scrolling_mode != 0xFF)
|
||||
{
|
||||
bannerIndex = create_new_banner(flags);
|
||||
|
||||
if (bannerIndex == 0xFF)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
rct_banner * banner = &gBanners[bannerIndex];
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
banner->flags |= BANNER_FLAG_4;
|
||||
banner->type = 0;
|
||||
banner->x = position.x / 32;
|
||||
banner->y = position.y / 32;
|
||||
|
||||
sint32 rideIndex = banner_get_closest_ride_index(position.x, position.y, position.z);
|
||||
if (rideIndex != -1)
|
||||
{
|
||||
banner->colour = rideIndex & 0xFF;
|
||||
banner->flags |= BANNER_FLAG_LINKED_TO_RIDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8 clearanceHeight = position.z / 8;
|
||||
if (edgeSlope & (EDGE_SLOPE_UPWARDS | EDGE_SLOPE_DOWNWARDS))
|
||||
{
|
||||
if (wallEntry->wall.flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE)
|
||||
{
|
||||
gGameCommandErrorText = STR_ERR_UNABLE_TO_BUILD_THIS_ON_SLOPE;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
clearanceHeight += 2;
|
||||
}
|
||||
clearanceHeight += wallEntry->wall.height;
|
||||
|
||||
bool wallAcrossTrack = false;
|
||||
if (!(flags & GAME_COMMAND_FLAG_7) && !gCheatsDisableClearanceChecks)
|
||||
{
|
||||
if (!WallCheckObstruction(wallEntry,
|
||||
position.x,
|
||||
position.y,
|
||||
position.z / 8,
|
||||
clearanceHeight,
|
||||
edge,
|
||||
&wallAcrossTrack))
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
if (gGameCommandNestLevel == 1 && !(flags & 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);
|
||||
}
|
||||
|
||||
rct_map_element * mapElement = map_element_insert(position.x / 32, position.y / 32, position.z / 8, 0);
|
||||
assert(mapElement != NULL);
|
||||
|
||||
map_animation_create(MAP_ANIMATION_TYPE_WALL, position.x, position.y, position.z / 8);
|
||||
|
||||
mapElement->clearance_height = clearanceHeight;
|
||||
|
||||
mapElement->type = edgeSlope | edge | MAP_ELEMENT_TYPE_WALL;
|
||||
|
||||
mapElement->properties.wall.colour_1 = primaryColour;
|
||||
wall_element_set_secondary_colour(mapElement, secondaryColour);
|
||||
|
||||
if (wallAcrossTrack)
|
||||
{
|
||||
mapElement->properties.wall.animation |= WALL_ANIMATION_FLAG_ACROSS_TRACK;
|
||||
}
|
||||
|
||||
mapElement->properties.wall.type = wallType;
|
||||
if (bannerIndex != 0xFF)
|
||||
{
|
||||
mapElement->properties.wall.banner_index = bannerIndex;
|
||||
}
|
||||
|
||||
if (wallEntry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
|
||||
{
|
||||
mapElement->properties.wall.colour_3 = tertiaryColour;
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST)
|
||||
{
|
||||
mapElement->flags |= MAP_ELEMENT_FLAG_GHOST;
|
||||
}
|
||||
|
||||
gSceneryMapElement = mapElement;
|
||||
map_invalidate_tile_zoom1(position.x, position.y, mapElement->base_height * 8, mapElement->base_height * 8 + 72);
|
||||
}
|
||||
|
||||
if (gParkFlags & PARK_FLAGS_NO_MONEY)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return wallEntry->wall.price;
|
||||
}
|
||||
}
|
||||
|
||||
static money32 WallRemove(sint16 x, sint16 y, uint8 baseHeight, uint8 direction, uint8 flags)
|
||||
{
|
||||
if (!map_is_location_valid(x, y))
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
if(!(flags & GAME_COMMAND_FLAG_GHOST) &&
|
||||
game_is_paused() &&
|
||||
!gCheatsBuildInPauseMode)
|
||||
{
|
||||
gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if(!(flags & GAME_COMMAND_FLAG_GHOST) &&
|
||||
!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) &&
|
||||
!gCheatsSandboxMode &&
|
||||
!map_is_location_owned(x, y, baseHeight * 8))
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
bool wallFound = false;
|
||||
rct_map_element * wallElement = map_get_first_element_at(x / 32, y / 32);
|
||||
do
|
||||
{
|
||||
if (map_element_get_type(wallElement) != MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
if (wallElement->base_height != baseHeight)
|
||||
continue;
|
||||
if ((wallElement->type & MAP_ELEMENT_DIRECTION_MASK) != direction)
|
||||
continue;
|
||||
if ((flags & GAME_COMMAND_FLAG_GHOST) && !(wallElement->flags & MAP_ELEMENT_FLAG_GHOST))
|
||||
continue;
|
||||
|
||||
wallFound = true;
|
||||
break;
|
||||
}
|
||||
while (!map_element_is_last_for_tile(wallElement++));
|
||||
|
||||
if (!(flags & GAME_COMMAND_FLAG_APPLY) || (wallFound == false))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (gGameCommandNestLevel == 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);
|
||||
}
|
||||
|
||||
map_element_remove_banner_entry(wallElement);
|
||||
map_invalidate_tile_zoom1(x, y, wallElement->base_height * 8, (wallElement->base_height * 8) + 72);
|
||||
map_element_remove(wallElement);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static money32 WallSetColour(sint16 x,
|
||||
sint16 y,
|
||||
uint8 baseHeight,
|
||||
uint8 direction,
|
||||
uint8 primaryColour,
|
||||
uint8 secondaryColour,
|
||||
uint8 tertiaryColour,
|
||||
uint8 flags)
|
||||
{
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
sint32 z = baseHeight * 8;
|
||||
|
||||
gCommandPosition.x = x + 16;
|
||||
gCommandPosition.y = y + 16;
|
||||
gCommandPosition.z = z;
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) &&
|
||||
!map_is_location_in_park(x, y) &&
|
||||
!gCheatsSandboxMode)
|
||||
{
|
||||
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
rct_map_element * wallElement = map_get_wall_element_at(x, y, baseHeight, direction);
|
||||
|
||||
if (wallElement == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((flags & GAME_COMMAND_FLAG_GHOST) && !(wallElement->flags & MAP_ELEMENT_FLAG_GHOST))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
rct_scenery_entry * scenery_entry = get_wall_entry(wallElement->properties.wall.type);
|
||||
wallElement->properties.wall.colour_1 = primaryColour;
|
||||
wall_element_set_secondary_colour(wallElement, secondaryColour);
|
||||
|
||||
if(scenery_entry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
|
||||
{
|
||||
wallElement->properties.wall.colour_3 = tertiaryColour;
|
||||
}
|
||||
map_invalidate_tile_zoom1(x, y, z, z + 72);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
uint8 wall_element_get_animation_frame(rct_map_element * wallElement)
|
||||
{
|
||||
return (wallElement->properties.wall.animation >> 3) & 0xF;
|
||||
}
|
||||
|
||||
void wall_element_set_animation_frame(rct_map_element * wallElement, uint8 frameNum)
|
||||
{
|
||||
wallElement->properties.wall.animation &= WALL_ANIMATION_FLAG_ALL_FLAGS;
|
||||
wallElement->properties.wall.animation |= (frameNum >> 3) & 0xF;
|
||||
}
|
||||
|
||||
uint8 wall_element_get_secondary_colour(rct_map_element * wallElement)
|
||||
{
|
||||
uint8 secondaryColour = (wallElement->properties.wall.colour_1 & 0xE0) >> 5;
|
||||
secondaryColour |= (wallElement->flags & 0x60) >> 2;
|
||||
return secondaryColour;
|
||||
}
|
||||
|
||||
void wall_element_set_secondary_colour(rct_map_element * wallElement, uint8 secondaryColour)
|
||||
{
|
||||
wallElement->properties.wall.colour_1 &= 0x1F;
|
||||
wallElement->properties.wall.colour_1 |= (secondaryColour & 0x7) << 5;
|
||||
wallElement->flags &= 0x9F;
|
||||
wallElement->flags |= (secondaryColour & 0x18) << 2;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E588E
|
||||
*/
|
||||
void wall_remove_at(sint32 x, sint32 y, sint32 z0, sint32 z1)
|
||||
{
|
||||
rct_map_element * mapElement;
|
||||
|
||||
z0 /= 8;
|
||||
z1 /= 8;
|
||||
repeat:
|
||||
mapElement = map_get_first_element_at(x >> 5, y >> 5);
|
||||
do
|
||||
{
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
if (z0 >= mapElement->clearance_height)
|
||||
continue;
|
||||
if (z1 <= mapElement->base_height)
|
||||
continue;
|
||||
|
||||
map_element_remove_banner_entry(mapElement);
|
||||
map_invalidate_tile_zoom1(x, y, mapElement->base_height * 8, mapElement->base_height * 8 + 72);
|
||||
map_element_remove(mapElement);
|
||||
goto repeat;
|
||||
}
|
||||
while (!map_element_is_last_for_tile(mapElement++));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E57E6
|
||||
*/
|
||||
void wall_remove_at_z(sint32 x, sint32 y, sint32 z)
|
||||
{
|
||||
wall_remove_at(x, y, z, z + 48);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E5935
|
||||
*/
|
||||
void wall_remove_intersecting_walls(sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 direction)
|
||||
{
|
||||
rct_map_element * mapElement;
|
||||
|
||||
mapElement = map_get_first_element_at(x >> 5, y >> 5);
|
||||
do
|
||||
{
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
|
||||
if (mapElement->clearance_height <= z0 || mapElement->base_height >= z1)
|
||||
continue;
|
||||
|
||||
if (direction != (mapElement->type & 3))
|
||||
continue;
|
||||
|
||||
map_element_remove_banner_entry(mapElement);
|
||||
map_invalidate_tile_zoom1(x, y, mapElement->base_height * 8, mapElement->base_height * 8 + 72);
|
||||
map_element_remove(mapElement);
|
||||
mapElement--;
|
||||
}
|
||||
while (!map_element_is_last_for_tile(mapElement++));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E519A
|
||||
*/
|
||||
void game_command_place_wall(sint32 * eax,
|
||||
sint32 * ebx,
|
||||
sint32 * ecx,
|
||||
sint32 * edx,
|
||||
sint32 * esi,
|
||||
sint32 * edi,
|
||||
sint32 * ebp)
|
||||
{
|
||||
*ebx = WallPlace(
|
||||
(*ebx >> 8) & 0xFF,
|
||||
*eax & 0xFFFF,
|
||||
*ecx & 0xFFFF,
|
||||
*edi & 0xFFFF,
|
||||
*edx & 0xFF,
|
||||
(*edx >> 8) & 0xFF,
|
||||
*ebp & 0xFF,
|
||||
(*ebp >> 8) & 0xFF,
|
||||
*ebx & 0xFF
|
||||
);
|
||||
}
|
||||
|
||||
money32 wall_place(sint32 type,
|
||||
sint32 x,
|
||||
sint32 y,
|
||||
sint32 z,
|
||||
sint32 edge,
|
||||
sint32 primaryColour,
|
||||
sint32 secondaryColour,
|
||||
sint32 tertiaryColour,
|
||||
sint32 flags)
|
||||
{
|
||||
sint32 eax, ebx, ecx, edx, esi, edi, ebp;
|
||||
|
||||
eax = x;
|
||||
ebx = flags | (type << 8);
|
||||
ecx = y;
|
||||
edx = edge | (primaryColour << 8);
|
||||
edi = z;
|
||||
ebp = secondaryColour | (tertiaryColour << 8);
|
||||
game_command_place_wall(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
return ebx;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E5597
|
||||
*/
|
||||
void game_command_remove_wall(sint32 * eax,
|
||||
sint32 * ebx,
|
||||
sint32 * ecx,
|
||||
sint32 * edx,
|
||||
sint32 * esi,
|
||||
sint32 * edi,
|
||||
sint32 * ebp)
|
||||
{
|
||||
*ebx = WallRemove(
|
||||
*eax & 0xFFFF,
|
||||
*ecx & 0xFFFF,
|
||||
(*edx >> 8) & 0xFF,
|
||||
*edx & 0xFF,
|
||||
*ebx & 0xFF
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E56B5
|
||||
*/
|
||||
void game_command_set_wall_colour(sint32 * eax,
|
||||
sint32 * ebx,
|
||||
sint32 * ecx,
|
||||
sint32 * edx,
|
||||
sint32 * esi,
|
||||
sint32 * edi,
|
||||
sint32 * ebp)
|
||||
{
|
||||
*ebx = WallSetColour(
|
||||
*eax & 0xFFFF,
|
||||
*ecx & 0xFFFF,
|
||||
(*edx >> 8) & 0xFF,
|
||||
*edx & 0xFF,
|
||||
(*ebx >> 8) & 0xFF,
|
||||
*ebp & 0xFF,
|
||||
(*ebp >> 8) & 0xFF,
|
||||
*ebx & 0xFF
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user