1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 14:54:30 +01:00

Merge pull request #8659 from Xkeeper0/f/better-sign-tooltips

Better tooltips for banners and signs
This commit is contained in:
Aaron van Geffen
2019-05-02 00:21:26 +02:00
committed by GitHub
7 changed files with 73 additions and 45 deletions

View File

@@ -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;
@@ -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;
@@ -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;
}

View File

@@ -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
};

View File

@@ -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, 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);
set_format_arg(0, rct_string_id, STR_NO_ENTRY);
}
else
{
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), string_id, gCommonFormatArgs);
set_format_arg(0, rct_string_id, gBanners[tile_element->AsBanner()->GetIndex()].string_idx);
}
if (gConfigGeneral.upper_case_banners)
{
format_string_to_upper(
gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, gCommonFormatArgs);
}
else
{
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, gCommonFormatArgs);
}
gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
@@ -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);
}

View File

@@ -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;
@@ -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;
@@ -264,7 +264,6 @@ 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);
@@ -272,18 +271,21 @@ static void park_entrance_paint(paint_session* session, uint8_t direction, int32
{
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;
@@ -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);
}

View File

@@ -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;
@@ -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;