This commit is contained in:
Duncan Frost 2014-05-08 19:16:34 +01:00
commit 63681f6877
7 changed files with 171 additions and 12 deletions

View File

@ -276,3 +276,71 @@ void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc)
newsItem++;
newsItem->type = 0;
}
/**
* Opens the window/tab for the subject of the news item
*
* rct2: 0x0066EBE6
*
**/
void news_item_open_subject(int type, int subject) {
int eax;
rct_peep* peep;
rct_window* window;
switch (type) {
case NEWS_ITEM_RIDE:
RCT2_CALLPROC_X(0x006ACC28, subject, 0, 0, 0, 0, 0, 0);
break;
case NEWS_ITEM_PEEP_ON_RIDE:
case NEWS_ITEM_PEEP:
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]);
RCT2_CALLPROC_X(0x006989E9, 0, 0, 0, peep, 0, 0, 0);
break;
case NEWS_ITEM_MONEY:
// Open finances window
RCT2_CALLPROC_EBPSAFE(0x0069DDF1);
break;
case NEWS_ITEM_RESEARCH:
if (subject >= 0x10000) {
// Open ride list window
RCT2_CALLPROC_EBPSAFE(0x006B3CFF);
eax = (subject & 0xFF00) >> 8;
eax += (subject & 0xFF) << 8;
// Switch to right tab and scroll to ride location
RCT2_CALLPROC_X(0x006B3EBA, eax, 0, subject, 0, 0, 0, 0);
break;
}
// Check if window is already open
window = window_bring_to_front_by_id(WC_SCENERY, 0);
if (window == NULL) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
if (tool_set(window, 9, 0)){
RCT2_CALLPROC_X(0x006E1172, (subject & 0xFFFF), 0, subject, 0, 0, 0, 0);
}
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
// Open scenery window
RCT2_CALLPROC_EBPSAFE(0x006E0FEF);
}
}
// Switch to new scenery tab
RCT2_CALLPROC_X(0x006E1172, (subject & 0xFFFF), 0, subject, 0, 0, 0, 0);
break;
case NEWS_ITEM_PEEPS:
// Open guest list to right tab
RCT2_CALLPROC_X(0x006993BA, 3, subject, 0, 0, 0, 0, 0);
break;
case NEWS_ITEM_AWARD:
window_park_awards_open();
break;
case NEWS_ITEM_GRAPH:
window_park_rating_open();
break;
}
}

View File

@ -33,7 +33,7 @@ enum {
NEWS_ITEM_PEEP,
NEWS_ITEM_MONEY,
NEWS_ITEM_BLANK,
NEWS_ITEM_SCENERY,
NEWS_ITEM_RESEARCH,
NEWS_ITEM_PEEPS,
NEWS_ITEM_AWARD,
NEWS_ITEM_GRAPH
@ -61,5 +61,6 @@ void news_item_update_current();
void news_item_close_current();
void news_item_get_subject_location(int type, int subject, int *x, int *y, int *z);
void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc);
void news_item_open_subject(int type, int subject);
#endif

View File

@ -359,8 +359,11 @@ void window_clear_scenery_open();
void window_land_open();
void window_water_open();
void window_guest_list_open();
void window_park_awards_open();
void window_park_entrance_open();
void window_park_guests_open();
void window_park_objective_open();
void window_park_rating_open();
void window_ride_list_open();
void window_cheats_open();

View File

@ -270,7 +270,7 @@ static void window_footpath_mouseup()
break;
_window_footpath_cost = 0x80000000;
RCT2_CALLPROC_EBPSAFE(0x006EE281);
tool_cancel();
RCT2_CALLPROC_EBPSAFE(0x006A7831);
RCT2_CALLPROC_EBPSAFE(0x0068AB1B);
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2;

View File

@ -163,17 +163,17 @@ static void window_game_bottom_toolbar_mouseup()
RCT2_CALLPROC_EBPSAFE(0x0069DDF1);
break;
case WIDX_GUESTS:
RCT2_CALLPROC_EBPSAFE(0x00667D35);
window_park_guests_open();
break;
case WIDX_PARK_RATING:
RCT2_CALLPROC_EBPSAFE(0x00667CA4);
window_park_rating_open();
break;
case WIDX_MIDDLE_INSET:
news_item_close_current();
break;
case WIDX_NEWS_SUBJECT:
newsItem = &(RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item)[0]);
RCT2_CALLPROC_X(0x0066EBE6, 0, newsItem->type, newsItem->assoc, 0, 0, 0, 0);
news_item_open_subject(newsItem->type, newsItem->assoc);
break;
case WIDX_NEWS_LOCATE:
newsItem = &(RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item)[0]);
@ -615,7 +615,7 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
break;
case NEWS_ITEM_MONEY:
gfx_draw_sprite(dpi, SPR_FINANCE, x, y);
case NEWS_ITEM_SCENERY:
case NEWS_ITEM_RESEARCH:
gfx_draw_sprite(dpi, (newsItem->assoc < 0x10000 ? SPR_NEW_RIDE : SPR_SCENERY), x, y);
break;
case NEWS_ITEM_PEEPS:

View File

@ -169,7 +169,7 @@ static void window_news_update()
if (newsItems[i].flags & 1)
return;
if (w->var_482 == 1) {
RCT2_CALLPROC_X(0x0066EBE6, 0, newsItems[i].type, newsItems[i].assoc, 0, 0, 0, 0);
news_item_open_subject(newsItems[i].type, newsItems[i].assoc);
return;
} else if (w->var_482 > 1) {
news_item_get_subject_location(newsItems[i].type, newsItems[i].assoc, &x, &y, &z);
@ -352,7 +352,7 @@ static void window_news_scrollpaint()
case NEWS_ITEM_MONEY:
gfx_draw_sprite(dpi, SPR_FINANCE, x, yy);
break;
case NEWS_ITEM_SCENERY:
case NEWS_ITEM_RESEARCH:
gfx_draw_sprite(dpi, newsItem->assoc < 0x10000 ? SPR_NEW_RIDE : SPR_SCENERY, x, yy);
break;
case NEWS_ITEM_PEEPS:

View File

@ -646,7 +646,7 @@ static void window_park_entrance_close()
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
RCT2_CALLPROC_EBPSAFE(0x006EE281);
tool_cancel();
}
/**
@ -1083,6 +1083,35 @@ static void window_park_scroll_to_viewport(rct_window *w)
#pragma region Rating page
/**
*
* rct2: 0x00667CA4
*/
void window_park_rating_open()
{
rct_window* window;
window = window_bring_to_front_by_id(WC_PARK_INFORMATION, 0);
if (window == NULL) {
window = window_park_open();
window->var_482 = -1;
window->var_484 = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
window->viewport = NULL;
window->page = WINDOW_PARK_PAGE_RATING;
window_invalidate(window);
window->widgets = window_park_rating_widgets;
window->enabled_widgets = window_park_page_enabled_widgets[WINDOW_PARK_PAGE_RATING];
window->var_020 = 0;
window->event_handlers = window_park_rating_events;
window_init_scroll_widgets(window);
}
/**
*
* rct2: 0x00668A06
@ -1197,6 +1226,35 @@ static void window_park_rating_paint()
#pragma region Guests page
/**
*
* rct2: 0x00667D35
*/
void window_park_guests_open()
{
rct_window* window;
window = window_bring_to_front_by_id(WC_PARK_INFORMATION, 0);
if (window == NULL) {
window = window_park_open();
window->var_482 = -1;
window->var_484 = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
window->viewport = NULL;
window->page = WINDOW_PARK_PAGE_GUESTS;
window_invalidate(window);
window->widgets = window_park_guests_widgets;
window->enabled_widgets = window_park_page_enabled_widgets[WINDOW_PARK_PAGE_GUESTS];
window->var_020 = 0;
window->event_handlers = window_park_guests_events;
window_init_scroll_widgets(window);
}
/**
*
* rct2: 0x00668DEB
@ -1570,7 +1628,7 @@ static void window_park_stats_paint()
y = w->y + window_park_awards_widgets[WIDX_PAGE_BACKGROUND].top + 4;
// Draw park size
parkSize = RCT2_GLOBAL(0x013580EA, sint16) * 10;
parkSize = RCT2_GLOBAL(RCT2_ADDRESS_PARK_SIZE, sint16) * 10;
stringIndex = STR_PARK_SIZE_METRIC_LABEL;
if (!RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint8)) {
stringIndex = STR_PARK_SIZE_IMPERIAL_LABEL;
@ -1619,7 +1677,7 @@ void window_park_objective_open()
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
RCT2_CALLPROC_EBPSAFE(0x006EE281);
tool_cancel();
window->viewport = NULL;
window->page = WINDOW_PARK_PAGE_OBJECTIVE;
@ -1773,6 +1831,35 @@ static void window_park_objective_paint()
#pragma region Awards page
/**
*
* rct2: 0x00667DC6
*/
void window_park_awards_open()
{
rct_window* window;
window = window_bring_to_front_by_id(WC_PARK_INFORMATION, 0);
if (window == NULL) {
window = window_park_open();
window->var_482 = -1;
window->var_484 = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
window->viewport = NULL;
window->page = WINDOW_PARK_PAGE_AWARDS;
window_invalidate(window);
window->widgets = window_park_awards_widgets;
window->enabled_widgets = window_park_page_enabled_widgets[WINDOW_PARK_PAGE_AWARDS];
window->var_020 = 0;
window->event_handlers = window_park_awards_events;
window_init_scroll_widgets(window);
}
/**
*
* rct2: 0x00669851
@ -1896,7 +1983,7 @@ static void window_park_set_page(rct_window *w, int page)
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
RCT2_CALLPROC_EBPSAFE(0x006EE281);
tool_cancel();
// Set listen only to viewport
listen = 0;