Skip to content

Commit

Permalink
Merge pull request OpenRCT2#8659 from Xkeeper0/f/better-sign-tooltips
Browse files Browse the repository at this point in the history
Better tooltips for banners and signs
  • Loading branch information
AaronVanGeffen authored May 1, 2019
2 parents df42cfe + 05a1ce6 commit 6098c1c
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 41 deletions.
9 changes: 5 additions & 4 deletions data/language/en-GB.txt
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,8 @@ STR_1167 :Can't raise water level here...
STR_1168 :Options
STR_1169 :(None)
STR_1170 :{STRING}
STR_1171 :{RED}Closed - -
STR_1172 :{YELLOW}{STRINGID} - -
STR_1171 :{RED}Closed
STR_1172 :{YELLOW}{STRINGID}
STR_1173 :{SMALLFONT}{BLACK}Build footpaths and queue lines
STR_1174 :Banner sign in the way
STR_1175 :Can't build this on sloped footpath
Expand Down Expand Up @@ -1108,7 +1108,7 @@ STR_1726 :Land not for sale!
STR_1727 :Construction rights not for sale!
STR_1728 :Can't buy construction rights here...
STR_1729 :Land not owned by park!
STR_1730 :{RED}Closed - -
STR_1730 :{RED}Closed
STR_1731 :{WHITE}{STRINGID} - -
STR_1732 :Build
STR_1733 :Mode
Expand Down Expand Up @@ -2237,7 +2237,7 @@ STR_2977 :Staff member name
STR_2978 :Enter new name for this member of staff:
STR_2979 :Can't name staff member...
STR_2980 :Too many banners in game
STR_2981 :{RED}No entry - -
STR_2981 :{RED}No entry
STR_2982 :Banner text
STR_2983 :Enter new text for this banner:
STR_2984 :Can't set new text for banner...
Expand Down Expand Up @@ -3755,6 +3755,7 @@ STR_6304 :Open scenery picker
STR_6305 :Multithreading
STR_6306 :{SMALLFONT}{BLACK}Experimental option to use multiple threads to render, may cause instability.
STR_6307 :Colour scheme: {BLACK}{STRINGID}
STR_6308 :“{STRINGID}{OUTLINE}{TOPAZ}”{NEWLINE}{STRINGID}

#############
# Scenarios #
Expand Down
1 change: 1 addition & 0 deletions distribution/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Feature: [#7296] Allow assigning a keyboard shortcut for the scenery picker.
- Feature: [#8029] Add the Hungarian Forint (HUF) to the list of available currencies.
- Feature: [#8481] Multi-threaded rendering.
- Feature: [#8659] Banner and sign texts are now shown in tooltips.
- Feature: [#8919] Allow setting ride price from console.
- Feature: [#8963] Add missing Czech letters to sprite font, use sprite font for Czech.
- Feature: [#9154] Change map toolbar icon with current viewport rotation.
Expand Down
25 changes: 19 additions & 6 deletions src/openrct2-ui/interface/ViewportInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,11 @@ int32_t viewport_interaction_get_item_right(int32_t x, int32_t y, viewport_inter
sceneryEntry = tileElement->AsWall()->GetEntry();
if (sceneryEntry->wall.scrolling_mode != SCROLLING_MODE_NONE)
{
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY);
set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name);
banner = &gBanners[tileElement->AsWall()->GetBannerIndex()];
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_BANNER_STRINGID_STRINGID);
set_map_tooltip_format_arg(2, rct_string_id, banner->string_idx);
set_map_tooltip_format_arg(4, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY);
set_map_tooltip_format_arg(6, rct_string_id, sceneryEntry->name);
return info->type;
}
break;
Expand All @@ -327,8 +330,11 @@ int32_t viewport_interaction_get_item_right(int32_t x, int32_t y, viewport_inter
sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
if (sceneryEntry->large_scenery.scrolling_mode != SCROLLING_MODE_NONE)
{
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY);
set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name);
banner = &gBanners[tileElement->AsLargeScenery()->GetBannerIndex()];
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_BANNER_STRINGID_STRINGID);
set_map_tooltip_format_arg(2, rct_string_id, banner->string_idx);
set_map_tooltip_format_arg(4, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY);
set_map_tooltip_format_arg(6, rct_string_id, sceneryEntry->name);
return info->type;
}
break;
Expand All @@ -337,8 +343,15 @@ int32_t viewport_interaction_get_item_right(int32_t x, int32_t y, viewport_inter
banner = &gBanners[tileElement->AsBanner()->GetIndex()];
sceneryEntry = get_banner_entry(banner->type);

set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY);
set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name);
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_BANNER_STRINGID_STRINGID);

if (banner->flags & BANNER_FLAG_NO_ENTRY)
set_map_tooltip_format_arg(2, rct_string_id, STR_NO_ENTRY);
else
set_map_tooltip_format_arg(2, rct_string_id, banner->string_idx);

set_map_tooltip_format_arg(4, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY);
set_map_tooltip_format_arg(6, rct_string_id, sceneryEntry->name);
return info->type;
}

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 @@ -3939,6 +3939,8 @@ enum

STR_TILE_INSPECTOR_COLOUR_SCHEME = 6307,

STR_MAP_TOOLTIP_BANNER_STRINGID_STRINGID = 6308,

// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};
Expand Down
16 changes: 10 additions & 6 deletions src/openrct2/paint/tile_element/Paint.Banner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,23 @@ void banner_paint(paint_session* session, uint8_t direction, int32_t height, con
set_format_arg(0, uint32_t, 0);
set_format_arg(4, uint32_t, 0);

rct_string_id string_id = STR_NO_ENTRY;
if (!(gBanners[tile_element->AsBanner()->GetIndex()].flags & BANNER_FLAG_NO_ENTRY))
if (gBanners[tile_element->AsBanner()->GetIndex()].flags & BANNER_FLAG_NO_ENTRY)
{
set_format_arg(0, rct_string_id, STR_NO_ENTRY);
}
else
{
set_format_arg(0, rct_string_id, gBanners[tile_element->AsBanner()->GetIndex()].string_idx);
string_id = STR_BANNER_TEXT_FORMAT;
}

if (gConfigGeneral.upper_case_banners)
{
format_string_to_upper(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), string_id, gCommonFormatArgs);
format_string_to_upper(
gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, gCommonFormatArgs);
}
else
{
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), string_id, gCommonFormatArgs);
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, gCommonFormatArgs);
}

gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
Expand All @@ -116,6 +120,6 @@ void banner_paint(paint_session* session, uint8_t direction, int32_t height, con
uint16_t scroll = (gCurrentTicks / 2) % string_width;

sub_98199C(
session, scrolling_text_setup(session, string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22,
session, scrolling_text_setup(session, STR_BANNER_TEXT_FORMAT, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22,
boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ);
}
37 changes: 20 additions & 17 deletions src/openrct2/paint/tile_element/Paint.Entrance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,27 @@ static void ride_entrance_exit_paint(paint_session* session, uint8_t direction,
if (!is_exit && !(tile_element->IsGhost()) && tile_element->AsEntrance()->GetRideIndex() != RIDE_ID_NULL
&& stationObj->ScrollingMode != SCROLLING_MODE_NONE)
{
set_format_arg(0, uint32_t, 0);
set_format_arg(0, rct_string_id, STR_RIDE_ENTRANCE_NAME);
set_format_arg(4, uint32_t, 0);

rct_string_id string_id = STR_RIDE_ENTRANCE_CLOSED;

if (ride->status == RIDE_STATUS_OPEN && !(ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN))
{
set_format_arg(0, rct_string_id, ride->name);
set_format_arg(2, uint32_t, ride->name_arguments);

string_id = STR_RIDE_ENTRANCE_NAME;
set_format_arg(2, rct_string_id, ride->name);
set_format_arg(4, uint32_t, ride->name_arguments);
}
else
{
set_format_arg(2, rct_string_id, STR_RIDE_ENTRANCE_CLOSED);
}

utf8 entrance_string[256];
if (gConfigGeneral.upper_case_banners)
{
format_string_to_upper(entrance_string, sizeof(entrance_string), string_id, gCommonFormatArgs);
format_string_to_upper(entrance_string, sizeof(entrance_string), STR_BANNER_TEXT_FORMAT, gCommonFormatArgs);
}
else
{
format_string(entrance_string, sizeof(entrance_string), string_id, gCommonFormatArgs);
format_string(entrance_string, sizeof(entrance_string), STR_BANNER_TEXT_FORMAT, gCommonFormatArgs);
}

gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
Expand All @@ -187,8 +187,8 @@ static void ride_entrance_exit_paint(paint_session* session, uint8_t direction,
uint16_t scroll = (gCurrentTicks / 2) % string_width;

sub_98199C(
session, scrolling_text_setup(session, string_id, scroll, stationObj->ScrollingMode), 0, 0, 0x1C, 0x1C, 0x33,
height + stationObj->Height, 2, 2, height + stationObj->Height);
session, scrolling_text_setup(session, STR_BANNER_TEXT_FORMAT, scroll, stationObj->ScrollingMode), 0, 0, 0x1C, 0x1C,
0x33, height + stationObj->Height, 2, 2, height + stationObj->Height);
}

image_id = entranceImageId;
Expand Down Expand Up @@ -264,26 +264,28 @@ static void park_entrance_paint(paint_session* session, uint8_t direction, int32
break;

{
rct_string_id park_text_id = STR_BANNER_TEXT_CLOSED;
set_format_arg(0, uint32_t, 0);
set_format_arg(4, uint32_t, 0);

if (gParkFlags & PARK_FLAGS_PARK_OPEN)
{
set_format_arg(0, rct_string_id, gParkName);
set_format_arg(2, uint32_t, gParkNameArgs);

park_text_id = STR_BANNER_TEXT_FORMAT;
}
else
{
set_format_arg(0, rct_string_id, STR_BANNER_TEXT_CLOSED);
set_format_arg(2, uint32_t, 0);
}

utf8 park_name[256];
if (gConfigGeneral.upper_case_banners)
{
format_string_to_upper(park_name, sizeof(park_name), park_text_id, gCommonFormatArgs);
format_string_to_upper(park_name, sizeof(park_name), STR_BANNER_TEXT_FORMAT, gCommonFormatArgs);
}
else
{
format_string(park_name, sizeof(park_name), park_text_id, gCommonFormatArgs);
format_string(park_name, sizeof(park_name), STR_BANNER_TEXT_FORMAT, gCommonFormatArgs);
}

gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
Expand All @@ -294,7 +296,8 @@ static void park_entrance_paint(paint_session* session, uint8_t direction, int32
if (entrance->scrolling_mode == SCROLLING_MODE_NONE)
break;

int32_t stsetup = scrolling_text_setup(session, park_text_id, scroll, entrance->scrolling_mode + direction / 2);
int32_t stsetup = scrolling_text_setup(
session, STR_BANNER_TEXT_FORMAT, scroll, entrance->scrolling_mode + direction / 2);
int32_t text_height = height + entrance->text_height;
sub_98199C(session, stsetup, 0, 0, 0x1C, 0x1C, 0x2F, text_height, 2, 2, text_height);
}
Expand Down
20 changes: 12 additions & 8 deletions src/openrct2/paint/tile_element/Paint.Path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,21 +451,25 @@ static void sub_6A4101(
set_format_arg(4, uint32_t, 0);

Ride* ride = get_ride(tile_element->AsPath()->GetRideIndex());
rct_string_id string_id = STR_RIDE_ENTRANCE_CLOSED;
if (ride->status == RIDE_STATUS_OPEN && !(ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN))
{
set_format_arg(0, rct_string_id, ride->name);
set_format_arg(2, uint32_t, ride->name_arguments);
string_id = STR_RIDE_ENTRANCE_NAME;
set_format_arg(0, rct_string_id, STR_RIDE_ENTRANCE_NAME);
set_format_arg(2, rct_string_id, ride->name);
set_format_arg(4, uint32_t, ride->name_arguments);
}
else
{
set_format_arg(0, rct_string_id, STR_RIDE_ENTRANCE_CLOSED);
}
if (gConfigGeneral.upper_case_banners)
{
format_string_to_upper(
gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), string_id, gCommonFormatArgs);
gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, gCommonFormatArgs);
}
else
{
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), string_id, gCommonFormatArgs);
format_string(
gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, gCommonFormatArgs);
}

gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
Expand All @@ -474,8 +478,8 @@ static void sub_6A4101(
uint16_t scroll = (gCurrentTicks / 2) % string_width;

sub_98199C(
session, scrolling_text_setup(session, string_id, scroll, scrollingMode), 0, 0, 1, 1, 21, height + 7,
boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z);
session, scrolling_text_setup(session, STR_BANNER_TEXT_FORMAT, scroll, scrollingMode), 0, 0, 1, 1, 21,
height + 7, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z);
}

session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
Expand Down

0 comments on commit 6098c1c

Please sign in to comment.