From ad1b9265dca467b4d119ae8475cef866e9dd6dbf Mon Sep 17 00:00:00 2001 From: Ted John Date: Sun, 24 Apr 2016 12:31:13 +0100 Subject: [PATCH] integrate variables for various drawing pointers --- src/drawing/drawing.c | 6 ++++ src/drawing/drawing.h | 12 +++++++ src/drawing/scrolling_text.c | 2 +- src/drawing/sprite.c | 19 +++++----- src/drawing/string.c | 10 +++--- src/interface/viewport.c | 17 +++++---- src/interface/viewport.h | 8 +++++ src/paint/map_element/banner.c | 2 +- src/paint/map_element/entrance.c | 2 +- src/paint/map_element/fence.c | 4 +-- src/paint/map_element/map_element.c | 4 +-- src/paint/map_element/scenery.c | 2 +- src/paint/map_element/scenery_multiple.c | 4 +-- src/paint/map_element/surface.c | 2 +- src/paint/paint.c | 46 ++++++++++++------------ src/paint/sprite/litter.c | 2 +- src/paint/sprite/misc.c | 4 +-- src/paint/sprite/peep.c | 2 +- src/paint/sprite/sprite.c | 4 +-- src/ride/coaster/virginia_reel.c | 4 +-- src/ride/gentle/haunted_house.c | 2 +- src/ride/gentle/merry_go_round.c | 4 +-- src/ride/gentle/mini_golf.c | 4 +-- src/ride/gentle/spiral_slide.c | 2 +- src/ride/thrill/enterprise.c | 2 +- src/ride/thrill/launched_freefall.c | 2 +- src/ride/thrill/magic_carpet.c | 2 +- src/ride/thrill/pirate_ship.c | 2 +- src/ride/thrill/top_spin.c | 2 +- src/ride/thrill/twist.c | 4 +-- src/ride/track_paint.c | 2 +- src/ride/vehicle_paint.c | 2 +- src/ride/water/river_rapids.c | 2 +- src/windows/ride_construction.c | 2 +- 34 files changed, 110 insertions(+), 80 deletions(-) diff --git a/src/drawing/drawing.c b/src/drawing/drawing.c index 9c9b973a7c..55eb628397 100644 --- a/src/drawing/drawing.c +++ b/src/drawing/drawing.c @@ -34,6 +34,12 @@ uint32 gPickupPeepImage; sint32 gPickupPeepX; sint32 gPickupPeepY; +void *unk_9ABDA4; +void *unk_9E3CDC; +void *unk_9E3CE4[8]; +#if NO_RCT2 +rct_drawpixelinfo *unk_140E9A8; +#endif //Originally 0x9ABE0C, 12 elements from 0xF3 are the peep top colour, 12 elements from 0xCA are peep trouser colour const uint8 peep_palette[0x100] = { diff --git a/src/drawing/drawing.h b/src/drawing/drawing.h index 4cd3576b28..8391f685df 100644 --- a/src/drawing/drawing.h +++ b/src/drawing/drawing.h @@ -113,6 +113,18 @@ extern sint32 gPickupPeepY; extern rct_g1_element *g1Elements; extern rct_gx g2; +extern rct_drawpixelinfo gScreenDPI; +extern rct_drawpixelinfo gWindowDPI; + +extern void *unk_9ABDA4; +extern void *unk_9E3CDC; +extern void *unk_9E3CE4[8]; +#if NO_RCT2 +extern rct_drawpixelinfo *unk_140E9A8; +#else +#define unk_140E9A8 RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*) +#endif + // bool clip_drawpixelinfo(rct_drawpixelinfo *dst, rct_drawpixelinfo *src, int x, int y, int width, int height); void gfx_set_dirty_blocks(sint16 left, sint16 top, sint16 right, sint16 bottom); diff --git a/src/drawing/scrolling_text.c b/src/drawing/scrolling_text.c index 90c44a0ce4..fddb99c7e1 100644 --- a/src/drawing/scrolling_text.c +++ b/src/drawing/scrolling_text.c @@ -144,7 +144,7 @@ int scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrolling memcpy(gCommonFormatArgs, (const void*)0x013CE952, 16); } - rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo* dpi = unk_140E9A8; if (dpi->zoom_level != 0) return 0x626; diff --git a/src/drawing/sprite.c b/src/drawing/sprite.c index 83e5bf9b65..c13a2e6bdd 100644 --- a/src/drawing/sprite.c +++ b/src/drawing/sprite.c @@ -136,11 +136,10 @@ int gfx_load_g2() */ void sub_68371D() { - uint8 **unk_9E3CE4 = (uint8**)0x009E3CE4; - unk_9E3CE4[0] = NULL; - for (int i = 1; i < 8; i++) + for (int i = 1; i < 8; i++) { unk_9E3CE4[i] = g1Elements[23199 + i].offset; + } } /** @@ -238,7 +237,7 @@ static void FASTCALL gfx_bmp_sprite_to_buffer(uint8* palette_pointer, uint8* unk return; } - if (RCT2_GLOBAL(0x9E3CDC, uint32) != 0){//Not tested. I can't actually work out when this code runs. + if (unk_9E3CDC != NULL) { //Not tested. I can't actually work out when this code runs. unknown_pointer += source_pointer - source_image->offset; for (; height > 0; height -= zoom_amount){ @@ -301,14 +300,14 @@ void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo *dpi, int image_id, int RCT2_GLOBAL(0x00EDF81C, uint32) = image_id & 0xE0000000; - uint8* unknown_pointer = (uint8*)(RCT2_ADDRESS(0x9E3CE4, uint32*)[image_sub_type]); - RCT2_GLOBAL(0x009E3CDC, uint32) = (uint32)unknown_pointer; + uint8* unknown_pointer = (uint8*)unk_9E3CE4[image_sub_type]; + unk_9E3CDC = unknown_pointer; if (image_type && !(image_type & IMAGE_TYPE_UNKNOWN)) { uint8 palette_ref = (image_id >> 19) & 0xFF; if (image_type & IMAGE_TYPE_MIX_BACKGROUND){ unknown_pointer = NULL; - RCT2_GLOBAL(0x009E3CDC, uint32) = 0; + unk_9E3CDC = NULL; } else{ palette_ref &= 0x7F; @@ -318,7 +317,7 @@ void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo *dpi, int image_id, int palette_pointer = g1Elements[palette_offset].offset; } else if (image_type && !(image_type & IMAGE_TYPE_USE_PALETTE)){ - RCT2_GLOBAL(0x9E3CDC, uint32) = 0; + unk_9E3CDC = NULL; unknown_pointer = NULL; palette_pointer = RCT2_ADDRESS(0x9ABF0C, uint8); @@ -343,7 +342,7 @@ void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo *dpi, int image_id, int image_id |= IMAGE_TYPE_USE_PALETTE << 28; } else if (image_type){ - RCT2_GLOBAL(0x9E3CDC, uint32) = 0; + unk_9E3CDC = NULL; unknown_pointer = NULL; palette_pointer = RCT2_ADDRESS(0x9ABE0C, uint8); @@ -362,7 +361,7 @@ void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo *dpi, int image_id, int } //For backwards compatibility - RCT2_GLOBAL(0x9ABDA4, uint8*) = palette_pointer; + unk_9ABDA4 = palette_pointer; gfx_draw_sprite_palette_set_software(dpi, image_id, x, y, palette_pointer, unknown_pointer); } diff --git a/src/drawing/string.c b/src/drawing/string.c index bf50c33535..9b12ece3ce 100644 --- a/src/drawing/string.c +++ b/src/drawing/string.c @@ -461,7 +461,7 @@ void colour_char(uint8 colour, uint16* current_font_flags, uint8* palette_pointe palette_pointer[2] = (eax >> 8) & 0xFF; palette_pointer[3] = (eax >> 16) & 0xFF; palette_pointer[4] = (eax >> 24) & 0xFF; - RCT2_GLOBAL(0x009ABDA4, uint32) = (uint32)palette_pointer; + unk_9ABDA4 = palette_pointer; } /** @@ -481,7 +481,7 @@ void colour_char_window(uint8 colour, uint16* current_font_flags,uint8* palette_ palette_pointer[2] = (eax >> 8) & 0xFF; palette_pointer[3] = (eax >> 16) & 0xFF; palette_pointer[4] = (eax >> 24) & 0xFF; - RCT2_GLOBAL(0x009ABDA4, uint32) = (uint32)palette_pointer; + unk_9ABDA4 = palette_pointer; } /** @@ -916,7 +916,7 @@ static void ttf_draw_character_sprite(rct_drawpixelinfo *dpi, int codepoint, tex int sprite = font_sprite_get_codepoint_sprite(info->font_sprite_base, codepoint); if (!(info->flags & TEXT_DRAW_FLAG_NO_DRAW)) { - RCT2_GLOBAL(0x009ABDA4, uint8*) = (uint8*)&info->palette; + unk_9ABDA4 = &info->palette; RCT2_GLOBAL(0x00EDF81C, uint32) = (IMAGE_TYPE_USE_PALETTE << 28); int x = info->x; @@ -1079,7 +1079,7 @@ static const utf8 *ttf_process_format_code(rct_drawpixelinfo *dpi, const utf8 *t memcpy(info->palette + 5, &(g1Element->offset[250]), 2); // Set the palette pointer - RCT2_GLOBAL(0x009ABDA4, uint32) = (uint32)&info->palette; + unk_9ABDA4 = &info->palette; break; } case 3: @@ -1251,7 +1251,7 @@ static void ttf_process_initial_colour(int colour, text_draw_info *info) info->palette[2] = (eax >> 8) & 0xFF; info->palette[3] = (eax >> 16) & 0xFF; info->palette[4] = (eax >> 24) & 0xFF; - RCT2_GLOBAL(0x009ABDA4, uint8*) = (uint8*)&info->palette; + unk_9ABDA4 = &info->palette; eax = 0; } } diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 456307bfa7..650185c23a 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -41,6 +41,11 @@ rct_viewport g_viewport_list[MAX_VIEWPORT_COUNT]; +#if NO_RCT2 +paint_struct *unk_EE7884; +paint_struct *unk_EE7888; +#endif + /** * This is not a viewport function. It is used to setup many variables for * multiple things. @@ -741,7 +746,7 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in gfx_clear(dpi2, colour); } RCT2_GLOBAL(0xEE7880, uint32) = 0xF1A4CC; - RCT2_GLOBAL(0x140E9A8, uint32) = (int)dpi2; + unk_140E9A8 = dpi2; painter_setup(); viewport_paint_setup(); sub_688217(); @@ -1019,7 +1024,7 @@ static bool sub_679236_679662_679B0D_679FF1(uint32 ebx, rct_g1_element *image, u } if (ebx & 0x20000000) { - uint8 *ebx_palette = RCT2_GLOBAL(0x009ABDA4, uint8*); + uint8 *ebx_palette = unk_9ABDA4; uint8 al = *esi; uint8 al2 = *(al + ebx_palette); @@ -1288,7 +1293,7 @@ void sub_679023(rct_drawpixelinfo *dpi, int imageId, int x, int y) index &= 0x1F; } int g1Index = RCT2_ADDRESS(0x0097FCBC, uint32)[index]; - RCT2_GLOBAL(0x009ABDA4, uint8*) = g1Elements[g1Index].offset; + unk_9ABDA4 = g1Elements[g1Index].offset; } else { RCT2_GLOBAL(0x00EDF81C, uint32) = 0; } @@ -1301,8 +1306,8 @@ void sub_679023(rct_drawpixelinfo *dpi, int imageId, int x, int y) */ void sub_68862C() { - rct_drawpixelinfo *dpi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); - paint_struct *ps = RCT2_GLOBAL(0x00EE7884, paint_struct*), *old_ps, *next_ps; + rct_drawpixelinfo *dpi = unk_140E9A8; + paint_struct *ps = unk_EE7884, *old_ps, *next_ps; while ((ps = ps->next_quadrant_ps) != NULL) { old_ps = ps; @@ -1372,7 +1377,7 @@ void get_map_coordinates_from_pos(int screenX, int screenY, int flags, sint16 *x dpi->x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, int16_t); dpi->width = 1; RCT2_GLOBAL(0xEE7880, uint32_t) = 0xF1A4CC; - RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*) = dpi; + unk_140E9A8 = dpi; painter_setup(); viewport_paint_setup(); sub_688217(); diff --git a/src/interface/viewport.h b/src/interface/viewport.h index d62b8caad4..6e906ee691 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -19,6 +19,7 @@ #include "../world/map.h" #include "../world/sprite.h" +#include "../paint/paint.h" #include "window.h" enum { @@ -95,6 +96,13 @@ typedef struct viewport_interaction_info { // rct2: 0x014234BC extern rct_viewport g_viewport_list[MAX_VIEWPORT_COUNT]; +#if NO_RCT2 +extern paint_struct *unk_EE7884; +extern paint_struct *unk_EE7888; +#else + #define unk_EE7884 RCT2_GLOBAL(0x00EE7884, paint_struct*) + #define unk_EE7888 RCT2_GLOBAL(0x00EE7888, paint_struct*) +#endif void viewport_init_all(); void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_viewport* viewport); diff --git a/src/paint/map_element/banner.c b/src/paint/map_element/banner.c index d6301da193..658aae5f2c 100644 --- a/src/paint/map_element/banner.c +++ b/src/paint/map_element/banner.c @@ -30,7 +30,7 @@ void banner_paint(uint8 direction, int height, rct_map_element* map_element) { uint16 boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ; - rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo* dpi = unk_140E9A8; gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_BANNER; diff --git a/src/paint/map_element/entrance.c b/src/paint/map_element/entrance.c index 48f0f1e68e..f3f9e31496 100644 --- a/src/paint/map_element/entrance.c +++ b/src/paint/map_element/entrance.c @@ -246,7 +246,7 @@ void park_entrance_paint(uint8 direction, int height, rct_map_element* map_eleme void entrance_paint(uint8 direction, int height, rct_map_element* map_element){ gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_LABEL; - rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo* dpi = unk_140E9A8; if (gCurrentViewportFlags & VIEWPORT_FLAG_PATH_HEIGHTS && dpi->zoom_level == 0){ diff --git a/src/paint/map_element/fence.c b/src/paint/map_element/fence.c index 4ed0fb3394..aee4bbb783 100644 --- a/src/paint/map_element/fence.c +++ b/src/paint/map_element/fence.c @@ -132,10 +132,10 @@ void fence_paint_wall(uint32 frameNum, const rct_scenery_entry * sceneryEntry, u */ void fence_paint(uint8 direction, int height, rct_map_element * map_element) { - rct_drawpixelinfo * dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo *); + rct_drawpixelinfo * dpi = unk_140E9A8; gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_WALL; - rct_scenery_entry * sceneryEntry = get_wall_entry(map_element->properties.fence.type); + rct_scenery_entry * sceneryEntry = get_wall_entry(map_element->properties.fence.type); uint32 frameNum = 0; if (sceneryEntry->wall.flags2 & WALL_SCENERY_2_FLAG_5) { diff --git a/src/paint/map_element/map_element.c b/src/paint/map_element/map_element.c index a4c9e88f8b..969af11fc4 100644 --- a/src/paint/map_element/map_element.c +++ b/src/paint/map_element/map_element.c @@ -90,7 +90,7 @@ void sub_68B2B7(int x, int y) */ static void blank_tiles_paint(int x, int y) { - rct_drawpixelinfo *dpi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo *dpi = unk_140E9A8; int dx; switch (get_current_rotation()) { @@ -132,7 +132,7 @@ bool gShowSupportSegmentHeights = false; */ static void sub_68B3FB(int x, int y) { - rct_drawpixelinfo *dpi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo *dpi = unk_140E9A8; RCT2_GLOBAL(0x141F56A, uint16_t) = 0; RCT2_GLOBAL(0x9E3138, uint8_t) = 0xFF; diff --git a/src/paint/map_element/scenery.c b/src/paint/map_element/scenery.c index c00c35a617..885fd89d6e 100644 --- a/src/paint/map_element/scenery.c +++ b/src/paint/map_element/scenery.c @@ -139,7 +139,7 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) { } if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_ANIMATED) { - rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo* dpi = unk_140E9A8; if ( !(entry->small_scenery.flags & SMALL_SCENERY_FLAG21) || (dpi->zoom_level <= 1) ) { // 6E01A9: if (entry->small_scenery.flags & SMALL_SCENERY_FLAG12) { diff --git a/src/paint/map_element/scenery_multiple.c b/src/paint/map_element/scenery_multiple.c index 4244ae9642..ead978da8d 100644 --- a/src/paint/map_element/scenery_multiple.c +++ b/src/paint/map_element/scenery_multiple.c @@ -241,7 +241,7 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map return; } } - rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo* dpi = unk_140E9A8; if (dpi->zoom_level > 1) { scenery_multiple_paint_supports(direction, height, mapElement, dword_F4387C, tile); return; @@ -324,7 +324,7 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map } return; } - rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo* dpi = unk_140E9A8; if (dpi->zoom_level > 0) { scenery_multiple_paint_supports(direction, height, mapElement, dword_F4387C, tile); return; diff --git a/src/paint/map_element/surface.c b/src/paint/map_element/surface.c index f09bfc7f0c..1fdbfc8bfd 100644 --- a/src/paint/map_element/surface.c +++ b/src/paint/map_element/surface.c @@ -965,7 +965,7 @@ void viewport_surface_draw_water_side_bottom(enum edge edge, uint8 height, uint8 */ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement) { - rct_drawpixelinfo * dpi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo * dpi = unk_140E9A8; gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_TERRAIN; RCT2_GLOBAL(0x9DE57C, uint16) |= 1; // Probably a boolean indicating 'above surface' RCT2_GLOBAL(0x9E3250, rct_map_element *) = mapElement; diff --git a/src/paint/paint.c b/src/paint/paint.c index 53b8143562..1dcd313338 100644 --- a/src/paint/paint.c +++ b/src/paint/paint.c @@ -33,7 +33,7 @@ const uint32 construction_markers[] = { * rct2: 0x0068615B */ void painter_setup() { - RCT2_GLOBAL(0xEE7888, uint32) = 0x00EE788C; + unk_EE7888 = (paint_struct*)0x00EE788C; RCT2_GLOBAL(0xF1AD28, uint32) = 0; RCT2_GLOBAL(0xF1AD2C, uint32) = 0; uint8* edi = RCT2_ADDRESS(0xF1A50C, uint8); @@ -49,7 +49,7 @@ void painter_setup() { */ paint_struct * sub_9819_c(uint32 image_id, rct_xyz16 offset, rct_xyz16 boundBoxSize, rct_xyz16 boundBoxOffset, uint8 rotation) { - paint_struct * ps = RCT2_GLOBAL(0xEE7888, paint_struct*); + paint_struct * ps = unk_EE7888; if ((uint32) ps >= RCT2_GLOBAL(0xEE7880, uint32))return NULL; @@ -89,7 +89,7 @@ paint_struct * sub_9819_c(uint32 image_id, rct_xyz16 offset, rct_xyz16 boundBoxS RCT2_GLOBAL(0xF1AD1C, uint16) = left; RCT2_GLOBAL(0xF1AD1E, uint16) = bottom; - rct_drawpixelinfo * dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo * dpi = unk_140E9A8; if (right <= dpi->x)return NULL; if (top <= dpi->y)return NULL; @@ -166,7 +166,7 @@ paint_struct * sub_98196C( RCT2_GLOBAL(0xF1AD2C, uint32) = 0; //Not a paint struct but something similar - paint_struct *ps = RCT2_GLOBAL(0xEE7888, paint_struct*); + paint_struct *ps = unk_EE7888; if ((uint32) ps >= RCT2_GLOBAL(0xEE7880, uint32)) { return NULL; @@ -242,7 +242,7 @@ paint_struct * sub_98196C( RCT2_GLOBAL(0xF1AD1C, sint16) = left; RCT2_GLOBAL(0xF1AD1E, sint16) = bottom; - rct_drawpixelinfo *dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo *dpi = unk_140E9A8; if (right <= dpi->x) return NULL; if (top <= dpi->y) return NULL; @@ -302,7 +302,7 @@ paint_struct * sub_98196C( RCT2_GLOBAL(0x00F1AD10, uint32) = edi; } - RCT2_GLOBAL(0xEE7888, paint_struct*) ++; + unk_EE7888 ++; return ps; } @@ -386,7 +386,7 @@ paint_struct * sub_98197C( RCT2_GLOBAL(0x00F1AD10, uint32) = di; } - RCT2_GLOBAL(0xEE7888, paint_struct*)++; + unk_EE7888++; return ps; } @@ -431,7 +431,7 @@ paint_struct * sub_98198C( } RCT2_GLOBAL(0xF1AD28, paint_struct*) = ps; - RCT2_GLOBAL(0xEE7888, paint_struct*)++; + unk_EE7888++; return ps; } @@ -487,7 +487,7 @@ paint_struct * sub_98199C( old_ps->var_20 = ps; RCT2_GLOBAL(0xF1AD28, paint_struct*) = ps; - RCT2_GLOBAL(0xEE7888, paint_struct*)++; + unk_EE7888++; return ps; } @@ -505,7 +505,7 @@ bool paint_attach_to_previous_attach(uint32 image_id, uint16 x, uint16 y) return paint_attach_to_previous_ps(image_id, x, y); } - attached_paint_struct * ps = RCT2_GLOBAL(0xEE7888, attached_paint_struct *); + attached_paint_struct * ps = (attached_paint_struct *)unk_EE7888; if ((uint32) ps >= RCT2_GLOBAL(0xEE7880, uint32)) { return false; @@ -523,7 +523,7 @@ bool paint_attach_to_previous_attach(uint32 image_id, uint16 x, uint16 y) RCT2_GLOBAL(0xF1AD2C, attached_paint_struct *) = ps; - RCT2_GLOBAL(0xEE7888, attached_paint_struct *)++; + unk_EE7888++; return true; } @@ -538,7 +538,7 @@ bool paint_attach_to_previous_attach(uint32 image_id, uint16 x, uint16 y) */ bool paint_attach_to_previous_ps(uint32 image_id, uint16 x, uint16 y) { - attached_paint_struct * ps = RCT2_GLOBAL(0xEE7888, attached_paint_struct *); + attached_paint_struct * ps = (attached_paint_struct *)unk_EE7888; if ((uint32) ps >= RCT2_GLOBAL(0xEE7880, uint32)) { return false; @@ -554,7 +554,7 @@ bool paint_attach_to_previous_ps(uint32 image_id, uint16 x, uint16 y) return false; } - RCT2_GLOBAL(0x00EE7888, attached_paint_struct *)++; + unk_EE7888++; attached_paint_struct * oldFirstAttached = masterPs->attached_ps; masterPs->attached_ps = ps; @@ -578,7 +578,7 @@ bool paint_attach_to_previous_ps(uint32 image_id, uint16 x, uint16 y) */ void sub_685EBC(money32 amount, uint16 string_id, sint16 y, sint16 z, sint8 y_offsets[], sint16 offset_x, uint32 rotation) { - paint_string_struct * ps = RCT2_GLOBAL(0xEE7888, paint_string_struct*); + paint_string_struct * ps = (paint_string_struct *)unk_EE7888; if ((uint32) ps >= RCT2_GLOBAL(0xEE7880, uint32)) { return; @@ -598,7 +598,7 @@ void sub_685EBC(money32 amount, uint16 string_id, sint16 y, sint16 z, sint8 y_of ps->x = coord.x + offset_x; ps->y = coord.y; - RCT2_GLOBAL(0xEE7888, paint_string_struct*)++; + unk_EE7888++; paint_string_struct * oldPs = RCT2_GLOBAL(0xF1AD24, paint_string_struct*); @@ -617,7 +617,7 @@ void sub_685EBC(money32 amount, uint16 string_id, sint16 y, sint16 z, sint8 y_of */ void viewport_paint_setup() { - rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo* dpi = unk_140E9A8; rct_xy16 mapTile = { .x = dpi->x & 0xFFE0, @@ -725,7 +725,7 @@ void viewport_paint_setup() void sub_688217_helper(uint16 ax, uint8 flag) { paint_struct *ps, *ps_temp; - paint_struct *ps_next = RCT2_GLOBAL(0x00EE7884, paint_struct*); + paint_struct *ps_next = unk_EE7884; do { ps = ps_next; @@ -834,10 +834,10 @@ void sub_688217_helper(uint16 ax, uint8 flag) */ void sub_688217() { - paint_struct *ps = RCT2_GLOBAL(0x00EE7888, paint_struct*); + paint_struct *ps = unk_EE7888; paint_struct *ps_next; - RCT2_GLOBAL(0x00EE7888, paint_struct*)++; - RCT2_GLOBAL(0x00EE7884, paint_struct*) = ps; + unk_EE7888++; + unk_EE7884 = ps; ps->next_quadrant_ps = NULL; uint32 edi = RCT2_GLOBAL(0x00F1AD0C, uint32); if (edi == -1) @@ -904,8 +904,8 @@ void paint_attached_ps(paint_struct* ps, attached_paint_struct* attached_ps, rct /* rct2: 0x00688485 */ void paint_quadrant_ps() { - rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); - paint_struct* ps = RCT2_GLOBAL(0xEE7884, paint_struct*); + rct_drawpixelinfo* dpi = unk_140E9A8; + paint_struct* ps = unk_EE7884; paint_struct* previous_ps = ps->next_quadrant_ps; for (ps = ps->next_quadrant_ps; ps;) { @@ -986,7 +986,7 @@ void viewport_draw_money_effects() if (ps == NULL) return; - rct_drawpixelinfo dpi = *(RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*)); + rct_drawpixelinfo dpi = *(unk_140E9A8); draw_pixel_info_crop_by_zoom(&dpi); do { diff --git a/src/paint/sprite/litter.c b/src/paint/sprite/litter.c index 7052914723..8d5a1fbf7c 100644 --- a/src/paint/sprite/litter.c +++ b/src/paint/sprite/litter.c @@ -27,7 +27,7 @@ void litter_paint(rct_litter *litter, int imageDirection) { rct_drawpixelinfo *dpi; - dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + dpi = unk_140E9A8; if (dpi->zoom_level != 0) return; // If zoomed at all no litter drawn // litter has no sprite direction so remove that diff --git a/src/paint/sprite/misc.c b/src/paint/sprite/misc.c index b1685908a0..2274e8c9cd 100644 --- a/src/paint/sprite/misc.c +++ b/src/paint/sprite/misc.c @@ -36,7 +36,7 @@ const uint32 vehicle_particle_base_sprites[] = { */ void misc_paint(rct_sprite *misc, int imageDirection) { - rct_drawpixelinfo * dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo *); + rct_drawpixelinfo * dpi = unk_140E9A8; switch (misc->steam_particle.misc_identifier) { case SPRITE_MISC_STEAM_PARTICLE: // 0 @@ -193,4 +193,4 @@ void misc_paint(rct_sprite *misc, int imageDirection) break; } } -} \ No newline at end of file +} diff --git a/src/paint/sprite/peep.c b/src/paint/sprite/peep.c index 5ce823c651..b3ee938562 100644 --- a/src/paint/sprite/peep.c +++ b/src/paint/sprite/peep.c @@ -25,7 +25,7 @@ */ void peep_paint(rct_peep * peep, int imageDirection) { - rct_drawpixelinfo * dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo * dpi = unk_140E9A8; if (dpi->zoom_level > 2) { return; } diff --git a/src/paint/sprite/sprite.c b/src/paint/sprite/sprite.c index 42e5aacd6a..fe0dbe579e 100644 --- a/src/paint/sprite/sprite.c +++ b/src/paint/sprite/sprite.c @@ -39,13 +39,13 @@ void sprite_paint_setup(const uint16 eax, const uint16 ecx) { if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES) return; - dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + dpi = unk_140E9A8; if (dpi->zoom_level > 2) return; for (rct_sprite* spr = &g_sprite_list[sprite_idx]; sprite_idx != SPRITE_INDEX_NULL; sprite_idx = spr->unknown.next_in_quadrant) { spr = &g_sprite_list[sprite_idx]; - dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + dpi = unk_140E9A8; if (dpi->y + dpi->height <= spr->unknown.sprite_top) continue; if (spr->unknown.sprite_bottom <= dpi->y)continue; diff --git a/src/ride/coaster/virginia_reel.c b/src/ride/coaster/virginia_reel.c index f7e5786048..b76b9315f7 100644 --- a/src/ride/coaster/virginia_reel.c +++ b/src/ride/coaster/virginia_reel.c @@ -212,7 +212,7 @@ void vehicle_visual_virginia_reel(int x, int imageDirection, int y, int z, rct_v image_id = baseImage_id | (vehicle->colours.body_colour << 19) | (vehicle->colours.trim_colour << 24) | 0xA0000000; sub_98197C(image_id, 0, 0, bb->length_x, bb->length_y, bb->length_z, z, bb->offset_x, bb->offset_y, bb->offset_z + z, rotation); - if (RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*)->zoom_level < 2 && vehicle->num_peeps > 0) { + if (unk_140E9A8->zoom_level < 2 && vehicle->num_peeps > 0) { uint8 riding_peep_sprites[4] = {0xFF, 0xFF, 0xFF, 0xFF}; for (int i = 0; i < vehicle->num_peeps; i++) { riding_peep_sprites[((ecx / 8) + i) & 3] = vehicle->peep_tshirt_colours[i]; @@ -538,4 +538,4 @@ TRACK_PAINT_FUNCTION get_track_paint_function_virginia_reel(int trackType, int d } return NULL; -} \ No newline at end of file +} diff --git a/src/ride/gentle/haunted_house.c b/src/ride/gentle/haunted_house.c index e7af92e66b..751b48b502 100644 --- a/src/ride/gentle/haunted_house.c +++ b/src/ride/gentle/haunted_house.c @@ -64,7 +64,7 @@ static void paint_haunted_house_structure(uint8 rideIndex, uint8 direction, sint haunted_house_bound_box boundBox = haunted_house_data[part]; sub_98197C(imageId, xOffset, yOffset, boundBox.length_x, boundBox.length_y, 127, height, boundBox.offset_x, boundBox.offset_y, height, get_current_rotation()); - rct_drawpixelinfo * dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo * dpi = unk_140E9A8; if (dpi->zoom_level == 0 && frameNum != 0) { switch (direction) { case 0: imageId = baseImageId + 3 + frameNum; break; diff --git a/src/ride/gentle/merry_go_round.c b/src/ride/gentle/merry_go_round.c index e8a050cab2..537d06faed 100644 --- a/src/ride/gentle/merry_go_round.c +++ b/src/ride/gentle/merry_go_round.c @@ -72,7 +72,7 @@ static void paint_merry_go_round_structure(uint8 rideIndex, uint8 direction, sin uint32 imageId = (baseImageId + imageOffset) | imageColourFlags; sub_98197C(imageId, xOffset, yOffset, 24, 24, 48, height, xOffset + 16, yOffset + 16, height, get_current_rotation()); - rct_drawpixelinfo * dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo * dpi = unk_140E9A8; if (dpi->zoom_level == 0 && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != NULL) { @@ -160,4 +160,4 @@ TRACK_PAINT_FUNCTION get_track_paint_function_merry_go_round(int trackType, int } return paint_merry_go_round; -} \ No newline at end of file +} diff --git a/src/ride/gentle/mini_golf.c b/src/ride/gentle/mini_golf.c index 05997c8717..189a647ed1 100644 --- a/src/ride/gentle/mini_golf.c +++ b/src/ride/gentle/mini_golf.c @@ -972,7 +972,7 @@ void vehicle_visual_mini_golf_player(int x, int imageDirection, int y, int z, rc return; } - rct_drawpixelinfo *edi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo *edi = unk_140E9A8; if (edi->zoom_level >= 2) { return; } @@ -1001,7 +1001,7 @@ void vehicle_visual_mini_golf_ball(int x, int imageDirection, int y, int z, rct_ return; } - rct_drawpixelinfo *edi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo *edi = unk_140E9A8; if (edi->zoom_level >= 1) { return; } diff --git a/src/ride/gentle/spiral_slide.c b/src/ride/gentle/spiral_slide.c index e29a4da3ab..ddf648306f 100644 --- a/src/ride/gentle/spiral_slide.c +++ b/src/ride/gentle/spiral_slide.c @@ -102,7 +102,7 @@ static void spiral_slide_paint_tile_front(uint8 rideIndex, uint8 trackSequence, sub_98197C(image_id, 16, 16, 8, 16, 108, height, 8, 0, height + 3, get_current_rotation()); } - rct_drawpixelinfo *dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo *dpi = unk_140E9A8; if (dpi->zoom_level == 0 && ride->slide_in_use != 0) { uint8 slide_progress = ride->spiral_slide_progress; if (slide_progress != 0) { diff --git a/src/ride/thrill/enterprise.c b/src/ride/thrill/enterprise.c index c3a4f69971..616534293a 100644 --- a/src/ride/thrill/enterprise.c +++ b/src/ride/thrill/enterprise.c @@ -51,7 +51,7 @@ static void paint_enterprise_structure(rct_ride * ride, sint8 xOffset, sint8 yOf uint32 imageId = (baseImageId + imageOffset) | imageColourFlags; sub_98197C(imageId, xOffset, yOffset, 24, 24, 48, height, 0, 0, height, get_current_rotation()); - rct_drawpixelinfo * dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo *); + rct_drawpixelinfo * dpi = unk_140E9A8; if (dpi->zoom_level == 0 && imageOffset < 12 diff --git a/src/ride/thrill/launched_freefall.c b/src/ride/thrill/launched_freefall.c index 3a03bf430a..b92a269f6e 100644 --- a/src/ride/thrill/launched_freefall.c +++ b/src/ride/thrill/launched_freefall.c @@ -57,7 +57,7 @@ void vehicle_visual_launched_freefall(int x, int imageDirection, int y, int z, r sub_98197C(image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1, rotation); // Draw peeps: - if (RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*)->zoom_level < 2) { + if (unk_140E9A8->zoom_level < 2) { if (vehicle->num_peeps > 0) { baseImage_id = vehicleEntry->base_image_id + 9; if ((vehicle->restraints_position / 64) == 3) { diff --git a/src/ride/thrill/magic_carpet.c b/src/ride/thrill/magic_carpet.c index 073bedb77b..ad7547ad26 100644 --- a/src/ride/thrill/magic_carpet.c +++ b/src/ride/thrill/magic_carpet.c @@ -136,7 +136,7 @@ static void paint_magic_carpet_vehicle(rct_ride *ride, uint8 direction, uint32 s sub_98199C(vehicleImageId | imageColourFlags, (sint8)offset.x, (sint8)offset.y, bbSize.x, bbSize.y, 127, offset.z, bbOffset.x, bbOffset.y, bbOffset.z, get_current_rotation()); // Riders - rct_drawpixelinfo *dpi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo *dpi = unk_140E9A8; if (dpi->zoom_level <= 1 && (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) { rct_vehicle *vehicle = get_first_vehicle(ride); if (vehicle != NULL) { diff --git a/src/ride/thrill/pirate_ship.c b/src/ride/thrill/pirate_ship.c index afad6723be..efeba0029c 100644 --- a/src/ride/thrill/pirate_ship.c +++ b/src/ride/thrill/pirate_ship.c @@ -115,7 +115,7 @@ static void paint_pirate_ship_structure(rct_ride * ride, uint8 direction, sint8 imageId = baseImageId | imageColourFlags; sub_98199C(imageId, xOffset, yOffset, bounds.length_x, bounds.length_y, 80, height, bounds.offset_x, bounds.offset_y, height, get_current_rotation()); - rct_drawpixelinfo * dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo * dpi = unk_140E9A8; if (dpi->zoom_level <= 1 && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK diff --git a/src/ride/thrill/top_spin.c b/src/ride/thrill/top_spin.c index f07daf823a..c57ee9deca 100644 --- a/src/ride/thrill/top_spin.c +++ b/src/ride/thrill/top_spin.c @@ -171,7 +171,7 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di sub_98199C(image_id, (sint8) seatCoords.x, (sint8) seatCoords.y, lengthX, lengthY, 90, seatCoords.z, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, rotation); - rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo* dpi = unk_140E9A8; if (dpi->zoom_level < 2 && vehicle != NULL && vehicle->num_peeps != 0) { image_id = (vehicle->peep_tshirt_colours[0] << 19) | diff --git a/src/ride/thrill/twist.c b/src/ride/thrill/twist.c index 606000d19e..9f1fa7ea17 100644 --- a/src/ride/thrill/twist.c +++ b/src/ride/thrill/twist.c @@ -56,7 +56,7 @@ static void paint_twist_structure(rct_ride * ride, uint8 direction, sint8 xOffse uint32 imageId = (baseImageId + structureFrameNum) | imageColourFlags; sub_98197C(imageId, xOffset, yOffset, 24, 24, 48, height, xOffset + 16, yOffset + 16, height, get_current_rotation()); - rct_drawpixelinfo * dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo * dpi = unk_140E9A8; if (dpi->zoom_level < 1 && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK @@ -151,4 +151,4 @@ TRACK_PAINT_FUNCTION get_track_paint_function_twist(int trackType, int direction } return paint_twist; -} \ No newline at end of file +} diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index f3bbc3cc60..9275edf9a2 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -861,7 +861,7 @@ void track_paint_util_spinning_tunnel_paint(sint8 thickness, sint16 height, uint */ void track_paint(uint8 direction, int height, rct_map_element *mapElement) { - rct_drawpixelinfo *dpi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo *dpi = unk_140E9A8; rct_ride *ride; int rideIndex, trackType, trackColourScheme, trackSequence; diff --git a/src/ride/vehicle_paint.c b/src/ride/vehicle_paint.c index b1f2c34f8f..4bc45d8b8c 100644 --- a/src/ride/vehicle_paint.c +++ b/src/ride/vehicle_paint.c @@ -905,7 +905,7 @@ void vehicle_sprite_paint(rct_vehicle *vehicle, int ebx, int ecx, int z, const r if (ps != NULL) { ps->tertiary_colour = vehicle->colours_extended; } - rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*); + rct_drawpixelinfo* dpi = unk_140E9A8; if (dpi->zoom_level < 2 && vehicle->num_peeps > 0 && vehicleEntry->no_seating_rows > 0) { baseImage_id += vehicleEntry->no_vehicle_images; for (int i = 0; i < 8; i++){ diff --git a/src/ride/water/river_rapids.c b/src/ride/water/river_rapids.c index 8a90f5de17..8f36336d04 100644 --- a/src/ride/water/river_rapids.c +++ b/src/ride/water/river_rapids.c @@ -224,7 +224,7 @@ void vehicle_visual_river_rapids(int x, int imageDirection, int y, int z, rct_ve image_id = baseImage_id | (vehicle->colours.body_colour << 19) | (vehicle->colours.trim_colour << 24) | 0xA0000000; sub_98197C(image_id, 0, 0, bb->length_x, bb->length_y, bb->length_z, z, bb->offset_x, bb->offset_y, bb->offset_z + z, rotation); - if (RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*)->zoom_level < 2 && vehicle->num_peeps > 0) { + if (unk_140E9A8->zoom_level < 2 && vehicle->num_peeps > 0) { // Draw peeps: (this particular vehicle doesn't sort them back to front like others so the back ones sometimes clip, but thats how the original does it...) int peeps = ((ecx / 8) + 0) & 3; image_id = (baseImage_id + ((peeps + 1) * 72)) | (vehicle->peep_tshirt_colours[0] << 19) | (vehicle->peep_tshirt_colours[1] << 24) | 0xA0000000; diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index 5840533837..7307ccbfb2 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -2252,7 +2252,7 @@ static void window_ride_construction_draw_track_piece( } dpi->x += x - width / 2; dpi->y += y - height / 2 - 16; - RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*) = dpi; + unk_140E9A8 = dpi; uint32_t d = unknown << 16; d |= rideIndex; d |= trackType << 8;