2014-04-15 01:50:20 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Copyright (c) 2014 Ted John
|
|
|
|
* 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/>.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../addresses.h"
|
|
|
|
#include "../game.h"
|
|
|
|
#include "../interface/widget.h"
|
|
|
|
#include "../interface/window.h"
|
|
|
|
#include "../localisation/localisation.h"
|
2015-01-25 01:20:53 +01:00
|
|
|
#include "../world/park.h"
|
2014-10-06 20:41:43 +02:00
|
|
|
#include "../peep/peep.h"
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../ride/ride.h"
|
|
|
|
#include "../scenario.h"
|
|
|
|
#include "../sprites.h"
|
|
|
|
#include "../world/climate.h"
|
2015-04-01 01:46:20 +02:00
|
|
|
#include "../world/footpath.h"
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../world/park.h"
|
|
|
|
#include "../world/sprite.h"
|
2014-07-16 04:41:12 +02:00
|
|
|
|
|
|
|
//#define WW 200
|
|
|
|
//#define WH 128
|
2014-12-10 02:44:30 +01:00
|
|
|
#define CHEATS_MONEY_INCREMENT MONEY(5000,00)
|
|
|
|
#define CHEATS_TRAM_INCREMENT 250
|
2014-04-15 01:50:20 +02:00
|
|
|
enum {
|
|
|
|
WINDOW_CHEATS_PAGE_MONEY,
|
2014-07-16 04:41:12 +02:00
|
|
|
WINDOW_CHEATS_PAGE_GUESTS,
|
|
|
|
WINDOW_CHEATS_PAGE_MISC,
|
2015-03-26 21:52:19 +01:00
|
|
|
WINDOW_CHEATS_PAGE_RIDES,
|
2014-04-15 01:50:20 +02:00
|
|
|
};
|
|
|
|
|
2014-05-19 21:10:32 +02:00
|
|
|
enum WINDOW_CHEATS_WIDGET_IDX {
|
2014-04-15 01:50:20 +02:00
|
|
|
WIDX_BACKGROUND,
|
|
|
|
WIDX_TITLE,
|
|
|
|
WIDX_CLOSE,
|
|
|
|
WIDX_PAGE_BACKGROUND,
|
|
|
|
WIDX_TAB_1,
|
|
|
|
WIDX_TAB_2,
|
2014-07-16 04:41:12 +02:00
|
|
|
WIDX_TAB_3,
|
2015-03-26 21:52:19 +01:00
|
|
|
WIDX_TAB_4,
|
2014-05-01 23:55:26 +02:00
|
|
|
WIDX_HIGH_MONEY,
|
2014-06-28 15:44:48 +02:00
|
|
|
WIDX_PARK_ENTRANCE_FEE,
|
2015-03-26 21:52:19 +01:00
|
|
|
WIDX_HAPPY_GUESTS = 8, //Same as HIGH_MONEY as it is also the 8th widget but on a different page
|
2014-07-16 04:41:12 +02:00
|
|
|
WIDX_TRAM_GUESTS,
|
2015-03-26 21:52:19 +01:00
|
|
|
WIDX_FREEZE_CLIMATE = 8,
|
2014-07-16 04:41:12 +02:00
|
|
|
WIDX_OPEN_CLOSE_PARK,
|
|
|
|
WIDX_DECREASE_GAME_SPEED,
|
|
|
|
WIDX_INCREASE_GAME_SPEED,
|
2014-11-05 21:26:27 +01:00
|
|
|
WIDX_ZERO_CLEARANCE,
|
|
|
|
WIDX_WEATHER_SUN,
|
2014-12-10 02:44:30 +01:00
|
|
|
WIDX_WEATHER_THUNDER,
|
|
|
|
WIDX_CLEAR_GRASS,
|
|
|
|
WIDX_MOWED_GRASS,
|
|
|
|
WIDX_WATER_PLANTS,
|
|
|
|
WIDX_FIX_VANDALISM,
|
2015-02-21 03:04:33 +01:00
|
|
|
WIDX_REMOVE_LITTER,
|
2015-03-18 16:21:45 +01:00
|
|
|
WIDX_WIN_SCENARIO,
|
2015-03-26 21:52:19 +01:00
|
|
|
WIDX_RENEW_RIDES = 8,
|
2015-03-28 19:29:19 +01:00
|
|
|
WIDX_REMOVE_SIX_FLAGS,
|
2015-05-15 16:49:46 +02:00
|
|
|
WIDX_MAKE_DESTRUCTIBLE,
|
|
|
|
WIDX_FIX_ALL
|
2014-04-15 01:50:20 +02:00
|
|
|
};
|
|
|
|
|
2014-07-16 04:41:12 +02:00
|
|
|
#pragma region MEASUREMENTS
|
|
|
|
#define WW 240
|
|
|
|
#define WH 240
|
2014-07-21 14:05:43 +02:00
|
|
|
#define TAB_HEIGHT 43
|
|
|
|
#define XSPA 5 //X spacing
|
|
|
|
#define YSPA 5 //Y spacing
|
|
|
|
#define XOS 0 + XSPA //X offset from left
|
|
|
|
#define YOS TAB_HEIGHT + YSPA //Y offset ofrom top (includes tabs height)
|
|
|
|
#define BTNW 110 //button width
|
|
|
|
#define BTNH 16 //button height
|
|
|
|
#define YPL(ROW) YOS + ((BTNH + YSPA) * ROW)
|
|
|
|
#define HPL(ROW) YPL(ROW) + BTNH
|
|
|
|
#define XPL(COL) XOS + ((BTNW + XSPA) * COL)
|
|
|
|
#define WPL(COL) XPL(COL) + BTNW
|
|
|
|
|
|
|
|
#define TXTO 3 //text horizontal offset from button left (for button text)
|
2014-07-16 04:41:12 +02:00
|
|
|
#pragma endregion
|
|
|
|
|
2014-05-01 23:55:26 +02:00
|
|
|
static rct_widget window_cheats_money_widgets[] = {
|
2014-07-16 04:41:12 +02:00
|
|
|
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0x0FFFFFFFF, 65535}, // panel / background
|
|
|
|
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, 3165, STR_WINDOW_TITLE_TIP}, // title bar
|
|
|
|
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP}, // close x button
|
|
|
|
{ WWT_IMGBTN, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, 65535}, // tab content panel
|
|
|
|
{ WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 2462}, // tab 1
|
|
|
|
{ WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 2462}, // tab 2
|
|
|
|
{ WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2462}, // tab 3
|
2015-03-26 21:52:19 +01:00
|
|
|
{ WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 2462}, // tab 4
|
2014-08-14 08:47:23 +02:00
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(1), HPL(1), 2760, STR_NONE}, // high money
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(3), HPL(3), 2761, STR_NONE}, //Park Entrance Fee Toggle
|
2014-04-15 01:50:20 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2014-05-01 23:55:26 +02:00
|
|
|
static rct_widget window_cheats_guests_widgets[] = {
|
2014-07-16 04:41:12 +02:00
|
|
|
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0x0FFFFFFFF, 65535 }, // panel / background
|
|
|
|
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, 3165, STR_WINDOW_TITLE_TIP }, // title bar
|
|
|
|
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP }, // close x button
|
|
|
|
{ WWT_IMGBTN, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, 65535 }, // tab content panel
|
|
|
|
{ WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 2462 }, // tab 1
|
|
|
|
{ WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 2462 }, // tab 2
|
|
|
|
{ WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2462 }, // tab 3
|
2015-03-26 21:52:19 +01:00
|
|
|
{ WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 2462}, // tab 4
|
2014-08-14 08:47:23 +02:00
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(1), HPL(1), 2764, STR_NONE}, // happy guests
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(3), HPL(3), 2765, STR_NONE}, // happy guests
|
2014-07-16 04:41:12 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
|
|
|
//Strings for following moved to window_cheats_paint()
|
|
|
|
static rct_widget window_cheats_misc_widgets[] = {
|
|
|
|
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0x0FFFFFFFF, 65535 }, // panel / background
|
|
|
|
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, 3165, STR_WINDOW_TITLE_TIP }, // title bar
|
|
|
|
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP }, // close x button
|
|
|
|
{ WWT_IMGBTN, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, 65535 }, // tab content panel
|
|
|
|
{ WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 2462 }, // tab 1
|
|
|
|
{ WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 2462 }, // tab 2
|
2014-07-21 14:05:43 +02:00
|
|
|
{ WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2462}, // tab 3
|
2015-03-26 21:52:19 +01:00
|
|
|
{ WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 2462}, // tab 4
|
2014-08-14 08:47:23 +02:00
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(0), HPL(0), 2767, STR_NONE}, // Freeze climate
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(1), HPL(1), 2769, STR_NONE}, // open / close park
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(2), HPL(2), 2771, STR_NONE}, // decrease game speed
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(2), HPL(2), 2772, STR_NONE}, // increase game speed
|
2014-11-03 22:15:35 +01:00
|
|
|
{ WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(3), HPL(3), 2759, STR_NONE}, // Zero Clearance
|
2014-11-05 21:26:27 +01:00
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(4), HPL(4), 2757, STR_NONE}, // Sun
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(4), HPL(4), 2758, STR_NONE}, // Thunder
|
2014-12-10 02:44:30 +01:00
|
|
|
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(5), HPL(5), 2752, STR_NONE}, // Clear grass
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(5), HPL(5), 2753, STR_NONE}, // Mowed grass
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(6), HPL(6), 2754, STR_NONE}, // Water plants
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(6), HPL(6), 2755, STR_NONE}, // Fix vandalism
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(7), HPL(7), 2756, STR_NONE}, // Remove litter
|
2015-02-21 03:04:33 +01:00
|
|
|
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(0), HPL(0), 2766, STR_NONE}, // Win scenario
|
2015-03-26 21:52:19 +01:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
static rct_widget window_cheats_rides_widgets[] = {
|
|
|
|
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0x0FFFFFFFF, 65535 }, // panel / background
|
|
|
|
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, 3165, STR_WINDOW_TITLE_TIP }, // title bar
|
|
|
|
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP }, // close x button
|
|
|
|
{ WWT_IMGBTN, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, 65535 }, // tab content panel
|
|
|
|
{ WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 2462 }, // tab 1
|
|
|
|
{ WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 2462 }, // tab 2
|
|
|
|
{ WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2462}, // tab 3
|
|
|
|
{ WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 2462}, // tab 4
|
2015-03-28 19:29:19 +01:00
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(0), HPL(0), 5123, STR_NONE}, // Renew rides
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(0), HPL(0), 5124, STR_NONE}, // Remove flags
|
|
|
|
{ WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(1), HPL(1), 5125, STR_NONE}, // Make destructable
|
2015-05-15 16:49:46 +02:00
|
|
|
{ WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(1), HPL(1), 5132, STR_NONE }, // Fix all rides
|
2014-05-01 23:55:26 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
|
|
|
static rct_widget *window_cheats_page_widgets[] = {
|
|
|
|
window_cheats_money_widgets,
|
2014-07-16 04:41:12 +02:00
|
|
|
window_cheats_guests_widgets,
|
|
|
|
window_cheats_misc_widgets,
|
2015-03-26 21:52:19 +01:00
|
|
|
window_cheats_rides_widgets,
|
2014-05-01 23:55:26 +02:00
|
|
|
};
|
|
|
|
|
2014-04-15 01:50:20 +02:00
|
|
|
static void window_cheats_emptysub() { }
|
2014-05-02 07:59:12 +02:00
|
|
|
static void window_cheats_money_mouseup();
|
|
|
|
static void window_cheats_guests_mouseup();
|
2014-07-16 04:41:12 +02:00
|
|
|
static void window_cheats_misc_mouseup();
|
2015-03-26 21:52:19 +01:00
|
|
|
static void window_cheats_rides_mouseup();
|
2015-02-21 03:04:33 +01:00
|
|
|
static void window_cheats_misc_tool_update();
|
|
|
|
static void window_cheats_misc_tool_down();
|
2014-05-19 19:47:14 +02:00
|
|
|
static void window_cheats_update(rct_window *w);
|
2014-04-15 01:50:20 +02:00
|
|
|
static void window_cheats_invalidate();
|
|
|
|
static void window_cheats_paint();
|
2014-05-01 23:55:26 +02:00
|
|
|
static void window_cheats_set_page(rct_window *w, int page);
|
|
|
|
|
2014-05-12 03:18:08 +02:00
|
|
|
static void* window_cheats_money_events[] = {
|
2014-05-01 23:55:26 +02:00
|
|
|
window_cheats_emptysub,
|
2014-05-02 07:59:12 +02:00
|
|
|
window_cheats_money_mouseup,
|
2014-05-01 23:55:26 +02:00
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_update,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_invalidate,
|
|
|
|
window_cheats_paint,
|
|
|
|
window_cheats_emptysub
|
|
|
|
};
|
2014-04-15 01:50:20 +02:00
|
|
|
|
2014-05-12 03:18:08 +02:00
|
|
|
static void* window_cheats_guests_events[] = {
|
2014-04-15 01:50:20 +02:00
|
|
|
window_cheats_emptysub,
|
2014-05-02 07:59:12 +02:00
|
|
|
window_cheats_guests_mouseup,
|
2014-04-15 01:50:20 +02:00
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_update,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_invalidate,
|
|
|
|
window_cheats_paint,
|
|
|
|
window_cheats_emptysub
|
|
|
|
};
|
|
|
|
|
2014-07-16 04:41:12 +02:00
|
|
|
static void* window_cheats_misc_events[] = {
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_misc_mouseup,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_update,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
2014-11-03 22:15:35 +01:00
|
|
|
window_cheats_misc_tool_update,
|
|
|
|
window_cheats_misc_tool_down,
|
2014-07-16 04:41:12 +02:00
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_invalidate,
|
|
|
|
window_cheats_paint,
|
|
|
|
window_cheats_emptysub
|
|
|
|
};
|
|
|
|
|
2015-03-26 21:52:19 +01:00
|
|
|
static void* window_cheats_rides_events[] = {
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_rides_mouseup,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_update,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_emptysub,
|
|
|
|
window_cheats_invalidate,
|
|
|
|
window_cheats_paint,
|
|
|
|
window_cheats_emptysub
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-05-12 03:18:08 +02:00
|
|
|
static void* window_cheats_page_events[] = {
|
2014-05-01 23:55:26 +02:00
|
|
|
window_cheats_money_events,
|
|
|
|
window_cheats_guests_events,
|
2014-07-16 04:41:12 +02:00
|
|
|
window_cheats_misc_events,
|
2015-03-26 21:52:19 +01:00
|
|
|
window_cheats_rides_events,
|
2014-05-01 23:55:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static uint32 window_cheats_page_enabled_widgets[] = {
|
2015-03-26 21:52:19 +01:00
|
|
|
(1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_HIGH_MONEY) | (1 << WIDX_PARK_ENTRANCE_FEE),
|
|
|
|
(1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_HAPPY_GUESTS) | (1 << WIDX_TRAM_GUESTS),
|
|
|
|
(1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_FREEZE_CLIMATE) | (1 << WIDX_OPEN_CLOSE_PARK) | (1 << WIDX_DECREASE_GAME_SPEED) | (1 << WIDX_INCREASE_GAME_SPEED) | (1 << WIDX_ZERO_CLEARANCE) | (1 << WIDX_WEATHER_SUN) | (1 << WIDX_WEATHER_THUNDER) | (1 << WIDX_CLEAR_GRASS) | (1 << WIDX_MOWED_GRASS) | (1 << WIDX_WATER_PLANTS) | (1 << WIDX_FIX_VANDALISM) | (1 << WIDX_REMOVE_LITTER) | (1 << WIDX_WIN_SCENARIO),
|
2015-05-15 16:49:46 +02:00
|
|
|
(1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_RENEW_RIDES) | (1 << WIDX_REMOVE_SIX_FLAGS) | (1 << WIDX_MAKE_DESTRUCTIBLE) | (1 << WIDX_FIX_ALL)
|
2014-05-01 23:55:26 +02:00
|
|
|
};
|
|
|
|
|
2014-04-15 01:50:20 +02:00
|
|
|
static void window_cheats_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w);
|
|
|
|
|
2014-12-10 02:44:30 +01:00
|
|
|
#pragma region Cheat functions
|
|
|
|
|
|
|
|
static void cheat_set_grass_length(int length)
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
rct_map_element *mapElement;
|
|
|
|
|
|
|
|
for (y = 0; y < 256; y++) {
|
|
|
|
for (x = 0; x < 256; x++) {
|
|
|
|
mapElement = map_get_surface_element_at(x, y);
|
|
|
|
if (!(mapElement->properties.surface.ownership & OWNERSHIP_OWNED))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (map_element_get_terrain(mapElement) != TERRAIN_GRASS)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((mapElement->properties.surface.terrain & 0x1F) > 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
mapElement->properties.surface.grass_length = length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx_invalidate_screen();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cheat_water_plants()
|
|
|
|
{
|
2015-01-22 01:19:05 +01:00
|
|
|
map_element_iterator it;
|
2014-12-10 02:44:30 +01:00
|
|
|
|
2015-01-22 01:19:05 +01:00
|
|
|
map_element_iterator_begin(&it);
|
|
|
|
do {
|
|
|
|
if (map_element_get_type(it.element) == MAP_ELEMENT_TYPE_SCENERY) {
|
|
|
|
it.element->properties.scenery.age = 0;
|
2014-12-10 02:44:30 +01:00
|
|
|
}
|
2015-01-22 01:19:05 +01:00
|
|
|
} while (map_element_iterator_next(&it));
|
2014-12-10 02:44:30 +01:00
|
|
|
|
|
|
|
gfx_invalidate_screen();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cheat_fix_vandalism()
|
|
|
|
{
|
2015-01-22 01:19:05 +01:00
|
|
|
map_element_iterator it;
|
2014-12-10 02:44:30 +01:00
|
|
|
|
2015-01-22 01:19:05 +01:00
|
|
|
map_element_iterator_begin(&it);
|
|
|
|
do {
|
|
|
|
if (map_element_get_type(it.element) != MAP_ELEMENT_TYPE_PATH)
|
|
|
|
continue;
|
2014-12-10 02:44:30 +01:00
|
|
|
|
2015-01-22 01:19:05 +01:00
|
|
|
if ((it.element->properties.path.additions & 0x0F) == 0)
|
|
|
|
continue;
|
2014-12-10 02:44:30 +01:00
|
|
|
|
2015-01-22 01:19:05 +01:00
|
|
|
it.element->flags &= ~MAP_ELEMENT_FLAG_BROKEN;
|
|
|
|
} while (map_element_iterator_next(&it));
|
2014-12-10 02:44:30 +01:00
|
|
|
|
|
|
|
gfx_invalidate_screen();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cheat_remove_litter()
|
|
|
|
{
|
|
|
|
rct_litter* litter;
|
|
|
|
uint16 spriteIndex, nextSpriteIndex;
|
|
|
|
|
|
|
|
for (spriteIndex = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_LITTER, uint16); spriteIndex != SPRITE_INDEX_NULL; spriteIndex = nextSpriteIndex) {
|
|
|
|
litter = &(g_sprite_list[spriteIndex].litter);
|
|
|
|
nextSpriteIndex = litter->next;
|
|
|
|
sprite_remove((rct_sprite*)litter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cheat_fix_rides()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
rct_ride *ride;
|
|
|
|
|
|
|
|
FOR_ALL_RIDES(i, ride) {
|
2015-05-15 16:49:46 +02:00
|
|
|
if (!ride->breakdown_reason){
|
2014-12-10 02:44:30 +01:00
|
|
|
ride->lifecycle_flags &= ~(RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN);
|
|
|
|
}
|
2015-05-15 16:49:46 +02:00
|
|
|
|
2014-12-10 02:44:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-18 16:21:45 +01:00
|
|
|
static void cheat_renew_rides()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
rct_ride *ride;
|
|
|
|
|
|
|
|
FOR_ALL_RIDES(i, ride)
|
2015-03-25 11:12:17 +01:00
|
|
|
{
|
|
|
|
// Set build date to current date (so the ride is brand new)
|
2015-03-18 16:21:45 +01:00
|
|
|
ride->build_date = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
|
2015-03-25 11:12:17 +01:00
|
|
|
// Set reliability to 100
|
|
|
|
ride->reliability = (100 << 8);
|
|
|
|
}
|
2015-03-18 16:21:45 +01:00
|
|
|
window_invalidate_by_class(WC_RIDE);
|
|
|
|
}
|
|
|
|
|
2015-03-26 21:52:19 +01:00
|
|
|
static void cheat_remove_six_flags()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
rct_ride *ride;
|
|
|
|
FOR_ALL_RIDES(i, ride)
|
|
|
|
{
|
|
|
|
if (ride->lifecycle_flags & RIDE_LIFECYCLE_SIX_FLAGS)
|
|
|
|
ride->lifecycle_flags&=~RIDE_LIFECYCLE_SIX_FLAGS;
|
|
|
|
}
|
|
|
|
window_invalidate_by_class(WC_RIDE);
|
|
|
|
}
|
|
|
|
|
2015-03-28 19:29:19 +01:00
|
|
|
static void cheat_make_destructible()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
rct_ride *ride;
|
|
|
|
FOR_ALL_RIDES(i, ride)
|
|
|
|
{
|
|
|
|
if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE)
|
|
|
|
ride->lifecycle_flags&=~RIDE_LIFECYCLE_INDESTRUCTIBLE;
|
|
|
|
}
|
|
|
|
window_invalidate_by_class(WC_RIDE);
|
|
|
|
}
|
|
|
|
|
2014-12-10 02:44:30 +01:00
|
|
|
static void cheat_clear_loan()
|
|
|
|
{
|
|
|
|
// TODO, this sets the loan but stops loan borrowing from working, possible due to cheat detection stuff
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = MONEY(0,00);
|
|
|
|
window_invalidate_by_class(WC_FINANCES);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cheat_increase_money(money32 amount)
|
|
|
|
{
|
|
|
|
money32 currentMoney;
|
|
|
|
|
|
|
|
currentMoney = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32));
|
|
|
|
if (currentMoney < INT_MAX - amount)
|
|
|
|
currentMoney += amount;
|
|
|
|
else
|
|
|
|
currentMoney = INT_MAX;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(currentMoney);
|
|
|
|
|
|
|
|
window_invalidate_by_class(WC_FINANCES);
|
|
|
|
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cheat_generate_guests(int count)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
generate_new_guest();
|
|
|
|
|
|
|
|
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cheat_make_guests_happy()
|
|
|
|
{
|
|
|
|
int spriteIndex;
|
|
|
|
rct_peep *peep;
|
|
|
|
|
|
|
|
FOR_ALL_GUESTS(spriteIndex, peep)
|
|
|
|
if (peep->var_2A == 0)
|
|
|
|
peep->happiness = 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
2014-04-15 01:50:20 +02:00
|
|
|
void window_cheats_open()
|
|
|
|
{
|
|
|
|
rct_window* window;
|
|
|
|
|
|
|
|
// Check if window is already open
|
2014-10-16 03:02:43 +02:00
|
|
|
window = window_bring_to_front_by_class(WC_CHEATS);
|
2014-04-15 01:50:20 +02:00
|
|
|
if (window != NULL)
|
|
|
|
return;
|
|
|
|
|
2014-05-12 03:18:08 +02:00
|
|
|
window = window_create(32, 32, WW, WH, (uint32*)window_cheats_money_events, WC_CHEATS, 0);
|
2014-05-01 23:55:26 +02:00
|
|
|
window->widgets = window_cheats_money_widgets;
|
|
|
|
window->enabled_widgets = window_cheats_page_enabled_widgets[0];
|
2014-04-15 01:50:20 +02:00
|
|
|
window_init_scroll_widgets(window);
|
2014-04-16 03:05:49 +02:00
|
|
|
window->page = WINDOW_CHEATS_PAGE_MONEY;
|
2014-04-15 01:50:20 +02:00
|
|
|
window->colours[0] = 1;
|
|
|
|
window->colours[1] = 19;
|
|
|
|
window->colours[2] = 19;
|
|
|
|
}
|
|
|
|
|
2014-05-02 07:59:12 +02:00
|
|
|
static void window_cheats_money_mouseup()
|
2014-04-15 01:50:20 +02:00
|
|
|
{
|
|
|
|
short widgetIndex;
|
|
|
|
rct_window *w;
|
|
|
|
|
2014-08-19 19:47:12 +02:00
|
|
|
window_widget_get_registers(w, widgetIndex);
|
2014-04-15 01:50:20 +02:00
|
|
|
|
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
window_close(w);
|
|
|
|
break;
|
2014-05-01 23:55:26 +02:00
|
|
|
case WIDX_TAB_1:
|
|
|
|
case WIDX_TAB_2:
|
2014-07-16 04:41:12 +02:00
|
|
|
case WIDX_TAB_3:
|
2015-03-26 21:52:19 +01:00
|
|
|
case WIDX_TAB_4:
|
2014-05-01 23:55:26 +02:00
|
|
|
window_cheats_set_page(w, widgetIndex - WIDX_TAB_1);
|
|
|
|
break;
|
2014-04-15 01:50:20 +02:00
|
|
|
case WIDX_HIGH_MONEY:
|
2014-12-10 02:44:30 +01:00
|
|
|
cheat_increase_money(CHEATS_MONEY_INCREMENT);
|
2014-05-01 23:55:26 +02:00
|
|
|
break;
|
2014-06-28 15:44:48 +02:00
|
|
|
case WIDX_PARK_ENTRANCE_FEE:
|
2014-12-10 02:44:30 +01:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_PARK_FREE_ENTRY;
|
2014-10-16 03:02:43 +02:00
|
|
|
window_invalidate_by_class(WC_PARK_INFORMATION);
|
2014-06-28 15:44:48 +02:00
|
|
|
break;
|
2014-05-02 07:59:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void window_cheats_guests_mouseup()
|
|
|
|
{
|
|
|
|
short widgetIndex;
|
|
|
|
rct_window *w;
|
2014-12-10 02:44:30 +01:00
|
|
|
|
2014-08-19 19:47:12 +02:00
|
|
|
window_widget_get_registers(w, widgetIndex);
|
2014-05-19 22:53:14 +02:00
|
|
|
|
2014-05-02 07:59:12 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
window_close(w);
|
|
|
|
break;
|
|
|
|
case WIDX_TAB_1:
|
|
|
|
case WIDX_TAB_2:
|
2014-07-16 04:41:12 +02:00
|
|
|
case WIDX_TAB_3:
|
2015-03-26 21:52:19 +01:00
|
|
|
case WIDX_TAB_4:
|
2014-05-02 07:59:12 +02:00
|
|
|
window_cheats_set_page(w, widgetIndex - WIDX_TAB_1);
|
|
|
|
break;
|
2014-05-01 23:55:26 +02:00
|
|
|
case WIDX_HAPPY_GUESTS:
|
2014-12-10 02:44:30 +01:00
|
|
|
cheat_make_guests_happy();
|
2014-04-15 01:50:20 +02:00
|
|
|
break;
|
2014-07-16 04:41:12 +02:00
|
|
|
case WIDX_TRAM_GUESTS:
|
2014-12-10 02:44:30 +01:00
|
|
|
cheat_generate_guests(CHEATS_TRAM_INCREMENT);
|
2014-07-16 04:41:12 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void window_cheats_misc_mouseup()
|
|
|
|
{
|
|
|
|
short widgetIndex;
|
|
|
|
rct_window *w;
|
2014-08-19 19:47:12 +02:00
|
|
|
|
|
|
|
window_widget_get_registers(w, widgetIndex);
|
2014-07-16 04:41:12 +02:00
|
|
|
|
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
window_close(w);
|
|
|
|
break;
|
|
|
|
case WIDX_TAB_1:
|
|
|
|
case WIDX_TAB_2:
|
|
|
|
case WIDX_TAB_3:
|
2015-03-26 21:52:19 +01:00
|
|
|
case WIDX_TAB_4:
|
2014-07-16 04:41:12 +02:00
|
|
|
window_cheats_set_page(w, widgetIndex - WIDX_TAB_1);
|
|
|
|
break;
|
|
|
|
case WIDX_FREEZE_CLIMATE:
|
2014-07-21 14:05:43 +02:00
|
|
|
toggle_climate_lock();
|
2014-08-14 08:47:23 +02:00
|
|
|
w->widgets[widgetIndex].image = w->widgets[widgetIndex].image == 2767 ? 2768 : 2767;
|
2014-07-16 04:41:12 +02:00
|
|
|
break;
|
|
|
|
case WIDX_OPEN_CLOSE_PARK:
|
2015-01-25 01:20:53 +01:00
|
|
|
park_set_open(park_is_open() ? 0 : 1);
|
2014-07-16 04:41:12 +02:00
|
|
|
break;
|
|
|
|
case WIDX_DECREASE_GAME_SPEED:
|
2014-07-21 14:05:43 +02:00
|
|
|
game_reduce_game_speed();
|
2014-07-16 04:41:12 +02:00
|
|
|
break;
|
|
|
|
case WIDX_INCREASE_GAME_SPEED:
|
2014-07-21 14:05:43 +02:00
|
|
|
game_increase_game_speed();
|
2014-07-16 04:41:12 +02:00
|
|
|
break;
|
2014-11-03 22:15:35 +01:00
|
|
|
case WIDX_ZERO_CLEARANCE:
|
|
|
|
if (tool_set(w, widgetIndex, 7)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
2014-11-05 21:26:27 +01:00
|
|
|
case WIDX_WEATHER_SUN:
|
|
|
|
climate_force_weather(WEATHER_SUNNY);
|
|
|
|
break;
|
|
|
|
case WIDX_WEATHER_THUNDER:
|
|
|
|
climate_force_weather(WEATHER_THUNDER);
|
|
|
|
break;
|
2014-12-10 02:44:30 +01:00
|
|
|
case WIDX_CLEAR_GRASS:
|
|
|
|
cheat_set_grass_length(GRASS_LENGTH_CLEAR_0);
|
|
|
|
break;
|
|
|
|
case WIDX_MOWED_GRASS:
|
|
|
|
cheat_set_grass_length(GRASS_LENGTH_MOWED);
|
|
|
|
break;
|
|
|
|
case WIDX_WATER_PLANTS:
|
|
|
|
cheat_water_plants();
|
|
|
|
break;
|
|
|
|
case WIDX_FIX_VANDALISM:
|
|
|
|
cheat_fix_vandalism();
|
|
|
|
break;
|
|
|
|
case WIDX_REMOVE_LITTER:
|
|
|
|
cheat_remove_litter();
|
|
|
|
break;
|
2015-02-21 03:04:33 +01:00
|
|
|
case WIDX_WIN_SCENARIO:
|
|
|
|
scenario_success();
|
|
|
|
break;
|
2015-03-26 21:52:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void window_cheats_rides_mouseup()
|
|
|
|
{
|
|
|
|
short widgetIndex;
|
|
|
|
rct_window *w;
|
|
|
|
|
|
|
|
window_widget_get_registers(w, widgetIndex);
|
|
|
|
|
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
window_close(w);
|
|
|
|
break;
|
|
|
|
case WIDX_TAB_1:
|
|
|
|
case WIDX_TAB_2:
|
|
|
|
case WIDX_TAB_3:
|
|
|
|
case WIDX_TAB_4:
|
|
|
|
window_cheats_set_page(w, widgetIndex - WIDX_TAB_1);
|
|
|
|
break;
|
2015-03-18 16:21:45 +01:00
|
|
|
case WIDX_RENEW_RIDES:
|
|
|
|
cheat_renew_rides();
|
|
|
|
break;
|
2015-03-26 21:52:19 +01:00
|
|
|
case WIDX_REMOVE_SIX_FLAGS:
|
|
|
|
cheat_remove_six_flags();
|
|
|
|
break;
|
2015-03-28 19:29:19 +01:00
|
|
|
case WIDX_MAKE_DESTRUCTIBLE:
|
|
|
|
cheat_make_destructible();
|
|
|
|
break;
|
2015-05-15 16:49:46 +02:00
|
|
|
case WIDX_FIX_ALL:
|
|
|
|
cheat_fix_rides();
|
|
|
|
break;
|
2014-04-15 01:50:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-18 21:32:50 +02:00
|
|
|
static void window_cheats_update(rct_window *w)
|
2014-04-15 01:50:20 +02:00
|
|
|
{
|
2014-07-23 19:07:38 +02:00
|
|
|
w->frame_no++;
|
2014-10-16 03:02:43 +02:00
|
|
|
widget_invalidate(w, WIDX_TAB_1 + w->page);
|
2014-04-15 01:50:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void window_cheats_invalidate()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
rct_window *w;
|
|
|
|
|
2014-08-19 19:47:12 +02:00
|
|
|
window_get_register(w);
|
2014-05-19 22:53:14 +02:00
|
|
|
|
2014-04-15 01:50:20 +02:00
|
|
|
strcpy((char*)0x009BC677, "Cheats");
|
|
|
|
|
2014-05-12 03:18:08 +02:00
|
|
|
rct_widget *widgets = window_cheats_page_widgets[w->page];
|
2014-05-01 23:55:26 +02:00
|
|
|
if (w->widgets != widgets) {
|
|
|
|
w->widgets = widgets;
|
|
|
|
window_init_scroll_widgets(w);
|
|
|
|
}
|
|
|
|
|
2014-12-10 02:44:30 +01:00
|
|
|
switch (w->page) {
|
|
|
|
case WINDOW_CHEATS_PAGE_MONEY:
|
|
|
|
w->widgets[WIDX_PARK_ENTRANCE_FEE].image = RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_FREE_ENTRY ?
|
|
|
|
2761 : 2762;
|
|
|
|
break;
|
|
|
|
case WINDOW_CHEATS_PAGE_MISC:
|
|
|
|
w->widgets[WIDX_OPEN_CLOSE_PARK].image = RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_OPEN ?
|
|
|
|
2770 : 2769;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-04-15 01:50:20 +02:00
|
|
|
// Set correct active tab
|
|
|
|
for (i = 0; i < 7; i++)
|
|
|
|
w->pressed_widgets &= ~(1 << (WIDX_TAB_1 + i));
|
2014-05-12 03:18:08 +02:00
|
|
|
w->pressed_widgets |= 1LL << (WIDX_TAB_1 + w->page);
|
2014-04-15 01:50:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void window_cheats_paint()
|
|
|
|
{
|
|
|
|
rct_window *w;
|
|
|
|
rct_drawpixelinfo *dpi;
|
|
|
|
|
2014-08-19 19:47:12 +02:00
|
|
|
window_paint_get_registers(w, dpi);
|
2014-04-15 01:50:20 +02:00
|
|
|
|
|
|
|
window_draw_widgets(w, dpi);
|
|
|
|
window_cheats_draw_tab_images(dpi, w);
|
2014-06-14 11:19:42 +02:00
|
|
|
|
|
|
|
if (w->page == WINDOW_CHEATS_PAGE_MONEY){
|
2015-03-07 17:38:17 +01:00
|
|
|
gfx_draw_string(dpi, (char*)language_get_string(2681), 0, w->x + XPL(0) + TXTO, w->y + YPL(0) + TXTO);
|
|
|
|
gfx_draw_string(dpi, (char*)language_get_string(2682), 0, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO);
|
2014-06-14 11:19:42 +02:00
|
|
|
}
|
|
|
|
else if (w->page == WINDOW_CHEATS_PAGE_GUESTS){
|
2015-03-07 17:38:17 +01:00
|
|
|
gfx_draw_string(dpi, (char*)language_get_string(2683), 0, w->x + XPL(0) + TXTO, w->y + YPL(0) + TXTO);
|
|
|
|
gfx_draw_string(dpi, (char*)language_get_string(2684), 0, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO);
|
2014-06-14 11:19:42 +02:00
|
|
|
}
|
|
|
|
|
2014-04-15 01:50:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void window_cheats_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w)
|
|
|
|
{
|
|
|
|
int sprite_idx;
|
|
|
|
|
|
|
|
// Money tab
|
|
|
|
if (!(w->disabled_widgets & (1 << WIDX_TAB_1))) {
|
|
|
|
sprite_idx = 5261;
|
2014-04-16 03:05:49 +02:00
|
|
|
if (w->page == WINDOW_CHEATS_PAGE_MONEY)
|
2014-07-23 19:07:38 +02:00
|
|
|
sprite_idx += (w->frame_no / 2) % 8;
|
2014-08-08 20:16:57 +02:00
|
|
|
gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_1].left, w->y + w->widgets[WIDX_TAB_1].top, 0);
|
2014-04-15 01:50:20 +02:00
|
|
|
}
|
2014-07-16 04:41:12 +02:00
|
|
|
|
2014-04-15 01:50:20 +02:00
|
|
|
// Guests tab
|
|
|
|
if (!(w->disabled_widgets & (1 << WIDX_TAB_2))) {
|
|
|
|
sprite_idx = 5568;
|
2014-04-16 03:05:49 +02:00
|
|
|
if (w->page == WINDOW_CHEATS_PAGE_GUESTS)
|
2014-07-23 19:07:38 +02:00
|
|
|
sprite_idx += (w->frame_no / 3) % 8;
|
2014-08-08 20:16:57 +02:00
|
|
|
gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_2].left, w->y + w->widgets[WIDX_TAB_2].top, 0);
|
2014-04-15 01:50:20 +02:00
|
|
|
}
|
2014-07-16 04:41:12 +02:00
|
|
|
|
|
|
|
// Misc tab
|
|
|
|
if (!(w->disabled_widgets & (1 << WIDX_TAB_3))) {
|
2015-03-28 18:20:19 +01:00
|
|
|
sprite_idx = STR_TAB_PARK;
|
2014-08-08 20:16:57 +02:00
|
|
|
gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_3].left, w->y + w->widgets[WIDX_TAB_3].top, 0);
|
2014-07-16 04:41:12 +02:00
|
|
|
}
|
2015-03-26 21:52:19 +01:00
|
|
|
|
|
|
|
// Rides tab
|
|
|
|
if (!(w->disabled_widgets & (1 << WIDX_TAB_4))) {
|
2015-03-28 18:20:19 +01:00
|
|
|
sprite_idx = SPR_TAB_RIDE_0;
|
|
|
|
if (w->page == WINDOW_CHEATS_PAGE_RIDES)
|
|
|
|
sprite_idx += (w->frame_no / 4) % 16;
|
2015-03-26 21:52:19 +01:00
|
|
|
gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_4].left, w->y + w->widgets[WIDX_TAB_4].top, 0);
|
|
|
|
}
|
2014-04-21 11:27:48 +02:00
|
|
|
}
|
2014-05-01 23:55:26 +02:00
|
|
|
|
|
|
|
static void window_cheats_set_page(rct_window *w, int page)
|
|
|
|
{
|
|
|
|
w->page = page;
|
2015-03-28 18:20:19 +01:00
|
|
|
w->frame_no = 0;
|
2014-05-01 23:55:26 +02:00
|
|
|
|
|
|
|
w->enabled_widgets = window_cheats_page_enabled_widgets[page];
|
|
|
|
|
|
|
|
w->event_handlers = window_cheats_page_events[page];
|
|
|
|
w->widgets = window_cheats_page_widgets[page];
|
|
|
|
|
|
|
|
window_invalidate(w);
|
2014-05-02 23:22:38 +02:00
|
|
|
}
|
2014-11-03 22:15:35 +01:00
|
|
|
|
2015-02-21 03:04:33 +01:00
|
|
|
static void window_cheats_misc_tool_update()
|
|
|
|
{
|
2014-11-03 22:15:35 +01:00
|
|
|
short widgetIndex;
|
|
|
|
rct_window* w;
|
|
|
|
short x, y;
|
|
|
|
|
|
|
|
window_tool_get_registers(w, widgetIndex, x, y);
|
|
|
|
|
|
|
|
if (widgetIndex != WIDX_ZERO_CLEARANCE) return;
|
|
|
|
|
2014-12-17 21:45:27 +01:00
|
|
|
map_invalidate_selection_rect();
|
2014-11-03 22:15:35 +01:00
|
|
|
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~(1 << 0);
|
|
|
|
|
2015-04-01 01:46:20 +02:00
|
|
|
int map_x, map_y;
|
|
|
|
footpath_get_coordinates_from_pos(x, y + 16, &map_x, &map_y, NULL, NULL);
|
|
|
|
if (map_x != 0x8000){
|
2014-11-03 22:15:35 +01:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= 1;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4;
|
2015-04-01 01:46:20 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, uint16) = map_x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, uint16) = map_x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, uint16) = map_y;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, uint16) = map_y;
|
2014-12-17 21:45:27 +01:00
|
|
|
map_invalidate_selection_rect();
|
2014-11-03 22:15:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, sint32) = -1;
|
|
|
|
}
|
|
|
|
|
2015-02-21 03:04:33 +01:00
|
|
|
static void window_cheats_misc_tool_down()
|
|
|
|
{
|
2014-11-03 22:15:35 +01:00
|
|
|
short widgetIndex;
|
|
|
|
rct_window* w;
|
|
|
|
short x, y;
|
|
|
|
|
|
|
|
window_tool_get_registers(w, widgetIndex, x, y);
|
|
|
|
|
|
|
|
if (widgetIndex != WIDX_ZERO_CLEARANCE) return;
|
|
|
|
|
2015-04-01 01:46:20 +02:00
|
|
|
int dest_x, dest_y;
|
|
|
|
footpath_get_coordinates_from_pos(x, y + 16, &dest_x, &dest_y, NULL, NULL);
|
2014-11-03 22:15:35 +01:00
|
|
|
|
|
|
|
if (dest_x == 0x8000)return;
|
|
|
|
|
|
|
|
// Set the coordinate of destination to be exactly
|
|
|
|
// in the middle of a tile.
|
|
|
|
dest_x += 16;
|
|
|
|
dest_y += 16;
|
|
|
|
|
2015-01-22 01:19:05 +01:00
|
|
|
// Set the tile coordinate to top left of tile
|
|
|
|
int tile_x = (dest_x & 0xFFE0) >> 5;
|
|
|
|
int tile_y = (dest_y & 0xFFE0) >> 5;
|
2014-11-03 22:15:35 +01:00
|
|
|
|
2015-01-22 01:19:05 +01:00
|
|
|
rct_map_element *mapElement = map_get_first_element_at(tile_x, tile_y);
|
|
|
|
do {
|
|
|
|
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_SURFACE) {
|
|
|
|
mapElement->clearance_height = 0;
|
2014-11-03 22:15:35 +01:00
|
|
|
}
|
2015-01-22 01:19:05 +01:00
|
|
|
} while (!map_element_is_last_for_tile(mapElement++));
|
2015-03-18 16:21:45 +01:00
|
|
|
}
|