mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 05:53:02 +01:00
Fix missing variables. Labeled even more vars
This commit is contained in:
@@ -395,7 +395,7 @@ rct_window *window_create(int x, int y, int width, int height, uint32 *event_han
|
||||
w->disabled_widgets = 0;
|
||||
w->pressed_widgets = 0;
|
||||
w->var_020 = 0;
|
||||
w->var_480 = 0;
|
||||
w->focus.coordinate.var_480 = 0;
|
||||
w->focus.coordinate.viewport_target_x = 0;
|
||||
w->focus.coordinate.viewport_target_y = 0;
|
||||
w->focus.coordinate.viewport_target_z = 0;
|
||||
|
||||
26
src/window.h
26
src/window.h
@@ -95,6 +95,7 @@ typedef struct {
|
||||
|
||||
// Type is viewport_target_y & 0x8000 == 0
|
||||
typedef struct{
|
||||
sint16 var_480;
|
||||
sint16 viewport_target_x; //0x482
|
||||
sint16 viewport_target_y; //0x484 & VIEWPORT_FOCUS_Y_MASK
|
||||
sint16 viewport_target_z; //0x486
|
||||
@@ -104,6 +105,7 @@ typedef struct{
|
||||
|
||||
// Type is viewport_target_sprite_id & 0x80000000 != 0
|
||||
typedef struct{
|
||||
sint16 var_480;
|
||||
uint16 viewport_target_sprite_id; //0x482
|
||||
uint8 pad_484;
|
||||
uint8 type; //0x485 & VIEWPORT_FOCUS_TYPE_MASK
|
||||
@@ -119,7 +121,7 @@ enum{
|
||||
|
||||
/**
|
||||
* Viewport focus structure.
|
||||
* size: 0x8
|
||||
* size: 0xA
|
||||
*/
|
||||
typedef union{
|
||||
sprite_focus sprite;
|
||||
@@ -127,24 +129,35 @@ typedef union{
|
||||
} viewport_focus;
|
||||
|
||||
typedef struct{
|
||||
uint16 no_weeks; //0x482
|
||||
sint16 campaign_type;
|
||||
sint16 no_weeks; //0x482
|
||||
uint16 ride_id; //0x484
|
||||
uint32 pad_486;
|
||||
} campaign_variables;
|
||||
|
||||
typedef struct{
|
||||
uint16 selected_ride_id; //0x482
|
||||
sint16 selected_ride_id; //0x480
|
||||
sint16 highlighted_ride_id; //0x482
|
||||
uint16 pad_484;
|
||||
uint16 pad_486;
|
||||
uint16 selected_ride_countdown; //488
|
||||
} new_ride_variables;
|
||||
|
||||
typedef struct{
|
||||
uint16 var_482;
|
||||
sint16 var_480;
|
||||
sint16 var_482;
|
||||
uint16 var_484;
|
||||
uint16 var_486;
|
||||
uint16 var_488;
|
||||
} news_variables;
|
||||
|
||||
typedef struct{
|
||||
sint16 rotation;
|
||||
sint16 var_482;
|
||||
uint16 var_484;
|
||||
uint16 var_486;
|
||||
uint16 var_488;
|
||||
}map_variables;
|
||||
/**
|
||||
* Window structure
|
||||
* size: 0x4C0
|
||||
@@ -174,14 +187,13 @@ typedef struct rct_window {
|
||||
sint16 selected_list_item; // 0x47A -1 for none selected
|
||||
sint16 pad_47C;
|
||||
sint16 pad_47E;
|
||||
sint16 var_480;
|
||||
union{
|
||||
viewport_focus focus;
|
||||
campaign_variables campaign;
|
||||
new_ride_variables new_ride;
|
||||
news_variables news;
|
||||
map_variables map;
|
||||
};
|
||||
//viewport_focus focus; // 0x482 viewport focus
|
||||
sint16 page; // 0x48A
|
||||
sint16 var_48C;
|
||||
sint16 frame_no; // 0x48E updated every tic for motion in windows sprites
|
||||
@@ -430,7 +442,7 @@ void window_park_objective_open();
|
||||
void window_park_rating_open();
|
||||
void window_finances_open();
|
||||
void window_finances_research_open();
|
||||
void window_new_campaign_open(int campaignType);
|
||||
void window_new_campaign_open(sint16 campaignType);
|
||||
void window_ride_list_open();
|
||||
void window_new_ride_open();
|
||||
void window_banner_open();
|
||||
|
||||
@@ -162,7 +162,7 @@ void window_map_open()
|
||||
w->var_020 |= 0x300;
|
||||
|
||||
window_init_scroll_widgets(w);
|
||||
w->var_480 = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint16);
|
||||
w->map.rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint16);
|
||||
|
||||
window_map_init_map();
|
||||
RCT2_GLOBAL(0x00F64F05, uint8) = 0;
|
||||
|
||||
@@ -128,7 +128,7 @@ int ride_name_compare(const void *a, const void *b)
|
||||
*
|
||||
* rct2: 0x0069E16F
|
||||
*/
|
||||
void window_new_campaign_open(int campaignType)
|
||||
void window_new_campaign_open(sint16 campaignType)
|
||||
{
|
||||
// RCT2_CALLPROC_X(0x0069E16F, campaignType, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
@@ -138,7 +138,7 @@ void window_new_campaign_open(int campaignType)
|
||||
|
||||
w = window_bring_to_front_by_id(WC_NEW_CAMPAIGN, 0);
|
||||
if (w != NULL) {
|
||||
if (w->var_480 == campaignType)
|
||||
if (w->campaign.campaign_type == campaignType)
|
||||
return;
|
||||
|
||||
window_close(w);
|
||||
@@ -162,7 +162,7 @@ void window_new_campaign_open(int campaignType)
|
||||
window_new_campaign_widgets[WIDX_TITLE].image = STR_MARKETING_VOUCHERS_FOR_FREE_ENTRY_TO_THE_PARK + campaignType;
|
||||
|
||||
// Campaign type
|
||||
w->var_480 = campaignType;
|
||||
w->campaign.campaign_type = campaignType;
|
||||
|
||||
// Number of weeks
|
||||
w->campaign.no_weeks = 2;
|
||||
@@ -234,7 +234,7 @@ static void window_new_campaign_mouseup()
|
||||
break;
|
||||
case WIDX_START_BUTTON:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_START_MARKETING_CAMPAIGN;
|
||||
game_do_command(0, (w->campaign.no_weeks<< 8) | 1, 0, (w->campaign.ride_id << 8) | w->var_480, GAME_COMMAND_START_MARKETING_CAMPAIGN, 0, 0);
|
||||
game_do_command(0, (w->campaign.no_weeks << 8) | 1, 0, (w->campaign.ride_id << 8) | w->campaign.campaign_type, GAME_COMMAND_START_MARKETING_CAMPAIGN, 0, 0);
|
||||
window_close(w);
|
||||
break;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ static void window_new_campaign_mousedown(int widgetIndex, rct_window *w, rct_wi
|
||||
case WIDX_RIDE_DROPDOWN_BUTTON:
|
||||
dropdownWidget = widget - 1;
|
||||
|
||||
if (w->var_480 == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE) {
|
||||
if (w->campaign.campaign_type == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE) {
|
||||
window_new_campaign_get_shop_items();
|
||||
if (window_new_campaign_shop_items[0] != 255) {
|
||||
int numItems = 0;
|
||||
@@ -329,7 +329,7 @@ static void window_new_campaign_dropdown()
|
||||
if (widgetIndex != WIDX_RIDE_DROPDOWN_BUTTON)
|
||||
return;
|
||||
|
||||
if (w->var_480 == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE) {
|
||||
if (w->campaign.campaign_type == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE) {
|
||||
rct_string_id itemStringId = (uint16)gDropdownItemsArgs[dropdownIndex] - 2016;
|
||||
if (itemStringId >= 32)
|
||||
itemStringId -= 96;
|
||||
@@ -355,7 +355,7 @@ static void window_new_campaign_invalidate()
|
||||
window_new_campaign_widgets[WIDX_RIDE_DROPDOWN].type = WWT_EMPTY;
|
||||
window_new_campaign_widgets[WIDX_RIDE_DROPDOWN_BUTTON].type = WWT_EMPTY;
|
||||
window_new_campaign_widgets[WIDX_RIDE_DROPDOWN].image = STR_MARKETING_NOT_SELECTED;
|
||||
switch (w->var_480) {
|
||||
switch (w->campaign.campaign_type) {
|
||||
case ADVERTISING_CAMPAIGN_RIDE_FREE:
|
||||
case ADVERTISING_CAMPAIGN_RIDE:
|
||||
window_new_campaign_widgets[WIDX_RIDE_LABEL].type = WWT_24;
|
||||
@@ -409,11 +409,11 @@ static void window_new_campaign_paint()
|
||||
y = w->y + 60;
|
||||
|
||||
// Price per week
|
||||
money32 pricePerWeek = AdvertisingCampaignPricePerWeek[w->var_480];
|
||||
money32 pricePerWeek = AdvertisingCampaignPricePerWeek[w->campaign.campaign_type];
|
||||
gfx_draw_string_left(dpi, STR_MARKETING_COST_PER_WEEK, &pricePerWeek, 0, x, y);
|
||||
y += 13;
|
||||
|
||||
// Total price
|
||||
money32 totalPrice = AdvertisingCampaignPricePerWeek[w->var_480] * w->campaign.no_weeks;
|
||||
money32 totalPrice = AdvertisingCampaignPricePerWeek[w->campaign.campaign_type] * w->campaign.no_weeks;
|
||||
gfx_draw_string_left(dpi, STR_MARKETING_TOTAL_COST, &totalPrice, 0, x, y);
|
||||
}
|
||||
@@ -431,16 +431,16 @@ void window_new_ride_open()
|
||||
w->colours[0] = 24;
|
||||
w->colours[1] = 26;
|
||||
w->colours[2] = 26;
|
||||
w->var_480 = -1;
|
||||
w->new_ride.selected_ride_id = -1;
|
||||
w->new_ride.selected_ride_countdown = -1;
|
||||
w->new_ride.highlighted_ride_id = -1;
|
||||
_lastTrackDesignCountRideType.type = 255;
|
||||
_lastTrackDesignCountRideType.entry_index = 255;
|
||||
|
||||
window_new_ride_populate_list();
|
||||
|
||||
w->new_ride.selected_ride_id = RCT2_ADDRESS(0x00F43825, sint16)[_window_new_ride_current_tab];
|
||||
if (w->new_ride.selected_ride_id == -1)
|
||||
w->new_ride.selected_ride_id = RCT2_GLOBAL(0x00F43523, sint16);
|
||||
w->new_ride.highlighted_ride_id = RCT2_ADDRESS(0x00F43825, sint16)[_window_new_ride_current_tab];
|
||||
if (w->new_ride.highlighted_ride_id == -1)
|
||||
w->new_ride.highlighted_ride_id = RCT2_GLOBAL(0x00F43523, sint16);
|
||||
|
||||
w->width = 1;
|
||||
window_new_ride_refresh_widget_sizing(w);
|
||||
@@ -577,13 +577,13 @@ static void window_new_ride_mousedown(int widgetIndex, rct_window *w, rct_widget
|
||||
|
||||
_window_new_ride_current_tab = page;
|
||||
w->frame_no = 0;
|
||||
w->new_ride.selected_ride_id = -1;
|
||||
w->var_480 = -1;
|
||||
w->new_ride.highlighted_ride_id = -1;
|
||||
w->new_ride.selected_ride_countdown = -1;
|
||||
window_new_ride_populate_list();
|
||||
if (page < WINDOW_NEW_RIDE_PAGE_RESEARCH) {
|
||||
w->new_ride.selected_ride_id = RCT2_ADDRESS(0x00F43825, sint16)[page];
|
||||
if (w->new_ride.selected_ride_id == -1)
|
||||
w->new_ride.selected_ride_id = RCT2_GLOBAL(0x00F43523, sint16);
|
||||
w->new_ride.highlighted_ride_id = RCT2_ADDRESS(0x00F43825, sint16)[page];
|
||||
if (w->new_ride.highlighted_ride_id == -1)
|
||||
w->new_ride.highlighted_ride_id = RCT2_GLOBAL(0x00F43523, sint16);
|
||||
}
|
||||
|
||||
window_new_ride_refresh_widget_sizing(w);
|
||||
@@ -603,7 +603,7 @@ static void window_new_ride_update(rct_window *w)
|
||||
|
||||
widget_invalidate(w->classification, w->number, WIDX_TAB_1 + _window_new_ride_current_tab);
|
||||
|
||||
if (w->var_480 != -1 && w->new_ride.selected_ride_countdown-- == 0)
|
||||
if (w->new_ride.selected_ride_countdown != -1 && w->new_ride.selected_ride_countdown-- == 0)
|
||||
window_new_ride_select(w);
|
||||
}
|
||||
|
||||
@@ -657,7 +657,7 @@ static void window_new_ride_scrollmousedown()
|
||||
return;
|
||||
|
||||
RCT2_ADDRESS(0x00F43825, ride_list_item)[_window_new_ride_current_tab] = item;
|
||||
w->var_480 = *((sint16*)&item);
|
||||
w->new_ride.selected_ride_countdown = *((sint16*)&item);
|
||||
|
||||
sound_play_panned(SOUND_CLICK_1, w->x + (w->width / 2));
|
||||
w->new_ride.selected_ride_countdown = 8;
|
||||
@@ -676,14 +676,14 @@ static void window_new_ride_scrollmouseover()
|
||||
|
||||
window_scrollmouse_get_registers(w, x, y);
|
||||
|
||||
if (w->var_480 != -1)
|
||||
if (w->new_ride.selected_ride_countdown != -1)
|
||||
return;
|
||||
|
||||
item = window_new_ride_scroll_get_ride_list_item_at(w, x, y);
|
||||
if (w->new_ride.selected_ride_id == *((sint16*)&item))
|
||||
if (w->new_ride.highlighted_ride_id == *((sint16*)&item))
|
||||
return;
|
||||
|
||||
w->new_ride.selected_ride_id = *((sint16*)&item);
|
||||
w->new_ride.highlighted_ride_id = *((sint16*)&item);
|
||||
RCT2_ADDRESS(0x00F43825, ride_list_item)[_window_new_ride_current_tab] = item;
|
||||
window_invalidate(w);
|
||||
}
|
||||
@@ -739,7 +739,7 @@ static void window_new_ride_paint()
|
||||
window_new_ride_draw_tab_images(dpi, w);
|
||||
|
||||
if (_window_new_ride_current_tab != WINDOW_NEW_RIDE_PAGE_RESEARCH) {
|
||||
ride_list_item item = *((ride_list_item*)&w->new_ride.selected_ride_id);
|
||||
ride_list_item item = *((ride_list_item*)&w->new_ride.highlighted_ride_id);
|
||||
if (item.type == 255 && item.entry_index == 255)
|
||||
return;
|
||||
|
||||
@@ -832,9 +832,9 @@ static void window_new_ride_scrollpaint()
|
||||
uint8 *rideEntry;
|
||||
// Draw flat button rectangle
|
||||
int flags = 0;
|
||||
if (w->var_480 == *((sint16*)listItem))
|
||||
if (w->new_ride.selected_ride_countdown == *((sint16*)listItem))
|
||||
flags |= 0x20;
|
||||
if (w->new_ride.selected_ride_id == *((sint16*)listItem) || flags != 0)
|
||||
if (w->new_ride.highlighted_ride_id == *((sint16*)listItem) || flags != 0)
|
||||
gfx_fill_rect_inset(dpi, x, y, x + 115, y + 115, w->colours[1], 0x80 | flags);
|
||||
|
||||
// Draw ride image
|
||||
@@ -973,7 +973,7 @@ static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixeli
|
||||
*/
|
||||
static void window_new_ride_select(rct_window *w)
|
||||
{
|
||||
ride_list_item item = *((ride_list_item*)&w->var_480);
|
||||
ride_list_item item = *((ride_list_item*)&w->new_ride.selected_ride_countdown);
|
||||
if (item.type == 255)
|
||||
return;
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ void window_news_open()
|
||||
window->colours[0] = 1;
|
||||
window->colours[1] = 1;
|
||||
window->colours[2] = 0;
|
||||
window->var_480 = -1;
|
||||
window->news.var_480 = -1;
|
||||
}
|
||||
|
||||
// sub_66E4BA:
|
||||
@@ -144,7 +144,7 @@ static void window_news_update(rct_window *w)
|
||||
int i, j, x, y, z;
|
||||
rct_news_item *newsItems;
|
||||
|
||||
if (w->var_480 == -1)
|
||||
if (w->news.var_480 == -1)
|
||||
return;
|
||||
if (--w->news.var_484 != 0)
|
||||
return;
|
||||
@@ -153,8 +153,8 @@ static void window_news_update(rct_window *w)
|
||||
sound_play_panned(SOUND_CLICK_2, w->x + (w->width / 2));
|
||||
|
||||
newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
|
||||
j = w->var_480;
|
||||
w->var_480 = -1;
|
||||
j = w->news.var_480;
|
||||
w->news.var_480 = -1;
|
||||
for (i = 11; i < 61; i++) {
|
||||
if (newsItems[i].type == NEWS_ITEM_NULL)
|
||||
return;
|
||||
@@ -251,7 +251,7 @@ static void window_news_scrollmousedown()
|
||||
}
|
||||
|
||||
if (buttonIndex != 0) {
|
||||
w->var_480 = i - 11;
|
||||
w->news.var_480 = i - 11;
|
||||
w->news.var_482 = buttonIndex;
|
||||
w->news.var_484 = 4;
|
||||
window_invalidate(w);
|
||||
@@ -329,8 +329,8 @@ static void window_news_scrollpaint()
|
||||
yy = y + 14;
|
||||
|
||||
press = 0;
|
||||
if (w->var_480 != -1) {
|
||||
newsItem2 = &newsItems[11 + w->var_480];
|
||||
if (w->news.var_480 != -1) {
|
||||
newsItem2 = &newsItems[11 + w->news.var_480];
|
||||
if (newsItem == newsItem2 && w->news.var_482 == 1)
|
||||
press = 0x20;
|
||||
}
|
||||
@@ -370,8 +370,8 @@ static void window_news_scrollpaint()
|
||||
yy = y + 14;
|
||||
|
||||
press = 0;
|
||||
if (w->var_480 != -1) {
|
||||
newsItem2 = &newsItems[11 + w->var_480];
|
||||
if (w->news.var_480 != -1) {
|
||||
newsItem2 = &newsItems[11 + w->news.var_480];
|
||||
if (newsItem == newsItem2 && w->news.var_482 == 2)
|
||||
press = 0x20;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ void window_peep_set_page(rct_window* w, int page);
|
||||
|
||||
void window_peep_close();
|
||||
void window_peep_resize();
|
||||
void window_peep_overview_mouse_up(int widgetIndex, rct_window* w, rct_widget* widget);
|
||||
void window_peep_overview_mouse_up();
|
||||
|
||||
static void* window_peep_overview_events[] = {
|
||||
window_peep_close,
|
||||
@@ -226,10 +226,10 @@ void window_peep_open(rct_peep* peep){
|
||||
window->page = 0;
|
||||
window_invalidate(window);
|
||||
|
||||
window->widgets = RCT2_GLOBAL(0x981D0C, rct_widget*);
|
||||
window->widgets = window_peep_page_widgets[WINDOW_PEEP_OVERVIEW];
|
||||
window->enabled_widgets = window_peep_page_enabled_widgets[WINDOW_PEEP_OVERVIEW];
|
||||
window->var_020 = RCT2_GLOBAL(0x981D54,uint32);
|
||||
window->event_handlers = RCT2_GLOBAL(0x981D24,uint32*);
|
||||
window->event_handlers = window_peep_page_events[WINDOW_PEEP_OVERVIEW];
|
||||
window->pressed_widgets = 0;
|
||||
|
||||
RCT2_CALLPROC_X(0x006987A6, 0, 0, 0, 0, (int)window, 0, 0);
|
||||
@@ -259,32 +259,9 @@ void window_peep_resize(){
|
||||
RCT2_CALLPROC_EBPSAFE(0x6987a6);
|
||||
RCT2_CALLPROC_EBPSAFE(w->event_handlers[WE_INVALIDATE]);
|
||||
|
||||
window_invalidate_by_id(0xA97,w->number);
|
||||
window_invalidate_by_id(0xA97, w->number);
|
||||
|
||||
w->min_width = 192;
|
||||
w->max_width = 500;
|
||||
w->min_height = 159;
|
||||
w->max_height = 450;
|
||||
|
||||
if (w->min_width > w->width){
|
||||
w->width = w->min_width;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
if (w->max_width < w->width){
|
||||
w->width = w->max_width;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
if (w->min_height > w->height){
|
||||
w->height = w->min_height;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
if (w->max_height < w->height){
|
||||
w->height = w->max_height;
|
||||
window_invalidate(w);
|
||||
}
|
||||
window_set_resize(w, 192, 159, 500, 450);
|
||||
|
||||
rct_viewport* view = w->viewport;
|
||||
|
||||
@@ -305,7 +282,11 @@ void window_peep_resize(){
|
||||
}
|
||||
|
||||
/* rct2: 0x00696A06 */
|
||||
void window_peep_overview_mouse_up(int widgetIndex, rct_window* w, rct_widget* widget){
|
||||
void window_peep_overview_mouse_up(){
|
||||
short widgetIndex;
|
||||
rct_window* w;
|
||||
window_widget_get_registers(w, widgetIndex);
|
||||
|
||||
switch(widgetIndex){
|
||||
case WIDX_CLOSE:
|
||||
window_close(w);
|
||||
|
||||
@@ -128,7 +128,7 @@ void window_scenarioselect_open()
|
||||
window->colours[0] = 1;
|
||||
window->colours[1] = 26;
|
||||
window->colours[2] = 26;
|
||||
window->var_480 = -1;
|
||||
window->focus.coordinate.var_480 = -1;
|
||||
window->var_494 = 0;
|
||||
|
||||
window_scenarioselect_init_tabs();
|
||||
|
||||
Reference in New Issue
Block a user