mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #4746 from marijnvdwerf/fix/supports
Fix scenery segments
This commit is contained in:
commit
a4f9d41f57
|
@ -98,7 +98,7 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
}
|
||||
} else {
|
||||
// 6DFFC2:
|
||||
uint32 ecx = ((mapElement->type >> 6) + rotation) & 3;
|
||||
uint8 ecx = (map_element_get_scenery_quadrant(mapElement) + rotation) & 3;
|
||||
x_offset = ScenerySubTileOffsets[ecx].x;
|
||||
y_offset = ScenerySubTileOffsets[ecx].y;
|
||||
boxoffset.x = x_offset;
|
||||
|
@ -293,11 +293,12 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (!(entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) {
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) {
|
||||
// 6E075C:
|
||||
uint8 direction = (map_element_get_scenery_quadrant(mapElement) + rotation) % 4;
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), height, 0x20);
|
||||
return;
|
||||
}
|
||||
// 6E075C:
|
||||
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)) {
|
||||
|
@ -307,9 +308,9 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (!(entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) {
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) {
|
||||
uint8 direction = (map_element_get_scenery_quadrant(mapElement) + rotation) % 4;
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
|
||||
return;
|
||||
}
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, rotation), 0xFFFF, 0);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -34,11 +34,13 @@ attached_paint_struct * g_aps_F1AD2C;
|
|||
paint_string_struct * gPaintPSStringHead;
|
||||
static paint_string_struct * _paintLastPSString;
|
||||
|
||||
#define MAX_PAINT_QUADRANTS (512)
|
||||
|
||||
#ifdef NO_RCT2
|
||||
paint_entry gPaintStructs[4000];
|
||||
static uint32 _paintQuadrantBackIndex;
|
||||
static uint32 _paintQuadrantFrontIndex;
|
||||
static paint_struct *_paintQuadrants[512];
|
||||
static paint_struct *_paintQuadrants[MAX_PAINT_QUADRANTS];
|
||||
void *g_currently_drawn_item;
|
||||
paint_entry * gEndOfPaintStructArray;
|
||||
sint16 gUnk9DE568;
|
||||
|
@ -100,7 +102,7 @@ void paint_init(rct_drawpixelinfo * dpi)
|
|||
|
||||
static void paint_add_ps_to_quadrant(paint_struct * ps, sint32 positionHash)
|
||||
{
|
||||
uint32 paintQuadrantIndex = clamp(0, positionHash / 32, countof(_paintQuadrants) - 1);
|
||||
uint32 paintQuadrantIndex = clamp(0, positionHash / 32, MAX_PAINT_QUADRANTS - 1);
|
||||
|
||||
ps->var_18 = paintQuadrantIndex;
|
||||
ps->next_quadrant_ps = _paintQuadrants[paintQuadrantIndex];
|
||||
|
|
|
@ -1200,7 +1200,7 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol
|
|||
|
||||
gfx_draw_sprite(&clipdpi, imageId, 0x20, spriteTop, w->colours[1]);
|
||||
|
||||
if (sceneryEntry->small_scenery.flags & 0x200) {
|
||||
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_GLASS) {
|
||||
imageId = ((sceneryEntry->image + gWindowSceneryRotation) + 0x40000004) +
|
||||
((gWindowSceneryPrimaryColour + 0x70) << 19);
|
||||
|
||||
|
|
|
@ -245,6 +245,11 @@ int map_element_is_last_for_tile(const rct_map_element *element)
|
|||
return element->flags & MAP_ELEMENT_FLAG_LAST_TILE;
|
||||
}
|
||||
|
||||
uint8 map_element_get_scenery_quadrant(const rct_map_element *element)
|
||||
{
|
||||
return (element->type & MAP_ELEMENT_QUADRANT_MASK) >> 6;
|
||||
}
|
||||
|
||||
int map_element_get_type(const rct_map_element *element)
|
||||
{
|
||||
return element->type & MAP_ELEMENT_TYPE_MASK;
|
||||
|
|
|
@ -397,6 +397,7 @@ void map_update_tile_pointers();
|
|||
rct_map_element *map_get_first_element_at(int x, int y);
|
||||
void map_set_tile_elements(int x, int y, rct_map_element *elements);
|
||||
int map_element_is_last_for_tile(const rct_map_element *element);
|
||||
uint8 map_element_get_scenery_quadrant(const rct_map_element *element);
|
||||
int map_element_get_type(const rct_map_element *element);
|
||||
int map_element_get_direction(const rct_map_element *element);
|
||||
int map_element_get_terrain(const rct_map_element *element);
|
||||
|
|
Loading…
Reference in New Issue