Merge pull request #2549 from OpenRCT2/notification-settings

Notification settings
This commit is contained in:
Ted John 2015-12-26 17:40:38 +00:00
commit a84f04b541
16 changed files with 471 additions and 41 deletions

View File

@ -3927,6 +3927,24 @@ STR_5585 :{SMALLFONT}{BLACK}Unlocks ride operation limits, allowing for thing
STR_5586 :Automatically open shops and stalls
STR_5587 :{SMALLFONT}{BLACK}When enabled, shops and stalls will be automatically opened after building them
STR_5588 :{SMALLFONT}{BLACK}Play with other players
STR_5589 :Notification Settings
STR_5590 :Park awards
STR_5591 :Marketing campaign has finished
STR_5592 :Park warnings
STR_5593 :Park rating warnings
STR_5594 :Ride has broken down
STR_5595 :Ride has crashed
STR_5596 :Ride warnings
STR_5597 :Ride / scenery researched
STR_5598 :Guest warnings
STR_5599 :Guest is lost
STR_5600 :Guest has left the park
STR_5601 :Guest is queuing for ride
STR_5602 :Guest is on ride
STR_5603 :Guest has left ride
STR_5604 :Guest has bought item
STR_5605 :Guest has used facility
STR_5606 :Guest has died
#####################
# Rides/attractions #

View File

@ -4,8 +4,8 @@
- Feature: Changing the number of trains no longer requires retesting.
- Feature: Add SI units as a new measurement system for distance / speed.
- Feature: Update alternative font selection mechanism for all platforms.
- Fix: [#2126] Ferris Wheels set to "backward rotation" stop working (original
bug)
- Feature: Allow enabling / disabling of different notifications.
- Fix: [#2126] Ferris Wheels set to "backward rotation" stop working (original bug)
- Fix: [#2449] Turning off Day/Night Circle while it is night doesn't reset back to day
0.0.3.1-beta (2015-12-04)

View File

@ -103,6 +103,7 @@
<ClCompile Include="src\scenario_list.c" />
<ClCompile Include="src\windows\changelog.c" />
<ClCompile Include="src\windows\network_status.c" />
<ClCompile Include="src\windows\news_options.c" />
<ClCompile Include="src\windows\player_list.c" />
<ClCompile Include="src\windows\server_list.c" />
<ClCompile Include="src\windows\server_start.c" />
@ -374,7 +375,7 @@
<PreprocessorDefinitions>$(OpenRCT2_DEFINES);DEBUG;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ObjectFileName>$(IntDir)fake\%(RelativeDir)</ObjectFileName>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<TreatSpecificWarningsAsErrors>4013</TreatSpecificWarningsAsErrors>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>

View File

@ -552,9 +552,8 @@
<ClCompile Include="src\addresses.c">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="..\src\drawing\supports.c">
<Filter>Source\Drawing</Filter>
</ClCompile>
<ClCompile Include="src\drawing\supports.c" />
<ClCompile Include="src\windows\news_options.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\management\award.h">
@ -827,9 +826,6 @@
<ClInclude Include="src\interface\colour.h">
<Filter>Source\Interface</Filter>
</ClInclude>
<ClInclude Include="src\core\Util.hpp">
<Filter>Source\Core</Filter>
</ClInclude>
<ClInclude Include="src\drawing\supports.h">
<Filter>Source\Drawing</Filter>
</ClInclude>

View File

@ -260,13 +260,34 @@ config_property_definition _networkDefinitions[] = {
{ offsetof(network_configuration, provider_website), "provider_website", CONFIG_VALUE_TYPE_STRING, {.value_string = NULL }, NULL }
};
config_property_definition _notificationsDefinitions[] = {
{ offsetof(notification_configuration, park_award), "park_award", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, park_marketing_campaign_finished), "park_marketing_campaign_finished", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, park_warnings), "park_warnings", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, park_rating_warnings), "park_rating_warnings", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, ride_broken_down), "ride_broken_down", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, ride_crashed), "ride_crashed", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, ride_warnings), "ride_warnings", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, ride_researched), "ride_researched", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, guest_warnings), "guest_warnings", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, guest_lost), "guest_lost", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
{ offsetof(notification_configuration, guest_left_park), "guest_entered_left_park", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, guest_queuing_for_ride), "guest_queuing_for_ride", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, guest_on_ride), "guest_on_ride", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, guest_left_ride), "guest_left_ride", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, guest_bought_item), "guest_bought_item", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, guest_used_facility), "guest_used_facility", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
{ offsetof(notification_configuration, guest_died), "guest_died", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
};
config_section_definition _sectionDefinitions[] = {
{ &gConfigGeneral, "general", _generalDefinitions, countof(_generalDefinitions) },
{ &gConfigInterface, "interface", _interfaceDefinitions, countof(_interfaceDefinitions) },
{ &gConfigSound, "sound", _soundDefinitions, countof(_soundDefinitions) },
{ &gConfigCheat, "cheat", _cheatDefinitions, countof(_cheatDefinitions) },
{ &gConfigTwitch, "twitch", _twitchDefinitions, countof(_twitchDefinitions) },
{ &gConfigNetwork, "network", _networkDefinitions, countof(_networkDefinitions) }
{ &gConfigNetwork, "network", _networkDefinitions, countof(_networkDefinitions) },
{ &gConfigNotifications, "notifications", _notificationsDefinitions, countof(_notificationsDefinitions) },
};
#pragma endregion
@ -277,6 +298,7 @@ sound_configuration gConfigSound;
cheat_configuration gConfigCheat;
twitch_configuration gConfigTwitch;
network_configuration gConfigNetwork;
notification_configuration gConfigNotifications;
themes_configuration gConfigThemes;
title_sequences_configuration gConfigTitleSequences;

View File

@ -229,6 +229,26 @@ typedef struct {
utf8string provider_website;
} network_configuration;
typedef struct {
bool park_award;
bool park_marketing_campaign_finished;
bool park_warnings;
bool park_rating_warnings;
bool ride_broken_down;
bool ride_crashed;
bool ride_warnings;
bool ride_researched;
bool guest_warnings;
bool guest_lost;
bool guest_left_park;
bool guest_queuing_for_ride;
bool guest_on_ride;
bool guest_left_ride;
bool guest_bought_item;
bool guest_used_facility;
bool guest_died;
} notification_configuration;
typedef struct theme_window {
uint8 colours[6];
@ -303,6 +323,7 @@ extern sound_configuration gConfigSound;
extern cheat_configuration gConfigCheat;
extern twitch_configuration gConfigTwitch;
extern network_configuration gConfigNetwork;
extern notification_configuration gConfigNotifications;
extern themes_configuration gConfigThemes;
extern title_sequences_configuration gConfigTitleSequences;

View File

@ -434,6 +434,7 @@ enum {
WC_TRACK_DELETE_PROMPT = 48,
WC_INSTALL_TRACK = 49,
WC_CLEAR_SCENERY = 50,
WC_NOTIFICATION_OPTIONS = 109,
WC_CHEATS = 110,
WC_RESEARCH = 111,
WC_VIEWPORT = 112,
@ -627,6 +628,7 @@ void window_install_track_open(const char* path);
void window_banner_open(rct_windownumber number);
void window_sign_open(rct_windownumber number);
void window_sign_small_open(rct_windownumber number);
void window_news_options_open();
void window_cheats_open();
void window_player_list_open();
void window_network_status_open(const char* text);

View File

@ -2210,6 +2210,25 @@ enum {
STR_SHOW_MULTIPLAYER_TIP = 5588,
STR_NOTIFICATION_SETTINGS = 5589,
STR_NOTIFICATION_PARK_AWARD = 5590,
STR_NOTIFICATION_PARK_MARKETING_CAMPAIGN_FINISHED = 5591,
STR_NOTIFICATION_PARK_WARNINGS = 5592,
STR_NOTIFICATION_PARK_RATING_WARNINGS = 5593,
STR_NOTIFICATION_RIDE_BROKEN_DOWN = 5594,
STR_NOTIFICATION_RIDE_CRASHED = 5595,
STR_NOTIFICATION_RIDE_WARNINGS = 5596,
STR_NOTIFICATION_RIDE_RESEARCHED = 5597,
STR_NOTIFICATION_GUEST_WARNINGS = 5598,
STR_NOTIFICATION_GUEST_LOST = 5599,
STR_NOTIFICATION_GUEST_LEFT_PARK = 5600,
STR_NOTIFICATION_GUEST_QUEUING_FOR_RIDE = 5601,
STR_NOTIFICATION_GUEST_ON_RIDE = 5602,
STR_NOTIFICATION_GUEST_LEFT_RIDE = 5603,
STR_NOTIFICATION_GUEST_BOUGHT_ITEM = 5604,
STR_NOTIFICATION_GUEST_USED_FACILITY = 5605,
STR_NOTIFICATION_GUEST_DIED = 5606,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};

View File

@ -19,6 +19,7 @@
*****************************************************************************/
#include "../addresses.h"
#include "../config.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../peep/peep.h"
@ -619,7 +620,9 @@ void award_update_all()
// Add award
gCurrentAwards[freeAwardEntryIndex].type = awardType;
gCurrentAwards[freeAwardEntryIndex].time = 5;
news_item_add_to_queue(NEWS_ITEM_AWARD, STR_NEWS_ITEM_AWARD_MOST_UNTIDY + awardType, 0);
if (gConfigNotifications.park_award) {
news_item_add_to_queue(NEWS_ITEM_AWARD, STR_NEWS_ITEM_AWARD_MOST_UNTIDY + awardType, 0);
}
window_invalidate_by_class(WC_PARK_INFORMATION);
}
}

View File

@ -19,6 +19,7 @@
*****************************************************************************/
#include "../addresses.h"
#include "../config.h"
#include "../game.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
@ -100,7 +101,9 @@ void marketing_update()
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ShopItemStringIds[campaignItem].plural;
}
news_item_add_to_queue(NEWS_ITEM_MONEY, STR_MARKETING_FINISHED_BASE + campaign, 0);
if (gConfigNotifications.park_marketing_campaign_finished) {
news_item_add_to_queue(NEWS_ITEM_MONEY, STR_MARKETING_FINISHED_BASE + campaign, 0);
}
}
}

View File

@ -19,6 +19,7 @@
*****************************************************************************/
#include "../addresses.h"
#include "../config.h"
#include "../game.h"
#include "../interface/window.h"
#include "../localisation/date.h"
@ -203,8 +204,11 @@ void research_finish_item(sint32 entryIndex)
if (RCT2_GLOBAL(0x009AC06C, uint8) == 0) {
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = ((rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) ?
rideEntry->name : base_ride_type + 2;
if (!gSilentResearch)
news_item_add_to_queue(NEWS_ITEM_RESEARCH, STR_NEWS_ITEM_RESEARCH_NEW_RIDE_AVAILABLE, entryIndex);
if (!gSilentResearch) {
if (gConfigNotifications.ride_researched) {
news_item_add_to_queue(NEWS_ITEM_RESEARCH, STR_NEWS_ITEM_RESEARCH_NEW_RIDE_AVAILABLE, entryIndex);
}
}
}
research_invalidate_related_windows();
@ -219,8 +223,11 @@ void research_finish_item(sint32 entryIndex)
// I don't think 0x009AC06C is ever not 0, so probably redundant
if (RCT2_GLOBAL(0x009AC06C, uint8) == 0) {
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = scenerySetEntry->name;
if (!gSilentResearch)
news_item_add_to_queue(NEWS_ITEM_RESEARCH, STR_NEWS_ITEM_RESEARCH_NEW_SCENERY_SET_AVAILABLE, entryIndex);
if (!gSilentResearch) {
if (gConfigNotifications.ride_researched) {
news_item_add_to_queue(NEWS_ITEM_RESEARCH, STR_NEWS_ITEM_RESEARCH_NEW_SCENERY_SET_AVAILABLE, entryIndex);
}
}
}
research_invalidate_related_windows();

View File

@ -1326,11 +1326,13 @@ void peep_update_falling(rct_peep* peep){
peep_update_action(&x, &y, &xy_distance, peep);
if (peep->action == PEEP_ACTION_DROWNING) return;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x80000)){
if (gConfigNotifications.guest_died) {
RCT2_GLOBAL(0x13CE952, uint16) = peep->name_string_idx;
RCT2_GLOBAL(0x13CE954, uint32) = peep->id;
news_item_add_to_queue(NEWS_ITEM_BLANK, STR_NEWS_ITEM_GUEST_DROWNED, peep->x | (peep->y << 16));
}
RCT2_GLOBAL(0x135882E, uint16) += 25;
if (RCT2_GLOBAL(0x135882E, uint16) > 1000){
RCT2_GLOBAL(0x135882E, uint16) = 1000;
@ -2123,7 +2125,9 @@ static void peep_update_ride_sub_state_2_enter_ride(rct_peep* peep, rct_ride* ri
else
msg_string = STR_PEEP_TRACKING_PEEP_IS_ON_X;
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, msg_string, peep->sprite_index);
if (gConfigNotifications.guest_on_ride) {
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, msg_string, peep->sprite_index);
}
}
if (ride->type == RIDE_TYPE_SPIRAL_SLIDE){
@ -3169,7 +3173,9 @@ static void peep_update_ride_sub_state_18(rct_peep* peep){
RCT2_GLOBAL(0x13CE958, uint16) = ride->name;
RCT2_GLOBAL(0x13CE95A, uint32) = ride->name_arguments;
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_LEFT_RIDE_X, peep->sprite_index);
if (gConfigNotifications.guest_left_ride) {
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_LEFT_RIDE_X, peep->sprite_index);
}
}
peep->var_79 = 0xFF;
@ -5264,52 +5270,68 @@ void peep_problem_warnings_update()
--warning_throttle[0];
else if ( hunger_counter >= PEEP_HUNGER_WARNING_THRESHOLD && hunger_counter >= guests_in_park / 16) {
warning_throttle[0] = 4;
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_ARE_HUNGRY, 20);
if (gConfigNotifications.guest_warnings) {
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_ARE_HUNGRY, 20);
}
}
if (warning_throttle[1])
--warning_throttle[1];
else if (thirst_counter >= PEEP_THIRST_WARNING_THRESHOLD && thirst_counter >= guests_in_park / 16) {
warning_throttle[1] = 4;
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_ARE_THIRSTY, 21);
if (gConfigNotifications.guest_warnings) {
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_ARE_THIRSTY, 21);
}
}
if (warning_throttle[2])
--warning_throttle[2];
else if (bathroom_counter >= PEEP_BATHROOM_WARNING_THRESHOLD && bathroom_counter >= guests_in_park / 16) {
warning_throttle[2] = 4;
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_CANT_FIND_BATHROOM, 22);
if (gConfigNotifications.guest_warnings) {
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_CANT_FIND_BATHROOM, 22);
}
}
if (warning_throttle[3])
--warning_throttle[3];
else if (litter_counter >= PEEP_LITTER_WARNING_THRESHOLD && litter_counter >= guests_in_park / 32) {
warning_throttle[3] = 4;
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_DISLIKE_LITTER, 26);
if (gConfigNotifications.guest_warnings) {
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_DISLIKE_LITTER, 26);
}
}
if (warning_throttle[4])
--warning_throttle[4];
else if (disgust_counter >= PEEP_DISGUST_WARNING_THRESHOLD && disgust_counter >= guests_in_park / 32) {
warning_throttle[4] = 4;
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_DISGUSTED_BY_PATHS, 31);
if (gConfigNotifications.guest_warnings) {
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_DISGUSTED_BY_PATHS, 31);
}
}
if (warning_throttle[5])
--warning_throttle[5];
else if (vandalism_counter >= PEEP_VANDALISM_WARNING_THRESHOLD && vandalism_counter >= guests_in_park / 32) {
warning_throttle[5] = 4;
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_DISLIKE_VANDALISM, 33);
if (gConfigNotifications.guest_warnings) {
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_DISLIKE_VANDALISM, 33);
}
}
if (warning_throttle[6])
--warning_throttle[6];
else if (noexit_counter >= PEEP_NOEXIT_WARNING_THRESHOLD) {
warning_throttle[6] = 4;
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_GETTING_LOST_OR_STUCK, 27);
if (gConfigNotifications.guest_warnings) {
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_GETTING_LOST_OR_STUCK, 27);
}
} else if (lost_counter >= PEEP_LOST_WARNING_THRESHOLD) {
warning_throttle[6] = 4;
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_GETTING_LOST_OR_STUCK, 16);
if (gConfigNotifications.guest_warnings) {
news_item_add_to_queue(NEWS_ITEM_PEEPS, STR_PEEPS_GETTING_LOST_OR_STUCK, 16);
}
}
}
@ -6297,7 +6319,9 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m
RCT2_GLOBAL(0x0013CE954, uint32) = peep->id;
RCT2_GLOBAL(0x0013CE958, rct_string_id) = ride->name;
RCT2_GLOBAL(0x0013CE95A, uint32) = ride->name_arguments;
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, peep->sprite_index);
if (gConfigNotifications.guest_queuing_for_ride) {
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, peep->sprite_index);
}
}
return 1;
}
@ -6339,7 +6363,9 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m
if (peep->flags & PEEP_FLAGS_TRACKING){
RCT2_GLOBAL(0x0013CE952, rct_string_id) = peep->name_string_idx;
RCT2_GLOBAL(0x0013CE954, uint32) = peep->id;
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_LEFT_PARK, peep->sprite_index);
if (gConfigNotifications.guest_left_park) {
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_LEFT_PARK, peep->sprite_index);
}
}
return 1;
}
@ -6674,7 +6700,9 @@ static int peep_interact_with_path(rct_peep* peep, sint16 x, sint16 y, rct_map_e
RCT2_GLOBAL(0x0013CE954, uint32) = peep->id;
RCT2_GLOBAL(0x0013CE958, rct_string_id) = ride->name;
RCT2_GLOBAL(0x0013CE95A, uint32) = ride->name_arguments;
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, peep->sprite_index);
if (gConfigNotifications.guest_queuing_for_ride) {
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, peep->sprite_index);
}
}
return peep_footpath_move_forward(peep, x, y, map_element, vandalism_present);
@ -6746,7 +6774,9 @@ static int peep_interact_with_shop(rct_peep* peep, sint16 x, sint16 y, rct_map_e
RCT2_GLOBAL(0x0013CE958, rct_string_id) = ride->name;
RCT2_GLOBAL(0x0013CE95A, uint32) = ride->name_arguments;
rct_string_id string_id = ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IN_RIDE) ? 1933 : 1932;
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, string_id, peep->sprite_index);
if (gConfigNotifications.guest_used_facility) {
news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, string_id, peep->sprite_index);
}
}
return 1;
}
@ -8287,7 +8317,9 @@ loc_69B221:
RCT2_GLOBAL(0x13CE952,uint16) = peep->name_string_idx;
RCT2_GLOBAL((0x13CE952 + 2), uint32) = peep->id;
RCT2_GLOBAL((0x13CE956 + 2), uint16) = (shopItem >= 32 ? STR_SHOP_ITEM_INDEFINITE_PHOTO2 + (shopItem - 32) : STR_SHOP_ITEM_INDEFINITE_BALLOON + shopItem);
news_item_add_to_queue(2, STR_PEEP_TRACKING_NOTIFICATION_BOUGHT_X, peep->sprite_index);
if (gConfigNotifications.guest_bought_item) {
news_item_add_to_queue(2, STR_PEEP_TRACKING_NOTIFICATION_BOUGHT_X, peep->sprite_index);
}
}
if (shop_item_is_food(shopItem))

View File

@ -2299,7 +2299,9 @@ void ride_breakdown_add_news_item(int rideIndex)
RCT2_GLOBAL(0x0013CE952 + 0, uint16) = ride->name;
RCT2_GLOBAL(0x0013CE952 + 2, uint32) = ride->name_arguments;
news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_IS_BROKEN_DOWN, rideIndex);
if (gConfigNotifications.ride_broken_down) {
news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_IS_BROKEN_DOWN, rideIndex);
}
}
/**
@ -2323,7 +2325,9 @@ static void ride_breakdown_status_update(int rideIndex)
) {
RCT2_GLOBAL(0x0013CE952 + 0, uint16) = ride->name;
RCT2_GLOBAL(0x0013CE952 + 2, uint32) = ride->name_arguments;
news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_IS_STILL_NOT_FIXED, rideIndex);
if (gConfigNotifications.ride_warnings) {
news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_IS_STILL_NOT_FIXED, rideIndex);
}
}
}
@ -3043,7 +3047,9 @@ static void ride_entrance_exit_connected(rct_ride* ride, int ride_idx)
// name of ride is parameter of the format string
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name;
RCT2_GLOBAL(0x013CE954, uint32) = ride->name_arguments;
if (gConfigNotifications.ride_warnings) {
news_item_add_to_queue(1, STR_ENTRANCE_NOT_CONNECTED, ride_idx);
}
ride->connected_message_throttle = 3;
}
@ -3051,7 +3057,9 @@ static void ride_entrance_exit_connected(rct_ride* ride, int ride_idx)
// name of ride is parameter of the format string
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name;
RCT2_GLOBAL(0x013CE954, uint32) = ride->name_arguments;
if (gConfigNotifications.ride_warnings) {
news_item_add_to_queue(1, STR_EXIT_NOT_CONNECTED, ride_idx);
}
ride->connected_message_throttle = 3;
}
@ -3117,7 +3125,9 @@ static void ride_shop_connected(rct_ride* ride, int ride_idx)
// Name of ride is parameter of the format string
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name;
RCT2_GLOBAL(0x013CE954, uint32) = ride->name_arguments;
if (gConfigNotifications.ride_warnings) {
news_item_add_to_queue(1, STR_ENTRANCE_NOT_CONNECTED, ride_idx);
}
ride->connected_message_throttle = 3;
}
@ -7211,8 +7221,10 @@ void ride_crash(int rideIndex, int vehicleIndex)
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, rct_string_id) = ride->name;
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments;
if (gConfigNotifications.ride_crashed) {
news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_HAS_CRASHED, rideIndex);
}
}
bool ride_type_is_intamin(int rideType)
{

View File

@ -511,7 +511,9 @@ void scenario_entrance_fee_too_high_check()
}
packed_xy = (y << 16) | x;
news_item_add_to_queue(NEWS_ITEM_BLANK, STR_ENTRANCE_FEE_TOO_HI, packed_xy);
if (gConfigNotifications.park_warnings) {
news_item_add_to_queue(NEWS_ITEM_BLANK, STR_ENTRANCE_FEE_TOO_HI, packed_xy);
}
}
}
@ -1330,13 +1332,21 @@ static void scenario_objective_check_guests_and_rating()
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) < 700 && RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) >= 1) {
RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16)++;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) == 1) {
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_RATING_WARNING_4_WEEKS_REMAINING, 0);
if (gConfigNotifications.park_rating_warnings) {
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_RATING_WARNING_4_WEEKS_REMAINING, 0);
}
} else if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) == 8) {
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_RATING_WARNING_3_WEEKS_REMAINING, 0);
if (gConfigNotifications.park_rating_warnings) {
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_RATING_WARNING_3_WEEKS_REMAINING, 0);
}
} else if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) == 15) {
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_RATING_WARNING_2_WEEKS_REMAINING, 0);
if (gConfigNotifications.park_rating_warnings) {
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_RATING_WARNING_2_WEEKS_REMAINING, 0);
}
} else if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) == 22) {
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_RATING_WARNING_1_WEEK_REMAINING, 0);
if (gConfigNotifications.park_rating_warnings) {
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_RATING_WARNING_1_WEEK_REMAINING, 0);
}
} else if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) == 29) {
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_HAS_BEEN_CLOSED_DOWN, 0);
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_PARK_OPEN;

View File

@ -33,6 +33,7 @@ enum WINDOW_NEWS_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_SETTINGS,
WIDX_SCROLL
};
@ -40,7 +41,8 @@ static rct_widget window_news_widgets[] = {
{ WWT_FRAME, 0, 0, 399, 0, 299, 0x0FFFFFFFF, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, 398, 1, 14, STR_RECENT_MESSAGES, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, 387, 397, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
{ WWT_SCROLL, 0, 4, 395, 18, 295, 2, STR_NONE }, // scroll
{ WWT_FLATBTN, 0, 372, 395, 18, 41, 5201, STR_NONE }, // settings
{ WWT_SCROLL, 0, 4, 395, 44, 295, 2, STR_NONE }, // scroll
{ WIDGETS_END },
};
@ -103,7 +105,7 @@ void window_news_open()
0
);
window->widgets = window_news_widgets;
window->enabled_widgets = (1 << WIDX_CLOSE);
window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_SETTINGS);
window_init_scroll_widgets(window);
window->news.var_480 = -1;
}
@ -130,6 +132,9 @@ static void window_news_mouseup(rct_window *w, int widgetIndex)
case WIDX_CLOSE:
window_close(w);
break;
case WIDX_SETTINGS:
window_news_options_open();
break;
}
}

279
src/windows/news_options.c Normal file
View File

@ -0,0 +1,279 @@
#include "../config.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
enum {
NOTIFICATION_CATEGORY_PARK,
NOTIFICATION_CATEGORY_RIDE,
NOTIFICATION_CATEGORY_GUEST
};
typedef struct {
uint8 category;
rct_string_id caption;
size_t config_offset;
} notification_def;
static const notification_def NewsItemOptionDefinitions[] = {
{ NOTIFICATION_CATEGORY_PARK, STR_NOTIFICATION_PARK_AWARD, offsetof(notification_configuration, park_award) },
{ NOTIFICATION_CATEGORY_PARK, STR_NOTIFICATION_PARK_MARKETING_CAMPAIGN_FINISHED, offsetof(notification_configuration, park_marketing_campaign_finished) },
{ NOTIFICATION_CATEGORY_PARK, STR_NOTIFICATION_PARK_WARNINGS, offsetof(notification_configuration, park_warnings) },
{ NOTIFICATION_CATEGORY_PARK, STR_NOTIFICATION_PARK_RATING_WARNINGS, offsetof(notification_configuration, park_rating_warnings) },
{ NOTIFICATION_CATEGORY_RIDE, STR_NOTIFICATION_RIDE_BROKEN_DOWN, offsetof(notification_configuration, ride_broken_down) },
{ NOTIFICATION_CATEGORY_RIDE, STR_NOTIFICATION_RIDE_CRASHED, offsetof(notification_configuration, ride_crashed) },
{ NOTIFICATION_CATEGORY_RIDE, STR_NOTIFICATION_RIDE_WARNINGS, offsetof(notification_configuration, ride_warnings) },
{ NOTIFICATION_CATEGORY_RIDE, STR_NOTIFICATION_RIDE_RESEARCHED, offsetof(notification_configuration, ride_researched) },
{ NOTIFICATION_CATEGORY_GUEST, STR_NOTIFICATION_GUEST_WARNINGS, offsetof(notification_configuration, guest_warnings) },
{ NOTIFICATION_CATEGORY_GUEST, STR_NOTIFICATION_GUEST_LOST, offsetof(notification_configuration, guest_lost) },
{ NOTIFICATION_CATEGORY_GUEST, STR_NOTIFICATION_GUEST_LEFT_PARK, offsetof(notification_configuration, guest_left_park) },
{ NOTIFICATION_CATEGORY_GUEST, STR_NOTIFICATION_GUEST_QUEUING_FOR_RIDE, offsetof(notification_configuration, guest_queuing_for_ride) },
{ NOTIFICATION_CATEGORY_GUEST, STR_NOTIFICATION_GUEST_ON_RIDE, offsetof(notification_configuration, guest_on_ride) },
{ NOTIFICATION_CATEGORY_GUEST, STR_NOTIFICATION_GUEST_LEFT_RIDE, offsetof(notification_configuration, guest_left_ride) },
{ NOTIFICATION_CATEGORY_GUEST, STR_NOTIFICATION_GUEST_BOUGHT_ITEM, offsetof(notification_configuration, guest_bought_item) },
{ NOTIFICATION_CATEGORY_GUEST, STR_NOTIFICATION_GUEST_USED_FACILITY, offsetof(notification_configuration, guest_used_facility) },
{ NOTIFICATION_CATEGORY_GUEST, STR_NOTIFICATION_GUEST_DIED, offsetof(notification_configuration, guest_died) },
};
enum WINDOW_NEWS_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_TAB_CONTENT_PANEL,
WIDX_TAB_PARK,
WIDX_TAB_RIDE,
WIDX_TAB_GUEST,
WIDX_CHECKBOX_0
};
static rct_widget window_news_options_widgets[] = {
{ WWT_FRAME, 0, 0, 399, 0, 299, 0x0FFFFFFFF, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, 398, 1, 14, STR_NOTIFICATION_SETTINGS, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, 387, 397, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
{ WWT_RESIZE, 1, 0, 399, 43, 299, 0x0FFFFFFFF, STR_NONE }, // tab content panel
{ WWT_TAB, 1, 3, 33, 17, 43, 0x02000144E, STR_NONE }, // tab 1
{ WWT_TAB, 1, 34, 64, 17, 43, 0x02000144E, STR_NONE }, // tab 2
{ WWT_TAB, 1, 65, 95, 17, 43, 0x02000144E, STR_NONE }, // tab 2
{ WWT_CHECKBOX, 2, 3, 349, 46, 59, STR_NONE, STR_NONE },
{ WWT_CHECKBOX, 2, 0, 0, 0, 0, STR_NONE, STR_NONE },
{ WWT_CHECKBOX, 2, 0, 0, 0, 0, STR_NONE, STR_NONE },
{ WWT_CHECKBOX, 2, 0, 0, 0, 0, STR_NONE, STR_NONE },
{ WWT_CHECKBOX, 2, 0, 0, 0, 0, STR_NONE, STR_NONE },
{ WWT_CHECKBOX, 2, 0, 0, 0, 0, STR_NONE, STR_NONE },
{ WWT_CHECKBOX, 2, 0, 0, 0, 0, STR_NONE, STR_NONE },
{ WWT_CHECKBOX, 2, 0, 0, 0, 0, STR_NONE, STR_NONE },
{ WWT_CHECKBOX, 2, 0, 0, 0, 0, STR_NONE, STR_NONE },
{ WIDGETS_END },
};
static void window_news_options_mouseup(rct_window *w, int widgetIndex);
static void window_news_options_update(rct_window *w);
static void window_news_options_invalidate(rct_window *w);
static void window_news_options_paint(rct_window *w, rct_drawpixelinfo *dpi);
static rct_window_event_list window_news_options_events = {
NULL,
window_news_options_mouseup,
NULL,
NULL,
NULL,
NULL,
window_news_options_update,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
window_news_options_invalidate,
window_news_options_paint,
NULL
};
static void window_news_options_draw_tab_images(rct_window *w, rct_drawpixelinfo *dpi);
static bool *get_notification_value_ptr(const notification_def *ndef);
void window_news_options_open()
{
rct_window* window;
// Check if window is already open
window = window_bring_to_front_by_class(WC_NOTIFICATION_OPTIONS);
if (window == NULL) {
window = window_create_centred(
400,
300,
&window_news_options_events,
WC_NOTIFICATION_OPTIONS,
0
);
window->widgets = window_news_options_widgets;
window->enabled_widgets =
(1 << WIDX_CLOSE) |
(1 << WIDX_TAB_PARK) |
(1 << WIDX_TAB_RIDE) |
(1 << WIDX_TAB_GUEST);
window_init_scroll_widgets(window);
window->colours[0] = COLOUR_GREY;
window->colours[1] = COLOUR_LIGHT_BLUE;
window->colours[2] = COLOUR_LIGHT_BLUE;
}
}
static void window_news_options_mouseup(rct_window *w, int widgetIndex)
{
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
case WIDX_TAB_PARK:
case WIDX_TAB_RIDE:
case WIDX_TAB_GUEST:
w->page = widgetIndex - WIDX_TAB_PARK;
w->frame_no = 0;
window_invalidate(w);
break;
default:
{
int checkBoxIndex = widgetIndex - WIDX_CHECKBOX_0;
if (checkBoxIndex >= 0) {
int matchIndex = 0;
for (int i = 0; i < countof(NewsItemOptionDefinitions); i++) {
const notification_def *ndef = &NewsItemOptionDefinitions[i];
if (ndef->category != w->page) continue;
if (matchIndex == checkBoxIndex) {
// Toggle value
bool *configValue = get_notification_value_ptr(ndef);
*configValue = !(*configValue);
config_save_default();
widget_invalidate(w, widgetIndex);
break;
}
matchIndex++;
}
}
break;
}
}
}
static void window_news_options_update(rct_window *w)
{
w->frame_no++;
widget_invalidate(w, WIDX_TAB_PARK + w->page);
}
static void window_news_options_invalidate(rct_window *w)
{
// colour_scheme_update(w);
// Set pressed tab
w->pressed_widgets &= ~(1ULL << WIDX_TAB_PARK);
w->pressed_widgets &= ~(1ULL << WIDX_TAB_RIDE);
w->pressed_widgets &= ~(1ULL << WIDX_TAB_GUEST);
w->pressed_widgets |= (1ULL << (WIDX_TAB_PARK + w->page));
// Set checkboxes
rct_widget *baseCheckBox = &w->widgets[WIDX_CHECKBOX_0];
int y = baseCheckBox->top;
int checkboxWidgetIndex = WIDX_CHECKBOX_0;
rct_widget *checkboxWidget = &w->widgets[checkboxWidgetIndex];
for (int i = 0; i < countof(NewsItemOptionDefinitions); i++) {
const notification_def *ndef = &NewsItemOptionDefinitions[i];
if (ndef->category != w->page) continue;
w->enabled_widgets |= (1ULL << checkboxWidgetIndex);
checkboxWidget->type = WWT_CHECKBOX;
checkboxWidget->left = baseCheckBox->left;
checkboxWidget->right = baseCheckBox->right;
checkboxWidget->top = y;
checkboxWidget->bottom = checkboxWidget->top + 13;
checkboxWidget->image = ndef->caption;
const bool *configValue = get_notification_value_ptr(ndef);
widget_set_checkbox_value(w, checkboxWidgetIndex, *configValue);
checkboxWidgetIndex++;
checkboxWidget++;
y += 13;
}
// Remove unused checkboxes
while (checkboxWidget->type != WWT_LAST) {
w->enabled_widgets &= ~(1ULL << checkboxWidgetIndex);
checkboxWidget->type = WWT_EMPTY;
checkboxWidgetIndex++;
checkboxWidget++;
}
// Resize window to fit checkboxes exactly
y += 3;
if (w->height != y) {
window_invalidate(w);
w->height = y;
w->widgets[WIDX_BACKGROUND].bottom = y - 1;
w->widgets[WIDX_TAB_CONTENT_PANEL].bottom = y - 1;
window_invalidate(w);
}
}
static void window_news_options_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
window_draw_widgets(w, dpi);
window_news_options_draw_tab_images(w, dpi);
}
const int window_news_option_tab_animation_divisor[] = { 1, 4, 4 };
const int window_news_option_tab_animation_frames[] = { 1, 16, 8 };
static void window_news_options_draw_tab_image(rct_window *w, rct_drawpixelinfo *dpi, int page, int spriteIndex)
{
int widgetIndex = WIDX_TAB_PARK + page;
if (!(w->disabled_widgets & (1LL << widgetIndex))) {
if (w->page == page) {
int numFrames = window_news_option_tab_animation_frames[w->page];
if (numFrames > 1) {
int frame = w->frame_no / window_news_option_tab_animation_divisor[w->page];
spriteIndex += (frame % numFrames);
}
}
gfx_draw_sprite(dpi, spriteIndex, w->x + w->widgets[widgetIndex].left, w->y + w->widgets[widgetIndex].top, 0);
}
}
static void window_news_options_draw_tab_images(rct_window *w, rct_drawpixelinfo *dpi)
{
window_news_options_draw_tab_image(w, dpi, NOTIFICATION_CATEGORY_PARK, 5466);
window_news_options_draw_tab_image(w, dpi, NOTIFICATION_CATEGORY_RIDE, 5442);
window_news_options_draw_tab_image(w, dpi, NOTIFICATION_CATEGORY_GUEST, 5568);
}
static bool *get_notification_value_ptr(const notification_def *ndef)
{
bool *configValue = (bool*)((size_t)&gConfigNotifications + ndef->config_offset);
return configValue;
}