2014-11-02 09:39:01 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* Copyright (c) 2014 Ted John, Duncan Frost
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
|
|
|
* This file is part of OpenRCT2.
|
|
|
|
*
|
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "../addresses.h"
|
|
|
|
#include "../game.h"
|
|
|
|
#include "../interface/widget.h"
|
|
|
|
#include "../interface/window.h"
|
|
|
|
#include "../localisation/localisation.h"
|
|
|
|
#include "../peep/peep.h"
|
|
|
|
#include "../peep/staff.h"
|
|
|
|
#include "../sprites.h"
|
|
|
|
#include "../world/sprite.h"
|
2015-06-01 17:02:09 +02:00
|
|
|
#include "../interface/themes.h"
|
2014-11-02 09:39:01 +01:00
|
|
|
|
|
|
|
#define WW 200
|
|
|
|
#define WH 100
|
|
|
|
|
|
|
|
enum WINDOW_RIDE_DEMOLISH_WIDGET_IDX {
|
|
|
|
WIDX_BACKGROUND,
|
|
|
|
WIDX_TITLE,
|
|
|
|
WIDX_CLOSE,
|
|
|
|
WIDX_DEMOLISH,
|
|
|
|
WIDX_CANCEL
|
|
|
|
};
|
|
|
|
|
|
|
|
// 0x009AEBA0
|
|
|
|
static rct_widget window_ride_demolish_widgets[] = {
|
2015-07-10 02:39:16 +02:00
|
|
|
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE },
|
|
|
|
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_DEMOLISH_RIDE, STR_WINDOW_TITLE_TIP },
|
|
|
|
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP },
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 0, 10, 94, WH - 20, WH - 9, STR_DEMOLISH, STR_NONE },
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 0, WW - 95, WW - 11, WH - 20, WH - 9, STR_SAVE_PROMPT_CANCEL, STR_NONE },
|
|
|
|
{ WIDGETS_END }
|
2014-11-02 09:39:01 +01:00
|
|
|
};
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_ride_demolish_mouseup(rct_window *w, int widgetIndex);
|
|
|
|
static void window_ride_demolish_invalidate(rct_window *w);
|
|
|
|
static void window_ride_demolish_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
2014-11-02 09:39:01 +01:00
|
|
|
|
|
|
|
//0x0098E2E4
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_ride_demolish_events = {
|
|
|
|
NULL,
|
2014-11-02 09:39:01 +01:00
|
|
|
window_ride_demolish_mouseup,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2015-05-29 18:04:53 +02:00
|
|
|
window_ride_demolish_invalidate,
|
2014-11-02 09:39:01 +01:00
|
|
|
window_ride_demolish_paint,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL
|
2014-11-02 09:39:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Based off of rct2: 0x006B486A */
|
2015-07-10 02:39:16 +02:00
|
|
|
void window_ride_demolish_prompt_open(int rideIndex)
|
|
|
|
{
|
2014-11-02 09:39:01 +01:00
|
|
|
rct_window *w;
|
|
|
|
|
|
|
|
w = window_bring_to_front_by_number(WC_DEMOLISH_RIDE_PROMPT, rideIndex);
|
|
|
|
if (w != NULL)
|
|
|
|
return;
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
w = window_create_centred(WW, WH, &window_ride_demolish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT);
|
2014-11-02 09:39:01 +01:00
|
|
|
w->widgets = window_ride_demolish_widgets;
|
|
|
|
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_CANCEL) | (1 << WIDX_DEMOLISH);
|
|
|
|
window_init_scroll_widgets(w);
|
|
|
|
w->number = rideIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006B4933
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_ride_demolish_mouseup(rct_window *w, int widgetIndex)
|
|
|
|
{
|
|
|
|
switch (widgetIndex) {
|
2014-11-02 09:39:01 +01:00
|
|
|
case WIDX_DEMOLISH:
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_DEMOLISH_RIDE;
|
2015-06-28 14:13:42 +02:00
|
|
|
game_do_command(0, 1, 0, w->number, GAME_COMMAND_DEMOLISH_RIDE, 0, 0);
|
2014-11-02 09:39:01 +01:00
|
|
|
break;
|
|
|
|
case WIDX_CANCEL:
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
window_close(w);
|
2015-07-10 02:39:16 +02:00
|
|
|
break;
|
2014-11-02 09:39:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_ride_demolish_invalidate(rct_window *w)
|
2015-05-29 18:04:53 +02:00
|
|
|
{
|
|
|
|
colour_scheme_update(w);
|
|
|
|
}
|
|
|
|
|
2014-11-02 09:39:01 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006B48E5
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_ride_demolish_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|
|
|
{
|
2014-11-02 09:39:01 +01:00
|
|
|
window_draw_widgets(w, dpi);
|
|
|
|
|
2016-01-22 15:38:52 +01:00
|
|
|
rct_ride* ride = get_ride(w->number);
|
2014-11-02 09:39:01 +01:00
|
|
|
|
2016-01-11 12:55:33 +01:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments;
|
2014-11-02 09:39:01 +01:00
|
|
|
|
|
|
|
int x = w->x + WW / 2;
|
|
|
|
int y = w->y + (WH / 2) - 3;
|
|
|
|
|
2016-01-11 12:55:33 +01:00
|
|
|
gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, WW - 4, STR_DEMOLISH_RIDE_ID, 0);
|
2014-11-02 09:39:01 +01:00
|
|
|
}
|