From b6f98167c4b97a4b32bf1dcf6100be1ea318c05f Mon Sep 17 00:00:00 2001 From: adrian17 Date: Thu, 28 Aug 2014 17:27:48 +0200 Subject: [PATCH] Use macros from addresses.h --- src/audio.c | 4 ++-- src/park.c | 2 +- src/scenario.c | 2 +- src/window_new_campaign.c | 2 +- src/window_new_ride.c | 16 ++++++++-------- src/window_research.c | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/audio.c b/src/audio.c index 6fe7726f63..470862fc9a 100644 --- a/src/audio.c +++ b/src/audio.c @@ -282,7 +282,7 @@ int dsound_create_primary_buffer(int a, int device, int channels, int samples, i } WAVEFORMATEX waveformat1, waveformat2; RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER)->lpVtbl->GetFormat(RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER), &waveformat1, sizeof(WAVEFORMATEX), 0); - RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER)->lpVtbl->SetFormat(RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER), &RCT2_GLOBAL(0x01425B40, WAVEFORMATEX)); + RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER)->lpVtbl->SetFormat(RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER), &RCT2_GLOBAL(RCT2_ADDRESS_AUDIO_INFO, WAVEFORMATEX)); RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER)->lpVtbl->GetFormat(RCT2_GLOBAL(0x009E2BA8, LPDIRECTSOUNDBUFFER), &waveformat2, sizeof(WAVEFORMATEX), 0); return 1; } @@ -683,7 +683,7 @@ int sound_play_panned(int sound_id, int x) } RCT2_GLOBAL(0x014241BC, uint32) = 1; - sound_prepare(sound_id, &other_sound->sound, 1, RCT2_GLOBAL(0x009AAC6E, uint32)); + sound_prepare(sound_id, &other_sound->sound, 1, RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, uint32)); RCT2_GLOBAL(0x014241BC, uint32) = 0; RCT2_GLOBAL(0x014241BC, uint32) = 1; result = sound_play(&other_sound->sound, 0, volume, pan, 0); diff --git a/src/park.c b/src/park.c index 1779458712..159017c392 100644 --- a/src/park.c +++ b/src/park.c @@ -90,7 +90,7 @@ void park_init() RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) = MONEY(10, 00); RCT2_GLOBAL(RCT2_ADDRESS_PEEP_SPAWNS, sint16) = -1; RCT2_GLOBAL(0x013573F8, sint16) = -1; - RCT2_GLOBAL(0x01357CF2, uint16) = 127; + RCT2_GLOBAL(RCT2_ADDRESS_ACTIVE_RESEARCH_TYPES, uint16) = 127; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2; RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, uint16) = MONEY(50,00); // Cash per guest (average) diff --git a/src/scenario.c b/src/scenario.c index a2884a39d0..406179dbaa 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -139,7 +139,7 @@ void scenario_load(const char *path) sawyercoding_read_chunk(file, (uint8*)RCT2_ADDRESS_CURRENT_PARK_RATING); // Read ? - sawyercoding_read_chunk(file, (uint8*)0x01357CF2); + sawyercoding_read_chunk(file, (uint8*)RCT2_ADDRESS_ACTIVE_RESEARCH_TYPES); // Read ? sawyercoding_read_chunk(file, (uint8*)0x0135832C); diff --git a/src/window_new_campaign.c b/src/window_new_campaign.c index 16cd807000..efe6ad5afd 100644 --- a/src/window_new_campaign.c +++ b/src/window_new_campaign.c @@ -174,7 +174,7 @@ void window_new_campaign_open(sint16 campaignType) numApplicableRides = 0; window_new_campaign_rides[0] = 255; FOR_ALL_RIDES(i, ride) { - if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x03820000)) + if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x03820000)) window_new_campaign_rides[numApplicableRides++] = i; } window_new_campaign_rides[numApplicableRides] = 255; diff --git a/src/window_new_ride.c b/src/window_new_ride.c index 296aea59ce..f744a63c24 100644 --- a/src/window_new_ride.c +++ b/src/window_new_ride.c @@ -29,7 +29,7 @@ #include "widget.h" #include "window.h" -#define _window_new_ride_current_tab RCT2_GLOBAL(0x00F43824, uint8) +#define _window_new_ride_current_tab RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) typedef struct { uint8 type; @@ -374,7 +374,7 @@ static void window_new_ride_scroll_to_focused_ride(rct_window *w) // Find row index of the focused ride type rct_widget *listWidget = &window_new_ride_widgets[WIDX_RIDE_LIST]; - int focusRideType = RCT2_ADDRESS(0x00F43825, uint16)[_window_new_ride_current_tab]; + int focusRideType = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, uint16)[_window_new_ride_current_tab]; int count = 0, row = 0; ride_list_item *listItem = (ride_list_item*)0x00F43523; while (listItem->type != 255 || listItem->entry_index != 255) { @@ -436,7 +436,7 @@ void window_new_ride_open() window_new_ride_populate_list(); - w->new_ride.highlighted_ride_id = RCT2_ADDRESS(0x00F43825, sint16)[_window_new_ride_current_tab]; + w->new_ride.highlighted_ride_id = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, sint16)[_window_new_ride_current_tab]; if (w->new_ride.highlighted_ride_id == -1) w->new_ride.highlighted_ride_id = RCT2_GLOBAL(0x00F43523, sint16); @@ -579,7 +579,7 @@ static void window_new_ride_mousedown(int widgetIndex, rct_window *w, rct_widget w->new_ride.selected_ride_countdown = -1; window_new_ride_populate_list(); if (page < WINDOW_NEW_RIDE_PAGE_RESEARCH) { - w->new_ride.highlighted_ride_id = RCT2_ADDRESS(0x00F43825, sint16)[page]; + w->new_ride.highlighted_ride_id = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, sint16)[page]; if (w->new_ride.highlighted_ride_id == -1) w->new_ride.highlighted_ride_id = RCT2_GLOBAL(0x00F43523, sint16); } @@ -654,7 +654,7 @@ static void window_new_ride_scrollmousedown() if (item.type == 255 && item.entry_index == 255) return; - RCT2_ADDRESS(0x00F43825, ride_list_item)[_window_new_ride_current_tab] = item; + RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, ride_list_item)[_window_new_ride_current_tab] = item; w->new_ride.selected_ride_id = *((sint16*)&item); sound_play_panned(SOUND_CLICK_1, w->x + (w->width / 2)); @@ -683,7 +683,7 @@ static void window_new_ride_scrollmouseover() return; w->new_ride.highlighted_ride_id = *((sint16*)&item); - RCT2_ADDRESS(0x00F43825, ride_list_item)[_window_new_ride_current_tab] = item; + RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, ride_list_item)[_window_new_ride_current_tab] = item; window_invalidate(w); } @@ -715,7 +715,7 @@ static void window_new_ride_invalidate() if (_window_new_ride_current_tab == WINDOW_NEW_RIDE_PAGE_RESEARCH) { window_new_ride_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WWT_EMPTY; - uint32 typeId = RCT2_GLOBAL(0x01357CF4, uint32); + uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, uint32); if (typeId != 0xFFFFFFFF) { window_new_ride_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WWT_FLATBTN; window_new_ride_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].image = typeId >= 0x10000 ? 5189 : 5191; @@ -790,7 +790,7 @@ static void window_new_ride_paint() x = w->x + 10; y = w->y + window_new_ride_widgets[WIDX_LAST_DEVELOPMENT_GROUP].top + 12; - uint32 typeId = RCT2_GLOBAL(0x01357CF4, uint32); + uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, uint32); if (typeId != 0xFFFFFFFF) { if (typeId >= 0x10000) { rct_ride_type *rideEntry = RCT2_GLOBAL(0x009ACFA4 + (typeId & 0xFF) * 4, rct_ride_type*); diff --git a/src/window_research.c b/src/window_research.c index 0417db1afa..b65fc7dba4 100644 --- a/src/window_research.c +++ b/src/window_research.c @@ -310,7 +310,7 @@ static void window_research_development_invalidate() window_research_set_pressed_tab(w); window_research_development_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WWT_EMPTY; - uint32 typeId = RCT2_GLOBAL(0x01357CF4, uint32); + uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, uint32); if (typeId != 0xFFFFFFFF) { window_research_development_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WWT_FLATBTN; window_research_development_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].image = typeId >= 0x10000 ? 5189 : 5191; @@ -377,7 +377,7 @@ static void window_research_development_paint() x = w->x + 10; y = w->y + window_research_development_widgets[WIDX_LAST_DEVELOPMENT_GROUP].top + 12; - uint32 typeId = RCT2_GLOBAL(0x01357CF4, uint32); + uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, uint32); int lastDevelopmentFormat; if (typeId != 0xFFFFFFFF) { if (typeId >= 0x10000) {