2016-05-04 19:24:41 +02:00
|
|
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
2014-04-03 04:08:06 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
2016-05-04 19:24:41 +02:00
|
|
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
|
|
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
2014-04-03 04:08:06 +02:00
|
|
|
*
|
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
|
|
|
* A full copy of the GNU General Public License can be found in licence.txt
|
2014-04-03 04:08:06 +02:00
|
|
|
*****************************************************************************/
|
2016-05-04 19:24:41 +02:00
|
|
|
#pragma endregion
|
2014-04-03 04:08:06 +02:00
|
|
|
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../audio/audio.h"
|
2014-10-15 23:59:26 +02:00
|
|
|
#include "../input.h"
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../interface/window.h"
|
|
|
|
#include "../localisation/date.h"
|
|
|
|
#include "../localisation/localisation.h"
|
2016-11-30 12:07:10 +01:00
|
|
|
#include "../rct2.h"
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../ride/ride.h"
|
|
|
|
#include "../world/sprite.h"
|
2015-10-30 15:18:29 +01:00
|
|
|
#include "../util/util.h"
|
2014-04-03 04:08:06 +02:00
|
|
|
#include "news_item.h"
|
|
|
|
|
2016-09-03 17:03:35 +02:00
|
|
|
rct_news_item gNewsItems[MAX_NEWS_ITEMS];
|
2016-07-27 10:53:07 +02:00
|
|
|
|
|
|
|
/** rct2: 0x0097BE7C */
|
|
|
|
const uint8 news_type_properties[] = {
|
|
|
|
0, // NEWS_ITEM_NULL
|
|
|
|
NEWS_TYPE_HAS_LOCATION | NEWS_TYPE_HAS_SUBJECT, // NEWS_ITEM_RIDE
|
|
|
|
NEWS_TYPE_HAS_LOCATION | NEWS_TYPE_HAS_SUBJECT, // NEWS_ITEM_PEEP_ON_RIDE
|
|
|
|
NEWS_TYPE_HAS_LOCATION | NEWS_TYPE_HAS_SUBJECT, // NEWS_ITEM_PEEP
|
|
|
|
NEWS_TYPE_HAS_SUBJECT, // NEWS_ITEM_MONEY
|
|
|
|
NEWS_TYPE_HAS_LOCATION, // NEWS_ITEM_BLANK
|
|
|
|
NEWS_TYPE_HAS_SUBJECT, // NEWS_ITEM_RESEARCH
|
|
|
|
NEWS_TYPE_HAS_SUBJECT, // NEWS_ITEM_PEEPS
|
|
|
|
NEWS_TYPE_HAS_SUBJECT, // NEWS_ITEM_AWARD
|
|
|
|
NEWS_TYPE_HAS_SUBJECT, // NEWS_ITEM_GRAPH
|
|
|
|
};
|
|
|
|
|
2014-04-11 04:58:17 +02:00
|
|
|
void window_game_bottom_toolbar_invalidate_news_item();
|
2014-04-08 18:52:39 +02:00
|
|
|
static int news_item_get_new_history_slot();
|
|
|
|
|
2015-07-30 00:57:43 +02:00
|
|
|
bool news_item_is_valid_idx(int index)
|
2015-07-24 23:40:04 +02:00
|
|
|
{
|
2016-09-03 17:45:31 +02:00
|
|
|
if (index >= MAX_NEWS_ITEMS) {
|
2015-07-24 23:40:04 +02:00
|
|
|
log_error("Tried to get news item past MAX_NEWS.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-07-30 00:57:43 +02:00
|
|
|
rct_news_item *news_item_get(int index)
|
2015-07-24 23:40:04 +02:00
|
|
|
{
|
2015-07-30 00:57:43 +02:00
|
|
|
if (news_item_is_valid_idx(index)) {
|
|
|
|
return &gNewsItems[index];
|
2015-07-24 23:40:04 +02:00
|
|
|
} else {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-30 00:57:43 +02:00
|
|
|
bool news_item_is_empty(int index)
|
2015-07-24 23:40:04 +02:00
|
|
|
{
|
2015-07-30 00:57:43 +02:00
|
|
|
return news_item_get(index)->type == NEWS_ITEM_NULL;
|
2015-07-24 23:40:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool news_item_is_queue_empty()
|
|
|
|
{
|
|
|
|
return news_item_is_empty(0);
|
|
|
|
}
|
|
|
|
|
2014-04-03 04:08:06 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066DF32
|
|
|
|
*/
|
|
|
|
void news_item_init_queue()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2015-07-24 23:40:04 +02:00
|
|
|
news_item_get(0)->type = NEWS_ITEM_NULL;
|
|
|
|
news_item_get(11)->type = NEWS_ITEM_NULL;
|
2016-05-11 22:15:43 +02:00
|
|
|
|
2015-07-24 23:40:04 +02:00
|
|
|
// Throttles for warning types (PEEP_*_WARNING)
|
2016-05-11 22:15:43 +02:00
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
gPeepWarningThrottle[i] = 0;
|
|
|
|
}
|
2014-04-03 04:08:06 +02:00
|
|
|
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_bottom_toolbar_invalidate_news_item();
|
2014-04-04 22:46:26 +02:00
|
|
|
}
|
|
|
|
|
2015-07-24 23:40:04 +02:00
|
|
|
static void news_item_tick_current()
|
|
|
|
{
|
|
|
|
int ticks;
|
2015-07-31 22:37:28 +02:00
|
|
|
ticks = ++news_item_get(0)->ticks;
|
2015-11-08 11:07:35 +01:00
|
|
|
// Only play news item sound when in normal playing mode
|
2016-04-23 12:16:46 +02:00
|
|
|
if (ticks == 1 && (gScreenFlags == SCREEN_FLAGS_PLAYING)) {
|
2015-07-24 23:40:04 +02:00
|
|
|
// Play sound
|
2016-04-24 01:36:39 +02:00
|
|
|
audio_play_sound_panned(SOUND_NEWS_ITEM, gScreenWidth / 2, 0, 0, 0);
|
2015-07-24 23:40:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool news_item_is_current_old()
|
|
|
|
{
|
|
|
|
int remove_time = 320;
|
|
|
|
if (!news_item_is_empty(5) &&
|
|
|
|
!news_item_is_empty(4) &&
|
|
|
|
!news_item_is_empty(3) &&
|
|
|
|
!news_item_is_empty(2))
|
|
|
|
remove_time = 256;
|
|
|
|
|
|
|
|
if (news_item_get(0)->ticks >= remove_time)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-04-04 22:46:26 +02:00
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-04-04 22:46:26 +02:00
|
|
|
* rct2: 0x0066E252
|
|
|
|
*/
|
|
|
|
void news_item_update_current()
|
|
|
|
{
|
|
|
|
// Check if there is a current news item
|
2015-07-24 23:40:04 +02:00
|
|
|
if (news_item_is_queue_empty())
|
2014-04-04 22:46:26 +02:00
|
|
|
return;
|
|
|
|
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_bottom_toolbar_invalidate_news_item();
|
2014-04-04 22:46:26 +02:00
|
|
|
|
|
|
|
// Update the current news item
|
2015-07-24 23:40:04 +02:00
|
|
|
news_item_tick_current();
|
2014-04-04 22:46:26 +02:00
|
|
|
|
|
|
|
// Removal of current news item
|
2015-07-24 23:40:04 +02:00
|
|
|
if (news_item_is_current_old())
|
2014-04-04 22:46:26 +02:00
|
|
|
news_item_close_current();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-04-04 22:46:26 +02:00
|
|
|
* rct2: 0x0066E377
|
|
|
|
*/
|
|
|
|
void news_item_close_current()
|
|
|
|
{
|
|
|
|
int i;
|
2016-09-03 17:03:35 +02:00
|
|
|
rct_news_item *newsItems = gNewsItems;
|
2014-04-04 22:46:26 +02:00
|
|
|
|
|
|
|
// Check if there is a current message
|
2015-07-24 23:40:04 +02:00
|
|
|
if (news_item_is_queue_empty())
|
2014-04-04 22:46:26 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Find an available history news item slot for current message
|
|
|
|
i = news_item_get_new_history_slot();
|
|
|
|
|
|
|
|
// Set the history news item slot to the current news item
|
|
|
|
newsItems[i] = newsItems[0];
|
|
|
|
|
|
|
|
// Set the end of the end of the history list
|
2016-09-03 17:45:31 +02:00
|
|
|
if (i < MAX_NEWS_ITEMS - 1)
|
2014-04-04 22:46:26 +02:00
|
|
|
newsItems[i + 1].type = NEWS_ITEM_NULL;
|
|
|
|
|
|
|
|
// Invalidate the news window
|
2014-10-16 03:02:43 +02:00
|
|
|
window_invalidate_by_class(WC_RECENT_NEWS);
|
2014-04-04 22:46:26 +02:00
|
|
|
|
|
|
|
// Dequeue the current news item, shift news up
|
|
|
|
for (i = 0; i < 10; i++)
|
|
|
|
newsItems[i] = newsItems[i + 1];
|
|
|
|
newsItems[10].type = NEWS_ITEM_NULL;
|
|
|
|
|
|
|
|
// Invalidate current news item bar
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_bottom_toolbar_invalidate_news_item();
|
2014-04-04 22:46:26 +02:00
|
|
|
}
|
|
|
|
|
2015-07-24 23:40:04 +02:00
|
|
|
static void news_item_shift_history_up()
|
|
|
|
{
|
|
|
|
const int history_idx = 11;
|
|
|
|
rct_news_item *history_start = news_item_get(history_idx);
|
2015-07-30 00:57:43 +02:00
|
|
|
const size_t count = sizeof(rct_news_item) * (MAX_NEWS_ITEMS - 1 - history_idx);
|
2015-07-24 23:40:04 +02:00
|
|
|
memmove(history_start, history_start + 1, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-04 22:46:26 +02:00
|
|
|
/**
|
|
|
|
* Finds a spare history slot or replaces an existing one if there are no spare
|
|
|
|
* slots available.
|
|
|
|
*/
|
2014-04-08 18:52:39 +02:00
|
|
|
static int news_item_get_new_history_slot()
|
2014-04-04 22:46:26 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
// Find an available history news item slot
|
2015-09-09 23:56:40 +02:00
|
|
|
for (i = 11; i < MAX_NEWS_ITEMS; i++)
|
2015-07-24 23:40:04 +02:00
|
|
|
if (news_item_is_empty(i))
|
2014-04-04 22:46:26 +02:00
|
|
|
return i;
|
|
|
|
|
|
|
|
// Dequeue the first history news item, shift history up
|
2015-07-24 23:40:04 +02:00
|
|
|
news_item_shift_history_up();
|
2015-09-09 23:56:40 +02:00
|
|
|
return MAX_NEWS_ITEMS - 1;
|
2014-04-11 21:02:20 +02:00
|
|
|
}
|
|
|
|
|
2014-04-12 03:14:31 +02:00
|
|
|
/**
|
2014-04-27 20:27:12 +02:00
|
|
|
* Get the (x,y,z) coordinates of the subject of a news item.
|
2014-04-29 18:40:06 +02:00
|
|
|
* If the new item is no longer valid, return SPRITE_LOCATION_NULL in the x-coordinate
|
2014-04-27 20:27:12 +02:00
|
|
|
*
|
2014-04-12 03:14:31 +02:00
|
|
|
* rct2: 0x0066BA74
|
|
|
|
*/
|
2014-04-11 21:02:20 +02:00
|
|
|
void news_item_get_subject_location(int type, int subject, int *x, int *y, int *z)
|
|
|
|
{
|
2014-04-12 03:14:31 +02:00
|
|
|
int i;
|
2014-04-11 21:02:20 +02:00
|
|
|
rct_ride *ride;
|
2014-05-01 14:02:28 +02:00
|
|
|
rct_peep *peep;
|
2014-05-25 19:40:11 +02:00
|
|
|
rct_vehicle *vehicle;
|
2014-04-11 21:02:20 +02:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case NEWS_ITEM_RIDE:
|
2016-01-22 15:38:52 +01:00
|
|
|
ride = get_ride(subject);
|
2014-05-05 19:34:24 +02:00
|
|
|
if (ride->overall_view == 0xFFFF) {
|
2014-04-29 18:40:06 +02:00
|
|
|
*x = SPRITE_LOCATION_NULL;
|
2014-04-11 21:02:20 +02:00
|
|
|
break;
|
|
|
|
}
|
2014-05-05 19:34:24 +02:00
|
|
|
*x = (ride->overall_view & 0xFF) * 32 + 16;
|
|
|
|
*y = (ride->overall_view >> 8) * 32 + 16;
|
2014-05-02 21:25:42 +02:00
|
|
|
*z = map_element_height(*x, *y);
|
2014-04-11 21:02:20 +02:00
|
|
|
break;
|
2014-05-01 13:23:18 +02:00
|
|
|
case NEWS_ITEM_PEEP_ON_RIDE:
|
2014-05-27 19:03:25 +02:00
|
|
|
peep = GET_PEEP(subject);
|
2014-05-01 14:02:28 +02:00
|
|
|
*x = peep->x;
|
|
|
|
*y = peep->y;
|
|
|
|
*z = peep->z;
|
2015-07-23 19:38:43 +02:00
|
|
|
if (*x != SPRITE_LOCATION_NULL)
|
2014-04-12 03:14:31 +02:00
|
|
|
break;
|
|
|
|
|
2014-05-01 14:02:28 +02:00
|
|
|
if (peep->state != 3 && peep->state != 7) {
|
2014-04-29 18:40:06 +02:00
|
|
|
*x = SPRITE_LOCATION_NULL;
|
2014-04-12 03:14:31 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-05-01 13:16:41 +02:00
|
|
|
// Find which ride peep is on
|
2016-01-22 15:38:52 +01:00
|
|
|
ride = get_ride(peep->current_ride);
|
2014-05-22 02:02:55 +02:00
|
|
|
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)) {
|
2014-04-29 18:40:06 +02:00
|
|
|
*x = SPRITE_LOCATION_NULL;
|
2014-04-12 03:14:31 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-05-01 14:12:30 +02:00
|
|
|
// Find the first car of the train peep is on
|
2016-07-17 22:14:44 +02:00
|
|
|
vehicle = &(get_sprite(ride->vehicles[peep->current_train])->vehicle);
|
2014-05-01 14:12:30 +02:00
|
|
|
// Find the actual car peep is on
|
2014-05-01 14:02:28 +02:00
|
|
|
for (i = 0; i < peep->current_car; i++)
|
2016-07-17 22:14:44 +02:00
|
|
|
vehicle = &(get_sprite(vehicle->next_vehicle_on_train)->vehicle);
|
2014-05-25 19:40:11 +02:00
|
|
|
*x = vehicle->x;
|
|
|
|
*y = vehicle->y;
|
|
|
|
*z = vehicle->z;
|
2014-04-11 21:02:20 +02:00
|
|
|
break;
|
2014-05-01 13:23:18 +02:00
|
|
|
case NEWS_ITEM_PEEP:
|
2014-05-27 19:03:25 +02:00
|
|
|
peep = GET_PEEP(subject);
|
2014-05-01 14:02:28 +02:00
|
|
|
*x = peep->x;
|
|
|
|
*y = peep->y;
|
|
|
|
*z = peep->z;
|
2014-04-11 21:02:20 +02:00
|
|
|
break;
|
|
|
|
case NEWS_ITEM_BLANK:
|
2014-05-03 10:24:25 +02:00
|
|
|
*x = subject;
|
|
|
|
*y = subject >> 16;
|
|
|
|
*z = map_element_height(*x, *y);
|
|
|
|
break;
|
2014-04-11 21:02:20 +02:00
|
|
|
default:
|
2014-04-29 18:40:06 +02:00
|
|
|
*x = SPRITE_LOCATION_NULL;
|
2014-04-11 21:02:20 +02:00
|
|
|
break;
|
|
|
|
}
|
2014-04-21 11:27:48 +02:00
|
|
|
}
|
2014-05-02 16:09:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-12-11 16:38:37 +01:00
|
|
|
*
|
|
|
|
* rct2: 0x0066DF55
|
2014-05-02 16:09:07 +02:00
|
|
|
*
|
|
|
|
* @param a (al)
|
|
|
|
* @param string_id (ebx)
|
|
|
|
* @param c (ecx)
|
2015-12-11 16:38:37 +01:00
|
|
|
*/
|
2014-05-02 16:09:07 +02:00
|
|
|
void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc)
|
2015-05-25 21:36:40 +02:00
|
|
|
{
|
2016-09-03 17:03:35 +02:00
|
|
|
utf8 buffer[256];
|
2016-05-15 23:03:53 +02:00
|
|
|
void *args = gCommonFormatArgs;
|
2015-05-25 21:36:40 +02:00
|
|
|
|
2016-09-26 04:24:29 +02:00
|
|
|
format_string(buffer, 256, string_id, args); // overflows possible?
|
2015-05-25 21:36:40 +02:00
|
|
|
news_item_add_to_queue_raw(type, buffer, assoc);
|
|
|
|
}
|
|
|
|
|
2015-08-02 12:25:26 +02:00
|
|
|
void news_item_add_to_queue_raw(uint8 type, const utf8 *text, uint32 assoc)
|
2014-05-02 16:09:07 +02:00
|
|
|
{
|
2016-09-03 17:03:35 +02:00
|
|
|
rct_news_item *newsItem = gNewsItems;
|
2014-05-02 16:09:07 +02:00
|
|
|
|
|
|
|
// find first open slot
|
|
|
|
while (newsItem->type != NEWS_ITEM_NULL) {
|
2016-08-06 22:38:46 +02:00
|
|
|
if (newsItem + 1 >= &gNewsItems[10]) // &news_list[10]
|
2014-05-02 16:09:07 +02:00
|
|
|
news_item_close_current();
|
|
|
|
else
|
|
|
|
newsItem++;
|
|
|
|
}
|
|
|
|
|
|
|
|
//now we have found an item slot to place the new news in
|
|
|
|
newsItem->type = type;
|
|
|
|
newsItem->flags = 0;
|
|
|
|
newsItem->assoc = assoc;
|
|
|
|
newsItem->ticks = 0;
|
2016-04-23 12:03:18 +02:00
|
|
|
newsItem->month_year = gDateMonthsElapsed;
|
|
|
|
newsItem->day = ((days_in_month[(newsItem->month_year & 7)] * gDateMonthTicks) >> 16) + 1;
|
2016-01-18 20:49:52 +01:00
|
|
|
safe_strcpy(newsItem->text, text, 255);
|
2014-05-02 16:09:07 +02:00
|
|
|
newsItem->text[254] = 0;
|
|
|
|
|
|
|
|
// blatant disregard for what happens on the last element.
|
|
|
|
// Change this when we implement the queue ourselves.
|
|
|
|
newsItem++;
|
|
|
|
newsItem->type = 0;
|
|
|
|
}
|
2014-05-08 17:14:08 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the window/tab for the subject of the news item
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x0066EBE6
|
2014-05-08 17:14:08 +02:00
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
*/
|
2014-10-08 23:11:50 +02:00
|
|
|
void news_item_open_subject(int type, int subject)
|
|
|
|
{
|
2014-05-08 17:14:08 +02:00
|
|
|
rct_peep* peep;
|
|
|
|
rct_window* window;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case NEWS_ITEM_RIDE:
|
2014-09-22 18:46:14 +02:00
|
|
|
window_ride_main_open(subject);
|
2014-05-08 17:14:08 +02:00
|
|
|
break;
|
|
|
|
case NEWS_ITEM_PEEP_ON_RIDE:
|
|
|
|
case NEWS_ITEM_PEEP:
|
2014-05-27 19:03:25 +02:00
|
|
|
peep = GET_PEEP(subject);
|
2014-11-29 16:55:44 +01:00
|
|
|
window_guest_open(peep);
|
2014-05-08 17:14:08 +02:00
|
|
|
break;
|
|
|
|
case NEWS_ITEM_MONEY:
|
2014-05-26 00:17:55 +02:00
|
|
|
window_finances_open();
|
2014-05-08 17:14:08 +02:00
|
|
|
break;
|
2014-05-08 17:53:57 +02:00
|
|
|
case NEWS_ITEM_RESEARCH:
|
2014-05-08 17:14:08 +02:00
|
|
|
if (subject >= 0x10000) {
|
|
|
|
// Open ride list window
|
2014-10-08 23:11:50 +02:00
|
|
|
window_new_ride_open();
|
|
|
|
|
2014-05-08 17:14:08 +02:00
|
|
|
// Switch to right tab and scroll to ride location
|
2014-10-08 23:11:50 +02:00
|
|
|
ride_list_item rideItem;
|
|
|
|
rideItem.type = subject >> 8;
|
|
|
|
rideItem.entry_index = subject & 0xFF;
|
|
|
|
window_new_ride_focus(rideItem);
|
2014-05-08 17:14:08 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if window is already open
|
2014-10-16 03:02:43 +02:00
|
|
|
window = window_bring_to_front_by_class(WC_SCENERY);
|
2014-05-08 17:14:08 +02:00
|
|
|
if (window == NULL) {
|
2014-10-16 03:02:43 +02:00
|
|
|
window = window_find_by_class(WC_TOP_TOOLBAR);
|
2014-05-08 17:14:08 +02:00
|
|
|
if (window != NULL) {
|
|
|
|
window_invalidate(window);
|
2015-03-31 14:06:34 +02:00
|
|
|
if (!tool_set(window, 9, 0)) {
|
2016-01-04 23:53:03 +01:00
|
|
|
gInputFlags |= INPUT_FLAG_6;
|
2015-03-31 14:06:34 +02:00
|
|
|
window_scenery_open();
|
2014-05-08 17:14:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2014-05-08 17:14:08 +02:00
|
|
|
// Switch to new scenery tab
|
2015-03-31 14:06:34 +02:00
|
|
|
window = window_find_by_class(WC_SCENERY);
|
|
|
|
if (window != NULL)
|
|
|
|
window_event_mouse_down_call(window, 4 + subject);
|
2014-05-08 17:14:08 +02:00
|
|
|
break;
|
|
|
|
case NEWS_ITEM_PEEPS:
|
2016-09-03 14:54:59 +02:00
|
|
|
window_guest_list_open_with_filter(GLFT_GUESTS_THINKING_X, subject);;
|
2014-05-08 17:14:08 +02:00
|
|
|
break;
|
|
|
|
case NEWS_ITEM_AWARD:
|
|
|
|
window_park_awards_open();
|
|
|
|
break;
|
|
|
|
case NEWS_ITEM_GRAPH:
|
|
|
|
window_park_rating_open();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-04-05 03:45:52 +02:00
|
|
|
|
|
|
|
/**
|
2015-07-30 00:57:43 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066E407
|
2015-04-05 03:45:52 +02:00
|
|
|
*/
|
2015-07-30 00:57:43 +02:00
|
|
|
void news_item_disable_news(uint8 type, uint32 assoc)
|
|
|
|
{
|
|
|
|
// TODO: write test invalidating windows
|
|
|
|
for (int i = 0; i < 11; i++) {
|
|
|
|
if (!news_item_is_empty(i)) {
|
|
|
|
rct_news_item * const newsItem = news_item_get(i);
|
|
|
|
if (type == newsItem->type && assoc == newsItem->assoc) {
|
|
|
|
newsItem->flags |= 0x1;
|
|
|
|
if (i == 0) {
|
|
|
|
window_game_bottom_toolbar_invalidate_news_item();
|
|
|
|
}
|
2015-07-24 23:40:04 +02:00
|
|
|
}
|
2015-07-30 00:57:43 +02:00
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-03 17:45:31 +02:00
|
|
|
for (int i = 11; i < MAX_NEWS_ITEMS; i++) {
|
2015-07-30 00:57:43 +02:00
|
|
|
if (!news_item_is_empty(i)) {
|
|
|
|
rct_news_item * const newsItem = news_item_get(i);
|
|
|
|
if (type == newsItem->type && assoc == newsItem->assoc) {
|
|
|
|
newsItem->flags |= 0x1;
|
|
|
|
window_invalidate_by_class(WC_RECENT_NEWS);
|
2015-07-24 23:40:04 +02:00
|
|
|
}
|
2015-07-30 00:57:43 +02:00
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-04-05 03:45:52 +02:00
|
|
|
}
|
2015-04-05 03:58:14 +02:00
|
|
|
|
2015-02-12 17:23:49 +01:00
|
|
|
void news_item_add_to_queue_custom(rct_news_item *newNewsItem)
|
|
|
|
{
|
2016-09-03 17:03:35 +02:00
|
|
|
rct_news_item *newsItem = gNewsItems;
|
2015-02-12 17:23:49 +01:00
|
|
|
|
|
|
|
// Find first open slot
|
|
|
|
while (newsItem->type != NEWS_ITEM_NULL) {
|
2016-08-06 23:22:11 +02:00
|
|
|
if (newsItem + 1 >= &gNewsItems[10])
|
2015-02-12 17:23:49 +01:00
|
|
|
news_item_close_current();
|
|
|
|
else
|
|
|
|
newsItem++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*newsItem = *newNewsItem;
|
|
|
|
newsItem++;
|
|
|
|
newsItem->type = 0;
|
|
|
|
}
|