mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 03:23:15 +01:00
Dissociate rct_news_item from RCT2
This commit is contained in:
@@ -731,10 +731,10 @@ void game_convert_strings_to_utf8()
|
||||
|
||||
// News items
|
||||
for (sint32 i = 0; i < MAX_NEWS_ITEMS; i++) {
|
||||
rct_news_item *newsItem = news_item_get(i);
|
||||
NewsItem *newsItem = news_item_get(i);
|
||||
|
||||
if (!str_is_null_or_empty(newsItem->text)) {
|
||||
rct2_to_utf8_self(newsItem->text, 256);
|
||||
if (!str_is_null_or_empty(newsItem->Text)) {
|
||||
rct2_to_utf8_self(newsItem->Text, 256);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -760,10 +760,10 @@ void game_convert_strings_to_rct2(rct_s6_data *s6)
|
||||
|
||||
// News items
|
||||
for (sint32 i = 0; i < MAX_NEWS_ITEMS; i++) {
|
||||
rct_news_item *newsItem = &s6->news_items[i];
|
||||
rct12_news_item *newsItem = &s6->news_items[i];
|
||||
|
||||
if (!str_is_null_or_empty(newsItem->text)) {
|
||||
utf8_to_rct2_self(newsItem->text, 256);
|
||||
if (!str_is_null_or_empty(newsItem->Text)) {
|
||||
utf8_to_rct2_self(newsItem->Text, 256);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "../world/sprite.h"
|
||||
#include "news_item.h"
|
||||
|
||||
rct_news_item gNewsItems[MAX_NEWS_ITEMS];
|
||||
NewsItem gNewsItems[MAX_NEWS_ITEMS];
|
||||
|
||||
/** rct2: 0x0097BE7C */
|
||||
const uint8 news_type_properties[] = {
|
||||
@@ -52,7 +52,7 @@ bool news_item_is_valid_idx(sint32 index)
|
||||
return true;
|
||||
}
|
||||
|
||||
rct_news_item *news_item_get(sint32 index)
|
||||
NewsItem *news_item_get(sint32 index)
|
||||
{
|
||||
if (news_item_is_valid_idx(index)) {
|
||||
return &gNewsItems[index];
|
||||
@@ -63,7 +63,7 @@ rct_news_item *news_item_get(sint32 index)
|
||||
|
||||
bool news_item_is_empty(sint32 index)
|
||||
{
|
||||
return news_item_get(index)->type == NEWS_ITEM_NULL;
|
||||
return news_item_get(index)->Type == NEWS_ITEM_NULL;
|
||||
}
|
||||
|
||||
bool news_item_is_queue_empty()
|
||||
@@ -79,8 +79,8 @@ void news_item_init_queue()
|
||||
{
|
||||
sint32 i;
|
||||
|
||||
news_item_get(0)->type = NEWS_ITEM_NULL;
|
||||
news_item_get(11)->type = NEWS_ITEM_NULL;
|
||||
news_item_get(0)->Type = NEWS_ITEM_NULL;
|
||||
news_item_get(11)->Type = NEWS_ITEM_NULL;
|
||||
|
||||
// Throttles for warning types (PEEP_*_WARNING)
|
||||
for (i = 0; i < 16; i++) {
|
||||
@@ -93,7 +93,7 @@ void news_item_init_queue()
|
||||
static void news_item_tick_current()
|
||||
{
|
||||
sint32 ticks;
|
||||
ticks = ++news_item_get(0)->ticks;
|
||||
ticks = ++news_item_get(0)->Ticks;
|
||||
// Only play news item sound when in normal playing mode
|
||||
if (ticks == 1 && (gScreenFlags == SCREEN_FLAGS_PLAYING)) {
|
||||
// Play sound
|
||||
@@ -110,7 +110,7 @@ static bool news_item_is_current_old()
|
||||
!news_item_is_empty(2))
|
||||
remove_time = 256;
|
||||
|
||||
if (news_item_get(0)->ticks >= remove_time)
|
||||
if (news_item_get(0)->Ticks >= remove_time)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -143,7 +143,7 @@ void news_item_update_current()
|
||||
void news_item_close_current()
|
||||
{
|
||||
sint32 i;
|
||||
rct_news_item *newsItems = gNewsItems;
|
||||
NewsItem *newsItems = gNewsItems;
|
||||
|
||||
// Check if there is a current message
|
||||
if (news_item_is_queue_empty())
|
||||
@@ -157,7 +157,7 @@ void news_item_close_current()
|
||||
|
||||
// Set the end of the end of the history list
|
||||
if (i < MAX_NEWS_ITEMS - 1)
|
||||
newsItems[i + 1].type = NEWS_ITEM_NULL;
|
||||
newsItems[i + 1].Type = NEWS_ITEM_NULL;
|
||||
|
||||
// Invalidate the news window
|
||||
window_invalidate_by_class(WC_RECENT_NEWS);
|
||||
@@ -165,7 +165,7 @@ void news_item_close_current()
|
||||
// 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;
|
||||
newsItems[10].Type = NEWS_ITEM_NULL;
|
||||
|
||||
// Invalidate current news item bar
|
||||
window_game_bottom_toolbar_invalidate_news_item();
|
||||
@@ -174,8 +174,8 @@ void news_item_close_current()
|
||||
static void news_item_shift_history_up()
|
||||
{
|
||||
const sint32 history_idx = 11;
|
||||
rct_news_item *history_start = news_item_get(history_idx);
|
||||
const size_t count = sizeof(rct_news_item) * (MAX_NEWS_ITEMS - 1 - history_idx);
|
||||
NewsItem *history_start = news_item_get(history_idx);
|
||||
const size_t count = sizeof(NewsItem) * (MAX_NEWS_ITEMS - 1 - history_idx);
|
||||
memmove(history_start, history_start + 1, count);
|
||||
}
|
||||
|
||||
@@ -288,10 +288,10 @@ void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc)
|
||||
|
||||
void news_item_add_to_queue_raw(uint8 type, const utf8 *text, uint32 assoc)
|
||||
{
|
||||
rct_news_item *newsItem = gNewsItems;
|
||||
NewsItem *newsItem = gNewsItems;
|
||||
|
||||
// find first open slot
|
||||
while (newsItem->type != NEWS_ITEM_NULL) {
|
||||
while (newsItem->Type != NEWS_ITEM_NULL) {
|
||||
if (newsItem + 1 >= &gNewsItems[10]) // &news_list[10]
|
||||
news_item_close_current();
|
||||
else
|
||||
@@ -299,19 +299,19 @@ void news_item_add_to_queue_raw(uint8 type, const utf8 *text, uint32 assoc)
|
||||
}
|
||||
|
||||
//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;
|
||||
newsItem->month_year = gDateMonthsElapsed;
|
||||
newsItem->day = ((days_in_month[(newsItem->month_year & 7)] * gDateMonthTicks) >> 16) + 1;
|
||||
safe_strcpy(newsItem->text, text, 255);
|
||||
newsItem->text[254] = 0;
|
||||
newsItem->Type = type;
|
||||
newsItem->Flags = 0;
|
||||
newsItem->Assoc = assoc;
|
||||
newsItem->Ticks = 0;
|
||||
newsItem->MonthYear = gDateMonthsElapsed;
|
||||
newsItem->Day = ((days_in_month[(newsItem->MonthYear & 7)] * gDateMonthTicks) >> 16) + 1;
|
||||
safe_strcpy(newsItem->Text, text, 255);
|
||||
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;
|
||||
newsItem->Type = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -389,9 +389,9 @@ void news_item_disable_news(uint8 type, uint32 assoc)
|
||||
// TODO: write test invalidating windows
|
||||
for (sint32 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;
|
||||
NewsItem * 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();
|
||||
}
|
||||
@@ -403,9 +403,9 @@ void news_item_disable_news(uint8 type, uint32 assoc)
|
||||
|
||||
for (sint32 i = 11; i < MAX_NEWS_ITEMS; 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;
|
||||
NewsItem * const newsItem = news_item_get(i);
|
||||
if (type == newsItem->Type && assoc == newsItem->Assoc) {
|
||||
newsItem->Flags |= 0x1;
|
||||
window_invalidate_by_class(WC_RECENT_NEWS);
|
||||
}
|
||||
} else {
|
||||
@@ -414,12 +414,12 @@ void news_item_disable_news(uint8 type, uint32 assoc)
|
||||
}
|
||||
}
|
||||
|
||||
void news_item_add_to_queue_custom(rct_news_item *newNewsItem)
|
||||
void news_item_add_to_queue_custom(NewsItem *newNewsItem)
|
||||
{
|
||||
rct_news_item *newsItem = gNewsItems;
|
||||
NewsItem *newsItem = gNewsItems;
|
||||
|
||||
// Find first open slot
|
||||
while (newsItem->type != NEWS_ITEM_NULL) {
|
||||
while (newsItem->Type != NEWS_ITEM_NULL) {
|
||||
if (newsItem + 1 >= &gNewsItems[10])
|
||||
news_item_close_current();
|
||||
else
|
||||
@@ -428,5 +428,5 @@ void news_item_add_to_queue_custom(rct_news_item *newNewsItem)
|
||||
|
||||
*newsItem = *newNewsItem;
|
||||
newsItem++;
|
||||
newsItem->type = 0;
|
||||
newsItem->Type = 0;
|
||||
}
|
||||
|
||||
@@ -39,27 +39,22 @@ enum {
|
||||
|
||||
extern const uint8 news_type_properties[10];
|
||||
|
||||
#pragma pack(push, 1)
|
||||
/**
|
||||
* News item structure.
|
||||
* size: 0x10C
|
||||
* A single news item / message.
|
||||
*/
|
||||
typedef struct rct_news_item {
|
||||
uint8 type; // 0x00
|
||||
uint8 flags; // 0x01
|
||||
uint32 assoc; // 0x02
|
||||
uint16 ticks; // 0x06
|
||||
uint16 month_year; // 0x08
|
||||
uint8 day; // 0x0A
|
||||
uint8 pad_0B; // 0x0B
|
||||
utf8 text[256]; // 0x0C
|
||||
} rct_news_item;
|
||||
assert_struct_size(rct_news_item, 12 + 256);
|
||||
#pragma pack(pop)
|
||||
typedef struct NewsItem {
|
||||
uint8 Type;
|
||||
uint8 Flags;
|
||||
uint32 Assoc;
|
||||
uint16 Ticks;
|
||||
uint16 MonthYear;
|
||||
uint8 Day;
|
||||
utf8 Text[256];
|
||||
} NewsItem;
|
||||
|
||||
#define MAX_NEWS_ITEMS 61
|
||||
|
||||
extern rct_news_item gNewsItems[MAX_NEWS_ITEMS];
|
||||
extern NewsItem gNewsItems[MAX_NEWS_ITEMS];
|
||||
|
||||
void news_item_init_queue();
|
||||
void news_item_update_current();
|
||||
@@ -69,11 +64,11 @@ void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc);
|
||||
void news_item_add_to_queue_raw(uint8 type, const utf8 *text, uint32 assoc);
|
||||
void news_item_open_subject(sint32 type, sint32 subject);
|
||||
void news_item_disable_news(uint8 type, uint32 assoc);
|
||||
rct_news_item *news_item_get(sint32 index);
|
||||
NewsItem *news_item_get(sint32 index);
|
||||
bool news_item_is_empty(sint32 index);
|
||||
bool news_item_is_queue_empty();
|
||||
bool news_item_is_valid_idx(sint32 index);
|
||||
|
||||
void news_item_add_to_queue_custom(rct_news_item *newNewsItem);
|
||||
void news_item_add_to_queue_custom(NewsItem *newNewsItem);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -590,7 +590,7 @@ typedef struct rct1_s4 {
|
||||
uint8 target_weather_gloom;
|
||||
uint8 rain;
|
||||
uint8 target_rain;
|
||||
rct_news_item messages[61];
|
||||
rct12_news_item messages[RCT12_MAX_NEWS_ITEMS];
|
||||
char scenario_name[62];
|
||||
uint16 scenario_slot_index;
|
||||
uint32 scenario_flags;
|
||||
|
||||
@@ -1454,10 +1454,18 @@ private:
|
||||
}
|
||||
|
||||
// News items
|
||||
rct_news_item *newsItems = gNewsItems;
|
||||
for (size_t i = 0; i < MAX_NEWS_ITEMS; i++)
|
||||
for (size_t i = 0; i < RCT12_MAX_NEWS_ITEMS; i++)
|
||||
{
|
||||
newsItems[i] = _s4.messages[i];
|
||||
const rct12_news_item * src = &_s4.messages[i];
|
||||
NewsItem * dst = &gNewsItems[i];
|
||||
|
||||
dst->Type = src->Type;
|
||||
dst->Flags = src->Flags;
|
||||
dst->Assoc = src->Assoc;
|
||||
dst->Ticks = src->Ticks;
|
||||
dst->MonthYear = src->MonthYear;
|
||||
dst->Day = src->Day;
|
||||
memcpy(dst->Text, src->Text, sizeof(src->Text));
|
||||
}
|
||||
|
||||
// Initial guest status
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "common.h"
|
||||
|
||||
#define RCT12_MAX_AWARDS 4
|
||||
#define RCT12_MAX_NEWS_ITEMS 61
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
@@ -31,4 +32,21 @@ typedef struct rct12_award
|
||||
} rct12_award;
|
||||
assert_struct_size(rct12_award, 4);
|
||||
|
||||
/**
|
||||
* A single news item / message.
|
||||
* size: 0x10C
|
||||
*/
|
||||
typedef struct rct12_news_item
|
||||
{
|
||||
uint8 Type;
|
||||
uint8 Flags;
|
||||
uint32 Assoc;
|
||||
uint16 Ticks;
|
||||
uint16 MonthYear;
|
||||
uint8 Day;
|
||||
uint8 pad_0B;
|
||||
char Text[256];
|
||||
} rct12_news_item;
|
||||
assert_struct_size(rct12_news_item, 0x10C);
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
@@ -435,7 +435,22 @@ void S6Exporter::Export()
|
||||
_s6.next_weather_gloom = gClimateNextWeatherGloom;
|
||||
_s6.current_rain_level = gClimateCurrentRainLevel;
|
||||
_s6.next_rain_level = gClimateNextRainLevel;
|
||||
memcpy(_s6.news_items, gNewsItems, sizeof(_s6.news_items));
|
||||
|
||||
// News items
|
||||
for (size_t i = 0; i < RCT12_MAX_NEWS_ITEMS; i++)
|
||||
{
|
||||
const NewsItem * src = &gNewsItems[i];
|
||||
rct12_news_item * dst = &_s6.news_items[i];
|
||||
|
||||
dst->Type = src->Type;
|
||||
dst->Flags = src->Flags;
|
||||
dst->Assoc = src->Assoc;
|
||||
dst->Ticks = src->Ticks;
|
||||
dst->MonthYear = src->MonthYear;
|
||||
dst->Day = src->Day;
|
||||
memcpy(dst->Text, src->Text, sizeof(dst->Text));
|
||||
}
|
||||
|
||||
// pad_13CE730
|
||||
// rct1_scenario_flags
|
||||
_s6.wide_path_tile_loop_x = gWidePathTileLoopX;
|
||||
|
||||
@@ -352,7 +352,22 @@ void S6Importer::Import()
|
||||
gClimateNextWeatherGloom = _s6.next_weather_gloom;
|
||||
gClimateCurrentRainLevel = _s6.current_rain_level;
|
||||
gClimateNextRainLevel = _s6.next_rain_level;
|
||||
memcpy(gNewsItems, _s6.news_items, sizeof(_s6.news_items));
|
||||
|
||||
// News items
|
||||
for (size_t i = 0; i < RCT12_MAX_NEWS_ITEMS; i++)
|
||||
{
|
||||
const rct12_news_item * src = &_s6.news_items[i];
|
||||
NewsItem * dst = &gNewsItems[i];
|
||||
|
||||
dst->Type = src->Type;
|
||||
dst->Flags = src->Flags;
|
||||
dst->Assoc = src->Assoc;
|
||||
dst->Ticks = src->Ticks;
|
||||
dst->MonthYear = src->MonthYear;
|
||||
dst->Day = src->Day;
|
||||
memcpy(dst->Text, src->Text, sizeof(src->Text));
|
||||
}
|
||||
|
||||
// pad_13CE730
|
||||
// rct1_scenario_flags
|
||||
gWidePathTileLoopX = _s6.wide_path_tile_loop_x;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "../game.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../management/news_item.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../rct2/hook.h"
|
||||
#include "../scenario/scenario.h"
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "../common.h"
|
||||
#include "../management/finance.h"
|
||||
#include "../management/news_item.h"
|
||||
#include "../management/research.h"
|
||||
#include "../object.h"
|
||||
#include "../platform/platform.h"
|
||||
@@ -290,7 +289,7 @@ typedef struct rct_s6_data {
|
||||
uint8 next_weather_gloom;
|
||||
uint8 current_rain_level;
|
||||
uint8 next_rain_level;
|
||||
rct_news_item news_items[MAX_NEWS_ITEMS];
|
||||
rct12_news_item news_items[RCT12_MAX_NEWS_ITEMS];
|
||||
uint8 pad_13CE730[64];
|
||||
uint32 rct1_scenario_flags;
|
||||
uint16 wide_path_tile_loop_x;
|
||||
|
||||
@@ -33,6 +33,7 @@ extern "C"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../management/news_item.h"
|
||||
#include "../peep/staff.h"
|
||||
#include "../world/climate.h"
|
||||
#include "../world/scenery.h"
|
||||
|
||||
@@ -32,6 +32,7 @@ extern "C"
|
||||
#include "../game.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../management/news_item.h"
|
||||
#include "../world/scenery.h"
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ void window_game_bottom_toolbar_open()
|
||||
*/
|
||||
static void window_game_bottom_toolbar_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
rct_news_item *newsItem;
|
||||
NewsItem *newsItem;
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_LEFT_OUTSET:
|
||||
@@ -183,7 +183,7 @@ static void window_game_bottom_toolbar_mouseup(rct_window *w, sint32 widgetIndex
|
||||
break;
|
||||
case WIDX_NEWS_SUBJECT:
|
||||
newsItem = news_item_get(0);
|
||||
news_item_open_subject(newsItem->type, newsItem->assoc);
|
||||
news_item_open_subject(newsItem->Type, newsItem->Assoc);
|
||||
break;
|
||||
case WIDX_NEWS_LOCATE:
|
||||
if (news_item_is_queue_empty())
|
||||
@@ -192,9 +192,9 @@ static void window_game_bottom_toolbar_mouseup(rct_window *w, sint32 widgetIndex
|
||||
{
|
||||
newsItem = news_item_get(0);
|
||||
sint32 x, y, z;
|
||||
sint32 subject = newsItem->assoc;
|
||||
sint32 subject = newsItem->Assoc;
|
||||
|
||||
news_item_get_subject_location(newsItem->type, subject, &x, &y, &z);
|
||||
news_item_get_subject_location(newsItem->Type, subject, &x, &y, &z);
|
||||
|
||||
if (x == SPRITE_LOCATION_NULL)
|
||||
break;
|
||||
@@ -240,7 +240,7 @@ static void window_game_bottom_toolbar_tooltip(rct_window* w, sint32 widgetIndex
|
||||
static void window_game_bottom_toolbar_invalidate(rct_window *w)
|
||||
{
|
||||
sint32 x;
|
||||
rct_news_item *newsItem;
|
||||
NewsItem *newsItem;
|
||||
|
||||
colour_scheme_update(w);
|
||||
|
||||
@@ -285,18 +285,18 @@ static void window_game_bottom_toolbar_invalidate(rct_window *w)
|
||||
|
||||
// Find out if the news item is no longer valid
|
||||
sint32 y, z;
|
||||
sint32 subject = newsItem->assoc;
|
||||
news_item_get_subject_location(newsItem->type, subject, &x, &y, &z);
|
||||
sint32 subject = newsItem->Assoc;
|
||||
news_item_get_subject_location(newsItem->Type, subject, &x, &y, &z);
|
||||
|
||||
if (x == SPRITE_LOCATION_NULL)
|
||||
w->disabled_widgets |= (1 << WIDX_NEWS_LOCATE);
|
||||
|
||||
if (!(news_type_properties[newsItem->type] & NEWS_TYPE_HAS_SUBJECT)) {
|
||||
if (!(news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_SUBJECT)) {
|
||||
w->disabled_widgets |= (1 << WIDX_NEWS_SUBJECT);
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WWT_EMPTY;
|
||||
}
|
||||
|
||||
if (newsItem->flags & 1) {
|
||||
if (newsItem->Flags & 1) {
|
||||
w->disabled_widgets |= (1 << WIDX_NEWS_SUBJECT);
|
||||
w->disabled_widgets |= (1 << WIDX_NEWS_LOCATE);
|
||||
}
|
||||
@@ -508,7 +508,7 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi,
|
||||
static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rct_window *w)
|
||||
{
|
||||
sint32 x, y, width;
|
||||
rct_news_item *newsItem;
|
||||
NewsItem *newsItem;
|
||||
rct_widget *middleOutsetWidget;
|
||||
|
||||
middleOutsetWidget = &window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET];
|
||||
@@ -526,21 +526,21 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
|
||||
);
|
||||
|
||||
// Text
|
||||
utf8 *newsItemText = newsItem->text;
|
||||
utf8 *newsItemText = newsItem->Text;
|
||||
x = w->x + (middleOutsetWidget->left + middleOutsetWidget->right) / 2;
|
||||
y = w->y + middleOutsetWidget->top + 11;
|
||||
width = middleOutsetWidget->right - middleOutsetWidget->left - 62;
|
||||
gfx_draw_string_centred_wrapped_partial(dpi, x, y, width, COLOUR_BRIGHT_GREEN, STR_BOTTOM_TOOLBAR_NEWS_TEXT, &newsItemText, newsItem->ticks);
|
||||
gfx_draw_string_centred_wrapped_partial(dpi, x, y, width, COLOUR_BRIGHT_GREEN, STR_BOTTOM_TOOLBAR_NEWS_TEXT, &newsItemText, newsItem->Ticks);
|
||||
|
||||
x = w->x + window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].left;
|
||||
y = w->y + window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].top;
|
||||
switch (newsItem->type) {
|
||||
switch (newsItem->Type) {
|
||||
case NEWS_ITEM_RIDE:
|
||||
gfx_draw_sprite(dpi, SPR_RIDE, x, y, 0);
|
||||
break;
|
||||
case NEWS_ITEM_PEEP_ON_RIDE:
|
||||
case NEWS_ITEM_PEEP:
|
||||
if (newsItem->flags & 1)
|
||||
if (newsItem->Flags & 1)
|
||||
break;
|
||||
|
||||
rct_drawpixelinfo cliped_dpi;
|
||||
@@ -548,7 +548,7 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
|
||||
break;
|
||||
}
|
||||
|
||||
rct_peep* peep = GET_PEEP(newsItem->assoc);
|
||||
rct_peep* peep = GET_PEEP(newsItem->Assoc);
|
||||
sint32 clip_x = 10, clip_y = 19;
|
||||
|
||||
if (peep->type == PEEP_TYPE_STAFF){
|
||||
@@ -589,7 +589,7 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
|
||||
gfx_draw_sprite(dpi, SPR_FINANCE, x, y, 0);
|
||||
break;
|
||||
case NEWS_ITEM_RESEARCH:
|
||||
gfx_draw_sprite(dpi, (newsItem->assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE), x, y, 0);
|
||||
gfx_draw_sprite(dpi, (newsItem->Assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE), x, y, 0);
|
||||
break;
|
||||
case NEWS_ITEM_PEEPS:
|
||||
gfx_draw_sprite(dpi, SPR_GUESTS, x, y, 0);
|
||||
|
||||
@@ -156,15 +156,15 @@ static void window_news_update(rct_window *w)
|
||||
return;
|
||||
|
||||
if (j == 0) {
|
||||
rct_news_item * const newsItem = news_item_get(i);
|
||||
if (newsItem->flags & 1)
|
||||
NewsItem * const newsItem = news_item_get(i);
|
||||
if (newsItem->Flags & 1)
|
||||
return;
|
||||
if (w->news.var_482 == 1) {
|
||||
news_item_open_subject(newsItem->type, newsItem->assoc);
|
||||
news_item_open_subject(newsItem->Type, newsItem->Assoc);
|
||||
return;
|
||||
}
|
||||
else if (w->news.var_482 > 1) {
|
||||
news_item_get_subject_location(newsItem->type, newsItem->assoc, &x, &y, &z);
|
||||
news_item_get_subject_location(newsItem->Type, newsItem->Assoc, &x, &y, &z);
|
||||
if (x != SPRITE_LOCATION_NULL)
|
||||
if ((w = window_get_main()) != NULL)
|
||||
window_scroll_to_location(w, x, y, z);
|
||||
@@ -206,8 +206,8 @@ static void window_news_scrollmousedown(rct_window *w, sint32 scrollIndex, sint3
|
||||
break;
|
||||
|
||||
if (y < 42) {
|
||||
rct_news_item * const newsItem = news_item_get(i);
|
||||
if (newsItem->flags & 1) {
|
||||
NewsItem * const newsItem = news_item_get(i);
|
||||
if (newsItem->Flags & 1) {
|
||||
buttonIndex = 0;
|
||||
break;
|
||||
} else if (y < 14) {
|
||||
@@ -220,12 +220,12 @@ static void window_news_scrollmousedown(rct_window *w, sint32 scrollIndex, sint3
|
||||
buttonIndex = 0;
|
||||
break;
|
||||
} else if (x < 351) {
|
||||
if (news_type_properties[newsItem->type] & NEWS_TYPE_HAS_SUBJECT) {
|
||||
if (news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_SUBJECT) {
|
||||
buttonIndex = 1;
|
||||
break;
|
||||
}
|
||||
} else if (x < 376) {
|
||||
if (news_type_properties[newsItem->type] & NEWS_TYPE_HAS_LOCATION) {
|
||||
if (news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_LOCATION) {
|
||||
buttonIndex = 2;
|
||||
break;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint3
|
||||
|
||||
y = 0;
|
||||
for (i = 11; i < 61; i++) {
|
||||
rct_news_item * const newsItem = news_item_get(i);
|
||||
NewsItem * const newsItem = news_item_get(i);
|
||||
if (news_item_is_empty(i))
|
||||
break;
|
||||
if (y >= dpi->y + dpi->height)
|
||||
@@ -290,20 +290,20 @@ static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint3
|
||||
gfx_fill_rect_inset(dpi, -1, y, 383, y + 41, w->colours[1], (INSET_RECT_FLAG_BORDER_INSET | INSET_RECT_FLAG_FILL_GREY));
|
||||
|
||||
// Date text
|
||||
set_format_arg(0, rct_string_id, DateDayNames[newsItem->day - 1]);
|
||||
set_format_arg(2, rct_string_id, DateGameMonthNames[(newsItem->month_year % 8)]);
|
||||
set_format_arg(0, rct_string_id, DateDayNames[newsItem->Day - 1]);
|
||||
set_format_arg(2, rct_string_id, DateGameMonthNames[(newsItem->MonthYear % 8)]);
|
||||
gfx_draw_string_left(dpi, STR_NEWS_DATE_FORMAT, gCommonFormatArgs, COLOUR_WHITE, 4, y);
|
||||
|
||||
// Item text
|
||||
utf8 buffer[400];
|
||||
utf8 *ch = buffer;
|
||||
ch = utf8_write_codepoint(ch, FORMAT_SMALLFONT);
|
||||
memcpy(ch, newsItem->text, 256);
|
||||
memcpy(ch, newsItem->Text, 256);
|
||||
ch = buffer;
|
||||
gfx_draw_string_left_wrapped(dpi, &ch, 2, y + 10, 325, STR_STRING, COLOUR_BRIGHT_GREEN);
|
||||
|
||||
// Subject button
|
||||
if ((news_type_properties[newsItem->type] & NEWS_TYPE_HAS_SUBJECT) && !(newsItem->flags & 1)) {
|
||||
if ((news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_SUBJECT) && !(newsItem->Flags & 1)) {
|
||||
x = 328;
|
||||
yy = y + 14;
|
||||
|
||||
@@ -316,7 +316,7 @@ static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint3
|
||||
}
|
||||
gfx_fill_rect_inset(dpi, x, yy, x + 23, yy + 23, w->colours[2], press);
|
||||
|
||||
switch (newsItem->type) {
|
||||
switch (newsItem->Type) {
|
||||
case NEWS_ITEM_RIDE:
|
||||
gfx_draw_sprite(dpi, SPR_RIDE, x, yy, 0);
|
||||
break;
|
||||
@@ -328,7 +328,7 @@ static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint3
|
||||
break;
|
||||
}
|
||||
|
||||
rct_peep* peep = GET_PEEP(newsItem->assoc);
|
||||
rct_peep* peep = GET_PEEP(newsItem->Assoc);
|
||||
sint32 clip_x = 10, clip_y = 19;
|
||||
|
||||
// If normal peep set sprite to normal (no food)
|
||||
@@ -352,7 +352,7 @@ static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint3
|
||||
gfx_draw_sprite(dpi, SPR_FINANCE, x, yy, 0);
|
||||
break;
|
||||
case NEWS_ITEM_RESEARCH:
|
||||
gfx_draw_sprite(dpi, newsItem->assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE, x, yy, 0);
|
||||
gfx_draw_sprite(dpi, newsItem->Assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE, x, yy, 0);
|
||||
break;
|
||||
case NEWS_ITEM_PEEPS:
|
||||
gfx_draw_sprite(dpi, SPR_GUESTS, x, yy, 0);
|
||||
@@ -367,7 +367,7 @@ static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint3
|
||||
}
|
||||
|
||||
// Location button
|
||||
if ((news_type_properties[newsItem->type] & NEWS_TYPE_HAS_LOCATION) && !(newsItem->flags & 1)) {
|
||||
if ((news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_LOCATION) && !(newsItem->Flags & 1)) {
|
||||
x = 352;
|
||||
yy = y + 14;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user