mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #8001 from Gymnasiast/elementary-my-dear-watson
Port Wall elements to new tile element structure; remove some access to ->type
This commit is contained in:
commit
a6a5e3e315
|
@ -306,7 +306,7 @@ int32_t viewport_interaction_get_item_right(int32_t x, int32_t y, viewport_inter
|
|||
return info->type;
|
||||
|
||||
case VIEWPORT_INTERACTION_ITEM_WALL:
|
||||
sceneryEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
sceneryEntry = tileElement->AsWall()->GetEntry();
|
||||
if (sceneryEntry->wall.scrolling_mode != 255)
|
||||
{
|
||||
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY);
|
||||
|
@ -383,7 +383,7 @@ int32_t viewport_interaction_get_item_right(int32_t x, int32_t y, viewport_inter
|
|||
return info->type;
|
||||
|
||||
case VIEWPORT_INTERACTION_ITEM_WALL:
|
||||
sceneryEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
sceneryEntry = tileElement->AsWall()->GetEntry();
|
||||
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE);
|
||||
set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name);
|
||||
return info->type;
|
||||
|
@ -540,10 +540,10 @@ void viewport_interaction_remove_park_entrance(rct_tile_element* tileElement, in
|
|||
*/
|
||||
static void viewport_interaction_remove_park_wall(rct_tile_element* tileElement, int32_t x, int32_t y)
|
||||
{
|
||||
rct_scenery_entry* sceneryEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
rct_scenery_entry* sceneryEntry = tileElement->AsWall()->GetEntry();
|
||||
if (sceneryEntry->wall.scrolling_mode != 0xFF)
|
||||
{
|
||||
context_open_detail_window(WD_SIGN_SMALL, tileElement->properties.wall.banner_index);
|
||||
context_open_detail_window(WD_SIGN_SMALL, tileElement->AsWall()->GetBannerIndex());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -410,10 +410,10 @@ rct_window* window_sign_small_open(rct_windownumber number)
|
|||
{
|
||||
if (tile_element->GetType() == TILE_ELEMENT_TYPE_WALL)
|
||||
{
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(tile_element->properties.wall.type);
|
||||
rct_scenery_entry* scenery_entry = tile_element->AsWall()->GetEntry();
|
||||
if (scenery_entry->wall.scrolling_mode != 0xFF)
|
||||
{
|
||||
if (tile_element->properties.wall.banner_index == w->number)
|
||||
if (tile_element->AsWall()->GetBannerIndex() == w->number)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -423,9 +423,9 @@ rct_window* window_sign_small_open(rct_windownumber number)
|
|||
int32_t view_z = tile_element->base_height << 3;
|
||||
w->frame_no = view_z;
|
||||
|
||||
w->list_information_type = wall_get_primary_colour(tile_element);
|
||||
w->var_492 = wall_get_secondary_colour(tile_element);
|
||||
w->var_48C = tile_element->properties.wall.type;
|
||||
w->list_information_type = tile_element->AsWall()->GetPrimaryColour();
|
||||
w->var_492 = tile_element->AsWall()->GetSecondaryColour();
|
||||
w->var_48C = tile_element->AsWall()->GetEntryIndex();
|
||||
|
||||
view_x += 16;
|
||||
view_y += 16;
|
||||
|
@ -468,10 +468,10 @@ static void window_sign_small_mouseup(rct_window* w, rct_widgetindex widgetIndex
|
|||
{
|
||||
if (tile_element->GetType() == TILE_ELEMENT_TYPE_WALL)
|
||||
{
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(tile_element->properties.wall.type);
|
||||
rct_scenery_entry* scenery_entry = tile_element->AsWall()->GetEntry();
|
||||
if (scenery_entry->wall.scrolling_mode != 0xFF)
|
||||
{
|
||||
if (tile_element->properties.wall.banner_index == w->number)
|
||||
if (tile_element->AsWall()->GetBannerIndex() == w->number)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -730,7 +730,7 @@ static void window_tile_inspector_entrance_make_usable(int32_t elementIndex)
|
|||
static void window_tile_inspector_wall_set_slope(int32_t elementIndex, int32_t slopeValue)
|
||||
{
|
||||
// Make sure only the correct bits are set
|
||||
openrct2_assert((slopeValue & 0xC0) == slopeValue, "slopeValue doesn't match its mask");
|
||||
openrct2_assert((slopeValue & 3) == slopeValue, "slopeValue doesn't match its mask");
|
||||
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_WALL_SET_SLOPE, GAME_COMMAND_FLAG_APPLY, windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
|
@ -1189,7 +1189,7 @@ static void window_tile_inspector_dropdown(rct_window* w, rct_widgetindex widget
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_WALL_DROPDOWN_SLOPE_BUTTON:
|
||||
window_tile_inspector_wall_set_slope(windowTileInspectorSelectedIndex, dropdownIndex << 6);
|
||||
window_tile_inspector_wall_set_slope(windowTileInspectorSelectedIndex, dropdownIndex);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -1623,7 +1623,7 @@ static void window_tile_inspector_invalidate(rct_window* w)
|
|||
w->widgets[WIDX_WALL_DROPDOWN_SLOPE].text = WallSlopeStringIds[tileElement->AsWall()->GetSlope()];
|
||||
w->widgets[WIDX_WALL_DROPDOWN_SLOPE_BUTTON].top = GBBT(propertiesAnchor, 1) + 4;
|
||||
w->widgets[WIDX_WALL_DROPDOWN_SLOPE_BUTTON].bottom = GBBB(propertiesAnchor, 1) - 4;
|
||||
const uint8_t wallType = tileElement->properties.wall.type;
|
||||
const uint8_t wallType = tileElement->AsWall()->GetEntryIndex();
|
||||
const rct_wall_scenery_entry wallEntry = get_wall_entry(wallType)->wall;
|
||||
const bool canBeSloped = !(wallEntry.flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE);
|
||||
// Wall slope dropdown
|
||||
|
@ -1978,7 +1978,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
// Details
|
||||
// Type
|
||||
int16_t wallType = tileElement->properties.wall.type;
|
||||
int16_t wallType = tileElement->AsWall()->GetEntryIndex();
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_WALL_TYPE, &wallType, COLOUR_DARK_GREEN, x, y);
|
||||
|
||||
// Banner info
|
||||
|
@ -1987,7 +1987,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT,
|
||||
&gBanners[tileElement->properties.wall.banner_index].string_idx, COLOUR_DARK_GREEN, x, y + 11);
|
||||
&gBanners[tileElement->AsWall()->GetBannerIndex()].string_idx, COLOUR_DARK_GREEN, x, y + 11);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2158,7 +2158,7 @@ static void window_tile_inspector_scrollpaint(rct_window* w, rct_drawpixelinfo*
|
|||
case TILE_ELEMENT_TYPE_WALL:
|
||||
snprintf(
|
||||
buffer, sizeof(buffer), "%s (%s)", language_get_string(STR_TILE_INSPECTOR_WALL),
|
||||
language_get_string(get_wall_entry(tileElement->properties.wall.type)->name));
|
||||
language_get_string(tileElement->AsWall()->GetEntry()->name));
|
||||
typeName = buffer;
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
|
||||
|
|
|
@ -1001,7 +1001,7 @@ static void repaint_scenery_tool_down(int16_t x, int16_t y, rct_widgetindex widg
|
|||
}
|
||||
case VIEWPORT_INTERACTION_ITEM_WALL:
|
||||
{
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(tile_element->properties.wall.type);
|
||||
rct_scenery_entry* scenery_entry = tile_element->AsWall()->GetEntry();
|
||||
|
||||
// If can't repaint
|
||||
if (!(scenery_entry->wall.flags & (WALL_SCENERY_HAS_PRIMARY_COLOUR | WALL_SCENERY_HAS_GLASS)))
|
||||
|
@ -1080,16 +1080,16 @@ static void scenery_eyedropper_tool_down(int16_t x, int16_t y, rct_widgetindex w
|
|||
}
|
||||
case VIEWPORT_INTERACTION_ITEM_WALL:
|
||||
{
|
||||
int32_t entryIndex = tileElement->properties.wall.type;
|
||||
int32_t entryIndex = tileElement->AsWall()->GetEntryIndex();
|
||||
rct_scenery_entry* sceneryEntry = get_wall_entry(entryIndex);
|
||||
if (sceneryEntry != nullptr)
|
||||
{
|
||||
int32_t sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_WALLS, entryIndex);
|
||||
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId))
|
||||
{
|
||||
gWindowSceneryPrimaryColour = wall_get_primary_colour(tileElement);
|
||||
gWindowScenerySecondaryColour = wall_get_secondary_colour(tileElement);
|
||||
gWindowSceneryTertiaryColour = wall_get_tertiary_colour(tileElement);
|
||||
gWindowSceneryPrimaryColour = tileElement->AsWall()->GetPrimaryColour();
|
||||
gWindowScenerySecondaryColour = tileElement->AsWall()->GetSecondaryColour();
|
||||
gWindowSceneryTertiaryColour = tileElement->AsWall()->GetTertiaryColour();
|
||||
gWindowSceneryEyedropperEnabled = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ void setup_in_use_selection_flags()
|
|||
Editor::SetSelectedObject(OBJECT_TYPE_PATHS, type, OBJECT_SELECTION_FLAG_SELECTED);
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_WALL:
|
||||
type = iter.element->properties.wall.type;
|
||||
type = iter.element->AsWall()->GetEntryIndex();
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_WALLS]);
|
||||
Editor::SetSelectedObject(OBJECT_TYPE_WALLS, type, OBJECT_SELECTION_FLAG_SELECTED);
|
||||
break;
|
||||
|
|
|
@ -109,7 +109,7 @@ private:
|
|||
{
|
||||
while (!(tileElement++)->IsLastForTile())
|
||||
{
|
||||
if (tileElement->type != TILE_ELEMENT_TYPE_PATH && !tileElement->IsGhost())
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH && !tileElement->IsGhost())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ void scenery_paint(paint_session* session, uint8_t direction, int32_t height, co
|
|||
{
|
||||
// 6E01F8:
|
||||
frame += ((session->SpritePosition.x / 4) + (session->SpritePosition.y / 4));
|
||||
frame += (tileElement->type & 0xC0) / 16;
|
||||
frame += tileElement->AsSmallScenery()->GetSceneryQuadrant() << 2;
|
||||
}
|
||||
// 6E0222:
|
||||
uint16_t delay = entry->small_scenery.animation_delay & 0xFF;
|
||||
|
|
|
@ -158,7 +158,7 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
|
|||
{
|
||||
session->InteractionType = VIEWPORT_INTERACTION_ITEM_WALL;
|
||||
|
||||
rct_scenery_entry* sceneryEntry = get_wall_entry(tile_element->properties.wall.type);
|
||||
rct_scenery_entry* sceneryEntry = tile_element->AsWall()->GetEntry();
|
||||
if (sceneryEntry == nullptr)
|
||||
{
|
||||
return;
|
||||
|
@ -170,20 +170,20 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
|
|||
frameNum = (gCurrentTicks & 7) * 2;
|
||||
}
|
||||
|
||||
int32_t primaryColour = wall_get_primary_colour(tile_element);
|
||||
int32_t primaryColour = tile_element->AsWall()->GetPrimaryColour();
|
||||
uint32_t imageColourFlags = primaryColour << 19 | IMAGE_TYPE_REMAP;
|
||||
uint32_t dword_141F718 = imageColourFlags + 0x23800006;
|
||||
|
||||
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR)
|
||||
{
|
||||
uint8_t secondaryColour = wall_get_secondary_colour(tile_element);
|
||||
uint8_t secondaryColour = tile_element->AsWall()->GetSecondaryColour();
|
||||
imageColourFlags |= secondaryColour << 24 | IMAGE_TYPE_REMAP_2_PLUS;
|
||||
}
|
||||
|
||||
uint32_t tertiaryColour = 0;
|
||||
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
|
||||
{
|
||||
tertiaryColour = wall_get_tertiary_colour(tile_element);
|
||||
tertiaryColour = tile_element->AsWall()->GetTertiaryColour();
|
||||
imageColourFlags &= 0x0DFFFFFFF;
|
||||
}
|
||||
|
||||
|
@ -212,9 +212,10 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
|
|||
{
|
||||
LocationXYZ16 offset;
|
||||
LocationXYZ16 boundsR1, boundsR1_, boundsR2, boundsR2_, boundsL1, boundsL1_;
|
||||
uint8_t animationFrame = wall_get_animation_frame(tile_element);
|
||||
uint8_t animationFrame = tile_element->AsWall()->GetAnimationFrame();
|
||||
// Add the direction as well
|
||||
animationFrame |= (tile_element->properties.wall.animation & WALL_ANIMATION_FLAG_DIRECTION_BACKWARD) >> 3;
|
||||
if (tile_element->AsWall()->AnimationIsBackwards())
|
||||
animationFrame |= (1 << 4);
|
||||
uint32_t imageId;
|
||||
switch (direction)
|
||||
{
|
||||
|
@ -300,11 +301,11 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
|
|||
switch (direction)
|
||||
{
|
||||
case 0:
|
||||
if (tile_element->type & 0x80)
|
||||
if (tile_element->AsWall()->GetSlope() == 2)
|
||||
{
|
||||
imageOffset = 3;
|
||||
}
|
||||
else if (tile_element->type & 0x40)
|
||||
else if (tile_element->AsWall()->GetSlope() == 1)
|
||||
{
|
||||
imageOffset = 5;
|
||||
}
|
||||
|
@ -319,11 +320,11 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
|
|||
break;
|
||||
|
||||
case 1:
|
||||
if (tile_element->type & 0x80)
|
||||
if (tile_element->AsWall()->GetSlope() == 2)
|
||||
{
|
||||
imageOffset = 2;
|
||||
}
|
||||
else if (tile_element->type & 0x40)
|
||||
else if (tile_element->AsWall()->GetSlope() == 1)
|
||||
{
|
||||
imageOffset = 4;
|
||||
}
|
||||
|
@ -353,11 +354,11 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
|
|||
break;
|
||||
|
||||
case 2:
|
||||
if (tile_element->type & 0x80)
|
||||
if (tile_element->AsWall()->GetSlope() == 2)
|
||||
{
|
||||
imageOffset = 5;
|
||||
}
|
||||
else if (tile_element->type & 0x40)
|
||||
else if (tile_element->AsWall()->GetSlope() == 1)
|
||||
{
|
||||
imageOffset = 3;
|
||||
}
|
||||
|
@ -377,11 +378,11 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
|
|||
break;
|
||||
|
||||
case 3:
|
||||
if (tile_element->type & 0x80)
|
||||
if (tile_element->AsWall()->GetSlope() == 2)
|
||||
{
|
||||
imageOffset = 4;
|
||||
}
|
||||
else if (tile_element->type & 0x40)
|
||||
else if (tile_element->AsWall()->GetSlope() == 1)
|
||||
{
|
||||
imageOffset = 2;
|
||||
}
|
||||
|
@ -413,7 +414,7 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
|
|||
set_format_arg(0, uint32_t, 0);
|
||||
set_format_arg(4, uint32_t, 0);
|
||||
|
||||
uint8_t secondaryColour = wall_get_secondary_colour(tile_element);
|
||||
uint8_t secondaryColour = tile_element->AsWall()->GetSecondaryColour();
|
||||
|
||||
if (dword_141F710 != 0)
|
||||
{
|
||||
|
@ -429,7 +430,7 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
|
|||
|
||||
uint16_t scrollingMode = sceneryEntry->wall.scrolling_mode + ((direction + 1) & 0x3);
|
||||
|
||||
uint8_t bannerIndex = tile_element->properties.wall.banner_index;
|
||||
uint8_t bannerIndex = tile_element->AsWall()->GetBannerIndex();
|
||||
rct_banner* banner = &gBanners[bannerIndex];
|
||||
|
||||
set_format_arg(0, rct_string_id, banner->string_idx);
|
||||
|
|
|
@ -6299,7 +6299,7 @@ static bool peep_find_ride_to_look_at(rct_peep* peep, uint8_t edge, uint8_t* rid
|
|||
continue;
|
||||
if (tileElement->GetDirection() != edge)
|
||||
continue;
|
||||
auto wallEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
auto wallEntry = tileElement->AsWall()->GetEntry();
|
||||
if (wallEntry == nullptr || (wallEntry->wall.flags2 & WALL_SCENERY_2_IS_OPAQUE))
|
||||
continue;
|
||||
if (peep->next_z + 4 <= tileElement->base_height)
|
||||
|
@ -6333,7 +6333,7 @@ static bool peep_find_ride_to_look_at(rct_peep* peep, uint8_t edge, uint8_t* rid
|
|||
continue;
|
||||
if (tileElement->GetDirectionWithOffset(2) != edge)
|
||||
continue;
|
||||
auto wallEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
auto wallEntry = tileElement->AsWall()->GetEntry();
|
||||
if (wallEntry == nullptr || (wallEntry->wall.flags2 & WALL_SCENERY_2_IS_OPAQUE))
|
||||
continue;
|
||||
// TODO: Check whether this shouldn't be <=, as the other loops use. If so, also extract as loop A.
|
||||
|
@ -6411,7 +6411,7 @@ static bool peep_find_ride_to_look_at(rct_peep* peep, uint8_t edge, uint8_t* rid
|
|||
|
||||
if (tileElement->GetType() == TILE_ELEMENT_TYPE_WALL)
|
||||
{
|
||||
auto wallEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
auto wallEntry = tileElement->AsWall()->GetEntry();
|
||||
if (wallEntry == nullptr || (wallEntry->wall.flags2 & WALL_SCENERY_2_IS_OPAQUE))
|
||||
{
|
||||
continue;
|
||||
|
@ -6445,7 +6445,7 @@ static bool peep_find_ride_to_look_at(rct_peep* peep, uint8_t edge, uint8_t* rid
|
|||
continue;
|
||||
if (tileElement->GetDirectionWithOffset(2) != edge)
|
||||
continue;
|
||||
auto wallEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
auto wallEntry = tileElement->AsWall()->GetEntry();
|
||||
if (wallEntry == nullptr || (wallEntry->wall.flags2 & WALL_SCENERY_2_IS_OPAQUE))
|
||||
continue;
|
||||
if (peep->next_z + 6 <= tileElement->base_height)
|
||||
|
@ -6522,7 +6522,7 @@ static bool peep_find_ride_to_look_at(rct_peep* peep, uint8_t edge, uint8_t* rid
|
|||
|
||||
if (tileElement->GetType() == TILE_ELEMENT_TYPE_WALL)
|
||||
{
|
||||
auto wallEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
auto wallEntry = tileElement->AsWall()->GetEntry();
|
||||
if (wallEntry == nullptr || (wallEntry->wall.flags2 & WALL_SCENERY_2_IS_OPAQUE))
|
||||
{
|
||||
continue;
|
||||
|
@ -6556,7 +6556,7 @@ static bool peep_find_ride_to_look_at(rct_peep* peep, uint8_t edge, uint8_t* rid
|
|||
continue;
|
||||
if (tileElement->GetDirectionWithOffset(2) != edge)
|
||||
continue;
|
||||
auto wallEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
auto wallEntry = tileElement->AsWall()->GetEntry();
|
||||
if (wallEntry == nullptr || (wallEntry->wall.flags2 & WALL_SCENERY_2_IS_OPAQUE))
|
||||
continue;
|
||||
if (peep->next_z + 8 <= tileElement->base_height)
|
||||
|
|
|
@ -61,8 +61,6 @@
|
|||
using namespace OpenRCT2;
|
||||
|
||||
static uint8_t GetPathType(rct_tile_element* tileElement);
|
||||
static int32_t GetWallType(rct_tile_element* tileElement, int32_t edge);
|
||||
static uint8_t GetWallColour(rct_tile_element* tileElement);
|
||||
|
||||
class EntryList
|
||||
{
|
||||
|
@ -499,7 +497,7 @@ private:
|
|||
{
|
||||
for (int32_t edge = 0; edge < 4; edge++)
|
||||
{
|
||||
int32_t type = GetWallType(tileElement, edge);
|
||||
int32_t type = tileElement->AsWall()->GetRCT1WallType(edge);
|
||||
|
||||
if (type != -1)
|
||||
{
|
||||
|
@ -2406,10 +2404,11 @@ private:
|
|||
// Fill the rest of the row with blank tiles
|
||||
for (int32_t y = 0; y < RCT1_MAX_MAP_SIZE; y++)
|
||||
{
|
||||
nextFreeTileElement->type = TILE_ELEMENT_TYPE_SURFACE;
|
||||
memset(nextFreeTileElement, 0, sizeof(rct_tile_element));
|
||||
nextFreeTileElement->SetType(TILE_ELEMENT_TYPE_SURFACE);
|
||||
nextFreeTileElement->flags = TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
nextFreeTileElement->base_height = 2;
|
||||
nextFreeTileElement->clearance_height = 0;
|
||||
nextFreeTileElement->clearance_height = 2;
|
||||
nextFreeTileElement->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
||||
nextFreeTileElement->AsSurface()->SetSurfaceStyle(TERRAIN_GRASS);
|
||||
nextFreeTileElement->AsSurface()->SetEdgeStyle(TERRAIN_EDGE_ROCK);
|
||||
|
@ -2422,10 +2421,11 @@ private:
|
|||
// 128 extra rows left to fill with blank tiles
|
||||
for (int32_t y = 0; y < 128 * 256; y++)
|
||||
{
|
||||
nextFreeTileElement->type = TILE_ELEMENT_TYPE_SURFACE;
|
||||
memset(nextFreeTileElement, 0, sizeof(rct_tile_element));
|
||||
nextFreeTileElement->SetType(TILE_ELEMENT_TYPE_SURFACE);
|
||||
nextFreeTileElement->flags = TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
nextFreeTileElement->base_height = 2;
|
||||
nextFreeTileElement->clearance_height = 0;
|
||||
nextFreeTileElement->clearance_height = 2;
|
||||
nextFreeTileElement->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
||||
nextFreeTileElement->AsSurface()->SetSurfaceStyle(TERRAIN_GRASS);
|
||||
nextFreeTileElement->AsSurface()->SetEdgeStyle(TERRAIN_EDGE_ROCK);
|
||||
|
@ -2573,11 +2573,11 @@ private:
|
|||
|
||||
for (int32_t edge = 0; edge < 4; edge++)
|
||||
{
|
||||
int32_t type = GetWallType(&originalTileElement, edge);
|
||||
int32_t type = originalTileElement.AsWall()->GetRCT1WallType(edge);
|
||||
|
||||
if (type != -1)
|
||||
{
|
||||
int32_t colourA = RCT1::GetColour(GetWallColour(&originalTileElement));
|
||||
int32_t colourA = RCT1::GetColour(originalTileElement.AsWall()->GetRCT1WallColour());
|
||||
int32_t colourB = 0;
|
||||
int32_t colourC = 0;
|
||||
ConvertWall(&type, &colourA, &colourB);
|
||||
|
@ -2895,10 +2895,10 @@ static uint8_t GetPathType(rct_tile_element* tileElement)
|
|||
return pathType;
|
||||
}
|
||||
|
||||
static int32_t GetWallType(rct_tile_element* tileElement, int32_t edge)
|
||||
int32_t WallElement::GetRCT1WallType(int32_t edge) const
|
||||
{
|
||||
uint8_t var_05 = tileElement->properties.wall.colour_3;
|
||||
uint16_t var_06 = tileElement->properties.wall.colour_1 | (tileElement->properties.wall.animation << 8);
|
||||
uint8_t var_05 = colour_3;
|
||||
uint16_t var_06 = colour_1 | (animation << 8);
|
||||
|
||||
int32_t typeA = (var_05 >> (edge * 2)) & 3;
|
||||
int32_t typeB = (var_06 >> (edge * 4)) & 0x0F;
|
||||
|
@ -2913,7 +2913,7 @@ static int32_t GetWallType(rct_tile_element* tileElement, int32_t edge)
|
|||
}
|
||||
}
|
||||
|
||||
static uint8_t GetWallColour(rct_tile_element* tileElement)
|
||||
colour_t WallElement::GetRCT1WallColour() const
|
||||
{
|
||||
return ((tileElement->type & 0xC0) >> 3) | ((tileElement->properties.wall.type & 0xE0) >> 5);
|
||||
return ((type & 0xC0) >> 3) | ((entryIndex & 0xE0) >> 5);
|
||||
}
|
||||
|
|
|
@ -2327,7 +2327,7 @@ static void track_design_preview_clear_map()
|
|||
{
|
||||
rct_tile_element* tile_element = &gTileElements[i];
|
||||
memset(tile_element, 0, sizeof(rct_tile_element));
|
||||
tile_element->type = TILE_ELEMENT_TYPE_SURFACE;
|
||||
tile_element->SetType(TILE_ELEMENT_TYPE_SURFACE);
|
||||
tile_element->flags = TILE_ELEMENT_FLAG_LAST_TILE;
|
||||
tile_element->base_height = 2;
|
||||
tile_element->clearance_height = 0;
|
||||
|
|
|
@ -354,15 +354,15 @@ static void track_design_save_add_large_scenery(int32_t x, int32_t y, rct_tile_e
|
|||
|
||||
static void track_design_save_add_wall(int32_t x, int32_t y, rct_tile_element* tileElement)
|
||||
{
|
||||
int32_t entryType = tileElement->properties.wall.type;
|
||||
int32_t entryType = tileElement->AsWall()->GetEntryIndex();
|
||||
auto entry = object_entry_get_entry(OBJECT_TYPE_WALLS, entryType);
|
||||
|
||||
uint8_t flags = 0;
|
||||
flags |= tileElement->type & 3;
|
||||
flags |= wall_get_tertiary_colour(tileElement) << 2;
|
||||
flags |= tileElement->AsWall()->GetTertiaryColour() << 2;
|
||||
|
||||
uint8_t secondaryColour = wall_get_secondary_colour(tileElement);
|
||||
uint8_t primaryColour = wall_get_primary_colour(tileElement);
|
||||
uint8_t secondaryColour = tileElement->AsWall()->GetSecondaryColour();
|
||||
uint8_t primaryColour = tileElement->AsWall()->GetPrimaryColour();
|
||||
|
||||
track_design_save_push_tile_element(x, y, tileElement);
|
||||
track_design_save_push_tile_element_desc(entry, x, y, tileElement->base_height, flags, primaryColour, secondaryColour);
|
||||
|
@ -542,12 +542,12 @@ static void track_design_save_remove_large_scenery(int32_t x, int32_t y, rct_til
|
|||
|
||||
static void track_design_save_remove_wall(int32_t x, int32_t y, rct_tile_element* tileElement)
|
||||
{
|
||||
int32_t entryType = tileElement->properties.wall.type;
|
||||
int32_t entryType = tileElement->AsWall()->GetEntryIndex();
|
||||
auto entry = object_entry_get_entry(OBJECT_TYPE_WALLS, entryType);
|
||||
|
||||
uint8_t flags = 0;
|
||||
flags |= tileElement->type & 3;
|
||||
flags |= wall_get_tertiary_colour(tileElement) << 2;
|
||||
flags |= tileElement->AsWall()->GetTertiaryColour() << 2;
|
||||
|
||||
track_design_save_pop_tile_element(x, y, tileElement);
|
||||
track_design_save_pop_tile_element_desc(entry, x, y, tileElement->base_height, flags);
|
||||
|
|
|
@ -2846,7 +2846,7 @@ static bool vehicle_can_depart_synchronised(rct_vehicle* vehicle)
|
|||
* is found we allow for space between that and the next.
|
||||
*/
|
||||
|
||||
int32_t direction = (tileElement->type + 1) & 3;
|
||||
int32_t direction = tileElement->GetDirectionWithOffset(1);
|
||||
int32_t spaceBetween;
|
||||
int32_t maxCheckDistance = RIDE_ADJACENCY_CHECK_DISTANCE;
|
||||
|
||||
|
@ -7397,7 +7397,7 @@ static void vehicle_update_additional_animation(rct_vehicle* vehicle)
|
|||
*/
|
||||
static void vehicle_play_scenery_door_open_sound(rct_vehicle* vehicle, rct_tile_element* tileElement)
|
||||
{
|
||||
rct_scenery_entry* wallEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
rct_scenery_entry* wallEntry = tileElement->AsWall()->GetEntry();
|
||||
int32_t doorSoundType = wall_entry_get_door_sound(wallEntry);
|
||||
if (doorSoundType != 0)
|
||||
{
|
||||
|
@ -7415,7 +7415,7 @@ static void vehicle_play_scenery_door_open_sound(rct_vehicle* vehicle, rct_tile_
|
|||
*/
|
||||
static void vehicle_play_scenery_door_close_sound(rct_vehicle* vehicle, rct_tile_element* tileElement)
|
||||
{
|
||||
rct_scenery_entry* wallEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
rct_scenery_entry* wallEntry = tileElement->AsWall()->GetEntry();
|
||||
int32_t doorSoundType = wall_entry_get_door_sound(wallEntry);
|
||||
if (doorSoundType != 0)
|
||||
{
|
||||
|
@ -7453,15 +7453,15 @@ static void vehicle_update_scenery_door(rct_vehicle* vehicle)
|
|||
|
||||
if (vehicle->next_vehicle_on_train != SPRITE_INDEX_NULL)
|
||||
{
|
||||
tileElement->properties.wall.animation &= ~(WALL_ANIMATION_FLAG_DIRECTION_BACKWARD);
|
||||
wall_set_animation_frame(tileElement, 1);
|
||||
tileElement->AsWall()->SetAnimationIsBackwards(false);
|
||||
tileElement->AsWall()->SetAnimationFrame(1);
|
||||
map_animation_create(MAP_ANIMATION_TYPE_WALL_DOOR, x, y, z);
|
||||
vehicle_play_scenery_door_open_sound(vehicle, tileElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
tileElement->properties.wall.animation &= ~(WALL_ANIMATION_FLAG_DIRECTION_BACKWARD);
|
||||
wall_set_animation_frame(tileElement, 6);
|
||||
tileElement->AsWall()->SetAnimationIsBackwards(false);
|
||||
tileElement->AsWall()->SetAnimationFrame(6);
|
||||
vehicle_play_scenery_door_close_sound(vehicle, tileElement);
|
||||
}
|
||||
}
|
||||
|
@ -7533,15 +7533,15 @@ static void vehicle_update_handle_scenery_door(rct_vehicle* vehicle)
|
|||
|
||||
if (vehicle->next_vehicle_on_train != SPRITE_INDEX_NULL)
|
||||
{
|
||||
tileElement->properties.wall.animation |= WALL_ANIMATION_FLAG_DIRECTION_BACKWARD;
|
||||
wall_set_animation_frame(tileElement, 1);
|
||||
tileElement->AsWall()->SetAnimationIsBackwards(true);
|
||||
tileElement->AsWall()->SetAnimationFrame(1);
|
||||
map_animation_create(MAP_ANIMATION_TYPE_WALL_DOOR, x, y, z);
|
||||
vehicle_play_scenery_door_open_sound(vehicle, tileElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
tileElement->properties.wall.animation &= ~(WALL_ANIMATION_FLAG_DIRECTION_BACKWARD);
|
||||
wall_set_animation_frame(tileElement, 6);
|
||||
tileElement->AsWall()->SetAnimationIsBackwards(true);
|
||||
tileElement->AsWall()->SetAnimationFrame(6);
|
||||
vehicle_play_scenery_door_close_sound(vehicle, tileElement);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3442,7 +3442,7 @@ void map_obstruction_set_error_text(rct_tile_element* tileElement)
|
|||
}
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_WALL:
|
||||
sceneryEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
sceneryEntry = tileElement->AsWall()->GetEntry();
|
||||
errorStringId = STR_X_IN_THE_WAY;
|
||||
set_format_arg(0, rct_string_id, sceneryEntry->name);
|
||||
break;
|
||||
|
@ -4388,10 +4388,10 @@ void game_command_set_sign_style(
|
|||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(tileElement->properties.wall.type);
|
||||
rct_scenery_entry* scenery_entry = tileElement->AsWall()->GetEntry();
|
||||
if (scenery_entry->wall.scrolling_mode == 0xFF)
|
||||
continue;
|
||||
if (tileElement->properties.wall.banner_index != bannerId)
|
||||
if (tileElement->AsWall()->GetBannerIndex() != bannerId)
|
||||
continue;
|
||||
wall_found = true;
|
||||
break;
|
||||
|
@ -4408,8 +4408,8 @@ void game_command_set_sign_style(
|
|||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
wall_set_primary_colour(tileElement, mainColour);
|
||||
wall_set_secondary_colour(tileElement, textColour);
|
||||
tileElement->AsWall()->SetPrimaryColour(mainColour);
|
||||
tileElement->AsWall()->SetSecondaryColour(textColour);
|
||||
|
||||
map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);
|
||||
}
|
||||
|
|
|
@ -492,7 +492,7 @@ static bool map_animation_invalidate_wall_door(int32_t x, int32_t y, int32_t bas
|
|||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
|
||||
sceneryEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
sceneryEntry = tileElement->AsWall()->GetEntry();
|
||||
if (!(sceneryEntry->wall.flags & WALL_SCENERY_IS_DOOR))
|
||||
continue;
|
||||
|
||||
|
@ -503,7 +503,7 @@ static bool map_animation_invalidate_wall_door(int32_t x, int32_t y, int32_t bas
|
|||
|
||||
bool invalidate = false;
|
||||
|
||||
uint8_t currentFrame = wall_get_animation_frame(tileElement);
|
||||
uint8_t currentFrame = tileElement->AsWall()->GetAnimationFrame();
|
||||
if (currentFrame != 0)
|
||||
{
|
||||
if (currentFrame == 15)
|
||||
|
@ -523,7 +523,7 @@ static bool map_animation_invalidate_wall_door(int32_t x, int32_t y, int32_t bas
|
|||
}
|
||||
}
|
||||
}
|
||||
wall_set_animation_frame(tileElement, currentFrame);
|
||||
tileElement->AsWall()->SetAnimationFrame(currentFrame);
|
||||
if (invalidate)
|
||||
{
|
||||
int32_t z = tileElement->base_height * 8;
|
||||
|
@ -552,7 +552,7 @@ static bool map_animation_invalidate_wall(int32_t x, int32_t y, int32_t baseZ)
|
|||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
|
||||
sceneryEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
sceneryEntry = tileElement->AsWall()->GetEntry();
|
||||
|
||||
if (!(sceneryEntry->wall.flags2 & WALL_SCENERY_2_ANIMATED) && sceneryEntry->wall.scrolling_mode == 255)
|
||||
continue;
|
||||
|
|
|
@ -76,7 +76,7 @@ static money32 SmallSceneryRemove(
|
|||
{
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_SMALL_SCENERY)
|
||||
continue;
|
||||
if ((tileElement->type >> 6) != quadrant)
|
||||
if ((tileElement->AsSmallScenery()->GetSceneryQuadrant()) != quadrant)
|
||||
continue;
|
||||
if (tileElement->base_height != baseHeight)
|
||||
continue;
|
||||
|
@ -382,11 +382,10 @@ static money32 SmallSceneryPlace(
|
|||
rct_tile_element* newElement = tile_element_insert(x / 32, y / 32, zLow, collisionQuadrants);
|
||||
assert(newElement != nullptr);
|
||||
gSceneryTileElement = newElement;
|
||||
uint8_t type = quadrant << 6;
|
||||
type |= TILE_ELEMENT_TYPE_SMALL_SCENERY;
|
||||
type |= rotation;
|
||||
newElement->type = type;
|
||||
SmallSceneryElement* sceneryElement = newElement->AsSmallScenery();
|
||||
newElement->SetType(TILE_ELEMENT_TYPE_SMALL_SCENERY);
|
||||
newElement->AsSmallScenery()->SetSceneryQuadrant(quadrant);
|
||||
newElement->SetDirection(rotation);
|
||||
sceneryElement->SetEntryIndex(sceneryType);
|
||||
sceneryElement->SetAge(0);
|
||||
sceneryElement->SetPrimaryColour(primaryColour);
|
||||
|
@ -530,6 +529,12 @@ uint8_t SmallSceneryElement::GetSceneryQuadrant() const
|
|||
return (this->type & TILE_ELEMENT_QUADRANT_MASK) >> 6;
|
||||
}
|
||||
|
||||
void SmallSceneryElement::SetSceneryQuadrant(uint8_t newQuadrant)
|
||||
{
|
||||
type &= ~TILE_ELEMENT_QUADRANT_MASK;
|
||||
type |= (newQuadrant << 6);
|
||||
}
|
||||
|
||||
uint8_t SmallSceneryElement::GetEntryIndex() const
|
||||
{
|
||||
return this->entryIndex;
|
||||
|
|
|
@ -54,11 +54,6 @@ bool TileElementBase::IsGhost() const
|
|||
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0;
|
||||
}
|
||||
|
||||
uint8_t WallElement::GetSlope() const
|
||||
{
|
||||
return (this->type & TILE_ELEMENT_QUADRANT_MASK) >> 6;
|
||||
}
|
||||
|
||||
bool tile_element_is_underground(rct_tile_element* tileElement)
|
||||
{
|
||||
do
|
||||
|
@ -83,11 +78,11 @@ BannerIndex tile_element_get_banner_index(rct_tile_element* tileElement)
|
|||
|
||||
return tileElement->AsLargeScenery()->GetBannerIndex();
|
||||
case TILE_ELEMENT_TYPE_WALL:
|
||||
sceneryEntry = get_wall_entry(tileElement->properties.wall.type);
|
||||
sceneryEntry = tileElement->AsWall()->GetEntry();
|
||||
if (sceneryEntry == nullptr || sceneryEntry->wall.scrolling_mode == 0xFF)
|
||||
return BANNER_INDEX_NULL;
|
||||
|
||||
return tileElement->properties.wall.banner_index;
|
||||
return tileElement->AsWall()->GetBannerIndex();
|
||||
case TILE_ELEMENT_TYPE_BANNER:
|
||||
return tileElement->properties.banner.index;
|
||||
default:
|
||||
|
@ -100,7 +95,7 @@ void tile_element_set_banner_index(rct_tile_element* tileElement, BannerIndex ba
|
|||
switch (tileElement->GetType())
|
||||
{
|
||||
case TILE_ELEMENT_TYPE_WALL:
|
||||
tileElement->properties.wall.banner_index = bannerIndex;
|
||||
tileElement->AsWall()->SetBannerIndex(bannerIndex);
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
|
||||
tileElement->AsLargeScenery()->SetBannerIndex(bannerIndex);
|
||||
|
|
|
@ -64,19 +64,6 @@ struct rct_tile_element_entrance_properties
|
|||
};
|
||||
assert_struct_size(rct_tile_element_entrance_properties, 4);
|
||||
|
||||
struct rct_tile_element_wall_properties
|
||||
{
|
||||
uint8_t type; // 4
|
||||
union
|
||||
{
|
||||
uint8_t colour_3; // 5
|
||||
BannerIndex banner_index; // 5
|
||||
};
|
||||
uint8_t colour_1; // 6 0b_2221_1111 2 = colour_2 (uses flags for rest of colour2), 1 = colour_1
|
||||
uint8_t animation; // 7 0b_dfff_ft00 d = direction, f = frame num, t = across track flag (not used)
|
||||
};
|
||||
assert_struct_size(rct_tile_element_wall_properties, 4);
|
||||
|
||||
struct rct_tile_element_banner_properties
|
||||
{
|
||||
BannerIndex index; // 4
|
||||
|
@ -91,7 +78,6 @@ union rct_tile_element_properties
|
|||
rct_tile_element_path_properties path;
|
||||
rct_tile_element_track_properties track;
|
||||
rct_tile_element_entrance_properties entrance;
|
||||
rct_tile_element_wall_properties wall;
|
||||
rct_tile_element_banner_properties banner;
|
||||
};
|
||||
assert_struct_size(rct_tile_element_properties, 4);
|
||||
|
@ -263,6 +249,7 @@ public:
|
|||
void SetAge(uint8_t newAge);
|
||||
void IncreaseAge(int32_t x, int32_t y);
|
||||
uint8_t GetSceneryQuadrant() const;
|
||||
void SetSceneryQuadrant(uint8_t newQuadrant);
|
||||
colour_t GetPrimaryColour() const;
|
||||
void SetPrimaryColour(colour_t colour);
|
||||
colour_t GetSecondaryColour() const;
|
||||
|
@ -297,10 +284,44 @@ assert_struct_size(LargeSceneryElement, 8);
|
|||
|
||||
struct WallElement : TileElementBase
|
||||
{
|
||||
rct_tile_element_wall_properties temp;
|
||||
private:
|
||||
uint8_t entryIndex; // 4
|
||||
union
|
||||
{
|
||||
uint8_t colour_3; // 5
|
||||
BannerIndex banner_index; // 5
|
||||
};
|
||||
uint8_t colour_1; // 6 0b_2221_1111 2 = colour_2 (uses flags for rest of colour2), 1 = colour_1
|
||||
uint8_t animation; // 7 0b_dfff_ft00 d = direction, f = frame num, t = across track flag (not used)
|
||||
|
||||
public:
|
||||
uint8_t GetEntryIndex() const;
|
||||
void SetEntryIndex(uint8_t newIndex);
|
||||
rct_scenery_entry* GetEntry() const;
|
||||
|
||||
uint8_t GetSlope() const;
|
||||
void SetSlope(uint8_t newslope);
|
||||
|
||||
colour_t GetPrimaryColour() const;
|
||||
void SetPrimaryColour(colour_t newColour);
|
||||
colour_t GetSecondaryColour() const;
|
||||
void SetSecondaryColour(colour_t newColour);
|
||||
colour_t GetTertiaryColour() const;
|
||||
void SetTertiaryColour(colour_t newColour);
|
||||
|
||||
uint8_t GetAnimationFrame() const;
|
||||
void SetAnimationFrame(uint8_t frameNum);
|
||||
|
||||
BannerIndex GetBannerIndex() const;
|
||||
void SetBannerIndex(BannerIndex newIndex);
|
||||
|
||||
bool IsAcrossTrack() const;
|
||||
void SetAcrossTrack(bool acrossTrack);
|
||||
bool AnimationIsBackwards() const;
|
||||
void SetAnimationIsBackwards(bool isBackwards);
|
||||
|
||||
int32_t GetRCT1WallType(int32_t edge) const;
|
||||
colour_t GetRCT1WallColour() const;
|
||||
};
|
||||
assert_struct_size(WallElement, 8);
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ int32_t tile_inspector_insert_corrupt_at(int32_t x, int32_t y, int16_t elementIn
|
|||
log_warning("Failed to insert corrupt element.");
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
corruptElement->type = TILE_ELEMENT_TYPE_CORRUPT;
|
||||
corruptElement->SetType(TILE_ELEMENT_TYPE_CORRUPT);
|
||||
|
||||
// Set the base height to be the same as the selected element
|
||||
rct_tile_element* const selectedElement = map_get_nth_element_at(x, y, elementIndex + 1);
|
||||
|
@ -238,8 +238,7 @@ int32_t tile_inspector_rotate_element_at(int32_t x, int32_t y, int32_t elementIn
|
|||
{
|
||||
// Update element rotation
|
||||
newRotation = tileElement->GetDirectionWithOffset(1);
|
||||
tileElement->type &= ~TILE_ELEMENT_DIRECTION_MASK;
|
||||
tileElement->type |= newRotation;
|
||||
tileElement->SetDirection(newRotation);
|
||||
|
||||
// Update ride's known entrance/exit rotation
|
||||
Ride* ride = get_ride(tileElement->properties.entrance.ride_index);
|
||||
|
@ -264,8 +263,7 @@ int32_t tile_inspector_rotate_element_at(int32_t x, int32_t y, int32_t elementIn
|
|||
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
|
||||
case TILE_ELEMENT_TYPE_WALL:
|
||||
newRotation = tileElement->GetDirectionWithOffset(1);
|
||||
tileElement->type &= ~TILE_ELEMENT_DIRECTION_MASK;
|
||||
tileElement->type |= newRotation;
|
||||
tileElement->SetDirection(newRotation);
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_BANNER:
|
||||
{
|
||||
|
@ -708,8 +706,7 @@ int32_t tile_inspector_wall_set_slope(int32_t x, int32_t y, int32_t elementIndex
|
|||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
// Set new slope value
|
||||
wallElement->type &= ~0xC0;
|
||||
wallElement->type |= slopeValue;
|
||||
wallElement->AsWall()->SetSlope(slopeValue);
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
|
@ -994,8 +991,7 @@ int32_t tile_inspector_scenery_set_quarter_location(
|
|||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
// Set quadrant index
|
||||
tileElement->type &= ~TILE_ELEMENT_QUADRANT_MASK;
|
||||
tileElement->type |= quarterIndex << 6;
|
||||
tileElement->AsSmallScenery()->SetSceneryQuadrant(quarterIndex);
|
||||
|
||||
// Update collision
|
||||
tileElement->flags &= 0xF0;
|
||||
|
|
|
@ -512,26 +512,28 @@ static money32 WallPlace(
|
|||
map_animation_create(MAP_ANIMATION_TYPE_WALL, position.x, position.y, position.z / 8);
|
||||
|
||||
tileElement->clearance_height = clearanceHeight;
|
||||
tileElement->SetType(TILE_ELEMENT_TYPE_WALL);
|
||||
tileElement->SetDirection(edge);
|
||||
// TODO: Normalise the edge slope code.
|
||||
tileElement->AsWall()->SetSlope(edgeSlope >> 6);
|
||||
|
||||
tileElement->type = edgeSlope | edge | TILE_ELEMENT_TYPE_WALL;
|
||||
|
||||
wall_set_primary_colour(tileElement, primaryColour);
|
||||
wall_set_secondary_colour(tileElement, secondaryColour);
|
||||
tileElement->AsWall()->SetPrimaryColour(primaryColour);
|
||||
tileElement->AsWall()->SetSecondaryColour(secondaryColour);
|
||||
|
||||
if (wallAcrossTrack)
|
||||
{
|
||||
tileElement->properties.wall.animation |= WALL_ANIMATION_FLAG_ACROSS_TRACK;
|
||||
tileElement->AsWall()->SetAcrossTrack(true);
|
||||
}
|
||||
|
||||
tileElement->properties.wall.type = wallType;
|
||||
tileElement->AsWall()->SetEntryIndex(wallType);
|
||||
if (bannerIndex != 0xFF)
|
||||
{
|
||||
tileElement->properties.wall.banner_index = bannerIndex;
|
||||
tileElement->AsWall()->SetBannerIndex(bannerIndex);
|
||||
}
|
||||
|
||||
if (wallEntry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
|
||||
{
|
||||
wall_set_tertiary_colour(tileElement, tertiaryColour);
|
||||
tileElement->AsWall()->SetTertiaryColour(tertiaryColour);
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST)
|
||||
|
@ -582,13 +584,13 @@ static money32 WallSetColour(
|
|||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
rct_scenery_entry* scenery_entry = get_wall_entry(wallElement->properties.wall.type);
|
||||
wall_set_primary_colour(wallElement, primaryColour);
|
||||
wall_set_secondary_colour(wallElement, secondaryColour);
|
||||
rct_scenery_entry* scenery_entry = wallElement->AsWall()->GetEntry();
|
||||
wallElement->AsWall()->SetPrimaryColour(primaryColour);
|
||||
wallElement->AsWall()->SetSecondaryColour(secondaryColour);
|
||||
|
||||
if (scenery_entry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
|
||||
{
|
||||
wall_set_tertiary_colour(wallElement, tertiaryColour);
|
||||
wallElement->AsWall()->SetTertiaryColour(tertiaryColour);
|
||||
}
|
||||
map_invalidate_tile_zoom1(x, y, z, z + 72);
|
||||
}
|
||||
|
@ -596,56 +598,6 @@ static money32 WallSetColour(
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint8_t wall_get_animation_frame(const rct_tile_element* wallElement)
|
||||
{
|
||||
return (wallElement->properties.wall.animation >> 3) & 0xF;
|
||||
}
|
||||
|
||||
void wall_set_animation_frame(rct_tile_element* wallElement, uint8_t frameNum)
|
||||
{
|
||||
wallElement->properties.wall.animation &= WALL_ANIMATION_FLAG_ALL_FLAGS;
|
||||
wallElement->properties.wall.animation |= (frameNum & 0xF) << 3;
|
||||
}
|
||||
|
||||
colour_t wall_get_primary_colour(const rct_tile_element* tileElement)
|
||||
{
|
||||
return tileElement->properties.wall.colour_1 & TILE_ELEMENT_COLOUR_MASK;
|
||||
}
|
||||
|
||||
colour_t wall_get_secondary_colour(const rct_tile_element* wallElement)
|
||||
{
|
||||
uint8_t secondaryColour = (wallElement->properties.wall.colour_1 & ~TILE_ELEMENT_COLOUR_MASK) >> 5;
|
||||
secondaryColour |= (wallElement->flags & 0x60) >> 2;
|
||||
return secondaryColour;
|
||||
}
|
||||
|
||||
colour_t wall_get_tertiary_colour(const rct_tile_element* tileElement)
|
||||
{
|
||||
return tileElement->properties.wall.colour_3 & TILE_ELEMENT_COLOUR_MASK;
|
||||
}
|
||||
|
||||
void wall_set_primary_colour(rct_tile_element* tileElement, colour_t colour)
|
||||
{
|
||||
assert(colour <= 31);
|
||||
tileElement->properties.wall.colour_1 &= ~TILE_ELEMENT_COLOUR_MASK;
|
||||
tileElement->properties.wall.colour_1 |= colour;
|
||||
}
|
||||
|
||||
void wall_set_secondary_colour(rct_tile_element* wallElement, colour_t secondaryColour)
|
||||
{
|
||||
wallElement->properties.wall.colour_1 &= TILE_ELEMENT_COLOUR_MASK;
|
||||
wallElement->properties.wall.colour_1 |= (secondaryColour & 0x7) << 5;
|
||||
wallElement->flags &= ~0x60;
|
||||
wallElement->flags |= (secondaryColour & 0x18) << 2;
|
||||
}
|
||||
|
||||
void wall_set_tertiary_colour(rct_tile_element* tileElement, colour_t colour)
|
||||
{
|
||||
assert(colour <= 31);
|
||||
tileElement->properties.wall.colour_3 &= ~TILE_ELEMENT_COLOUR_MASK;
|
||||
tileElement->properties.wall.colour_3 |= colour;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E588E
|
||||
|
@ -749,3 +701,113 @@ void game_command_set_wall_colour(
|
|||
*eax & 0xFFFF, *ecx & 0xFFFF, (*edx >> 8) & 0xFF, *edx & 0xFF, (*ebx >> 8) & 0xFF, *ebp & 0xFF, (*ebp >> 8) & 0xFF,
|
||||
*ebx & 0xFF);
|
||||
}
|
||||
|
||||
uint8_t WallElement::GetSlope() const
|
||||
{
|
||||
return (type & TILE_ELEMENT_QUADRANT_MASK) >> 6;
|
||||
}
|
||||
|
||||
void WallElement::SetSlope(uint8_t newSlope)
|
||||
{
|
||||
type &= ~TILE_ELEMENT_QUADRANT_MASK;
|
||||
type |= (newSlope << 6);
|
||||
}
|
||||
|
||||
colour_t WallElement::GetPrimaryColour() const
|
||||
{
|
||||
return colour_1 & TILE_ELEMENT_COLOUR_MASK;
|
||||
}
|
||||
|
||||
colour_t WallElement::GetSecondaryColour() const
|
||||
{
|
||||
uint8_t secondaryColour = (colour_1 & ~TILE_ELEMENT_COLOUR_MASK) >> 5;
|
||||
secondaryColour |= (flags & 0x60) >> 2;
|
||||
return secondaryColour;
|
||||
}
|
||||
|
||||
colour_t WallElement::GetTertiaryColour() const
|
||||
{
|
||||
return colour_3 & TILE_ELEMENT_COLOUR_MASK;
|
||||
}
|
||||
|
||||
void WallElement::SetPrimaryColour(colour_t newColour)
|
||||
{
|
||||
assert(newColour <= 31);
|
||||
colour_1 &= ~TILE_ELEMENT_COLOUR_MASK;
|
||||
colour_1 |= newColour;
|
||||
}
|
||||
|
||||
void WallElement::SetSecondaryColour(colour_t newColour)
|
||||
{
|
||||
colour_1 &= TILE_ELEMENT_COLOUR_MASK;
|
||||
colour_1 |= (newColour & 0x7) << 5;
|
||||
flags &= ~0x60;
|
||||
flags |= (newColour & 0x18) << 2;
|
||||
}
|
||||
|
||||
void WallElement::SetTertiaryColour(colour_t newColour)
|
||||
{
|
||||
assert(newColour <= 31);
|
||||
colour_3 &= ~TILE_ELEMENT_COLOUR_MASK;
|
||||
colour_3 |= newColour;
|
||||
}
|
||||
|
||||
uint8_t WallElement::GetAnimationFrame() const
|
||||
{
|
||||
return (animation >> 3) & 0xF;
|
||||
}
|
||||
|
||||
void WallElement::SetAnimationFrame(uint8_t frameNum)
|
||||
{
|
||||
animation &= WALL_ANIMATION_FLAG_ALL_FLAGS;
|
||||
animation |= (frameNum & 0xF) << 3;
|
||||
}
|
||||
|
||||
uint8_t WallElement::GetEntryIndex() const
|
||||
{
|
||||
return entryIndex;
|
||||
}
|
||||
|
||||
rct_scenery_entry* WallElement::GetEntry() const
|
||||
{
|
||||
return get_wall_entry(entryIndex);
|
||||
}
|
||||
|
||||
void WallElement::SetEntryIndex(uint8_t newIndex)
|
||||
{
|
||||
entryIndex = newIndex;
|
||||
}
|
||||
|
||||
BannerIndex WallElement::GetBannerIndex() const
|
||||
{
|
||||
return banner_index;
|
||||
}
|
||||
|
||||
void WallElement::SetBannerIndex(BannerIndex newIndex)
|
||||
{
|
||||
banner_index = newIndex;
|
||||
}
|
||||
|
||||
bool WallElement::IsAcrossTrack() const
|
||||
{
|
||||
return (animation & WALL_ANIMATION_FLAG_ACROSS_TRACK) != 0;
|
||||
}
|
||||
|
||||
void WallElement::SetAcrossTrack(bool acrossTrack)
|
||||
{
|
||||
animation &= ~WALL_ANIMATION_FLAG_ACROSS_TRACK;
|
||||
if (acrossTrack)
|
||||
animation |= WALL_ANIMATION_FLAG_ACROSS_TRACK;
|
||||
}
|
||||
|
||||
bool WallElement::AnimationIsBackwards() const
|
||||
{
|
||||
return (animation & WALL_ANIMATION_FLAG_DIRECTION_BACKWARD) != 0;
|
||||
}
|
||||
|
||||
void WallElement::SetAnimationIsBackwards(bool isBackwards)
|
||||
{
|
||||
animation &= ~WALL_ANIMATION_FLAG_DIRECTION_BACKWARD;
|
||||
if (isBackwards)
|
||||
animation |= WALL_ANIMATION_FLAG_DIRECTION_BACKWARD;
|
||||
}
|
|
@ -20,13 +20,4 @@ enum
|
|||
WALL_ANIMATION_FLAG_ALL_FLAGS = WALL_ANIMATION_FLAG_ACROSS_TRACK | WALL_ANIMATION_FLAG_DIRECTION_BACKWARD
|
||||
};
|
||||
|
||||
colour_t wall_get_primary_colour(const rct_tile_element* tileElement);
|
||||
colour_t wall_get_secondary_colour(const rct_tile_element* wallElement);
|
||||
colour_t wall_get_tertiary_colour(const rct_tile_element* tileElement);
|
||||
void wall_set_primary_colour(rct_tile_element* tileElement, colour_t colour);
|
||||
void wall_set_secondary_colour(rct_tile_element* wallElement, colour_t secondaryColour);
|
||||
void wall_set_tertiary_colour(rct_tile_element* tileElement, colour_t colour);
|
||||
uint8_t wall_get_animation_frame(const rct_tile_element* fenceElement);
|
||||
void wall_set_animation_frame(rct_tile_element* wallElement, uint8_t frameNum);
|
||||
|
||||
money32 wall_remove(int16_t x, int16_t y, uint8_t baseHeight, uint8_t direction, uint8_t flags);
|
||||
|
|
Loading…
Reference in New Issue