diff --git a/src/openrct2/drawing/drawing.h b/src/openrct2/drawing/drawing.h index 9c99757d65..316ede47f2 100644 --- a/src/openrct2/drawing/drawing.h +++ b/src/openrct2/drawing/drawing.h @@ -362,9 +362,11 @@ void gfx_draw_string_with_y_offsets(rct_drawpixelinfo *dpi, const utf8 *text, si sint32 gfx_clip_string(char* buffer, sint32 width); void shorten_path(utf8 *buffer, size_t bufferSize, const utf8 *path, sint32 availableWidth); +typedef struct paint_session paint_session; + // scrolling text void scrolling_text_initialise_bitmaps(); -sint32 scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrollingMode); +sint32 scrolling_text_setup(paint_session * session, rct_string_id stringId, uint16 scroll, uint16 scrollingMode); rct_size16 FASTCALL gfx_get_sprite_size(uint32 image_id); diff --git a/src/openrct2/drawing/lightfx.c b/src/openrct2/drawing/lightfx.c index 62b92bc43c..c3cabe722b 100644 --- a/src/openrct2/drawing/lightfx.c +++ b/src/openrct2/drawing/lightfx.c @@ -654,10 +654,10 @@ void lightfx_add_3d_light(uint32 lightID, uint16 lightIDqualifier, sint16 x, sin // log_warning("new 3d light"); } -void lightfx_add_3d_light_magic_from_drawing_tile(sint16 offsetX, sint16 offsetY, sint16 offsetZ, uint8 lightType) +void lightfx_add_3d_light_magic_from_drawing_tile(rct_xy16 mapPosition, sint16 offsetX, sint16 offsetY, sint16 offsetZ, uint8 lightType) { - sint16 x = gPaintSession.MapPosition.x + offsetX; - sint16 y = gPaintSession.MapPosition.y + offsetY; + sint16 x = mapPosition.x + offsetX; + sint16 y = mapPosition.y + offsetY; switch (get_current_rotation()) { case 0: diff --git a/src/openrct2/drawing/lightfx.h b/src/openrct2/drawing/lightfx.h index bf9ef37701..8ce397de1a 100644 --- a/src/openrct2/drawing/lightfx.h +++ b/src/openrct2/drawing/lightfx.h @@ -20,6 +20,7 @@ #ifdef __ENABLE_LIGHTFX__ #include "../common.h" +#include "../world/map.h" #include "drawing.h" enum LIGHTFX_LIGHT_TYPE { @@ -58,7 +59,7 @@ const rct_palette * lightfx_get_palette(); void lightfx_add_3d_light(uint32 lightID, uint16 lightIDqualifier, sint16 x, sint16 y, uint16 z, uint8 lightType); -void lightfx_add_3d_light_magic_from_drawing_tile(sint16 offsetX, sint16 offsetY, sint16 offsetZ, uint8 lightType); +void lightfx_add_3d_light_magic_from_drawing_tile(rct_xy16 mapPosition, sint16 offsetX, sint16 offsetY, sint16 offsetZ, uint8 lightType); void lightfx_add_lights_magic_vehicles(); diff --git a/src/openrct2/drawing/scrolling_text.c b/src/openrct2/drawing/scrolling_text.c index 9b6e76d2e5..962a20b677 100644 --- a/src/openrct2/drawing/scrolling_text.c +++ b/src/openrct2/drawing/scrolling_text.c @@ -1416,11 +1416,11 @@ static const sint16* _scrollPositions[MAX_SCROLLING_TEXT_MODES] = { * @param scrollingMode (bp) * @returns ebx */ -sint32 scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrollingMode) +sint32 scrolling_text_setup(paint_session * session, rct_string_id stringId, uint16 scroll, uint16 scrollingMode) { assert(scrollingMode < MAX_SCROLLING_TEXT_MODES); - rct_drawpixelinfo* dpi = gPaintSession.Unk140E9A8; + rct_drawpixelinfo* dpi = session->Unk140E9A8; if (dpi->zoom_level != 0) return SPR_SCROLLING_TEXT_DEFAULT; diff --git a/src/openrct2/paint/map_element/banner.c b/src/openrct2/paint/map_element/banner.c index 32d4440947..8c486479b0 100644 --- a/src/openrct2/paint/map_element/banner.c +++ b/src/openrct2/paint/map_element/banner.c @@ -113,5 +113,5 @@ void banner_paint(paint_session * session, uint8 direction, sint32 height, rct_m uint16 string_width = gfx_get_string_width(gCommonStringFormatBuffer); uint16 scroll = (gCurrentTicks / 2) % string_width; - sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, get_current_rotation()); + sub_98199C(scrolling_text_setup(session, string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, get_current_rotation()); } diff --git a/src/openrct2/paint/map_element/entrance.c b/src/openrct2/paint/map_element/entrance.c index c5d10122b1..6c5862185c 100644 --- a/src/openrct2/paint/map_element/entrance.c +++ b/src/openrct2/paint/map_element/entrance.c @@ -45,21 +45,21 @@ static void ride_entrance_exit_paint(paint_session * session, uint8 direction, s #ifdef __ENABLE_LIGHTFX__ if (gConfigGeneral.enable_light_fx) { if (!is_exit) { - lightfx_add_3d_light_magic_from_drawing_tile(0, 0, height + 45, LIGHTFX_LIGHT_TYPE_LANTERN_3); + lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 0, 0, height + 45, LIGHTFX_LIGHT_TYPE_LANTERN_3); } switch (map_element_get_direction(map_element)) { case 0: - lightfx_add_3d_light_magic_from_drawing_tile(16, 0, height + 16, LIGHTFX_LIGHT_TYPE_LANTERN_2); + lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 16, 0, height + 16, LIGHTFX_LIGHT_TYPE_LANTERN_2); break; case 1: - lightfx_add_3d_light_magic_from_drawing_tile(0, -16, height + 16, LIGHTFX_LIGHT_TYPE_LANTERN_2); + lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 0, -16, height + 16, LIGHTFX_LIGHT_TYPE_LANTERN_2); break; case 2: - lightfx_add_3d_light_magic_from_drawing_tile(-16, 0, height + 16, LIGHTFX_LIGHT_TYPE_LANTERN_2); + lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, -16, 0, height + 16, LIGHTFX_LIGHT_TYPE_LANTERN_2); break; case 3: - lightfx_add_3d_light_magic_from_drawing_tile(0, 16, height + 16, LIGHTFX_LIGHT_TYPE_LANTERN_2); + lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 0, 16, height + 16, LIGHTFX_LIGHT_TYPE_LANTERN_2); break; }; } @@ -166,7 +166,7 @@ static void ride_entrance_exit_paint(paint_session * session, uint8 direction, s uint16 string_width = gfx_get_string_width(entrance_string); uint16 scroll = (gCurrentTicks / 2) % string_width; - sub_98199C(scrolling_text_setup(string_id, scroll, style->scrolling_mode), 0, 0, 0x1C, 0x1C, 0x33, height + style->height, 2, 2, height + style->height, get_current_rotation()); + sub_98199C(scrolling_text_setup(session, string_id, scroll, style->scrolling_mode), 0, 0, 0x1C, 0x1C, 0x33, height + style->height, 2, 2, height + style->height, get_current_rotation()); } image_id = _unk9E32BC; @@ -191,7 +191,7 @@ static void park_entrance_paint(paint_session * session, uint8 direction, sint32 #ifdef __ENABLE_LIGHTFX__ if (gConfigGeneral.enable_light_fx) { - lightfx_add_3d_light_magic_from_drawing_tile(0, 0, 155, LIGHTFX_LIGHT_TYPE_LANTERN_3); + lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 0, 0, 155, LIGHTFX_LIGHT_TYPE_LANTERN_3); } #endif @@ -253,7 +253,7 @@ static void park_entrance_paint(paint_session * session, uint8 direction, sint32 if (entrance->scrolling_mode == 0xFF) break; - sub_98199C(scrolling_text_setup(park_text_id, scroll, entrance->scrolling_mode + direction / 2), 0, 0, 0x1C, 0x1C, 0x2F, height + entrance->text_height, 2, 2, height + entrance->text_height, get_current_rotation()); + sub_98199C(scrolling_text_setup(session, park_text_id, scroll, entrance->scrolling_mode + direction / 2), 0, 0, 0x1C, 0x1C, 0x2F, height + entrance->text_height, 2, 2, height + entrance->text_height, get_current_rotation()); break; case 1: case 2: diff --git a/src/openrct2/paint/map_element/fence.c b/src/openrct2/paint/map_element/fence.c index 0c010b8216..35e07ab6be 100644 --- a/src/openrct2/paint/map_element/fence.c +++ b/src/openrct2/paint/map_element/fence.c @@ -382,5 +382,5 @@ void fence_paint(paint_session * session, uint8 direction, sint32 height, rct_ma uint16 string_width = gfx_get_string_width(signString); uint16 scroll = (gCurrentTicks / 2) % string_width; - sub_98199C(scrolling_text_setup(stringId, scroll, scrollingMode), 0, 0, 1, 1, 13, height + 8, boundsOffset.x, boundsOffset.y, boundsOffset.z, get_current_rotation()); + sub_98199C(scrolling_text_setup(session, stringId, scroll, scrollingMode), 0, 0, 1, 1, 13, height + 8, boundsOffset.x, boundsOffset.y, boundsOffset.z, get_current_rotation()); } diff --git a/src/openrct2/paint/map_element/path.c b/src/openrct2/paint/map_element/path.c index 1d58d0c53d..2db48407dc 100644 --- a/src/openrct2/paint/map_element/path.c +++ b/src/openrct2/paint/map_element/path.c @@ -415,7 +415,7 @@ static void sub_6A4101(paint_session * session, rct_map_element * map_element, u uint16 string_width = gfx_get_string_width(gCommonStringFormatBuffer); uint16 scroll = (gCurrentTicks / 2) % string_width; - sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 21, height + 7, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z, get_current_rotation()); + sub_98199C(scrolling_text_setup(session, string_id, scroll, scrollingMode), 0, 0, 1, 1, 21, height + 7, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z, get_current_rotation()); } session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH; @@ -781,16 +781,16 @@ void path_paint(paint_session * session, uint8 direction, uint16 height, rct_map rct_scenery_entry *sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element)); if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_LAMP) { if (!(map_element->properties.path.edges & (1 << 0))) { - lightfx_add_3d_light_magic_from_drawing_tile(-16, 0, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3); + lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, -16, 0, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3); } if (!(map_element->properties.path.edges & (1 << 1))) { - lightfx_add_3d_light_magic_from_drawing_tile(0, 16, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3); + lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 0, 16, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3); } if (!(map_element->properties.path.edges & (1 << 2))) { - lightfx_add_3d_light_magic_from_drawing_tile(16, 0, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3); + lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 16, 0, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3); } if (!(map_element->properties.path.edges & (1 << 3))) { - lightfx_add_3d_light_magic_from_drawing_tile(0, -16, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3); + lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 0, -16, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3); } } } diff --git a/src/openrct2/paint/map_element/scenery_multiple.c b/src/openrct2/paint/map_element/scenery_multiple.c index d1fd8a3f4f..74b062b208 100644 --- a/src/openrct2/paint/map_element/scenery_multiple.c +++ b/src/openrct2/paint/map_element/scenery_multiple.c @@ -367,7 +367,7 @@ void scenery_multiple_paint(paint_session * session, uint8 direction, uint16 hei uint16 string_width = gfx_get_string_width(signString); uint16 scroll = (gCurrentTicks / 2) % string_width; - sub_98199C(scrolling_text_setup(stringId, scroll, scrollMode), 0, 0, 1, 1, 21, height + 25, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation()); + sub_98199C(scrolling_text_setup(session, stringId, scroll, scrollMode), 0, 0, 1, 1, 21, height + 25, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation()); scenery_multiple_paint_supports(direction, height, mapElement, dword_F4387C, tile); }