mirror of https://github.com/OpenRCT2/OpenRCT2.git
Cache rotation value in scenery_paint
This commit is contained in:
parent
b568f002d4
commit
a7cd10a7f7
|
@ -51,6 +51,7 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
boxoffset.y = 0;
|
||||
boxoffset.z = height;
|
||||
int baseImageid = 0;
|
||||
const int rotation = get_current_rotation();
|
||||
if (gTrackDesignSaveMode) {
|
||||
if (!track_design_save_contains_map_element(mapElement)) {
|
||||
baseImageid = 0x21700000;
|
||||
|
@ -97,7 +98,7 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
}
|
||||
} else {
|
||||
// 6DFFC2:
|
||||
uint32 ecx = ((mapElement->type >> 6) + get_current_rotation()) & 3;
|
||||
uint32 ecx = ((mapElement->type >> 6) + rotation) & 3;
|
||||
x_offset = ScenerySubTileOffsets[ecx].x;
|
||||
y_offset = ScenerySubTileOffsets[ecx].y;
|
||||
boxoffset.x = x_offset;
|
||||
|
@ -126,14 +127,14 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
baseImageid = (baseImageid & 0x7FFFF) | dword_F64EB0;
|
||||
}
|
||||
if (!(entry->small_scenery.flags & SMALL_SCENERY_FLAG21)) {
|
||||
sub_98197C(baseImageid, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98197C(baseImageid, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
}
|
||||
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_GLASS) {
|
||||
if (dword_F64EB0 == 0) {
|
||||
// Draw translucent overlay:
|
||||
int image_id = (baseImageid & 0x7FFFF) + (((mapElement->properties.scenery.colour_1 & 0x1F) + 112) << 19) + 0x40000004;
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +148,7 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
if (dword_F64EB0 != 0) {
|
||||
image_id = (image_id & 0x7FFFF) | dword_F64EB0;
|
||||
}
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
} else
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG13) {
|
||||
// 6E043B:
|
||||
|
@ -155,19 +156,19 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
if (dword_F64EB0 != 0) {
|
||||
image_id = (image_id & 0x7FFFF) | dword_F64EB0;
|
||||
}
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
|
||||
image_id = direction + entry->image + 4;
|
||||
if (dword_F64EB0 != 0) {
|
||||
image_id = (image_id & 0x7FFFF) | dword_F64EB0;
|
||||
}
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
|
||||
image_id = ((gCurrentTicks / 2) & 0xF) + entry->image + 24;
|
||||
if (dword_F64EB0 != 0) {
|
||||
image_id = (image_id & 0x7FFFF) | dword_F64EB0;
|
||||
}
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
} else
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_IS_CLOCK) {
|
||||
// 6E035C:
|
||||
|
@ -189,7 +190,7 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
if (dword_F64EB0 != 0) {
|
||||
image_id = (image_id & 0x7FFFF) | dword_F64EB0;
|
||||
}
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
|
||||
image_id = gRealTimeOfDay.minute + (direction * 15);
|
||||
if (image_id >= 60) {
|
||||
|
@ -199,7 +200,7 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
if (dword_F64EB0 != 0) {
|
||||
image_id = (image_id & 0x7FFFF) | dword_F64EB0;
|
||||
}
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
} else
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG15) {
|
||||
// 6E02F6:
|
||||
|
@ -211,7 +212,7 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
if (dword_F64EB0 != 0) {
|
||||
image_id = (image_id & 0x7FFFF) | dword_F64EB0;
|
||||
}
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
} else {
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG16) {
|
||||
// nothing
|
||||
|
@ -245,9 +246,9 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
image_id = (image_id & 0x7FFFF) | dword_F64EB0;
|
||||
}
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG21) {
|
||||
sub_98197C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98197C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
} else {
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
sub_98199C(image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -296,7 +297,7 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
return;
|
||||
}
|
||||
// 6E075C:
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, get_current_rotation()), height, 0x20);
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, rotation), height, 0x20);
|
||||
return;
|
||||
}
|
||||
if (entry->small_scenery.flags & (SMALL_SCENERY_FLAG27 | SMALL_SCENERY_FLAG_FULL_TILE)) {
|
||||
|
@ -309,6 +310,6 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
if (!(entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) {
|
||||
return;
|
||||
}
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, get_current_rotation()), 0xFFFF, 0);
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, rotation), 0xFFFF, 0);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue