mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Move animation frame and rct1 wall functions to methods
This commit is contained in:
@@ -212,7 +212,7 @@ 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;
|
||||
uint32_t imageId;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
@@ -2573,11 +2571,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 +2893,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 +2911,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);
|
||||
}
|
||||
|
||||
@@ -7454,14 +7454,14 @@ 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()->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()->SetAnimationFrame(6);
|
||||
vehicle_play_scenery_door_close_sound(vehicle, tileElement);
|
||||
}
|
||||
}
|
||||
@@ -7534,14 +7534,14 @@ 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()->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()->SetAnimationFrame(6);
|
||||
vehicle_play_scenery_door_close_sound(vehicle, tileElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -317,6 +317,12 @@ public:
|
||||
void SetSecondaryColour(colour_t newColour);
|
||||
colour_t GetTertiaryColour() const;
|
||||
void SetTertiaryColour(colour_t newColour);
|
||||
|
||||
uint8_t GetAnimationFrame() const;
|
||||
void SetAnimationFrame(uint8_t frameNum);
|
||||
|
||||
int32_t GetRCT1WallType(int32_t edge) const;
|
||||
colour_t GetRCT1WallColour() const;
|
||||
};
|
||||
assert_struct_size(WallElement, 8);
|
||||
|
||||
|
||||
@@ -596,17 +596,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;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E588E
|
||||
@@ -759,4 +748,15 @@ 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;
|
||||
}
|
||||
@@ -20,7 +20,4 @@ enum
|
||||
WALL_ANIMATION_FLAG_ALL_FLAGS = WALL_ANIMATION_FLAG_ACROSS_TRACK | WALL_ANIMATION_FLAG_DIRECTION_BACKWARD
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user