mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 04:23:20 +01:00
Refactor of footpath labeling enums
This commit is contained in:
@@ -27,7 +27,7 @@ extern "C"
|
||||
void FootpathObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
|
||||
{
|
||||
stream->Seek(10, STREAM_SEEK_CURRENT);
|
||||
_legacyType.var_0A = stream->ReadValue<uint8>();
|
||||
_legacyType.support_type = stream->ReadValue<uint8>();
|
||||
_legacyType.flags = stream->ReadValue<uint8>();
|
||||
_legacyType.scrolling_mode = stream->ReadValue<uint8>();
|
||||
stream->Seek(1, STREAM_SEEK_CURRENT);
|
||||
@@ -36,9 +36,9 @@ void FootpathObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
|
||||
GetImageTable()->Read(context, stream);
|
||||
|
||||
// Validate properties
|
||||
if (_legacyType.var_0A > 1)
|
||||
if (_legacyType.support_type >= FOOTPATH_ENTRY_SUPPORT_TYPE_COUNT)
|
||||
{
|
||||
context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "VAR_0A can not be greater than 1.");
|
||||
context->LogError(OBJECT_ERROR_INVALID_PROPERTY, "SUPPORT_TYPE not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,9 +82,9 @@ const uint8 byte_98D8A4[] = {
|
||||
0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0
|
||||
};
|
||||
|
||||
void loc_6A37C9(rct_map_element * mapElement, sint32 height, rct_footpath_entry * footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags);
|
||||
void path_paint_pole_support(rct_map_element * mapElement, sint32 height, rct_footpath_entry * footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags);
|
||||
|
||||
void loc_6A3B57(rct_map_element* mapElement, sint16 height, rct_footpath_entry* footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags);
|
||||
void path_paint_box_support(rct_map_element* mapElement, sint16 height, rct_footpath_entry* footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags);
|
||||
|
||||
/* rct2: 0x006A5AE5 */
|
||||
static void path_bit_lights_paint(rct_scenery_entry* pathBitEntry, rct_map_element* mapElement, sint32 height, uint8 edges, uint32 pathBitImageFlags) {
|
||||
@@ -287,7 +287,7 @@ static void path_bit_jumping_fountains_paint(rct_scenery_entry* pathBitEntry, rc
|
||||
*/
|
||||
static void sub_6A4101(rct_map_element * map_element, uint16 height, uint32 ebp, bool word_F3F038, rct_footpath_entry * footpathEntry, uint32 base_image_id, uint32 imageFlags)
|
||||
{
|
||||
if (map_element->type & 1) {
|
||||
if (footpath_element_is_queue(map_element)) {
|
||||
uint8 local_ebp = ebp & 0x0F;
|
||||
if (footpath_element_is_sloped(map_element)) {
|
||||
switch ((map_element->properties.path.type + get_current_rotation()) & 0x03) {
|
||||
@@ -429,7 +429,7 @@ static void sub_6A4101(rct_map_element * map_element, uint16 height, uint32 ebp,
|
||||
|
||||
// save ecx, ebp, esi
|
||||
uint32 dword_F3EF80 = ebp;
|
||||
if (!(footpathEntry->flags & FOOTPATH_ENTRY_FLAG_2)) {
|
||||
if (!(footpathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE)) {
|
||||
dword_F3EF80 &= 0x0F;
|
||||
}
|
||||
|
||||
@@ -680,7 +680,7 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
|
||||
uint32 imageFlags = 0;
|
||||
|
||||
if (gTrackDesignSaveMode) {
|
||||
if (map_element->type & 1) {
|
||||
if (footpath_element_is_queue(map_element)) {
|
||||
if (map_element->properties.path.ride_index != gTrackDesignSaveRideIndex) {
|
||||
return;
|
||||
}
|
||||
@@ -767,10 +767,10 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
|
||||
uint8 pathType = (map_element->properties.path.type & 0xF0) >> 4;
|
||||
rct_footpath_entry * footpathEntry = gFootpathEntries[pathType];
|
||||
|
||||
if (footpathEntry->var_0A == 0) {
|
||||
loc_6A37C9(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
|
||||
if (footpathEntry->support_type == FOOTPATH_ENTRY_SUPPORT_TYPE_POLE) {
|
||||
path_paint_pole_support(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
|
||||
} else {
|
||||
loc_6A3B57(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
|
||||
path_paint_box_support(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
|
||||
}
|
||||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
@@ -796,7 +796,7 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
|
||||
#endif
|
||||
}
|
||||
|
||||
void loc_6A37C9(rct_map_element * mapElement, sint32 height, rct_footpath_entry * footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags)
|
||||
void path_paint_pole_support(rct_map_element * mapElement, sint32 height, rct_footpath_entry * footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags)
|
||||
{
|
||||
// Rol edges around rotation
|
||||
uint8 edges = ((mapElement->properties.path.edges << get_current_rotation()) & 0xF) |
|
||||
@@ -819,7 +819,7 @@ void loc_6A37C9(rct_map_element * mapElement, sint32 height, rct_footpath_entry
|
||||
}
|
||||
|
||||
imageId += footpathEntry->image;
|
||||
if (mapElement->type & 1) {
|
||||
if (footpath_element_is_queue(mapElement)) {
|
||||
imageId += 51;
|
||||
}
|
||||
|
||||
@@ -842,7 +842,7 @@ void loc_6A37C9(rct_map_element * mapElement, sint32 height, rct_footpath_entry
|
||||
|
||||
sub_98197C(image_id | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
|
||||
|
||||
if (!(mapElement->type & 1) && !(footpathEntry->flags & FOOTPATH_ENTRY_FLAG_2)) {
|
||||
if (!footpath_element_is_queue(mapElement) && !(footpathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE)) {
|
||||
// don't draw
|
||||
} else {
|
||||
sub_98199C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
|
||||
@@ -870,7 +870,7 @@ void loc_6A37C9(rct_map_element * mapElement, sint32 height, rct_footpath_entry
|
||||
|
||||
paint_util_set_general_support_height(height, 0x20);
|
||||
|
||||
if ((mapElement->type & 1)
|
||||
if (footpath_element_is_queue(mapElement)
|
||||
|| (mapElement->properties.path.edges != 0xFF && hasFences)
|
||||
) {
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
@@ -901,7 +901,7 @@ void loc_6A37C9(rct_map_element * mapElement, sint32 height, rct_footpath_entry
|
||||
}
|
||||
}
|
||||
|
||||
void loc_6A3B57(rct_map_element* mapElement, sint16 height, rct_footpath_entry* footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags)
|
||||
void path_paint_box_support(rct_map_element* mapElement, sint16 height, rct_footpath_entry* footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags)
|
||||
{
|
||||
// Rol edges around rotation
|
||||
uint8 edges = ((mapElement->properties.path.edges << get_current_rotation()) & 0xF) |
|
||||
@@ -932,7 +932,7 @@ void loc_6A3B57(rct_map_element* mapElement, sint16 height, rct_footpath_entry*
|
||||
|
||||
|
||||
imageId += footpathEntry->image;
|
||||
if (mapElement->type & 1) {
|
||||
if (footpath_element_is_queue(mapElement)) {
|
||||
imageId += 51;
|
||||
}
|
||||
|
||||
@@ -959,7 +959,7 @@ void loc_6A3B57(rct_map_element* mapElement, sint16 height, rct_footpath_entry*
|
||||
|
||||
sub_98197C(bridgeImage | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
|
||||
|
||||
if ((mapElement->type & 1) || (footpathEntry->flags & FOOTPATH_ENTRY_FLAG_2)) {
|
||||
if (footpath_element_is_queue(mapElement) || (footpathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE)) {
|
||||
sub_98199C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
|
||||
}
|
||||
}
|
||||
@@ -991,7 +991,7 @@ void loc_6A3B57(rct_map_element* mapElement, sint16 height, rct_footpath_entry*
|
||||
|
||||
paint_util_set_general_support_height(height, 0x20);
|
||||
|
||||
if ((mapElement->type & 1)
|
||||
if (footpath_element_is_queue(mapElement)
|
||||
|| (mapElement->properties.path.edges != 0xFF && hasFences)
|
||||
) {
|
||||
|
||||
|
||||
@@ -1275,7 +1275,7 @@ bool path_b_supports_paint_setup(sint32 segment, sint32 special, sint32 height,
|
||||
|
||||
if ((gSupportSegments[segment].slope & 0x20)
|
||||
|| (height - gSupportSegments[segment].height < 6)
|
||||
|| !(pathEntry->flags & FOOTPATH_ENTRY_FLAG_1)) {
|
||||
|| !(pathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE)) {
|
||||
baseHeight = gSupportSegments[segment].height;
|
||||
} else {
|
||||
uint8 imageOffset = metal_supports_slope_image_map[gSupportSegments[segment].slope & 0x1F];
|
||||
|
||||
@@ -32,7 +32,7 @@ typedef struct rct_footpath_entry {
|
||||
rct_string_id string_idx; // 0x00
|
||||
uint32 image; // 0x02
|
||||
uint32 bridge_image; // 0x06
|
||||
uint8 var_0A;
|
||||
uint8 support_type; // 0x0A
|
||||
uint8 flags; // 0x0B
|
||||
uint8 scrolling_mode; // 0x0C
|
||||
} rct_footpath_entry;
|
||||
@@ -40,8 +40,14 @@ assert_struct_size(rct_footpath_entry, 13);
|
||||
#pragma pack(pop)
|
||||
|
||||
enum {
|
||||
FOOTPATH_ENTRY_FLAG_1 = (1 << 0),
|
||||
FOOTPATH_ENTRY_FLAG_2 = (1 << 1),
|
||||
FOOTPATH_ENTRY_SUPPORT_TYPE_POLE = 0,
|
||||
FOOTPATH_ENTRY_SUPPORT_TYPE_BOX = 1,
|
||||
FOOTPATH_ENTRY_SUPPORT_TYPE_COUNT
|
||||
};
|
||||
|
||||
enum {
|
||||
FOOTPATH_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE = (1 << 0),
|
||||
FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE = (1 << 1), //When elevated
|
||||
FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR = (1 << 2),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user