From f2dea1832ac0c95f76ecae2913bb0559d83458c6 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 3 Sep 2016 14:15:29 +0100 Subject: [PATCH] Integrate gScreenshotCountdown --- src/addresses.h | 2 +- src/interface/keyboard_shortcut.c | 3 ++- src/interface/screenshot.c | 8 +++++--- src/interface/screenshot.h | 2 ++ src/windows/top_toolbar.c | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 8d11c8338c..96d30f099c 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -148,7 +148,6 @@ #define RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_Y 0x009DEA54 #define RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_Z 0x009DEA56 -#define RCT2_ADDRESS_SCREENSHOT_COUNTDOWN 0x009DEA6D #define RCT2_ADDRESS_PLACE_OBJECT_MODIFIER 0x009DEA70 #define RCT2_ADDRESS_ON_TUTORIAL 0x009DEA71 @@ -437,6 +436,7 @@ #define RCT2_ADDRESS_SCREEN_AGE 0x009DEA66 #define RCT2_ADDRESS_SCREEN_FLAGS 0x009DEA68 +#define RCT2_ADDRESS_SCREENSHOT_COUNTDOWN 0x009DEA6D #define RCT2_ADDRESS_GAME_PAUSED 0x009DEA6E #define RCT2_ADDRESS_WINDOW_DPI 0x009DEA74 diff --git a/src/interface/keyboard_shortcut.c b/src/interface/keyboard_shortcut.c index 1a169f5709..ca2f053930 100644 --- a/src/interface/keyboard_shortcut.c +++ b/src/interface/keyboard_shortcut.c @@ -19,6 +19,7 @@ #include "../game.h" #include "../editor.h" #include "../interface/chat.h" +#include "../interface/screenshot.h" #include "../input.h" #include "../localisation/localisation.h" #include "../network/network.h" @@ -480,7 +481,7 @@ static void shortcut_show_map() static void shortcut_screenshot() { - RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) = 2; + gScreenshotCountdown = 2; } static void shortcut_reduce_game_speed() diff --git a/src/interface/screenshot.c b/src/interface/screenshot.c index 653054ed7a..e00e061a4a 100644 --- a/src/interface/screenshot.c +++ b/src/interface/screenshot.c @@ -29,6 +29,8 @@ #include "screenshot.h" #include "viewport.h" +uint8 gScreenshotCountdown = 0; + /** * * rct2: 0x006E3AEC @@ -37,9 +39,9 @@ void screenshot_check() { int screenshotIndex; - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) != 0) { - RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8)--; - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) == 0) { + if (gScreenshotCountdown != 0) { + gScreenshotCountdown--; + if (gScreenshotCountdown == 0) { // update_rain_animation(); screenshotIndex = screenshot_dump(); diff --git a/src/interface/screenshot.h b/src/interface/screenshot.h index f29d54515c..ce37374840 100644 --- a/src/interface/screenshot.h +++ b/src/interface/screenshot.h @@ -19,6 +19,8 @@ #include "../drawing/drawing.h" +extern uint8 gScreenshotCountdown; + void screenshot_check(); int screenshot_dump(); int screenshot_dump_png(rct_drawpixelinfo *dpi); diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index 19ec2cb62e..6fa0811d3b 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -555,7 +555,7 @@ static void window_top_toolbar_dropdown(rct_window *w, int widgetIndex, int drop window_options_open(); break; case DDIDX_SCREENSHOT: - RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 10; + gScreenshotCountdown = 10; break; case DDIDX_GIANT_SCREENSHOT: screenshot_giant();