add global macro for gCurrentFontSpriteBase and gCurrentFontFlags

This commit is contained in:
Ted John 2016-04-25 23:00:58 +01:00
parent b1f704dac4
commit 489ea66cc9
21 changed files with 83 additions and 83 deletions

View File

@ -83,6 +83,10 @@ typedef struct {
#define SPRITE_ID_PALETTE_COLOUR_1(colourId) ((IMAGE_TYPE_USE_PALETTE << 28) | ((colourId) << 19))
#define PALETTE_TO_G1_OFFSET_COUNT 144
#define gCurrentFontSpriteBase RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16)
#define gCurrentFontFlags RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16)
extern uint8 gGamePalette[256 * 4];
extern uint32 gPaletteEffectFrame;
extern const uint16 palette_to_g1_offset[];

View File

@ -232,7 +232,7 @@ int gfx_wrap_string(utf8 *text, int width, int *outNumLines, int *outFontHeight)
}
}
maxWidth = max(maxWidth, lineWidth);
*outFontHeight = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16);
*outFontHeight = gCurrentFontSpriteBase;
return maxWidth == 0 ? lineWidth : maxWidth;
}
@ -255,7 +255,7 @@ void gfx_draw_string_left_clipped(rct_drawpixelinfo* dpi, int format, void* args
buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);
format_string(buffer, format, args);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0xE0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
// Clip text - return value is not needed
gfx_clip_string(buffer, width);
@ -283,7 +283,7 @@ void gfx_draw_string_centred_clipped(rct_drawpixelinfo *dpi, int format, void *a
buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);
format_string(buffer, format, args);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0xE0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
// Clip text
text_width = gfx_clip_string(buffer, width);
@ -352,21 +352,18 @@ void gfx_draw_string_centred(rct_drawpixelinfo *dpi, int format, int x, int y, i
int gfx_draw_string_centred_wrapped(rct_drawpixelinfo *dpi, void *args, int x, int y, int width, int format, int colour)
{
int font_height, line_height, line_width, line_y, num_lines;
// Location of font sprites
sint16* current_font_sprite_base;
char* buffer = RCT2_ADDRESS(0x009C383D, char);
current_font_sprite_base = RCT2_ADDRESS(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16);
if (*current_font_sprite_base >= 0) *current_font_sprite_base = 0xE0;
if (gCurrentFontSpriteBase >= 0) {
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
}
gfx_draw_string(dpi, buffer, colour, dpi->x, dpi->y);
buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);
format_string(buffer, format, args);
*current_font_sprite_base = 0xE0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
// line_width unused here
line_width = gfx_wrap_string(buffer, width, &num_lines, &font_height);
@ -379,7 +376,7 @@ int gfx_draw_string_centred_wrapped(rct_drawpixelinfo *dpi, void *args, int x, i
font_height = (line_height / 2) * num_lines;
line_y = y - font_height;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;
gCurrentFontFlags = 0;
for (int line = 0; line <= num_lines; ++line) {
int half_width = gfx_get_string_width(buffer) / 2;
@ -408,20 +405,18 @@ int gfx_draw_string_left_wrapped(rct_drawpixelinfo *dpi, void *args, int x, int
// font height might actually be something else
int fontSpriteBase, lineHeight, lineY, numLines;
// Location of font sprites
uint16* current_font_sprite_base = RCT2_ADDRESS(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16);
*current_font_sprite_base = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
char* buffer = RCT2_ADDRESS(0x009C383D, char);
gfx_draw_string(dpi, buffer, colour, dpi->x, dpi->y);
buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);
format_string(buffer, format, args);
*current_font_sprite_base = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_wrap_string(buffer, width, &numLines, &fontSpriteBase);
lineHeight = font_get_line_height(fontSpriteBase);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;
gCurrentFontFlags = 0;
lineY = y;
for (int line = 0; line <= numLines; ++line) {
gfx_draw_string(dpi, buffer, 0xFE, x, lineY);
@ -447,7 +442,7 @@ void gfx_draw_string_left(rct_drawpixelinfo *dpi, int format, void *args, int co
buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);
format_string(buffer, format, args);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_draw_string(dpi, buffer, colour, x, y);
}
@ -458,7 +453,7 @@ void gfx_draw_string_left_centred(rct_drawpixelinfo *dpi, rct_string_id format,
{
char* buffer;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
buffer = (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER;
format_string(buffer, format, args);
int height = string_get_height_raw(buffer);
@ -526,7 +521,7 @@ void draw_string_left_underline(rct_drawpixelinfo *dpi, int format, void *args,
int width;
format_string(buffer, format, args);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
width = gfx_get_string_width(buffer);
gfx_draw_string(dpi, buffer, colour, x, y);
gfx_fill_rect(dpi, x, y + 11, x + width, y + 11, text_palette[1]);
@ -540,7 +535,7 @@ void draw_string_right_underline(rct_drawpixelinfo *dpi, int format, void *args,
int width;
format_string(buffer, format, args);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
width = gfx_get_string_width(buffer);
x -= width;
gfx_draw_string(dpi, buffer, colour, x, y);
@ -555,7 +550,7 @@ void draw_string_centred_underline(rct_drawpixelinfo *dpi, int format, void *arg
int width;
format_string(buffer, format, args);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
width = gfx_get_string_width(buffer);
x -= width / 2;
gfx_draw_string(dpi, buffer, colour, x, y);
@ -576,9 +571,9 @@ void draw_string_centred_underline(rct_drawpixelinfo *dpi, int format, void *arg
*/
void draw_string_centred_raw(rct_drawpixelinfo *dpi, int x, int y, int numLines, char *text)
{
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_draw_string(dpi, (char*)0x009C383D, 0, dpi->x, dpi->y);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;
gCurrentFontFlags = 0;
for (int i = 0; i <= numLines; i++) {
int width = gfx_get_string_width(text);
@ -593,18 +588,18 @@ void draw_string_centred_raw(rct_drawpixelinfo *dpi, int x, int y, int numLines,
}
text = (char*)(ch + 1);
y += font_get_line_height(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16));
y += font_get_line_height(gCurrentFontSpriteBase);
}
}
int string_get_height_raw(char *buffer)
{
uint16 fontBase = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16);
uint16 fontBase = gCurrentFontSpriteBase;
int height = 0;
if (fontBase <= 224)
if (fontBase <= FONT_SIZE_MEDIUM)
height += 10;
else if (fontBase == 448)
else if (fontBase == FONT_SPRITE_BASE_TINY)
height += 6;
char *ch = buffer;
@ -678,19 +673,19 @@ void gfx_draw_string_centred_wrapped_partial(rct_drawpixelinfo *dpi, int x, int
int numLines, fontSpriteBase, lineHeight, lineY;
utf8 *buffer = (utf8*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_draw_string(dpi, (char*)0x009C383D, colour, dpi->x, dpi->y);
format_string(buffer, format, args);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_wrap_string(buffer, width, &numLines, &fontSpriteBase);
lineHeight = font_get_line_height(fontSpriteBase);
int numCharactersDrawn = 0;
int numCharactersToDraw = ticks;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;
gCurrentFontFlags = 0;
lineY = y - ((numLines * lineHeight) / 2);
for (int line = 0; line <= numLines; line++) {
int halfWidth = gfx_get_string_width(buffer) / 2;
@ -1285,8 +1280,8 @@ static void ttf_draw_string(rct_drawpixelinfo *dpi, char *text, int colour, int
if (text == NULL) return;
text_draw_info info;
info.font_sprite_base = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16);
info.flags = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16);
info.font_sprite_base = gCurrentFontSpriteBase;
info.flags = gCurrentFontFlags;
info.startX = x;
info.startY = x;
info.x = x;
@ -1299,8 +1294,8 @@ static void ttf_draw_string(rct_drawpixelinfo *dpi, char *text, int colour, int
ttf_process_string(dpi, text, &info);
memcpy(text_palette, info.palette, sizeof(info.palette));
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = info.font_sprite_base;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = info.flags;
gCurrentFontSpriteBase = info.font_sprite_base;
gCurrentFontFlags = info.flags;
gLastDrawStringX = info.x;
gLastDrawStringY = info.y;
@ -1309,8 +1304,8 @@ static void ttf_draw_string(rct_drawpixelinfo *dpi, char *text, int colour, int
static int ttf_get_string_width(const utf8 *text)
{
text_draw_info info;
info.font_sprite_base = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16);
info.flags = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16);
info.font_sprite_base = gCurrentFontSpriteBase;
info.flags = gCurrentFontFlags;
info.startX = 0;
info.startY = 0;
info.x = 0;
@ -1333,8 +1328,8 @@ static int ttf_get_string_width(const utf8 *text)
void gfx_draw_string_with_y_offsets(rct_drawpixelinfo *dpi, const utf8 *text, int colour, int x, int y, const sint8 *yOffsets, bool forceSpriteFont)
{
text_draw_info info;
info.font_sprite_base = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16);
info.flags = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16);
info.font_sprite_base = gCurrentFontSpriteBase;
info.flags = gCurrentFontFlags;
info.startX = x;
info.startY = x;
info.x = x;
@ -1352,8 +1347,8 @@ void gfx_draw_string_with_y_offsets(rct_drawpixelinfo *dpi, const utf8 *text, in
ttf_process_string(dpi, text, &info);
memcpy(text_palette, info.palette, sizeof(info.palette));
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = info.font_sprite_base;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = info.flags;
gCurrentFontSpriteBase = info.font_sprite_base;
gCurrentFontFlags = info.flags;
gLastDrawStringX = info.x;
gLastDrawStringY = info.y;

View File

@ -73,8 +73,8 @@ void chat_draw()
char* lineCh = lineBuffer;
int x = _chatLeft;
int y = _chatBottom - (15 * 2);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontFlags = 0;
for (int i = 0; i < CHAT_HISTORY_SIZE; i++, y -= 15) {
if (!gChatOpen && SDL_TICKS_PASSED(SDL_GetTicks(), chat_history_get_time(i) + 10000)) {
break;

View File

@ -139,9 +139,9 @@ void console_draw(rct_drawpixelinfo *dpi)
return;
// Set font
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = (gConfigInterface.console_small_font ? FONT_SPRITE_BASE_SMALL : FONT_SPRITE_BASE_MEDIUM);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;
int lineHeight = font_get_line_height(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16));
gCurrentFontSpriteBase = (gConfigInterface.console_small_font ? FONT_SPRITE_BASE_SMALL : FONT_SPRITE_BASE_MEDIUM);
gCurrentFontFlags = 0;
int lineHeight = font_get_line_height(gCurrentFontSpriteBase);
int lines = 0;
int maxLines = ((_consoleBottom - 22 - _consoleTop) / lineHeight) - 1;

View File

@ -1467,7 +1467,7 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma
format_string(entrance_string, string_id, RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void));
}
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0x1C0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
uint16 string_width = gfx_get_string_width(entrance_string);
uint16 scroll = (gCurrentTicks / 2) % string_width;
@ -1555,7 +1555,7 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele
format_string(park_name, park_text_id, RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void));
}
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0x1C0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
uint16 string_width = gfx_get_string_width(park_name);
uint16 scroll = (gCurrentTicks / 2) % string_width;
@ -1814,7 +1814,7 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m
format_string(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char), string_id, RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void));
}
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0x1C0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
uint16 string_width = gfx_get_string_width(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char));
uint16 scroll = (gCurrentTicks / 2) % string_width;
@ -2349,7 +2349,7 @@ static void viewport_draw_money_effects()
do {
format_string(buffer, ps->string_id, &ps->args);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
bool forceSpriteFont = false;
const currency_descriptor *currencyDesc = &CurrencyDescriptors[gConfigGeneral.currency_format];

View File

@ -754,7 +754,7 @@ static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
// fill it when checkbox is pressed
if (widget_is_pressed(w, widgetIndex)) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_draw_string(dpi, (char*)CheckBoxMarkString, colour & 0x7F, l, yMid - 5);
}
}
@ -807,7 +807,7 @@ static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget
r--;
b--;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = 0xE0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
// Horizontal scrollbar
if (scroll->flags & HSCROLLBAR_VISIBLE)
@ -1163,8 +1163,8 @@ static void widget_text_box_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
//gfx_fill_rect_inset(dpi, l, t, r, b, colour, 0x20 | (!active ? 0x40 : 0x00));
gfx_fill_rect_inset(dpi, l, t, r, b, colour, 0x60);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontFlags = 0;
if (!active) {

View File

@ -175,10 +175,8 @@ static void window_changelog_paint(rct_window *w, rct_drawpixelinfo *dpi)
static void window_changelog_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
{
uint16 *currentFontFlags = RCT2_ADDRESS(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16);
sint16 *currentFontSpriteBase = RCT2_ADDRESS(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16);
*currentFontFlags = 0;
*currentFontSpriteBase = 224;
gCurrentFontFlags = 0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_draw_string(dpi, (char*)0x009C383D, 1, dpi->x, dpi->y);
int x = 3;
@ -231,7 +229,7 @@ static bool window_changelog_read_file()
_changelogLines = realloc(_changelogLines, _changelogNumLines * sizeof(char*));
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
_changelogLongestLineWidth = 0;
for (int i = 0; i < _changelogNumLines; i++) {
int width = gfx_get_string_width(_changelogLines[i]);

View File

@ -139,7 +139,7 @@ void window_dropdown_show_text(int x, int y, int extray, uint8 colour, uint8 fla
max_string_width = 0;
for (i = 0; i < num_items; i++) {
format_string(buffer, gDropdownItemsFormat[i], (void*)(&gDropdownItemsArgs[i]));
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
string_width = gfx_get_string_width(buffer);
max_string_width = max(string_width, max_string_width);
}

View File

@ -874,12 +874,13 @@ static void window_editor_inventions_list_scrollpaint(rct_window *w, rct_drawpix
format_string(ptr, stringId, NULL);
if (disableItemMovement) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = -1;
if ((colour & 0xFF) == 14 && _editorInventionsListDraggedItem == NULL)
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = -2;
gCurrentFontSpriteBase = -1;
if ((colour & 0xFF) == 14 && _editorInventionsListDraggedItem == NULL) {
gCurrentFontSpriteBase = -2;
}
colour = 64 | w->colours[1];
} else {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
colour = 0;
}

View File

@ -1470,7 +1470,7 @@ static void window_editor_object_selection_scrollpaint(rct_window *w, rct_drawpi
// Draw checkmark
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && (*listItem->flags & OBJECT_SELECTION_FLAG_SELECTED)) {
x = 2;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = colour == 14 ? -2 : -1;
gCurrentFontSpriteBase = colour == 14 ? -2 : -1;
colour2 = w->colours[1] & 0x7F;
if (*listItem->flags & (OBJECT_SELECTION_FLAG_IN_USE | OBJECT_SELECTION_FLAG_REQUIRED | OBJECT_SELECTION_FLAG_ALWAYS_REQUIRED))
colour2 |= 0x40;
@ -1484,11 +1484,11 @@ static void window_editor_object_selection_scrollpaint(rct_window *w, rct_drawpi
char *buffer = utf8_write_codepoint(bufferWithColour, colour);
if (*listItem->flags & OBJECT_SELECTION_FLAG_6) {
colour = w->colours[1] & 0x7F;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = -1;
gCurrentFontSpriteBase = -1;
}
else {
colour = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
}
if (ridePage) {

View File

@ -1211,7 +1211,7 @@ static void window_editor_objective_options_rides_scrollpaint(rct_window *w, rct
// Checkbox mark
ride = get_ride(i);
if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = stringId == 1193 ? 0xFFFE : 0xFFFF;
gCurrentFontSpriteBase = stringId == 1193 ? -2 : -1;
gfx_draw_string(dpi, (char*)CheckBoxMarkString, w->colours[1] & 0x7F, 2, y);
}

View File

@ -109,11 +109,11 @@ void window_error_open(rct_string_id title, rct_string_id message)
if (dst == _window_error_text + 1)
return;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
width = gfx_get_string_width_new_lined(_window_error_text);
width = min(196, width);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_wrap_string(_window_error_text, width + 1, &numLines, &fontHeight);
_window_error_num_lines = numLines;

View File

@ -177,7 +177,7 @@ static void window_network_status_invalidate(rct_window *w)
static void window_network_status_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
window_draw_widgets(w, dpi);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
char buffer[sizeof(window_network_status_text) + 10];
char* lineCh = buffer;
lineCh = utf8_write_codepoint(lineCh, FORMAT_BLACK);

View File

@ -1627,7 +1627,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi)
case WINDOW_OPTIONS_PAGE_CULTURE:
gfx_draw_string_left(dpi, 2776, w, w->colours[1], w->x + 10, w->y + window_options_culture_widgets[WIDX_LANGUAGE].top + 1);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_draw_string(
dpi,
(char*)LanguagesDescriptors[gCurrentLanguage].native_name,

View File

@ -269,8 +269,8 @@ static void window_text_input_paint(rct_window *w, rct_drawpixelinfo *dpi)
y += 25;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontFlags = 0;
char wrapped_string[512];
safe_strcpy(wrapped_string, text_input, 512);

View File

@ -842,7 +842,7 @@ void window_themes_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scroll
gfx_fill_rect_inset(dpi, _button_offset_x + 12 * j, y + _check_offset_y, _button_offset_x + 12 * j + 9, y + _check_offset_y + 10, w->colours[1], 0xE0);
if (colour & COLOUR_FLAG_TRANSLUCENT) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = -1;
gCurrentFontSpriteBase = -1;
gfx_draw_string(dpi, (char*)CheckBoxMarkString, w->colours[1] & 0x7F, _button_offset_x + 12 * j, y + _check_offset_y);
}

View File

@ -513,7 +513,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi)
window_draw_widgets(w, dpi);
// Set medium font size
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
// Draw column headers
rct_widget *widget;
@ -572,7 +572,7 @@ static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *
rct_map_element *element = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
do {
int type = map_element_get_type(element);
char *type_name;

View File

@ -136,7 +136,7 @@ static void window_title_logo_draw_expansion_packs(rct_drawpixelinfo *dpi)
i++;
} while (names[i - 1] != 0);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint32) = 0;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_SMALL;
gfx_draw_string(dpi, buffer, 0, x, y);
y += 10;
}

View File

@ -399,7 +399,7 @@ static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi)
if (gConfigGeneral.debugging_tools) {
utf8 path[MAX_PATH];
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
shorten_path(path, sizeof(path), scenario->path, w->width - 6);
const utf8 *pathPtr = path;
@ -481,7 +481,9 @@ static void window_scenarioselect_scrollpaint(rct_window *w, rct_drawpixelinfo *
safe_strcpy((char*)language_get_string(placeholderStringId), scenario->name, 64);
int format = isDisabled ? 865 : (isHighlighted ? highlighted_format : unhighlighted_format);
colour = isDisabled ? w->colours[1] | 0x40 : COLOUR_BLACK;
if (isDisabled) RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = -1;
if (isDisabled) {
gCurrentFontSpriteBase = -1;
}
gfx_draw_string_centred(dpi, format, wide ? 270 : 210, y + 1, colour, &placeholderStringId);
// Check if scenario is completed

View File

@ -94,21 +94,21 @@ void window_tooltip_show(rct_string_id id, int x, int y)
char* buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);
format_string(buffer, id, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
int tooltip_text_width;
tooltip_text_width = gfx_get_string_width_new_lined(buffer);
buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);
tooltip_text_width = min(tooltip_text_width, 196);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
int numLines, fontSpriteBase;
tooltip_text_width = gfx_wrap_string(buffer, tooltip_text_width + 1, &numLines, &fontSpriteBase);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TEXT_HEIGHT, sint16) = numLines;
width = tooltip_text_width + 3;
height = ((numLines + 1) * font_get_line_height(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16))) + 4;
height = ((numLines + 1) * font_get_line_height(gCurrentFontSpriteBase)) + 4;
window_tooltip_widgets[WIDX_BACKGROUND].right = width;
window_tooltip_widgets[WIDX_BACKGROUND].bottom = height;

View File

@ -40,7 +40,7 @@ void money_effect_create_at(money32 value, int x, int y, int z)
stringId = 1399;
}
format_string(buffer, stringId, &value);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
moneyEffect->offset_x = -(gfx_get_string_width(buffer) / 2);
moneyEffect->wiggle = 0;
}