From e8d6cba5bec2c547628427c0baa73dfef5e5c82c Mon Sep 17 00:00:00 2001 From: zaxcav Date: Wed, 28 Dec 2016 21:40:59 +0100 Subject: [PATCH] Initial attempt at paintClip UI Compiles but untested. NOT INTENDED FOR MERGING --- data/language/en-GB.txt | 5 +++++ src/openrct2/interface/window.h | 4 ++++ src/openrct2/localisation/string_ids.h | 6 ++++++ src/openrct2/paint/paint.c | 1 + src/openrct2/paint/paint.h | 1 + src/openrct2/windows/themes.c | 1 + src/openrct2/windows/top_toolbar.c | 13 +++++++++++++ 7 files changed, 31 insertions(+) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index e86a089d54..bbe6334d98 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -4311,6 +4311,11 @@ STR_5999 :Set money STR_6000 :Enter new value STR_6001 :Enable lighting effects (experimental) STR_6002 :{SMALLFONT}{BLACK}Lamps and rides will be lit up at night.{NEWLINE}Requires rendering engine to be set to hardware display. +STR_6003 :View Clipping +STR_6004 :Enable clipping by height +STR_6005 :Height clipping only displays map elements below the clip height +STR_6006 :Clip height +STR_6007 :Select clip height ############# # Scenarios # diff --git a/src/openrct2/interface/window.h b/src/openrct2/interface/window.h index e3931fef1e..cdffc5e4bb 100644 --- a/src/openrct2/interface/window.h +++ b/src/openrct2/interface/window.h @@ -471,6 +471,7 @@ enum { WC_SERVER_START = 128, WC_CUSTOM_CURRENCY_CONFIG = 129, WC_DEBUG_PAINT = 130, + WC_VIEW_CLIPPING = 131, // Only used for colour schemes WC_STAFF = 220, @@ -726,6 +727,9 @@ void window_editor_inventions_list_open(); void window_editor_scenario_options_open(); void window_editor_objective_options_open(); +void window_view_clipping_open(); +void window_view_clipping_close(); + void window_guest_list_init_vars_a(); void window_guest_list_init_vars_b(); void window_bubble_list_item(rct_window* w, sint32 item_position); diff --git a/src/openrct2/localisation/string_ids.h b/src/openrct2/localisation/string_ids.h index fbfcc60200..26f4dd03fc 100644 --- a/src/openrct2/localisation/string_ids.h +++ b/src/openrct2/localisation/string_ids.h @@ -3654,6 +3654,12 @@ enum { STR_ENABLE_LIGHTING_EFFECTS = 6001, STR_ENABLE_LIGHTING_EFFECTS_TIP = 6002, + STR_VIEW_CLIPPING = 6003, + STR_VIEW_CLIPPING_HEIGHT_ENABLE = 6004, + STR_VIEW_CLIPPING_HEIGHT_ENABLE_TIP = 6005, + STR_VIEW_CLIPPING_HEIGHT_VALUE = 6006, + STR_VIEW_CLIPPING_HEIGHT_SCROLL_TIP = 6007, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 }; diff --git a/src/openrct2/paint/paint.c b/src/openrct2/paint/paint.c index b92ea5d8b6..f61e4565e4 100644 --- a/src/openrct2/paint/paint.c +++ b/src/openrct2/paint/paint.c @@ -25,6 +25,7 @@ // zax: globals for paint clipping height uint8 gClipHeight = 255; +bool gClipHeightEnable = false; const uint32 construction_markers[] = { COLOUR_DARK_GREEN << 19 | COLOUR_GREY << 24 | IMAGE_TYPE_REMAP, // White diff --git a/src/openrct2/paint/paint.h b/src/openrct2/paint/paint.h index 2ac5ee1308..5ecada6a8a 100644 --- a/src/openrct2/paint/paint.h +++ b/src/openrct2/paint/paint.h @@ -25,6 +25,7 @@ // zax: Global paint clipping height. extern uint8 gClipHeight; +extern bool gClipHeightEnable; typedef struct attached_paint_struct attached_paint_struct; typedef struct paint_struct paint_struct; diff --git a/src/openrct2/windows/themes.c b/src/openrct2/windows/themes.c index 9c206d6f13..c5c1a37729 100644 --- a/src/openrct2/windows/themes.c +++ b/src/openrct2/windows/themes.c @@ -245,6 +245,7 @@ static rct_windowclass window_themes_tab_6_classes[] = { WC_MULTIPLAYER, WC_PLAYER, WC_CHAT, + WC_VIEW_CLIPPING, }; static rct_windowclass window_themes_tab_7_classes[] = { diff --git a/src/openrct2/windows/top_toolbar.c b/src/openrct2/windows/top_toolbar.c index 4843cc1b5b..4e81b4dda9 100644 --- a/src/openrct2/windows/top_toolbar.c +++ b/src/openrct2/windows/top_toolbar.c @@ -98,6 +98,7 @@ typedef enum { DDIDX_LAND_HEIGHTS = 10, DDIDX_TRACK_HEIGHTS = 11, DDIDX_PATH_HEIGHTS = 12, + DDIDX_VIEW_CLIPPING = 13, } TOP_TOOLBAR_VIEW_MENU_DDIDX; typedef enum { @@ -3044,6 +3045,7 @@ void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) { gDropdownItemsFormat[10] = STR_TOGGLE_OPTION; gDropdownItemsFormat[11] = STR_TOGGLE_OPTION; gDropdownItemsFormat[12] = STR_TOGGLE_OPTION; + gDropdownItemsFormat[13] = STR_TOGGLE_OPTION; gDropdownItemsArgs[0] = STR_UNDERGROUND_VIEW; gDropdownItemsArgs[1] = STR_REMOVE_BASE_LAND; @@ -3056,6 +3058,7 @@ void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) { gDropdownItemsArgs[10] = STR_HEIGHT_MARKS_ON_LAND; gDropdownItemsArgs[11] = STR_HEIGHT_MARKS_ON_RIDE_TRACKS; gDropdownItemsArgs[12] = STR_HEIGHT_MARKS_ON_PATHS; + gDropdownItemsArgs[13] = STR_VIEW_CLIPPING; window_dropdown_show_text( w->x + widget->left, @@ -3090,6 +3093,8 @@ void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) { dropdown_set_checked(11, true); if (mainViewport->flags & VIEWPORT_FLAG_PATH_HEIGHTS) dropdown_set_checked(12, true); + if (mainViewport->flags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT) + dropdown_set_checked(13, true); gDropdownDefaultIndex = DDIDX_UNDERGROUND_INSIDE; } @@ -3136,6 +3141,14 @@ void top_toolbar_view_menu_dropdown(sint16 dropdownIndex) case DDIDX_PATH_HEIGHTS: w->viewport->flags ^= VIEWPORT_FLAG_PATH_HEIGHTS; break; + case DDIDX_VIEW_CLIPPING: + if ((w->viewport->flags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT) == 0) { + window_view_clipping_open(); + } + else { + window_view_clipping_close(); + } + break; default: return; }