Skip to content

Commit

Permalink
Implement OpenRCT2#4984: Add option to highlight vomit, litter and ha…
Browse files Browse the repository at this point in the history
…ndymen
  • Loading branch information
rwjuk authored and AaronVanGeffen committed Jan 29, 2018
1 parent 6bd0b2b commit 3006aef
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 9 deletions.
1 change: 1 addition & 0 deletions data/language/en-GB.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4524,6 +4524,7 @@ STR_6214 :Skyscraper B
STR_6215 :Construction
STR_6216 :Operation
STR_6217 :Ride / track availability
STR_6218 :Highlight vandalism and vomit

#############
# Scenarios #
Expand Down
8 changes: 8 additions & 0 deletions src/openrct2-ui/windows/TopToolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ typedef enum {
DDIDX_PATH_HEIGHTS = 12,
// 13 is a separator
DDIDX_VIEW_CLIPPING = 14,
DDIDX_HIGHLIGHT_PATH_ISSUES = 15,

TOP_TOOLBAR_VIEW_MENU_COUNT
} TOP_TOOLBAR_VIEW_MENU_DDIDX;
Expand Down Expand Up @@ -3174,6 +3175,7 @@ static void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) {
gDropdownItemsFormat[12] = STR_TOGGLE_OPTION;
gDropdownItemsFormat[13] = DROPDOWN_SEPARATOR;
gDropdownItemsFormat[DDIDX_VIEW_CLIPPING] = STR_TOGGLE_OPTION;
gDropdownItemsFormat[DDIDX_HIGHLIGHT_PATH_ISSUES] = STR_TOGGLE_OPTION;

gDropdownItemsArgs[0] = STR_UNDERGROUND_VIEW;
gDropdownItemsArgs[1] = STR_REMOVE_BASE_LAND;
Expand All @@ -3187,6 +3189,7 @@ static void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) {
gDropdownItemsArgs[11] = STR_HEIGHT_MARKS_ON_RIDE_TRACKS;
gDropdownItemsArgs[12] = STR_HEIGHT_MARKS_ON_PATHS;
gDropdownItemsArgs[DDIDX_VIEW_CLIPPING] = STR_VIEW_CLIPPING_MENU;
gDropdownItemsArgs[DDIDX_HIGHLIGHT_PATH_ISSUES] = STR_HIGHLIGHT_PATH_ISSUES_MENU;

window_dropdown_show_text(
w->x + widget->left,
Expand Down Expand Up @@ -3223,6 +3226,8 @@ static void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) {
dropdown_set_checked(12, true);
if (mainViewport->flags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT)
dropdown_set_checked(DDIDX_VIEW_CLIPPING, true);
if (mainViewport->flags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
dropdown_set_checked(DDIDX_HIGHLIGHT_PATH_ISSUES, true);

gDropdownDefaultIndex = DDIDX_UNDERGROUND_INSIDE;
}
Expand Down Expand Up @@ -3277,6 +3282,9 @@ static void top_toolbar_view_menu_dropdown(sint16 dropdownIndex)
w->viewport->flags ^= VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT;
}
break;
case DDIDX_HIGHLIGHT_PATH_ISSUES:
w->viewport->flags ^= VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES;
break;
default:
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/openrct2/drawing/Rain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "../world/Climate.h"
#include "Drawing.h"
#include "../config/Config.h"
#include "../interface/Viewport.h"

#include "IDrawingEngine.h"
#include "Rain.h"
Expand Down Expand Up @@ -177,7 +178,7 @@ void DrawRain(rct_drawpixelinfo * dpi, IRainDrawer * rainDrawer)
{
// Get rain draw function and draw rain
uint32 rainType = gClimateCurrent.RainLevel;
if (rainType != RAIN_LEVEL_NONE && !gTrackDesignSaveMode)
if (rainType != RAIN_LEVEL_NONE && !gTrackDesignSaveMode && !(gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES))
{
DrawRainAnimation(dpi, rainDrawer, rainType);
}
Expand Down
3 changes: 2 additions & 1 deletion src/openrct2/interface/Viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,8 @@ static void viewport_paint_column(rct_drawpixelinfo * dpi, uint32 viewFlags)

if (gConfigGeneral.render_weather_gloom &&
!gTrackDesignSaveMode &&
!(viewFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES)
!(viewFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES) &&
!(viewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
) {
viewport_paint_weather_gloom(dpi);
}
Expand Down
1 change: 1 addition & 0 deletions src/openrct2/interface/Viewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ enum {
VIEWPORT_FLAG_15 = (1 << 15),
VIEWPORT_FLAG_SEETHROUGH_PATHS = (1 << 16),
VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT = (1 << 17),
VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES = (1 << 18),
};

enum {
Expand Down
2 changes: 2 additions & 0 deletions src/openrct2/localisation/StringIds.h
Original file line number Diff line number Diff line change
Expand Up @@ -3874,6 +3874,8 @@ enum {
STR_CHEAT_GROUP_OPERATION = 6216,
STR_CHEAT_GROUP_AVAILABILITY = 6217,

STR_HIGHLIGHT_PATH_ISSUES_MENU = 6218,

// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};
Expand Down
23 changes: 22 additions & 1 deletion src/openrct2/paint/sprite/Sprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ void sprite_paint_setup(paint_session * session, const uint16 eax, const uint16

if (gTrackDesignSaveMode) return;

if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES) return;
if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES)
{
return;
}

bool highlightPathIssues = (gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES);

dpi = session->Unk140E9A8;
if (dpi->zoom_level > 2) return;
Expand All @@ -46,6 +51,22 @@ void sprite_paint_setup(paint_session * session, const uint16 eax, const uint16
for (rct_sprite* spr = get_sprite(sprite_idx); sprite_idx != SPRITE_INDEX_NULL; sprite_idx = spr->unknown.next_in_quadrant) {
spr = get_sprite(sprite_idx);

if (highlightPathIssues)
{
if (spr->unknown.sprite_identifier == SPRITE_IDENTIFIER_PEEP)
{
rct_peep * peep = (rct_peep*)spr;
if (!(peep->type == PEEP_TYPE_STAFF && peep->staff_type == STAFF_TYPE_HANDYMAN))
{
continue;
}
}
else if (spr->unknown.sprite_identifier != SPRITE_IDENTIFIER_LITTER)
{
continue;
}
}

// Only paint sprites that are below the clip height.
// Here converting from land/path/etc height scale to pixel height scale.
// Note: peeps/scenery on slopes will be above the base
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/paint/tile_element/Banner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void banner_paint(paint_session * session, uint8 direction, sint32 height, rct_t

session->InteractionType = VIEWPORT_INTERACTION_ITEM_BANNER;

if (dpi->zoom_level > 1 || gTrackDesignSaveMode) return;
if (dpi->zoom_level > 1 || gTrackDesignSaveMode || (gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) return;

height -= 16;

Expand Down
5 changes: 3 additions & 2 deletions src/openrct2/paint/tile_element/Entrance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static void ride_entrance_exit_paint(paint_session * session, uint8 direction, s

uint8 is_exit = tile_element->properties.entrance.type == ENTRANCE_TYPE_RIDE_EXIT;

if (gTrackDesignSaveMode) {
if (gTrackDesignSaveMode || (gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) {
if (tile_element->properties.entrance.ride_index != gTrackDesignSaveRideIndex)
return;
}
Expand Down Expand Up @@ -98,6 +98,7 @@ static void ride_entrance_exit_paint(paint_session * session, uint8 direction, s
else{
image_id |= style->sprite_index + direction;
}

// Format modified to stop repeated code

// Each entrance is split into 2 images for drawing
Expand Down Expand Up @@ -186,7 +187,7 @@ static void ride_entrance_exit_paint(paint_session * session, uint8 direction, s
* rct2: 0x006658ED
*/
static void park_entrance_paint(paint_session * session, uint8 direction, sint32 height, rct_tile_element* tile_element){
if (gTrackDesignSaveMode)
if (gTrackDesignSaveMode || (gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES))
return;

#ifdef __ENABLE_LIGHTFX__
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/paint/tile_element/Fence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void fence_paint(paint_session * session, uint8 direction, sint32 height, rct_ti
paint_util_set_general_support_height(session, height, 0x20);

uint32 dword_141F710 = 0;
if (gTrackDesignSaveMode) {
if (gTrackDesignSaveMode || (gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) {
if (!track_design_save_contains_tile_element(tile_element)) {
dword_141F710 = 0x21700000;
}
Expand Down
4 changes: 4 additions & 0 deletions src/openrct2/paint/tile_element/LargeScenery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ static constexpr const boundbox s98E3C4[] = {
*/
void large_scenery_paint(paint_session * session, uint8 direction, uint16 height, rct_tile_element * tileElement)
{
if (gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
{
return;
}
session->InteractionType = VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY;
uint32 sequenceNum = scenery_large_get_sequence(tileElement);
rct_scenery_entry *entry = get_large_scenery_entry(scenery_large_get_type(tileElement));
Expand Down
11 changes: 11 additions & 0 deletions src/openrct2/paint/tile_element/Path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,12 @@ static void sub_6A3F61(paint_session * session, rct_tile_element * tile_element,
if (dpi->zoom_level <= 1) {
if (!gTrackDesignSaveMode) {
if (footpath_element_has_path_scenery(tile_element)) {
if ((gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) &&
!(tile_element->flags & TILE_ELEMENT_FLAG_BROKEN))
{
return;
}

session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM;
if (sceneryImageFlags != 0) {
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
Expand Down Expand Up @@ -697,6 +703,11 @@ void path_paint(paint_session * session, uint8 direction, uint16 height, rct_til
}
}

if (gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
{
imageFlags = 0x21700000;
}

if (footpath_element_path_scenery_is_ghost(tile_element)) {
sceneryImageFlags = CONSTRUCTION_MARKER;
}
Expand Down
4 changes: 4 additions & 0 deletions src/openrct2/paint/tile_element/SmallScenery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ static constexpr const LocationXY16 lengths[] = {
* rct2: 0x006DFF47
*/
void scenery_paint(paint_session * session, uint8 direction, sint32 height, rct_tile_element* tileElement) {
if (gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
{
return;
}
//RCT2_CALLPROC_X(0x6DFF47, 0, 0, direction, height, (sint32)tileElement, 0, 0); return;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SCENERY;
LocationXYZ16 boxlength;
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/paint/tile_element/Surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ void surface_paint(paint_session * session, uint8 direction, uint16 height, rct_
const uint16 localHeight = height + 16;
const uint16 waterHeight = map_get_water_height(tileElement) * 16;

if (!gTrackDesignSaveMode)
if (!gTrackDesignSaveMode && !(gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES))
{
session->Unk141E9DC = waterHeight;

Expand Down
3 changes: 2 additions & 1 deletion src/openrct2/ride/TrackPaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,8 @@ void track_paint(paint_session * session, uint8 direction, sint32 height, rct_ti

rct_drawpixelinfo * dpi = session->Unk140E9A8;

if (!gTrackDesignSaveMode || rideIndex == gTrackDesignSaveRideIndex)
if ((!gTrackDesignSaveMode || rideIndex == gTrackDesignSaveRideIndex) &&
!(gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES))
{
sint32 trackType = track_element_get_type(tileElement);
sint32 trackSequence = tile_element_get_track_sequence(tileElement);
Expand Down

0 comments on commit 3006aef

Please sign in to comment.