diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 0e7811f5df..39507e0a40 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3682,6 +3682,7 @@ STR_6436 :Toggle invisibility STR_6437 :Invisible STR_6438 :I STR_6439 :Tile Inspector: Toggle invisibility +STR_6440 :Opaque water ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 7464bb2c8c..f7cd4c99cf 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -6,6 +6,7 @@ - Feature: [#14538] [Plugin] Add property for getting current plugin api version. - Feature: [#14620] [Plugin] Add properties related to guest generation. - Feature: [#14636] [Plugin] Add properties related to climate and weather. +- Feature: [#14731] Opaque water (like in RCT1). - Change: [#14496] [Plugin] Rename Object to LoadedObject to fix conflicts with Typescript's Object interface. - Change: [#14536] [Plugin] Rename ListView to ListViewWidget to make it consistent with names of other widgets. - Fix: [#11829] Visual glitches and crashes when using RCT1 assets from mismatched or corrupt CSG1.DAT and CSG1i.DAT files. diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 3b7a1545da..ff57dc0db5 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -127,19 +127,22 @@ enum FILE_MENU_DDIDX { enum TOP_TOOLBAR_VIEW_MENU_DDIDX { DDIDX_UNDERGROUND_INSIDE = 0, - DDIDX_HIDE_BASE = 1, - DDIDX_HIDE_VERTICAL = 2, - DDIDX_SEETHROUGH_RIDES = 4, - DDIDX_SEETHROUGH_SCENARY = 5, - DDIDX_SEETHROUGH_PATHS = 6, - DDIDX_INVISIBLE_SUPPORTS = 7, - DDIDX_INVISIBLE_PEEPS = 8, - DDIDX_LAND_HEIGHTS = 10, - DDIDX_TRACK_HEIGHTS = 11, - DDIDX_PATH_HEIGHTS = 12, - // 13 is a separator - DDIDX_VIEW_CLIPPING = 14, - DDIDX_HIGHLIGHT_PATH_ISSUES = 15, + DDIDX_OPAQUE_WATER = 1, + DDIDX_HIDE_BASE = 2, + DDIDX_HIDE_VERTICAL = 3, + // separator + DDIDX_SEETHROUGH_RIDES = 5, + DDIDX_SEETHROUGH_SCENERY = 6, + DDIDX_SEETHROUGH_PATHS = 7, + DDIDX_INVISIBLE_SUPPORTS = 8, + DDIDX_INVISIBLE_PEEPS = 9, + // separator + DDIDX_LAND_HEIGHTS = 11, + DDIDX_TRACK_HEIGHTS = 12, + DDIDX_PATH_HEIGHTS = 13, + // separator + DDIDX_VIEW_CLIPPING = 15, + DDIDX_HIGHLIGHT_PATH_ISSUES = 16, TOP_TOOLBAR_VIEW_MENU_COUNT }; @@ -3607,14 +3610,14 @@ static void top_toolbar_network_menu_dropdown(int16_t dropdownIndex) static void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) { using namespace Dropdown; - constexpr Item items[] = { ToggleOption(DDIDX_UNDERGROUND_INSIDE, STR_UNDERGROUND_VIEW), + ToggleOption(DDIDX_OPAQUE_WATER, STR_VIEWPORT_OPAQUE_WATER), ToggleOption(DDIDX_HIDE_BASE, STR_REMOVE_BASE_LAND), ToggleOption(DDIDX_HIDE_VERTICAL, STR_REMOVE_VERTICAL_FACES), Separator(), ToggleOption(DDIDX_SEETHROUGH_RIDES, STR_SEE_THROUGH_RIDES), - ToggleOption(DDIDX_SEETHROUGH_SCENARY, STR_SEE_THROUGH_SCENERY), + ToggleOption(DDIDX_SEETHROUGH_SCENERY, STR_SEE_THROUGH_SCENERY), ToggleOption(DDIDX_SEETHROUGH_PATHS, STR_SEE_THROUGH_PATHS), ToggleOption(DDIDX_INVISIBLE_SUPPORTS, STR_INVISIBLE_SUPPORTS), ToggleOption(DDIDX_INVISIBLE_PEEPS, STR_INVISIBLE_PEOPLE), @@ -3626,6 +3629,7 @@ static void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) ToggleOption(DDIDX_VIEW_CLIPPING, STR_VIEW_CLIPPING_MENU), ToggleOption(DDIDX_HIGHLIGHT_PATH_ISSUES, STR_HIGHLIGHT_PATH_ISSUES_MENU), }; + static_assert(ItemIDsMatchIndices(items)); SetItems(items); @@ -3637,33 +3641,41 @@ static void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) // Set checkmarks rct_viewport* mainViewport = window_get_main()->viewport; if (mainViewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE) - Dropdown::SetChecked(0, true); + Dropdown::SetChecked(DDIDX_UNDERGROUND_INSIDE, true); + if (gConfigGeneral.opaque_water) + Dropdown::SetChecked(DDIDX_OPAQUE_WATER, true); if (mainViewport->flags & VIEWPORT_FLAG_HIDE_BASE) - Dropdown::SetChecked(1, true); + Dropdown::SetChecked(DDIDX_HIDE_BASE, true); if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VERTICAL) - Dropdown::SetChecked(2, true); + Dropdown::SetChecked(DDIDX_HIDE_VERTICAL, true); if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_RIDES) - Dropdown::SetChecked(4, true); + Dropdown::SetChecked(DDIDX_SEETHROUGH_RIDES, true); if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_SCENERY) - Dropdown::SetChecked(5, true); + Dropdown::SetChecked(DDIDX_SEETHROUGH_SCENERY, true); if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_PATHS) - Dropdown::SetChecked(6, true); + Dropdown::SetChecked(DDIDX_SEETHROUGH_PATHS, true); if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) - Dropdown::SetChecked(7, true); + Dropdown::SetChecked(DDIDX_INVISIBLE_SUPPORTS, true); if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_PEEPS) - Dropdown::SetChecked(8, true); + Dropdown::SetChecked(DDIDX_INVISIBLE_PEEPS, true); if (mainViewport->flags & VIEWPORT_FLAG_LAND_HEIGHTS) - Dropdown::SetChecked(10, true); + Dropdown::SetChecked(DDIDX_LAND_HEIGHTS, true); if (mainViewport->flags & VIEWPORT_FLAG_TRACK_HEIGHTS) - Dropdown::SetChecked(11, true); + Dropdown::SetChecked(DDIDX_TRACK_HEIGHTS, true); if (mainViewport->flags & VIEWPORT_FLAG_PATH_HEIGHTS) - Dropdown::SetChecked(12, true); + Dropdown::SetChecked(DDIDX_PATH_HEIGHTS, true); if (mainViewport->flags & VIEWPORT_FLAG_CLIP_VIEW) Dropdown::SetChecked(DDIDX_VIEW_CLIPPING, true); if (mainViewport->flags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) Dropdown::SetChecked(DDIDX_HIGHLIGHT_PATH_ISSUES, true); gDropdownDefaultIndex = DDIDX_UNDERGROUND_INSIDE; + + // Opaque water relies on RCT1 sprites. + if (!is_csg_loaded()) + { + Dropdown::SetDisabled(DDIDX_OPAQUE_WATER, true); + } } /** @@ -3680,6 +3692,10 @@ static void top_toolbar_view_menu_dropdown(int16_t dropdownIndex) case DDIDX_UNDERGROUND_INSIDE: w->viewport->flags ^= VIEWPORT_FLAG_UNDERGROUND_INSIDE; break; + case DDIDX_OPAQUE_WATER: + gConfigGeneral.opaque_water ^= 1; + config_save_default(); + break; case DDIDX_HIDE_BASE: w->viewport->flags ^= VIEWPORT_FLAG_HIDE_BASE; break; @@ -3689,7 +3705,7 @@ static void top_toolbar_view_menu_dropdown(int16_t dropdownIndex) case DDIDX_SEETHROUGH_RIDES: w->viewport->flags ^= VIEWPORT_FLAG_SEETHROUGH_RIDES; break; - case DDIDX_SEETHROUGH_SCENARY: + case DDIDX_SEETHROUGH_SCENERY: w->viewport->flags ^= VIEWPORT_FLAG_SEETHROUGH_SCENERY; break; case DDIDX_SEETHROUGH_PATHS: diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index a1873c0ccf..1a1ff0b5b7 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -227,6 +227,7 @@ namespace Config model->show_real_names_of_guests = reader->GetBoolean("show_real_names_of_guests", true); model->allow_early_completion = reader->GetBoolean("allow_early_completion", false); model->transparent_screenshot = reader->GetBoolean("transparent_screenshot", true); + model->opaque_water = reader->GetBoolean("opaque_water", false); model->last_version_check_time = reader->GetInt64("last_version_check_time", 0); } } @@ -304,6 +305,7 @@ namespace Config writer->WriteBoolean("allow_early_completion", model->allow_early_completion); writer->WriteEnum("virtual_floor_style", model->virtual_floor_style, Enum_VirtualFloorStyle); writer->WriteBoolean("transparent_screenshot", model->transparent_screenshot); + writer->WriteBoolean("opaque_water", model->opaque_water); writer->WriteInt64("last_version_check_time", model->last_version_check_time); } diff --git a/src/openrct2/config/Config.h b/src/openrct2/config/Config.h index badf2b1fdf..3f516dd0d2 100644 --- a/src/openrct2/config/Config.h +++ b/src/openrct2/config/Config.h @@ -58,6 +58,7 @@ struct GeneralConfiguration bool disable_lightning_effect; bool show_guest_purchases; bool transparent_screenshot; + bool opaque_water; // Localisation int32_t language; diff --git a/src/openrct2/interface/Viewport.h b/src/openrct2/interface/Viewport.h index cc4750ab6a..8393b1628d 100644 --- a/src/openrct2/interface/Viewport.h +++ b/src/openrct2/interface/Viewport.h @@ -49,6 +49,7 @@ enum VIEWPORT_FLAG_CLIP_VIEW = (1 << 17), VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES = (1 << 18), VIEWPORT_FLAG_TRANSPARENT_BACKGROUND = (1 << 19), + VIEWPORT_FLAG_OPAQUE_WATER = (1 << 20), }; enum class ViewportInteractionItem : uint8_t diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index 70e41b5e5a..3118b5a81e 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3941,6 +3941,8 @@ enum STR_TILE_INSPECTOR_INVISIBLE_SHORT = 6438, STR_SHORTCUT_TOGGLE_INVISIBILITY = 6439, + STR_VIEWPORT_OPAQUE_WATER = 6440, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working /* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings }; diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index 22a4202c9c..3285a519db 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -1315,7 +1315,9 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c | EnumValue(FilterPaletteID::PaletteWater) << 19; PaintAddImageAsParent(session, image_id, 0, 0, 32, 32, -1, waterHeight); - PaintAttachToPreviousPS(session, SPR_WATER_OVERLAY + image_offset, 0, 0); + const bool opaque = (gConfigGeneral.opaque_water) && !(session->ViewFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE); + const uint32_t overlayStart = opaque ? SPR_RCT1_WATER_OVERLAY : SPR_WATER_OVERLAY; + PaintAttachToPreviousPS(session, overlayStart + image_offset, 0, 0); if (!(session->ViewFlags & VIEWPORT_FLAG_HIDE_VERTICAL)) { diff --git a/src/openrct2/paint/tile_element/Paint.Surface.h b/src/openrct2/paint/tile_element/Paint.Surface.h index 6b774390f8..15a7a6793e 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.h +++ b/src/openrct2/paint/tile_element/Paint.Surface.h @@ -100,6 +100,9 @@ enum SPR_TERRAIN_PATTERN_MARTIAN = 28995, SPR_TERRAIN_PATTERN_GRASS_CLUMPS = 29001, SPR_TERRAIN_PATTERN_ICE = 29007, + + SPR_RCT1_WATER_MASK = SPR_CSG_BEGIN + 46787, + SPR_RCT1_WATER_OVERLAY = SPR_CSG_BEGIN + 46792, }; #endif //_PAINT_SURFACE_H