diff --git a/src/addresses.h b/src/addresses.h
index 3719994eea..7839d72ea9 100644
--- a/src/addresses.h
+++ b/src/addresses.h
@@ -47,7 +47,6 @@
// translate between scroll positions for drawing
#define RCT2_ADDRESS_SCROLLING_MODE_POSITIONS 0x00992FB8
-#define RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS 0x009A9804
#define RCT2_ADDRESS_MAP_TOOLTIP_ARGS 0x009A9808
#define RCT2_ADDRESS_APP_PATH 0x009AA214
@@ -75,8 +74,6 @@
#define RCT2_ADDRESS_TRACKS_PATH 0x009ABA1E
#define RCT2_ADDRESS_SAVED_GAMES_PATH_2 0x009ABB37
-#define RCT2_ADDRESS_LIGHTNING_ACTIVE 0x009AC068
-
#define RCT2_ADDRESS_VIEWPORT_PAINT_BITS_PTR 0x009AC118
#define RCT2_ADDRESS_VIEWPORT_PAINT_X 0x009AC11C
#define RCT2_ADDRESS_VIEWPORT_PAINT_Y 0x009AC11E
@@ -542,6 +539,8 @@
#define RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG 0x009AB4C6
#define RCT2_ADDRESS_NAUSEA_THRESHOLDS 0x00982390 //uint16
+#define RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS 0x009A9804
+
#define RCT2_ADDRESS_SCREEN_DPI 0x009ABDC8
#define RCT2_ADDRESS_SCREEN_WIDTH 0x009ABDD8
#define RCT2_ADDRESS_SCREEN_HEIGHT 0x009ABDDA
@@ -553,6 +552,7 @@
#define RCT2_ADDRESS_NO_RAIN_PIXELS 0x009AC00C
#define RCT2_ADDRESS_RAIN_PATTERN 0x009AC010
+#define RCT2_ADDRESS_LIGHTNING_ACTIVE 0x009AC068
#define RCT2_ADDRESS_TOOL_WINDOWNUMBER 0x009DE542
#define RCT2_ADDRESS_TOOL_WINDOWCLASS 0x009DE544
diff --git a/src/game.c b/src/game.c
index 9513b5ef09..062389e52a 100644
--- a/src/game.c
+++ b/src/game.c
@@ -137,7 +137,7 @@ void update_palette_effects()
{
rct_water_type* water_type = (rct_water_type*)object_entry_groups[OBJECT_TYPE_WATER].chunks[0];
- if (RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8) == 1) {
+ if (gClimateLightningFlash == 1) {
// change palette to lighter colour during lightning
int palette = 1532;
@@ -154,9 +154,9 @@ void update_palette_effects()
paletteOffset[(i * 4) + 2] = -((0xFF - g1_element.offset[(i * 3) + 2]) / 2) - 1;
}
platform_update_palette(gGamePalette, 10, 236);
- RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8)++;
+ gClimateLightningFlash++;
} else {
- if (RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8) == 2) {
+ if (gClimateLightningFlash == 2) {
// change palette back to normal after lightning
int palette = 1532;
@@ -241,9 +241,9 @@ void update_palette_effects()
}
platform_update_palette(gGamePalette, 230, 16);
- if (RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8) == 2) {
+ if (gClimateLightningFlash == 2) {
platform_update_palette(gGamePalette, 10, 236);
- RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8) = 0;
+ gClimateLightningFlash = 0;
}
}
if (RCT2_GLOBAL(0x009E2C4C, uint32) == 2 || RCT2_GLOBAL(0x009E2C4C, uint32) == 1) {
diff --git a/src/interface/window.c b/src/interface/window.c
index 86b2e1e265..b3d6c46e6e 100644
--- a/src/interface/window.c
+++ b/src/interface/window.c
@@ -49,6 +49,8 @@ int gTextBoxFrameNo = 0;
bool gUsingWidgetTextBox = 0;
bool gLoadSaveTitleSequenceSave = 0;
+uint8 gToolbarDirtyFlags;
+
// converted from uint16 values at 0x009A41EC - 0x009A4230
// these are percentage coordinates of the viewport to center to, if a window is obscuring a location, the next is tried
float window_scroll_locations[][2] = {
diff --git a/src/interface/window.h b/src/interface/window.h
index cb9184b997..e99be2222b 100644
--- a/src/interface/window.h
+++ b/src/interface/window.h
@@ -514,6 +514,8 @@ extern rct_window * gWindowNextSlot;
// rct2: 0x00F635EE
extern ride_list_item _window_track_list_item;
+extern uint8 gToolbarDirtyFlags;
+
void window_dispatch_update_all();
void window_update_all_viewports();
void window_update_all();
diff --git a/src/management/finance.c b/src/management/finance.c
index 6442a0e529..b84ea95f05 100644
--- a/src/management/finance.c
+++ b/src/management/finance.c
@@ -71,7 +71,7 @@ void finance_payment(money32 amount, rct_expenditure_type type)
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32) -= amount; // Cumulative amount of money spent this day
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= BTM_TB_DIRTY_FLAG_MONEY;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_MONEY;
window_invalidate_by_class(WC_FINANCES);
}
@@ -324,7 +324,7 @@ void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int*
finance_update_loan_hash();
window_invalidate_by_class(WC_FINANCES);
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= 1;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_MONEY;
}
*ebx = 0;
diff --git a/src/peep/peep.c b/src/peep/peep.c
index 8f04a5af71..8f01904ee1 100644
--- a/src/peep/peep.c
+++ b/src/peep/peep.c
@@ -1319,7 +1319,7 @@ void peep_remove(rct_peep* peep){
if (peep->type == PEEP_TYPE_GUEST){
if (peep->outside_of_park == 0){
gNumGuestsInPark--;
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
}
if (peep->state == PEEP_STATE_ENTERING_PARK){
gNumGuestsHeadingForPark--;
@@ -4373,7 +4373,7 @@ static void peep_update_leaving_park(rct_peep* peep){
peep->outside_of_park = 1;
peep->destination_tolerence = 5;
gNumGuestsInPark--;
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
peep->var_37 = 1;
window_invalidate_by_class(WC_GUEST_LIST);
@@ -4497,7 +4497,7 @@ static void peep_update_entering_park(rct_peep* peep){
peep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32);
gNumGuestsInPark++;
gNumGuestsHeadingForPark--;
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
window_invalidate_by_class(WC_GUEST_LIST);
}
diff --git a/src/platform/shared.c b/src/platform/shared.c
index 297a316cde..a0f2b9b79b 100644
--- a/src/platform/shared.c
+++ b/src/platform/shared.c
@@ -25,15 +25,16 @@
#include "../cursors.h"
#include "../drawing/drawing.h"
#include "../game.h"
+#include "../input.h"
#include "../interface/console.h"
#include "../interface/keyboard_shortcut.h"
#include "../interface/window.h"
-#include "../input.h"
#include "../localisation/currency.h"
#include "../localisation/localisation.h"
#include "../openrct2.h"
#include "../title.h"
#include "../util/util.h"
+#include "../world/climate.h"
#include "platform.h"
typedef void(*update_palette_func)(const uint8*, int, int);
@@ -406,7 +407,7 @@ void platform_update_palette(const uint8* colours, int start_index, int num_colo
gPalette[i].a = 0;
float night = gDayNightCycle;
- if (night >= 0 && RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8) == 0) {
+ if (night >= 0 && gClimateLightningFlash == 0) {
gPalette[i].r = lerp(gPalette[i].r, soft_light(gPalette[i].r, 8), night);
gPalette[i].g = lerp(gPalette[i].g, soft_light(gPalette[i].g, 8), night);
gPalette[i].b = lerp(gPalette[i].b, soft_light(gPalette[i].b, 128), night);
diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c
index 8d22c64b7d..6691d9bb33 100644
--- a/src/ride/vehicle.c
+++ b/src/ride/vehicle.c
@@ -4090,7 +4090,7 @@ static void vehicle_kill_all_passengers(rct_vehicle* vehicle) {
rct_peep* peep = GET_PEEP(curVehicle->peep[i]);
if (peep->outside_of_park == 0) {
gNumGuestsInPark--;
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |=
+ gToolbarDirtyFlags |=
BTM_TB_DIRTY_FLAG_PEEP_COUNT;
}
ride->num_riders--;
diff --git a/src/scenario.c b/src/scenario.c
index c9b6333d0d..c6c72d4dc9 100644
--- a/src/scenario.c
+++ b/src/scenario.c
@@ -529,7 +529,7 @@ static void scenario_day_update()
uint16 unk = (gParkFlags & PARK_FLAGS_NO_MONEY) ? 40 : 7;
RCT2_GLOBAL(0x00135882E, uint16) = RCT2_GLOBAL(0x00135882E, uint16) > unk ? RCT2_GLOBAL(0x00135882E, uint16) - unk : 0;
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= BTM_TB_DIRTY_FLAG_DATE;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_DATE;
}
static void scenario_week_update()
diff --git a/src/windows/game_bottom_toolbar.c b/src/windows/game_bottom_toolbar.c
index 3d8ec28604..7cd6e65385 100644
--- a/src/windows/game_bottom_toolbar.c
+++ b/src/windows/game_bottom_toolbar.c
@@ -643,28 +643,28 @@ static void window_game_bottom_toolbar_unknown05(rct_window *w)
*/
static void window_game_bottom_toolbar_invalidate_dirty_widgets(rct_window *w)
{
- if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & BTM_TB_DIRTY_FLAG_MONEY){
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~BTM_TB_DIRTY_FLAG_MONEY;
+ if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_MONEY){
+ gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_MONEY;
widget_invalidate(w, WIDX_LEFT_INSET);
}
- if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & BTM_TB_DIRTY_FLAG_DATE){
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~BTM_TB_DIRTY_FLAG_DATE;
+ if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_DATE){
+ gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_DATE;
widget_invalidate(w, WIDX_RIGHT_INSET);
}
- if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & BTM_TB_DIRTY_FLAG_PEEP_COUNT){
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~BTM_TB_DIRTY_FLAG_PEEP_COUNT;
+ if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_PEEP_COUNT){
+ gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_PEEP_COUNT;
widget_invalidate(w, WIDX_LEFT_INSET);
}
- if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & BTM_TB_DIRTY_FLAG_CLIMATE){
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~BTM_TB_DIRTY_FLAG_CLIMATE;
+ if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_CLIMATE){
+ gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_CLIMATE;
widget_invalidate(w, WIDX_RIGHT_INSET);
}
- if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & BTM_TB_DIRTY_FLAG_PARK_RATING){
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~BTM_TB_DIRTY_FLAG_PARK_RATING;
+ if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_PARK_RATING){
+ gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_PARK_RATING;
widget_invalidate(w, WIDX_LEFT_INSET);
}
}
diff --git a/src/world/banner.c b/src/world/banner.c
index ce1b02ae41..f3b7816ece 100644
--- a/src/world/banner.c
+++ b/src/world/banner.c
@@ -18,7 +18,6 @@
* along with this program. If not, see .
*****************************************************************************/
-#include "../addresses.h"
#include "../game.h"
#include "../localisation/localisation.h"
#include "../ride/ride.h"
diff --git a/src/world/climate.c b/src/world/climate.c
index dce30c2fab..ce06cf10bb 100644
--- a/src/world/climate.c
+++ b/src/world/climate.c
@@ -18,18 +18,17 @@
* along with this program. If not, see .
*****************************************************************************/
-#include "../addresses.h"
#include "../audio/audio.h"
#include "../audio/mixer.h"
+#include "../cheats.h"
#include "../config.h"
#include "../drawing/drawing.h"
#include "../game.h"
+#include "../interface/window.h"
#include "../localisation/date.h"
#include "../scenario.h"
-#include "../interface/window.h"
#include "../util/util.h"
#include "climate.h"
-#include "../cheats.h"
enum {
THUNDER_STATUS_NULL = 0,
@@ -46,6 +45,8 @@ typedef struct {
static const rct_weather_transition* climate_transitions[4];
+uint16 gClimateLightningFlash;
+
// Sound data
static int _rainVolume = 1;
static unsigned int _lightningTimer, _thunderTimer;
@@ -126,15 +127,12 @@ void climate_update()
if (screen_flags & (~SCREEN_FLAGS_PLAYING)) // only normal play mode gets climate
return;
- if (gClimateUpdateTimer) {
-
- if (gClimateUpdateTimer == 960)
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= BTM_TB_DIRTY_FLAG_CLIMATE;
-
+ if (gClimateUpdateTimer) {
+ if (gClimateUpdateTimer == 960) {
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
+ }
gClimateUpdateTimer--;
-
} else if (!(gCurrentTicks & 0x7F)) {
-
if (temperature == target_temperature) {
if (cur_gloom == next_gloom) {
gClimateCurrentWeatherEffect = gClimateNextWeatherEffect;
@@ -144,7 +142,7 @@ void climate_update()
if (cur_rain == next_rain) {
gClimateCurrentWeather = gClimateNextWeather;
climate_determine_future_weather(scenario_rand());
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= BTM_TB_DIRTY_FLAG_CLIMATE;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
} else if (next_rain <= 2) { // Safe-guard
gClimateCurrentRainLevel = step_weather_level(cur_rain, next_rain);
}
@@ -155,7 +153,7 @@ void climate_update()
} else {
gClimateCurrentTemperature = step_weather_level(temperature, target_temperature);
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= BTM_TB_DIRTY_FLAG_CLIMATE;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
}
}
@@ -289,9 +287,9 @@ static void climate_update_lightning()
if (!gConfigGeneral.disable_lightning_effect) {
_lightningTimer--;
- if (RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint16) == 0)
+ if (gClimateLightningFlash == 0)
if ((util_rand() & 0xFFFF) <= 0x2000)
- RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint16) = 1;
+ gClimateLightningFlash = 1;
}
}
diff --git a/src/world/climate.h b/src/world/climate.h
index 3c4cbfac7a..ad07e585c5 100644
--- a/src/world/climate.h
+++ b/src/world/climate.h
@@ -62,6 +62,8 @@ typedef struct {
extern const rct_weather climate_weather_data[6];
+extern uint16 gClimateLightningFlash;
+
int climate_celsius_to_fahrenheit(int celsius);
void climate_reset(int climate);
void climate_update();
diff --git a/src/world/fountain.c b/src/world/fountain.c
index 6317acf8a5..5b92a0dc56 100644
--- a/src/world/fountain.c
+++ b/src/world/fountain.c
@@ -18,7 +18,6 @@
* along with this program. If not, see .
*****************************************************************************/
-#include "../addresses.h"
#include "../game.h"
#include "../scenario.h"
#include "fountain.h"
diff --git a/src/world/park.c b/src/world/park.c
index 861fd4004f..2d7cce3dd5 100644
--- a/src/world/park.c
+++ b/src/world/park.c
@@ -553,7 +553,7 @@ void park_update()
gCompanyValue = calculate_company_value();
window_invalidate_by_class(WC_FINANCES);
_guestGenerationProbability = park_calculate_guest_generation_probability();
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PARK_RATING;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PARK_RATING;
window_invalidate_by_class(WC_PARK_INFORMATION);
}
@@ -594,7 +594,7 @@ void park_update_histories()
int guestsInPark = gNumGuestsInPark;
int lastGuestsInPark = gNumGuestsInParkLastWeek;
gNumGuestsInParkLastWeek = guestsInPark;
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= 4;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
int changeInGuestsInPark = guestsInPark - lastGuestsInPark;
int guestChangeModifier = 1;
@@ -1120,7 +1120,7 @@ void game_command_buy_land_rights(int *eax, int *ebx, int *ecx, int *edx, int *e
void set_forced_park_rating(int rating){
gForcedParkRating = rating;
gParkRating = calculate_park_rating();
- RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PARK_RATING;
+ gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PARK_RATING;
window_invalidate_by_class(WC_PARK_INFORMATION);
}