Example #1
0
/**
 *
 *  rct2: 0x0066EAB8
 */
static void window_news_update(rct_window *w)
{
    sint32 i, j, x, y, z;

    if (w->news.var_480 == -1 ||
        --w->news.var_484 != 0)
    {
        return;
    }

    window_invalidate(w);
    audio_play_sound(SOUND_CLICK_2, 0, w->x + (w->width / 2));

    j = w->news.var_480;
    w->news.var_480 = -1;
    for (i = 11; i < 61; i++)
    {
        if (news_item_is_empty(i))
            return;

        if (j == 0)
        {
            NewsItem * const newsItem = news_item_get(i);
            if (newsItem->Flags & NEWS_FLAG_HAS_BUTTON)
                return;
            if (w->news.var_482 == 1)
            {
                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);
                if (x != LOCATION_NULL && (w = window_get_main()) != nullptr)
                {
                    window_scroll_to_location(w, x, y, z);
                }
                return;
            }
        }
        j--;
    }
}
Example #2
0
/**
 * 
 *  rct2: 0x0066EAB8
 */
static void window_news_update(rct_window *w)
{
	int i, j, x, y, z;
	rct_news_item *newsItems;

	if (w->var_480 == -1)
		return;
	if (--w->var_484 != 0)
		return;

	window_invalidate(w);
	sound_play_panned(5, w->x + (w->width / 2));

	newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
	j = w->var_480;
	w->var_480 = -1;
	for (i = 11; i < 61; i++) {
		if (newsItems[i].type == NEWS_ITEM_NULL)
			return;

		if (j == 0) {
			if (newsItems[i].flags & 1)
				return;
			if (w->var_482 == 1) {
				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);
				if (x != SPRITE_LOCATION_NULL)
					if ((w = window_get_main()) != NULL)
						window_scroll_to_location(w, x, y, z);
				return;
			}
		}
		j--;
	}
}
Example #3
0
/**
 *
 *  rct2: 0x0066EAB8
 */
static void window_news_update(rct_window *w)
{
	int i, j, x, y, z;

	if (w->news.var_480 == -1)
		return;
	if (--w->news.var_484 != 0)
		return;

	window_invalidate(w);
	audio_play_sound_panned(SOUND_CLICK_2, w->x + (w->width / 2), 0, 0, 0);

	j = w->news.var_480;
	w->news.var_480 = -1;
	for (i = 11; i < 61; i++) {
		if (news_item_is_empty(i))
			return;

		if (j == 0) {
			rct_news_item * 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);
				return;
			}
			else if (w->news.var_482 > 1) {
				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);
				return;
			}
		}
		j--;
	}
}