diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 73d9dedd10..f553fb0a0e 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #define WINDOW_SCENERY_WIDTH 634 #define WINDOW_SCENERY_HEIGHT 180 @@ -935,7 +936,7 @@ void window_scenery_invalidate(rct_window *w) } rct_scenery_entry* sceneryEntry = get_small_scenery_entry(tabSelectedSceneryId); - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_ROTATABLE) { + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_ROTATABLE)) { window_scenery_widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WWT_FLATBTN; } } @@ -993,10 +994,11 @@ void window_scenery_invalidate(rct_window *w) } else if (tabSelectedSceneryId < 0x100) { sceneryEntry = get_small_scenery_entry(tabSelectedSceneryId); - if (sceneryEntry->small_scenery.flags & (SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS)) { + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS)) + { window_scenery_widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WWT_COLOURBTN; - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR) + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) window_scenery_widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WWT_COLOURBTN; } } @@ -1194,31 +1196,31 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 sc sceneryEntry = get_small_scenery_entry(currentSceneryGlobalId); uint32 imageId = sceneryEntry->image + gWindowSceneryRotation; - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR) { + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR)) { imageId |= (gWindowSceneryPrimaryColour << 19) | IMAGE_TYPE_REMAP; - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR) { + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) { imageId |= (gWindowScenerySecondaryColour << 24) | IMAGE_TYPE_REMAP_2_PLUS; } } uint16 spriteTop = (sceneryEntry->small_scenery.height / 4) + 0x2B; - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE && - sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) { + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_FULL_TILE) && + scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) { spriteTop -= 0x0C; } gfx_draw_sprite(&clipdpi, imageId, 0x20, spriteTop, w->colours[1]); - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_GLASS) { + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_HAS_GLASS)) { imageId = ((sceneryEntry->image + gWindowSceneryRotation) + 0x40000004) + (GlassPaletteIds[gWindowSceneryPrimaryColour] << 19); gfx_draw_sprite(&clipdpi, imageId, 0x20, spriteTop, w->colours[1]); } - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_ANIMATED_FG) { + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_ANIMATED_FG)) { imageId = (sceneryEntry->image + gWindowSceneryRotation) + 4; gfx_draw_sprite(&clipdpi, imageId, 0x20, spriteTop, w->colours[1]); } diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index a5af71bc8f..54da6d48bd 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include static const rct_string_id TerrainTypeStringIds[] = { @@ -1754,7 +1755,9 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SCENERY_AGE, &age, COLOUR_DARK_GREEN, x, y); // Quadrant value - if (!(get_small_scenery_entry(tileElement->properties.scenery.type)->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)) { + const rct_scenery_entry * sceneryEntry = get_small_scenery_entry(tileElement->properties.scenery.type); + if (!(scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_FULL_TILE))) + { sint16 quadrant = (tileElement->type & TILE_ELEMENT_QUADRANT_MASK) >> 6; static rct_string_id quadrant_string_idx[] = { STR_TILE_INSPECTOR_SCENERY_QUADRANT_SW, diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 1ae68f82a4..693b218fa6 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -955,9 +955,7 @@ static void repaint_scenery_tool_down(sint16 x, sint16 y, rct_widgetindex widget rct_scenery_entry* scenery_entry = get_small_scenery_entry(tile_element->properties.scenery.type); // If can't repaint - if (!(scenery_entry->small_scenery.flags & - (SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | - SMALL_SCENERY_FLAG_HAS_GLASS))) + if (!scenery_small_entry_has_flag(scenery_entry, SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS)) return; gGameCommandErrorTitle = STR_CANT_REPAINT_THIS; @@ -1154,7 +1152,8 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid if (scenery_type == SCENERY_TYPE_SMALL) { rct_scenery_entry* scenery_entry = get_small_scenery_entry(selected_scenery); - if (scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_STACKABLE) { + if (scenery_small_entry_has_flag(scenery_entry, SMALL_SCENERY_FLAG_STACKABLE)) + { can_raise_item = true; } } @@ -1223,7 +1222,8 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid { // Small scenery rct_scenery_entry* scenery = get_small_scenery_entry(selected_scenery); - if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)) { + if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_FULL_TILE)) + { uint8 cl = 0; // If CTRL not pressed @@ -1272,7 +1272,8 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid uint8 rotation = gWindowSceneryRotation; - if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG_ROTATABLE)) { + if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_ROTATABLE)) + { rotation = util_rand() & 0xFF; } @@ -1345,7 +1346,8 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid *grid_y &= 0xFFE0; uint8 rotation = gWindowSceneryRotation; - if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG_ROTATABLE)) { + if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_ROTATABLE)) + { rotation = util_rand() & 0xFF; } @@ -1576,8 +1578,10 @@ static void window_top_toolbar_scenery_tool_down(sint16 x, sint16 y, rct_window sint16 cur_grid_x = gridX; sint16 cur_grid_y = gridY; - if (isCluster){ - if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)){ + if (isCluster) + { + if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_FULL_TILE)) + { parameter_2 &= 0xFF00; parameter_2 |= util_rand() & 3; } @@ -1585,7 +1589,8 @@ static void window_top_toolbar_scenery_tool_down(sint16 x, sint16 y, rct_window cur_grid_x += ((util_rand() % 16) - 8) * 32; cur_grid_y += ((util_rand() % 16) - 8) * 32; - if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG_ROTATABLE)){ + if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_ROTATABLE)) + { gSceneryPlaceRotation = (gSceneryPlaceRotation + 1) & 3; } } @@ -2408,7 +2413,8 @@ static void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ scenery = get_small_scenery_entry(selected_scenery); gMapSelectType = MAP_SELECT_TYPE_FULL; - if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE) && !gWindowSceneryClusterEnabled){ + if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_FULL_TILE) && !gWindowSceneryClusterEnabled) + { gMapSelectType = MAP_SELECT_TYPE_QUARTER_0 + ((parameter2 & 0xFF) ^ 2); } diff --git a/src/openrct2/object/SmallSceneryObject.cpp b/src/openrct2/object/SmallSceneryObject.cpp index 806cb5bac5..2836d9ca73 100644 --- a/src/openrct2/object/SmallSceneryObject.cpp +++ b/src/openrct2/object/SmallSceneryObject.cpp @@ -23,6 +23,7 @@ #include "../drawing/drawing.h" #include "../localisation/language.h" #include "../world/scenery.h" +#include "../world/SmallScenery.h" SmallSceneryObject::~SmallSceneryObject() { @@ -48,7 +49,7 @@ void SmallSceneryObject::ReadLegacy(IReadObjectContext * context, IStream * stre rct_object_entry sgEntry = stream->ReadValue(); SetPrimarySceneryGroup(&sgEntry); - if (_legacyType.small_scenery.flags & SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS) + if (scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS)) { _frameOffsets = ReadFrameOffsets(stream); } @@ -79,7 +80,7 @@ void SmallSceneryObject::Load() _legacyType.small_scenery.scenery_tab_id = 0xFF; - if (_legacyType.small_scenery.flags & SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS) + if (scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS)) { _legacyType.small_scenery.frame_offsets = _frameOffsets; } @@ -98,12 +99,11 @@ void SmallSceneryObject::Unload() void SmallSceneryObject::DrawPreview(rct_drawpixelinfo * dpi, sint32 width, sint32 height) const { - uint32 flags = _legacyType.small_scenery.flags; uint32 imageId = _legacyType.image; - if (flags & SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR) + if (scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR)) { imageId |= 0x20D00000; - if (flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR) + if (scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) { imageId |= 0x92000000; } @@ -113,28 +113,28 @@ void SmallSceneryObject::DrawPreview(rct_drawpixelinfo * dpi, sint32 width, sint sint32 y = (height / 2) + (_legacyType.small_scenery.height / 2); y = Math::Min(y, height - 16); - if ((flags & SMALL_SCENERY_FLAG_FULL_TILE) && - (flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) + if ((scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_FULL_TILE)) && + (scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_VOFFSET_CENTRE))) { y -= 12; } gfx_draw_sprite(dpi, imageId, x, y, 0); - if (_legacyType.small_scenery.flags & SMALL_SCENERY_FLAG_HAS_GLASS) + if (scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_HAS_GLASS)) { imageId = _legacyType.image + 0x44500004; - if (flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR) + if (scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) { imageId |= 0x92000000; } gfx_draw_sprite(dpi, imageId, x, y, 0); } - if (flags & SMALL_SCENERY_FLAG_ANIMATED_FG) + if (scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_ANIMATED_FG)) { imageId = _legacyType.image + 4; - if (flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR) + if (scenery_small_entry_has_flag(&_legacyType, SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) { imageId |= 0x92000000; } diff --git a/src/openrct2/paint/tile_element/scenery.c b/src/openrct2/paint/tile_element/scenery.c index 9150365945..0b9a116e7c 100644 --- a/src/openrct2/paint/tile_element/scenery.c +++ b/src/openrct2/paint/tile_element/scenery.c @@ -76,8 +76,9 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ boxlength.y = 2; sint8 x_offset = 0; sint8 y_offset = 0; - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE) { - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HALF_SPACE) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_FULL_TILE)) + { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_HALF_SPACE)) { // 6DFFE3: boxoffset.x = offsets[direction].x; boxoffset.y = offsets[direction].y; @@ -88,12 +89,12 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ } else { x_offset = 15; y_offset = 15; - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) { x_offset = 3; y_offset = 3; boxlength.x = 26; boxlength.y = 26; - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_NO_WALLS) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_NO_WALLS)) { x_offset = 1; y_offset = 1; boxlength.x = 30; @@ -116,7 +117,8 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ if (boxlength.z > 128 || boxlength.z < 0) { boxlength.z = 128; } - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_CAN_WITHER) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_CAN_WITHER)) + { if (tileElement->properties.scenery.age >= 40) { baseImageid += 4; } @@ -124,9 +126,9 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ baseImageid += 4; } } - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR) + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR)) { - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR) + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) { baseImageid |= SPRITE_ID_PALETTE_COLOUR_2(scenery_small_get_primary_colour(tileElement), scenery_small_get_secondary_colour(tileElement)); @@ -139,11 +141,11 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ if (dword_F64EB0 != 0) { baseImageid = (baseImageid & 0x7FFFF) | dword_F64EB0; } - if (!(entry->small_scenery.flags & SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED)) { + if (!(scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED))) { sub_98197C(session, 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 (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_HAS_GLASS)) { if (dword_F64EB0 == 0) { // Draw translucent overlay: // TODO: Name palette entries @@ -152,11 +154,11 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ } } - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_ANIMATED) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_ANIMATED)) { rct_drawpixelinfo* dpi = session->Unk140E9A8; - if ( (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED) || (dpi->zoom_level <= 1) ) { + if ((scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED)) || (dpi->zoom_level <= 1)) { // 6E01A9: - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1)) { // 6E0512: sint32 image_id = ((gCurrentTicks / 2) & 0xF) + entry->image + 4; if (dword_F64EB0 != 0) { @@ -164,7 +166,7 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ } sub_98199C(session, 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_FOUNTAIN_SPRAY_4) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4)) { // 6E043B: sint32 image_id = ((gCurrentTicks / 2) & 0xF) + entry->image + 8; if (dword_F64EB0 != 0) { @@ -184,7 +186,7 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ } sub_98199C(session, 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) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_IS_CLOCK)) { // 6E035C: sint32 minuteImageOffset = ((gRealTimeOfDay.minute + 6) * 17) / 256; sint32 timeImageBase = gRealTimeOfDay.hour; @@ -216,7 +218,7 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ } sub_98199C(session, 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_SWAMP_GOO) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_SWAMP_GOO)) { // 6E02F6: sint32 image_id = gCurrentTicks; image_id += session->SpritePosition.x / 4; @@ -228,10 +230,10 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ } sub_98199C(session, 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_HAS_FRAME_OFFSETS) + else if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS)) { sint32 frame = gCurrentTicks; - if (!(entry->small_scenery.flags & SMALL_SCENERY_FLAG_COG)) { + if (!(scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_COG))) { // 6E01F8: frame += ((session->SpritePosition.x / 4) + (session->SpritePosition.y / 4)); frame += (tileElement->type & 0xC0) / 16; @@ -245,12 +247,12 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ image_id = entry->small_scenery.frame_offsets[frame]; } image_id = (image_id * 4) + direction + entry->image; - if (entry->small_scenery.flags & (SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED | SMALL_SCENERY_FLAG17)) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED | SMALL_SCENERY_FLAG17)) { image_id += 4; } - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR) + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR)) { - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR)) { image_id |= SPRITE_ID_PALETTE_COLOUR_2(scenery_small_get_primary_colour(tileElement), scenery_small_get_secondary_colour(tileElement)); } @@ -262,7 +264,7 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ if (dword_F64EB0 != 0) { image_id = (image_id & 0x7FFFF) | dword_F64EB0; } - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED)) { sub_98197C(session, image_id, x_offset, y_offset, boxlength.x, boxlength.y, boxlength.z - 1, height, boxoffset.x, boxoffset.y, boxoffset.z, rotation); } else { @@ -273,7 +275,7 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ } // 6E0556: Draw supports: if (scenery_small_get_supports_needed(tileElement)) { - if (!(entry->small_scenery.flags & SMALL_SCENERY_FLAG_NO_SUPPORTS)) { + if (!(scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_NO_SUPPORTS))) { sint32 ax = 0; sint32 supportHeight = height; if (supportHeight & 0xF) { @@ -281,7 +283,7 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ ax = 49; } uint32 supportImageColourFlags = IMAGE_TYPE_REMAP; - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_PAINT_SUPPORTS) + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_PAINT_SUPPORTS)) { supportImageColourFlags = SPRITE_ID_PALETTE_COLOUR_1(scenery_small_get_primary_colour(tileElement)); } @@ -300,16 +302,16 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ paint_util_set_general_support_height(session, ceil2(height, 8), 0x20); // 6E05FF: - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_BUILD_DIRECTLY_ONTOP) { - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_BUILD_DIRECTLY_ONTOP)) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_FULL_TILE)) { // 6E0825: paint_util_set_segment_support_height(session, SEGMENT_C4, height, 0x20); - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) { paint_util_set_segment_support_height(session, SEGMENTS_ALL & ~SEGMENT_C4, height, 0x20); } return; } - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) { // 6E075C: direction = (tile_element_get_scenery_quadrant(tileElement) + rotation) % 4; paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), height, 0x20); @@ -317,14 +319,14 @@ void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_ } return; } - if (entry->small_scenery.flags & (SMALL_SCENERY_FLAG27 | SMALL_SCENERY_FLAG_FULL_TILE)) { + if (scenery_small_entry_has_flag(entry, (SMALL_SCENERY_FLAG27 | SMALL_SCENERY_FLAG_FULL_TILE))) { paint_util_set_segment_support_height(session, SEGMENT_C4, 0xFFFF, 0); - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) { paint_util_set_segment_support_height(session, SEGMENTS_ALL & ~SEGMENT_C4, 0xFFFF, 0); } return; } - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) { + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) { direction = (tile_element_get_scenery_quadrant(tileElement) + rotation) % 4; paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0); return; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 1ab2b80db9..8afda2da6b 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -45,6 +45,7 @@ #include "../world/map.h" #include "../world/LargeScenery.h" #include "../world/scenery.h" +#include "../world/SmallScenery.h" #include "../world/sprite.h" #include "Peep.h" #include "Staff.h" @@ -5540,7 +5541,7 @@ static void peep_update_watering(rct_peep * peep) rct_scenery_entry * scenery_entry = get_small_scenery_entry(tile_element->properties.scenery.type); - if (!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_CAN_BE_WATERED)) + if (!scenery_small_entry_has_flag(scenery_entry, SMALL_SCENERY_FLAG_CAN_BE_WATERED)) continue; tile_element->properties.scenery.age = 0; @@ -6804,7 +6805,7 @@ static sint32 peep_update_patrolling_find_watering(rct_peep * peep) rct_scenery_entry * sceneryEntry = get_small_scenery_entry(tile_element->properties.scenery.type); - if (sceneryEntry == nullptr || !(sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_CAN_BE_WATERED)) + if (sceneryEntry == nullptr || !scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_CAN_BE_WATERED)) { continue; } diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index bc25dcd9de..559d2fb2c0 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -34,6 +34,7 @@ #include "../util/util.h" #include "../world/footpath.h" #include "../world/scenery.h" +#include "../world/SmallScenery.h" #include "ride.h" #include "ride_data.h" #include "Track.h" @@ -525,10 +526,10 @@ static void track_design_mirror_scenery(rct_track_td6 * td6) case OBJECT_TYPE_SMALL_SCENERY: scenery->y = -scenery->y; - if (scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_DIAGONAL) + if (scenery_small_entry_has_flag(scenery_entry, SMALL_SCENERY_FLAG_DIAGONAL)) { scenery->flags ^= (1 << 0); - if (!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)) + if (!scenery_small_entry_has_flag(scenery_entry, SMALL_SCENERY_FLAG_FULL_TILE)) { scenery->flags ^= (1 << 2); } @@ -802,11 +803,11 @@ track_design_place_scenery(rct_td6_scenery_element * scenery_start, uint8 rideIn uint8 bh = rotation | (quadrant << 6) | TILE_ELEMENT_TYPE_SMALL_SCENERY; rct_scenery_entry * small_scenery = get_small_scenery_entry(entry_index); - if (!(!(small_scenery->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE) && - (small_scenery->small_scenery.flags & SMALL_SCENERY_FLAG_DIAGONAL)) && - (small_scenery->small_scenery.flags & - (SMALL_SCENERY_FLAG_DIAGONAL | SMALL_SCENERY_FLAG_HALF_SPACE | - SMALL_SCENERY_FLAG_THREE_QUARTERS))) + if (!(!scenery_small_entry_has_flag(small_scenery, SMALL_SCENERY_FLAG_FULL_TILE) && + scenery_small_entry_has_flag(small_scenery, SMALL_SCENERY_FLAG_DIAGONAL)) && + scenery_small_entry_has_flag(small_scenery, + SMALL_SCENERY_FLAG_DIAGONAL | SMALL_SCENERY_FLAG_HALF_SPACE | + SMALL_SCENERY_FLAG_THREE_QUARTERS)) { bh &= 0x3F; } diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 33d34ef706..ad6add86f2 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -33,6 +33,7 @@ #include "../util/util.h" #include "../world/map_animation.h" #include "../world/scenery.h" +#include "../world/SmallScenery.h" #include "../world/sprite.h" #include "Vehicle.h" #include "CableLift.h" @@ -1836,7 +1837,7 @@ static void vehicle_update_measurements(rct_vehicle * vehicle) continue; rct_scenery_entry * scenery = get_small_scenery_entry(tile_element->properties.scenery.type); - if (scenery->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE) + if (scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_FULL_TILE)) { cover_found = true; break; diff --git a/src/openrct2/world/SmallScenery.cpp b/src/openrct2/world/SmallScenery.cpp index eb2c67195a..dcfc908d66 100644 --- a/src/openrct2/world/SmallScenery.cpp +++ b/src/openrct2/world/SmallScenery.cpp @@ -213,11 +213,10 @@ static money32 SmallSceneryPlace(sint16 x, return MONEY32_UNDEFINED; } - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE || - !(sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_DIAGONAL)) + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_FULL_TILE) || + !scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_DIAGONAL)) { - if (sceneryEntry->small_scenery.flags & - (SMALL_SCENERY_FLAG_DIAGONAL | SMALL_SCENERY_FLAG_HALF_SPACE | SMALL_SCENERY_FLAG_THREE_QUARTERS)) + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_DIAGONAL | SMALL_SCENERY_FLAG_HALF_SPACE | SMALL_SCENERY_FLAG_THREE_QUARTERS)) { quadrant = 0; } @@ -226,7 +225,7 @@ static money32 SmallSceneryPlace(sint16 x, // Check if sub tile height is any different compared to actual surface tile height sint32 x2 = x; sint32 y2 = y; - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE) + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_FULL_TILE)) { x2 += 16; y2 += 16; @@ -263,7 +262,7 @@ static money32 SmallSceneryPlace(sint16 x, if (flags & GAME_COMMAND_FLAG_APPLY && !(flags & GAME_COMMAND_FLAG_GHOST)) { footpath_remove_litter(x, y, targetHeight); - if (!gCheatsDisableClearanceChecks && (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_NO_WALLS)) + if (!gCheatsDisableClearanceChecks && (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_NO_WALLS))) { wall_remove_at(x, y, targetHeight, targetHeight + sceneryEntry->small_scenery.height); } @@ -281,7 +280,7 @@ static money32 SmallSceneryPlace(sint16 x, } } - if (!gCheatsDisableClearanceChecks && !(sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_STACKABLE)) + if (!gCheatsDisableClearanceChecks && !(scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_STACKABLE))) { if (isOnWater) { @@ -300,7 +299,7 @@ static money32 SmallSceneryPlace(sint16 x, } if (!gCheatsDisableClearanceChecks && - (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE) && + (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE)) && !supportsRequired && !isOnWater && surfaceElement != nullptr && @@ -312,7 +311,7 @@ static money32 SmallSceneryPlace(sint16 x, } if (!gCheatsDisableSupportLimits && - !(sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_STACKABLE) && + !(scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_STACKABLE)) && supportsRequired) { @@ -341,16 +340,16 @@ static money32 SmallSceneryPlace(sint16 x, sint32 zHigh = zLow + ceil2(sceneryEntry->small_scenery.height, 8) / 8; uint8 collisionQuadrants = 0xF; uint8 blSupports = 0; - if (!(sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)) + if (!(scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_FULL_TILE))) { collisionQuadrants = 1 << (quadrant ^ 2); } - if (!(sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HALF_SPACE)) + if (!(scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_HALF_SPACE))) { - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_DIAGONAL && - sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE) + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_DIAGONAL) && + scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_FULL_TILE)) { - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_THREE_QUARTERS) + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_THREE_QUARTERS)) { collisionQuadrants = 0xF & rol8(0xBB, ((quadrant ^ 2) + rotation) & 3); } @@ -429,7 +428,7 @@ static money32 SmallSceneryPlace(sint16 x, } map_invalidate_tile_full(x, y); - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_ANIMATED) + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_ANIMATED)) { map_animation_create(2, x, y, newElement->base_height); } @@ -596,4 +595,9 @@ extern "C" { tileElement->properties.scenery.colour_1 |= MAP_ELEM_SMALL_SCENERY_COLOUR_FLAG_NEEDS_SUPPORTS; } + + bool scenery_small_entry_has_flag(const rct_scenery_entry * sceneryEntry, uint32 flags) + { + return (bool)(sceneryEntry->small_scenery.flags & flags); + } } diff --git a/src/openrct2/world/SmallScenery.h b/src/openrct2/world/SmallScenery.h index 6655930a2b..5f5652ab54 100644 --- a/src/openrct2/world/SmallScenery.h +++ b/src/openrct2/world/SmallScenery.h @@ -16,11 +16,45 @@ #include "../common.h" #include "map.h" +#include "scenery.h" #ifdef __cplusplus extern "C" { #endif +typedef enum +{ + SMALL_SCENERY_FLAG_FULL_TILE = (1 << 0), // 0x1 + SMALL_SCENERY_FLAG_VOFFSET_CENTRE = (1 << 1), // 0x2 + SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE = (1 << 2), // 0x4 + SMALL_SCENERY_FLAG_ROTATABLE = (1 << 3), // 0x8; when set, user can set rotation, otherwise rotation is automatic + SMALL_SCENERY_FLAG_ANIMATED = (1 << 4), // 0x10 + SMALL_SCENERY_FLAG_CAN_WITHER = (1 << 5), // 0x20 + SMALL_SCENERY_FLAG_CAN_BE_WATERED = (1 << 6), // 0x40 + SMALL_SCENERY_FLAG_ANIMATED_FG = (1 << 7), // 0x80 + SMALL_SCENERY_FLAG_DIAGONAL = (1 << 8), // 0x100 + SMALL_SCENERY_FLAG_HAS_GLASS = (1 << 9), // 0x200 + SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR = (1 << 10), // 0x400 + SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1 = (1 << 11), // 0x800 + SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4 = (1 << 12), // 0x1000 + SMALL_SCENERY_FLAG_IS_CLOCK = (1 << 13), // 0x2000 + SMALL_SCENERY_FLAG_SWAMP_GOO = (1 << 14), // 0x4000 + SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS = (1 << 15), // 0x8000 + SMALL_SCENERY_FLAG17 = (1 << 16), // 0x10000 + SMALL_SCENERY_FLAG_STACKABLE = (1 << 17), // 0x20000; means scenery item can be placed in the air and over water + SMALL_SCENERY_FLAG_NO_WALLS = (1 << 18), // 0x40000 + SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR = (1 << 19), // 0x80000 + SMALL_SCENERY_FLAG_NO_SUPPORTS = (1 << 20), // 0x100000 + SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED = (1 << 21), // 0x200000 + SMALL_SCENERY_FLAG_COG = (1 << 22), // 0x400000 + SMALL_SCENERY_FLAG_BUILD_DIRECTLY_ONTOP = (1 << 23), // 0x800000; means supports can be built on this object. Used for base blocks. + SMALL_SCENERY_FLAG_HALF_SPACE = (1 << 24), // 0x1000000 + SMALL_SCENERY_FLAG_THREE_QUARTERS = (1 << 25), // 0x2000000 + SMALL_SCENERY_FLAG_PAINT_SUPPORTS = (1 << 26), // 0x4000000; used for scenery items which are support structures + SMALL_SCENERY_FLAG27 = (1 << 27), // 0x8000000 +} +SMALL_SCENERY_FLAGS; + sint32 scenery_small_get_primary_colour(const rct_tile_element * tileElement); sint32 scenery_small_get_secondary_colour(const rct_tile_element * tileElement); void scenery_small_set_primary_colour(rct_tile_element * tileElement, uint32 colour); @@ -28,6 +62,8 @@ void scenery_small_set_secondary_colour(rct_tile_element * tileElement, uint32 c bool scenery_small_get_supports_needed(const rct_tile_element * tileElement); void scenery_small_set_supports_needed(rct_tile_element * tileElement); +bool scenery_small_entry_has_flag(const rct_scenery_entry * sceneryEntry, uint32 flags); + #ifdef __cplusplus } #endif diff --git a/src/openrct2/world/Wall.cpp b/src/openrct2/world/Wall.cpp index 066cd380ba..2d2c7ca003 100644 --- a/src/openrct2/world/Wall.cpp +++ b/src/openrct2/world/Wall.cpp @@ -27,6 +27,7 @@ #include "map.h" #include "park.h" #include "scenery.h" +#include "SmallScenery.h" #include "Wall.h" /** @@ -228,7 +229,7 @@ static bool WallCheckObstruction(rct_scenery_entry * wall, case TILE_ELEMENT_TYPE_SMALL_SCENERY: entryType = tileElement->properties.scenery.type; entry = get_small_scenery_entry(entryType); - if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_NO_WALLS) + if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_NO_WALLS)) { map_obstruction_set_error_text(tileElement); return false; diff --git a/src/openrct2/world/map.c b/src/openrct2/world/map.c index d1fd736eb0..faf1e30b18 100644 --- a/src/openrct2/world/map.c +++ b/src/openrct2/world/map.c @@ -41,6 +41,7 @@ #include "map_animation.h" #include "park.h" #include "scenery.h" +#include "SmallScenery.h" #include "TileInspector.h" #include "Wall.h" @@ -4108,7 +4109,7 @@ bool map_surface_is_blocked(sint16 x, sint16 y){ { return false; } - if (scenery->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE) + if (scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_FULL_TILE)) return true; } return false; diff --git a/src/openrct2/world/map_animation.c b/src/openrct2/world/map_animation.c index d2345dc8f8..7aa003736b 100644 --- a/src/openrct2/world/map_animation.c +++ b/src/openrct2/world/map_animation.c @@ -22,6 +22,7 @@ #include "map_animation.h" #include "map.h" #include "scenery.h" +#include "SmallScenery.h" #include "sprite.h" typedef bool (*map_animation_invalidate_event_handler)(sint32 x, sint32 y, sint32 baseZ); @@ -184,12 +185,14 @@ static bool map_animation_invalidate_small_scenery(sint32 x, sint32 y, sint32 ba continue; sceneryEntry = get_small_scenery_entry(tileElement->properties.scenery.type); - if (sceneryEntry->small_scenery.flags & (SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1 | SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4 | SMALL_SCENERY_FLAG_SWAMP_GOO | SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS)) { + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1 | SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4 | SMALL_SCENERY_FLAG_SWAMP_GOO | SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS)) + { map_invalidate_tile_zoom1(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8); return false; } - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_IS_CLOCK) { + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_IS_CLOCK)) + { // Peep, looking at scenery if (!(gCurrentTicks & 0x3FF) && game_is_not_paused()) { sint32 direction = tile_element_get_direction(tileElement); diff --git a/src/openrct2/world/scenery.c b/src/openrct2/world/scenery.c index bead35a478..da83aec036 100644 --- a/src/openrct2/world/scenery.c +++ b/src/openrct2/world/scenery.c @@ -14,19 +14,20 @@ *****************************************************************************/ #pragma endregion -#include "../game.h" #include "../common.h" -#include "../localisation/localisation.h" -#include "../scenario/scenario.h" #include "../cheats.h" +#include "../game.h" +#include "../localisation/localisation.h" #include "../network/network.h" #include "../object_list.h" +#include "../scenario/scenario.h" #include "Climate.h" +#include "footpath.h" #include "Fountain.h" #include "map.h" #include "park.h" #include "scenery.h" -#include "footpath.h" +#include "SmallScenery.h" uint8 gWindowSceneryActiveTabIndex; uint16 gWindowSceneryTabSelections[20]; @@ -122,13 +123,13 @@ void scenery_update_age(sint32 x, sint32 y, rct_tile_element *tileElement) return; } - if (gCheatsDisablePlantAging && - (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_CAN_BE_WATERED)) { + if (gCheatsDisablePlantAging && (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_CAN_BE_WATERED))) + { return; } if ( - !(sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_CAN_BE_WATERED) || + !scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_CAN_BE_WATERED) || (gClimateCurrentWeather < WEATHER_RAIN) || (tileElement->properties.scenery.age < 5) ) { @@ -156,7 +157,8 @@ void scenery_update_age(sint32 x, sint32 y, rct_tile_element *tileElement) return; case TILE_ELEMENT_TYPE_SMALL_SCENERY: sceneryEntry = get_small_scenery_entry(tileElementAbove->properties.scenery.type); - if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) { + if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_VOFFSET_CENTRE)) + { scenery_increase_age(x, y, tileElement); return; } diff --git a/src/openrct2/world/scenery.h b/src/openrct2/world/scenery.h index 7d6913f0c9..c308a93c71 100644 --- a/src/openrct2/world/scenery.h +++ b/src/openrct2/world/scenery.h @@ -49,37 +49,6 @@ typedef struct rct_small_scenery_entry { assert_struct_size(rct_small_scenery_entry, 21); #endif -typedef enum { - SMALL_SCENERY_FLAG_FULL_TILE = (1 << 0), // 0x1 - SMALL_SCENERY_FLAG_VOFFSET_CENTRE = (1 << 1), // 0x2 - SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE = (1 << 2), // 0x4 - SMALL_SCENERY_FLAG_ROTATABLE = (1 << 3), // 0x8; when set, user can set rotation, otherwise rotation is automatic - SMALL_SCENERY_FLAG_ANIMATED = (1 << 4), // 0x10 - SMALL_SCENERY_FLAG_CAN_WITHER = (1 << 5), // 0x20 - SMALL_SCENERY_FLAG_CAN_BE_WATERED = (1 << 6), // 0x40 - SMALL_SCENERY_FLAG_ANIMATED_FG = (1 << 7), // 0x80 - SMALL_SCENERY_FLAG_DIAGONAL = (1 << 8), // 0x100 - SMALL_SCENERY_FLAG_HAS_GLASS = (1 << 9), // 0x200 - SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR = (1 << 10), // 0x400 - SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1 = (1 << 11), // 0x800 - SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4 = (1 << 12), // 0x1000 - SMALL_SCENERY_FLAG_IS_CLOCK = (1 << 13), // 0x2000 - SMALL_SCENERY_FLAG_SWAMP_GOO = (1 << 14), // 0x4000 - SMALL_SCENERY_FLAG_HAS_FRAME_OFFSETS = (1 << 15), // 0x8000 - SMALL_SCENERY_FLAG17 = (1 << 16), // 0x10000 - SMALL_SCENERY_FLAG_STACKABLE = (1 << 17), // 0x20000; means scenery item can be placed in the air and over water - SMALL_SCENERY_FLAG_NO_WALLS = (1 << 18), // 0x40000 - SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR = (1 << 19), // 0x80000 - SMALL_SCENERY_FLAG_NO_SUPPORTS = (1 << 20), // 0x100000 - SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED = (1 << 21), // 0x200000 - SMALL_SCENERY_FLAG_COG = (1 << 22), // 0x400000 - SMALL_SCENERY_FLAG_BUILD_DIRECTLY_ONTOP = (1 << 23), // 0x800000; means supports can be built on this object. Used for base blocks. - SMALL_SCENERY_FLAG_HALF_SPACE = (1 << 24), // 0x1000000 - SMALL_SCENERY_FLAG_THREE_QUARTERS = (1 << 25), // 0x2000000 - SMALL_SCENERY_FLAG_PAINT_SUPPORTS = (1 << 26), // 0x4000000; used for scenery items which are support structures - SMALL_SCENERY_FLAG27 = (1 << 27), // 0x8000000 -} SMALL_SCENERY_FLAGS; - typedef struct rct_large_scenery_tile { sint16 x_offset; sint16 y_offset;