diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index 4e10931727..9063f53269 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -426,5 +426,8 @@ Data\Language + + Data\Language + \ No newline at end of file diff --git a/src/input.c b/src/input.c index 67bee3606e..429c5c3d2e 100644 --- a/src/input.c +++ b/src/input.c @@ -531,8 +531,10 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex) } break; default: - if (!widget_is_enabled(w, widgetIndex)) - break; + if (!widget_is_enabled(w, widgetIndex)) + break; + if (widget_is_disabled(w, widgetIndex)) + break; sound_play_panned(SOUND_CLICK_1, w->x + (widget->left + widget->right) / 2); diff --git a/src/map.c b/src/map.c index f654935c4a..3db145ec96 100644 --- a/src/map.c +++ b/src/map.c @@ -25,6 +25,22 @@ static void tiles_init(); +int map_element_get_terrain(rct_map_element *element) +{ + int terrain = (element->properties.surface.terrain >> 5) & 7; + if (element->type & 1) + terrain |= (1 << 3); + return terrain; +} + +int map_element_get_terrain_edge(rct_map_element *element) +{ + int terrain_edge = (element->properties.surface.slope >> 5) & 7; + if (element->type & 128) + terrain_edge |= (1 << 3); + return terrain_edge; +} + void map_element_set_terrain(rct_map_element *element, int terrain) { // Bit 3 for terrain is stored in element.type bit 0 @@ -40,7 +56,7 @@ void map_element_set_terrain(rct_map_element *element, int terrain) void map_element_set_terrain_edge(rct_map_element *element, int terrain) { - // Bit 3 for terrain is stored in element.type bit 0 + // Bit 3 for terrain is stored in element.type bit 7 if (terrain & 8) element->type |= 128; else @@ -48,7 +64,7 @@ void map_element_set_terrain_edge(rct_map_element *element, int terrain) // Bits 0, 1, 2 for terrain are stored in element.slope bit 5, 6, 7 element->properties.surface.slope &= ~0xE0; - element->properties.surface.slope = (terrain & 7) << 5; + element->properties.surface.slope |= (terrain & 7) << 5; } rct_map_element *map_get_surface_element_at(int x, int y) diff --git a/src/map.h b/src/map.h index 1546d9e3fe..8b0073eaa0 100644 --- a/src/map.h +++ b/src/map.h @@ -195,6 +195,10 @@ typedef struct { void map_init(); void map_update_tile_pointers(); +int map_element_get_terrain(rct_map_element *element); +int map_element_get_terrain_edge(rct_map_element *element); +void map_element_set_terrain(rct_map_element *element, int terrain); +void map_element_set_terrain_edge(rct_map_element *element, int terrain); rct_map_element *map_get_surface_element_at(int x, int y); int map_element_height(int x, int y); void sub_68B089(); diff --git a/src/marketing.c b/src/marketing.c index af6179fc1c..c8a1f6e991 100644 --- a/src/marketing.c +++ b/src/marketing.c @@ -107,28 +107,28 @@ void marketing_set_guest_campaign(rct_peep *peep, int campaign) switch (campaign) { case ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE: peep->item_standard_flags |= PEEP_ITEM_VOUCHER; - peep->var_F0 = 0; + peep->voucher_type = VOUCHER_TYPE_PARK_ENTRY_FREE; break; case ADVERTISING_CAMPAIGN_RIDE_FREE: peep->item_standard_flags |= PEEP_ITEM_VOUCHER; - peep->var_F0 = 1; - peep->var_F1 = RCT2_ADDRESS(0x01358116, uint8)[campaign]; - peep->staff_id = RCT2_ADDRESS(0x01358116, uint8)[campaign]; + peep->voucher_type = VOUCHER_TYPE_RIDE_FREE; + peep->voucher_arguments = RCT2_ADDRESS(0x01358116, uint8)[campaign]; + peep->guest_heading_to_ride_id = RCT2_ADDRESS(0x01358116, uint8)[campaign]; peep->var_C6 = 240; break; case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE: peep->item_standard_flags |= PEEP_ITEM_VOUCHER; - peep->var_F0 = 2; + peep->voucher_type = VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE; break; case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE: peep->item_standard_flags |= PEEP_ITEM_VOUCHER; - peep->var_F0 = 3; - peep->var_F1 = RCT2_ADDRESS(0x01358116, uint8)[campaign]; + peep->voucher_type = VOUCHER_TYPE_FOOD_OR_DRINK_FREE; + peep->voucher_arguments = RCT2_ADDRESS(0x01358116, uint8)[campaign]; break; case ADVERTISING_CAMPAIGN_PARK: break; case ADVERTISING_CAMPAIGN_RIDE: - peep->staff_id = RCT2_ADDRESS(0x01358116, uint8)[campaign]; + peep->guest_heading_to_ride_id = RCT2_ADDRESS(0x01358116, uint8)[campaign]; peep->var_C6 = 240; break; } diff --git a/src/marketing.h b/src/marketing.h index f5ee816d3d..f94f27664d 100644 --- a/src/marketing.h +++ b/src/marketing.h @@ -33,6 +33,13 @@ enum { ADVERTISING_CAMPAIGN_COUNT }; +enum{ + VOUCHER_TYPE_PARK_ENTRY_FREE, + VOUCHER_TYPE_RIDE_FREE, + VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE, + VOUCHER_TYPE_FOOD_OR_DRINK_FREE, +}; + extern const money16 AdvertisingCampaignPricePerWeek[6]; int marketing_get_campaign_guest_generation_probability(int campaign); diff --git a/src/peep.c b/src/peep.c index d9d38c404e..f7eaa0d465 100644 --- a/src/peep.c +++ b/src/peep.c @@ -179,31 +179,31 @@ void peep_problem_warnings_update() break; case PEEP_THOUGHT_TYPE_HUNGRY: // 0x14 - if (peep->staff_id == -1){ + if (peep->guest_heading_to_ride_id == -1){ hunger_counter++; break; } - ride = &g_ride_list[peep->staff_id]; + ride = &g_ride_list[peep->guest_heading_to_ride_id]; if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x80000)) hunger_counter++; break; case PEEP_THOUGHT_TYPE_THIRSTY: - if (peep->staff_id == -1){ + if (peep->guest_heading_to_ride_id == -1){ thirst_counter++; break; } - ride = &g_ride_list[peep->staff_id]; + ride = &g_ride_list[peep->guest_heading_to_ride_id]; if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x1000000)) thirst_counter++; break; case PEEP_THOUGHT_TYPE_BATHROOM: - if (peep->staff_id == -1){ + if (peep->guest_heading_to_ride_id == -1){ bathroom_counter++; break; } - ride = &g_ride_list[peep->staff_id]; + ride = &g_ride_list[peep->guest_heading_to_ride_id]; if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x2000000)) bathroom_counter++; break; @@ -449,8 +449,8 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum break; case PEEP_STATE_WALKING: case 0x14: - if (peep->staff_id != 0xFF){ - ride = g_ride_list[peep->staff_id]; + if (peep->guest_heading_to_ride_id != 0xFF){ + ride = g_ride_list[peep->guest_heading_to_ride_id]; *argument_1 = STR_HEADING_FOR | (ride.name << 16); *argument_2 = ride.name_arguments; } @@ -691,4 +691,4 @@ int peep_is_mechanic(rct_peep *peep) peep->type == PEEP_TYPE_STAFF && peep->staff_type == STAFF_TYPE_MECHANIC ); -} \ No newline at end of file +} diff --git a/src/peep.h b/src/peep.h index d46040e6e1..2e96151f16 100644 --- a/src/peep.h +++ b/src/peep.h @@ -332,7 +332,10 @@ typedef struct { uint8 pad_2C; uint8 sprite_type; // 0x2D uint8 type; // 0x2E - uint8 staff_type; // 0x2F Also used for no_of_rides + union{ // 0x2F + uint8 staff_type; + uint8 no_of_rides; + }; uint8 tshirt_colour; // 0x30 uint8 trousers_colour; // 0x31 uint16 var_32; @@ -388,7 +391,11 @@ typedef struct { uint16 var_AE; rct_peep_thought thoughts[PEEP_MAX_THOUGHTS]; // 0xB0 uint8 var_C4; // 0xC4 - uint8 staff_id; + union // 0xC5 + { + uint8 staff_id; + uint8 guest_heading_to_ride_id; + }; uint8 var_C6; uint8 photo1_ride_ref; // 0xC7 uint32 flags; // 0xC8 @@ -406,8 +413,8 @@ typedef struct { uint8 no_of_drinks; // 0xED uint8 no_of_souvenirs; // 0xEE uint8 pad_EF; - uint8 var_F0; //voucher_type - uint8 var_F1; //voucher_type arguments i.e. ride_id + uint8 voucher_type; // 0xF0 + uint8 voucher_arguments; // 0xF1 ride_id or string_offset_id uint8 pad_F2; uint8 var_F3; uint8 pad_F4[0x02]; diff --git a/src/staff.c b/src/staff.c index 3871dfb080..d0bc47c04e 100644 --- a/src/staff.c +++ b/src/staff.c @@ -290,4 +290,4 @@ void sub_6C0C3F() } } } -} \ No newline at end of file +} diff --git a/src/widget.c b/src/widget.c index 003e86597a..0e4038d337 100644 --- a/src/widget.c +++ b/src/widget.c @@ -442,6 +442,7 @@ static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widge widget->right - widget->left - 2 ); } else { + colour &= ~(1 << 7); if (widget_is_disabled(w, widgetIndex)) colour |= 0x40; gfx_draw_string_centred_clipped( diff --git a/src/window_cheats.c b/src/window_cheats.c index 585388ee29..e0975ef90d 100644 --- a/src/window_cheats.c +++ b/src/window_cheats.c @@ -238,9 +238,9 @@ static void* window_cheats_page_events[] = { }; static uint32 window_cheats_page_enabled_widgets[] = { - (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_HIGH_MONEY) | (1 << WIDX_PARK_ENTRANCE_FEE), - (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_HAPPY_GUESTS) | (1 << WIDX_TRAM_GUESTS), - (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_FREEZE_CLIMATE) | (1 << WIDX_OPEN_CLOSE_PARK) | (1 << WIDX_DECREASE_GAME_SPEED) | (1 << WIDX_INCREASE_GAME_SPEED), + (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_HIGH_MONEY) | (1 << WIDX_PARK_ENTRANCE_FEE), + (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_HAPPY_GUESTS) | (1 << WIDX_TRAM_GUESTS), + (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_FREEZE_CLIMATE) | (1 << WIDX_OPEN_CLOSE_PARK) | (1 << WIDX_DECREASE_GAME_SPEED) | (1 << WIDX_INCREASE_GAME_SPEED), }; static void window_cheats_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w); diff --git a/src/window_footpath.c b/src/window_footpath.c index 1e70c75998..b2f06656d9 100644 --- a/src/window_footpath.c +++ b/src/window_footpath.c @@ -391,7 +391,7 @@ static void window_footpath_toolupdate() if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) { window_footpath_set_provisional_path_at_point(x, y); } else if (widgetIndex == WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL) { - RCT2_CALLPROC_X(0x006A8388, 0, 0, 0, 0, (int)w, 0, 0); + RCT2_CALLPROC_X(0x006A8388, x, y, 0, 0, (int)w, 0, 0); } } diff --git a/src/window_new_ride.c b/src/window_new_ride.c index 0c8585f1ab..b643b3c6a9 100644 --- a/src/window_new_ride.c +++ b/src/window_new_ride.c @@ -870,7 +870,7 @@ static ride_list_item window_new_ride_scroll_get_ride_list_item_at(rct_window *w int column = x / 116; int row = y / 116; - if (row >= 5) + if (column >= 5) return result; int index = column + (row * 5); diff --git a/src/window_peep.c b/src/window_peep.c index 55f98e510c..cd6c610a2b 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -21,6 +21,7 @@ #include "addresses.h" #include "game.h" #include "map.h" +#include "marketing.h" #include "ride.h" #include "peep.h" #include "scenario.h" @@ -1839,8 +1840,8 @@ void window_peep_finance_paint(){ // Paid on rides y += 10; RCT2_GLOBAL(0x13CE952, money32) = peep->paid_on_rides; - RCT2_GLOBAL(0x13CE956, uint16) = peep->staff_type; - if (peep->staff_type != 1){ + RCT2_GLOBAL(0x13CE956, uint16) = peep->no_of_rides; + if (peep->no_of_rides != 1){ gfx_draw_string_left(dpi, 2298, (void*)0x13CE952, 0, x, y); } else{ @@ -2105,19 +2106,19 @@ void window_peep_inventory_paint(){ RCT2_GLOBAL(0x13CE95A, uint32) = ride->name_arguments; break; case PEEP_ITEM_VOUCHER: - RCT2_GLOBAL(0x13CE958, uint16) = peep->var_F0 + 2418; + RCT2_GLOBAL(0x13CE958, uint16) = peep->voucher_type + 2418; RCT2_GLOBAL(0x13CE95A, uint16) = RCT2_GLOBAL(0x13573D4, uint16); RCT2_GLOBAL(0x13CE95C, uint32) = RCT2_GLOBAL(0x13573D8, uint32); - if (peep->var_F0 == 0 || peep->var_F0 == 2)break; + if (peep->voucher_type == VOUCHER_TYPE_PARK_ENTRY_FREE || peep->voucher_type == VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE)break; - int voucher_id = peep->var_F1 + 1988; + int voucher_id = peep->voucher_arguments + 1988; if (voucher_id >= 2020) voucher_id += 102; RCT2_GLOBAL(0x13CE95A, uint16) = voucher_id; - if (peep->var_F0 == 3)break; - ride = GET_RIDE(peep->var_F1); + if (peep->voucher_type == VOUCHER_TYPE_FOOD_OR_DRINK_FREE)break; + ride = GET_RIDE(peep->voucher_arguments); RCT2_GLOBAL(0x13CE95A, uint16) = ride->name; RCT2_GLOBAL(0x13CE95C, uint32) = ride->name_arguments; break; diff --git a/src/window_save_prompt.c b/src/window_save_prompt.c index 5ab0081bb5..185ef5f7b2 100644 --- a/src/window_save_prompt.c +++ b/src/window_save_prompt.c @@ -125,46 +125,48 @@ void window_save_prompt_open() // Check if window is already open window = window_bring_to_front_by_id(WC_SAVE_PROMPT, 0); - if (window == NULL) { - if (prompt_mode == PM_QUIT) { - widgets = window_quit_prompt_widgets; - enabled_widgets = - (1 << WQIDX_CLOSE) | - (1 << WQIDX_OK) | - (1 << WQIDX_CANCEL); - x = 177; - y = 34; - } else { - widgets = window_save_prompt_widgets; - enabled_widgets = - (1 << WIDX_CLOSE) | - (1 << WIDX_SAVE) | - (1 << WIDX_DONT_SAVE) | - (1 << WIDX_CANCEL); - x = 260; - y = 50; - } + if (window){ + window_close(window); + } - window = window_create( - (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2) - x/2, - max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2) - y/2), + if (prompt_mode == PM_QUIT) { + widgets = window_quit_prompt_widgets; + enabled_widgets = + (1 << WQIDX_CLOSE) | + (1 << WQIDX_OK) | + (1 << WQIDX_CANCEL); + x = 177; + y = 34; + } else { + widgets = window_save_prompt_widgets; + enabled_widgets = + (1 << WIDX_CLOSE) | + (1 << WIDX_SAVE) | + (1 << WIDX_DONT_SAVE) | + (1 << WIDX_CANCEL); + x = 260; + y = 50; + } + + window = window_create( + (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2) - x / 2, + max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2) - y / 2), x, y, (uint32*)window_save_prompt_events, WC_SAVE_PROMPT, WF_TRANSPARENT | WF_STICK_TO_FRONT - ); + ); - window->widgets = widgets; - window->enabled_widgets = enabled_widgets; - window_init_scroll_widgets(window); - window->colours[0] = 154; + window->widgets = widgets; + window->enabled_widgets = enabled_widgets; + window_init_scroll_widgets(window); + window->colours[0] = 154; - // Pause the game - RCT2_GLOBAL(0x009DEA6E, uint8) |= 2; - pause_sounds(); - window_invalidate_by_id(0x80 | WC_TOP_TOOLBAR, 0); - } + // Pause the game + RCT2_GLOBAL(0x009DEA6E, uint8) |= 2; + pause_sounds(); + window_invalidate_by_id(0x80 | WC_TOP_TOOLBAR, 0); stringId = prompt_mode + STR_LOAD_GAME; if (stringId == STR_LOAD_GAME && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) diff --git a/src/window_scenery.c b/src/window_scenery.c index 886fd5b083..3ed8744b9e 100644 --- a/src/window_scenery.c +++ b/src/window_scenery.c @@ -1088,6 +1088,12 @@ void window_scenery_scrollpaint() if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) { imageId |= (window_scenery_secondary_colour << 24) | 0x80000000; } + gfx_draw_sprite(clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32, + tertiaryColour); + + imageId = (sceneryEntry->image + 0x40000006) | (window_scenery_primary_colour << 19); + gfx_draw_sprite(clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32, + tertiaryColour); } else { imageId |= (window_scenery_primary_colour << 19) | 0x20000000; @@ -1100,11 +1106,17 @@ void window_scenery_scrollpaint() tertiaryColour = window_scenery_tertiary_colour; } + } + gfx_draw_sprite(clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32, + tertiaryColour); + + if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG5){ + gfx_draw_sprite(clipdpi, imageId + 1, 0x2F, (sceneryEntry->wall.height * 2) + 0x32, + tertiaryColour); } } - gfx_draw_sprite(clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32, - tertiaryColour); + rct2_free(clipdpi); } }