From dd7bfdc5298d9f1e4041d2666a08ba9530a69485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 30 Aug 2016 14:27:08 +0000 Subject: [PATCH] Conditionally integrate pointer at 0xEE7880 --- src/interface/viewport.c | 4 ++-- src/paint/paint.c | 11 ++++++----- src/paint/paint.h | 6 ++++-- src/windows/ride_construction.c | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/interface/viewport.c b/src/interface/viewport.c index f1f42bc442..6b0f164554 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -760,7 +760,7 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in } gfx_clear(dpi2, colour); } - RCT2_GLOBAL(0xEE7880, uint32) = 0xF1A4CC; + g_ps_EE7880 = (paint_struct *)0xF1A4CC; unk_140E9A8 = dpi2; painter_setup(); viewport_paint_setup(); @@ -1392,7 +1392,7 @@ void get_map_coordinates_from_pos(int screenX, int screenY, int flags, sint16 *x dpi->zoom_level = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_ZOOM, uint16_t); dpi->x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, int16_t); dpi->width = 1; - RCT2_GLOBAL(0xEE7880, uint32_t) = 0xF1A4CC; + g_ps_EE7880 = (paint_struct *)0xF1A4CC; unk_140E9A8 = dpi; painter_setup(); viewport_paint_setup(); diff --git a/src/paint/paint.c b/src/paint/paint.c index b33cdc6f47..6b4f1d4214 100644 --- a/src/paint/paint.c +++ b/src/paint/paint.c @@ -36,6 +36,7 @@ paint_string_struct *pss2; #ifdef NO_RCT2 paint_struct *g_paint_structs[512]; void *g_currently_drawn_item; +paint_struct * g_ps_EE7880; #else #define g_paint_structs (RCT2_ADDRESS(0x00F1A50C, paint_struct*)) #endif @@ -82,7 +83,7 @@ static paint_struct * sub_9819_c(uint32 image_id, rct_xyz16 offset, rct_xyz16 bo { paint_struct * ps = unk_EE7888; - if ((uint32) ps >= RCT2_GLOBAL(0xEE7880, uint32))return NULL; + if (ps >= g_ps_EE7880) return NULL; ps->image_id = image_id; @@ -199,7 +200,7 @@ paint_struct * sub_98196C( //Not a paint struct but something similar paint_struct *ps = unk_EE7888; - if ((uint32) ps >= RCT2_GLOBAL(0xEE7880, uint32)) { + if (ps >= g_ps_EE7880) { return NULL; } @@ -538,7 +539,7 @@ bool paint_attach_to_previous_attach(uint32 image_id, uint16 x, uint16 y) attached_paint_struct * ps = (attached_paint_struct *)unk_EE7888; - if ((uint32) ps >= RCT2_GLOBAL(0xEE7880, uint32)) { + if ((paint_struct *)ps >= g_ps_EE7880) { return false; } @@ -571,7 +572,7 @@ bool paint_attach_to_previous_ps(uint32 image_id, uint16 x, uint16 y) { attached_paint_struct * ps = (attached_paint_struct *)unk_EE7888; - if ((uint32) ps >= RCT2_GLOBAL(0xEE7880, uint32)) { + if ((paint_struct *)ps >= g_ps_EE7880) { return false; } @@ -611,7 +612,7 @@ void sub_685EBC(money32 amount, rct_string_id string_id, sint16 y, sint16 z, sin { paint_string_struct * ps = (paint_string_struct *)unk_EE7888; - if ((uint32) ps >= RCT2_GLOBAL(0xEE7880, uint32)) { + if ((paint_struct *)ps >= g_ps_EE7880) { return; } diff --git a/src/paint/paint.h b/src/paint/paint.h index 9328a6aabd..1717e196f7 100644 --- a/src/paint/paint.h +++ b/src/paint/paint.h @@ -23,11 +23,15 @@ #include "../drawing/drawing.h" typedef struct attached_paint_struct attached_paint_struct; +struct paint_struct; +typedef struct paint_struct paint_struct; #ifdef NO_RCT2 extern void *g_currently_drawn_item; +extern paint_struct * g_ps_EE7880; #else #define g_currently_drawn_item RCT2_GLOBAL(0x9DE578, void*) + #define g_ps_EE7880 RCT2_GLOBAL(0xEE7880, paint_struct *) #endif #pragma pack(push, 1) @@ -50,8 +54,6 @@ struct attached_paint_struct { assert_struct_size(attached_paint_struct, 0x12); #endif -typedef struct paint_struct paint_struct; - /* size 0x34 */ struct paint_struct { uint32 image_id; // 0x00 diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index 05728f930e..5398869a7b 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -2304,7 +2304,7 @@ static void sub_6CBCE2( gCurrentViewportFlags = 0; trackDirection &= 3; - RCT2_GLOBAL(0x00EE7880, uint32) = 0x00F1A4CC; + g_ps_EE7880 = (paint_struct *)0x00F1A4CC; painter_setup(); ride = get_ride(rideIndex);