1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Merge branch 'ddevrien-map-window'

This commit is contained in:
IntelOrca
2014-05-20 03:16:18 +01:00
2 changed files with 134 additions and 7 deletions

View File

@@ -54,6 +54,8 @@ enum {
SPR_AWARD = 5194,
SPR_GRAPH = 5195,
SPR_PARK_ENTRANCE = 5197,
SPR_TAB_GRAPH_0 = 5245,
SPR_TAB_GRAPH_1 = SPR_TAB_GRAPH_0 + 1,
SPR_TAB_GRAPH_2 = SPR_TAB_GRAPH_0 + 2,

View File

@@ -28,12 +28,24 @@ static enum WINDOW_MAP_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_RESIZE = 3,
WIDX_PEOPLE_TAB = 4,
WIDX_RIDES_TAB = 5,
WIDX_MAP = 6,
WIDX_MAP_SIZE_SPINNER = 7,
WIDX_BUY_LAND = 10,
WIDX_PEOPLE_STARTING_POSITION = 12
WIDX_MAP_SIZE_SPINNER_UP = 8,
WIDX_MAP_SIZE_SPINNER_DOWN = 9,
WIDX_SET_LAND_RIGHTS = 10,
WIDX_BUILD_PARK_ENTRANCE = 11,
WIDX_PEOPLE_STARTING_POSITION = 12,
WIDX_LAND_TOOL = 13,
WIDX_LAND_TOOL_SMALLER = 14,
WIDX_LAND_TOOL_LARGER = 15,
WIDX_LAND_OWNED_CHECKBOX = 16,
WIDX_CONSTRUCTION_RIGHTS_OWNED_CHECKBOX = 17,
WIDX_LAND_SALE_CHECKBOX = 18,
WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX = 19,
WIDX_ROTATE_90 = 20
};
static rct_widget window_map_widgets[] = {
@@ -43,12 +55,12 @@ static rct_widget window_map_widgets[] = {
{ WWT_RESIZE, 1, 0, 244, 43, 257, STR_NONE, STR_NONE },
{ WWT_COLORBTN, 1, 3, 33, 17, 43, 0x02000144E, STR_SHOW_PEOPLE_ON_MAP_TIP },
{ WWT_COLORBTN, 1, 34, 64, 17, 43, 0x02000144E, STR_SHOW_RIDES_STALLS_ON_MAP_TIP },
{ WWT_SCROLL, 1, 3, 241, 46, 125, 0x3, STR_NONE },
{ WWT_SCROLL, 1, 3, 241, 46, 225, 0x3, STR_NONE },
{ WWT_SPINNER, 1, 104, 198, 229, 240, 0xC8C, STR_NONE },
{ WWT_DROPDOWN_BUTTON, 1, 187, 197, 230, 234, STR_NUMERIC_UP, STR_NONE },
{ WWT_DROPDOWN_BUTTON, 1, 187, 197, 235, 239, STR_NUMERIC_DOWN, STR_NONE },
{ WWT_FLATBTN, 1, 4, 27, 1, 24, SPR_BUY_LAND_RIGHTS, STR_SELECT_PARK_OWNED_LAND_TIP },
{ WWT_FLATBTN, 1, 4, 27, 1, 24, SPR_BUY_CONSTRUCTION_RIGHTS, STR_BUILD_PARK_ENTRANCE_TIP },
{ WWT_FLATBTN, 1, 4, 27, 1, 24, SPR_PARK_ENTRANCE, STR_BUILD_PARK_ENTRANCE_TIP },
{ WWT_FLATBTN, 1, 28, 51, 1, 24, STR_NONE, STR_SET_STARTING_POSITIONS_TIP },
{ WWT_IMGBTN, 1, 4, 47, 17, 48, SPR_LAND_TOOL_SIZE_0, STR_NONE },
{ WWT_TRNBTN, 1, 5, 20, 18, 33, 0x02000157B, STR_ADJUST_SMALLER_LAND_TIP },
@@ -227,7 +239,120 @@ static void window_map_scrollmousedown()
*/
static void window_map_invalidate()
{
RCT2_CALLPROC_EBPSAFE(0x0068CA8F);
rct_window *w;
uint32 pressed_widgets;
int i, height;
__asm mov w, esi
// set the pressed widgets
pressed_widgets = (uint32)w->pressed_widgets;
pressed_widgets &= 0xFFFFFF8F; // both tabs and the map
pressed_widgets |= (1 << (w->selected_tab + 4)); // people tab or rides tab
pressed_widgets |= (1 << WIDX_LAND_TOOL); // land tool
pressed_widgets &= 0xFFF0FFFF; // the land option checkboxes
if (RCT2_GLOBAL(0x0F1AD61, uint8) & 8)
pressed_widgets |= (1 << WIDX_LAND_SALE_CHECKBOX);
if (RCT2_GLOBAL(0x0F1AD61, uint8) & 4)
pressed_widgets |= (1 << WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX);
if (RCT2_GLOBAL(0x0F1AD61, uint8) & 2)
pressed_widgets |= (1 << WIDX_LAND_OWNED_CHECKBOX);
if (RCT2_GLOBAL(0x0F1AD61, uint8) & 1)
pressed_widgets |= (1 << WIDX_CONSTRUCTION_RIGHTS_OWNED_CHECKBOX);
w->pressed_widgets = pressed_widgets;
// resizing changes some widget coordinates
w->widgets[WIDX_BACKGROUND].right = w->width - 1;
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
w->widgets[WIDX_RESIZE].right = w->width - 1;
w->widgets[WIDX_RESIZE].bottom = w->height - 1;
w->widgets[WIDX_TITLE].right = w->width - 2;
w->widgets[WIDX_CLOSE].left = w->width - 2 - 11;
w->widgets[WIDX_CLOSE].right = w->width - 2 - 11 + 10;
w->widgets[WIDX_MAP].right = w->width - 4;
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR))
w->widgets[WIDX_MAP].bottom = w->height - 1 - 72;
else if (w->selected_tab == 1)
w->widgets[WIDX_MAP].bottom = w->height - 1 - 44;
else
w->widgets[WIDX_MAP].bottom = w->height - 1 - 14;
w->widgets[WIDX_MAP_SIZE_SPINNER].top = w->height - 15;
w->widgets[WIDX_MAP_SIZE_SPINNER].bottom = w->height - 4;
w->widgets[WIDX_MAP_SIZE_SPINNER_UP].top = w->height - 14;
w->widgets[WIDX_MAP_SIZE_SPINNER_UP].bottom = w->height - 10;
w->widgets[WIDX_MAP_SIZE_SPINNER_DOWN].top = w->height - 9;
w->widgets[WIDX_MAP_SIZE_SPINNER_DOWN].bottom = w->height - 5;
w->widgets[WIDX_SET_LAND_RIGHTS].top = w->height - 70;
w->widgets[WIDX_SET_LAND_RIGHTS].bottom = w->height - 70 + 23;
w->widgets[WIDX_BUILD_PARK_ENTRANCE].top = w->height - 46;
w->widgets[WIDX_BUILD_PARK_ENTRANCE].bottom = w->height - 46 + 23;
w->widgets[WIDX_ROTATE_90].top = w->height - 46;
w->widgets[WIDX_ROTATE_90].bottom = w->height - 46 + 23;
w->widgets[WIDX_PEOPLE_STARTING_POSITION].top = w->height - 46;
w->widgets[WIDX_PEOPLE_STARTING_POSITION].bottom = w->height - 46 + 23;
w->widgets[WIDX_LAND_TOOL].top = w->height - 42;
w->widgets[WIDX_LAND_TOOL].bottom = w->height - 42 + 30;
w->widgets[WIDX_LAND_TOOL_SMALLER].top = w->height - 41;
w->widgets[WIDX_LAND_TOOL_SMALLER].bottom = w->height - 41 + 15;
w->widgets[WIDX_LAND_TOOL_LARGER].top = w->height - 27;
w->widgets[WIDX_LAND_TOOL_LARGER].bottom = w->height - 27 + 15;
// land tool mode (4 checkboxes)
height = w->height - 55;
for (i = 0; i < 4; i++) {
w->widgets[WIDX_LAND_OWNED_CHECKBOX + i].top = height;
height += 11;
w->widgets[WIDX_LAND_OWNED_CHECKBOX + i].bottom = height;
height += 2;
}
// disable all scenario editor related widgets
for (i = WIDX_MAP_SIZE_SPINNER; i <= WIDX_ROTATE_90; i++) {
w->widgets[i].type = WWT_EMPTY;
}
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)) {
// scenario editor: build park entrance selected, show rotate button
if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_MAP &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) == WIDX_BUILD_PARK_ENTRANCE) {
w->widgets[WIDX_ROTATE_90].type = WWT_FLATBTN;
}
// always show set land rights button
w->widgets[WIDX_SET_LAND_RIGHTS].type = WWT_FLATBTN;
if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_MAP) {
// if not in set land rights mode: show the default scenario editor buttons
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) != WIDX_SET_LAND_RIGHTS) {
w->widgets[WIDX_BUILD_PARK_ENTRANCE].type = WWT_FLATBTN;
w->widgets[WIDX_PEOPLE_STARTING_POSITION].type = WWT_FLATBTN;
w->widgets[WIDX_MAP_SIZE_SPINNER].type = WWT_SPINNER;
w->widgets[WIDX_MAP_SIZE_SPINNER_UP].type = WWT_DROPDOWN_BUTTON;
w->widgets[WIDX_MAP_SIZE_SPINNER_DOWN].type = WWT_DROPDOWN_BUTTON;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, uint16);
} else { // if in set land rights mode: show land tool buttons + modes
w->widgets[WIDX_LAND_TOOL].type = WWT_IMGBTN;
w->widgets[WIDX_LAND_TOOL_SMALLER].type = WWT_TRNBTN;
w->widgets[WIDX_LAND_TOOL_LARGER].type = WWT_TRNBTN;
for (i = 0; i < 4; i++)
w->widgets[WIDX_LAND_OWNED_CHECKBOX + i].type = WWT_CHECKBOX;
w->widgets[WIDX_LAND_TOOL].image = SPR_LAND_TOOL_SIZE_0 +
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, uint16);
}
}
}
}
/**
@@ -236,7 +361,6 @@ static void window_map_invalidate()
*/
static void window_map_paint()
{
//RCT2_CALLPROC_EBPSAFE(0x0068CDA9);
rct_window *w;
rct_drawpixelinfo *dpi;
int image_id;
@@ -290,10 +414,11 @@ static void window_map_paint()
}
if ((RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) != WC_MAP) &&
(RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) != WIDX_BUY_LAND))
(RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) != WIDX_SET_LAND_RIGHTS))
return;
}
// map size spinner
gfx_draw_string_left(dpi, STR_MAP_SIZE, 0, 0, w->x + 4, w->y + w->widgets[WIDX_MAP_SIZE_SPINNER].top + 1);
}