2014-08-25 16:04:28 +02:00
|
|
|
|
/*****************************************************************************
|
2020-05-12 20:11:29 +02:00
|
|
|
|
* Copyright (c) 2014-2020 OpenRCT2 developers
|
2014-08-25 16:04:28 +02:00
|
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2014-08-25 16:04:28 +02:00
|
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2014-08-25 16:04:28 +02:00
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
#include "../interface/Theme.h"
|
|
|
|
|
|
2018-08-12 13:50:40 +02:00
|
|
|
|
#include <algorithm>
|
2018-03-14 15:25:34 +01:00
|
|
|
|
#include <cmath>
|
2018-11-21 23:16:04 +01:00
|
|
|
|
#include <iterator>
|
2017-11-26 21:24:57 +01:00
|
|
|
|
#include <limits>
|
2018-06-22 23:21:44 +02:00
|
|
|
|
#include <openrct2-ui/interface/Dropdown.h>
|
|
|
|
|
#include <openrct2-ui/interface/Viewport.h>
|
|
|
|
|
#include <openrct2-ui/interface/Widget.h>
|
2017-10-21 16:03:33 +02:00
|
|
|
|
#include <openrct2-ui/windows/Window.h>
|
2017-12-13 13:02:24 +01:00
|
|
|
|
#include <openrct2/Cheats.h>
|
2017-10-21 16:03:33 +02:00
|
|
|
|
#include <openrct2/Context.h>
|
2017-11-30 18:17:06 +01:00
|
|
|
|
#include <openrct2/Game.h>
|
2017-12-12 14:52:57 +01:00
|
|
|
|
#include <openrct2/Input.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
|
#include <openrct2/OpenRCT2.h>
|
2018-12-11 22:17:52 +01:00
|
|
|
|
#include <openrct2/actions/GameAction.h>
|
Split actions hpp files into separate h and cpp files (#13548)
* Split up SmallSceneryPlace/Remove
Added undo function for Remove Scenery
* Refactor: Balloon and Banner actions hpp=>h/cpp
* Refactor: rename all action *.hpp files to *.cpp
This is preparation for separation in later commits. Note that without
the complete set of commits in this branch, the code will not build.
* Refactor Clear, Climate, Custom, and Footpath actions hpp=>h/cpp
* VSCode: add src subdirectories to includePath
* Refactor Guest actions hpp=>h/cpp
* Refactor Land actions hpp=>h/cpp
* Refactor LargeScenery actions hpp=>h/cpp
* Refactor Load, Maze, Network actions hpp=>h/cpp
* Refactor Park actions hpp=>h/cpp
* Refactor/style: move private function declarations in actions *.h
Previous action .h files included private function declarations with
private member variables, before public function declarations. This
commit re-orders the header files to the following order:
- public member variables
- private member variables
- public functions
- private functions
* Refactor Pause action hpp=>h/cpp
* Refactor Peep, Place, Player actions hpp=>h/cpp
* Refactor Ride actions hpp=>h/cpp
* Refactor Scenario, Set*, Sign* actions hpp=>h/cpp
* Refactor SmallScenerySetColourAction hpp=>h/cpp
* Refactor Staff actions hpp=>h/cpp
* Refactor Surface, Tile, Track* actions hpp=>h/cpp
* Refactor Wall and Water actions hpp=>h/cpp
* Fix various includes and other compile errors
Update includes for tests.
Move static function declarations to .h files
Add explicit includes to various files that were previously implicit
(the required header was a nested include in an action hpp file, and the
action .h file does not include that header)
Move RideSetStatus string enum to the cpp file to avoid unused imports
* Xcode: modify project file for actions refactor
* Cleanup whitespace and end-of-file newlines
Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2020-12-10 07:39:10 +01:00
|
|
|
|
#include <openrct2/actions/ParkSetParameterAction.h>
|
|
|
|
|
#include <openrct2/actions/RideSetAppearanceAction.h>
|
|
|
|
|
#include <openrct2/actions/RideSetColourSchemeAction.h>
|
|
|
|
|
#include <openrct2/actions/RideSetPriceAction.h>
|
|
|
|
|
#include <openrct2/actions/RideSetSettingAction.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
|
#include <openrct2/audio/audio.h>
|
|
|
|
|
#include <openrct2/config/Config.h>
|
2019-05-11 13:06:29 +02:00
|
|
|
|
#include <openrct2/core/String.hpp>
|
2021-11-24 16:19:52 +01:00
|
|
|
|
#include <openrct2/entity/EntityList.h>
|
2021-11-25 22:47:24 +01:00
|
|
|
|
#include <openrct2/entity/Staff.h>
|
2018-01-06 18:32:25 +01:00
|
|
|
|
#include <openrct2/localisation/Date.h>
|
2021-12-12 00:06:06 +01:00
|
|
|
|
#include <openrct2/localisation/Formatter.h>
|
2018-01-06 18:32:25 +01:00
|
|
|
|
#include <openrct2/localisation/Localisation.h>
|
2018-05-29 19:09:29 +02:00
|
|
|
|
#include <openrct2/localisation/LocalisationService.h>
|
2018-01-06 18:32:25 +01:00
|
|
|
|
#include <openrct2/localisation/StringIds.h>
|
2017-10-21 16:03:33 +02:00
|
|
|
|
#include <openrct2/network/network.h>
|
2021-01-09 21:54:02 +01:00
|
|
|
|
#include <openrct2/object/MusicObject.h>
|
2017-10-21 16:03:33 +02:00
|
|
|
|
#include <openrct2/object/ObjectManager.h>
|
|
|
|
|
#include <openrct2/object/ObjectRepository.h>
|
2018-12-05 21:33:45 +01:00
|
|
|
|
#include <openrct2/object/StationObject.h>
|
2018-01-09 10:40:42 +01:00
|
|
|
|
#include <openrct2/rct1/RCT1.h>
|
2019-04-16 20:36:00 +02:00
|
|
|
|
#include <openrct2/rct2/T6Exporter.h>
|
2021-12-18 19:50:29 +01:00
|
|
|
|
#include <openrct2/ride/RideConstruction.h>
|
2018-01-10 00:00:09 +01:00
|
|
|
|
#include <openrct2/ride/RideData.h>
|
2018-05-14 19:21:43 +02:00
|
|
|
|
#include <openrct2/ride/ShopItem.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
|
#include <openrct2/ride/Station.h>
|
2017-10-21 16:03:33 +02:00
|
|
|
|
#include <openrct2/ride/Track.h>
|
|
|
|
|
#include <openrct2/ride/TrackData.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
|
#include <openrct2/ride/TrackDesign.h>
|
2019-06-30 12:23:06 +02:00
|
|
|
|
#include <openrct2/ride/TrackDesignRepository.h>
|
2021-05-29 07:01:32 +02:00
|
|
|
|
#include <openrct2/ride/Vehicle.h>
|
2017-10-21 16:03:33 +02:00
|
|
|
|
#include <openrct2/sprites.h>
|
|
|
|
|
#include <openrct2/windows/Intent.h>
|
2018-03-19 23:28:40 +01:00
|
|
|
|
#include <openrct2/world/Park.h>
|
2021-08-12 18:20:15 +02:00
|
|
|
|
#include <optional>
|
2021-01-09 21:54:02 +01:00
|
|
|
|
#include <vector>
|
|
|
|
|
|
2018-12-05 21:33:45 +01:00
|
|
|
|
using namespace OpenRCT2;
|
2021-08-22 17:18:38 +02:00
|
|
|
|
using namespace OpenRCT2::TrackMetaData;
|
2018-12-05 21:33:45 +01:00
|
|
|
|
|
2020-05-05 22:26:14 +02:00
|
|
|
|
static constexpr const rct_string_id WINDOW_TITLE = STR_RIDE_WINDOW_TITLE;
|
|
|
|
|
static constexpr const int32_t WH = 207;
|
|
|
|
|
static constexpr const int32_t WW = 316;
|
2019-10-19 04:02:31 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void PopulateVehicleTypeDropdown(Ride* ride, bool forceRefresh = false);
|
2021-10-27 11:30:55 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
enum
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
WINDOW_RIDE_PAGE_MAIN,
|
|
|
|
|
WINDOW_RIDE_PAGE_VEHICLE,
|
|
|
|
|
WINDOW_RIDE_PAGE_OPERATING,
|
|
|
|
|
WINDOW_RIDE_PAGE_MAINTENANCE,
|
|
|
|
|
WINDOW_RIDE_PAGE_COLOUR,
|
|
|
|
|
WINDOW_RIDE_PAGE_MUSIC,
|
|
|
|
|
WINDOW_RIDE_PAGE_MEASUREMENTS,
|
|
|
|
|
WINDOW_RIDE_PAGE_GRAPHS,
|
|
|
|
|
WINDOW_RIDE_PAGE_INCOME,
|
|
|
|
|
WINDOW_RIDE_PAGE_CUSTOMER,
|
|
|
|
|
WINDOW_RIDE_PAGE_COUNT
|
2014-08-25 19:28:56 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-08-25 16:04:28 +02:00
|
|
|
|
#pragma region Widgets
|
|
|
|
|
|
2018-05-16 20:41:29 +02:00
|
|
|
|
// clang-format off
|
2014-08-25 19:28:56 +02:00
|
|
|
|
enum {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
WIDX_BACKGROUND,
|
|
|
|
|
WIDX_TITLE,
|
|
|
|
|
WIDX_CLOSE,
|
|
|
|
|
WIDX_PAGE_BACKGROUND,
|
|
|
|
|
WIDX_TAB_1,
|
|
|
|
|
WIDX_TAB_2,
|
|
|
|
|
WIDX_TAB_3,
|
|
|
|
|
WIDX_TAB_4,
|
|
|
|
|
WIDX_TAB_5,
|
|
|
|
|
WIDX_TAB_6,
|
|
|
|
|
WIDX_TAB_7,
|
|
|
|
|
WIDX_TAB_8,
|
|
|
|
|
WIDX_TAB_9,
|
|
|
|
|
WIDX_TAB_10,
|
|
|
|
|
|
|
|
|
|
WIDX_VIEWPORT = 14,
|
|
|
|
|
WIDX_VIEW,
|
|
|
|
|
WIDX_VIEW_DROPDOWN,
|
|
|
|
|
WIDX_STATUS,
|
|
|
|
|
WIDX_OPEN,
|
|
|
|
|
WIDX_CONSTRUCTION,
|
|
|
|
|
WIDX_RENAME,
|
|
|
|
|
WIDX_LOCATE,
|
|
|
|
|
WIDX_DEMOLISH,
|
|
|
|
|
WIDX_CLOSE_LIGHT,
|
2019-05-07 21:14:21 +02:00
|
|
|
|
WIDX_SIMULATE_LIGHT,
|
2017-06-06 23:24:18 +02:00
|
|
|
|
WIDX_TEST_LIGHT,
|
|
|
|
|
WIDX_OPEN_LIGHT,
|
|
|
|
|
WIDX_RIDE_TYPE,
|
2018-05-29 11:04:17 +02:00
|
|
|
|
WIDX_RIDE_TYPE_DROPDOWN,
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
WIDX_VEHICLE_TYPE = 14,
|
|
|
|
|
WIDX_VEHICLE_TYPE_DROPDOWN,
|
|
|
|
|
WIDX_VEHICLE_TRAINS_PREVIEW,
|
|
|
|
|
WIDX_VEHICLE_TRAINS,
|
|
|
|
|
WIDX_VEHICLE_TRAINS_INCREASE,
|
|
|
|
|
WIDX_VEHICLE_TRAINS_DECREASE,
|
|
|
|
|
WIDX_VEHICLE_CARS_PER_TRAIN,
|
|
|
|
|
WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE,
|
|
|
|
|
WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE,
|
|
|
|
|
|
|
|
|
|
WIDX_MODE_TWEAK = 14,
|
|
|
|
|
WIDX_MODE_TWEAK_INCREASE,
|
|
|
|
|
WIDX_MODE_TWEAK_DECREASE,
|
|
|
|
|
WIDX_LIFT_HILL_SPEED,
|
|
|
|
|
WIDX_LIFT_HILL_SPEED_INCREASE,
|
|
|
|
|
WIDX_LIFT_HILL_SPEED_DECREASE,
|
|
|
|
|
WIDX_LOAD_CHECKBOX,
|
|
|
|
|
WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX,
|
|
|
|
|
WIDX_MINIMUM_LENGTH_CHECKBOX,
|
|
|
|
|
WIDX_MINIMUM_LENGTH,
|
|
|
|
|
WIDX_MINIMUM_LENGTH_INCREASE,
|
|
|
|
|
WIDX_MINIMUM_LENGTH_DECREASE,
|
|
|
|
|
WIDX_MAXIMUM_LENGTH_CHECKBOX,
|
|
|
|
|
WIDX_MAXIMUM_LENGTH,
|
|
|
|
|
WIDX_MAXIMUM_LENGTH_INCREASE,
|
|
|
|
|
WIDX_MAXIMUM_LENGTH_DECREASE,
|
|
|
|
|
WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX,
|
|
|
|
|
WIDX_MODE_TWEAK_LABEL,
|
|
|
|
|
WIDX_LIFT_HILL_SPEED_LABEL,
|
|
|
|
|
WIDX_MODE,
|
|
|
|
|
WIDX_MODE_DROPDOWN,
|
|
|
|
|
WIDX_LOAD,
|
|
|
|
|
WIDX_LOAD_DROPDOWN,
|
|
|
|
|
WIDX_OPERATE_NUMBER_OF_CIRCUITS_LABEL,
|
|
|
|
|
WIDX_OPERATE_NUMBER_OF_CIRCUITS,
|
|
|
|
|
WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE,
|
|
|
|
|
WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE,
|
|
|
|
|
|
|
|
|
|
WIDX_INSPECTION_INTERVAL = 14,
|
|
|
|
|
WIDX_INSPECTION_INTERVAL_DROPDOWN,
|
|
|
|
|
WIDX_LOCATE_MECHANIC,
|
2018-03-29 11:17:54 +02:00
|
|
|
|
WIDX_REFURBISH_RIDE,
|
2017-06-06 23:24:18 +02:00
|
|
|
|
WIDX_FORCE_BREAKDOWN,
|
|
|
|
|
|
|
|
|
|
WIDX_TRACK_PREVIEW = 14,
|
|
|
|
|
WIDX_TRACK_COLOUR_SCHEME,
|
|
|
|
|
WIDX_TRACK_COLOUR_SCHEME_DROPDOWN,
|
|
|
|
|
WIDX_TRACK_MAIN_COLOUR,
|
|
|
|
|
WIDX_TRACK_ADDITIONAL_COLOUR,
|
|
|
|
|
WIDX_TRACK_SUPPORT_COLOUR,
|
|
|
|
|
WIDX_MAZE_STYLE,
|
|
|
|
|
WIDX_MAZE_STYLE_DROPDOWN,
|
|
|
|
|
WIDX_PAINT_INDIVIDUAL_AREA,
|
|
|
|
|
WIDX_ENTRANCE_PREVIEW,
|
|
|
|
|
WIDX_ENTRANCE_STYLE,
|
|
|
|
|
WIDX_ENTRANCE_STYLE_DROPDOWN,
|
|
|
|
|
WIDX_VEHICLE_PREVIEW,
|
|
|
|
|
WIDX_VEHICLE_COLOUR_SCHEME,
|
|
|
|
|
WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN,
|
|
|
|
|
WIDX_VEHICLE_COLOUR_INDEX,
|
|
|
|
|
WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN,
|
2021-11-29 23:04:31 +01:00
|
|
|
|
WIDX_VEHICLE_BODY_COLOR,
|
|
|
|
|
WIDX_VEHICLE_TRIM_COLOUR,
|
|
|
|
|
WIDX_VEHICLE_TERNARY_COLOUR,
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
WIDX_PLAY_MUSIC = 14,
|
|
|
|
|
WIDX_MUSIC,
|
|
|
|
|
WIDX_MUSIC_DROPDOWN,
|
|
|
|
|
|
|
|
|
|
WIDX_SAVE_TRACK_DESIGN = 14,
|
|
|
|
|
WIDX_SELECT_NEARBY_SCENERY,
|
|
|
|
|
WIDX_RESET_SELECTION,
|
|
|
|
|
WIDX_SAVE_DESIGN,
|
|
|
|
|
WIDX_CANCEL_DESIGN,
|
|
|
|
|
|
|
|
|
|
WIDX_GRAPH = 14,
|
|
|
|
|
WIDX_GRAPH_VELOCITY,
|
|
|
|
|
WIDX_GRAPH_ALTITUDE,
|
|
|
|
|
WIDX_GRAPH_VERTICAL,
|
|
|
|
|
WIDX_GRAPH_LATERAL,
|
|
|
|
|
|
|
|
|
|
WIDX_PRIMARY_PRICE_LABEL = 14,
|
|
|
|
|
WIDX_PRIMARY_PRICE,
|
|
|
|
|
WIDX_PRIMARY_PRICE_INCREASE,
|
|
|
|
|
WIDX_PRIMARY_PRICE_DECREASE,
|
|
|
|
|
WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK,
|
|
|
|
|
WIDX_SECONDARY_PRICE_LABEL,
|
|
|
|
|
WIDX_SECONDARY_PRICE,
|
|
|
|
|
WIDX_SECONDARY_PRICE_INCREASE,
|
|
|
|
|
WIDX_SECONDARY_PRICE_DECREASE,
|
|
|
|
|
WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK,
|
|
|
|
|
|
|
|
|
|
WIDX_SHOW_GUESTS_THOUGHTS = 14,
|
|
|
|
|
WIDX_SHOW_GUESTS_ON_RIDE,
|
|
|
|
|
WIDX_SHOW_GUESTS_QUEUING
|
2014-08-25 19:28:56 +02:00
|
|
|
|
};
|
|
|
|
|
|
2019-10-24 05:38:13 +02:00
|
|
|
|
constexpr int32_t RCT1_LIGHT_OFFSET = 4;
|
2015-06-08 02:31:54 +02:00
|
|
|
|
|
2017-03-11 22:29:39 +01:00
|
|
|
|
#define MAIN_RIDE_WIDGETS \
|
2020-05-09 16:44:21 +02:00
|
|
|
|
WINDOW_SHIM(WINDOW_TITLE, WW, WH), \
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeWidget({ 0, 43}, {316, 137}, WindowWidgetType::Resize, WindowColour::Secondary), \
|
2020-08-29 04:31:31 +02:00
|
|
|
|
MakeTab ({ 3, 17}, STR_VIEW_OF_RIDE_ATTRACTION_TIP ), \
|
|
|
|
|
MakeTab ({ 34, 17}, STR_VEHICLE_DETAILS_AND_OPTIONS_TIP ), \
|
|
|
|
|
MakeTab ({ 65, 17}, STR_OPERATING_OPTIONS_TIP ), \
|
|
|
|
|
MakeTab ({ 96, 17}, STR_MAINTENANCE_OPTIONS_TIP ), \
|
|
|
|
|
MakeTab ({127, 17}, STR_COLOUR_SCHEME_OPTIONS_TIP ), \
|
|
|
|
|
MakeTab ({158, 17}, STR_SOUND_AND_MUSIC_OPTIONS_TIP ), \
|
|
|
|
|
MakeTab ({189, 17}, STR_MEASUREMENTS_AND_TEST_DATA_TIP ), \
|
|
|
|
|
MakeTab ({220, 17}, STR_GRAPHS_TIP ), \
|
|
|
|
|
MakeTab ({251, 17}, STR_INCOME_AND_COSTS_TIP ), \
|
|
|
|
|
MakeTab ({282, 17}, STR_CUSTOMER_INFORMATION_TIP )
|
2017-03-11 22:29:39 +01:00
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
// 0x009ADC34
|
|
|
|
|
static rct_widget window_ride_main_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
MAIN_RIDE_WIDGETS,
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeWidget({ 3, 60}, {288, 107}, WindowWidgetType::Viewport, WindowColour::Secondary, STR_VIEWPORT ),
|
|
|
|
|
MakeWidget({ 35, 46}, {222, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, 0xFFFFFFFF, STR_VIEW_SELECTION ),
|
|
|
|
|
MakeWidget({245, 47}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_VIEW_SELECTION ),
|
|
|
|
|
MakeWidget({ 3, 167}, {288, 11}, WindowWidgetType::LabelCentred, WindowColour::Secondary ),
|
|
|
|
|
MakeWidget({291, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_OPEN_CLOSE_OR_TEST_RIDE),
|
|
|
|
|
MakeWidget({291, 70}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_CONSTRUCTION, STR_CONSTRUCTION ),
|
|
|
|
|
MakeWidget({291, 94}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_RENAME, STR_NAME_RIDE_TIP ),
|
|
|
|
|
MakeWidget({291, 118}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_LOCATE, STR_LOCATE_SUBJECT_TIP ),
|
|
|
|
|
MakeWidget({291, 142}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_DEMOLISH, STR_DEMOLISH_RIDE_TIP ),
|
|
|
|
|
MakeWidget({296, 48}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, SPR_G2_RCT1_CLOSE_BUTTON_0, STR_CLOSE_RIDE_TIP ),
|
|
|
|
|
MakeWidget({296, 62}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, SPR_G2_RCT1_TEST_BUTTON_0, STR_SIMULATE_RIDE_TIP ),
|
|
|
|
|
MakeWidget({296, 62}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, SPR_G2_RCT1_TEST_BUTTON_0, STR_TEST_RIDE_TIP ),
|
|
|
|
|
MakeWidget({296, 76}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, SPR_G2_RCT1_OPEN_BUTTON_0, STR_OPEN_RIDE_TIP ),
|
|
|
|
|
MakeWidget({ 3, 180}, {305, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_6_STRINGID ),
|
|
|
|
|
MakeWidget({297, 180}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
|
2021-09-26 11:11:42 +02:00
|
|
|
|
WIDGETS_END,
|
2014-08-25 19:28:56 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-09-18 03:48:51 +02:00
|
|
|
|
// 0x009ADDA8
|
|
|
|
|
static rct_widget window_ride_vehicle_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
MAIN_RIDE_WIDGETS,
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeWidget ({ 7, 50}, {302, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ),
|
|
|
|
|
MakeWidget ({297, 51}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
|
|
|
|
|
MakeWidget ({ 7, 147}, {302, 43}, WindowWidgetType::Scroll, WindowColour::Secondary, STR_EMPTY ),
|
|
|
|
|
MakeSpinnerWidgets({ 7, 196}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_RIDE_VEHICLE_COUNT, STR_MAX_VEHICLES_TIP ),
|
|
|
|
|
MakeSpinnerWidgets({164, 196}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_1_CAR_PER_TRAIN, STR_MAX_CARS_PER_TRAIN_TIP),
|
2021-09-26 11:11:42 +02:00
|
|
|
|
WIDGETS_END,
|
2014-09-18 03:48:51 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-09-09 02:12:32 +02:00
|
|
|
|
// 0x009ADEFC
|
|
|
|
|
static rct_widget window_ride_operating_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
MAIN_RIDE_WIDGETS,
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeSpinnerWidgets({157, 61}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_ARG_18_STRINGID ), // NB: 3 widgets
|
|
|
|
|
MakeSpinnerWidgets({157, 75}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_LIFT_HILL_CHAIN_SPEED_VALUE ), // NB: 3 widgets
|
|
|
|
|
MakeWidget ({ 7, 109}, { 80, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_WAIT_FOR, STR_WAIT_FOR_PASSENGERS_BEFORE_DEPARTING_TIP),
|
|
|
|
|
MakeWidget ({ 7, 124}, {302, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary ),
|
|
|
|
|
MakeWidget ({ 7, 139}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MINIMUM_WAITING_TIME, STR_MINIMUM_LENGTH_BEFORE_DEPARTING_TIP ),
|
|
|
|
|
MakeSpinnerWidgets({157, 139}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_ARG_10_STRINGID ), // NB: 3 widgets
|
|
|
|
|
MakeWidget ({ 7, 154}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAXIMUM_WAITING_TIME, STR_MAXIMUM_LENGTH_BEFORE_DEPARTING_TIP ),
|
|
|
|
|
MakeSpinnerWidgets({157, 154}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_ARG_14_STRINGID ), // NB: 3 widgets
|
|
|
|
|
MakeWidget ({ 7, 169}, {302, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_SYNCHRONISE_WITH_ADJACENT_STATIONS, STR_SYNCHRONISE_WITH_ADJACENT_STATIONS_TIP ),
|
|
|
|
|
MakeWidget ({ 21, 61}, {129, 12}, WindowWidgetType::Label, WindowColour::Secondary ),
|
|
|
|
|
MakeWidget ({ 21, 75}, {129, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_LIFT_HILL_CHAIN_SPEED ),
|
|
|
|
|
MakeWidget ({ 7, 47}, {302, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_OPERATING_MODE ),
|
|
|
|
|
MakeWidget ({297, 48}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_OPERATING_MODE ),
|
|
|
|
|
MakeWidget ({ 87, 109}, {222, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ),
|
|
|
|
|
MakeWidget ({297, 110}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
|
|
|
|
|
MakeWidget ({ 21, 89}, {129, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_NUMBER_OF_CIRCUITS, STR_NUMBER_OF_CIRCUITS_TIP ),
|
|
|
|
|
MakeSpinnerWidgets({157, 89}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_NUMBER_OF_CIRCUITS_VALUE ), // NB: 3 widgets
|
2021-09-26 11:11:42 +02:00
|
|
|
|
WIDGETS_END,
|
2014-09-09 02:12:32 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-09-05 03:37:48 +02:00
|
|
|
|
// 0x009AE190
|
|
|
|
|
static rct_widget window_ride_maintenance_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
MAIN_RIDE_WIDGETS,
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeWidget({107, 71}, {202, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_EMPTY, STR_SELECT_HOW_OFTEN_A_MECHANIC_SHOULD_CHECK_THIS_RIDE),
|
|
|
|
|
MakeWidget({297, 72}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_HOW_OFTEN_A_MECHANIC_SHOULD_CHECK_THIS_RIDE),
|
|
|
|
|
MakeWidget({289, 108}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_LOCATE_NEAREST_AVAILABLE_MECHANIC_TIP ),
|
|
|
|
|
MakeWidget({265, 108}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_CONSTRUCTION, STR_REFURBISH_RIDE_TIP ),
|
|
|
|
|
MakeWidget({241, 108}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_NO_ENTRY, STR_DEBUG_FORCE_BREAKDOWN_TIP ),
|
2021-09-26 11:11:42 +02:00
|
|
|
|
WIDGETS_END,
|
2014-09-05 03:37:48 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-09-10 19:13:07 +02:00
|
|
|
|
// 0x009AE2A4
|
|
|
|
|
static rct_widget window_ride_colour_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
MAIN_RIDE_WIDGETS,
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeWidget({ 3, 47}, { 68, 47}, WindowWidgetType::Spinner, WindowColour::Secondary ),
|
|
|
|
|
MakeWidget({ 74, 49}, {239, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_14_STRINGID ),
|
|
|
|
|
MakeWidget({301, 50}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_COLOUR_SCHEME_TO_CHANGE_TIP ),
|
|
|
|
|
MakeWidget({ 79, 74}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_MAIN_COLOUR_TIP ),
|
|
|
|
|
MakeWidget({ 99, 74}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_ADDITIONAL_COLOUR_1_TIP ),
|
|
|
|
|
MakeWidget({119, 74}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_SUPPORT_STRUCTURE_COLOUR_TIP ),
|
|
|
|
|
MakeWidget({ 74, 49}, {239, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ),
|
|
|
|
|
MakeWidget({301, 50}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
|
|
|
|
|
MakeWidget({289, 68}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_PAINTBRUSH, STR_PAINT_INDIVIDUAL_AREA_TIP ),
|
|
|
|
|
MakeWidget({245, 101}, { 68, 47}, WindowWidgetType::Spinner, WindowColour::Secondary ),
|
|
|
|
|
MakeWidget({103, 103}, {139, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_EMPTY ),
|
|
|
|
|
MakeWidget({230, 104}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_STYLE_OF_ENTRANCE_EXIT_STATION_TIP),
|
|
|
|
|
MakeWidget({ 3, 157}, { 68, 47}, WindowWidgetType::Scroll, WindowColour::Secondary, STR_EMPTY ),
|
|
|
|
|
MakeWidget({ 74, 157}, {239, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_6_STRINGID ),
|
|
|
|
|
MakeWidget({301, 158}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_VEHICLE_COLOUR_SCHEME_TIP ),
|
|
|
|
|
MakeWidget({ 74, 173}, {239, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ),
|
|
|
|
|
MakeWidget({301, 174}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_VEHICLE_TO_MODIFY_TIP ),
|
|
|
|
|
MakeWidget({ 79, 190}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_MAIN_COLOUR_TIP ),
|
|
|
|
|
MakeWidget({ 99, 190}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_ADDITIONAL_COLOUR_1_TIP ),
|
|
|
|
|
MakeWidget({119, 190}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_ADDITIONAL_COLOUR_2_TIP ),
|
2021-09-26 11:11:42 +02:00
|
|
|
|
WIDGETS_END,
|
2014-09-10 19:13:07 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
// 0x009AE4C8
|
|
|
|
|
static rct_widget window_ride_music_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
MAIN_RIDE_WIDGETS,
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeWidget({ 7, 47}, {302, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_PLAY_MUSIC, STR_SELECT_MUSIC_TIP ),
|
|
|
|
|
MakeWidget({ 7, 62}, {302, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_EMPTY ),
|
|
|
|
|
MakeWidget({297, 63}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_MUSIC_STYLE_TIP),
|
2021-09-26 11:11:42 +02:00
|
|
|
|
WIDGETS_END,
|
2014-08-25 19:28:56 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-09-05 19:10:30 +02:00
|
|
|
|
// 0x009AE5DC
|
|
|
|
|
static rct_widget window_ride_measurements_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
MAIN_RIDE_WIDGETS,
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeWidget({288, 194}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_FLOPPY, STR_SAVE_TRACK_DESIGN),
|
|
|
|
|
MakeWidget({ 4, 127}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_SELECT_NEARBY_SCENERY ),
|
|
|
|
|
MakeWidget({158, 127}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RESET_SELECTION ),
|
|
|
|
|
MakeWidget({ 4, 177}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_DESIGN_SAVE ),
|
|
|
|
|
MakeWidget({158, 177}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_DESIGN_CANCEL ),
|
2021-09-26 11:11:42 +02:00
|
|
|
|
WIDGETS_END,
|
2014-09-05 19:10:30 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-09-20 20:41:03 +02:00
|
|
|
|
// 0x009AE710
|
|
|
|
|
static rct_widget window_ride_graphs_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
MAIN_RIDE_WIDGETS,
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeWidget({ 3, 46}, {306, 112}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL, STR_LOGGING_DATA_FROM_TIP ),
|
|
|
|
|
MakeWidget({ 3, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_VELOCITY, STR_SHOW_GRAPH_OF_VELOCITY_AGAINST_TIME_TIP ),
|
|
|
|
|
MakeWidget({ 76, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_ALTITUDE, STR_SHOW_GRAPH_OF_ALTITUDE_AGAINST_TIME_TIP ),
|
|
|
|
|
MakeWidget({149, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_VERT_G, STR_SHOW_GRAPH_OF_VERTICAL_ACCELERATION_AGAINST_TIME_TIP),
|
|
|
|
|
MakeWidget({222, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_LAT_G, STR_SHOW_GRAPH_OF_LATERAL_ACCELERATION_AGAINST_TIME_TIP ),
|
2021-09-26 11:11:42 +02:00
|
|
|
|
WIDGETS_END,
|
2014-09-20 20:41:03 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-09-06 00:44:02 +02:00
|
|
|
|
// 0x009AE844
|
|
|
|
|
static rct_widget window_ride_income_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
MAIN_RIDE_WIDGETS,
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeWidget ({ 19, 50}, {126, 14}, WindowWidgetType::Label, WindowColour::Secondary ),
|
|
|
|
|
MakeSpinnerWidgets({147, 50}, {162, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_ARG_6_CURRENCY2DP ), // NB: 3 widgets
|
|
|
|
|
MakeWidget ({ 5, 62}, {306, 13}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_SAME_PRICE_THROUGHOUT_PARK, STR_SAME_PRICE_THROUGHOUT_PARK_TIP),
|
|
|
|
|
MakeWidget ({ 19, 94}, {126, 14}, WindowWidgetType::Label, WindowColour::Secondary ),
|
|
|
|
|
MakeSpinnerWidgets({147, 94}, {162, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_RIDE_SECONDARY_PRICE_VALUE ), // NB: 3 widgets
|
|
|
|
|
MakeWidget ({ 5, 106}, {306, 13}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_SAME_PRICE_THROUGHOUT_PARK, STR_SAME_PRICE_THROUGHOUT_PARK_TIP),
|
2021-09-26 11:11:42 +02:00
|
|
|
|
WIDGETS_END,
|
2014-09-06 00:44:02 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-09-04 20:59:42 +02:00
|
|
|
|
// 0x009AE9C8
|
|
|
|
|
static rct_widget window_ride_customer_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
MAIN_RIDE_WIDGETS,
|
2020-11-27 04:14:20 +01:00
|
|
|
|
MakeWidget({289, 54}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_SHOW_GUESTS_THOUGHTS_ABOUT_THIS_RIDE_ATTRACTION, STR_SHOW_GUESTS_THOUGHTS_ABOUT_THIS_RIDE_ATTRACTION_TIP),
|
|
|
|
|
MakeWidget({289, 78}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_SHOW_GUESTS_ON_THIS_RIDE_ATTRACTION, STR_SHOW_GUESTS_ON_THIS_RIDE_ATTRACTION_TIP ),
|
|
|
|
|
MakeWidget({289, 102}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_SHOW_GUESTS_QUEUING_FOR_THIS_RIDE_ATTRACTION, STR_SHOW_GUESTS_QUEUING_FOR_THIS_RIDE_ATTRACTION_TIP ),
|
2021-09-26 11:11:42 +02:00
|
|
|
|
WIDGETS_END,
|
2014-09-04 20:59:42 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-08-25 16:04:28 +02:00
|
|
|
|
static rct_widget *window_ride_page_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_main_widgets,
|
|
|
|
|
window_ride_vehicle_widgets,
|
|
|
|
|
window_ride_operating_widgets,
|
|
|
|
|
window_ride_maintenance_widgets,
|
|
|
|
|
window_ride_colour_widgets,
|
|
|
|
|
window_ride_music_widgets,
|
|
|
|
|
window_ride_measurements_widgets,
|
|
|
|
|
window_ride_graphs_widgets,
|
|
|
|
|
window_ride_income_widgets,
|
2021-10-17 15:31:56 +02:00
|
|
|
|
window_ride_customer_widgets,
|
2014-08-25 16:04:28 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
static constexpr const uint64_t window_ride_page_hold_down_widgets[] = {
|
2018-05-31 00:24:48 +02:00
|
|
|
|
0,
|
2017-06-06 23:24:18 +02:00
|
|
|
|
(1ULL << WIDX_VEHICLE_TRAINS_INCREASE) |
|
|
|
|
|
(1ULL << WIDX_VEHICLE_TRAINS_DECREASE) |
|
|
|
|
|
(1ULL << WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE) |
|
|
|
|
|
(1ULL << WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE),
|
|
|
|
|
(1ULL << WIDX_MODE_TWEAK_INCREASE) |
|
|
|
|
|
(1ULL << WIDX_MODE_TWEAK_DECREASE) |
|
|
|
|
|
(1ULL << WIDX_LIFT_HILL_SPEED_INCREASE) |
|
|
|
|
|
(1ULL << WIDX_LIFT_HILL_SPEED_DECREASE) |
|
|
|
|
|
(1ULL << WIDX_MINIMUM_LENGTH_INCREASE) |
|
|
|
|
|
(1ULL << WIDX_MINIMUM_LENGTH_DECREASE) |
|
|
|
|
|
(1ULL << WIDX_MAXIMUM_LENGTH_INCREASE) |
|
2021-02-17 08:51:07 +01:00
|
|
|
|
(1ULL << WIDX_MAXIMUM_LENGTH_DECREASE) |
|
|
|
|
|
(1ULL << WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE) |
|
|
|
|
|
(1ULL << WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE),
|
2017-06-06 23:24:18 +02:00
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
(1ULL << WIDX_PRIMARY_PRICE_INCREASE) |
|
|
|
|
|
(1ULL << WIDX_PRIMARY_PRICE_DECREASE) |
|
|
|
|
|
(1ULL << WIDX_SECONDARY_PRICE_INCREASE) |
|
|
|
|
|
(1ULL << WIDX_SECONDARY_PRICE_DECREASE),
|
2021-10-17 15:31:56 +02:00
|
|
|
|
0,
|
2015-02-10 21:40:33 +01:00
|
|
|
|
};
|
2021-10-17 15:31:56 +02:00
|
|
|
|
// clang-format on
|
2015-02-10 21:40:33 +01:00
|
|
|
|
|
2014-08-25 16:04:28 +02:00
|
|
|
|
#pragma endregion
|
|
|
|
|
|
|
|
|
|
#pragma region Events
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideInitViewport(rct_window* w);
|
|
|
|
|
|
|
|
|
|
static void WindowRideMainMouseup(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideMainResize(rct_window* w);
|
|
|
|
|
static void WindowRideMainMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget);
|
|
|
|
|
static void WindowRideMainDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex);
|
|
|
|
|
static void WindowRideMainUpdate(rct_window* w);
|
|
|
|
|
static void WindowRideMainTextinput(rct_window* w, rct_widgetindex widgetIndex, char* text);
|
|
|
|
|
static void WindowRideMainViewportRotate(rct_window* w);
|
|
|
|
|
static void WindowRideMainInvalidate(rct_window* w);
|
|
|
|
|
static void WindowRideMainPaint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
|
static void WindowRideMainFollowRide(rct_window* w);
|
|
|
|
|
|
|
|
|
|
static void WindowRideVehicleMouseup(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideVehicleResize(rct_window* w);
|
|
|
|
|
static void WindowRideVehicleMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget);
|
|
|
|
|
static void WindowRideVehicleDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex);
|
|
|
|
|
static void WindowRideVehicleUpdate(rct_window* w);
|
|
|
|
|
static OpenRCT2String WindowRideVehicleTooltip(rct_window* const w, const rct_widgetindex widgetIndex, rct_string_id fallback);
|
|
|
|
|
static void WindowRideVehicleInvalidate(rct_window* w);
|
|
|
|
|
static void WindowRideVehiclePaint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
|
static void WindowRideVehicleScrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex);
|
|
|
|
|
|
|
|
|
|
static void WindowRideOperatingMouseup(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideOperatingResize(rct_window* w);
|
|
|
|
|
static void WindowRideOperatingMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget);
|
|
|
|
|
static void WindowRideOperatingDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex);
|
|
|
|
|
static void WindowRideOperatingUpdate(rct_window* w);
|
|
|
|
|
static void WindowRideOperatingInvalidate(rct_window* w);
|
|
|
|
|
static void WindowRideOperatingPaint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
|
|
|
|
|
|
static void WindowRideMaintenanceMouseup(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideMaintenanceResize(rct_window* w);
|
|
|
|
|
static void WindowRideMaintenanceMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget);
|
|
|
|
|
static void WindowRideMaintenanceDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex);
|
|
|
|
|
static void WindowRideMaintenanceUpdate(rct_window* w);
|
|
|
|
|
static void WindowRideMaintenanceInvalidate(rct_window* w);
|
|
|
|
|
static void WindowRideMaintenancePaint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
|
|
|
|
|
|
static void WindowRideColourClose(rct_window* w);
|
|
|
|
|
static void WindowRideColourMouseup(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideColourResize(rct_window* w);
|
|
|
|
|
static void WindowRideColourMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget);
|
|
|
|
|
static void WindowRideColourDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex);
|
|
|
|
|
static void WindowRideColourUpdate(rct_window* w);
|
|
|
|
|
static void WindowRideColourTooldown(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords);
|
|
|
|
|
static void WindowRideColourTooldrag(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords);
|
|
|
|
|
static void WindowRideColourInvalidate(rct_window* w);
|
|
|
|
|
static void WindowRideColourPaint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
|
static void WindowRideColourScrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex);
|
|
|
|
|
|
|
|
|
|
static void WindowRideMusicMouseup(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideMusicResize(rct_window* w);
|
|
|
|
|
static void WindowRideMusicMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget);
|
|
|
|
|
static void WindowRideMusicDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex);
|
|
|
|
|
static void WindowRideMusicUpdate(rct_window* w);
|
|
|
|
|
static void WindowRideMusicInvalidate(rct_window* w);
|
|
|
|
|
static void WindowRideMusicPaint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
|
|
|
|
|
|
static void WindowRideMeasurementsClose(rct_window* w);
|
|
|
|
|
static void WindowRideMeasurementsMouseup(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideMeasurementsResize(rct_window* w);
|
|
|
|
|
static void WindowRideMeasurementsMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget);
|
|
|
|
|
static void WindowRideMeasurementsDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex);
|
|
|
|
|
static void WindowRideMeasurementsUpdate(rct_window* w);
|
|
|
|
|
static void WindowRideMeasurementsTooldown(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords);
|
|
|
|
|
static void WindowRideMeasurementsTooldrag(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords);
|
|
|
|
|
static void WindowRideMeasurementsToolabort(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideMeasurementsInvalidate(rct_window* w);
|
|
|
|
|
static void WindowRideMeasurementsPaint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
|
|
|
|
|
|
static void WindowRideGraphsMouseup(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideGraphsResize(rct_window* w);
|
|
|
|
|
static void WindowRideGraphsMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget);
|
|
|
|
|
static void WindowRideGraphsUpdate(rct_window* w);
|
|
|
|
|
static void WindowRideGraphsScrollgetheight(rct_window* w, int32_t scrollIndex, int32_t* width, int32_t* height);
|
|
|
|
|
static void WindowRideGraphs15(rct_window* w, int32_t scrollIndex, int32_t scrollAreaType);
|
|
|
|
|
static OpenRCT2String WindowRideGraphsTooltip(rct_window* w, const rct_widgetindex widgetIndex, const rct_string_id fallback);
|
|
|
|
|
static void WindowRideGraphsInvalidate(rct_window* w);
|
|
|
|
|
static void WindowRideGraphsPaint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
|
static void WindowRideGraphsScrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex);
|
|
|
|
|
|
|
|
|
|
static void WindowRideIncomeMouseup(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideIncomeResize(rct_window* w);
|
|
|
|
|
static void WindowRideIncomeMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget);
|
|
|
|
|
static void WindowRideIncomeUpdate(rct_window* w);
|
|
|
|
|
static void WindowRideIncomeTextinput(rct_window* w, rct_widgetindex widgetIndex, char* text);
|
|
|
|
|
static void WindowRideIncomeInvalidate(rct_window* w);
|
|
|
|
|
static void WindowRideIncomePaint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
|
static bool WindowRideIncomeCanModifyPrimaryPrice(rct_window* w);
|
|
|
|
|
|
|
|
|
|
static void WindowRideCustomerMouseup(rct_window* w, rct_widgetindex widgetIndex);
|
|
|
|
|
static void WindowRideCustomerResize(rct_window* w);
|
|
|
|
|
static void WindowRideCustomerUpdate(rct_window* w);
|
|
|
|
|
static void WindowRideCustomerInvalidate(rct_window* w);
|
|
|
|
|
static void WindowRideCustomerPaint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
|
|
|
|
|
|
static void WindowRideSetPage(rct_window* w, int32_t page);
|
2015-05-21 12:28:51 +02:00
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
// 0x0098DFD4
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static rct_window_event_list window_ride_main_events([](auto& events) {
|
2021-11-23 14:18:07 +01:00
|
|
|
|
events.mouse_up = &WindowRideMainMouseup;
|
|
|
|
|
events.resize = &WindowRideMainResize;
|
|
|
|
|
events.mouse_down = &WindowRideMainMousedown;
|
|
|
|
|
events.dropdown = &WindowRideMainDropdown;
|
|
|
|
|
events.update = &WindowRideMainUpdate;
|
|
|
|
|
events.text_input = &WindowRideMainTextinput;
|
|
|
|
|
events.viewport_rotate = &WindowRideMainViewportRotate;
|
|
|
|
|
events.invalidate = &WindowRideMainInvalidate;
|
|
|
|
|
events.paint = &WindowRideMainPaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
|
});
|
2014-08-25 19:28:56 +02:00
|
|
|
|
|
2014-09-18 03:48:51 +02:00
|
|
|
|
// 0x0098E204
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static rct_window_event_list window_ride_vehicle_events([](auto& events) {
|
2021-11-23 14:18:07 +01:00
|
|
|
|
events.mouse_up = &WindowRideVehicleMouseup;
|
|
|
|
|
events.resize = &WindowRideVehicleResize;
|
|
|
|
|
events.mouse_down = &WindowRideVehicleMousedown;
|
|
|
|
|
events.dropdown = &WindowRideVehicleDropdown;
|
|
|
|
|
events.update = &WindowRideVehicleUpdate;
|
|
|
|
|
events.tooltip = &WindowRideVehicleTooltip;
|
|
|
|
|
events.invalidate = &WindowRideVehicleInvalidate;
|
|
|
|
|
events.paint = &WindowRideVehiclePaint;
|
|
|
|
|
events.scroll_paint = &WindowRideVehicleScrollpaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
|
});
|
2014-09-18 03:48:51 +02:00
|
|
|
|
|
2014-09-09 02:12:32 +02:00
|
|
|
|
// 0x0098E0B4
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static rct_window_event_list window_ride_operating_events([](auto& events) {
|
2021-11-23 14:18:07 +01:00
|
|
|
|
events.mouse_up = &WindowRideOperatingMouseup;
|
|
|
|
|
events.resize = &WindowRideOperatingResize;
|
|
|
|
|
events.mouse_down = &WindowRideOperatingMousedown;
|
|
|
|
|
events.dropdown = &WindowRideOperatingDropdown;
|
|
|
|
|
events.update = &WindowRideOperatingUpdate;
|
|
|
|
|
events.invalidate = &WindowRideOperatingInvalidate;
|
|
|
|
|
events.paint = &WindowRideOperatingPaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
|
});
|
2014-09-09 02:12:32 +02:00
|
|
|
|
|
2014-09-05 03:37:48 +02:00
|
|
|
|
// 0x0098E124
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static rct_window_event_list window_ride_maintenance_events([](auto& events) {
|
2021-11-23 14:18:07 +01:00
|
|
|
|
events.mouse_up = &WindowRideMaintenanceMouseup;
|
|
|
|
|
events.resize = &WindowRideMaintenanceResize;
|
|
|
|
|
events.mouse_down = &WindowRideMaintenanceMousedown;
|
|
|
|
|
events.dropdown = &WindowRideMaintenanceDropdown;
|
|
|
|
|
events.update = &WindowRideMaintenanceUpdate;
|
|
|
|
|
events.invalidate = &WindowRideMaintenanceInvalidate;
|
|
|
|
|
events.paint = &WindowRideMaintenancePaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
|
});
|
2014-09-05 03:37:48 +02:00
|
|
|
|
|
2014-09-10 19:13:07 +02:00
|
|
|
|
// 0x0098E044
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static rct_window_event_list window_ride_colour_events([](auto& events) {
|
2021-11-23 14:18:07 +01:00
|
|
|
|
events.close = &WindowRideColourClose;
|
|
|
|
|
events.mouse_up = &WindowRideColourMouseup;
|
|
|
|
|
events.resize = &WindowRideColourResize;
|
|
|
|
|
events.mouse_down = &WindowRideColourMousedown;
|
|
|
|
|
events.dropdown = &WindowRideColourDropdown;
|
|
|
|
|
events.update = &WindowRideColourUpdate;
|
|
|
|
|
events.tool_down = &WindowRideColourTooldown;
|
|
|
|
|
events.tool_drag = &WindowRideColourTooldrag;
|
|
|
|
|
events.invalidate = &WindowRideColourInvalidate;
|
|
|
|
|
events.paint = &WindowRideColourPaint;
|
|
|
|
|
events.scroll_paint = &WindowRideColourScrollpaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
|
});
|
2014-09-10 19:13:07 +02:00
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
// 0x0098E194
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static rct_window_event_list window_ride_music_events([](auto& events) {
|
2021-11-23 14:18:07 +01:00
|
|
|
|
events.mouse_up = &WindowRideMusicMouseup;
|
|
|
|
|
events.resize = &WindowRideMusicResize;
|
|
|
|
|
events.mouse_down = &WindowRideMusicMousedown;
|
|
|
|
|
events.dropdown = &WindowRideMusicDropdown;
|
|
|
|
|
events.update = &WindowRideMusicUpdate;
|
|
|
|
|
events.invalidate = &WindowRideMusicInvalidate;
|
|
|
|
|
events.paint = &WindowRideMusicPaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
|
});
|
2014-08-25 19:28:56 +02:00
|
|
|
|
|
2014-09-05 19:10:30 +02:00
|
|
|
|
// 0x0098DE14
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static rct_window_event_list window_ride_measurements_events([](auto& events) {
|
2021-11-23 14:18:07 +01:00
|
|
|
|
events.close = &WindowRideMeasurementsClose;
|
|
|
|
|
events.mouse_up = &WindowRideMeasurementsMouseup;
|
|
|
|
|
events.resize = &WindowRideMeasurementsResize;
|
|
|
|
|
events.mouse_down = &WindowRideMeasurementsMousedown;
|
|
|
|
|
events.dropdown = &WindowRideMeasurementsDropdown;
|
|
|
|
|
events.update = &WindowRideMeasurementsUpdate;
|
|
|
|
|
events.tool_down = &WindowRideMeasurementsTooldown;
|
|
|
|
|
events.tool_drag = &WindowRideMeasurementsTooldrag;
|
|
|
|
|
events.tool_abort = &WindowRideMeasurementsToolabort;
|
|
|
|
|
events.invalidate = &WindowRideMeasurementsInvalidate;
|
|
|
|
|
events.paint = &WindowRideMeasurementsPaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
|
});
|
2014-09-05 19:10:30 +02:00
|
|
|
|
|
2014-09-20 20:41:03 +02:00
|
|
|
|
// 0x0098DF64
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static rct_window_event_list window_ride_graphs_events([](auto& events) {
|
2021-11-23 14:18:07 +01:00
|
|
|
|
events.mouse_up = &WindowRideGraphsMouseup;
|
|
|
|
|
events.resize = &WindowRideGraphsResize;
|
|
|
|
|
events.mouse_down = &WindowRideGraphsMousedown;
|
|
|
|
|
events.update = &WindowRideGraphsUpdate;
|
|
|
|
|
events.get_scroll_size = &WindowRideGraphsScrollgetheight;
|
|
|
|
|
events.unknown_15 = &WindowRideGraphs15;
|
|
|
|
|
events.tooltip = &WindowRideGraphsTooltip;
|
|
|
|
|
events.invalidate = &WindowRideGraphsInvalidate;
|
|
|
|
|
events.paint = &WindowRideGraphsPaint;
|
|
|
|
|
events.scroll_paint = &WindowRideGraphsScrollpaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
|
});
|
2014-09-20 20:41:03 +02:00
|
|
|
|
|
2014-09-06 00:44:02 +02:00
|
|
|
|
// 0x0098DEF4
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static rct_window_event_list window_ride_income_events([](auto& events) {
|
2021-11-23 14:18:07 +01:00
|
|
|
|
events.mouse_up = &WindowRideIncomeMouseup;
|
|
|
|
|
events.resize = &WindowRideIncomeResize;
|
|
|
|
|
events.mouse_down = &WindowRideIncomeMousedown;
|
|
|
|
|
events.update = &WindowRideIncomeUpdate;
|
|
|
|
|
events.text_input = &WindowRideIncomeTextinput;
|
|
|
|
|
events.invalidate = &WindowRideIncomeInvalidate;
|
|
|
|
|
events.paint = &WindowRideIncomePaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
|
});
|
2014-09-06 00:44:02 +02:00
|
|
|
|
|
2014-09-04 20:59:42 +02:00
|
|
|
|
// 0x0098DE84
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static rct_window_event_list window_ride_customer_events([](auto& events) {
|
2021-11-23 14:18:07 +01:00
|
|
|
|
events.mouse_up = &WindowRideCustomerMouseup;
|
|
|
|
|
events.resize = &WindowRideCustomerResize;
|
|
|
|
|
events.update = &WindowRideCustomerUpdate;
|
|
|
|
|
events.invalidate = &WindowRideCustomerInvalidate;
|
|
|
|
|
events.paint = &WindowRideCustomerPaint;
|
2020-09-28 20:36:15 +02:00
|
|
|
|
});
|
2014-09-04 20:59:42 +02:00
|
|
|
|
|
2021-10-17 15:31:56 +02:00
|
|
|
|
// clang-format off
|
2015-07-10 02:39:16 +02:00
|
|
|
|
static rct_window_event_list *window_ride_page_events[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
&window_ride_main_events,
|
|
|
|
|
&window_ride_vehicle_events,
|
|
|
|
|
&window_ride_operating_events,
|
|
|
|
|
&window_ride_maintenance_events,
|
|
|
|
|
&window_ride_colour_events,
|
|
|
|
|
&window_ride_music_events,
|
|
|
|
|
&window_ride_measurements_events,
|
|
|
|
|
&window_ride_graphs_events,
|
|
|
|
|
&window_ride_income_events,
|
2021-10-17 15:31:56 +02:00
|
|
|
|
&window_ride_customer_events,
|
2014-08-25 16:04:28 +02:00
|
|
|
|
};
|
2021-10-17 15:31:56 +02:00
|
|
|
|
// clang-format on
|
2014-08-25 16:04:28 +02:00
|
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
|
2017-05-29 22:34:33 +02:00
|
|
|
|
static bool _collectTrackDesignScenery = false;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
static int32_t _lastSceneryX = 0;
|
|
|
|
|
static int32_t _lastSceneryY = 0;
|
2019-06-30 12:23:06 +02:00
|
|
|
|
static std::unique_ptr<TrackDesign> _trackDesign;
|
2016-07-26 00:52:50 +02:00
|
|
|
|
|
2016-02-18 21:38:05 +01:00
|
|
|
|
// Cached overall view for each ride
|
|
|
|
|
// (Re)calculated when the ride window is opened
|
2021-11-24 17:16:52 +01:00
|
|
|
|
struct RideOverallView
|
2021-10-17 15:31:56 +02:00
|
|
|
|
{
|
2021-09-19 08:19:32 +02:00
|
|
|
|
CoordsXYZ loc;
|
2021-09-28 18:09:40 +02:00
|
|
|
|
ZoomLevel zoom;
|
2018-02-14 09:42:26 +01:00
|
|
|
|
};
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2021-11-24 17:16:52 +01:00
|
|
|
|
static std::vector<RideOverallView> ride_overall_views = {};
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2021-10-17 15:31:56 +02:00
|
|
|
|
static constexpr const int32_t window_ride_tab_animation_divisor[] = {
|
|
|
|
|
0, 0, 2, 2, 4, 2, 8, 8, 2, 0,
|
|
|
|
|
};
|
|
|
|
|
static constexpr const int32_t window_ride_tab_animation_frames[] = {
|
|
|
|
|
0, 0, 4, 16, 8, 16, 8, 8, 8, 0,
|
|
|
|
|
};
|
2014-09-04 00:19:13 +02:00
|
|
|
|
|
2021-10-17 15:31:56 +02:00
|
|
|
|
// clang-format off
|
2018-01-11 14:50:31 +01:00
|
|
|
|
static constexpr const rct_string_id RatingNames[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
STR_RATING_LOW,
|
|
|
|
|
STR_RATING_MEDIUM,
|
|
|
|
|
STR_RATING_HIGH,
|
|
|
|
|
STR_RATING_VERY_HIGH,
|
|
|
|
|
STR_RATING_EXTREME,
|
|
|
|
|
STR_RATING_ULTRA_EXTREME,
|
2016-07-14 14:07:49 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-01-11 14:50:31 +01:00
|
|
|
|
static constexpr const rct_string_id RideBreakdownReasonNames[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
STR_RIDE_BREAKDOWN_SAFETY_CUT_OUT ,
|
|
|
|
|
STR_RIDE_BREAKDOWN_RESTRAINTS_STUCK_CLOSED,
|
|
|
|
|
STR_RIDE_BREAKDOWN_RESTRAINTS_STUCK_OPEN,
|
|
|
|
|
STR_RIDE_BREAKDOWN_DOORS_STUCK_CLOSED,
|
|
|
|
|
STR_RIDE_BREAKDOWN_DOORS_STUCK_OPEN,
|
|
|
|
|
STR_RIDE_BREAKDOWN_VEHICLE_MALFUNCTION,
|
|
|
|
|
STR_RIDE_BREAKDOWN_BRAKES_FAILURE,
|
2021-10-17 15:31:56 +02:00
|
|
|
|
STR_RIDE_BREAKDOWN_CONTROL_FAILURE,
|
2016-07-14 14:07:49 +02:00
|
|
|
|
};
|
|
|
|
|
|
2019-04-22 15:49:09 +02:00
|
|
|
|
const rct_string_id ColourSchemeNames[4] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
STR_MAIN_COLOUR_SCHEME,
|
|
|
|
|
STR_ALTERNATIVE_COLOUR_SCHEME_1,
|
|
|
|
|
STR_ALTERNATIVE_COLOUR_SCHEME_2,
|
|
|
|
|
STR_ALTERNATIVE_COLOUR_SCHEME_3,
|
2016-07-14 14:07:49 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-01-11 14:50:31 +01:00
|
|
|
|
static constexpr const rct_string_id VehicleLoadNames[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
STR_QUARTER_LOAD,
|
|
|
|
|
STR_HALF_LOAD,
|
|
|
|
|
STR_THREE_QUARTER_LOAD,
|
|
|
|
|
STR_FULL_LOAD,
|
|
|
|
|
STR_ANY_LOAD,
|
2016-07-14 14:07:49 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-01-11 14:50:31 +01:00
|
|
|
|
static constexpr const rct_string_id VehicleColourSchemeNames[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
STR_ALL_VEHICLES_IN_SAME_COLOURS ,
|
|
|
|
|
STR_DIFFERENT_COLOURS_PER ,
|
|
|
|
|
STR_DIFFERENT_COLOURS_PER_VEHICLE ,
|
2016-07-14 14:07:49 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-01-11 14:50:31 +01:00
|
|
|
|
static constexpr const rct_string_id VehicleStatusNames[] = {
|
2020-08-09 07:24:25 +02:00
|
|
|
|
STR_MOVING_TO_END_OF, // Vehicle::Status::MovingToEndOfStation
|
|
|
|
|
STR_WAITING_FOR_PASSENGERS_AT, // Vehicle::Status::WaitingForPassengers
|
|
|
|
|
STR_WAITING_TO_DEPART, // Vehicle::Status::WaitingToDepart
|
|
|
|
|
STR_DEPARTING, // Vehicle::Status::Departing
|
|
|
|
|
STR_TRAVELLING_AT_0, // Vehicle::Status::Travelling
|
|
|
|
|
STR_ARRIVING_AT, // Vehicle::Status::Arriving
|
|
|
|
|
STR_UNLOADING_PASSENGERS_AT, // Vehicle::Status::UnloadingPassengers
|
|
|
|
|
STR_TRAVELLING_AT_1, // Vehicle::Status::TravellingBoat
|
|
|
|
|
STR_CRASHING, // Vehicle::Status::Crashing
|
|
|
|
|
STR_CRASHED_0, // Vehicle::Status::Crashed
|
|
|
|
|
STR_TRAVELLING_AT_2, // Vehicle::Status::TravellingDodgems
|
|
|
|
|
STR_SWINGING, // Vehicle::Status::Swinging
|
|
|
|
|
STR_ROTATING_0, // Vehicle::Status::Rotating
|
|
|
|
|
STR_ROTATING_1, // Vehicle::Status::FerrisWheelRotating
|
|
|
|
|
STR_OPERATING_0, // Vehicle::Status::SimulatorOperating
|
|
|
|
|
STR_SHOWING_FILM, // Vehicle::Status::ShowingFilm
|
|
|
|
|
STR_ROTATING_2, // Vehicle::Status::SpaceRingsOperating
|
|
|
|
|
STR_OPERATING_1, // Vehicle::Status::TopSpinOperating
|
|
|
|
|
STR_OPERATING_2, // Vehicle::Status::HauntedHouseOperating
|
|
|
|
|
STR_DOING_CIRCUS_SHOW, // Vehicle::Status::DoingCircusShow
|
|
|
|
|
STR_OPERATING_3, // Vehicle::Status::CrookedHouseOperating
|
|
|
|
|
STR_WAITING_FOR_CABLE_LIFT, // Vehicle::Status::WaitingForCableLift
|
|
|
|
|
STR_TRAVELLING_AT_3, // Vehicle::Status::TravellingCableLift
|
|
|
|
|
STR_STOPPING_0, // Vehicle::Status::Stopping
|
|
|
|
|
STR_WAITING_FOR_PASSENGERS, // Vehicle::Status::WaitingForPassengers17
|
|
|
|
|
STR_WAITING_TO_START, // Vehicle::Status::WaitingToStart
|
|
|
|
|
STR_STARTING, // Vehicle::Status::Starting
|
|
|
|
|
STR_OPERATING, // Vehicle::Status::Operating1A
|
|
|
|
|
STR_STOPPING_1, // Vehicle::Status::Stopping1B
|
|
|
|
|
STR_UNLOADING_PASSENGERS, // Vehicle::Status::UnloadingPassengers1C
|
|
|
|
|
STR_STOPPED_BY_BLOCK_BRAKES, // Vehicle::Status::StoppedByBlockBrakes
|
2016-07-14 14:07:49 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-01-11 14:50:31 +01:00
|
|
|
|
static constexpr const rct_string_id SingleSessionVehicleStatusNames[] = {
|
2020-08-09 07:24:25 +02:00
|
|
|
|
STR_STOPPING_0, // Vehicle::Status::MovingToEndOfStation
|
|
|
|
|
STR_WAITING_FOR_PASSENGERS, // Vehicle::Status::WaitingForPassengers
|
|
|
|
|
STR_WAITING_TO_START, // Vehicle::Status::WaitingToDepart
|
|
|
|
|
STR_STARTING, // Vehicle::Status::Departing
|
|
|
|
|
STR_OPERATING, // Vehicle::Status::Travelling
|
|
|
|
|
STR_STOPPING_1, // Vehicle::Status::Arriving
|
|
|
|
|
STR_UNLOADING_PASSENGERS, // Vehicle::Status::UnloadingPassengers
|
2016-07-14 14:07:49 +02:00
|
|
|
|
};
|
2021-10-17 15:31:56 +02:00
|
|
|
|
// clang-format on
|
2016-07-14 14:07:49 +02:00
|
|
|
|
|
2021-11-24 17:16:52 +01:00
|
|
|
|
struct WindowRideMazeDesignOption
|
2021-10-17 15:31:56 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_string_id text;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint32_t sprite;
|
2018-02-14 09:42:26 +01:00
|
|
|
|
};
|
2016-07-14 14:07:49 +02:00
|
|
|
|
|
2021-11-24 17:16:52 +01:00
|
|
|
|
static constexpr const WindowRideMazeDesignOption MazeOptions[] = {
|
2021-10-17 15:31:56 +02:00
|
|
|
|
{ STR_RIDE_DESIGN_MAZE_BRICK_WALLS, SPR_RIDE_DESIGN_PREVIEW_MAZE_BRICK_WALLS },
|
|
|
|
|
{ STR_RIDE_DESIGN_MAZE_HEDGES, SPR_RIDE_DESIGN_PREVIEW_MAZE_HEDGES },
|
|
|
|
|
{ STR_RIDE_DESIGN_MAZE_ICE_BLOCKS, SPR_RIDE_DESIGN_PREVIEW_MAZE_ICE_BLOCKS },
|
|
|
|
|
{ STR_RIDE_DESIGN_MAZE_WOODEN_FENCES, SPR_RIDE_DESIGN_PREVIEW_MAZE_WOODEN_FENCES },
|
2016-07-14 14:07:49 +02:00
|
|
|
|
};
|
2016-07-28 23:17:28 +02:00
|
|
|
|
|
2021-11-24 17:16:52 +01:00
|
|
|
|
struct GraphsYAxis
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint8_t interval;
|
|
|
|
|
int8_t unit;
|
|
|
|
|
int8_t unit_interval;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_string_id label;
|
2018-02-14 09:42:26 +01:00
|
|
|
|
};
|
2016-08-02 18:49:04 +02:00
|
|
|
|
|
|
|
|
|
/** rct2: 0x0098DD98 */
|
2021-11-24 17:16:52 +01:00
|
|
|
|
static constexpr const GraphsYAxis window_graphs_y_axi[] = {
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{ 11, 0, 10, STR_RIDE_STATS_VELOCITY_FORMAT }, // GRAPH_VELOCITY
|
|
|
|
|
{ 10, 0, 15, STR_RIDE_STATS_ALTITUDE_FORMAT }, // GRAPH_ALTITUDE
|
|
|
|
|
{ 13, -3, 1, STR_RIDE_STATS_G_FORCE_FORMAT }, // GRAPH_VERTICAL
|
|
|
|
|
{ 13, -4, 1, STR_RIDE_STATS_G_FORCE_FORMAT }, // GRAPH_LATERAL
|
2016-08-02 18:49:04 +02:00
|
|
|
|
};
|
|
|
|
|
|
2018-06-22 19:20:27 +02:00
|
|
|
|
static constexpr auto RIDE_G_FORCES_RED_POS_VERTICAL = FIXED_2DP(5, 00);
|
|
|
|
|
static constexpr auto RIDE_G_FORCES_RED_NEG_VERTICAL = -FIXED_2DP(2, 00);
|
|
|
|
|
static constexpr auto RIDE_G_FORCES_RED_LATERAL = FIXED_2DP(2, 80);
|
|
|
|
|
|
2018-05-29 19:09:29 +02:00
|
|
|
|
// Used for sorting the ride type cheat dropdown.
|
|
|
|
|
struct RideTypeLabel
|
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint8_t ride_type_id;
|
2018-05-29 19:09:29 +02:00
|
|
|
|
rct_string_id label_id;
|
|
|
|
|
const char* label_string;
|
|
|
|
|
};
|
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
static int32_t RideDropdownDataLanguage = LANGUAGE_UNDEFINED;
|
2018-05-29 19:09:29 +02:00
|
|
|
|
static std::vector<RideTypeLabel> RideDropdownData;
|
|
|
|
|
|
2018-06-01 20:13:47 +02:00
|
|
|
|
// Used for sorting the vehicle type dropdown.
|
|
|
|
|
struct VehicleTypeLabel
|
|
|
|
|
{
|
2022-02-12 20:12:12 +01:00
|
|
|
|
ObjectEntryIndex subtype_id;
|
2018-06-01 20:13:47 +02:00
|
|
|
|
rct_string_id label_id;
|
|
|
|
|
const char* label_string;
|
|
|
|
|
};
|
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
static int32_t VehicleDropdownDataLanguage = LANGUAGE_UNDEFINED;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
static rct_ride_entry* VehicleDropdownRideType = nullptr;
|
2018-06-01 20:13:47 +02:00
|
|
|
|
static bool VehicleDropdownExpanded = false;
|
|
|
|
|
static std::vector<VehicleTypeLabel> VehicleDropdownData;
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideDrawTabImage(rct_drawpixelinfo* dpi, rct_window* w, int32_t page, int32_t spriteIndex)
|
2014-09-04 00:19:13 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_widgetindex widgetIndex = WIDX_TAB_1 + page;
|
2014-09-04 00:19:13 +02:00
|
|
|
|
|
2022-02-13 00:51:04 +01:00
|
|
|
|
if (!WidgetIsDisabled(w, widgetIndex))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
|
|
|
|
if (w->page == page)
|
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t frame = w->frame_no / window_ride_tab_animation_divisor[w->page];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
spriteIndex += (frame % window_ride_tab_animation_frames[w->page]);
|
|
|
|
|
}
|
2014-09-04 00:19:13 +02:00
|
|
|
|
|
2021-10-01 01:15:07 +02:00
|
|
|
|
const auto& widget = w->widgets[widgetIndex];
|
|
|
|
|
gfx_draw_sprite(dpi, ImageId(spriteIndex), w->windowPos + ScreenCoordsXY{ widget.left, widget.top });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-04 00:19:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B2E88
|
2014-09-04 00:19:13 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideDrawTabMain(rct_drawpixelinfo* dpi, rct_window* w)
|
2014-09-04 00:19:13 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_widgetindex widgetIndex = WIDX_TAB_1 + WINDOW_RIDE_PAGE_MAIN;
|
2022-02-13 00:51:04 +01:00
|
|
|
|
if (!WidgetIsDisabled(w, widgetIndex))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-03 19:11:30 +02:00
|
|
|
|
if (ride != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2019-08-03 19:11:30 +02:00
|
|
|
|
int32_t spriteIndex = 0;
|
|
|
|
|
switch (ride->GetClassification())
|
|
|
|
|
{
|
|
|
|
|
case RideClassification::Ride:
|
|
|
|
|
spriteIndex = SPR_TAB_RIDE_0;
|
|
|
|
|
if (w->page == WINDOW_RIDE_PAGE_MAIN)
|
|
|
|
|
spriteIndex += (w->frame_no / 4) % 16;
|
|
|
|
|
break;
|
|
|
|
|
case RideClassification::ShopOrStall:
|
|
|
|
|
spriteIndex = SPR_TAB_SHOPS_AND_STALLS_0;
|
|
|
|
|
if (w->page == WINDOW_RIDE_PAGE_MAIN)
|
|
|
|
|
spriteIndex += (w->frame_no / 4) % 16;
|
|
|
|
|
break;
|
|
|
|
|
case RideClassification::KioskOrFacility:
|
|
|
|
|
spriteIndex = SPR_TAB_KIOSKS_AND_FACILITIES_0;
|
|
|
|
|
if (w->page == WINDOW_RIDE_PAGE_MAIN)
|
|
|
|
|
spriteIndex += (w->frame_no / 4) % 8;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2021-10-01 01:15:07 +02:00
|
|
|
|
|
|
|
|
|
const auto& widget = w->widgets[widgetIndex];
|
|
|
|
|
gfx_draw_sprite(dpi, ImageId(spriteIndex), w->windowPos + ScreenCoordsXY{ widget.left, widget.top });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-09-04 00:19:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B2B68
|
2014-09-04 00:19:13 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideDrawTabVehicle(rct_drawpixelinfo* dpi, rct_window* w)
|
2014-09-04 00:19:13 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_widgetindex widgetIndex = WIDX_TAB_1 + WINDOW_RIDE_PAGE_VEHICLE;
|
2021-10-01 01:15:07 +02:00
|
|
|
|
const auto& widget = w->widgets[widgetIndex];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2022-02-13 00:51:04 +01:00
|
|
|
|
if (!WidgetIsDisabled(w, widgetIndex))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-10-01 01:15:07 +02:00
|
|
|
|
auto screenCoords = ScreenCoordsXY{ widget.left + 1, widget.top + 1 };
|
|
|
|
|
int32_t width = widget.right - screenCoords.x;
|
|
|
|
|
int32_t height = widget.bottom - 3 - screenCoords.y;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (w->page == WINDOW_RIDE_PAGE_VEHICLE)
|
|
|
|
|
height += 4;
|
|
|
|
|
|
2020-06-24 17:48:17 +02:00
|
|
|
|
screenCoords += w->windowPos;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
rct_drawpixelinfo clipDPI;
|
2020-07-02 19:06:28 +02:00
|
|
|
|
if (!clip_drawpixelinfo(&clipDPI, dpi, screenCoords, width, height))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-01 01:15:07 +02:00
|
|
|
|
screenCoords = ScreenCoordsXY{ widget.width() / 2, widget.height() - 12 };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (rideEntry->flags & RIDE_ENTRY_FLAG_VEHICLE_TAB_SCALE_HALF)
|
|
|
|
|
{
|
2021-09-29 20:04:56 +02:00
|
|
|
|
clipDPI.zoom_level = ZoomLevel{ 1 };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
clipDPI.width *= 2;
|
|
|
|
|
clipDPI.height *= 2;
|
2020-06-24 17:48:17 +02:00
|
|
|
|
screenCoords.x *= 2;
|
|
|
|
|
screenCoords.y *= 2;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
clipDPI.x *= 2;
|
|
|
|
|
clipDPI.y *= 2;
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-06 16:01:20 +02:00
|
|
|
|
// For any suspended rides, move image higher in the vehicle tab on the rides window
|
2020-12-12 22:53:50 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SUSPENDED))
|
2017-08-06 16:01:20 +02:00
|
|
|
|
{
|
2020-06-24 17:48:17 +02:00
|
|
|
|
screenCoords.y /= 4;
|
2017-08-06 16:01:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-12 19:44:01 +01:00
|
|
|
|
const auto vehicle = ride_entry_get_vehicle_at_position(
|
2018-07-21 11:50:45 +02:00
|
|
|
|
ride->subtype, ride->num_cars_per_train, rideEntry->tab_vehicle);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_ride_entry_vehicle* rideVehicleEntry = &rideEntry->vehicles[vehicle];
|
|
|
|
|
|
2020-01-23 22:43:29 +01:00
|
|
|
|
auto vehicleId = ((ride->colour_scheme_type & 3) == VEHICLE_COLOUR_SCHEME_PER_VEHICLE) ? rideEntry->tab_vehicle : 0;
|
2021-11-29 23:04:31 +01:00
|
|
|
|
VehicleColour vehicleColour = ride_get_vehicle_colour(ride, vehicleId);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-12-05 02:50:33 +01:00
|
|
|
|
auto imageIndex = 32;
|
|
|
|
|
if (w->page == WINDOW_RIDE_PAGE_VEHICLE)
|
|
|
|
|
imageIndex += w->frame_no;
|
|
|
|
|
imageIndex /= (rideVehicleEntry->flags & VEHICLE_ENTRY_FLAG_USE_16_ROTATION_FRAMES) ? 4 : 2;
|
|
|
|
|
imageIndex &= rideVehicleEntry->rotation_frame_mask;
|
|
|
|
|
imageIndex *= rideVehicleEntry->base_num_frames;
|
|
|
|
|
imageIndex += rideVehicleEntry->base_image_id;
|
|
|
|
|
auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Ternary);
|
|
|
|
|
gfx_draw_sprite(&clipDPI, imageId, screenCoords);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-04 00:19:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B2F42
|
2014-09-04 00:19:13 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideDrawTabCustomer(rct_drawpixelinfo* dpi, rct_window* w)
|
2014-09-04 00:19:13 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_widgetindex widgetIndex = WIDX_TAB_1 + WINDOW_RIDE_PAGE_CUSTOMER;
|
2014-09-04 00:19:13 +02:00
|
|
|
|
|
2022-02-13 00:51:04 +01:00
|
|
|
|
if (!WidgetIsDisabled(w, widgetIndex))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-10-01 01:15:07 +02:00
|
|
|
|
const auto& widget = w->widgets[widgetIndex];
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t spriteIndex = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (w->page == WINDOW_RIDE_PAGE_CUSTOMER)
|
2020-03-01 21:51:29 +01:00
|
|
|
|
spriteIndex = w->picked_peep_frame & ~3;
|
2014-09-04 00:19:13 +02:00
|
|
|
|
|
2020-10-07 17:01:43 +02:00
|
|
|
|
spriteIndex += GetPeepAnimation(PeepSpriteType::Normal).base_image;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
spriteIndex += 1;
|
|
|
|
|
spriteIndex |= 0xA9E00000;
|
2015-10-20 20:16:30 +02:00
|
|
|
|
|
2021-03-23 11:58:09 +01:00
|
|
|
|
gfx_draw_sprite(
|
2021-10-01 01:15:07 +02:00
|
|
|
|
dpi, ImageId::FromUInt32(spriteIndex), w->windowPos + ScreenCoordsXY{ widget.midX(), widget.bottom - 6 });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-04 00:19:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B2B35
|
2014-09-04 00:19:13 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideDrawTabImages(rct_drawpixelinfo* dpi, rct_window* w)
|
2014-09-04 00:19:13 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabVehicle(dpi, w);
|
|
|
|
|
WindowRideDrawTabImage(dpi, w, WINDOW_RIDE_PAGE_OPERATING, SPR_TAB_GEARS_0);
|
|
|
|
|
WindowRideDrawTabImage(dpi, w, WINDOW_RIDE_PAGE_MAINTENANCE, SPR_TAB_WRENCH_0);
|
|
|
|
|
WindowRideDrawTabImage(dpi, w, WINDOW_RIDE_PAGE_INCOME, SPR_TAB_ADMISSION_0);
|
|
|
|
|
WindowRideDrawTabMain(dpi, w);
|
|
|
|
|
WindowRideDrawTabImage(dpi, w, WINDOW_RIDE_PAGE_MEASUREMENTS, SPR_TAB_TIMER_0);
|
|
|
|
|
WindowRideDrawTabImage(dpi, w, WINDOW_RIDE_PAGE_COLOUR, SPR_TAB_PAINT_0);
|
|
|
|
|
WindowRideDrawTabImage(dpi, w, WINDOW_RIDE_PAGE_GRAPHS, SPR_TAB_GRAPH_A_0);
|
|
|
|
|
WindowRideDrawTabCustomer(dpi, w);
|
|
|
|
|
WindowRideDrawTabImage(dpi, w, WINDOW_RIDE_PAGE_MUSIC, SPR_TAB_MUSIC_0);
|
2014-09-04 00:19:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-06 17:05:47 +01:00
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006AEB9F
|
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideDisableTabs(rct_window* w)
|
2015-03-06 17:05:47 +01:00
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint32_t disabled_tabs = 0;
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 15:20:59 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2020-12-12 22:53:50 +01:00
|
|
|
|
const auto& rtd = ride->GetRideTypeDescriptor();
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2020-12-12 22:53:50 +01:00
|
|
|
|
if (!rtd.HasFlag(RIDE_TYPE_FLAG_HAS_DATA_LOGGING))
|
2021-06-26 14:23:15 +02:00
|
|
|
|
disabled_tabs |= (1ULL << WIDX_TAB_8); // 0x800
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->type == RIDE_TYPE_MINI_GOLF)
|
2021-06-26 14:23:15 +02:00
|
|
|
|
disabled_tabs |= (1ULL << WIDX_TAB_2 | 1ULL << WIDX_TAB_3 | 1ULL << WIDX_TAB_4); // 0xE0
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (rtd.HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES))
|
2021-06-26 14:23:15 +02:00
|
|
|
|
disabled_tabs |= (1ULL << WIDX_TAB_2); // 0x20
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2020-12-12 22:53:50 +01:00
|
|
|
|
if (!rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN) && !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL)
|
|
|
|
|
&& !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS) && !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_VEHICLE_COLOURS)
|
|
|
|
|
&& !rtd.HasFlag(RIDE_TYPE_FLAG_HAS_ENTRANCE_EXIT))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-06-26 14:23:15 +02:00
|
|
|
|
disabled_tabs |= (1ULL << WIDX_TAB_5); // 0x100
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2020-12-12 22:53:50 +01:00
|
|
|
|
if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_SHOP))
|
2021-06-26 14:23:15 +02:00
|
|
|
|
disabled_tabs |= (1ULL << WIDX_TAB_3 | 1ULL << WIDX_TAB_4 | 1ULL << WIDX_TAB_7); // 0x4C0
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2020-12-12 22:53:50 +01:00
|
|
|
|
if (!rtd.HasFlag(RIDE_TYPE_FLAG_ALLOW_MUSIC))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-06-26 14:23:15 +02:00
|
|
|
|
disabled_tabs |= (1ULL << WIDX_TAB_6); // 0x200
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->type == RIDE_TYPE_CASH_MACHINE || ride->type == RIDE_TYPE_FIRST_AID || (gParkFlags & PARK_FLAGS_NO_MONEY) != 0)
|
2021-06-26 14:23:15 +02:00
|
|
|
|
disabled_tabs |= (1ULL << WIDX_TAB_9); // 0x1000
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) != 0)
|
2021-06-26 14:23:15 +02:00
|
|
|
|
disabled_tabs |= (1ULL << WIDX_TAB_4 | 1ULL << WIDX_TAB_6 | 1ULL << WIDX_TAB_9 | 1ULL << WIDX_TAB_10); // 0x3280
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2017-10-12 21:07:35 +02:00
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
{
|
2021-06-26 14:23:15 +02:00
|
|
|
|
disabled_tabs |= 1ULL << WIDX_TAB_2 | 1ULL << WIDX_TAB_3 | 1ULL << WIDX_TAB_4 | 1ULL << WIDX_TAB_5 | 1ULL << WIDX_TAB_6
|
|
|
|
|
| 1ULL << WIDX_TAB_7 | 1ULL << WIDX_TAB_8 | 1ULL << WIDX_TAB_9 | 1ULL << WIDX_TAB_10;
|
2017-10-12 21:07:35 +02:00
|
|
|
|
}
|
|
|
|
|
else if ((rideEntry->flags & RIDE_ENTRY_FLAG_DISABLE_COLOUR_TAB) != 0)
|
|
|
|
|
{
|
2021-06-26 14:23:15 +02:00
|
|
|
|
disabled_tabs |= (1ULL << WIDX_TAB_5);
|
2017-10-12 21:07:35 +02:00
|
|
|
|
}
|
2015-03-06 17:05:47 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->disabled_widgets = disabled_tabs;
|
2015-03-06 17:05:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideUpdateOverallView(Ride* ride)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Calculate x, y, z bounds of the entire ride using its track elements
|
2017-10-31 12:57:40 +01:00
|
|
|
|
tile_element_iterator it;
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
|
tile_element_iterator_begin(&it);
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2021-09-19 08:19:32 +02:00
|
|
|
|
CoordsXYZ min = { std::numeric_limits<int32_t>::max(), std::numeric_limits<int32_t>::max(),
|
|
|
|
|
std::numeric_limits<int32_t>::max() };
|
|
|
|
|
CoordsXYZ max = { std::numeric_limits<int32_t>::min(), std::numeric_limits<int32_t>::min(),
|
|
|
|
|
std::numeric_limits<int32_t>::min() };
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
while (tile_element_iterator_next(&it))
|
|
|
|
|
{
|
2021-12-11 00:39:39 +01:00
|
|
|
|
if (it.element->GetType() != TileElementType::Track)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
continue;
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2019-01-18 19:46:22 +01:00
|
|
|
|
if (it.element->AsTrack()->GetRideIndex() != ride->id)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
continue;
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2020-03-13 12:03:43 +01:00
|
|
|
|
auto location = TileCoordsXY(it.x, it.y).ToCoordsXY();
|
2019-12-31 09:33:27 +01:00
|
|
|
|
int32_t baseZ = it.element->GetBaseZ();
|
|
|
|
|
int32_t clearZ = it.element->GetClearanceZ();
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2021-09-19 08:19:32 +02:00
|
|
|
|
min.x = std::min(min.x, location.x);
|
|
|
|
|
min.y = std::min(min.y, location.y);
|
|
|
|
|
min.z = std::min(min.z, baseZ);
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2021-09-19 08:19:32 +02:00
|
|
|
|
max.x = std::max(max.x, location.x);
|
|
|
|
|
max.y = std::max(max.y, location.y);
|
|
|
|
|
max.z = std::max(max.z, clearZ);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2022-01-19 15:54:57 +01:00
|
|
|
|
const auto rideIndex = ride->id.ToUnderlying();
|
2021-09-04 18:17:37 +02:00
|
|
|
|
if (rideIndex >= ride_overall_views.size())
|
2019-08-03 18:27:50 +02:00
|
|
|
|
{
|
2021-09-04 18:17:37 +02:00
|
|
|
|
ride_overall_views.resize(rideIndex + 1);
|
2019-08-03 18:27:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-04 18:17:37 +02:00
|
|
|
|
auto& view = ride_overall_views[rideIndex];
|
2021-09-19 08:19:32 +02:00
|
|
|
|
view.loc = CoordsXYZ{ (min.x + max.x) / 2, (min.y + max.y) / 2, (min.z + max.z) / 2 } + CoordsXYZ{ 16, 16, -8 };
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Calculate size to determine from how far away to view the ride
|
2021-09-19 08:19:32 +02:00
|
|
|
|
const auto diff = max - min;
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2021-09-19 08:19:32 +02:00
|
|
|
|
const int32_t size = static_cast<int32_t>(std::sqrt(diff.x * diff.x + diff.y * diff.y + diff.z * diff.z));
|
2016-02-18 21:38:05 +01:00
|
|
|
|
|
2018-01-04 00:50:53 +01:00
|
|
|
|
if (size >= 80)
|
|
|
|
|
{
|
|
|
|
|
// Each farther zoom level shows twice as many tiles (log)
|
|
|
|
|
// Appropriate zoom is lowered by one to fill the entire view with the ride
|
2021-09-29 20:04:56 +02:00
|
|
|
|
const auto zoomValue = static_cast<int8_t>(std::ceil(std::log(size / 80)) - 1);
|
|
|
|
|
view.zoom = std::clamp(ZoomLevel{ zoomValue }, ZoomLevel{ 0 }, ZoomLevel::max());
|
2018-01-04 00:50:53 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Small rides or stalls are zoomed in all the way.
|
2021-09-29 20:04:56 +02:00
|
|
|
|
view.zoom = ZoomLevel{ 0 };
|
2018-01-04 00:50:53 +01:00
|
|
|
|
}
|
2016-02-18 21:38:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-25 16:04:28 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AEAB4
|
2014-08-25 16:04:28 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static rct_window* WindowRideOpen(Ride* ride)
|
2014-08-25 16:04:28 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_window* w;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-04 05:52:23 +01:00
|
|
|
|
w = WindowCreateAutoPos(316, 207, window_ride_page_events[0], WC_RIDE, WF_10 | WF_RESIZABLE);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = window_ride_page_widgets[WINDOW_RIDE_PAGE_MAIN];
|
2017-07-26 23:15:33 +02:00
|
|
|
|
w->hold_down_widgets = window_ride_page_hold_down_widgets[WINDOW_RIDE_PAGE_MAIN];
|
2021-09-06 15:40:12 +02:00
|
|
|
|
w->rideId = ride->id;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2017-07-26 23:15:33 +02:00
|
|
|
|
w->page = WINDOW_RIDE_PAGE_MAIN;
|
2017-07-28 12:31:49 +02:00
|
|
|
|
w->vehicleIndex = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->frame_no = 0;
|
|
|
|
|
w->list_information_type = 0;
|
2020-03-01 21:51:29 +01:00
|
|
|
|
w->picked_peep_frame = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->ride_colour = 0;
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDisableTabs(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->min_width = 316;
|
|
|
|
|
w->min_height = 180;
|
|
|
|
|
w->max_width = 500;
|
|
|
|
|
w->max_height = 450;
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideUpdateOverallView(ride);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
PopulateVehicleTypeDropdown(ride, true);
|
2021-10-27 11:30:55 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return w;
|
2014-08-25 16:04:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ACC28
|
2014-08-25 16:04:28 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
rct_window* WindowRideMainOpen(Ride* ride)
|
2014-08-25 16:04:28 +02:00
|
|
|
|
{
|
2020-11-01 14:49:43 +01:00
|
|
|
|
if (ride->type >= RIDE_TYPE_COUNT)
|
|
|
|
|
{
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
2014-08-25 16:04:28 +02:00
|
|
|
|
|
2022-01-19 15:54:57 +01:00
|
|
|
|
rct_window* w = window_bring_to_front_by_number(WC_RIDE, ride->id.ToUnderlying());
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w == nullptr)
|
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
w = WindowRideOpen(ride);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->ride.var_482 = -1;
|
2020-10-10 15:01:28 +02:00
|
|
|
|
w->ride.view = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (w->ride.view >= (1 + ride->num_vehicles + ride->num_stations))
|
|
|
|
|
{
|
|
|
|
|
w->ride.view = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-08-25 16:04:28 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))
|
|
|
|
|
{
|
|
|
|
|
if (w->classification == gCurrentToolWidget.window_classification && w->number == gCurrentToolWidget.window_number)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
tool_cancel();
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-08-25 16:04:28 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->page != WINDOW_RIDE_PAGE_MAIN)
|
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, WINDOW_RIDE_PAGE_MAIN);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2016-10-01 16:13:24 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideInitViewport(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return w;
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-10 01:40:59 +01:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ACCCE
|
2014-11-10 01:40:59 +01:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static rct_window* WindowRideOpenStation(Ride* ride, StationIndex stationIndex)
|
2014-11-10 01:40:59 +01:00
|
|
|
|
{
|
2020-11-01 14:49:43 +01:00
|
|
|
|
if (ride->type >= RIDE_TYPE_COUNT)
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES))
|
2021-11-23 14:18:07 +01:00
|
|
|
|
return WindowRideMainOpen(ride);
|
2014-11-29 16:55:44 +01:00
|
|
|
|
|
2022-01-19 15:54:57 +01:00
|
|
|
|
auto w = window_bring_to_front_by_number(WC_RIDE, ride->id.ToUnderlying());
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w == nullptr)
|
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
w = WindowRideOpen(ride);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->ride.var_482 = -1;
|
|
|
|
|
}
|
2014-11-29 16:55:44 +01:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == w->classification
|
|
|
|
|
&& gCurrentToolWidget.window_number == w->number)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
tool_cancel();
|
|
|
|
|
}
|
2014-11-29 16:55:44 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->page = WINDOW_RIDE_PAGE_MAIN;
|
|
|
|
|
w->width = 316;
|
|
|
|
|
w->height = 180;
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2014-11-29 16:55:44 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = window_ride_page_widgets[w->page];
|
|
|
|
|
w->hold_down_widgets = window_ride_page_hold_down_widgets[w->page];
|
|
|
|
|
w->event_handlers = window_ride_page_events[w->page];
|
|
|
|
|
w->pressed_widgets = 0;
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDisableTabs(w);
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2014-11-29 16:55:44 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// View
|
2022-01-27 10:42:07 +01:00
|
|
|
|
for (int32_t i = stationIndex.ToUnderlying(); i >= 0; i--)
|
2017-07-18 12:23:24 +02:00
|
|
|
|
{
|
2022-01-28 00:34:04 +01:00
|
|
|
|
if (ride->GetStations()[i].Start.IsNull())
|
2017-07-18 12:23:24 +02:00
|
|
|
|
{
|
2022-01-26 13:28:19 +01:00
|
|
|
|
stationIndex = StationIndex::FromUnderlying(stationIndex.ToUnderlying() - 1);
|
2017-07-18 12:23:24 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-11-29 16:55:44 +01:00
|
|
|
|
|
2022-01-26 13:28:19 +01:00
|
|
|
|
w->ride.view = 1 + ride->num_vehicles + stationIndex.ToUnderlying();
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideInitViewport(w);
|
2014-11-29 16:55:44 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return w;
|
2014-11-10 01:40:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
rct_window* WindowRideOpenTrack(TileElement* tileElement)
|
2014-11-10 01:40:59 +01:00
|
|
|
|
{
|
2019-01-18 19:46:22 +01:00
|
|
|
|
assert(tileElement != nullptr);
|
2020-10-27 21:59:55 +01:00
|
|
|
|
auto rideIndex = tileElement->GetRideIndex();
|
2022-01-19 17:24:23 +01:00
|
|
|
|
if (!rideIndex.IsNull())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2019-01-18 19:46:22 +01:00
|
|
|
|
auto ride = get_ride(rideIndex);
|
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
2021-12-11 00:39:39 +01:00
|
|
|
|
const auto type = tileElement->GetType();
|
|
|
|
|
if (type == TileElementType::Entrance)
|
2019-01-18 19:46:22 +01:00
|
|
|
|
{
|
2021-12-11 00:30:59 +01:00
|
|
|
|
// Open ride window in station view
|
|
|
|
|
auto entranceElement = tileElement->AsEntrance();
|
|
|
|
|
auto stationIndex = entranceElement->GetStationIndex();
|
|
|
|
|
return WindowRideOpenStation(ride, stationIndex);
|
|
|
|
|
}
|
2021-12-11 00:39:39 +01:00
|
|
|
|
else if (type == TileElementType::Track)
|
2021-12-11 00:30:59 +01:00
|
|
|
|
{
|
|
|
|
|
// Open ride window in station view
|
|
|
|
|
auto trackElement = tileElement->AsTrack();
|
|
|
|
|
auto trackType = trackElement->GetTrackType();
|
|
|
|
|
const auto& ted = GetTrackElementDescriptor(trackType);
|
|
|
|
|
if (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)
|
2019-01-18 19:46:22 +01:00
|
|
|
|
{
|
2021-12-11 00:30:59 +01:00
|
|
|
|
auto stationIndex = trackElement->GetStationIndex();
|
2021-11-23 14:18:07 +01:00
|
|
|
|
return WindowRideOpenStation(ride, stationIndex);
|
2019-01-18 19:46:22 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Open ride window in overview mode
|
2021-11-23 14:18:07 +01:00
|
|
|
|
return WindowRideMainOpen(ride);
|
2019-01-18 19:46:22 +01:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2019-01-18 19:46:22 +01:00
|
|
|
|
return nullptr;
|
2014-11-10 01:40:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ACAC2
|
2014-11-10 01:40:59 +01:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
rct_window* WindowRideOpenVehicle(Vehicle* vehicle)
|
2014-11-10 01:40:59 +01:00
|
|
|
|
{
|
2021-11-09 19:41:33 +01:00
|
|
|
|
if (vehicle == nullptr)
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
2020-04-19 06:28:23 +02:00
|
|
|
|
Vehicle* headVehicle = vehicle->TrainHead();
|
2021-11-09 19:41:33 +01:00
|
|
|
|
if (headVehicle == nullptr)
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
2022-02-12 22:31:06 +01:00
|
|
|
|
EntityId headVehicleSpriteIndex = headVehicle->sprite_index;
|
2020-06-21 09:38:53 +02:00
|
|
|
|
auto ride = headVehicle->GetRide();
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return nullptr;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Get view index
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t view = 1;
|
2022-02-01 21:59:48 +01:00
|
|
|
|
for (int32_t i = 0; i <= OpenRCT2::Limits::MaxTrainsPerRide; i++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (ride->vehicles[i] == headVehicleSpriteIndex)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
view++;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-19 15:54:57 +01:00
|
|
|
|
rct_window* w = window_find_by_number(WC_RIDE, ride->id.ToUnderlying());
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w != nullptr)
|
|
|
|
|
{
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == w->classification
|
|
|
|
|
&& gCurrentToolWidget.window_number == w->number)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
tool_cancel();
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t openedPeepWindow = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->ride.view == view)
|
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t numPeepsLeft = vehicle->num_peeps;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t i = 0; i < 32 && numPeepsLeft > 0; i++)
|
|
|
|
|
{
|
2021-03-25 09:44:25 +01:00
|
|
|
|
Peep* peep = GetEntity<Guest>(vehicle->peep[i]);
|
2020-08-04 01:09:24 +02:00
|
|
|
|
if (peep == nullptr)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
numPeepsLeft--;
|
2020-08-02 09:28:11 +02:00
|
|
|
|
rct_window* w2 = window_find_by_number(WC_PEEP, vehicle->peep[i]);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w2 == nullptr)
|
|
|
|
|
{
|
2017-10-06 23:21:00 +02:00
|
|
|
|
auto intent = Intent(WC_PEEP);
|
|
|
|
|
intent.putExtra(INTENT_EXTRA_PEEP, peep);
|
|
|
|
|
context_open_intent(&intent);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
openedPeepWindow = 1;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-19 15:54:57 +01:00
|
|
|
|
w = openedPeepWindow ? window_find_by_number(WC_RIDE, ride->id.ToUnderlying())
|
|
|
|
|
: window_bring_to_front_by_number(WC_RIDE, ride->id.ToUnderlying());
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w == nullptr)
|
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
w = WindowRideOpen(ride);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->ride.var_482 = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
w->page = WINDOW_RIDE_PAGE_MAIN;
|
|
|
|
|
w->width = 316;
|
|
|
|
|
w->height = 180;
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
w->widgets = window_ride_page_widgets[w->page];
|
|
|
|
|
w->hold_down_widgets = window_ride_page_hold_down_widgets[w->page];
|
|
|
|
|
w->event_handlers = window_ride_page_events[w->page];
|
|
|
|
|
w->pressed_widgets = 0;
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDisableTabs(w);
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
w->ride.view = view;
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideInitViewport(w);
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
return w;
|
2014-11-10 01:40:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006AF1D2
|
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideSetPage(rct_window* w, int32_t page)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t listen;
|
2014-08-25 19:28:56 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))
|
|
|
|
|
if (w->classification == gCurrentToolWidget.window_classification && w->number == gCurrentToolWidget.window_number)
|
|
|
|
|
tool_cancel();
|
2014-08-25 19:28:56 +02:00
|
|
|
|
|
2020-09-28 12:37:22 +02:00
|
|
|
|
if (page == WINDOW_RIDE_PAGE_VEHICLE)
|
|
|
|
|
{
|
|
|
|
|
auto constructionWindow = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
2021-09-25 08:45:06 +02:00
|
|
|
|
if (constructionWindow != nullptr && constructionWindow->number == w->number)
|
2020-09-28 12:37:22 +02:00
|
|
|
|
{
|
|
|
|
|
window_close_by_class(WC_RIDE_CONSTRUCTION);
|
|
|
|
|
// Closing the construction window sets the tab to the first page, which we don't want here,
|
|
|
|
|
// as user just clicked the Vehicle page
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, WINDOW_RIDE_PAGE_VEHICLE);
|
2020-09-28 12:37:22 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Set listen only to viewport
|
|
|
|
|
listen = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (page == WINDOW_RIDE_PAGE_MAIN && w->page == WINDOW_RIDE_PAGE_MAIN && w->viewport != nullptr
|
|
|
|
|
&& !(w->viewport->flags & VIEWPORT_FLAG_SOUND_ON))
|
2017-06-06 23:24:18 +02:00
|
|
|
|
listen++;
|
2014-08-25 19:28:56 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->page = page;
|
|
|
|
|
w->frame_no = 0;
|
2020-03-01 21:51:29 +01:00
|
|
|
|
w->picked_peep_frame = 0;
|
2015-04-14 19:35:26 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
// There doesn't seem to be any need for this call, and it can sometimes modify the reported number of cars per train, so
|
2019-01-18 11:46:18 +01:00
|
|
|
|
// I've removed it if (page == WINDOW_RIDE_PAGE_VEHICLE) { ride_update_max_vehicles(ride);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
//}
|
2015-04-14 19:35:26 +02:00
|
|
|
|
|
2020-10-06 11:27:56 +02:00
|
|
|
|
w->RemoveViewport();
|
2014-08-25 19:28:56 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->hold_down_widgets = window_ride_page_hold_down_widgets[page];
|
|
|
|
|
w->event_handlers = window_ride_page_events[page];
|
|
|
|
|
w->pressed_widgets = 0;
|
|
|
|
|
w->widgets = window_ride_page_widgets[page];
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDisableTabs(w);
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2014-08-25 19:28:56 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_event_resize_call(w);
|
|
|
|
|
window_event_invalidate_call(w);
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2014-08-25 19:28:56 +02:00
|
|
|
|
|
2017-08-15 10:07:44 +02:00
|
|
|
|
if (listen != 0 && w->viewport != nullptr)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideSetPressedTab(rct_window* w)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t i;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
for (i = 0; i < WINDOW_RIDE_PAGE_COUNT; i++)
|
|
|
|
|
w->pressed_widgets &= ~(1 << (WIDX_TAB_1 + i));
|
|
|
|
|
w->pressed_widgets |= 1LL << (WIDX_TAB_1 + w->page);
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideAnchorBorderWidgets(rct_window* w)
|
2014-08-25 23:06:51 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets[WIDX_BACKGROUND].right = w->width - 1;
|
|
|
|
|
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
|
|
|
|
w->widgets[WIDX_PAGE_BACKGROUND].right = w->width - 1;
|
|
|
|
|
w->widgets[WIDX_PAGE_BACKGROUND].bottom = w->height - 1;
|
|
|
|
|
w->widgets[WIDX_TITLE].right = w->width - 2;
|
|
|
|
|
w->widgets[WIDX_CLOSE].left = w->width - 13;
|
|
|
|
|
w->widgets[WIDX_CLOSE].right = w->width - 3;
|
2014-08-25 23:06:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
#pragma region Main
|
|
|
|
|
|
2021-08-12 18:20:15 +02:00
|
|
|
|
static std::optional<StationIndex> GetStationIndexFromViewSelection(const rct_window& w)
|
|
|
|
|
{
|
2022-01-19 15:54:57 +01:00
|
|
|
|
const auto* ride = get_ride(RideId::FromUnderlying(w.number));
|
2021-08-12 18:20:15 +02:00
|
|
|
|
if (ride == nullptr)
|
2021-09-13 23:24:57 +02:00
|
|
|
|
return std::nullopt;
|
2021-08-12 18:20:15 +02:00
|
|
|
|
|
|
|
|
|
int32_t viewSelectionIndex = w.ride.view - 1 - ride->num_vehicles;
|
|
|
|
|
if (viewSelectionIndex < 0)
|
|
|
|
|
{
|
2021-09-13 23:24:57 +02:00
|
|
|
|
return std::nullopt;
|
2021-08-12 18:20:15 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-28 10:04:16 +01:00
|
|
|
|
for (const auto& station : ride->GetStations())
|
2021-08-12 18:20:15 +02:00
|
|
|
|
{
|
2022-01-28 10:04:16 +01:00
|
|
|
|
if (!station.Start.IsNull() && viewSelectionIndex-- == 0)
|
2021-08-12 18:20:15 +02:00
|
|
|
|
{
|
2022-01-28 10:04:16 +01:00
|
|
|
|
const auto stationIndex = ride->GetStationIndex(&station);
|
|
|
|
|
return std::make_optional(stationIndex);
|
2021-08-12 18:20:15 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-13 23:24:57 +02:00
|
|
|
|
return std::nullopt;
|
2021-08-12 18:20:15 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-03 20:13:37 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF994
|
2014-09-03 20:13:37 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideInitViewport(rct_window* w)
|
2014-09-03 20:13:37 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->page != WINDOW_RIDE_PAGE_MAIN)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 15:20:59 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-09-18 21:34:38 +02:00
|
|
|
|
int32_t viewSelectionIndex = w->ride.view - 1;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-21 11:06:04 +02:00
|
|
|
|
std::optional<Focus> focus;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-07-30 17:34:42 +02:00
|
|
|
|
if (viewSelectionIndex >= 0 && viewSelectionIndex < ride->num_vehicles && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2022-02-12 22:31:06 +01:00
|
|
|
|
auto vehId = ride->vehicles[viewSelectionIndex];
|
2019-04-20 22:22:39 +02:00
|
|
|
|
rct_ride_entry* ride_entry = ride->GetRideEntry();
|
2021-09-25 08:45:06 +02:00
|
|
|
|
if (ride_entry != nullptr && ride_entry->tab_vehicle != 0)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-09-18 21:34:38 +02:00
|
|
|
|
Vehicle* vehicle = GetEntity<Vehicle>(vehId);
|
2019-08-01 11:11:59 +02:00
|
|
|
|
if (vehicle == nullptr)
|
|
|
|
|
{
|
2022-02-12 22:31:06 +01:00
|
|
|
|
vehId = EntityId::GetNull();
|
2019-08-01 11:11:59 +02:00
|
|
|
|
}
|
2022-02-12 22:31:06 +01:00
|
|
|
|
else if (!vehicle->next_vehicle_on_train.IsNull())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-09-18 21:34:38 +02:00
|
|
|
|
vehId = vehicle->next_vehicle_on_train;
|
2017-06-25 18:52:21 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-12 22:31:06 +01:00
|
|
|
|
if (!vehId.IsNull())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-09-21 11:06:04 +02:00
|
|
|
|
focus = Focus(vehId);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-30 17:34:42 +02:00
|
|
|
|
else if (viewSelectionIndex >= ride->num_vehicles && viewSelectionIndex < (ride->num_vehicles + ride->num_stations))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-08-12 18:20:15 +02:00
|
|
|
|
auto stationIndex = GetStationIndexFromViewSelection(*w);
|
|
|
|
|
if (stationIndex)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2022-01-28 00:34:04 +01:00
|
|
|
|
const auto location = ride->GetStation(*stationIndex).GetStart();
|
2021-09-21 11:06:04 +02:00
|
|
|
|
focus = Focus(location);
|
2021-07-30 17:34:42 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
2021-07-30 17:34:42 +02:00
|
|
|
|
if (viewSelectionIndex > 0)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-09-18 21:34:38 +02:00
|
|
|
|
w->ride.view = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2019-08-03 18:27:50 +02:00
|
|
|
|
if (w->number < ride_overall_views.size())
|
|
|
|
|
{
|
|
|
|
|
const auto& view = ride_overall_views[w->number];
|
2021-09-21 11:06:04 +02:00
|
|
|
|
focus = Focus(view.loc, view.zoom);
|
2019-08-03 18:27:50 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint16_t viewport_flags = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->viewport != nullptr)
|
|
|
|
|
{
|
2021-09-21 11:06:04 +02:00
|
|
|
|
if (focus == w->focus)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
viewport_flags = w->viewport->flags;
|
2020-10-06 11:27:56 +02:00
|
|
|
|
w->RemoveViewport();
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else if (gConfigGeneral.always_show_gridlines)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
viewport_flags |= VIEWPORT_FLAG_GRIDLINES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
|
2021-09-21 11:06:04 +02:00
|
|
|
|
w->focus = focus;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
// rct2: 0x006aec9c only used here so brought it into the function
|
2022-01-03 11:11:34 +01:00
|
|
|
|
if (w->viewport == nullptr && !ride->overall_view.IsNull() && w->focus.has_value())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-10-01 01:15:07 +02:00
|
|
|
|
const auto& view_widget = w->widgets[WIDX_VIEWPORT];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-10-01 01:15:07 +02:00
|
|
|
|
auto screenPos = w->windowPos + ScreenCoordsXY{ view_widget.left + 1, view_widget.top + 1 };
|
|
|
|
|
int32_t width = view_widget.width() - 1;
|
|
|
|
|
int32_t height = view_widget.height() - 1;
|
2021-09-18 21:34:38 +02:00
|
|
|
|
|
2021-09-21 11:06:04 +02:00
|
|
|
|
viewport_create(w, screenPos, width, height, w->focus.value());
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
w->flags |= WF_NO_SCROLLING;
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2021-09-25 08:45:06 +02:00
|
|
|
|
if (w->viewport != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->viewport->flags = viewport_flags;
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-03 20:13:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-02 15:05:44 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF315
|
2014-09-02 15:05:44 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideRename(rct_window* w)
|
2014-09-02 15:05:44 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-07-20 20:43:02 +02:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
|
|
|
|
auto rideName = ride->GetName();
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowTextInputRawOpen(
|
2021-08-24 20:12:05 +02:00
|
|
|
|
w, WIDX_RENAME, STR_RIDE_ATTRACTION_NAME, STR_ENTER_NEW_NAME_FOR_THIS_RIDE_ATTRACTION, {}, rideName.c_str(), 32);
|
2019-07-20 20:43:02 +02:00
|
|
|
|
}
|
2014-09-02 15:05:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF17E
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMainMouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_CLOSE:
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_close(w);
|
|
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_TAB_1:
|
|
|
|
|
case WIDX_TAB_2:
|
|
|
|
|
case WIDX_TAB_3:
|
|
|
|
|
case WIDX_TAB_4:
|
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
|
case WIDX_TAB_6:
|
|
|
|
|
case WIDX_TAB_7:
|
|
|
|
|
case WIDX_TAB_8:
|
|
|
|
|
case WIDX_TAB_9:
|
|
|
|
|
case WIDX_TAB_10:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, widgetIndex - WIDX_TAB_1);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_CONSTRUCTION:
|
2019-08-09 19:29:34 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 19:29:34 +02:00
|
|
|
|
if (ride != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2019-08-09 19:29:34 +02:00
|
|
|
|
ride_construct(ride);
|
2022-01-19 15:54:57 +01:00
|
|
|
|
if (window_find_by_number(WC_RIDE_CONSTRUCTION, ride->id.ToUnderlying()) != nullptr)
|
2019-08-09 19:29:34 +02:00
|
|
|
|
{
|
|
|
|
|
window_close(w);
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
break;
|
2019-08-09 19:29:34 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_RENAME:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideRename(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_DEMOLISH:
|
|
|
|
|
context_open_detail_window(WD_DEMOLISH_RIDE, w->number);
|
|
|
|
|
break;
|
|
|
|
|
case WIDX_CLOSE_LIGHT:
|
2019-05-07 21:14:21 +02:00
|
|
|
|
case WIDX_SIMULATE_LIGHT:
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_TEST_LIGHT:
|
|
|
|
|
case WIDX_OPEN_LIGHT:
|
2019-08-09 19:29:34 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-02-13 00:58:45 +01:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
2021-06-10 08:09:58 +02:00
|
|
|
|
RideStatus status;
|
2019-08-09 19:29:34 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
case WIDX_CLOSE_LIGHT:
|
2021-06-10 08:09:58 +02:00
|
|
|
|
status = RideStatus::Closed;
|
2019-08-09 19:29:34 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_SIMULATE_LIGHT:
|
2021-06-10 08:09:58 +02:00
|
|
|
|
status = RideStatus::Simulating;
|
2019-08-09 19:29:34 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_TEST_LIGHT:
|
2021-06-10 08:09:58 +02:00
|
|
|
|
status = RideStatus::Testing;
|
2019-08-09 19:29:34 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_OPEN_LIGHT:
|
2021-06-10 08:09:58 +02:00
|
|
|
|
status = RideStatus::Open;
|
2019-08-09 19:29:34 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2019-02-13 00:58:45 +01:00
|
|
|
|
ride_set_status(ride, status);
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2019-08-09 19:29:34 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-03 20:13:37 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF4A2
|
2014-09-03 20:13:37 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMainResize(rct_window* w)
|
2014-09-03 20:13:37 +02:00
|
|
|
|
{
|
2019-05-08 18:41:29 +02:00
|
|
|
|
int32_t minHeight = 180;
|
2020-11-03 11:59:00 +01:00
|
|
|
|
if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE)
|
2019-05-08 18:41:29 +02:00
|
|
|
|
{
|
|
|
|
|
minHeight += 20 + RCT1_LIGHT_OFFSET;
|
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-05-08 18:41:29 +02:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
2019-05-23 19:41:17 +02:00
|
|
|
|
#ifdef __SIMULATE_IN_RIDE_WINDOW__
|
2021-06-10 08:09:58 +02:00
|
|
|
|
if (ride->SupportsStatus(RideStatus::Simulating))
|
2019-05-08 18:41:29 +02:00
|
|
|
|
{
|
|
|
|
|
minHeight += 14;
|
|
|
|
|
}
|
2019-05-23 19:41:17 +02:00
|
|
|
|
#endif
|
2021-06-10 08:09:58 +02:00
|
|
|
|
if (ride->SupportsStatus(RideStatus::Testing))
|
2019-05-08 18:41:29 +02:00
|
|
|
|
{
|
|
|
|
|
minHeight += 14;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (gCheatsAllowArbitraryRideTypeChanges)
|
|
|
|
|
{
|
|
|
|
|
minHeight += 15;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
w->flags |= WF_RESIZABLE;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_set_resize(w, 316, minHeight, 500, 450);
|
2021-09-21 11:06:04 +02:00
|
|
|
|
// Unlike with other windows, the focus needs to be recentred so it’s best to just reset it.
|
|
|
|
|
w->focus = std::nullopt;
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideInitViewport(w);
|
2014-09-03 20:13:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-01 13:04:34 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF825
|
2014-09-01 13:04:34 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideShowViewDropdown(rct_window* w, rct_widget* widget)
|
2014-09-01 13:04:34 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* dropdownWidget = widget - 1;
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t numItems = 1;
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
numItems += ride->num_stations;
|
|
|
|
|
numItems += ride->num_vehicles;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
|
|
|
|
w->colours[1], 0, 0, numItems, widget->right - dropdownWidget->left);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// First item
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[0].Args = STR_OVERALL_VIEW;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t currentItem = 1;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-12-12 22:53:50 +01:00
|
|
|
|
const auto& rtd = ride->GetRideTypeDescriptor();
|
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Vehicles
|
2020-12-12 22:53:50 +01:00
|
|
|
|
int32_t name = GetRideComponentName(rtd.NameConvention.vehicle).number;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t i = 1; i <= ride->num_vehicles; i++)
|
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[currentItem].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[currentItem].Args = name | (currentItem << 16);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
currentItem++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Stations
|
2020-12-12 22:53:50 +01:00
|
|
|
|
name = GetRideComponentName(rtd.NameConvention.station).number;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t i = 1; i <= ride->num_stations; i++)
|
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[currentItem].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[currentItem].Args = name | (i << 16);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
currentItem++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set highlighted item
|
2017-07-24 11:24:23 +02:00
|
|
|
|
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK))
|
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
for (int32_t i = 0; i < ride->num_vehicles; i++)
|
2017-07-24 11:24:23 +02:00
|
|
|
|
{
|
|
|
|
|
// The +1 is to skip 'Overall view'
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetDisabled(i + 1, true);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set checked item
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(w->ride.view, true);
|
2014-09-01 13:04:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static RideStatus WindowRideGetNextDefaultStatus(const Ride* ride)
|
2014-09-01 13:04:34 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (ride->status)
|
|
|
|
|
{
|
2019-05-23 19:41:17 +02:00
|
|
|
|
default:
|
2021-06-10 08:09:58 +02:00
|
|
|
|
case RideStatus::Closed:
|
2019-05-23 19:41:17 +02:00
|
|
|
|
if ((ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)
|
|
|
|
|
|| (ride->lifecycle_flags & RIDE_LIFECYCLE_HAS_STALLED_VEHICLE))
|
2019-05-08 18:41:29 +02:00
|
|
|
|
{
|
2021-06-10 08:09:58 +02:00
|
|
|
|
return RideStatus::Closed;
|
2019-05-08 18:41:29 +02:00
|
|
|
|
}
|
2021-09-15 22:22:15 +02:00
|
|
|
|
if (ride->SupportsStatus(RideStatus::Testing) && !(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
|
2019-05-08 18:41:29 +02:00
|
|
|
|
{
|
2021-06-10 08:09:58 +02:00
|
|
|
|
return RideStatus::Testing;
|
2019-05-08 18:41:29 +02:00
|
|
|
|
}
|
2021-09-15 22:22:15 +02:00
|
|
|
|
return RideStatus::Open;
|
2021-06-10 08:09:58 +02:00
|
|
|
|
case RideStatus::Simulating:
|
|
|
|
|
return RideStatus::Testing;
|
|
|
|
|
case RideStatus::Testing:
|
|
|
|
|
return (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED) ? RideStatus::Open : RideStatus::Closed;
|
|
|
|
|
case RideStatus::Open:
|
|
|
|
|
return RideStatus::Closed;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2019-05-23 19:41:17 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2019-05-23 19:41:17 +02:00
|
|
|
|
struct RideStatusDropdownInfo
|
|
|
|
|
{
|
|
|
|
|
struct Ride* Ride{};
|
2021-06-10 08:09:58 +02:00
|
|
|
|
RideStatus CurrentStatus{};
|
|
|
|
|
RideStatus DefaultStatus{};
|
2019-05-23 19:41:17 +02:00
|
|
|
|
|
|
|
|
|
int32_t NumItems{};
|
|
|
|
|
int32_t CheckedIndex = -1;
|
|
|
|
|
int32_t DefaultIndex = -1;
|
|
|
|
|
};
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideSetDropdown(RideStatusDropdownInfo& info, RideStatus status, rct_string_id text)
|
2019-05-23 19:41:17 +02:00
|
|
|
|
{
|
|
|
|
|
if (info.Ride->SupportsStatus(status))
|
|
|
|
|
{
|
|
|
|
|
auto index = info.NumItems;
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[index].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[index].Args = text;
|
2019-05-23 19:41:17 +02:00
|
|
|
|
if (info.CurrentStatus == status)
|
|
|
|
|
{
|
|
|
|
|
info.CheckedIndex = index;
|
|
|
|
|
}
|
|
|
|
|
if (info.DefaultStatus == status)
|
|
|
|
|
{
|
|
|
|
|
info.DefaultIndex = index;
|
|
|
|
|
}
|
|
|
|
|
info.NumItems++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideShowOpenDropdown(rct_window* w, rct_widget* widget)
|
2019-05-23 19:41:17 +02:00
|
|
|
|
{
|
|
|
|
|
RideStatusDropdownInfo info;
|
2021-09-04 18:04:53 +02:00
|
|
|
|
info.Ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (info.Ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2019-05-23 19:41:17 +02:00
|
|
|
|
info.CurrentStatus = info.Ride->status;
|
2021-11-23 14:18:07 +01:00
|
|
|
|
info.DefaultStatus = WindowRideGetNextDefaultStatus(info.Ride);
|
|
|
|
|
WindowRideSetDropdown(info, RideStatus::Closed, STR_CLOSE_RIDE);
|
2019-05-23 19:41:17 +02:00
|
|
|
|
#ifdef __SIMULATE_IN_RIDE_WINDOW__
|
2021-06-10 08:09:58 +02:00
|
|
|
|
window_ride_set_dropdown(info, RideStatus::Simulating, STR_SIMULATE_RIDE);
|
2019-05-23 19:41:17 +02:00
|
|
|
|
#endif
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetDropdown(info, RideStatus::Testing, STR_TEST_RIDE);
|
|
|
|
|
WindowRideSetDropdown(info, RideStatus::Open, STR_OPEN_RIDE);
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowText(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0, info.NumItems);
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(info.CheckedIndex, true);
|
2019-05-23 19:41:17 +02:00
|
|
|
|
gDropdownDefaultIndex = info.DefaultIndex;
|
2014-09-01 13:04:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static rct_string_id GetRideTypeNameForDropdown(uint8_t rideType)
|
2020-06-16 22:50:58 +02:00
|
|
|
|
{
|
|
|
|
|
switch (rideType)
|
|
|
|
|
{
|
|
|
|
|
case RIDE_TYPE_1D:
|
|
|
|
|
return STR_RIDE_NAME_1D;
|
|
|
|
|
case RIDE_TYPE_1F:
|
|
|
|
|
return STR_RIDE_NAME_1F;
|
|
|
|
|
case RIDE_TYPE_22:
|
|
|
|
|
return STR_RIDE_NAME_22;
|
|
|
|
|
case RIDE_TYPE_50:
|
|
|
|
|
return STR_RIDE_NAME_50;
|
|
|
|
|
case RIDE_TYPE_52:
|
|
|
|
|
return STR_RIDE_NAME_52;
|
|
|
|
|
case RIDE_TYPE_53:
|
|
|
|
|
return STR_RIDE_NAME_53;
|
|
|
|
|
case RIDE_TYPE_54:
|
|
|
|
|
return STR_RIDE_NAME_54;
|
|
|
|
|
case RIDE_TYPE_55:
|
|
|
|
|
return STR_RIDE_NAME_55;
|
|
|
|
|
case RIDE_TYPE_59:
|
|
|
|
|
return STR_RIDE_NAME_59;
|
|
|
|
|
default:
|
2021-02-26 10:01:00 +01:00
|
|
|
|
return GetRideTypeDescriptor(rideType).Naming.Name;
|
2020-06-16 22:50:58 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void PopulateRideTypeDropdown()
|
2018-05-29 19:09:29 +02:00
|
|
|
|
{
|
|
|
|
|
auto& ls = OpenRCT2::GetContext()->GetLocalisationService();
|
|
|
|
|
if (RideDropdownDataLanguage == ls.GetCurrentLanguage())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
RideDropdownData.clear();
|
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
for (uint8_t i = 0; i < RIDE_TYPE_COUNT; i++)
|
2018-05-29 19:09:29 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
auto name = GetRideTypeNameForDropdown(i);
|
2021-01-08 21:59:55 +01:00
|
|
|
|
RideDropdownData.push_back({ i, name, ls.GetString(name) });
|
2018-05-29 19:09:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
std::sort(RideDropdownData.begin(), RideDropdownData.end(), [](auto& a, auto& b) {
|
2019-05-11 13:06:29 +02:00
|
|
|
|
return String::Compare(a.label_string, b.label_string, true) < 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
});
|
2018-06-01 20:13:47 +02:00
|
|
|
|
|
|
|
|
|
RideDropdownDataLanguage = ls.GetCurrentLanguage();
|
2018-05-29 19:09:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideShowRideTypeDropdown(rct_window* w, rct_widget* widget)
|
2017-07-25 13:25:31 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
PopulateRideTypeDropdown();
|
2018-05-29 19:09:29 +02:00
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < RideDropdownData.size(); i++)
|
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[i].Args = RideDropdownData[i].label_id;
|
2017-07-25 13:25:31 +02:00
|
|
|
|
}
|
2017-08-06 16:01:20 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* dropdownWidget = widget - 1;
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowText(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], Dropdown::Flag::StayOpen, RIDE_TYPE_COUNT);
|
2017-07-25 13:25:31 +02:00
|
|
|
|
|
2018-05-29 19:09:29 +02:00
|
|
|
|
// Find the current ride type in the ordered list.
|
2022-02-12 19:44:01 +01:00
|
|
|
|
int32_t pos = 0;
|
|
|
|
|
for (int32_t i = 0; i < RIDE_TYPE_COUNT; i++)
|
2018-05-29 19:09:29 +02:00
|
|
|
|
{
|
2018-06-14 20:15:31 +02:00
|
|
|
|
if (RideDropdownData[i].ride_type_id == ride->type)
|
2018-05-29 19:09:29 +02:00
|
|
|
|
{
|
|
|
|
|
pos = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gDropdownHighlightedIndex = pos;
|
|
|
|
|
gDropdownDefaultIndex = pos;
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(pos, true);
|
2017-07-25 13:25:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideShowLocateDropdown(rct_window* w, rct_widget* widget)
|
2021-08-01 20:14:38 +02:00
|
|
|
|
{
|
|
|
|
|
auto ride = get_ride(w->rideId);
|
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[0].Format = STR_LOCATE_SUBJECT_TIP;
|
|
|
|
|
gDropdownItems[1].Format = STR_FOLLOW_SUBJECT_TIP;
|
2021-08-01 20:14:38 +02:00
|
|
|
|
|
|
|
|
|
WindowDropdownShowText(
|
|
|
|
|
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0, 2);
|
|
|
|
|
gDropdownDefaultIndex = 0;
|
2022-03-02 20:05:53 +01:00
|
|
|
|
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK) || w->ride.view == 0
|
|
|
|
|
|| w->ride.view > ride->num_vehicles)
|
2021-08-01 20:14:38 +02:00
|
|
|
|
{
|
2022-03-02 20:05:53 +01:00
|
|
|
|
// Disable if we're a flat ride, 'overall view' is selected or a station is selected
|
2021-08-01 20:14:38 +02:00
|
|
|
|
Dropdown::SetDisabled(1, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMainFollowRide(rct_window* w)
|
2021-08-01 20:14:38 +02:00
|
|
|
|
{
|
2022-02-12 22:31:06 +01:00
|
|
|
|
auto* ride = get_ride(w->rideId);
|
2021-08-01 20:14:38 +02:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
|
|
|
|
if (!(ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_MAIN))
|
|
|
|
|
{
|
|
|
|
|
if (w->ride.view > 0)
|
|
|
|
|
{
|
|
|
|
|
if (w->ride.view <= ride->num_vehicles)
|
|
|
|
|
{
|
|
|
|
|
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[w->ride.view - 1]);
|
|
|
|
|
if (vehicle != nullptr)
|
|
|
|
|
{
|
2022-02-12 22:31:06 +01:00
|
|
|
|
auto headVehicleSpriteIndex = vehicle->sprite_index;
|
2021-08-01 20:14:38 +02:00
|
|
|
|
rct_window* w_main = window_get_main();
|
|
|
|
|
window_follow_sprite(w_main, headVehicleSpriteIndex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void PopulateVehicleTypeDropdown(Ride* ride, bool forceRefresh)
|
2018-06-01 18:48:27 +02:00
|
|
|
|
{
|
2020-03-20 18:07:31 +01:00
|
|
|
|
auto& objManager = GetContext()->GetObjectManager();
|
2019-04-20 22:22:39 +02:00
|
|
|
|
rct_ride_entry* rideEntry = ride->GetRideEntry();
|
2018-06-01 18:48:27 +02:00
|
|
|
|
|
|
|
|
|
bool selectionShouldBeExpanded;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t rideTypeIterator, rideTypeIteratorMax;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (gCheatsShowVehiclesFromOtherTrackTypes
|
2019-11-04 14:02:30 +01:00
|
|
|
|
&& !(
|
2021-02-24 13:53:01 +01:00
|
|
|
|
ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) || ride->type == RIDE_TYPE_MAZE
|
2019-11-04 14:02:30 +01:00
|
|
|
|
|| ride->type == RIDE_TYPE_MINI_GOLF))
|
2018-06-01 18:48:27 +02:00
|
|
|
|
{
|
|
|
|
|
selectionShouldBeExpanded = true;
|
|
|
|
|
rideTypeIterator = 0;
|
|
|
|
|
rideTypeIteratorMax = RIDE_TYPE_COUNT - 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
selectionShouldBeExpanded = false;
|
|
|
|
|
rideTypeIterator = ride->type;
|
|
|
|
|
rideTypeIteratorMax = ride->type;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-01 20:13:47 +02:00
|
|
|
|
// Don't repopulate the list if we just did.
|
|
|
|
|
auto& ls = OpenRCT2::GetContext()->GetLocalisationService();
|
2021-10-27 11:30:55 +02:00
|
|
|
|
if (!forceRefresh && VehicleDropdownExpanded == selectionShouldBeExpanded && VehicleDropdownRideType == rideEntry
|
2018-06-22 23:21:44 +02:00
|
|
|
|
&& VehicleDropdownDataLanguage == ls.GetCurrentLanguage())
|
2018-06-01 20:13:47 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
VehicleDropdownData.clear();
|
|
|
|
|
|
|
|
|
|
for (; rideTypeIterator <= rideTypeIteratorMax; rideTypeIterator++)
|
2018-06-01 18:48:27 +02:00
|
|
|
|
{
|
2021-02-26 09:49:09 +01:00
|
|
|
|
if (selectionShouldBeExpanded && GetRideTypeDescriptor(rideTypeIterator).HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE))
|
2018-06-01 18:48:27 +02:00
|
|
|
|
continue;
|
|
|
|
|
if (selectionShouldBeExpanded && (rideTypeIterator == RIDE_TYPE_MAZE || rideTypeIterator == RIDE_TYPE_MINI_GOLF))
|
|
|
|
|
continue;
|
|
|
|
|
|
2020-03-20 18:07:31 +01:00
|
|
|
|
auto& rideEntries = objManager.GetAllRideEntries(rideTypeIterator);
|
|
|
|
|
for (auto rideEntryIndex : rideEntries)
|
2018-06-01 18:48:27 +02:00
|
|
|
|
{
|
2022-01-01 15:07:42 +01:00
|
|
|
|
const auto* currentRideEntry = get_ride_entry(rideEntryIndex);
|
|
|
|
|
if (currentRideEntry == nullptr)
|
|
|
|
|
continue;
|
2018-06-01 18:48:27 +02:00
|
|
|
|
|
|
|
|
|
// Skip if vehicle type has not been invented yet
|
|
|
|
|
if (!ride_entry_is_invented(rideEntryIndex) && !gCheatsIgnoreResearchStatus)
|
|
|
|
|
continue;
|
|
|
|
|
|
2021-01-08 21:59:55 +01:00
|
|
|
|
VehicleDropdownData.push_back(
|
|
|
|
|
{ rideEntryIndex, currentRideEntry->naming.Name, ls.GetString(currentRideEntry->naming.Name) });
|
2018-06-01 20:13:47 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-01 18:48:27 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
std::sort(VehicleDropdownData.begin(), VehicleDropdownData.end(), [](auto& a, auto& b) {
|
2019-05-11 13:06:29 +02:00
|
|
|
|
return String::Compare(a.label_string, b.label_string, true) < 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
});
|
2018-06-01 18:48:27 +02:00
|
|
|
|
|
2018-06-01 20:13:47 +02:00
|
|
|
|
VehicleDropdownExpanded = selectionShouldBeExpanded;
|
|
|
|
|
VehicleDropdownRideType = rideEntry;
|
|
|
|
|
VehicleDropdownDataLanguage = ls.GetCurrentLanguage();
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideShowVehicleTypeDropdown(rct_window* w, rct_widget* widget)
|
2018-06-01 20:13:47 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
PopulateVehicleTypeDropdown(ride);
|
2018-06-01 20:13:47 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
size_t numItems = std::min<size_t>(VehicleDropdownData.size(), Dropdown::ItemsMaxSize);
|
2018-06-01 20:13:47 +02:00
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < numItems; i++)
|
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[i].Args = VehicleDropdownData[i].label_id;
|
2018-06-01 18:48:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* dropdownWidget = widget - 1;
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], 0, Dropdown::Flag::StayOpen, numItems, widget->right - dropdownWidget->left);
|
2018-06-01 18:48:27 +02:00
|
|
|
|
|
2018-06-01 20:13:47 +02:00
|
|
|
|
// Find the current vehicle type in the ordered list.
|
2022-02-12 19:44:01 +01:00
|
|
|
|
int32_t pos = 0;
|
|
|
|
|
for (int32_t i = 0; i < static_cast<int32_t>(VehicleDropdownData.size()); i++)
|
2018-06-01 20:13:47 +02:00
|
|
|
|
{
|
|
|
|
|
if (VehicleDropdownData[i].subtype_id == ride->subtype)
|
|
|
|
|
{
|
|
|
|
|
pos = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gDropdownHighlightedIndex = pos;
|
|
|
|
|
gDropdownDefaultIndex = pos;
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(pos, true);
|
2018-06-01 18:48:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF1BD
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMainMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_VIEW_DROPDOWN:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideShowViewDropdown(w, widget);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_OPEN:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideShowOpenDropdown(w, widget);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_RIDE_TYPE_DROPDOWN:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideShowRideTypeDropdown(w, widget);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2021-08-01 20:14:38 +02:00
|
|
|
|
case WIDX_LOCATE:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideShowLocateDropdown(w, widget);
|
2021-08-01 20:14:38 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF300
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMainDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_VIEW_DROPDOWN:
|
|
|
|
|
if (dropdownIndex == -1)
|
|
|
|
|
{
|
2019-05-08 18:41:29 +02:00
|
|
|
|
dropdownIndex = w->ride.view + 1;
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-05-08 18:41:29 +02:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
|
|
|
|
if (dropdownIndex != 0 && dropdownIndex <= ride->num_vehicles
|
|
|
|
|
&& !(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK))
|
|
|
|
|
{
|
|
|
|
|
dropdownIndex = ride->num_vehicles + 1;
|
|
|
|
|
}
|
|
|
|
|
if (dropdownIndex >= gDropdownNumItems)
|
|
|
|
|
{
|
|
|
|
|
dropdownIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
w->ride.view = dropdownIndex;
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideInitViewport(w);
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_OPEN:
|
2019-05-08 18:41:29 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-05-08 18:41:29 +02:00
|
|
|
|
if (ride != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-06-10 08:09:58 +02:00
|
|
|
|
auto status = RideStatus::Closed;
|
2019-05-23 19:41:17 +02:00
|
|
|
|
if (dropdownIndex < 0)
|
2019-05-08 18:41:29 +02:00
|
|
|
|
{
|
|
|
|
|
dropdownIndex = gDropdownHighlightedIndex;
|
|
|
|
|
}
|
2022-02-12 23:57:22 +01:00
|
|
|
|
if (dropdownIndex < static_cast<int32_t>(std::size(gDropdownItems)))
|
2019-05-08 18:41:29 +02:00
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
switch (gDropdownItems[dropdownIndex].Args)
|
2019-05-23 19:41:17 +02:00
|
|
|
|
{
|
|
|
|
|
case STR_CLOSE_RIDE:
|
2021-06-10 08:09:58 +02:00
|
|
|
|
status = RideStatus::Closed;
|
2019-05-23 19:41:17 +02:00
|
|
|
|
break;
|
|
|
|
|
case STR_SIMULATE_RIDE:
|
2021-06-10 08:09:58 +02:00
|
|
|
|
status = RideStatus::Simulating;
|
2019-05-23 19:41:17 +02:00
|
|
|
|
break;
|
|
|
|
|
case STR_TEST_RIDE:
|
2021-06-10 08:09:58 +02:00
|
|
|
|
status = RideStatus::Testing;
|
2019-05-23 19:41:17 +02:00
|
|
|
|
break;
|
|
|
|
|
case STR_OPEN_RIDE:
|
2021-06-10 08:09:58 +02:00
|
|
|
|
status = RideStatus::Open;
|
2019-05-23 19:41:17 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2019-05-08 18:41:29 +02:00
|
|
|
|
}
|
|
|
|
|
ride_set_status(ride, status);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
break;
|
2019-05-08 18:41:29 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_RIDE_TYPE_DROPDOWN:
|
|
|
|
|
if (dropdownIndex != -1 && dropdownIndex < RIDE_TYPE_COUNT)
|
2018-05-29 11:04:17 +02:00
|
|
|
|
{
|
2022-02-12 19:44:01 +01:00
|
|
|
|
auto rideLabelId = std::clamp(dropdownIndex, 0, RIDE_TYPE_COUNT - 1);
|
|
|
|
|
auto rideType = RideDropdownData[rideLabelId].ride_type_id;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (rideType < RIDE_TYPE_COUNT)
|
|
|
|
|
{
|
2021-09-06 15:40:12 +02:00
|
|
|
|
auto rideSetSetting = RideSetSettingAction(w->rideId, RideSetSetting::RideType, rideType);
|
2020-10-15 03:04:39 +02:00
|
|
|
|
rideSetSetting.SetCallback([](const GameAction* ga, const GameActions::Result* result) {
|
2020-08-16 19:48:21 +02:00
|
|
|
|
// Reset ghost track if ride construction window is open, prevents a crash
|
|
|
|
|
// Will get set to the correct Alternative variable during set_default_next_piece.
|
|
|
|
|
// TODO: Rework construction window to prevent the need for this.
|
|
|
|
|
_currentTrackAlternative = RIDE_TYPE_NO_ALTERNATIVES;
|
|
|
|
|
ride_construction_set_default_next_piece();
|
|
|
|
|
});
|
|
|
|
|
GameActions::Execute(&rideSetSetting);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
2018-05-29 11:04:17 +02:00
|
|
|
|
}
|
2021-08-01 20:14:38 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_LOCATE:
|
|
|
|
|
{
|
|
|
|
|
if (dropdownIndex == 0)
|
|
|
|
|
{
|
|
|
|
|
w->ScrollToViewport();
|
|
|
|
|
}
|
|
|
|
|
else if (dropdownIndex == 1)
|
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideMainFollowRide(w);
|
2021-08-01 20:14:38 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF40F
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMainUpdate(rct_window* w)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Update tab animation
|
|
|
|
|
w->frame_no++;
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_1);
|
|
|
|
|
|
|
|
|
|
// Update status
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (!(ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_MAIN))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (w->ride.view == 0)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
|
|
|
|
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (w->ride.view <= ride->num_vehicles)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-08-02 09:28:11 +02:00
|
|
|
|
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[w->ride.view - 1]);
|
2020-07-09 23:52:14 +02:00
|
|
|
|
if (vehicle == nullptr
|
2020-08-09 07:24:25 +02:00
|
|
|
|
|| (vehicle->status != Vehicle::Status::Travelling
|
|
|
|
|
&& vehicle->status != Vehicle::Status::TravellingCableLift
|
|
|
|
|
&& vehicle->status != Vehicle::Status::TravellingDodgems
|
|
|
|
|
&& vehicle->status != Vehicle::Status::TravellingBoat))
|
2019-08-09 09:06:25 +02:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-09 09:06:25 +02:00
|
|
|
|
ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_MAIN;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
widget_invalidate(w, WIDX_STATUS);
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF2F9
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMainTextinput(rct_window* w, rct_widgetindex widgetIndex, char* text)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2017-08-15 10:07:44 +02:00
|
|
|
|
if (widgetIndex != WIDX_RENAME || text == nullptr)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
2014-08-25 19:28:56 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-02-13 00:58:45 +01:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
|
|
|
|
ride_set_name(ride, text, 0);
|
|
|
|
|
}
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-04 00:19:13 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF55A
|
2014-09-04 00:19:13 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMainViewportRotate(rct_window* w)
|
2014-09-04 00:19:13 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideInitViewport(w);
|
2014-09-04 00:19:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AECF6
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMainInvalidate(rct_window* w)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* widgets;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t i, height;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
widgets = window_ride_page_widgets[w->page];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->widgets != widgets)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = widgets;
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPressedTab(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->disabled_widgets &= ~((1ULL << WIDX_DEMOLISH) | (1ULL << WIDX_CONSTRUCTION));
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK))
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->disabled_widgets |= (1ULL << WIDX_DEMOLISH);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-06-25 02:02:08 +02:00
|
|
|
|
auto ft = Formatter::Common();
|
|
|
|
|
ride->FormatNameTo(ft);
|
2019-07-21 02:28:33 +02:00
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint32_t spriteIds[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
|
SPR_CLOSED,
|
|
|
|
|
SPR_OPEN,
|
|
|
|
|
SPR_TESTING,
|
2019-05-25 11:25:50 +02:00
|
|
|
|
SPR_G2_SIMULATE,
|
2017-06-06 23:24:18 +02:00
|
|
|
|
};
|
2021-06-10 08:09:58 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_OPEN].image = spriteIds[EnumValue(ride->status)];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2019-05-23 19:41:17 +02:00
|
|
|
|
#ifdef __SIMULATE_IN_RIDE_WINDOW__
|
2021-06-10 08:09:58 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + (ride->status == RideStatus::Closed) * 2
|
2020-11-03 22:29:22 +01:00
|
|
|
|
+ WidgetIsPressed(w, WIDX_CLOSE_LIGHT);
|
2019-05-25 14:15:42 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_SIMULATE_LIGHT].image = SPR_G2_RCT1_SIMULATE_BUTTON_0
|
2021-06-10 08:09:58 +02:00
|
|
|
|
+ (ride->status == RideStatus::Simulating) * 2 + WidgetIsPressed(w, WIDX_SIMULATE_LIGHT);
|
|
|
|
|
window_ride_main_widgets[WIDX_TEST_LIGHT].image = SPR_G2_RCT1_TEST_BUTTON_0 + (ride->status == RideStatus::Testing) * 2
|
2020-11-03 22:29:22 +01:00
|
|
|
|
+ WidgetIsPressed(w, WIDX_TEST_LIGHT);
|
2019-05-23 19:41:17 +02:00
|
|
|
|
#else
|
2021-06-10 08:09:58 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + (ride->status == RideStatus::Closed) * 2
|
2020-11-03 22:29:22 +01:00
|
|
|
|
+ WidgetIsPressed(w, WIDX_CLOSE_LIGHT);
|
2019-05-25 14:15:42 +02:00
|
|
|
|
|
2021-06-10 08:09:58 +02:00
|
|
|
|
auto baseSprite = ride->status == RideStatus::Simulating ? SPR_G2_RCT1_SIMULATE_BUTTON_0 : SPR_G2_RCT1_TEST_BUTTON_0;
|
2019-05-25 14:15:42 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_TEST_LIGHT].image = baseSprite
|
2021-06-10 08:09:58 +02:00
|
|
|
|
+ (ride->status == RideStatus::Testing || ride->status == RideStatus::Simulating) * 2
|
2020-11-03 22:29:22 +01:00
|
|
|
|
+ WidgetIsPressed(w, WIDX_TEST_LIGHT);
|
2019-05-25 14:15:42 +02:00
|
|
|
|
#endif
|
2021-06-10 08:09:58 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_OPEN_LIGHT].image = SPR_G2_RCT1_OPEN_BUTTON_0 + (ride->status == RideStatus::Open) * 2
|
2020-11-03 22:29:22 +01:00
|
|
|
|
+ WidgetIsPressed(w, WIDX_OPEN_LIGHT);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideAnchorBorderWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
const int32_t offset = gCheatsAllowArbitraryRideTypeChanges ? 15 : 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Anchor main page specific widgets
|
|
|
|
|
window_ride_main_widgets[WIDX_VIEWPORT].right = w->width - 26;
|
|
|
|
|
window_ride_main_widgets[WIDX_VIEWPORT].bottom = w->height - (14 + offset);
|
|
|
|
|
window_ride_main_widgets[WIDX_STATUS].right = w->width - 26;
|
|
|
|
|
window_ride_main_widgets[WIDX_STATUS].top = w->height - (13 + offset);
|
|
|
|
|
window_ride_main_widgets[WIDX_STATUS].bottom = w->height - (3 + offset);
|
|
|
|
|
window_ride_main_widgets[WIDX_VIEW].right = w->width - 60;
|
|
|
|
|
window_ride_main_widgets[WIDX_VIEW_DROPDOWN].right = w->width - 61;
|
|
|
|
|
window_ride_main_widgets[WIDX_VIEW_DROPDOWN].left = w->width - 71;
|
2018-05-29 11:04:17 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE].right = w->width - 26;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE].top = w->height - 17;
|
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE].bottom = w->height - 4;
|
2018-05-29 11:04:17 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE_DROPDOWN].left = w->width - 37;
|
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE_DROPDOWN].right = w->width - 27;
|
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE_DROPDOWN].top = w->height - 16;
|
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE_DROPDOWN].bottom = w->height - 5;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (!gCheatsAllowArbitraryRideTypeChanges)
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE_DROPDOWN].type = WindowWidgetType::Empty;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE].type = WindowWidgetType::DropdownMenu;
|
2021-02-24 14:02:58 +01:00
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE].text = ride->GetRideTypeDescriptor().Naming.Name;
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_main_widgets[WIDX_RIDE_TYPE_DROPDOWN].type = WindowWidgetType::Button;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
|
|
|
|
|
2020-11-03 11:59:00 +01:00
|
|
|
|
if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_main_widgets[WIDX_OPEN].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_main_widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::ImgBtn;
|
|
|
|
|
window_ride_main_widgets[WIDX_SIMULATE_LIGHT].type = WindowWidgetType::Empty;
|
2019-05-23 19:41:17 +02:00
|
|
|
|
#ifdef __SIMULATE_IN_RIDE_WINDOW__
|
2021-06-10 08:09:58 +02:00
|
|
|
|
if (ride->SupportsStatus(RideStatus::Simulating))
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_main_widgets[WIDX_SIMULATE_LIGHT].type = WindowWidgetType::ImgBtn;
|
2019-05-23 19:41:17 +02:00
|
|
|
|
#endif
|
2021-06-10 08:09:58 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_TEST_LIGHT].type = ride->SupportsStatus(RideStatus::Testing) ? WindowWidgetType::ImgBtn
|
2020-11-27 04:14:20 +01:00
|
|
|
|
: WindowWidgetType::Empty;
|
|
|
|
|
window_ride_main_widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::ImgBtn;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
height = 62;
|
2020-11-27 04:14:20 +01:00
|
|
|
|
if (window_ride_main_widgets[WIDX_SIMULATE_LIGHT].type != WindowWidgetType::Empty)
|
2019-05-07 21:14:21 +02:00
|
|
|
|
{
|
|
|
|
|
window_ride_main_widgets[WIDX_SIMULATE_LIGHT].top = height;
|
|
|
|
|
window_ride_main_widgets[WIDX_SIMULATE_LIGHT].bottom = height + 13;
|
|
|
|
|
height += 14;
|
|
|
|
|
}
|
2020-11-27 04:14:20 +01:00
|
|
|
|
if (window_ride_main_widgets[WIDX_TEST_LIGHT].type != WindowWidgetType::Empty)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_main_widgets[WIDX_TEST_LIGHT].top = height;
|
|
|
|
|
window_ride_main_widgets[WIDX_TEST_LIGHT].bottom = height + 13;
|
|
|
|
|
height += 14;
|
|
|
|
|
}
|
|
|
|
|
window_ride_main_widgets[WIDX_OPEN_LIGHT].top = height;
|
|
|
|
|
window_ride_main_widgets[WIDX_OPEN_LIGHT].bottom = height + 13;
|
|
|
|
|
height += 14 - 24 + RCT1_LIGHT_OFFSET;
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_main_widgets[WIDX_OPEN].type = WindowWidgetType::FlatBtn;
|
|
|
|
|
window_ride_main_widgets[WIDX_CLOSE_LIGHT].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_main_widgets[WIDX_SIMULATE_LIGHT].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_main_widgets[WIDX_TEST_LIGHT].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_main_widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
height = 46;
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (i = WIDX_CLOSE_LIGHT; i <= WIDX_OPEN_LIGHT; i++)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_main_widgets[i].left = w->width - 20;
|
|
|
|
|
window_ride_main_widgets[i].right = w->width - 7;
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (i = WIDX_OPEN; i <= WIDX_DEMOLISH; i++, height += 24)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_main_widgets[i].left = w->width - 25;
|
|
|
|
|
window_ride_main_widgets[i].right = w->width - 2;
|
|
|
|
|
window_ride_main_widgets[i].top = height;
|
|
|
|
|
window_ride_main_widgets[i].bottom = height + 23;
|
|
|
|
|
}
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-03 20:13:37 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF10A
|
2014-09-03 20:13:37 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static rct_string_id WindowRideGetStatusOverallView(rct_window* w, Formatter& ft)
|
2014-09-03 20:13:37 +02:00
|
|
|
|
{
|
2019-02-13 00:58:45 +01:00
|
|
|
|
auto stringId = STR_NONE;
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-02-13 00:58:45 +01:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
2020-08-26 17:13:19 +02:00
|
|
|
|
ride->FormatStatusTo(ft);
|
2019-07-21 21:44:19 +02:00
|
|
|
|
stringId = STR_BLACK_STRING;
|
|
|
|
|
if ((ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
|
2019-02-13 00:58:45 +01:00
|
|
|
|
{
|
2019-07-21 21:44:19 +02:00
|
|
|
|
stringId = STR_RED_OUTLINED_STRING;
|
2019-02-13 00:58:45 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return stringId;
|
2014-09-03 20:13:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AEFEF
|
2014-09-03 20:13:37 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static rct_string_id WindowRideGetStatusVehicle(rct_window* w, Formatter& ft)
|
2014-09-03 20:13:37 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
2020-07-09 23:52:14 +02:00
|
|
|
|
return STR_EMPTY;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-08-02 09:28:11 +02:00
|
|
|
|
auto vehicle = GetEntity<Vehicle>(ride->vehicles[w->ride.view - 1]);
|
2020-07-09 23:52:14 +02:00
|
|
|
|
if (vehicle == nullptr)
|
|
|
|
|
return STR_EMPTY;
|
|
|
|
|
|
2020-08-09 07:24:25 +02:00
|
|
|
|
if (vehicle->status != Vehicle::Status::Crashing && vehicle->status != Vehicle::Status::Crashed)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-01-22 11:33:55 +01:00
|
|
|
|
auto trackType = vehicle->GetTrackType();
|
2020-08-18 08:28:41 +02:00
|
|
|
|
if (trackType == TrackElemType::BlockBrakes || trackType == TrackElemType::CableLiftHill
|
|
|
|
|
|| trackType == TrackElemType::Up25ToFlat || trackType == TrackElemType::Up60ToFlat
|
|
|
|
|
|| trackType == TrackElemType::DiagUp25ToFlat || trackType == TrackElemType::DiagUp60ToFlat)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-02-24 14:02:58 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_BLOCK_BRAKES) && vehicle->velocity == 0)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-08-26 17:13:19 +02:00
|
|
|
|
ft.Add<rct_string_id>(STR_STOPPED_BY_BLOCK_BRAKES);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return STR_BLACK_STRING;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ride->type == RIDE_TYPE_MINI_GOLF)
|
2020-08-26 13:59:18 +02:00
|
|
|
|
return STR_EMPTY;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-08-26 13:59:18 +02:00
|
|
|
|
auto stringId = VehicleStatusNames[static_cast<size_t>(vehicle->status)];
|
2021-02-25 22:55:06 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_SINGLE_SESSION)
|
2020-08-09 07:24:25 +02:00
|
|
|
|
&& vehicle->status <= Vehicle::Status::UnloadingPassengers)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-08-09 07:24:25 +02:00
|
|
|
|
stringId = SingleSessionVehicleStatusNames[static_cast<size_t>(vehicle->status)];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-26 17:13:19 +02:00
|
|
|
|
ft.Add<rct_string_id>(stringId);
|
2020-08-26 13:59:18 +02:00
|
|
|
|
uint16_t speedInMph = (abs(vehicle->velocity) * 9) >> 18;
|
2020-08-26 17:13:19 +02:00
|
|
|
|
ft.Add<uint16_t>(speedInMph);
|
2021-02-24 14:02:58 +01:00
|
|
|
|
const RideComponentName stationName = GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.station);
|
2020-08-26 17:13:19 +02:00
|
|
|
|
ft.Add<rct_string_id>(ride->num_stations > 1 ? stationName.number : stationName.singular);
|
2022-01-26 13:28:19 +01:00
|
|
|
|
ft.Add<uint16_t>(vehicle->current_station.ToUnderlying() + 1);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return stringId != STR_CRASHING && stringId != STR_CRASHED_0 ? STR_BLACK_STRING : STR_RED_OUTLINED_STRING;
|
2014-09-03 20:13:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AEF65
|
2014-09-03 20:13:37 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static rct_string_id WindowRideGetStatusStation(rct_window* w, Formatter& ft)
|
2014-09-03 20:13:37 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return STR_NONE;
|
|
|
|
|
|
2021-08-12 18:20:15 +02:00
|
|
|
|
const auto stationIndex = GetStationIndexFromViewSelection(*w);
|
|
|
|
|
if (!stationIndex)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-08-12 18:20:15 +02:00
|
|
|
|
return STR_NONE;
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2022-01-28 15:57:28 +01:00
|
|
|
|
const auto& station = ride->GetStation(*stationIndex);
|
2021-08-12 18:20:15 +02:00
|
|
|
|
rct_string_id stringId = STR_EMPTY;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Entrance / exit
|
2021-06-10 08:09:58 +02:00
|
|
|
|
if (ride->status == RideStatus::Closed)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2022-01-28 15:57:28 +01:00
|
|
|
|
if (station.Entrance.IsNull())
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_NO_ENTRANCE;
|
2022-01-28 15:57:28 +01:00
|
|
|
|
else if (station.Exit.IsNull())
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_NO_EXIT;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-01-28 15:57:28 +01:00
|
|
|
|
if (station.Entrance.IsNull())
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_EXIT_ONLY;
|
|
|
|
|
}
|
|
|
|
|
// Queue length
|
2020-08-26 13:59:18 +02:00
|
|
|
|
if (stringId == STR_EMPTY)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_QUEUE_EMPTY;
|
2022-01-28 00:34:04 +01:00
|
|
|
|
uint16_t queueLength = ride->GetStation(*stationIndex).QueueLength;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (queueLength == 1)
|
|
|
|
|
stringId = STR_QUEUE_ONE_PERSON;
|
|
|
|
|
else if (queueLength > 1)
|
|
|
|
|
stringId = STR_QUEUE_PEOPLE;
|
2020-08-26 13:59:18 +02:00
|
|
|
|
|
2020-08-26 17:13:19 +02:00
|
|
|
|
ft.Add<rct_string_id>(stringId);
|
|
|
|
|
ft.Add<uint16_t>(queueLength);
|
2020-08-26 13:59:18 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-08-26 17:13:19 +02:00
|
|
|
|
ft.Add<rct_string_id>(stringId);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return STR_BLACK_STRING;
|
2014-09-03 20:13:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AEE73
|
2014-09-03 20:13:37 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static rct_string_id WindowRideGetStatus(rct_window* w, Formatter& ft)
|
2014-09-03 20:13:37 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (w->ride.view == 0)
|
2021-11-23 14:18:07 +01:00
|
|
|
|
return WindowRideGetStatusOverallView(w, ft);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride != nullptr && w->ride.view <= ride->num_vehicles)
|
2021-11-23 14:18:07 +01:00
|
|
|
|
return WindowRideGetStatusVehicle(w, ft);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride != nullptr && ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
|
2021-11-23 14:18:07 +01:00
|
|
|
|
return WindowRideGetStatusOverallView(w, ft);
|
|
|
|
|
return WindowRideGetStatusStation(w, ft);
|
2014-09-03 20:13:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AEE73
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMainPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* widget;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowDrawWidgets(w, dpi);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabImages(dpi, w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Viewport and ear icon
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->viewport != nullptr)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_draw_viewport(dpi, w);
|
|
|
|
|
if (w->viewport->flags & VIEWPORT_FLAG_SOUND_ON)
|
2021-03-23 11:58:09 +01:00
|
|
|
|
gfx_draw_sprite(dpi, ImageId(SPR_HEARING_VIEWPORT), w->windowPos + ScreenCoordsXY{ 2, 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// View dropdown
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-09-30 23:42:04 +02:00
|
|
|
|
auto ft = Formatter();
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->ride.view != 0)
|
|
|
|
|
{
|
|
|
|
|
if (w->ride.view > ride->num_vehicles)
|
|
|
|
|
{
|
2021-02-24 14:02:58 +01:00
|
|
|
|
ft.Add<rct_string_id>(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.station).number);
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint16_t>(w->ride.view - ride->num_vehicles);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-02-24 14:02:58 +01:00
|
|
|
|
ft.Add<rct_string_id>(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).number);
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint16_t>(w->ride.view);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-03 12:03:12 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ft.Add<rct_string_id>(STR_OVERALL_VIEW);
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
widget = &window_ride_main_widgets[WIDX_VIEW];
|
2021-02-27 15:23:50 +01:00
|
|
|
|
DrawTextBasic(
|
|
|
|
|
dpi, { w->windowPos.x + (widget->left + widget->right - 11) / 2, w->windowPos.y + widget->top },
|
2021-07-27 20:32:27 +02:00
|
|
|
|
STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Status
|
2020-09-30 23:42:04 +02:00
|
|
|
|
ft = Formatter();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
widget = &window_ride_main_widgets[WIDX_STATUS];
|
2021-11-23 14:18:07 +01:00
|
|
|
|
rct_string_id rideStatus = WindowRideGetStatus(w, ft);
|
2020-08-28 18:03:51 +02:00
|
|
|
|
DrawTextEllipsised(
|
|
|
|
|
dpi, w->windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top }, widget->width(), rideStatus, ft,
|
2021-02-28 00:22:24 +01:00
|
|
|
|
{ TextAlignment::CENTRE });
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
|
2014-09-18 03:48:51 +02:00
|
|
|
|
#pragma region Vehicle
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B272D
|
2014-09-18 03:48:51 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideVehicleMouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-09-18 03:48:51 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
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:
|
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
|
case WIDX_TAB_6:
|
|
|
|
|
case WIDX_TAB_7:
|
|
|
|
|
case WIDX_TAB_8:
|
|
|
|
|
case WIDX_TAB_9:
|
|
|
|
|
case WIDX_TAB_10:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, widgetIndex - WIDX_TAB_1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-18 03:48:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B2ABB
|
2014-09-18 03:48:51 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideVehicleResize(rct_window* w)
|
2014-09-18 03:48:51 +02:00
|
|
|
|
{
|
2017-11-21 15:10:35 +01:00
|
|
|
|
window_set_resize(w, 316, 214, 316, 214);
|
2014-09-18 03:48:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B2748
|
2014-09-18 03:48:51 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideVehicleMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-09-18 03:48:51 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_VEHICLE_TYPE_DROPDOWN:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideShowVehicleTypeDropdown(w, &w->widgets[widgetIndex]);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_VEHICLE_TRAINS_INCREASE:
|
2022-02-01 21:59:48 +01:00
|
|
|
|
if (ride->num_vehicles < OpenRCT2::Limits::MaxTrainsPerRide)
|
2019-03-20 20:05:25 +01:00
|
|
|
|
ride->SetNumVehicles(ride->num_vehicles + 1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_VEHICLE_TRAINS_DECREASE:
|
|
|
|
|
if (ride->num_vehicles > 1)
|
2019-03-20 20:05:25 +01:00
|
|
|
|
ride->SetNumVehicles(ride->num_vehicles - 1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE:
|
2022-02-01 21:59:48 +01:00
|
|
|
|
if (ride->num_cars_per_train < OpenRCT2::Limits::MaxCarsPerTrain)
|
2019-03-20 20:05:25 +01:00
|
|
|
|
ride->SetNumCarsPerVehicle(ride->num_cars_per_train + 1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE:
|
2019-04-20 22:22:39 +02:00
|
|
|
|
rct_ride_entry* rideEntry = ride->GetRideEntry();
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->num_cars_per_train > rideEntry->zero_cars + 1)
|
2019-03-20 20:05:25 +01:00
|
|
|
|
ride->SetNumCarsPerVehicle(ride->num_cars_per_train - 1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-18 03:48:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B2767
|
2014-09-18 03:48:51 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideVehicleDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex)
|
2014-09-18 03:48:51 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (dropdownIndex == -1)
|
|
|
|
|
return;
|
2014-09-18 03:48:51 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_VEHICLE_TYPE_DROPDOWN:
|
2018-12-15 11:35:36 +01:00
|
|
|
|
if (dropdownIndex >= 0 && static_cast<std::size_t>(dropdownIndex) < VehicleDropdownData.size())
|
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-02-13 21:16:42 +01:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
|
|
|
|
auto newRideType = VehicleDropdownData[dropdownIndex].subtype_id;
|
2019-03-20 20:05:25 +01:00
|
|
|
|
ride->SetRideEntry(newRideType);
|
2019-02-13 21:16:42 +01:00
|
|
|
|
}
|
2018-12-15 11:35:36 +01:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-18 03:48:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B2AA1
|
2014-09-18 03:48:51 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideVehicleUpdate(rct_window* w)
|
2014-09-18 03:48:51 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->frame_no++;
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_2);
|
2014-09-18 03:48:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static OpenRCT2String WindowRideVehicleTooltip(rct_window* const w, const rct_widgetindex widgetIndex, rct_string_id fallback)
|
2020-10-17 10:10:08 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2020-10-17 10:10:08 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return { STR_NONE, {} };
|
|
|
|
|
|
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_VEHICLE_TRAINS:
|
|
|
|
|
case WIDX_VEHICLE_TRAINS_DECREASE:
|
|
|
|
|
case WIDX_VEHICLE_TRAINS_INCREASE:
|
|
|
|
|
{
|
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Increment(12);
|
|
|
|
|
|
2021-02-24 14:02:58 +01:00
|
|
|
|
RideComponentType vehicleType = ride->GetRideTypeDescriptor().NameConvention.vehicle;
|
2020-11-26 19:23:47 +01:00
|
|
|
|
rct_string_id stringId = GetRideComponentName(vehicleType).count;
|
2020-10-17 10:10:08 +02:00
|
|
|
|
if (ride->max_trains > 1)
|
|
|
|
|
{
|
2020-11-26 19:23:47 +01:00
|
|
|
|
stringId = GetRideComponentName(vehicleType).count_plural;
|
2020-10-17 10:10:08 +02:00
|
|
|
|
}
|
|
|
|
|
ft.Add<rct_string_id>(stringId);
|
|
|
|
|
ft.Add<uint16_t>(ride->max_trains);
|
|
|
|
|
return { fallback, ft };
|
|
|
|
|
}
|
|
|
|
|
case WIDX_VEHICLE_CARS_PER_TRAIN:
|
|
|
|
|
case WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE:
|
|
|
|
|
case WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE:
|
|
|
|
|
{
|
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
return { STR_NONE, {} };
|
|
|
|
|
|
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Increment(16);
|
2021-11-14 21:58:44 +01:00
|
|
|
|
ft.Add<uint16_t>(std::max(uint8_t(1), ride->MaxCarsPerTrain) - rideEntry->zero_cars);
|
2020-10-17 10:10:08 +02:00
|
|
|
|
|
2020-11-26 19:23:47 +01:00
|
|
|
|
rct_string_id stringId = GetRideComponentName(RideComponentType::Car).singular;
|
2021-11-14 21:58:44 +01:00
|
|
|
|
if (ride->MaxCarsPerTrain - rideEntry->zero_cars > 1)
|
2020-10-17 10:10:08 +02:00
|
|
|
|
{
|
2020-11-26 19:23:47 +01:00
|
|
|
|
stringId = GetRideComponentName(RideComponentType::Car).plural;
|
2020-10-17 10:10:08 +02:00
|
|
|
|
}
|
|
|
|
|
ft.Add<rct_string_id>(stringId);
|
|
|
|
|
return { fallback, ft };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return { fallback, {} };
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-18 03:48:51 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B222C
|
2014-09-18 03:48:51 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideVehicleInvalidate(rct_window* w)
|
2014-09-18 03:48:51 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* widgets;
|
|
|
|
|
rct_ride_entry* rideEntry;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_string_id stringId;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t carsPerTrain;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
widgets = window_ride_page_widgets[w->page];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->widgets != widgets)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = widgets;
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPressedTab(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2019-04-20 22:22:39 +02:00
|
|
|
|
rideEntry = ride->GetRideEntry();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2019-07-21 13:09:23 +02:00
|
|
|
|
w->widgets[WIDX_TITLE].text = STR_ARG_20_STRINGID;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Widget setup
|
|
|
|
|
carsPerTrain = ride->num_cars_per_train - rideEntry->zero_cars;
|
|
|
|
|
|
|
|
|
|
// Vehicle type
|
2020-06-16 22:50:58 +02:00
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].text = rideEntry->naming.Name;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Trains
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (rideEntry->cars_per_flat_ride > 1 || gCheatsDisableTrainLengthLimit)
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_TRAINS].type = WindowWidgetType::Spinner;
|
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_TRAINS_INCREASE].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_TRAINS_DECREASE].type = WindowWidgetType::Button;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_TRAINS].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_TRAINS_INCREASE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_TRAINS_DECREASE].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Cars per train
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (rideEntry->zero_cars + 1 < rideEntry->max_cars_in_train || gCheatsDisableTrainLengthLimit)
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_CARS_PER_TRAIN].type = WindowWidgetType::Spinner;
|
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE].type = WindowWidgetType::Button;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_CARS_PER_TRAIN].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_CARS_PER_TRAIN_INCREASE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-06-03 12:03:12 +02:00
|
|
|
|
auto ft = Formatter::Common();
|
|
|
|
|
ft.Increment(6);
|
|
|
|
|
ft.Add<uint16_t>(carsPerTrain);
|
2021-02-24 14:02:58 +01:00
|
|
|
|
RideComponentType vehicleType = ride->GetRideTypeDescriptor().NameConvention.vehicle;
|
2020-11-26 19:23:47 +01:00
|
|
|
|
stringId = GetRideComponentName(vehicleType).count;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->num_vehicles > 1)
|
|
|
|
|
{
|
2020-11-26 19:23:47 +01:00
|
|
|
|
stringId = GetRideComponentName(vehicleType).count_plural;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<rct_string_id>(stringId);
|
|
|
|
|
ft.Add<uint16_t>(ride->num_vehicles);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-10-17 10:10:08 +02:00
|
|
|
|
ft.Increment(8);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-06-25 02:02:08 +02:00
|
|
|
|
ride->FormatNameTo(ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideAnchorBorderWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->num_cars_per_train > (rideEntry->zero_cars + 1))
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_CARS_PER_TRAIN].text = STR_X_CARS_PER_TRAIN;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_vehicle_widgets[WIDX_VEHICLE_CARS_PER_TRAIN].text = STR_1_CAR_PER_TRAIN;
|
|
|
|
|
}
|
2014-09-18 03:48:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B23DC
|
2014-09-18 03:48:51 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideVehiclePaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-09-18 03:48:51 +02:00
|
|
|
|
{
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowDrawWidgets(w, dpi);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabImages(dpi, w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-06-20 21:09:45 +02:00
|
|
|
|
auto screenCoords = w->windowPos + ScreenCoordsXY{ 8, 64 };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Description
|
2021-08-21 09:42:05 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<rct_string_id>(rideEntry->naming.Description);
|
|
|
|
|
screenCoords.y += DrawTextWrapped(dpi, screenCoords, 300, STR_BLACK_STRING, ft, { TextAlignment::LEFT });
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += 2;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Capacity
|
2021-08-21 09:42:05 +02:00
|
|
|
|
ft = Formatter();
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft.Add<rct_string_id>(rideEntry->capacity);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_CAPACITY, ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2017-12-07 16:12:37 +01:00
|
|
|
|
// Excitement Factor
|
2021-07-27 20:32:27 +02:00
|
|
|
|
if (rideEntry->excitement_multiplier > 0)
|
2017-11-21 15:10:35 +01:00
|
|
|
|
{
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
|
|
|
|
|
ft = Formatter();
|
2021-08-20 13:05:54 +02:00
|
|
|
|
ft.Add<int16_t>(rideEntry->excitement_multiplier);
|
2021-07-27 20:32:27 +02:00
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_EXCITEMENT_FACTOR, ft);
|
2017-12-07 16:12:37 +01:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2017-12-07 16:12:37 +01:00
|
|
|
|
// Intensity Factor
|
2021-07-27 20:32:27 +02:00
|
|
|
|
if (rideEntry->intensity_multiplier > 0)
|
2017-12-07 16:12:37 +01:00
|
|
|
|
{
|
2021-02-27 12:40:20 +01:00
|
|
|
|
int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
2018-01-23 16:06:37 +01:00
|
|
|
|
if (lineHeight != 10)
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.x += 150;
|
2018-01-23 16:06:37 +01:00
|
|
|
|
else
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2018-01-23 16:06:37 +01:00
|
|
|
|
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<int16_t>(rideEntry->intensity_multiplier);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_INTENSITY_FACTOR, ft);
|
2018-01-23 16:06:37 +01:00
|
|
|
|
|
|
|
|
|
if (lineHeight != 10)
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.x -= 150;
|
2017-12-07 16:12:37 +01:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2017-12-07 16:12:37 +01:00
|
|
|
|
// Nausea Factor
|
2021-07-27 20:32:27 +02:00
|
|
|
|
if (rideEntry->nausea_multiplier > 0)
|
2017-12-07 16:12:37 +01:00
|
|
|
|
{
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
|
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<int16_t>(rideEntry->nausea_multiplier);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_NAUSEA_FACTOR, ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-18 03:48:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-24 17:16:52 +01:00
|
|
|
|
struct VehicleDrawInfo
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int16_t x;
|
|
|
|
|
int16_t y;
|
2021-12-05 02:50:33 +01:00
|
|
|
|
ImageId imageId;
|
2018-02-14 09:42:26 +01:00
|
|
|
|
};
|
2014-09-20 00:43:35 +02:00
|
|
|
|
|
2021-11-24 17:16:52 +01:00
|
|
|
|
static VehicleDrawInfo _sprites_to_draw[144];
|
2014-09-20 00:43:35 +02:00
|
|
|
|
|
2014-09-18 03:48:51 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B2502
|
2014-09-18 03:48:51 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideVehicleScrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)
|
2014-09-18 03:48:51 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2019-04-20 22:22:39 +02:00
|
|
|
|
rct_ride_entry* rideEntry = ride->GetRideEntry();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Background
|
2020-07-13 22:49:12 +02:00
|
|
|
|
gfx_fill_rect(dpi, { { dpi->x, dpi->y }, { dpi->x + dpi->width, dpi->y + dpi->height } }, PALETTE_INDEX_12);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* widget = &window_ride_vehicle_widgets[WIDX_VEHICLE_TRAINS_PREVIEW];
|
2020-06-25 03:44:00 +02:00
|
|
|
|
int32_t startX = std::max(2, (widget->width() - ((ride->num_vehicles - 1) * 36)) / 2 - 25);
|
|
|
|
|
int32_t startY = widget->height() - 4;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-07-21 11:50:45 +02:00
|
|
|
|
rct_ride_entry_vehicle* rideVehicleEntry = &rideEntry->vehicles[ride_entry_get_vehicle_at_position(
|
|
|
|
|
ride->subtype, ride->num_cars_per_train, 0)];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
startY += rideVehicleEntry->tab_height;
|
|
|
|
|
|
|
|
|
|
// For each train
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t i = 0; i < ride->num_vehicles; i++)
|
|
|
|
|
{
|
2021-11-24 17:16:52 +01:00
|
|
|
|
VehicleDrawInfo* nextSpriteToDraw = _sprites_to_draw;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t x = startX;
|
|
|
|
|
int32_t y = startY;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// For each car in train
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t j = 0; j < ride->num_cars_per_train; j++)
|
|
|
|
|
{
|
2018-07-21 11:50:45 +02:00
|
|
|
|
rideVehicleEntry = &rideEntry
|
|
|
|
|
->vehicles[ride_entry_get_vehicle_at_position(ride->subtype, ride->num_cars_per_train, j)];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
x += rideVehicleEntry->spacing / 17432;
|
|
|
|
|
y -= (rideVehicleEntry->spacing / 2) / 17432;
|
|
|
|
|
|
|
|
|
|
// Get colour of vehicle
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t vehicleColourIndex = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (ride->colour_scheme_type & 3)
|
|
|
|
|
{
|
|
|
|
|
case VEHICLE_COLOUR_SCHEME_SAME:
|
|
|
|
|
vehicleColourIndex = 0;
|
|
|
|
|
break;
|
|
|
|
|
case VEHICLE_COLOUR_SCHEME_PER_TRAIN:
|
|
|
|
|
vehicleColourIndex = i;
|
|
|
|
|
break;
|
|
|
|
|
case VEHICLE_COLOUR_SCHEME_PER_VEHICLE:
|
|
|
|
|
vehicleColourIndex = j;
|
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2021-11-29 23:04:31 +01:00
|
|
|
|
VehicleColour vehicleColour = ride_get_vehicle_colour(ride, vehicleColourIndex);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-12-05 02:50:33 +01:00
|
|
|
|
ImageIndex imageIndex = 16;
|
2021-05-13 13:34:32 +02:00
|
|
|
|
if (rideVehicleEntry->flags & VEHICLE_ENTRY_FLAG_USE_16_ROTATION_FRAMES)
|
2021-12-05 02:50:33 +01:00
|
|
|
|
imageIndex /= 2;
|
|
|
|
|
imageIndex &= rideVehicleEntry->rotation_frame_mask;
|
|
|
|
|
imageIndex *= rideVehicleEntry->base_num_frames;
|
|
|
|
|
imageIndex += rideVehicleEntry->base_image_id;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-12-05 02:50:33 +01:00
|
|
|
|
auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Ternary);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
nextSpriteToDraw->x = x;
|
|
|
|
|
nextSpriteToDraw->y = y;
|
2021-12-05 02:50:33 +01:00
|
|
|
|
nextSpriteToDraw->imageId = imageId;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
nextSpriteToDraw++;
|
|
|
|
|
|
|
|
|
|
x += rideVehicleEntry->spacing / 17432;
|
|
|
|
|
y -= (rideVehicleEntry->spacing / 2) / 17432;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->type == RIDE_TYPE_REVERSER_ROLLER_COASTER)
|
|
|
|
|
{
|
2021-11-24 17:16:52 +01:00
|
|
|
|
VehicleDrawInfo tmp = *(nextSpriteToDraw - 1);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
*(nextSpriteToDraw - 1) = *(nextSpriteToDraw - 2);
|
|
|
|
|
*(nextSpriteToDraw - 2) = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-24 17:16:52 +01:00
|
|
|
|
VehicleDrawInfo* current = nextSpriteToDraw;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
while (--current >= _sprites_to_draw)
|
2021-12-05 02:50:33 +01:00
|
|
|
|
gfx_draw_sprite(dpi, current->imageId, { current->x, current->y });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
startX += 36;
|
|
|
|
|
}
|
2014-09-18 03:48:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
|
2014-09-09 02:12:32 +02:00
|
|
|
|
#pragma region Operating
|
|
|
|
|
|
2014-09-09 18:17:08 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B11D5
|
2014-09-09 18:17:08 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideModeTweakIncrease(rct_window* w)
|
2014-09-09 18:17:08 +02:00
|
|
|
|
{
|
2021-09-06 15:40:12 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2015-05-17 17:26:07 +02:00
|
|
|
|
|
2021-02-24 14:02:58 +01:00
|
|
|
|
const auto& operatingSettings = ride->GetRideTypeDescriptor().OperatingSettings;
|
2020-06-17 18:59:04 +02:00
|
|
|
|
uint8_t maxValue = operatingSettings.MaxValue;
|
2021-05-29 18:41:16 +02:00
|
|
|
|
uint8_t minValue = gCheatsUnlockOperatingLimits ? 0 : operatingSettings.MinValue;
|
2016-08-03 20:41:31 +02:00
|
|
|
|
|
2021-05-29 18:41:16 +02:00
|
|
|
|
if (gCheatsUnlockOperatingLimits)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
maxValue = 255;
|
|
|
|
|
}
|
2014-09-09 18:17:08 +02:00
|
|
|
|
|
2020-09-28 15:09:59 +02:00
|
|
|
|
uint8_t increment = ride->mode == RideMode::Dodgems ? 10 : 1;
|
2016-05-03 15:44:54 +02:00
|
|
|
|
|
2019-02-22 11:13:08 +01:00
|
|
|
|
set_operating_setting(
|
2021-09-06 15:40:12 +02:00
|
|
|
|
w->rideId, RideSetSetting::Operation, std::clamp<int16_t>(ride->operation_option + increment, minValue, maxValue));
|
2014-09-09 18:17:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B120A
|
2014-09-09 18:17:08 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideModeTweakDecrease(rct_window* w)
|
2014-09-09 18:17:08 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2015-12-20 20:47:59 +01:00
|
|
|
|
|
2021-02-24 14:02:58 +01:00
|
|
|
|
const auto& operatingSettings = ride->GetRideTypeDescriptor().OperatingSettings;
|
2020-06-17 18:59:04 +02:00
|
|
|
|
uint8_t maxValue = operatingSettings.MaxValue;
|
2021-05-29 18:41:16 +02:00
|
|
|
|
uint8_t minValue = gCheatsUnlockOperatingLimits ? 0 : operatingSettings.MinValue;
|
|
|
|
|
if (gCheatsUnlockOperatingLimits)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
maxValue = 255;
|
|
|
|
|
}
|
2014-09-09 18:17:08 +02:00
|
|
|
|
|
2020-09-28 15:09:59 +02:00
|
|
|
|
uint8_t decrement = ride->mode == RideMode::Dodgems ? 10 : 1;
|
2016-05-19 19:21:36 +02:00
|
|
|
|
|
2019-02-22 11:13:08 +01:00
|
|
|
|
set_operating_setting(
|
2021-09-04 18:04:53 +02:00
|
|
|
|
w->rideId, RideSetSetting::Operation, std::clamp<int16_t>(ride->operation_option - decrement, minValue, maxValue));
|
2014-09-09 18:17:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1631
|
2014-09-09 18:17:08 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideModeDropdown(rct_window* w, rct_widget* widget)
|
2014-09-09 18:17:08 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* dropdownWidget;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
dropdownWidget = widget - 1;
|
2021-09-06 15:40:12 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-04-25 15:29:18 +02:00
|
|
|
|
auto availableModes = ride->GetAvailableModes();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Create dropdown list
|
2020-04-25 15:29:18 +02:00
|
|
|
|
auto numAvailableModes = 0;
|
|
|
|
|
auto checkedIndex = -1;
|
2020-09-28 15:09:59 +02:00
|
|
|
|
for (auto i = 0; i < static_cast<uint8_t>(RideMode::Count); i++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-04-25 15:29:18 +02:00
|
|
|
|
if (availableModes & (1ULL << i))
|
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[numAvailableModes].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[numAvailableModes].Args = RideModeNames[i];
|
2020-04-25 15:29:18 +02:00
|
|
|
|
|
2020-09-28 15:09:59 +02:00
|
|
|
|
if (ride->mode == static_cast<RideMode>(i))
|
2020-04-25 15:29:18 +02:00
|
|
|
|
checkedIndex = numAvailableModes;
|
|
|
|
|
|
|
|
|
|
numAvailableModes++;
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-04-25 15:29:18 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], 0, Dropdown::Flag::StayOpen, numAvailableModes, widget->right - dropdownWidget->left);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-04-25 15:29:18 +02:00
|
|
|
|
if (checkedIndex != -1)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(checkedIndex, true);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-09 18:17:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B15C0
|
2014-09-09 18:17:08 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideLoadDropdown(rct_window* w, rct_widget* widget)
|
2014-09-09 18:17:08 +02:00
|
|
|
|
{
|
2021-09-06 15:40:12 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2014-09-09 18:17:08 +02:00
|
|
|
|
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto dropdownWidget = widget - 1;
|
|
|
|
|
for (auto i = 0; i < 5; i++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[i].Args = VehicleLoadNames[i];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], 0, Dropdown::Flag::StayOpen, 5, widget->right - dropdownWidget->left);
|
2014-09-09 18:17:08 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK, true);
|
2014-09-09 18:17:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-09 02:12:32 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B10A7
|
2014-09-09 02:12:32 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideOperatingMouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-09-09 02:12:32 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
const auto rideId = w->rideId;
|
2021-08-02 06:24:52 +02:00
|
|
|
|
auto ride = get_ride(rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
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:
|
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
|
case WIDX_TAB_6:
|
|
|
|
|
case WIDX_TAB_7:
|
|
|
|
|
case WIDX_TAB_8:
|
|
|
|
|
case WIDX_TAB_9:
|
|
|
|
|
case WIDX_TAB_10:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, widgetIndex - WIDX_TAB_1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_LOAD_CHECKBOX:
|
2021-08-02 06:24:52 +02:00
|
|
|
|
set_operating_setting(rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_WAIT_FOR_LOAD);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX:
|
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_LEAVE_WHEN_ANOTHER_ARRIVES);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_MINIMUM_LENGTH_CHECKBOX:
|
2021-08-02 06:24:52 +02:00
|
|
|
|
set_operating_setting(rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_WAIT_FOR_MINIMUM_LENGTH);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_MAXIMUM_LENGTH_CHECKBOX:
|
2021-08-02 06:24:52 +02:00
|
|
|
|
set_operating_setting(rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_WAIT_FOR_MAXIMUM_LENGTH);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX:
|
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::Departure, ride->depart_flags ^ RIDE_DEPART_SYNCHRONISE_WITH_ADJACENT_STATIONS);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-09 02:12:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1715
|
2014-09-09 02:12:32 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideOperatingResize(rct_window* w)
|
2014-09-09 02:12:32 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_set_resize(w, 316, 186, 316, 186);
|
2014-09-09 02:12:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B10F4
|
2014-09-09 02:12:32 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideOperatingMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-09-09 02:12:32 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
const auto rideId = w->rideId;
|
2021-08-02 06:24:52 +02:00
|
|
|
|
auto ride = get_ride(rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2019-08-09 09:06:25 +02:00
|
|
|
|
uint8_t upper_bound, lower_bound;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_MODE_TWEAK_INCREASE:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideModeTweakIncrease(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_MODE_TWEAK_DECREASE:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideModeTweakDecrease(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_LIFT_HILL_SPEED_INCREASE:
|
2021-05-29 18:41:16 +02:00
|
|
|
|
upper_bound = gCheatsUnlockOperatingLimits ? 255 : ride->GetRideTypeDescriptor().LiftData.maximum_speed;
|
|
|
|
|
lower_bound = gCheatsUnlockOperatingLimits ? 0 : ride->GetRideTypeDescriptor().LiftData.minimum_speed;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::LiftHillSpeed,
|
2018-08-12 13:50:40 +02:00
|
|
|
|
std::clamp<int16_t>(ride->lift_hill_speed + 1, lower_bound, upper_bound));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_LIFT_HILL_SPEED_DECREASE:
|
2021-05-29 18:41:16 +02:00
|
|
|
|
upper_bound = gCheatsUnlockOperatingLimits ? 255 : ride->GetRideTypeDescriptor().LiftData.maximum_speed;
|
|
|
|
|
lower_bound = gCheatsUnlockOperatingLimits ? 0 : ride->GetRideTypeDescriptor().LiftData.minimum_speed;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::LiftHillSpeed,
|
2018-08-12 13:50:40 +02:00
|
|
|
|
std::clamp<int16_t>(ride->lift_hill_speed - 1, lower_bound, upper_bound));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_MINIMUM_LENGTH_INCREASE:
|
|
|
|
|
upper_bound = 250;
|
|
|
|
|
lower_bound = 0;
|
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::MinWaitingTime,
|
2018-08-12 13:50:40 +02:00
|
|
|
|
std::clamp<int16_t>(ride->min_waiting_time + 1, lower_bound, upper_bound));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_MINIMUM_LENGTH_DECREASE:
|
|
|
|
|
upper_bound = 250;
|
|
|
|
|
lower_bound = 0;
|
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::MinWaitingTime,
|
2018-08-12 13:50:40 +02:00
|
|
|
|
std::clamp<int16_t>(ride->min_waiting_time - 1, lower_bound, upper_bound));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_MAXIMUM_LENGTH_INCREASE:
|
|
|
|
|
upper_bound = 250;
|
|
|
|
|
lower_bound = 0;
|
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::MaxWaitingTime,
|
2018-08-12 13:50:40 +02:00
|
|
|
|
std::clamp<int16_t>(ride->max_waiting_time + 1, lower_bound, upper_bound));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_MAXIMUM_LENGTH_DECREASE:
|
|
|
|
|
upper_bound = 250;
|
|
|
|
|
lower_bound = 0;
|
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::MaxWaitingTime,
|
2018-08-12 13:50:40 +02:00
|
|
|
|
std::clamp<int16_t>(ride->max_waiting_time - 1, lower_bound, upper_bound));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_MODE_DROPDOWN:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideModeDropdown(w, widget);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_LOAD_DROPDOWN:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideLoadDropdown(w, widget);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE:
|
2022-02-01 21:59:48 +01:00
|
|
|
|
upper_bound = gCheatsUnlockOperatingLimits ? 255 : OpenRCT2::Limits::MaxCircuitsPerRide;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
lower_bound = 1;
|
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::NumCircuits, std::clamp<int16_t>(ride->num_circuits + 1, lower_bound, upper_bound));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE:
|
2022-02-01 21:59:48 +01:00
|
|
|
|
upper_bound = gCheatsUnlockOperatingLimits ? 255 : OpenRCT2::Limits::MaxCircuitsPerRide;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
lower_bound = 1;
|
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::NumCircuits, std::clamp<int16_t>(ride->num_circuits - 1, lower_bound, upper_bound));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-09 02:12:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1165
|
2014-09-09 02:12:32 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideOperatingDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex)
|
2014-09-09 02:12:32 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (dropdownIndex == -1)
|
|
|
|
|
return;
|
2014-09-09 18:17:08 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
const auto rideId = w->rideId;
|
2021-08-02 06:24:52 +02:00
|
|
|
|
auto ride = get_ride(rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2014-09-09 18:17:08 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_MODE_DROPDOWN:
|
2019-08-09 09:06:25 +02:00
|
|
|
|
{
|
2020-09-28 15:09:59 +02:00
|
|
|
|
RideMode rideMode = RideMode::NullMode;
|
2020-04-25 15:29:18 +02:00
|
|
|
|
auto availableModes = ride->GetAvailableModes();
|
|
|
|
|
auto modeInDropdownIndex = -1;
|
2020-09-28 15:09:59 +02:00
|
|
|
|
for (RideMode rideModeIndex = RideMode::Normal; rideModeIndex < RideMode::Count; rideModeIndex++)
|
2020-04-25 15:29:18 +02:00
|
|
|
|
{
|
2020-09-28 15:09:59 +02:00
|
|
|
|
if (availableModes & EnumToFlag(rideModeIndex))
|
2020-04-25 15:29:18 +02:00
|
|
|
|
{
|
|
|
|
|
modeInDropdownIndex++;
|
|
|
|
|
if (modeInDropdownIndex == dropdownIndex)
|
|
|
|
|
{
|
|
|
|
|
rideMode = rideModeIndex;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-28 15:09:59 +02:00
|
|
|
|
if (rideMode != RideMode::NullMode)
|
2021-08-02 06:24:52 +02:00
|
|
|
|
set_operating_setting(rideId, RideSetSetting::Mode, static_cast<uint8_t>(rideMode));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2019-08-09 09:06:25 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_LOAD_DROPDOWN:
|
|
|
|
|
set_operating_setting(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetSetting::Departure, (ride->depart_flags & ~RIDE_DEPART_WAIT_FOR_LOAD_MASK) | dropdownIndex);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-09 02:12:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B178E
|
2014-09-09 02:12:32 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideOperatingUpdate(rct_window* w)
|
2014-09-09 02:12:32 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->frame_no++;
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_3);
|
2014-09-09 02:12:32 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_OPERATING)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_OPERATING;
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-09 02:12:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B0B30
|
2014-09-09 02:12:32 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideOperatingInvalidate(rct_window* w)
|
2014-09-09 02:12:32 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* widgets;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_string_id format, caption, tooltip;
|
2014-09-09 02:12:32 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
widgets = window_ride_page_widgets[w->page];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->widgets != widgets)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = widgets;
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-09 02:12:32 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPressedTab(w);
|
2014-09-09 02:12:32 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 15:20:59 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2014-09-09 15:16:09 +02:00
|
|
|
|
|
2020-06-25 02:02:08 +02:00
|
|
|
|
auto ft = Formatter::Common();
|
|
|
|
|
ride->FormatNameTo(ft);
|
2014-09-09 02:12:32 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Widget setup
|
|
|
|
|
w->pressed_widgets &= ~(
|
2018-06-22 23:21:44 +02:00
|
|
|
|
(1ULL << WIDX_LOAD_CHECKBOX) | (1ULL << WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX)
|
|
|
|
|
| (1ULL << WIDX_MINIMUM_LENGTH_CHECKBOX) | (1ULL << WIDX_MAXIMUM_LENGTH_CHECKBOX)
|
|
|
|
|
| (1ULL << WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX));
|
2014-09-09 15:16:09 +02:00
|
|
|
|
|
2020-02-22 18:47:33 +01:00
|
|
|
|
// Sometimes, only one of the alternatives support lift hill pieces. Make sure to check both.
|
2021-02-24 14:02:58 +01:00
|
|
|
|
bool hasAlternativeType = ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_ALTERNATIVE_TRACK_TYPE);
|
|
|
|
|
if (ride->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_LIFT_HILL)
|
2020-02-22 18:47:33 +01:00
|
|
|
|
|| (hasAlternativeType
|
2021-02-26 10:01:00 +01:00
|
|
|
|
&& GetRideTypeDescriptor(ride->GetRideTypeDescriptor().AlternateType).SupportsTrackPiece(TRACK_LIFT_HILL)))
|
2018-03-27 20:40:50 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_LABEL].type = WindowWidgetType::Label;
|
|
|
|
|
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED].type = WindowWidgetType::Spinner;
|
|
|
|
|
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_INCREASE].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_DECREASE].type = WindowWidgetType::Button;
|
2020-06-25 02:02:08 +02:00
|
|
|
|
ft.Rewind();
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Increment(20);
|
|
|
|
|
ft.Add<uint16_t>(ride->lift_hill_speed);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_LABEL].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_INCREASE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_DECREASE].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Number of circuits
|
2019-04-20 22:22:39 +02:00
|
|
|
|
if (ride->CanHaveMultipleCircuits())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_LABEL].type = WindowWidgetType::Label;
|
|
|
|
|
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS].type = WindowWidgetType::Spinner;
|
|
|
|
|
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE].type = WindowWidgetType::Button;
|
2020-06-25 02:02:08 +02:00
|
|
|
|
ft.Rewind();
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Increment(22);
|
|
|
|
|
ft.Add<uint16_t>(ride->num_circuits);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_LABEL].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Leave if another vehicle arrives at station
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_LEAVE_WHEN_ANOTHER_VEHICLE_ARRIVES_AT_STATION)
|
2020-10-01 14:06:28 +02:00
|
|
|
|
&& ride->num_vehicles > 1 && !ride->IsBlockSectioned())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].type = WindowWidgetType::Checkbox;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
window_ride_operating_widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].tooltip
|
|
|
|
|
= STR_LEAVE_IF_ANOTHER_VEHICLE_ARRIVES_TIP;
|
2021-02-24 14:02:58 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].text = ride->GetRideTypeDescriptor()
|
2020-04-18 12:12:07 +02:00
|
|
|
|
.NameConvention.vehicle
|
2020-11-26 19:23:47 +01:00
|
|
|
|
== RideComponentType::Boat
|
2018-07-21 11:50:45 +02:00
|
|
|
|
? STR_LEAVE_IF_ANOTHER_BOAT_ARRIVES
|
|
|
|
|
: STR_LEAVE_IF_ANOTHER_TRAIN_ARRIVES;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Synchronise with adjacent stations
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_CAN_SYNCHRONISE_ADJACENT_STATIONS))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].type = WindowWidgetType::Checkbox;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
window_ride_operating_widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].image
|
|
|
|
|
= STR_SYNCHRONISE_WITH_ADJACENT_STATIONS;
|
|
|
|
|
window_ride_operating_widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].tooltip
|
|
|
|
|
= STR_SYNCHRONISE_WITH_ADJACENT_STATIONS_TIP;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Mode
|
2020-09-28 15:09:59 +02:00
|
|
|
|
window_ride_operating_widgets[WIDX_MODE].text = RideModeNames[static_cast<int>(ride->mode)];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Waiting
|
|
|
|
|
window_ride_operating_widgets[WIDX_LOAD].text = VehicleLoadNames[(ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK)];
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_LOAD_OPTIONS))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_LOAD_CHECKBOX].type = WindowWidgetType::Checkbox;
|
|
|
|
|
window_ride_operating_widgets[WIDX_LOAD].type = WindowWidgetType::DropdownMenu;
|
|
|
|
|
window_ride_operating_widgets[WIDX_LOAD_DROPDOWN].type = WindowWidgetType::Button;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_MINIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Checkbox;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MINIMUM_LENGTH].type = WindowWidgetType::Spinner;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MINIMUM_LENGTH_INCREASE].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MINIMUM_LENGTH_DECREASE].type = WindowWidgetType::Button;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Checkbox;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH].type = WindowWidgetType::Spinner;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH_INCREASE].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH_DECREASE].type = WindowWidgetType::Button;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-06-25 02:02:08 +02:00
|
|
|
|
ft.Rewind();
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Increment(10);
|
|
|
|
|
ft.Add<rct_string_id>(STR_FORMAT_SECONDS);
|
|
|
|
|
ft.Add<uint16_t>(ride->min_waiting_time);
|
|
|
|
|
ft.Add<rct_string_id>(STR_FORMAT_SECONDS);
|
|
|
|
|
ft.Add<uint16_t>(ride->max_waiting_time);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD)
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets |= (1ULL << WIDX_LOAD_CHECKBOX);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_LOAD_CHECKBOX].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_LOAD].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_LOAD_DROPDOWN].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_MINIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MINIMUM_LENGTH].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MINIMUM_LENGTH_INCREASE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MINIMUM_LENGTH_DECREASE].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH_CHECKBOX].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH_INCREASE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH_DECREASE].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ride->depart_flags & RIDE_DEPART_LEAVE_WHEN_ANOTHER_ARRIVES)
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets |= (1ULL << WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (ride->depart_flags & RIDE_DEPART_SYNCHRONISE_WITH_ADJACENT_STATIONS)
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets |= (1ULL << WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_MINIMUM_LENGTH)
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets |= (1ULL << WIDX_MINIMUM_LENGTH_CHECKBOX);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_MAXIMUM_LENGTH)
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets |= (1ULL << WIDX_MAXIMUM_LENGTH_CHECKBOX);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Mode specific functionality
|
2020-06-25 02:02:08 +02:00
|
|
|
|
ft.Rewind();
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Increment(18);
|
|
|
|
|
ft.Add<uint16_t>(ride->operation_option);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (ride->mode)
|
|
|
|
|
{
|
2020-09-28 15:09:59 +02:00
|
|
|
|
case RideMode::PoweredLaunchPasstrough:
|
|
|
|
|
case RideMode::PoweredLaunch:
|
|
|
|
|
case RideMode::UpwardLaunch:
|
|
|
|
|
case RideMode::PoweredLaunchBlockSectioned:
|
2020-06-03 12:54:39 +02:00
|
|
|
|
ft.Rewind();
|
|
|
|
|
ft.Increment(18);
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint16_t>((ride->launch_speed * 9) / 4);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
format = STR_RIDE_MODE_SPEED_VALUE;
|
|
|
|
|
caption = STR_LAUNCH_SPEED;
|
|
|
|
|
tooltip = STR_LAUNCH_SPEED_TIP;
|
|
|
|
|
break;
|
2020-09-28 15:09:59 +02:00
|
|
|
|
case RideMode::StationToStation:
|
2020-06-03 12:54:39 +02:00
|
|
|
|
ft.Rewind();
|
|
|
|
|
ft.Increment(18);
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint16_t>((ride->speed * 9) / 4);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
format = STR_RIDE_MODE_SPEED_VALUE;
|
|
|
|
|
caption = STR_SPEED;
|
|
|
|
|
tooltip = STR_SPEED_TIP;
|
|
|
|
|
break;
|
2020-09-28 15:09:59 +02:00
|
|
|
|
case RideMode::Race:
|
2020-06-03 12:54:39 +02:00
|
|
|
|
ft.Rewind();
|
|
|
|
|
ft.Increment(18);
|
2022-02-21 03:20:06 +01:00
|
|
|
|
ft.Add<uint16_t>(ride->NumLaps);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
format = STR_NUMBER_OF_LAPS_VALUE;
|
|
|
|
|
caption = STR_NUMBER_OF_LAPS;
|
|
|
|
|
tooltip = STR_NUMBER_OF_LAPS_TIP;
|
|
|
|
|
break;
|
2020-09-28 15:09:59 +02:00
|
|
|
|
case RideMode::Dodgems:
|
2018-06-22 23:21:44 +02:00
|
|
|
|
format = STR_RIDE_MODE_TIME_LIMIT_VALUE;
|
|
|
|
|
caption = STR_TIME_LIMIT;
|
|
|
|
|
tooltip = STR_TIME_LIMIT_TIP;
|
|
|
|
|
break;
|
2020-09-28 15:09:59 +02:00
|
|
|
|
case RideMode::Swing:
|
2018-06-22 23:21:44 +02:00
|
|
|
|
format = STR_RIDE_MODE_NUMBER_OF_SWINGS_VALUE;
|
|
|
|
|
caption = STR_NUMBER_OF_SWINGS;
|
|
|
|
|
tooltip = STR_NUMBER_OF_SWINGS_TIP;
|
|
|
|
|
break;
|
2020-09-28 15:09:59 +02:00
|
|
|
|
case RideMode::Rotation:
|
|
|
|
|
case RideMode::ForwardRotation:
|
|
|
|
|
case RideMode::BackwardRotation:
|
2018-06-22 23:21:44 +02:00
|
|
|
|
format = STR_NUMBER_OF_ROTATIONS_VALUE;
|
|
|
|
|
caption = STR_NUMBER_OF_ROTATIONS;
|
|
|
|
|
tooltip = STR_NUMBER_OF_ROTATIONS_TIP;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
format = STR_MAX_PEOPLE_ON_RIDE_VALUE;
|
|
|
|
|
caption = STR_MAX_PEOPLE_ON_RIDE;
|
|
|
|
|
tooltip = STR_MAX_PEOPLE_ON_RIDE_TIP;
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
format = 0;
|
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (format != 0)
|
|
|
|
|
{
|
|
|
|
|
if (ride->type == RIDE_TYPE_TWIST)
|
|
|
|
|
{
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft = Formatter::Common();
|
|
|
|
|
ft.Increment(18);
|
2020-09-30 23:42:04 +02:00
|
|
|
|
ft.Add<uint16_t>(ride->operation_option * 3);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK_LABEL].type = WindowWidgetType::Label;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK_LABEL].text = caption;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK_LABEL].tooltip = tooltip;
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK].type = WindowWidgetType::Spinner;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK].text = format;
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK_INCREASE].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK_DECREASE].type = WindowWidgetType::Button;
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets &= ~(1ULL << WIDX_LEAVE_WHEN_ANOTHER_ARRIVES_CHECKBOX);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK_LABEL].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK_INCREASE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_operating_widgets[WIDX_MODE_TWEAK_DECREASE].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideAnchorBorderWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
2014-09-09 02:12:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1001
|
2014-09-09 02:12:32 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideOperatingPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-09-09 02:12:32 +02:00
|
|
|
|
{
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowDrawWidgets(w, dpi);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabImages(dpi, w);
|
2014-09-09 02:12:32 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2014-09-09 02:12:32 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Horizontal rule between mode settings and depart settings
|
|
|
|
|
gfx_fill_rect_inset(
|
2020-09-16 05:02:22 +02:00
|
|
|
|
dpi,
|
|
|
|
|
{ w->windowPos + ScreenCoordsXY{ window_ride_operating_widgets[WIDX_PAGE_BACKGROUND].left + 4, 103 },
|
|
|
|
|
w->windowPos + ScreenCoordsXY{ window_ride_operating_widgets[WIDX_PAGE_BACKGROUND].right - 5, 104 } },
|
|
|
|
|
w->colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
2014-09-09 02:12:32 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Number of block sections
|
2020-10-01 14:06:28 +02:00
|
|
|
|
if (ride->IsBlockSectioned())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<uint16_t>(ride->num_block_brakes + ride->num_stations);
|
2021-02-27 16:49:13 +01:00
|
|
|
|
DrawTextBasic(
|
|
|
|
|
dpi, w->windowPos + ScreenCoordsXY{ 21, ride->mode == RideMode::PoweredLaunchBlockSectioned ? 89 : 61 },
|
2021-07-27 20:32:27 +02:00
|
|
|
|
STR_BLOCK_SECTIONS, ft, COLOUR_BLACK);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-09 02:12:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
|
2014-09-05 03:37:48 +02:00
|
|
|
|
#pragma region Maintenance
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1AE4
|
2014-09-05 03:37:48 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideLocateMechanic(rct_window* w)
|
2014-09-05 03:37:48 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 15:20:59 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2014-11-04 20:33:17 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// First check if there is a mechanic assigned
|
2019-08-09 15:20:59 +02:00
|
|
|
|
Peep* mechanic = ride_get_assigned_mechanic(ride);
|
2014-11-04 20:33:17 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Otherwise find the closest mechanic
|
2017-08-15 10:07:44 +02:00
|
|
|
|
if (mechanic == nullptr)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
mechanic = ride_find_closest_mechanic(ride, 1);
|
2014-11-04 20:33:17 +01:00
|
|
|
|
|
2017-08-15 10:07:44 +02:00
|
|
|
|
if (mechanic == nullptr)
|
2020-08-27 00:01:15 +02:00
|
|
|
|
context_show_error(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE, {});
|
2017-06-06 23:24:18 +02:00
|
|
|
|
else
|
2017-10-06 23:21:00 +02:00
|
|
|
|
{
|
|
|
|
|
auto intent = Intent(WC_PEEP);
|
|
|
|
|
intent.putExtra(INTENT_EXTRA_PEEP, mechanic);
|
|
|
|
|
context_open_intent(&intent);
|
|
|
|
|
}
|
2014-09-05 03:37:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B7D08
|
2014-09-05 03:37:48 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMaintenanceDrawBar(
|
2021-03-27 03:40:57 +01:00
|
|
|
|
rct_window* w, rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t value, int32_t colour)
|
2014-09-05 03:37:48 +02:00
|
|
|
|
{
|
2020-09-16 05:02:22 +02:00
|
|
|
|
gfx_fill_rect_inset(dpi, { coords, coords + ScreenCoordsXY{ 149, 8 } }, w->colours[1], INSET_RECT_F_30);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (colour & BAR_BLINK)
|
|
|
|
|
{
|
2017-07-20 20:56:29 +02:00
|
|
|
|
colour &= ~BAR_BLINK;
|
2018-12-01 17:00:11 +01:00
|
|
|
|
if (game_is_not_paused() && (gCurrentRealTimeTicks & 8))
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
2014-09-05 15:24:54 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
value = ((186 * ((value * 2) & 0xFF)) >> 8) & 0xFF;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (value > 2)
|
|
|
|
|
{
|
2020-09-16 05:02:22 +02:00
|
|
|
|
gfx_fill_rect_inset(dpi, { coords + ScreenCoordsXY{ 2, 1 }, coords + ScreenCoordsXY{ value + 1, 7 } }, colour, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-05 03:37:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1AAD
|
2014-09-05 03:37:48 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMaintenanceMouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-09-05 03:37:48 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
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:
|
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
|
case WIDX_TAB_6:
|
|
|
|
|
case WIDX_TAB_7:
|
|
|
|
|
case WIDX_TAB_8:
|
|
|
|
|
case WIDX_TAB_9:
|
|
|
|
|
case WIDX_TAB_10:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, widgetIndex - WIDX_TAB_1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_LOCATE_MECHANIC:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideLocateMechanic(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_REFURBISH_RIDE:
|
|
|
|
|
context_open_detail_window(WD_REFURBISH_RIDE, w->number);
|
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-05 03:37:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1D70
|
2014-09-05 03:37:48 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMaintenanceResize(rct_window* w)
|
2014-09-05 03:37:48 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_set_resize(w, 316, 135, 316, 135);
|
2014-09-05 03:37:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1ACE
|
2014-09-05 03:37:48 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMaintenanceMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-09-05 03:37:48 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
2017-10-12 21:07:35 +02:00
|
|
|
|
if (rideEntry == nullptr)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* dropdownWidget = widget;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t j, num_items;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_INSPECTION_INTERVAL_DROPDOWN:
|
|
|
|
|
dropdownWidget--;
|
|
|
|
|
for (int32_t i = 0; i < 7; i++)
|
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[i].Args = RideInspectionIntervalNames[i];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], 0, Dropdown::Flag::StayOpen, 7, widget->right - dropdownWidget->left);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(ride->inspection_interval, true);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WIDX_FORCE_BREAKDOWN:
|
2017-06-06 23:24:18 +02:00
|
|
|
|
num_items = 1;
|
2021-12-01 22:55:52 +01:00
|
|
|
|
for (j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-10-27 22:24:39 +01:00
|
|
|
|
if (rideEntry->ride_type[j] != RIDE_TYPE_NULL)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[0].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[0].Args = STR_DEBUG_FIX_RIDE;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t i = 0; i < 8; i++)
|
|
|
|
|
{
|
2020-05-11 14:32:56 +02:00
|
|
|
|
assert(j < static_cast<int32_t>(std::size(rideEntry->ride_type)));
|
2021-02-26 10:01:00 +01:00
|
|
|
|
if (GetRideTypeDescriptor(rideEntry->ride_type[j]).AvailableBreakdowns & static_cast<uint8_t>(1 << i))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-10-01 14:06:28 +02:00
|
|
|
|
if (i == BREAKDOWN_BRAKES_FAILURE && ride->IsBlockSectioned())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
|
|
|
|
if (ride->num_vehicles != 1)
|
|
|
|
|
continue;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[num_items].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[num_items].Args = RideBreakdownReasonNames[i];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
num_items++;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (num_items == 1)
|
|
|
|
|
{
|
2020-08-27 00:01:15 +02:00
|
|
|
|
context_show_error(STR_DEBUG_NO_BREAKDOWNS_AVAILABLE, STR_NONE, {});
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowText(
|
2020-05-01 20:58:36 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
|
2020-11-03 09:16:06 +01:00
|
|
|
|
dropdownWidget->height() + 1, w->colours[1], Dropdown::Flag::StayOpen, num_items);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
|
|
|
|
|
num_items = 1;
|
|
|
|
|
int32_t breakdownReason = ride->breakdown_reason_pending;
|
|
|
|
|
if (breakdownReason != BREAKDOWN_NONE && (ride->lifecycle_flags & RIDE_LIFECYCLE_BREAKDOWN_PENDING))
|
|
|
|
|
{
|
|
|
|
|
for (int32_t i = 0; i < 8; i++)
|
|
|
|
|
{
|
2021-02-26 10:01:00 +01:00
|
|
|
|
if (GetRideTypeDescriptor(rideEntry->ride_type[j]).AvailableBreakdowns & static_cast<uint8_t>(1 << i))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-10-01 14:06:28 +02:00
|
|
|
|
if (i == BREAKDOWN_BRAKES_FAILURE && ride->IsBlockSectioned())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
|
|
|
|
if (ride->num_vehicles != 1)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (i == breakdownReason)
|
|
|
|
|
{
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(num_items, true);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[num_items].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[num_items].Args = RideBreakdownReasonNames[i];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
num_items++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if ((ride->lifecycle_flags & RIDE_LIFECYCLE_BREAKDOWN_PENDING) == 0)
|
|
|
|
|
{
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetDisabled(0, true);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-05 03:37:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1AD9
|
2014-09-05 03:37:48 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMaintenanceDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex)
|
2014-09-05 03:37:48 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (dropdownIndex == -1)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-09-06 15:40:12 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_INSPECTION_INTERVAL_DROPDOWN:
|
2021-09-06 15:40:12 +02:00
|
|
|
|
set_operating_setting(w->rideId, RideSetSetting::InspectionInterval, dropdownIndex);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_FORCE_BREAKDOWN:
|
|
|
|
|
if (dropdownIndex == 0)
|
|
|
|
|
{
|
2020-01-19 16:53:17 +01:00
|
|
|
|
Vehicle* vehicle;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (ride->breakdown_reason_pending)
|
|
|
|
|
{
|
|
|
|
|
case BREAKDOWN_SAFETY_CUT_OUT:
|
|
|
|
|
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK))
|
|
|
|
|
break;
|
|
|
|
|
for (int32_t i = 0; i < ride->num_vehicles; ++i)
|
|
|
|
|
{
|
2020-07-31 08:48:27 +02:00
|
|
|
|
for (vehicle = GetEntity<Vehicle>(ride->vehicles[i]); vehicle != nullptr;
|
|
|
|
|
vehicle = GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-06-07 21:57:40 +02:00
|
|
|
|
vehicle->ClearUpdateFlag(
|
2018-06-22 23:21:44 +02:00
|
|
|
|
VEHICLE_UPDATE_FLAG_BROKEN_CAR | VEHICLE_UPDATE_FLAG_ZERO_VELOCITY
|
|
|
|
|
| VEHICLE_UPDATE_FLAG_BROKEN_TRAIN);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case BREAKDOWN_RESTRAINTS_STUCK_CLOSED:
|
|
|
|
|
case BREAKDOWN_RESTRAINTS_STUCK_OPEN:
|
|
|
|
|
case BREAKDOWN_DOORS_STUCK_CLOSED:
|
|
|
|
|
case BREAKDOWN_DOORS_STUCK_OPEN:
|
2020-06-06 12:32:37 +02:00
|
|
|
|
vehicle = GetEntity<Vehicle>(ride->vehicles[ride->broken_vehicle]);
|
2020-07-09 23:52:14 +02:00
|
|
|
|
if (vehicle != nullptr)
|
|
|
|
|
{
|
|
|
|
|
vehicle->ClearUpdateFlag(VEHICLE_UPDATE_FLAG_BROKEN_CAR);
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case BREAKDOWN_VEHICLE_MALFUNCTION:
|
2020-06-06 12:32:37 +02:00
|
|
|
|
vehicle = GetEntity<Vehicle>(ride->vehicles[ride->broken_vehicle]);
|
2020-07-09 23:52:14 +02:00
|
|
|
|
if (vehicle != nullptr)
|
|
|
|
|
{
|
|
|
|
|
vehicle->ClearUpdateFlag(VEHICLE_UPDATE_FLAG_BROKEN_TRAIN);
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
ride->lifecycle_flags &= ~(RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN);
|
|
|
|
|
window_invalidate_by_number(WC_RIDE, w->number);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->lifecycle_flags
|
|
|
|
|
& (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))
|
|
|
|
|
{
|
2020-08-27 00:01:15 +02:00
|
|
|
|
context_show_error(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_ALREADY_BROKEN, {});
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2021-06-10 08:09:58 +02:00
|
|
|
|
else if (ride->status == RideStatus::Closed)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-08-27 00:01:15 +02:00
|
|
|
|
context_show_error(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_IS_CLOSED, {});
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int32_t j;
|
2021-12-01 22:55:52 +01:00
|
|
|
|
for (j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
|
|
|
|
if (rideEntry->ride_type[j] != RIDE_TYPE_NULL)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
int32_t i;
|
|
|
|
|
int32_t num_items = 1;
|
|
|
|
|
for (i = 0; i < BREAKDOWN_COUNT; i++)
|
|
|
|
|
{
|
2020-05-11 14:32:56 +02:00
|
|
|
|
assert(j < static_cast<int32_t>(std::size(rideEntry->ride_type)));
|
2021-02-26 10:01:00 +01:00
|
|
|
|
if (GetRideTypeDescriptor(rideEntry->ride_type[j]).AvailableBreakdowns & static_cast<uint8_t>(1 << i))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-10-01 14:06:28 +02:00
|
|
|
|
if (i == BREAKDOWN_BRAKES_FAILURE && ride->IsBlockSectioned())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
|
|
|
|
if (ride->num_vehicles != 1)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (num_items == dropdownIndex)
|
|
|
|
|
break;
|
|
|
|
|
num_items++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-02-13 00:58:45 +01:00
|
|
|
|
ride_prepare_breakdown(ride, i);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-05 03:37:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1D37
|
2014-09-05 03:37:48 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMaintenanceUpdate(rct_window* w)
|
2014-09-05 03:37:48 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->frame_no++;
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_4);
|
2014-09-05 03:37:48 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_MAINTENANCE)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-05 03:37:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B17C8
|
2014-09-05 03:37:48 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMaintenanceInvalidate(rct_window* w)
|
2014-09-05 03:37:48 +02:00
|
|
|
|
{
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto widgets = window_ride_page_widgets[w->page];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->widgets != widgets)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = widgets;
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-05 03:37:48 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPressedTab(w);
|
2014-09-05 03:37:48 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2019-07-21 02:28:33 +02:00
|
|
|
|
|
2020-06-25 02:02:08 +02:00
|
|
|
|
auto ft = Formatter::Common();
|
|
|
|
|
ride->FormatNameTo(ft);
|
2014-09-05 03:37:48 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_maintenance_widgets[WIDX_INSPECTION_INTERVAL].text = RideInspectionIntervalNames[ride->inspection_interval];
|
2014-09-05 03:37:48 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideAnchorBorderWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
2015-06-10 02:18:04 +02:00
|
|
|
|
|
2018-03-29 11:17:54 +02:00
|
|
|
|
if (gConfigGeneral.debugging_tools && network_get_mode() == NETWORK_MODE_NONE)
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_maintenance_widgets[WIDX_FORCE_BREAKDOWN].type = WindowWidgetType::FlatBtn;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-03-29 11:17:54 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_maintenance_widgets[WIDX_FORCE_BREAKDOWN].type = WindowWidgetType::Empty;
|
2018-03-29 11:17:54 +02:00
|
|
|
|
}
|
2015-06-10 02:18:04 +02:00
|
|
|
|
|
2021-02-24 14:02:58 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().AvailableBreakdowns == 0 || !(ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED))
|
2018-03-29 11:17:54 +02:00
|
|
|
|
{
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->disabled_widgets |= (1ULL << WIDX_REFURBISH_RIDE);
|
2018-03-29 11:17:54 +02:00
|
|
|
|
window_ride_maintenance_widgets[WIDX_REFURBISH_RIDE].tooltip = STR_CANT_REFURBISH_NOT_NEEDED;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->disabled_widgets &= ~(1ULL << WIDX_REFURBISH_RIDE);
|
2018-03-29 11:17:54 +02:00
|
|
|
|
window_ride_maintenance_widgets[WIDX_REFURBISH_RIDE].tooltip = STR_REFURBISH_RIDE_TIP;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-05 03:37:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1877
|
2014-09-05 03:37:48 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMaintenancePaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-09-05 03:37:48 +02:00
|
|
|
|
{
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowDrawWidgets(w, dpi);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabImages(dpi, w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Locate mechanic button image
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* widget = &window_ride_maintenance_widgets[WIDX_LOCATE_MECHANIC];
|
2020-06-20 21:09:45 +02:00
|
|
|
|
auto screenCoords = w->windowPos + ScreenCoordsXY{ widget->left, widget->top };
|
|
|
|
|
gfx_draw_sprite(
|
2020-06-24 17:48:17 +02:00
|
|
|
|
dpi, (gStaffMechanicColour << 24) | IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS | SPR_MECHANIC, screenCoords, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Inspection label
|
|
|
|
|
widget = &window_ride_maintenance_widgets[WIDX_INSPECTION_INTERVAL];
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords = w->windowPos + ScreenCoordsXY{ 4, widget->top + 1 };
|
2021-02-27 16:49:13 +01:00
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_INSPECTION);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Reliability
|
|
|
|
|
widget = &window_ride_maintenance_widgets[WIDX_PAGE_BACKGROUND];
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords = w->windowPos + ScreenCoordsXY{ widget->left + 4, widget->top + 4 };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint16_t reliability = ride->reliability_percentage;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<uint16_t>(reliability);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_RELIABILITY_LABEL_1757, ft);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideMaintenanceDrawBar(
|
2021-03-27 03:40:57 +01:00
|
|
|
|
w, dpi, screenCoords + ScreenCoordsXY{ 103, 0 }, std::max<int32_t>(10, reliability), COLOUR_BRIGHT_GREEN);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += 11;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint16_t downTime = ride->downtime;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<uint16_t>(downTime);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_DOWN_TIME_LABEL_1889, ft);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideMaintenanceDrawBar(w, dpi, screenCoords + ScreenCoordsXY{ 103, 0 }, downTime, COLOUR_BRIGHT_RED);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += 26;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Last inspection
|
|
|
|
|
rct_string_id stringId;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
if (ride->last_inspection <= 1)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_TIME_SINCE_LAST_INSPECTION_MINUTE;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
else if (ride->last_inspection <= 240)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_TIME_SINCE_LAST_INSPECTION_MINUTES;
|
|
|
|
|
else
|
|
|
|
|
stringId = STR_TIME_SINCE_LAST_INSPECTION_MORE_THAN_4_HOURS;
|
|
|
|
|
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<uint16_t>(ride->last_inspection);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += 12;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Last / current breakdown
|
|
|
|
|
if (ride->breakdown_reason == BREAKDOWN_NONE)
|
|
|
|
|
return;
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
stringId = (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) ? STR_CURRENT_BREAKDOWN : STR_LAST_BREAKDOWN;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<rct_string_id>(RideBreakdownReasonNames[ride->breakdown_reason]);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2021-03-02 23:19:00 +01:00
|
|
|
|
screenCoords.y += 12;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Mechanic status
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
|
|
|
|
|
{
|
|
|
|
|
switch (ride->mechanic_status)
|
|
|
|
|
{
|
|
|
|
|
case RIDE_MECHANIC_STATUS_CALLING:
|
2019-02-28 20:28:58 +01:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
stringId = STR_NO_MECHANICS_ARE_HIRED_MESSAGE;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-03-16 12:18:06 +01:00
|
|
|
|
for (auto peep : EntityList<Staff>())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-02-21 13:23:31 +01:00
|
|
|
|
if (peep->IsMechanic())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
|
|
|
|
stringId = STR_CALLING_MECHANIC;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2019-02-28 20:28:58 +01:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case RIDE_MECHANIC_STATUS_HEADING:
|
|
|
|
|
stringId = STR_MEHCANIC_IS_HEADING_FOR_THE_RIDE;
|
|
|
|
|
break;
|
|
|
|
|
case RIDE_MECHANIC_STATUS_FIXING:
|
|
|
|
|
case RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES:
|
|
|
|
|
stringId = STR_MEHCANIC_IS_FIXING_THE_RIDE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
stringId = STR_EMPTY;
|
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (stringId != STR_EMPTY)
|
|
|
|
|
{
|
|
|
|
|
if (stringId == STR_CALLING_MECHANIC || stringId == STR_NO_MECHANICS_ARE_HIRED_MESSAGE)
|
|
|
|
|
{
|
2021-03-02 23:19:00 +01:00
|
|
|
|
DrawTextWrapped(dpi, screenCoords, 280, stringId, {}, { TextAlignment::LEFT });
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-09-27 12:36:23 +02:00
|
|
|
|
auto staff = GetEntity<Staff>(ride->mechanic);
|
|
|
|
|
if (staff != nullptr && staff->IsMechanic())
|
2018-04-26 17:15:29 +02:00
|
|
|
|
{
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
2020-09-27 12:36:23 +02:00
|
|
|
|
staff->FormatNameTo(ft);
|
2021-03-02 23:19:00 +01:00
|
|
|
|
DrawTextWrapped(dpi, screenCoords, 280, stringId, ft, { TextAlignment::LEFT });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-09-05 03:37:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
|
2014-09-10 19:13:07 +02:00
|
|
|
|
#pragma region Colour
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static uint32_t WindowRideGetColourButtonImage(int32_t colour)
|
2014-09-11 00:05:20 +02:00
|
|
|
|
{
|
2017-07-20 20:56:29 +02:00
|
|
|
|
return IMAGE_TYPE_TRANSPARENT | SPRITE_ID_PALETTE_COLOUR_1(colour) | SPR_PALETTE_BTN;
|
2014-09-11 00:05:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static int32_t WindowRideHasTrackColour(Ride* ride, int32_t trackColour)
|
2014-09-11 00:05:20 +02:00
|
|
|
|
{
|
2018-12-05 21:33:45 +01:00
|
|
|
|
// Get station flags (shops don't have them)
|
|
|
|
|
auto stationObjFlags = 0;
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP))
|
2018-12-05 21:33:45 +01:00
|
|
|
|
{
|
2021-12-18 18:48:52 +01:00
|
|
|
|
auto stationObj = ride->GetStationObject();
|
2018-12-05 21:33:45 +01:00
|
|
|
|
if (stationObj != nullptr)
|
|
|
|
|
{
|
|
|
|
|
stationObjFlags = stationObj->Flags;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-09-11 00:05:20 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (trackColour)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
2018-12-05 21:33:45 +01:00
|
|
|
|
return (stationObjFlags & STATION_OBJECT_FLAGS::HAS_PRIMARY_COLOUR)
|
2021-02-24 13:53:01 +01:00
|
|
|
|
|| ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case 1:
|
2018-12-05 21:33:45 +01:00
|
|
|
|
return (stationObjFlags & STATION_OBJECT_FLAGS::HAS_SECONDARY_COLOUR)
|
2021-02-24 13:53:01 +01:00
|
|
|
|
|| ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case 2:
|
2021-02-24 13:53:01 +01:00
|
|
|
|
return ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
default:
|
|
|
|
|
return 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-11 00:05:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideSetTrackColourScheme(rct_window* w, const ScreenCoordsXY& screenPos)
|
2014-09-18 01:31:20 +02:00
|
|
|
|
{
|
2020-08-02 09:32:59 +02:00
|
|
|
|
auto newColourScheme = static_cast<uint8_t>(w->ride_colour);
|
2021-02-10 02:06:18 +01:00
|
|
|
|
auto info = get_map_coordinates_from_pos(screenPos, EnumsToFlags(ViewportInteractionItem::Ride));
|
2014-09-18 01:31:20 +02:00
|
|
|
|
|
2020-12-29 19:09:15 +01:00
|
|
|
|
if (info.SpriteType != ViewportInteractionItem::Ride)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
2021-12-11 00:39:39 +01:00
|
|
|
|
if (info.Element->GetType() != TileElementType::Track)
|
2018-10-09 22:15:12 +02:00
|
|
|
|
return;
|
2021-09-04 18:04:53 +02:00
|
|
|
|
if (info.Element->AsTrack()->GetRideIndex() != w->rideId)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
2020-08-02 09:32:59 +02:00
|
|
|
|
if (info.Element->AsTrack()->GetColourScheme() == newColourScheme)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
2014-09-18 01:31:20 +02:00
|
|
|
|
|
2020-08-02 09:32:59 +02:00
|
|
|
|
auto z = info.Element->GetBaseZ();
|
|
|
|
|
auto direction = info.Element->GetDirection();
|
2019-07-07 03:53:59 +02:00
|
|
|
|
auto gameAction = RideSetColourSchemeAction(
|
2020-08-02 09:32:59 +02:00
|
|
|
|
CoordsXYZD{ info.Loc, z, static_cast<Direction>(direction) }, info.Element->AsTrack()->GetTrackType(), newColourScheme);
|
2018-12-11 22:17:52 +01:00
|
|
|
|
GameActions::Execute(&gameAction);
|
2014-09-18 01:31:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-10 19:13:07 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B04FA
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourClose(rct_window* w)
|
2014-09-10 19:13:07 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE)))
|
|
|
|
|
return;
|
2014-09-10 19:13:07 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (gCurrentToolWidget.window_classification != w->classification)
|
|
|
|
|
return;
|
2014-09-10 19:13:07 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (gCurrentToolWidget.window_number != w->number)
|
|
|
|
|
return;
|
2014-09-10 19:13:07 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
tool_cancel();
|
2014-09-10 19:13:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B02A1
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourMouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-09-10 19:13:07 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
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:
|
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
|
case WIDX_TAB_6:
|
|
|
|
|
case WIDX_TAB_7:
|
|
|
|
|
case WIDX_TAB_8:
|
|
|
|
|
case WIDX_TAB_9:
|
|
|
|
|
case WIDX_TAB_10:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, widgetIndex - WIDX_TAB_1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_PAINT_INDIVIDUAL_AREA:
|
2020-12-23 05:11:15 +01:00
|
|
|
|
tool_set(w, WIDX_PAINT_INDIVIDUAL_AREA, Tool::PaintDown);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-10 19:13:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B0AB6
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourResize(rct_window* w)
|
2014-09-10 19:13:07 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_set_resize(w, 316, 207, 316, 207);
|
2014-09-10 19:13:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B02C6
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-09-14 19:43:36 +02:00
|
|
|
|
{
|
2021-11-29 23:04:31 +01:00
|
|
|
|
VehicleColour vehicleColour;
|
2018-12-05 21:33:45 +01:00
|
|
|
|
int32_t i, numItems;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_string_id stringId;
|
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto colourSchemeIndex = w->ride_colour;
|
|
|
|
|
auto dropdownWidget = widget - 1;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_TRACK_COLOUR_SCHEME_DROPDOWN:
|
2022-02-01 21:59:48 +01:00
|
|
|
|
for (i = 0; i < OpenRCT2::Limits::NumColourSchemes; i++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[i].Args = ColourSchemeNames[i];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], 0, Dropdown::Flag::StayOpen, 4, widget->right - dropdownWidget->left);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(colourSchemeIndex, true);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_TRACK_MAIN_COLOUR:
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowColour(w, widget, w->colours[1], ride->track_colour[colourSchemeIndex].main);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_TRACK_ADDITIONAL_COLOUR:
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowColour(w, widget, w->colours[1], ride->track_colour[colourSchemeIndex].additional);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_TRACK_SUPPORT_COLOUR:
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowColour(w, widget, w->colours[1], ride->track_colour[colourSchemeIndex].supports);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_MAZE_STYLE_DROPDOWN:
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[i].Args = MazeOptions[i].text;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], 0, Dropdown::Flag::StayOpen, 4, widget->right - dropdownWidget->left);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(ride->track_colour[colourSchemeIndex].supports, true);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_ENTRANCE_STYLE_DROPDOWN:
|
2018-12-05 21:33:45 +01:00
|
|
|
|
{
|
|
|
|
|
auto ddIndex = 0;
|
|
|
|
|
auto& objManager = GetContext()->GetObjectManager();
|
|
|
|
|
for (i = 0; i < MAX_STATION_OBJECTS; i++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-09 10:36:37 +01:00
|
|
|
|
auto stationObj = static_cast<StationObject*>(objManager.GetLoadedObject(ObjectType::Station, i));
|
2018-12-05 21:33:45 +01:00
|
|
|
|
if (stationObj != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[ddIndex].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[ddIndex].Args = stationObj->NameStringId;
|
2018-12-05 21:33:45 +01:00
|
|
|
|
if (ride->entrance_style == i)
|
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[ddIndex].Format = STR_DROPDOWN_MENU_LABEL_SELECTED;
|
2018-12-05 21:33:45 +01:00
|
|
|
|
}
|
|
|
|
|
ddIndex++;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], 0, Dropdown::Flag::StayOpen, ddIndex, widget->right - dropdownWidget->left);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2018-12-05 21:33:45 +01:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN:
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[i].Args = (GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).singular
|
|
|
|
|
<< 16)
|
2018-07-21 11:50:45 +02:00
|
|
|
|
| VehicleColourSchemeNames[i];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], 0, Dropdown::Flag::StayOpen, rideEntry->max_cars_in_train > 1 ? 3 : 2,
|
2020-06-25 03:44:00 +02:00
|
|
|
|
widget->right - dropdownWidget->left);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(ride->colour_scheme_type & 3, true);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN:
|
|
|
|
|
numItems = ride->num_vehicles;
|
|
|
|
|
if ((ride->colour_scheme_type & 3) != VEHICLE_COLOUR_SCHEME_PER_TRAIN)
|
|
|
|
|
numItems = ride->num_cars_per_train;
|
|
|
|
|
|
|
|
|
|
stringId = (ride->colour_scheme_type & 3) == VEHICLE_COLOUR_SCHEME_PER_TRAIN ? STR_RIDE_COLOUR_TRAIN_OPTION
|
|
|
|
|
: STR_RIDE_COLOUR_VEHICLE_OPTION;
|
2020-11-03 09:16:06 +01:00
|
|
|
|
for (i = 0; i < std::min(numItems, Dropdown::ItemsMaxSize); i++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[i].Args = (static_cast<int64_t>(i + 1) << 32)
|
2021-02-24 14:02:58 +01:00
|
|
|
|
| ((GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).capitalised) << 16)
|
2020-04-18 12:12:07 +02:00
|
|
|
|
| stringId;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], 0, Dropdown::Flag::StayOpen, numItems, widget->right - dropdownWidget->left);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetChecked(w->vehicleIndex, true);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2021-11-29 23:04:31 +01:00
|
|
|
|
case WIDX_VEHICLE_BODY_COLOR:
|
2018-06-22 23:21:44 +02:00
|
|
|
|
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
|
2021-11-29 23:04:31 +01:00
|
|
|
|
WindowDropdownShowColour(w, widget, w->colours[1], vehicleColour.Body);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2021-11-29 23:04:31 +01:00
|
|
|
|
case WIDX_VEHICLE_TRIM_COLOUR:
|
2018-06-22 23:21:44 +02:00
|
|
|
|
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
|
2021-11-29 23:04:31 +01:00
|
|
|
|
WindowDropdownShowColour(w, widget, w->colours[1], vehicleColour.Trim);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2021-11-29 23:04:31 +01:00
|
|
|
|
case WIDX_VEHICLE_TERNARY_COLOUR:
|
2018-06-22 23:21:44 +02:00
|
|
|
|
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
|
2021-11-29 23:04:31 +01:00
|
|
|
|
WindowDropdownShowColour(w, widget, w->colours[1], vehicleColour.Ternary);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-14 19:43:36 +02:00
|
|
|
|
}
|
2014-09-10 19:13:07 +02:00
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B0331
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex)
|
2014-09-14 19:43:36 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (dropdownIndex == -1)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
const auto rideId = w->rideId;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_TRACK_COLOUR_SCHEME_DROPDOWN:
|
2020-04-18 13:32:48 +02:00
|
|
|
|
w->ride_colour = static_cast<uint16_t>(dropdownIndex);
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_TRACK_MAIN_COLOUR:
|
2019-02-06 12:56:08 +01:00
|
|
|
|
{
|
2019-02-06 16:05:35 +01:00
|
|
|
|
auto rideSetAppearanceAction = RideSetAppearanceAction(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetAppearanceType::TrackColourMain, dropdownIndex, w->ride_colour);
|
2019-02-06 12:56:08 +01:00
|
|
|
|
GameActions::Execute(&rideSetAppearanceAction);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_TRACK_ADDITIONAL_COLOUR:
|
2019-02-06 12:56:08 +01:00
|
|
|
|
{
|
2019-02-06 16:05:35 +01:00
|
|
|
|
auto rideSetAppearanceAction = RideSetAppearanceAction(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetAppearanceType::TrackColourAdditional, dropdownIndex, w->ride_colour);
|
2019-02-06 12:56:08 +01:00
|
|
|
|
GameActions::Execute(&rideSetAppearanceAction);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_TRACK_SUPPORT_COLOUR:
|
2019-02-06 12:56:08 +01:00
|
|
|
|
{
|
2019-02-06 16:05:35 +01:00
|
|
|
|
auto rideSetAppearanceAction = RideSetAppearanceAction(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetAppearanceType::TrackColourSupports, dropdownIndex, w->ride_colour);
|
2019-02-06 12:56:08 +01:00
|
|
|
|
GameActions::Execute(&rideSetAppearanceAction);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_MAZE_STYLE_DROPDOWN:
|
2019-02-06 12:56:08 +01:00
|
|
|
|
{
|
2019-02-06 16:05:35 +01:00
|
|
|
|
auto rideSetAppearanceAction = RideSetAppearanceAction(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetAppearanceType::MazeStyle, dropdownIndex, w->ride_colour);
|
2019-02-06 12:56:08 +01:00
|
|
|
|
GameActions::Execute(&rideSetAppearanceAction);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_ENTRANCE_STYLE_DROPDOWN:
|
2018-12-05 21:33:45 +01:00
|
|
|
|
{
|
|
|
|
|
auto ddIndex = 0;
|
|
|
|
|
auto& objManager = GetContext()->GetObjectManager();
|
|
|
|
|
for (auto i = 0; i < MAX_STATION_OBJECTS; i++)
|
|
|
|
|
{
|
2020-11-09 10:36:37 +01:00
|
|
|
|
auto stationObj = static_cast<StationObject*>(objManager.GetLoadedObject(ObjectType::Station, i));
|
2018-12-05 21:33:45 +01:00
|
|
|
|
if (stationObj != nullptr)
|
|
|
|
|
{
|
|
|
|
|
if (ddIndex == dropdownIndex)
|
|
|
|
|
{
|
2019-02-06 16:05:35 +01:00
|
|
|
|
auto rideSetAppearanceAction = RideSetAppearanceAction(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetAppearanceType::EntranceStyle, ddIndex, 0);
|
2022-01-29 15:42:27 +01:00
|
|
|
|
rideSetAppearanceAction.SetCallback([ddIndex](const GameAction*, const GameActions::Result* res) {
|
|
|
|
|
if (res->Error != GameActions::Status::Ok)
|
|
|
|
|
return;
|
|
|
|
|
gLastEntranceStyle = ddIndex;
|
|
|
|
|
});
|
2019-02-06 12:56:08 +01:00
|
|
|
|
GameActions::Execute(&rideSetAppearanceAction);
|
2018-12-05 21:33:45 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
ddIndex++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2018-12-05 21:33:45 +01:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN:
|
2019-02-06 12:56:08 +01:00
|
|
|
|
{
|
2019-02-06 16:05:35 +01:00
|
|
|
|
auto rideSetAppearanceAction = RideSetAppearanceAction(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetAppearanceType::VehicleColourScheme, dropdownIndex, 0);
|
2019-02-06 12:56:08 +01:00
|
|
|
|
GameActions::Execute(&rideSetAppearanceAction);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
w->vehicleIndex = 0;
|
2019-02-06 12:56:08 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN:
|
|
|
|
|
w->vehicleIndex = dropdownIndex;
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2021-11-29 23:04:31 +01:00
|
|
|
|
case WIDX_VEHICLE_BODY_COLOR:
|
2019-02-06 12:56:08 +01:00
|
|
|
|
{
|
2019-02-06 16:05:35 +01:00
|
|
|
|
auto rideSetAppearanceAction = RideSetAppearanceAction(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetAppearanceType::VehicleColourBody, dropdownIndex, w->vehicleIndex);
|
2019-02-06 12:56:08 +01:00
|
|
|
|
GameActions::Execute(&rideSetAppearanceAction);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2021-11-29 23:04:31 +01:00
|
|
|
|
case WIDX_VEHICLE_TRIM_COLOUR:
|
2019-02-06 12:56:08 +01:00
|
|
|
|
{
|
2019-02-06 16:05:35 +01:00
|
|
|
|
auto rideSetAppearanceAction = RideSetAppearanceAction(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetAppearanceType::VehicleColourTrim, dropdownIndex, w->vehicleIndex);
|
2019-02-06 12:56:08 +01:00
|
|
|
|
GameActions::Execute(&rideSetAppearanceAction);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2021-11-29 23:04:31 +01:00
|
|
|
|
case WIDX_VEHICLE_TERNARY_COLOUR:
|
2019-02-06 12:56:08 +01:00
|
|
|
|
{
|
2019-02-06 16:05:35 +01:00
|
|
|
|
auto rideSetAppearanceAction = RideSetAppearanceAction(
|
2021-08-02 06:24:52 +02:00
|
|
|
|
rideId, RideSetAppearanceType::VehicleColourTernary, dropdownIndex, w->vehicleIndex);
|
2019-02-06 12:56:08 +01:00
|
|
|
|
GameActions::Execute(&rideSetAppearanceAction);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-14 19:43:36 +02:00
|
|
|
|
}
|
2014-09-10 19:13:07 +02:00
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B0A8F
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourUpdate(rct_window* w)
|
2014-09-10 19:13:07 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->frame_no++;
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_5);
|
|
|
|
|
widget_invalidate(w, WIDX_VEHICLE_PREVIEW);
|
2014-09-10 19:13:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B04EC
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourTooldown(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
|
2015-10-20 20:16:30 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (widgetIndex == WIDX_PAINT_INDIVIDUAL_AREA)
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetTrackColourScheme(w, screenCoords);
|
2014-09-18 01:31:20 +02:00
|
|
|
|
}
|
2014-09-10 19:13:07 +02:00
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B04F3
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourTooldrag(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
|
2015-10-20 20:16:30 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (widgetIndex == WIDX_PAINT_INDIVIDUAL_AREA)
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetTrackColourScheme(w, screenCoords);
|
2014-09-18 01:31:20 +02:00
|
|
|
|
}
|
2014-09-10 19:13:07 +02:00
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AFB36
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourInvalidate(rct_window* w)
|
2014-09-10 19:13:07 +02:00
|
|
|
|
{
|
2019-01-01 21:33:59 +01:00
|
|
|
|
TrackColour trackColour;
|
2021-11-29 23:04:31 +01:00
|
|
|
|
VehicleColour vehicleColour;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2019-08-09 15:20:59 +02:00
|
|
|
|
auto widgets = window_ride_page_widgets[w->page];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->widgets != widgets)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = widgets;
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPressedTab(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 15:20:59 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2019-07-21 13:09:23 +02:00
|
|
|
|
w->widgets[WIDX_TITLE].text = STR_ARG_16_STRINGID;
|
2020-06-25 02:02:08 +02:00
|
|
|
|
auto ft = Formatter::Common();
|
|
|
|
|
ft.Increment(16);
|
|
|
|
|
ride->FormatNameTo(ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Track colours
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t colourScheme = w->ride_colour;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
trackColour = ride_get_track_colour(ride, colourScheme);
|
|
|
|
|
|
|
|
|
|
// Maze style
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->type == RIDE_TYPE_MAZE)
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_MAZE_STYLE].type = WindowWidgetType::DropdownMenu;
|
|
|
|
|
window_ride_colour_widgets[WIDX_MAZE_STYLE_DROPDOWN].type = WindowWidgetType::Button;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_colour_widgets[WIDX_MAZE_STYLE].text = MazeOptions[trackColour.supports].text;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_MAZE_STYLE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_MAZE_STYLE_DROPDOWN].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Track, multiple colour schemes
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_SUPPORTS_MULTIPLE_TRACK_COLOUR))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_COLOUR_SCHEME].type = WindowWidgetType::DropdownMenu;
|
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_colour_widgets[WIDX_PAINT_INDIVIDUAL_AREA].type = WindowWidgetType::FlatBtn;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_COLOUR_SCHEME].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_PAINT_INDIVIDUAL_AREA].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Track main colour
|
2021-11-23 14:18:07 +01:00
|
|
|
|
if (WindowRideHasTrackColour(ride, 0))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_MAIN_COLOUR].type = WindowWidgetType::ColourBtn;
|
2021-11-23 14:18:07 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_MAIN_COLOUR].image = WindowRideGetColourButtonImage(trackColour.main);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_MAIN_COLOUR].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Track additional colour
|
2021-11-23 14:18:07 +01:00
|
|
|
|
if (WindowRideHasTrackColour(ride, 1))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_ADDITIONAL_COLOUR].type = WindowWidgetType::ColourBtn;
|
2021-11-23 14:18:07 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_ADDITIONAL_COLOUR].image = WindowRideGetColourButtonImage(trackColour.additional);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_ADDITIONAL_COLOUR].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Track supports colour
|
2021-11-23 14:18:07 +01:00
|
|
|
|
if (WindowRideHasTrackColour(ride, 2) && ride->type != RIDE_TYPE_MAZE)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_SUPPORT_COLOUR].type = WindowWidgetType::ColourBtn;
|
2021-11-23 14:18:07 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_SUPPORT_COLOUR].image = WindowRideGetColourButtonImage(trackColour.supports);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_SUPPORT_COLOUR].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Track preview
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(
|
2018-06-22 23:21:44 +02:00
|
|
|
|
RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN | RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL
|
2021-02-24 13:53:01 +01:00
|
|
|
|
| RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS))
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_PREVIEW].type = WindowWidgetType::Spinner;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
else
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_TRACK_PREVIEW].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Entrance style
|
2021-02-25 22:55:06 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_ENTRANCE_EXIT))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_ENTRANCE_PREVIEW].type = WindowWidgetType::Spinner;
|
|
|
|
|
window_ride_colour_widgets[WIDX_ENTRANCE_STYLE].type = WindowWidgetType::DropdownMenu;
|
|
|
|
|
window_ride_colour_widgets[WIDX_ENTRANCE_STYLE_DROPDOWN].type = WindowWidgetType::Button;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-12-05 21:33:45 +01:00
|
|
|
|
auto stringId = STR_NONE;
|
2021-12-18 18:48:52 +01:00
|
|
|
|
auto stationObj = ride->GetStationObject();
|
2018-12-05 21:33:45 +01:00
|
|
|
|
if (stationObj != nullptr)
|
|
|
|
|
{
|
|
|
|
|
stringId = stationObj->NameStringId;
|
|
|
|
|
}
|
|
|
|
|
window_ride_colour_widgets[WIDX_ENTRANCE_STYLE].text = stringId;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_ENTRANCE_PREVIEW].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_ENTRANCE_STYLE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_ENTRANCE_STYLE_DROPDOWN].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Vehicle colours
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)
|
|
|
|
|
&& ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_VEHICLE_COLOURS))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t vehicleColourSchemeType = ride->colour_scheme_type & 3;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (vehicleColourSchemeType == 0)
|
2017-07-28 12:31:49 +02:00
|
|
|
|
w->vehicleIndex = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2017-07-28 12:31:49 +02:00
|
|
|
|
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_PREVIEW].type = WindowWidgetType::Scroll;
|
2021-11-29 23:04:31 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_BODY_COLOR].type = WindowWidgetType::ColourBtn;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_BODY_COLOR].image = WindowRideGetColourButtonImage(vehicleColour.Body);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-11-29 23:04:31 +01:00
|
|
|
|
bool allowChangingTrimColour = false;
|
|
|
|
|
bool allowChangingTernaryColour = false;
|
2017-07-20 12:57:37 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t i = 0; i < ride->num_cars_per_train; i++)
|
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
|
uint8_t vehicleTypeIndex = ride_entry_get_vehicle_at_position(ride->subtype, ride->num_cars_per_train, i);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-11-29 23:04:31 +01:00
|
|
|
|
if (rideEntry->vehicles[vehicleTypeIndex].flags & VEHICLE_ENTRY_FLAG_ENABLE_TRIM_COLOUR)
|
2017-07-20 12:57:37 +02:00
|
|
|
|
{
|
2021-11-29 23:04:31 +01:00
|
|
|
|
allowChangingTrimColour = true;
|
2017-07-20 12:57:37 +02:00
|
|
|
|
}
|
2021-11-29 23:04:31 +01:00
|
|
|
|
if (rideEntry->vehicles[vehicleTypeIndex].flags & VEHICLE_ENTRY_FLAG_ENABLE_TERNARY_COLOUR)
|
2017-07-20 12:57:37 +02:00
|
|
|
|
{
|
2021-11-29 23:04:31 +01:00
|
|
|
|
allowChangingTernaryColour = true;
|
2017-07-20 12:57:37 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Additional colours
|
2021-11-29 23:04:31 +01:00
|
|
|
|
if (allowChangingTrimColour)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-11-29 23:04:31 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_TRIM_COLOUR].type = WindowWidgetType::ColourBtn;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_TRIM_COLOUR].image = WindowRideGetColourButtonImage(vehicleColour.Trim);
|
|
|
|
|
if (allowChangingTernaryColour)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-11-29 23:04:31 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_TERNARY_COLOUR].type = WindowWidgetType::ColourBtn;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_TERNARY_COLOUR].image = WindowRideGetColourButtonImage(
|
|
|
|
|
vehicleColour.Ternary);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-11-29 23:04:31 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_TERNARY_COLOUR].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-11-29 23:04:31 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_TRIM_COLOUR].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_TERNARY_COLOUR].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Vehicle colour scheme type
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_VEHICLE_IS_INTEGRAL)
|
2020-03-16 22:52:06 +01:00
|
|
|
|
&& (ride->num_cars_per_train | ride->num_vehicles) > 1)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WindowWidgetType::DropdownMenu;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Button;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-06-25 02:02:08 +02:00
|
|
|
|
ft.Rewind();
|
2020-06-03 11:20:29 +02:00
|
|
|
|
ft.Increment(6);
|
|
|
|
|
ft.Add<rct_string_id>(VehicleColourSchemeNames[vehicleColourSchemeType]);
|
2021-02-24 14:02:58 +01:00
|
|
|
|
ft.Add<rct_string_id>(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).singular);
|
|
|
|
|
ft.Add<rct_string_id>(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).capitalised);
|
2020-06-03 11:20:29 +02:00
|
|
|
|
ft.Add<uint16_t>(w->vehicleIndex + 1);
|
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Vehicle index
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (vehicleColourSchemeType != 0)
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WindowWidgetType::DropdownMenu;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN].type = WindowWidgetType::Button;
|
2018-07-21 11:50:45 +02:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_INDEX].text = vehicleColourSchemeType == 1
|
|
|
|
|
? STR_RIDE_COLOUR_TRAIN_VALUE
|
|
|
|
|
: STR_RIDE_COLOUR_VEHICLE_VALUE;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_PREVIEW].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN].type = WindowWidgetType::Empty;
|
2021-11-29 23:04:31 +01:00
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_BODY_COLOR].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_TRIM_COLOUR].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_colour_widgets[WIDX_VEHICLE_TERNARY_COLOUR].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-06-25 02:02:08 +02:00
|
|
|
|
ft.Rewind();
|
2020-06-03 11:20:29 +02:00
|
|
|
|
ft.Increment(14);
|
|
|
|
|
ft.Add<rct_string_id>(ColourSchemeNames[colourScheme]);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideAnchorBorderWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
2014-09-10 19:13:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AFF3E
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-09-10 19:13:07 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// TODO: This should use lists and identified sprites
|
|
|
|
|
rct_drawpixelinfo clippedDpi;
|
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowDrawWidgets(w, dpi);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabImages(dpi, w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Track / shop item preview
|
2021-10-01 01:15:07 +02:00
|
|
|
|
const auto& trackPreviewWidget = window_ride_colour_widgets[WIDX_TRACK_PREVIEW];
|
|
|
|
|
if (trackPreviewWidget.type != WindowWidgetType::Empty)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
gfx_fill_rect(
|
2020-07-13 22:49:12 +02:00
|
|
|
|
dpi,
|
2021-10-01 01:15:07 +02:00
|
|
|
|
{ { w->windowPos + ScreenCoordsXY{ trackPreviewWidget.left + 1, trackPreviewWidget.top + 1 } },
|
|
|
|
|
{ w->windowPos + ScreenCoordsXY{ trackPreviewWidget.right - 1, trackPreviewWidget.bottom - 1 } } },
|
2020-07-13 22:49:12 +02:00
|
|
|
|
PALETTE_INDEX_12);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2019-01-01 21:33:59 +01:00
|
|
|
|
auto trackColour = ride_get_track_colour(ride, w->ride_colour);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
//
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if (rideEntry == nullptr || rideEntry->shop_item[0] == ShopItem::None)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-10-01 01:15:07 +02:00
|
|
|
|
auto screenCoords = w->windowPos + ScreenCoordsXY{ trackPreviewWidget.left, trackPreviewWidget.top };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Track
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->type == RIDE_TYPE_MAZE)
|
|
|
|
|
{
|
2021-03-23 11:58:09 +01:00
|
|
|
|
gfx_draw_sprite(dpi, ImageId(MazeOptions[trackColour.supports].sprite), screenCoords);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-07-03 22:15:11 +02:00
|
|
|
|
auto typeDescriptor = ride->GetRideTypeDescriptor();
|
|
|
|
|
int32_t spriteIndex = typeDescriptor.ColourPreview.Track;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (spriteIndex != 0)
|
|
|
|
|
{
|
2021-03-23 11:58:09 +01:00
|
|
|
|
gfx_draw_sprite(dpi, ImageId(spriteIndex, trackColour.main, trackColour.additional), screenCoords);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Supports
|
2020-07-03 22:15:11 +02:00
|
|
|
|
spriteIndex = typeDescriptor.ColourPreview.Supports;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (spriteIndex != 0)
|
|
|
|
|
{
|
2021-03-23 11:58:09 +01:00
|
|
|
|
gfx_draw_sprite(dpi, ImageId(spriteIndex, trackColour.supports), screenCoords);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-06-24 17:48:17 +02:00
|
|
|
|
auto screenCoords = w->windowPos
|
2021-10-01 01:15:07 +02:00
|
|
|
|
+ ScreenCoordsXY{ (trackPreviewWidget.left + trackPreviewWidget.right) / 2 - 8,
|
|
|
|
|
(trackPreviewWidget.bottom + trackPreviewWidget.top) / 2 - 6 };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-12-04 01:15:59 +01:00
|
|
|
|
ShopItem shopItem = rideEntry->shop_item[1] == ShopItem::None ? rideEntry->shop_item[0] : rideEntry->shop_item[1];
|
2021-03-23 11:58:09 +01:00
|
|
|
|
gfx_draw_sprite(dpi, ImageId(GetShopItemDescriptor(shopItem).Image, ride->track_colour[0].main), screenCoords);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Entrance preview
|
|
|
|
|
trackColour = ride_get_track_colour(ride, 0);
|
2021-10-01 01:15:07 +02:00
|
|
|
|
const auto& entrancePreviewWidget = w->widgets[WIDX_ENTRANCE_PREVIEW];
|
|
|
|
|
if (entrancePreviewWidget.type != WindowWidgetType::Empty)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (clip_drawpixelinfo(
|
2021-10-01 01:15:07 +02:00
|
|
|
|
&clippedDpi, dpi,
|
|
|
|
|
w->windowPos + ScreenCoordsXY{ entrancePreviewWidget.left + 1, entrancePreviewWidget.top + 1 },
|
|
|
|
|
entrancePreviewWidget.width(), entrancePreviewWidget.height()))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
gfx_clear(&clippedDpi, PALETTE_INDEX_12);
|
|
|
|
|
|
2021-12-18 18:48:52 +01:00
|
|
|
|
auto stationObj = ride->GetStationObject();
|
2021-12-13 23:11:55 +01:00
|
|
|
|
if (stationObj != nullptr && stationObj->BaseImageId != ImageIndexUndefined)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-12-05 02:50:33 +01:00
|
|
|
|
auto imageTemplate = ImageId(trackColour.main, trackColour.additional);
|
|
|
|
|
auto imageId = imageTemplate.WithIndex(stationObj->BaseImageId);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Back
|
2021-12-05 02:50:33 +01:00
|
|
|
|
gfx_draw_sprite(&clippedDpi, imageId, { 34, 20 });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Front
|
2021-12-05 02:50:33 +01:00
|
|
|
|
gfx_draw_sprite(&clippedDpi, imageId.WithIndexOffset(4), { 34, 20 });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Glass
|
2021-12-05 02:50:33 +01:00
|
|
|
|
if (stationObj->Flags & STATION_OBJECT_FLAGS::IS_TRANSPARENT)
|
|
|
|
|
{
|
|
|
|
|
auto glassImageId = ImageId(stationObj->BaseImageId + 20).WithTransparancy(trackColour.main);
|
|
|
|
|
gfx_draw_sprite(&clippedDpi, glassImageId, { 34, 20 });
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-12-15 19:00:37 +01:00
|
|
|
|
|
2021-02-28 00:22:24 +01:00
|
|
|
|
DrawTextEllipsised(dpi, { w->windowPos.x + 3, w->windowPos.y + 103 }, 97, STR_STATION_STYLE, {});
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-10 19:13:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B0192
|
2014-09-10 19:13:07 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideColourScrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)
|
2014-09-14 02:21:33 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2014-09-14 02:21:33 +02:00
|
|
|
|
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto vehiclePreviewWidget = &window_ride_colour_widgets[WIDX_VEHICLE_PREVIEW];
|
|
|
|
|
auto vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
|
2014-09-14 02:21:33 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Background colour
|
2020-07-13 22:49:12 +02:00
|
|
|
|
gfx_fill_rect(dpi, { { dpi->x, dpi->y }, { dpi->x + dpi->width - 1, dpi->y + dpi->height - 1 } }, PALETTE_INDEX_12);
|
2014-09-14 02:21:33 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// ?
|
2020-06-25 03:44:00 +02:00
|
|
|
|
auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 15 };
|
2015-06-29 02:24:07 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// ?
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto trainCarIndex = (ride->colour_scheme_type & 3) == RIDE_COLOUR_SCHEME_DIFFERENT_PER_CAR ? w->vehicleIndex
|
|
|
|
|
: rideEntry->tab_vehicle;
|
2014-09-14 02:21:33 +02:00
|
|
|
|
|
2018-07-21 11:50:45 +02:00
|
|
|
|
rct_ride_entry_vehicle* rideVehicleEntry = &rideEntry->vehicles[ride_entry_get_vehicle_at_position(
|
|
|
|
|
ride->subtype, ride->num_cars_per_train, trainCarIndex)];
|
2015-03-01 15:24:05 +01:00
|
|
|
|
|
2020-06-24 17:48:17 +02:00
|
|
|
|
screenCoords.y += rideVehicleEntry->tab_height;
|
2014-09-14 02:21:33 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Draw the coloured spinning vehicle
|
2021-12-05 02:50:33 +01:00
|
|
|
|
ImageIndex imageIndex = (rideVehicleEntry->flags & VEHICLE_ENTRY_FLAG_USE_16_ROTATION_FRAMES) ? w->frame_no / 4
|
|
|
|
|
: w->frame_no / 2;
|
|
|
|
|
imageIndex &= rideVehicleEntry->rotation_frame_mask;
|
|
|
|
|
imageIndex *= rideVehicleEntry->base_num_frames;
|
|
|
|
|
imageIndex += rideVehicleEntry->base_image_id;
|
|
|
|
|
auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Ternary);
|
|
|
|
|
gfx_draw_sprite(dpi, imageId, screenCoords);
|
2014-09-14 02:21:33 +02:00
|
|
|
|
}
|
2014-09-10 19:13:07 +02:00
|
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
#pragma region Music
|
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
static constexpr const uint8_t MusicStyleOrder[] = {
|
2021-10-17 15:31:56 +02:00
|
|
|
|
MUSIC_STYLE_GENTLE, MUSIC_STYLE_SUMMER, MUSIC_STYLE_WATER,
|
|
|
|
|
MUSIC_STYLE_RAGTIME, MUSIC_STYLE_TECHNO, MUSIC_STYLE_MECHANICAL,
|
|
|
|
|
MUSIC_STYLE_MODERN, MUSIC_STYLE_WILD_WEST, MUSIC_STYLE_PIRATES,
|
|
|
|
|
MUSIC_STYLE_ROCK, MUSIC_STYLE_ROCK_STYLE_2, MUSIC_STYLE_ROCK_STYLE_3,
|
|
|
|
|
MUSIC_STYLE_FANTASY, MUSIC_STYLE_HORROR, MUSIC_STYLE_TOYLAND,
|
|
|
|
|
MUSIC_STYLE_CANDY_STYLE, MUSIC_STYLE_ROMAN_FANFARE, MUSIC_STYLE_ORIENTAL,
|
|
|
|
|
MUSIC_STYLE_MARTIAN, MUSIC_STYLE_SPACE, MUSIC_STYLE_JUNGLE_DRUMS,
|
|
|
|
|
MUSIC_STYLE_JURASSIC, MUSIC_STYLE_EGYPTIAN, MUSIC_STYLE_DODGEMS_BEAT,
|
|
|
|
|
MUSIC_STYLE_SNOW, MUSIC_STYLE_ICE, MUSIC_STYLE_MEDIEVAL,
|
|
|
|
|
MUSIC_STYLE_URBAN, MUSIC_STYLE_ORGAN, MUSIC_STYLE_CUSTOM_MUSIC_1,
|
|
|
|
|
MUSIC_STYLE_CUSTOM_MUSIC_2,
|
2014-09-04 16:42:36 +02:00
|
|
|
|
};
|
|
|
|
|
|
2021-01-09 21:54:02 +01:00
|
|
|
|
static std::vector<ObjectEntryIndex> window_ride_current_music_style_order;
|
2014-09-04 16:42:36 +02:00
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B215D
|
2014-09-04 16:42:36 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideToggleMusic(rct_window* w)
|
2014-09-04 16:42:36 +02:00
|
|
|
|
{
|
2021-09-06 15:40:12 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
|
|
|
|
int32_t activateMusic = (ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) ? 0 : 1;
|
2021-09-06 15:40:12 +02:00
|
|
|
|
set_operating_setting(w->rideId, RideSetSetting::Music, activateMusic);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
}
|
2014-09-04 16:42:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1ED7
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMusicMouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
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:
|
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
|
case WIDX_TAB_6:
|
|
|
|
|
case WIDX_TAB_7:
|
|
|
|
|
case WIDX_TAB_8:
|
|
|
|
|
case WIDX_TAB_9:
|
|
|
|
|
case WIDX_TAB_10:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, widgetIndex - WIDX_TAB_1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_PLAY_MUSIC:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideToggleMusic(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-04 16:42:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AF4A2
|
2014-09-04 16:42:36 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMusicResize(rct_window* w)
|
2014-09-04 16:42:36 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->flags |= WF_RESIZABLE;
|
|
|
|
|
window_set_resize(w, 316, 81, 316, 81);
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-20 22:04:49 +01:00
|
|
|
|
static std::optional<size_t> GetMusicStyleOrder(ObjectEntryIndex musicObjectIndex)
|
2021-01-09 21:54:02 +01:00
|
|
|
|
{
|
|
|
|
|
auto& objManager = GetContext()->GetObjectManager();
|
|
|
|
|
auto musicObj = static_cast<MusicObject*>(objManager.GetLoadedObject(ObjectType::Music, musicObjectIndex));
|
|
|
|
|
|
|
|
|
|
// Get the index in the order list
|
|
|
|
|
auto originalStyleId = musicObj->GetOriginalStyleId();
|
2021-09-13 18:47:13 +02:00
|
|
|
|
if (originalStyleId.has_value())
|
2021-01-09 21:54:02 +01:00
|
|
|
|
{
|
2021-09-13 18:47:13 +02:00
|
|
|
|
auto it = std::find(std::begin(MusicStyleOrder), std::end(MusicStyleOrder), originalStyleId.value());
|
2021-01-09 21:54:02 +01:00
|
|
|
|
if (it != std::end(MusicStyleOrder))
|
|
|
|
|
{
|
|
|
|
|
return std::distance(std::begin(MusicStyleOrder), it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-20 22:04:49 +01:00
|
|
|
|
return std::nullopt;
|
2021-01-09 21:54:02 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-25 19:28:56 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1EFC
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMusicMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (widgetIndex != WIDX_MUSIC_DROPDOWN)
|
|
|
|
|
return;
|
|
|
|
|
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto dropdownWidget = widget - 1;
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-01-09 21:54:02 +01:00
|
|
|
|
// Construct list of available music
|
|
|
|
|
auto& musicOrder = window_ride_current_music_style_order;
|
|
|
|
|
musicOrder.clear();
|
|
|
|
|
auto& objManager = GetContext()->GetObjectManager();
|
|
|
|
|
for (ObjectEntryIndex i = 0; i < MAX_MUSIC_OBJECTS; i++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-01-09 21:54:02 +01:00
|
|
|
|
auto musicObj = static_cast<MusicObject*>(objManager.GetLoadedObject(ObjectType::Music, i));
|
|
|
|
|
if (musicObj != nullptr)
|
|
|
|
|
{
|
|
|
|
|
// Hide custom music if the WAV file does not exist
|
|
|
|
|
auto originalStyleId = musicObj->GetOriginalStyleId();
|
2021-09-13 18:47:13 +02:00
|
|
|
|
if (originalStyleId.has_value()
|
|
|
|
|
&& (originalStyleId == MUSIC_STYLE_CUSTOM_MUSIC_1 || originalStyleId == MUSIC_STYLE_CUSTOM_MUSIC_2))
|
2021-01-09 21:54:02 +01:00
|
|
|
|
{
|
|
|
|
|
auto numTracks = musicObj->GetTrackCount();
|
2021-01-20 22:04:49 +01:00
|
|
|
|
if (numTracks != 0)
|
2021-01-09 21:54:02 +01:00
|
|
|
|
{
|
|
|
|
|
auto track0 = musicObj->GetTrack(0);
|
|
|
|
|
if (!track0->Asset.IsAvailable())
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-05-29 18:41:16 +02:00
|
|
|
|
if (gCheatsUnlockOperatingLimits || musicObj->SupportsRideType(ride->type))
|
2021-01-09 21:54:02 +01:00
|
|
|
|
{
|
|
|
|
|
musicOrder.push_back(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-09 21:54:02 +01:00
|
|
|
|
// Sort available music by the original RCT2 list order
|
|
|
|
|
std::stable_sort(musicOrder.begin(), musicOrder.end(), [](const ObjectEntryIndex& a, const ObjectEntryIndex& b) {
|
|
|
|
|
auto orderA = GetMusicStyleOrder(a);
|
|
|
|
|
auto orderB = GetMusicStyleOrder(b);
|
|
|
|
|
return orderA < orderB;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Setup dropdown list
|
|
|
|
|
auto numItems = musicOrder.size();
|
|
|
|
|
for (size_t i = 0; i < numItems; i++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-01-09 21:54:02 +01:00
|
|
|
|
auto musicObj = static_cast<MusicObject*>(objManager.GetLoadedObject(ObjectType::Music, musicOrder[i]));
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
|
gDropdownItems[i].Args = musicObj->NameStringId;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowTextCustomWidth(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
2020-11-03 09:16:06 +01:00
|
|
|
|
w->colours[1], 0, Dropdown::Flag::StayOpen, numItems, widget->right - dropdownWidget->left);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-01-09 21:54:02 +01:00
|
|
|
|
// Set currently checked item
|
|
|
|
|
for (size_t i = 0; i < numItems; i++)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-01-09 21:54:02 +01:00
|
|
|
|
if (musicOrder[i] == ride->music)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-01-09 21:54:02 +01:00
|
|
|
|
Dropdown::SetChecked(static_cast<int32_t>(i), true);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1F03
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMusicDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2021-01-09 21:54:02 +01:00
|
|
|
|
if (widgetIndex == WIDX_MUSIC_DROPDOWN && dropdownIndex >= 0
|
|
|
|
|
&& static_cast<size_t>(dropdownIndex) < window_ride_current_music_style_order.size())
|
|
|
|
|
{
|
|
|
|
|
auto musicStyle = window_ride_current_music_style_order[dropdownIndex];
|
2021-09-04 18:04:53 +02:00
|
|
|
|
set_operating_setting(w->rideId, RideSetSetting::MusicType, musicStyle);
|
2021-01-09 21:54:02 +01:00
|
|
|
|
}
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B2198
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMusicUpdate(rct_window* w)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->frame_no++;
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_6);
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1DEA
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMusicInvalidate(rct_window* w)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto widgets = window_ride_page_widgets[w->page];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->widgets != widgets)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = widgets;
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-04 16:42:36 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPressedTab(w);
|
2014-09-04 16:42:36 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-06-25 02:02:08 +02:00
|
|
|
|
auto ft = Formatter::Common();
|
|
|
|
|
ride->FormatNameTo(ft);
|
2014-09-04 16:42:36 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Set selected music
|
2021-01-09 21:54:02 +01:00
|
|
|
|
rct_string_id musicName = STR_NONE;
|
|
|
|
|
auto& objManager = GetContext()->GetObjectManager();
|
|
|
|
|
auto musicObj = static_cast<MusicObject*>(objManager.GetLoadedObject(ObjectType::Music, ride->music));
|
|
|
|
|
if (musicObj != nullptr)
|
|
|
|
|
{
|
|
|
|
|
musicName = musicObj->NameStringId;
|
|
|
|
|
}
|
|
|
|
|
window_ride_music_widgets[WIDX_MUSIC].text = musicName;
|
2014-09-04 16:42:36 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Set music activated
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto isMusicActivated = (ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) != 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (isMusicActivated)
|
|
|
|
|
{
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets |= (1ULL << WIDX_PLAY_MUSIC);
|
|
|
|
|
w->disabled_widgets &= ~(1ULL << WIDX_MUSIC);
|
|
|
|
|
w->disabled_widgets &= ~(1ULL << WIDX_MUSIC_DROPDOWN);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets &= ~(1ULL << WIDX_PLAY_MUSIC);
|
|
|
|
|
w->disabled_widgets |= (1ULL << WIDX_MUSIC);
|
|
|
|
|
w->disabled_widgets |= (1ULL << WIDX_MUSIC_DROPDOWN);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-04 16:42:36 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideAnchorBorderWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006B1ECC
|
2014-08-25 19:28:56 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMusicPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-08-25 19:28:56 +02:00
|
|
|
|
{
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowDrawWidgets(w, dpi);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabImages(dpi, w);
|
2014-08-25 19:28:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-31 13:28:23 +02:00
|
|
|
|
#pragma endregion
|
2014-09-04 20:59:42 +02:00
|
|
|
|
|
2014-09-05 19:10:30 +02:00
|
|
|
|
#pragma region Measurements
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static rct_string_id GetRatingName(ride_rating rating)
|
2017-01-09 19:47:25 +01:00
|
|
|
|
{
|
2020-04-19 14:08:22 +02:00
|
|
|
|
int32_t index = std::clamp<int32_t>(rating >> 8, 0, static_cast<int32_t>(std::size(RatingNames)) - 1);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return RatingNames[index];
|
2017-01-09 19:47:25 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006D2804
|
|
|
|
|
when al == 0*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void CancelScenerySelection()
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
gGamePaused &= ~GAME_PAUSED_SAVING_TRACK;
|
|
|
|
|
gTrackDesignSaveMode = false;
|
2020-10-06 23:34:42 +02:00
|
|
|
|
OpenRCT2::Audio::Resume();
|
2015-02-27 14:03:40 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_window* main_w = window_get_main();
|
2021-09-25 08:45:06 +02:00
|
|
|
|
if (main_w != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
main_w->viewport->flags &= ~(VIEWPORT_FLAG_HIDE_VERTICAL | VIEWPORT_FLAG_HIDE_BASE);
|
|
|
|
|
}
|
2015-02-27 14:03:40 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
gfx_invalidate_screen();
|
|
|
|
|
tool_cancel();
|
2015-02-27 14:03:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* rct2: 0x006D27A3
|
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void SetupScenerySelection(rct_window* w)
|
2016-05-02 03:40:56 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (gTrackDesignSaveMode)
|
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
CancelScenerySelection();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2015-02-27 14:03:40 +01:00
|
|
|
|
|
2020-12-23 05:11:15 +01:00
|
|
|
|
while (tool_set(w, WIDX_BACKGROUND, Tool::Crosshair))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
;
|
2015-02-27 14:03:40 +01:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
gTrackDesignSaveRideIndex = w->rideId;
|
2015-02-27 14:03:40 +01:00
|
|
|
|
|
2019-04-16 20:36:00 +02:00
|
|
|
|
track_design_save_init();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
gGamePaused |= GAME_PAUSED_SAVING_TRACK;
|
|
|
|
|
gTrackDesignSaveMode = true;
|
2015-02-27 14:03:40 +01:00
|
|
|
|
|
2020-10-06 23:34:42 +02:00
|
|
|
|
OpenRCT2::Audio::StopAll();
|
2015-02-27 14:03:40 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_window* w_main = window_get_main();
|
2021-09-25 08:45:06 +02:00
|
|
|
|
if (w_main != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w_main->viewport->flags |= (VIEWPORT_FLAG_HIDE_VERTICAL | VIEWPORT_FLAG_HIDE_BASE);
|
|
|
|
|
}
|
2015-02-27 14:03:40 +01:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
gfx_invalidate_screen();
|
2015-02-27 14:03:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-05 19:10:30 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006D3026
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsDesignReset()
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2019-04-16 20:36:00 +02:00
|
|
|
|
track_design_save_reset_scenery();
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006D303D
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsDesignSelectNearbyScenery()
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2019-04-16 20:36:00 +02:00
|
|
|
|
track_design_save_select_nearby_scenery(gTrackDesignSaveRideIndex);
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD4DA
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
void WindowRideMeasurementsDesignCancel()
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (gTrackDesignSaveMode)
|
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
CancelScenerySelection();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-07 19:40:58 +02:00
|
|
|
|
static void TrackDesignCallback(int32_t result, [[maybe_unused]] const utf8* path)
|
2019-06-30 12:23:06 +02:00
|
|
|
|
{
|
|
|
|
|
if (result == MODAL_RESULT_OK)
|
|
|
|
|
{
|
|
|
|
|
track_repository_scan();
|
|
|
|
|
}
|
|
|
|
|
gfx_invalidate_screen();
|
|
|
|
|
};
|
|
|
|
|
|
2014-09-05 19:10:30 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD4CD
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsDesignSave(rct_window* w)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2021-12-04 12:07:10 +01:00
|
|
|
|
TrackDesignState tds{};
|
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
Ride* ride = get_ride(w->rideId);
|
2021-12-04 12:07:10 +01:00
|
|
|
|
_trackDesign = ride->SaveToTrackDesign(tds);
|
2019-06-30 12:23:06 +02:00
|
|
|
|
if (!_trackDesign)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gTrackDesignSaveMode)
|
|
|
|
|
{
|
2021-10-28 21:23:15 +02:00
|
|
|
|
auto errMessage = _trackDesign->CreateTrackDesignScenery(tds);
|
2019-06-30 12:23:06 +02:00
|
|
|
|
if (errMessage != STR_NONE)
|
|
|
|
|
{
|
2020-08-27 00:01:15 +02:00
|
|
|
|
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, errMessage, {});
|
2019-06-30 12:23:06 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-07 19:40:58 +02:00
|
|
|
|
auto trackName = ride->GetName();
|
2019-06-30 12:23:06 +02:00
|
|
|
|
auto intent = Intent(WC_LOADSAVE);
|
|
|
|
|
intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK);
|
|
|
|
|
intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, _trackDesign.get());
|
2019-07-07 19:40:58 +02:00
|
|
|
|
intent.putExtra(INTENT_EXTRA_PATH, trackName);
|
|
|
|
|
intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<void*>(&TrackDesignCallback));
|
2019-06-30 12:23:06 +02:00
|
|
|
|
|
|
|
|
|
context_open_intent(&intent);
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD4DA
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsClose(rct_window* w)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideMeasurementsDesignCancel();
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD478
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsMouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
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:
|
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
|
case WIDX_TAB_6:
|
|
|
|
|
case WIDX_TAB_7:
|
|
|
|
|
case WIDX_TAB_8:
|
|
|
|
|
case WIDX_TAB_9:
|
|
|
|
|
case WIDX_TAB_10:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, widgetIndex - WIDX_TAB_1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_SELECT_NEARBY_SCENERY:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideMeasurementsDesignSelectNearbyScenery();
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_RESET_SELECTION:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideMeasurementsDesignReset();
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_SAVE_DESIGN:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideMeasurementsDesignSave(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_CANCEL_DESIGN:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideMeasurementsDesignCancel();
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD564
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsResize(rct_window* w)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2017-10-21 15:51:20 +02:00
|
|
|
|
window_set_resize(w, 316, 234, 316, 234);
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD4AB
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (widgetIndex != WIDX_SAVE_TRACK_DESIGN)
|
|
|
|
|
return;
|
2014-09-05 19:10:30 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2018-01-14 01:48:13 +01:00
|
|
|
|
|
2022-02-12 23:57:22 +01:00
|
|
|
|
gDropdownItems[0].Format = STR_SAVE_TRACK_DESIGN_ITEM;
|
|
|
|
|
gDropdownItems[1].Format = STR_SAVE_TRACK_DESIGN_WITH_SCENERY_ITEM;
|
2014-09-05 19:10:30 +02:00
|
|
|
|
|
2020-11-03 09:16:06 +01:00
|
|
|
|
WindowDropdownShowText(
|
2020-06-25 03:44:00 +02:00
|
|
|
|
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1],
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::Flag::StayOpen, 2);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
gDropdownDefaultIndex = 0;
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK))
|
2018-01-14 01:48:13 +01:00
|
|
|
|
{
|
|
|
|
|
// Disable saving without scenery if we're a flat ride
|
2020-11-03 09:16:06 +01:00
|
|
|
|
Dropdown::SetDisabled(0, true);
|
2018-05-19 14:13:08 +02:00
|
|
|
|
gDropdownDefaultIndex = 1;
|
2018-01-14 01:48:13 +01:00
|
|
|
|
}
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD4B2
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsDropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (widgetIndex != WIDX_SAVE_TRACK_DESIGN)
|
|
|
|
|
return;
|
2014-09-05 19:10:30 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (dropdownIndex == -1)
|
|
|
|
|
dropdownIndex = gDropdownHighlightedIndex;
|
2014-09-05 19:10:30 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (dropdownIndex == 0)
|
2019-04-08 20:34:24 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideMeasurementsDesignSave(w);
|
2019-04-08 20:34:24 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
else
|
2021-11-23 14:18:07 +01:00
|
|
|
|
SetupScenerySelection(w);
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD5DD
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsUpdate(rct_window* w)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->frame_no++;
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_7);
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006D2AE7
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsTooldown(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2019-10-21 14:13:08 +02:00
|
|
|
|
_lastSceneryX = screenCoords.x;
|
|
|
|
|
_lastSceneryY = screenCoords.y;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
_collectTrackDesignScenery = true; // Default to true in case user does not select anything valid
|
2017-05-29 22:34:33 +02:00
|
|
|
|
|
2021-06-26 06:43:05 +02:00
|
|
|
|
constexpr auto flags = EnumsToFlags(
|
2021-02-10 02:06:18 +01:00
|
|
|
|
ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall,
|
|
|
|
|
ViewportInteractionItem::LargeScenery);
|
|
|
|
|
auto info = get_map_coordinates_from_pos(screenCoords, flags);
|
2020-08-02 09:32:59 +02:00
|
|
|
|
switch (info.SpriteType)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-12-29 19:09:15 +01:00
|
|
|
|
case ViewportInteractionItem::Scenery:
|
|
|
|
|
case ViewportInteractionItem::LargeScenery:
|
|
|
|
|
case ViewportInteractionItem::Wall:
|
|
|
|
|
case ViewportInteractionItem::Footpath:
|
2020-08-02 09:32:59 +02:00
|
|
|
|
_collectTrackDesignScenery = !track_design_save_contains_tile_element(info.Element);
|
|
|
|
|
track_design_save_select_tile_element(info.SpriteType, info.Loc, info.Element, _collectTrackDesignScenery);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2017-05-29 22:34:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsTooldrag(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
|
2017-05-29 22:34:33 +02:00
|
|
|
|
{
|
2019-10-21 14:13:08 +02:00
|
|
|
|
if (screenCoords.x == _lastSceneryX && screenCoords.y == _lastSceneryY)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
2019-10-21 14:13:08 +02:00
|
|
|
|
_lastSceneryX = screenCoords.x;
|
|
|
|
|
_lastSceneryY = screenCoords.y;
|
2017-05-29 22:34:33 +02:00
|
|
|
|
|
2021-02-10 02:06:18 +01:00
|
|
|
|
auto flags = EnumsToFlags(
|
|
|
|
|
ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall,
|
|
|
|
|
ViewportInteractionItem::LargeScenery);
|
|
|
|
|
auto info = get_map_coordinates_from_pos(screenCoords, flags);
|
2020-08-02 09:32:59 +02:00
|
|
|
|
switch (info.SpriteType)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-12-29 19:09:15 +01:00
|
|
|
|
case ViewportInteractionItem::Scenery:
|
|
|
|
|
case ViewportInteractionItem::LargeScenery:
|
|
|
|
|
case ViewportInteractionItem::Wall:
|
|
|
|
|
case ViewportInteractionItem::Footpath:
|
2020-08-02 09:32:59 +02:00
|
|
|
|
track_design_save_select_tile_element(info.SpriteType, info.Loc, info.Element, _collectTrackDesignScenery);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD4DA
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsToolabort(rct_window* w, rct_widgetindex widgetIndex)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideMeasurementsDesignCancel();
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ACDBC
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsInvalidate(rct_window* w)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto widgets = window_ride_page_widgets[w->page];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->widgets != widgets)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = widgets;
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPressedTab(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
const auto rideId = w->rideId;
|
2021-08-02 06:24:52 +02:00
|
|
|
|
auto ride = get_ride(rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-06-25 02:02:08 +02:00
|
|
|
|
auto ft = Formatter::Common();
|
|
|
|
|
ride->FormatNameTo(ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].tooltip = STR_SAVE_TRACK_DESIGN_NOT_POSSIBLE;
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].type = WindowWidgetType::Empty;
|
2021-08-02 06:24:52 +02:00
|
|
|
|
if (gTrackDesignSaveMode && gTrackDesignSaveRideIndex == rideId)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_measurements_widgets[WIDX_SELECT_NEARBY_SCENERY].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_measurements_widgets[WIDX_RESET_SELECTION].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_measurements_widgets[WIDX_SAVE_DESIGN].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_measurements_widgets[WIDX_CANCEL_DESIGN].type = WindowWidgetType::Button;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_measurements_widgets[WIDX_SELECT_NEARBY_SCENERY].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_measurements_widgets[WIDX_RESET_SELECTION].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_measurements_widgets[WIDX_SAVE_DESIGN].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_measurements_widgets[WIDX_CANCEL_DESIGN].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].type = WindowWidgetType::FlatBtn;
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->disabled_widgets |= (1ULL << WIDX_SAVE_TRACK_DESIGN);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED)
|
|
|
|
|
{
|
|
|
|
|
if (ride->excitement != RIDE_RATING_UNDEFINED)
|
|
|
|
|
{
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->disabled_widgets &= ~(1ULL << WIDX_SAVE_TRACK_DESIGN);
|
2017-12-29 21:50:43 +01:00
|
|
|
|
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].tooltip = STR_SAVE_TRACK_DESIGN;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideAnchorBorderWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ACF07
|
2014-09-05 19:10:30 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideMeasurementsPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-09-05 19:10:30 +02:00
|
|
|
|
{
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowDrawWidgets(w, dpi);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabImages(dpi, w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-27 04:14:20 +01:00
|
|
|
|
if (window_ride_measurements_widgets[WIDX_SAVE_DESIGN].type == WindowWidgetType::Button)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
|
|
|
|
rct_widget* widget = &window_ride_measurements_widgets[WIDX_PAGE_BACKGROUND];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-06-25 03:44:00 +02:00
|
|
|
|
ScreenCoordsXY widgetCoords(w->windowPos.x + widget->width() / 2, w->windowPos.y + widget->top + 40);
|
2021-02-27 17:17:17 +01:00
|
|
|
|
DrawTextWrapped(dpi, widgetCoords, w->width - 8, STR_CLICK_ITEMS_OF_SCENERY_TO_SELECT, {}, { TextAlignment::CENTRE });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-05-10 06:00:26 +02:00
|
|
|
|
widgetCoords.x = w->windowPos.x + 4;
|
|
|
|
|
widgetCoords.y = w->windowPos.y + window_ride_measurements_widgets[WIDX_SELECT_NEARBY_SCENERY].bottom + 17;
|
|
|
|
|
gfx_fill_rect_inset(
|
2020-09-16 05:02:22 +02:00
|
|
|
|
dpi, { widgetCoords, { w->windowPos.x + 312, widgetCoords.y + 1 } }, w->colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 15:20:59 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-06-20 21:09:45 +02:00
|
|
|
|
auto screenCoords = w->windowPos
|
|
|
|
|
+ ScreenCoordsXY{ window_ride_measurements_widgets[WIDX_PAGE_BACKGROUND].left + 4,
|
|
|
|
|
window_ride_measurements_widgets[WIDX_PAGE_BACKGROUND].top + 4 };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Excitement
|
2021-11-23 14:18:07 +01:00
|
|
|
|
rct_string_id ratingName = GetRatingName(ride->excitement);
|
2020-09-30 23:42:04 +02:00
|
|
|
|
auto ft = Formatter();
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint32_t>(ride->excitement);
|
|
|
|
|
ft.Add<rct_string_id>(ratingName);
|
2018-07-21 11:50:45 +02:00
|
|
|
|
rct_string_id stringId = ride->excitement == RIDE_RATING_UNDEFINED ? STR_EXCITEMENT_RATING_NOT_YET_AVAILABLE
|
|
|
|
|
: STR_EXCITEMENT_RATING;
|
2021-02-27 16:49:13 +01:00
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Intensity
|
2021-11-23 14:18:07 +01:00
|
|
|
|
ratingName = GetRatingName(ride->intensity);
|
2020-09-30 23:42:04 +02:00
|
|
|
|
ft = Formatter();
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint32_t>(ride->intensity);
|
|
|
|
|
ft.Add<rct_string_id>(ratingName);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
stringId = STR_INTENSITY_RATING;
|
|
|
|
|
if (ride->excitement == RIDE_RATING_UNDEFINED)
|
|
|
|
|
stringId = STR_INTENSITY_RATING_NOT_YET_AVAILABLE;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
else if (ride->intensity >= RIDE_RATING(10, 00))
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_INTENSITY_RATING_RED;
|
|
|
|
|
|
2021-02-27 16:49:13 +01:00
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Nausea
|
2021-11-23 14:18:07 +01:00
|
|
|
|
ratingName = GetRatingName(ride->nausea);
|
2020-09-30 23:42:04 +02:00
|
|
|
|
ft = Formatter();
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint32_t>(ride->nausea);
|
|
|
|
|
ft.Add<rct_string_id>(ratingName);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = ride->excitement == RIDE_RATING_UNDEFINED ? STR_NAUSEA_RATING_NOT_YET_AVAILABLE : STR_NAUSEA_RATING;
|
2021-02-27 16:49:13 +01:00
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += 2 * LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Horizontal rule
|
2020-06-20 21:09:45 +02:00
|
|
|
|
gfx_fill_rect_inset(
|
2020-09-16 05:02:22 +02:00
|
|
|
|
dpi, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 303, -5 } }, w->colours[1],
|
2020-06-20 21:09:45 +02:00
|
|
|
|
INSET_RECT_FLAG_BORDER_INSET);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_NO_RAW_STATS))
|
|
|
|
|
{
|
|
|
|
|
if (ride->type == RIDE_TYPE_MINI_GOLF)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Holes
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<uint16_t>(ride->holes);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_HOLES, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Max speed
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<int32_t>((ride->max_speed * 9) >> 18);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_MAX_SPEED, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Average speed
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<int32_t>((ride->average_speed * 9) >> 18);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_AVERAGE_SPEED, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Ride time
|
2020-09-30 23:42:04 +02:00
|
|
|
|
ft = Formatter();
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t numTimes = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t i = 0; i < ride->num_stations; i++)
|
|
|
|
|
{
|
2022-02-13 17:18:56 +01:00
|
|
|
|
StationIndex stationIndex = StationIndex::FromUnderlying(numTimes);
|
2022-01-28 00:34:04 +01:00
|
|
|
|
auto time = ride->GetStation(stationIndex).SegmentTime;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (time != 0)
|
|
|
|
|
{
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint16_t>(STR_RIDE_TIME_ENTRY_WITH_SEPARATOR);
|
|
|
|
|
ft.Add<uint16_t>(time);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
numTimes++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (numTimes == 0)
|
|
|
|
|
{
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint16_t>(STR_RIDE_TIME_ENTRY);
|
|
|
|
|
ft.Add<uint16_t>(0);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
numTimes++;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// sadly, STR_RIDE_TIME_ENTRY_WITH_SEPARATOR are defined with the separator AFTER an entry
|
|
|
|
|
// therefore we set the last entry to use the no-separator format now, post-format
|
2020-06-03 12:54:39 +02:00
|
|
|
|
ft.Rewind();
|
|
|
|
|
ft.Increment((numTimes - 1) * 4);
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint16_t>(STR_RIDE_TIME_ENTRY);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-06-03 12:54:39 +02:00
|
|
|
|
ft.Rewind();
|
|
|
|
|
ft.Increment(numTimes * 4);
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint16_t>(0);
|
|
|
|
|
ft.Add<uint16_t>(0);
|
|
|
|
|
ft.Add<uint16_t>(0);
|
|
|
|
|
ft.Add<uint16_t>(0);
|
2021-02-28 00:22:24 +01:00
|
|
|
|
DrawTextEllipsised(dpi, screenCoords, 308, STR_RIDE_TIME, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Ride length
|
2020-09-30 23:42:04 +02:00
|
|
|
|
ft = Formatter();
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t numLengths = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t i = 0; i < ride->num_stations; i++)
|
|
|
|
|
{
|
2022-01-28 00:34:04 +01:00
|
|
|
|
StationIndex stationIndex = StationIndex::FromUnderlying(i);
|
|
|
|
|
auto length = ride->GetStation(stationIndex).SegmentLength;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (length != 0)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
length >>= 16;
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<rct_string_id>(STR_RIDE_LENGTH_ENTRY_WITH_SEPARATOR);
|
|
|
|
|
ft.Add<uint16_t>(length & 0xFFFF);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
numLengths++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (numLengths == 0)
|
|
|
|
|
{
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<rct_string_id>(STR_RIDE_LENGTH_ENTRY);
|
|
|
|
|
ft.Add<uint16_t>(0);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
numLengths++;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// sadly, STR_RIDE_LENGTH_ENTRY_WITH_SEPARATOR are defined with the separator AFTER an entry
|
|
|
|
|
// therefore we set the last entry to use the no-separator format now, post-format
|
2020-06-03 12:54:39 +02:00
|
|
|
|
ft.Rewind();
|
|
|
|
|
ft.Increment((numLengths - 1) * 4);
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<rct_string_id>(STR_RIDE_LENGTH_ENTRY);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-06-03 12:54:39 +02:00
|
|
|
|
ft.Rewind();
|
|
|
|
|
ft.Increment(numLengths * 4);
|
2020-06-03 12:03:12 +02:00
|
|
|
|
ft.Add<uint16_t>(0);
|
|
|
|
|
ft.Add<uint16_t>(0);
|
|
|
|
|
ft.Add<uint16_t>(0);
|
|
|
|
|
ft.Add<uint16_t>(0);
|
2021-02-28 00:22:24 +01:00
|
|
|
|
DrawTextEllipsised(dpi, screenCoords, 308, STR_RIDE_LENGTH, ft);
|
2020-08-28 18:03:51 +02:00
|
|
|
|
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Max. positive vertical G's
|
2021-07-27 20:32:27 +02:00
|
|
|
|
stringId = ride->max_positive_vertical_g >= RIDE_G_FORCES_RED_POS_VERTICAL ? STR_MAX_POSITIVE_VERTICAL_G_RED
|
|
|
|
|
: STR_MAX_POSITIVE_VERTICAL_G;
|
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<fixed16_2dp>(ride->max_positive_vertical_g);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Max. negative vertical G's
|
2021-07-27 20:32:27 +02:00
|
|
|
|
stringId = ride->max_negative_vertical_g <= RIDE_G_FORCES_RED_NEG_VERTICAL ? STR_MAX_NEGATIVE_VERTICAL_G_RED
|
|
|
|
|
: STR_MAX_NEGATIVE_VERTICAL_G;
|
|
|
|
|
ft = Formatter();
|
2021-08-03 06:25:06 +02:00
|
|
|
|
ft.Add<int32_t>(ride->max_negative_vertical_g);
|
2021-07-27 20:32:27 +02:00
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Max lateral G's
|
2021-07-27 20:32:27 +02:00
|
|
|
|
stringId = ride->max_lateral_g >= RIDE_G_FORCES_RED_LATERAL ? STR_MAX_LATERAL_G_RED : STR_MAX_LATERAL_G;
|
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<fixed16_2dp>(ride->max_lateral_g);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Total 'air' time
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<fixed32_2dp>(ride->total_air_time * 3);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_TOTAL_AIR_TIME, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_DROPS))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Drops
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto drops = ride->drops & 0x3F;
|
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<uint16_t>(drops);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_DROPS, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Highest drop height
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto highestDropHeight = (ride->highest_drop_height * 3) / 4;
|
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<int32_t>(highestDropHeight);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_HIGHEST_DROP_HEIGHT, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->type != RIDE_TYPE_MINI_GOLF)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Inversions
|
2021-07-27 20:32:27 +02:00
|
|
|
|
if (ride->inversions != 0)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<uint16_t>(ride->inversions);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_INVERSIONS, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-02-27 16:49:13 +01:00
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_NO_TEST_RESULTS_YET);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-09-05 19:10:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
|
2014-09-20 20:41:03 +02:00
|
|
|
|
#pragma region Graphs
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
enum
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
GRAPH_VELOCITY,
|
|
|
|
|
GRAPH_ALTITUDE,
|
|
|
|
|
GRAPH_VERTICAL,
|
|
|
|
|
GRAPH_LATERAL
|
2014-09-20 20:41:03 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE8A6
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideSetGraph(rct_window* w, int32_t type)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if ((w->list_information_type & 0xFF) == type)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->list_information_type ^= 0x8000;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->list_information_type &= 0xFF00;
|
|
|
|
|
w->list_information_type |= type;
|
|
|
|
|
}
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE85D
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideGraphsMouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
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:
|
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
|
case WIDX_TAB_6:
|
|
|
|
|
case WIDX_TAB_7:
|
|
|
|
|
case WIDX_TAB_8:
|
|
|
|
|
case WIDX_TAB_9:
|
|
|
|
|
case WIDX_TAB_10:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, widgetIndex - WIDX_TAB_1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE8DA
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideGraphsResize(rct_window* w)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2020-10-14 17:51:58 +02:00
|
|
|
|
window_set_resize(w, 316, 182, 500, 450);
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE878
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideGraphsMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_GRAPH_VELOCITY:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetGraph(w, GRAPH_VELOCITY);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_GRAPH_ALTITUDE:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetGraph(w, GRAPH_ALTITUDE);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_GRAPH_VERTICAL:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetGraph(w, GRAPH_VERTICAL);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_GRAPH_LATERAL:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetGraph(w, GRAPH_LATERAL);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE95D
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideGraphsUpdate(rct_window* w)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
rct_widget* widget;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t x;
|
2014-09-20 20:41:03 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->frame_no++;
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_8);
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_GRAPH);
|
2014-09-20 20:41:03 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
widget = &window_ride_graphs_widgets[WIDX_GRAPH];
|
|
|
|
|
x = w->scrolls[0].h_left;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (!(w->list_information_type & 0x8000))
|
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-02-13 00:58:45 +01:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
2019-06-09 11:55:41 +02:00
|
|
|
|
RideMeasurement* measurement{};
|
2020-10-09 13:02:07 +02:00
|
|
|
|
std::tie(measurement, std::ignore) = ride->GetMeasurement();
|
2020-06-25 03:44:00 +02:00
|
|
|
|
x = measurement == nullptr ? 0 : measurement->current_item - ((widget->width() / 4) * 3);
|
2019-02-13 00:58:45 +01:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-20 20:41:03 +02:00
|
|
|
|
|
2020-06-25 03:44:00 +02:00
|
|
|
|
w->scrolls[0].h_left = std::clamp(x, 0, w->scrolls[0].h_right - (widget->width() - 2));
|
2020-11-03 22:29:22 +01:00
|
|
|
|
WidgetScrollUpdateThumbs(w, WIDX_GRAPH);
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AEA75
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideGraphsScrollgetheight(rct_window* w, int32_t scrollIndex, int32_t* width, int32_t* height)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_event_invalidate_call(w);
|
2014-09-20 20:41:03 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Set minimum size
|
2020-06-25 03:44:00 +02:00
|
|
|
|
*width = window_ride_graphs_widgets[WIDX_GRAPH].width() - 2;
|
2014-09-20 20:41:03 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Get measurement size
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-02-13 00:58:45 +01:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
2019-06-09 11:55:41 +02:00
|
|
|
|
RideMeasurement* measurement{};
|
2020-10-09 13:02:07 +02:00
|
|
|
|
std::tie(measurement, std::ignore) = ride->GetMeasurement();
|
2019-02-13 00:58:45 +01:00
|
|
|
|
if (measurement != nullptr)
|
|
|
|
|
{
|
|
|
|
|
*width = std::max<int32_t>(*width, measurement->num_items);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE953
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideGraphs15(rct_window* w, int32_t scrollIndex, int32_t scrollAreaType)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->list_information_type |= 0x8000;
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AEA05
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static OpenRCT2String WindowRideGraphsTooltip(rct_window* w, const rct_widgetindex widgetIndex, const rct_string_id fallback)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (widgetIndex == WIDX_GRAPH)
|
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-02-13 00:58:45 +01:00
|
|
|
|
if (ride != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-10-09 13:02:07 +02:00
|
|
|
|
auto [measurement, message] = ride->GetMeasurement();
|
2019-02-13 00:58:45 +01:00
|
|
|
|
if (measurement != nullptr && (measurement->flags & RIDE_MEASUREMENT_FLAG_RUNNING))
|
|
|
|
|
{
|
2020-10-10 15:49:56 +02:00
|
|
|
|
auto ft = Formatter();
|
2020-06-03 11:20:29 +02:00
|
|
|
|
ft.Increment(2);
|
2021-02-24 14:02:58 +01:00
|
|
|
|
ft.Add<rct_string_id>(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).number);
|
2020-06-03 11:20:29 +02:00
|
|
|
|
ft.Add<uint16_t>(measurement->vehicle_index + 1);
|
2020-10-10 15:49:56 +02:00
|
|
|
|
return { fallback, ft };
|
2019-02-13 00:58:45 +01:00
|
|
|
|
}
|
2021-09-15 22:22:15 +02:00
|
|
|
|
|
|
|
|
|
return message;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-10-10 15:49:56 +02:00
|
|
|
|
return { STR_NONE, {} };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-10-10 15:49:56 +02:00
|
|
|
|
return { fallback, {} };
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE372
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideGraphsInvalidate(rct_window* w)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto widgets = window_ride_page_widgets[w->page];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->widgets != widgets)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = widgets;
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPressedTab(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-06-25 02:02:08 +02:00
|
|
|
|
auto ft = Formatter::Common();
|
|
|
|
|
ride->FormatNameTo(ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Set pressed graph button type
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets &= ~(1ULL << WIDX_GRAPH_VELOCITY);
|
|
|
|
|
w->pressed_widgets &= ~(1ULL << WIDX_GRAPH_ALTITUDE);
|
|
|
|
|
w->pressed_widgets &= ~(1ULL << WIDX_GRAPH_VERTICAL);
|
|
|
|
|
w->pressed_widgets &= ~(1ULL << WIDX_GRAPH_LATERAL);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->pressed_widgets |= (1LL << (WIDX_GRAPH_VELOCITY + (w->list_information_type & 0xFF)));
|
|
|
|
|
|
|
|
|
|
// Hide graph buttons that are not applicable
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_VERTICAL].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_LATERAL].type = WindowWidgetType::Button;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_VERTICAL].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_LATERAL].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Anchor graph widget
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto x = w->width - 4;
|
2020-10-14 17:51:58 +02:00
|
|
|
|
auto y = w->height - BUTTON_FACE_HEIGHT - 8;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH].right = x;
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH].bottom = y;
|
|
|
|
|
y += 3;
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_VELOCITY].top = y;
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_ALTITUDE].top = y;
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_VERTICAL].top = y;
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_LATERAL].top = y;
|
2020-10-14 17:51:58 +02:00
|
|
|
|
y += BUTTON_FACE_HEIGHT + 1;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_VELOCITY].bottom = y;
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_ALTITUDE].bottom = y;
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_VERTICAL].bottom = y;
|
|
|
|
|
window_ride_graphs_widgets[WIDX_GRAPH_LATERAL].bottom = y;
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideAnchorBorderWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE4BC
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideGraphsPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowDrawWidgets(w, dpi);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabImages(dpi, w);
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE4C7
|
2014-09-20 20:41:03 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideGraphsScrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)
|
2014-09-20 20:41:03 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
gfx_clear(dpi, ColourMapA[COLOUR_SATURATED_GREEN].darker);
|
|
|
|
|
|
2019-02-13 00:58:45 +01:00
|
|
|
|
auto widget = &window_ride_graphs_widgets[WIDX_GRAPH];
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2020-10-09 13:02:07 +02:00
|
|
|
|
if (ride == nullptr)
|
2019-02-13 00:58:45 +01:00
|
|
|
|
{
|
2020-10-09 13:02:07 +02:00
|
|
|
|
return;
|
2019-02-13 00:58:45 +01:00
|
|
|
|
}
|
2020-10-09 13:02:07 +02:00
|
|
|
|
|
|
|
|
|
auto [measurement, message] = ride->GetMeasurement();
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (measurement == nullptr)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// No measurement message
|
2020-06-25 03:44:00 +02:00
|
|
|
|
ScreenCoordsXY stringCoords(widget->width() / 2, widget->height() / 2 - 5);
|
|
|
|
|
int32_t width = widget->width() - 2;
|
2021-02-27 17:17:17 +01:00
|
|
|
|
DrawTextWrapped(dpi, stringCoords, width, message.str, message.args, { TextAlignment::CENTRE });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Vertical grid lines
|
2018-06-20 17:28:51 +02:00
|
|
|
|
const uint8_t lightColour = ColourMapA[COLOUR_SATURATED_GREEN].mid_light;
|
|
|
|
|
const uint8_t darkColour = ColourMapA[COLOUR_SATURATED_GREEN].mid_dark;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t time = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t x = 0; x < dpi->x + dpi->width; x += 80)
|
|
|
|
|
{
|
|
|
|
|
if (x + 80 >= dpi->x)
|
|
|
|
|
{
|
2020-07-13 22:49:12 +02:00
|
|
|
|
auto coord1 = ScreenCoordsXY{ x, dpi->y };
|
|
|
|
|
auto coord2 = ScreenCoordsXY{ x, dpi->y + dpi->height - 1 };
|
|
|
|
|
gfx_fill_rect(dpi, { coord1, coord2 }, lightColour);
|
|
|
|
|
gfx_fill_rect(dpi, { coord1 + ScreenCoordsXY{ 16, 0 }, coord2 + ScreenCoordsXY{ 16, 0 } }, darkColour);
|
|
|
|
|
gfx_fill_rect(dpi, { coord1 + ScreenCoordsXY{ 32, 0 }, coord2 + ScreenCoordsXY{ 32, 0 } }, darkColour);
|
|
|
|
|
gfx_fill_rect(dpi, { coord1 + ScreenCoordsXY{ 48, 0 }, coord2 + ScreenCoordsXY{ 48, 0 } }, darkColour);
|
|
|
|
|
gfx_fill_rect(dpi, { coord1 + ScreenCoordsXY{ 64, 0 }, coord2 + ScreenCoordsXY{ 64, 0 } }, darkColour);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
time += 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Horizontal grid lines
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t listType = w->list_information_type & 0xFF;
|
|
|
|
|
int16_t yUnit = window_graphs_y_axi[listType].unit;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_string_id stringID = window_graphs_y_axi[listType].label;
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int16_t yUnitInterval = window_graphs_y_axi[listType].unit_interval;
|
|
|
|
|
int16_t yInterval = window_graphs_y_axi[listType].interval;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Scale modifier
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (listType == GRAPH_ALTITUDE)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
yUnit -= gMapBaseZ * 3;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-25 03:44:00 +02:00
|
|
|
|
for (int32_t y = widget->height() - 13; y >= 8; y -= yInterval, yUnit += yUnitInterval)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Minor / major line
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t colour = yUnit == 0 ? lightColour : darkColour;
|
2020-07-13 22:49:12 +02:00
|
|
|
|
gfx_fill_rect(dpi, { { dpi->x, y }, { dpi->x + dpi->width - 1, y } }, colour);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int16_t scaled_yUnit = yUnit;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Scale modifier
|
|
|
|
|
if (listType == GRAPH_ALTITUDE)
|
|
|
|
|
scaled_yUnit /= 2;
|
|
|
|
|
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<int16_t>(scaled_yUnit);
|
|
|
|
|
|
|
|
|
|
DrawTextBasic(dpi, { w->scrolls[0].h_left + 1, y - 4 }, stringID, ft, { FontSpriteBase::SMALL });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Time marks
|
|
|
|
|
time = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t x = 0; x < dpi->x + dpi->width; x += 80)
|
|
|
|
|
{
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<int32_t>(time);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (x + 80 >= dpi->x)
|
2021-07-27 20:32:27 +02:00
|
|
|
|
DrawTextBasic(dpi, { x + 2, 1 }, STR_RIDE_STATS_TIME, ft, { FontSpriteBase::SMALL });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
time += 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Plot
|
2018-06-20 17:28:51 +02:00
|
|
|
|
int32_t x = dpi->x;
|
|
|
|
|
int32_t top, bottom;
|
2018-09-08 23:34:05 +02:00
|
|
|
|
// Uses the force limits (used to draw extreme G's in red on measurement tab) to determine if line should be drawn red.
|
|
|
|
|
int32_t intensityThresholdPositive = 0;
|
|
|
|
|
int32_t intensityThresholdNegative = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
for (int32_t width = 0; width < dpi->width; width++, x++)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (x < 0 || x >= measurement->num_items - 1)
|
|
|
|
|
continue;
|
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (listType)
|
|
|
|
|
{
|
|
|
|
|
case GRAPH_VELOCITY:
|
|
|
|
|
top = measurement->velocity[x] / 2;
|
|
|
|
|
bottom = measurement->velocity[x + 1] / 2;
|
|
|
|
|
break;
|
|
|
|
|
case GRAPH_ALTITUDE:
|
|
|
|
|
top = measurement->altitude[x];
|
|
|
|
|
bottom = measurement->altitude[x + 1];
|
|
|
|
|
break;
|
|
|
|
|
case GRAPH_VERTICAL:
|
|
|
|
|
top = measurement->vertical[x] + 39;
|
|
|
|
|
bottom = measurement->vertical[x + 1] + 39;
|
2018-06-22 19:20:27 +02:00
|
|
|
|
intensityThresholdPositive = (RIDE_G_FORCES_RED_POS_VERTICAL / 8) + 39;
|
|
|
|
|
intensityThresholdNegative = (RIDE_G_FORCES_RED_NEG_VERTICAL / 8) + 39;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case GRAPH_LATERAL:
|
|
|
|
|
top = measurement->lateral[x] + 52;
|
|
|
|
|
bottom = measurement->lateral[x + 1] + 52;
|
2018-06-22 19:20:27 +02:00
|
|
|
|
intensityThresholdPositive = (RIDE_G_FORCES_RED_LATERAL / 8) + 52;
|
|
|
|
|
intensityThresholdNegative = -(RIDE_G_FORCES_RED_LATERAL / 8) + 52;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
log_error("Wrong graph type %d", listType);
|
|
|
|
|
top = bottom = 0;
|
2018-09-08 23:34:05 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-22 19:20:27 +02:00
|
|
|
|
// Adjust line to match graph widget position.
|
2020-06-25 03:44:00 +02:00
|
|
|
|
top = widget->height() - top - 13;
|
|
|
|
|
bottom = widget->height() - bottom - 13;
|
2018-09-08 23:34:05 +02:00
|
|
|
|
if (top > bottom)
|
|
|
|
|
{
|
|
|
|
|
std::swap(top, bottom);
|
|
|
|
|
}
|
2018-06-22 19:20:27 +02:00
|
|
|
|
|
2018-09-08 23:34:05 +02:00
|
|
|
|
// Adjust threshold line position as well
|
|
|
|
|
if (listType == GRAPH_VERTICAL || listType == GRAPH_LATERAL)
|
2018-06-22 19:20:27 +02:00
|
|
|
|
{
|
2020-06-25 03:44:00 +02:00
|
|
|
|
intensityThresholdPositive = widget->height() - intensityThresholdPositive - 13;
|
|
|
|
|
intensityThresholdNegative = widget->height() - intensityThresholdNegative - 13;
|
2018-06-22 19:20:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-08 23:34:05 +02:00
|
|
|
|
const bool previousMeasurement = x > measurement->current_item;
|
2018-06-22 19:20:27 +02:00
|
|
|
|
|
2021-11-13 23:38:04 +01:00
|
|
|
|
// Draw the current line in grey.
|
2020-07-13 22:49:12 +02:00
|
|
|
|
gfx_fill_rect(dpi, { { x, top }, { x, bottom } }, previousMeasurement ? PALETTE_INDEX_17 : PALETTE_INDEX_21);
|
2018-06-22 19:20:27 +02:00
|
|
|
|
|
|
|
|
|
// Draw red over extreme values (if supported by graph type).
|
2018-09-08 23:34:05 +02:00
|
|
|
|
if (listType == GRAPH_VERTICAL || listType == GRAPH_LATERAL)
|
2018-06-22 19:20:27 +02:00
|
|
|
|
{
|
2018-09-08 23:34:05 +02:00
|
|
|
|
const auto redLineColour = previousMeasurement ? PALETTE_INDEX_171 : PALETTE_INDEX_173;
|
|
|
|
|
|
|
|
|
|
// Line exceeds negative threshold (at bottom of graph).
|
|
|
|
|
if (bottom >= intensityThresholdNegative)
|
2018-06-22 19:20:27 +02:00
|
|
|
|
{
|
2020-07-13 22:49:12 +02:00
|
|
|
|
const auto redLineTop = ScreenCoordsXY{ x, std::max(top, intensityThresholdNegative) };
|
|
|
|
|
const auto redLineBottom = ScreenCoordsXY{ x, std::max(bottom, intensityThresholdNegative) };
|
|
|
|
|
gfx_fill_rect(dpi, { redLineTop, redLineBottom }, redLineColour);
|
2018-06-22 19:20:27 +02:00
|
|
|
|
}
|
2018-09-08 23:34:05 +02:00
|
|
|
|
|
|
|
|
|
// Line exceeds positive threshold (at top of graph).
|
|
|
|
|
if (top <= intensityThresholdPositive)
|
2018-06-22 19:20:27 +02:00
|
|
|
|
{
|
2020-07-13 22:49:12 +02:00
|
|
|
|
const auto redLineTop = ScreenCoordsXY{ x, std::min(top, intensityThresholdPositive) };
|
|
|
|
|
const auto redLineBottom = ScreenCoordsXY{ x, std::min(bottom, intensityThresholdPositive) };
|
|
|
|
|
gfx_fill_rect(dpi, { redLineTop, redLineBottom }, redLineColour);
|
2018-06-22 19:20:27 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-20 20:41:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
|
2014-09-06 00:44:02 +02:00
|
|
|
|
#pragma region Income
|
|
|
|
|
|
2017-07-24 10:56:08 +02:00
|
|
|
|
static utf8 _moneyInputText[MONEY_STRING_MAXLENGTH];
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void UpdateSamePriceThroughoutFlags(ShopItem shop_item)
|
2016-05-02 21:06:14 +02:00
|
|
|
|
{
|
2019-03-16 08:33:21 +01:00
|
|
|
|
uint64_t newFlags;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if (GetShopItemDescriptor(shop_item).IsPhoto())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2019-03-16 08:33:21 +01:00
|
|
|
|
newFlags = gSamePriceThroughoutPark;
|
2020-12-04 01:15:59 +01:00
|
|
|
|
newFlags ^= EnumsToFlags(ShopItem::Photo, ShopItem::Photo2, ShopItem::Photo3, ShopItem::Photo4);
|
2019-03-23 10:31:39 +01:00
|
|
|
|
auto parkSetParameter = ParkSetParameterAction(ParkParameter::SamePriceInPark, newFlags);
|
2019-03-16 08:33:21 +01:00
|
|
|
|
GameActions::Execute(&parkSetParameter);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
2019-03-16 08:33:21 +01:00
|
|
|
|
newFlags = gSamePriceThroughoutPark;
|
2020-12-04 01:15:59 +01:00
|
|
|
|
newFlags ^= EnumToFlag(shop_item);
|
2019-03-23 10:31:39 +01:00
|
|
|
|
auto parkSetParameter = ParkSetParameterAction(ParkParameter::SamePriceInPark, newFlags);
|
2019-03-16 08:33:21 +01:00
|
|
|
|
GameActions::Execute(&parkSetParameter);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2016-05-02 21:06:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-06 00:44:02 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ADEFD
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeTogglePrimaryPrice(rct_window* w)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
const auto rideId = w->rideId;
|
2021-08-02 06:24:52 +02:00
|
|
|
|
auto ride = get_ride(rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2015-10-20 20:16:30 +02:00
|
|
|
|
|
2020-12-04 01:15:59 +01:00
|
|
|
|
ShopItem shop_item;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (ride->type == RIDE_TYPE_TOILETS)
|
|
|
|
|
{
|
2020-12-04 01:15:59 +01:00
|
|
|
|
shop_item = ShopItem::Admission;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto rideEntry = get_ride_entry(ride->subtype);
|
|
|
|
|
if (rideEntry != nullptr)
|
|
|
|
|
{
|
2020-05-11 17:50:30 +02:00
|
|
|
|
shop_item = rideEntry->shop_item[0];
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if (shop_item == ShopItem::None)
|
2019-08-09 09:06:25 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
return;
|
2019-08-09 09:06:25 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2015-06-09 23:00:11 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
UpdateSamePriceThroughoutFlags(shop_item);
|
2016-05-02 21:06:14 +02:00
|
|
|
|
|
2021-08-02 06:24:52 +02:00
|
|
|
|
auto rideSetPriceAction = RideSetPriceAction(rideId, ride->price[0], true);
|
2019-02-07 22:02:49 +01:00
|
|
|
|
GameActions::Execute(&rideSetPriceAction);
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE06E
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeToggleSecondaryPrice(rct_window* w)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
const auto rideId = w->rideId;
|
2021-08-02 06:24:52 +02:00
|
|
|
|
auto ride = get_ride(rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2015-06-09 23:00:11 +02:00
|
|
|
|
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto rideEntry = get_ride_entry(ride->subtype);
|
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
return;
|
2015-10-20 20:16:30 +02:00
|
|
|
|
|
2020-05-11 17:50:30 +02:00
|
|
|
|
auto shop_item = rideEntry->shop_item[1];
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if (shop_item == ShopItem::None)
|
2021-02-24 14:02:58 +01:00
|
|
|
|
shop_item = ride->GetRideTypeDescriptor().PhotoItem;
|
2015-06-09 23:00:11 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
UpdateSamePriceThroughoutFlags(shop_item);
|
2015-06-09 23:00:11 +02:00
|
|
|
|
|
2021-08-02 06:24:52 +02:00
|
|
|
|
auto rideSetPriceAction = RideSetPriceAction(rideId, ride->price[1], false);
|
2019-02-07 22:02:49 +01:00
|
|
|
|
GameActions::Execute(&rideSetPriceAction);
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeSetPrimaryPrice(rct_window* w, money16 price)
|
2017-07-24 10:56:08 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto rideSetPriceAction = RideSetPriceAction(w->rideId, price, true);
|
2019-02-07 22:02:49 +01:00
|
|
|
|
GameActions::Execute(&rideSetPriceAction);
|
2017-07-24 10:56:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-06 00:44:02 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE1E4
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeIncreasePrimaryPrice(rct_window* w)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
if (!WindowRideIncomeCanModifyPrimaryPrice(w))
|
2018-06-01 14:23:46 +02:00
|
|
|
|
return;
|
2015-10-20 20:16:30 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-05-11 17:50:30 +02:00
|
|
|
|
money16 price = ride->price[0];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (price < MONEY(20, 00))
|
|
|
|
|
price++;
|
2015-06-09 03:28:07 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeSetPrimaryPrice(w, price);
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE237
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeDecreasePrimaryPrice(rct_window* w)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
if (!WindowRideIncomeCanModifyPrimaryPrice(w))
|
2018-06-01 14:23:46 +02:00
|
|
|
|
return;
|
2015-06-09 03:28:07 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-05-11 17:50:30 +02:00
|
|
|
|
money16 price = ride->price[0];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (price > MONEY(0, 00))
|
|
|
|
|
price--;
|
2015-06-09 03:28:07 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeSetPrimaryPrice(w, price);
|
2017-07-24 10:56:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static money16 WindowRideIncomeGetSecondaryPrice(rct_window* w)
|
2017-07-24 10:56:08 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2020-05-11 17:50:30 +02:00
|
|
|
|
money16 price = ride->price[1];
|
2017-07-24 10:56:08 +02:00
|
|
|
|
return price;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeSetSecondaryPrice(rct_window* w, money16 price)
|
2017-07-24 10:56:08 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto rideSetPriceAction = RideSetPriceAction(w->rideId, price, false);
|
2019-02-08 16:38:16 +01:00
|
|
|
|
GameActions::Execute(&rideSetPriceAction);
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static bool WindowRideIncomeCanModifyPrimaryPrice(rct_window* w)
|
2018-06-01 14:23:46 +02:00
|
|
|
|
{
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return false;
|
2018-06-01 14:23:46 +02:00
|
|
|
|
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
|
|
|
|
return park_ride_prices_unlocked() || ride->type == RIDE_TYPE_TOILETS
|
2020-12-04 01:15:59 +01:00
|
|
|
|
|| (rideEntry != nullptr && rideEntry->shop_item[0] != ShopItem::None);
|
2018-06-01 14:23:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-06 00:44:02 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE269
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeIncreaseSecondaryPrice(rct_window* w)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
money16 price = WindowRideIncomeGetSecondaryPrice(w);
|
2015-10-20 20:16:30 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (price < MONEY(20, 00))
|
|
|
|
|
price++;
|
2015-06-09 03:28:07 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeSetSecondaryPrice(w, price);
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE28D
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeDecreaseSecondaryPrice(rct_window* w)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
money16 price = WindowRideIncomeGetSecondaryPrice(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (price > MONEY(0, 00))
|
|
|
|
|
price--;
|
2015-06-09 03:28:07 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeSetSecondaryPrice(w, price);
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ADEA9
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeMouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2017-07-24 10:56:08 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
|
window_close(w);
|
|
|
|
|
break;
|
|
|
|
|
case WIDX_TAB_1:
|
|
|
|
|
case WIDX_TAB_2:
|
|
|
|
|
case WIDX_TAB_3:
|
|
|
|
|
case WIDX_TAB_4:
|
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
|
case WIDX_TAB_6:
|
|
|
|
|
case WIDX_TAB_7:
|
|
|
|
|
case WIDX_TAB_8:
|
|
|
|
|
case WIDX_TAB_9:
|
|
|
|
|
case WIDX_TAB_10:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, widgetIndex - WIDX_TAB_1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_PRIMARY_PRICE:
|
2017-07-24 10:56:08 +02:00
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
if (!WindowRideIncomeCanModifyPrimaryPrice(w))
|
2017-07-24 10:56:08 +02:00
|
|
|
|
return;
|
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride != nullptr)
|
|
|
|
|
{
|
2020-05-11 17:50:30 +02:00
|
|
|
|
money_to_string(static_cast<money32>(ride->price[0]), _moneyInputText, MONEY_STRING_MAXLENGTH, true);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowTextInputRawOpen(
|
2021-08-24 20:12:05 +02:00
|
|
|
|
w, WIDX_PRIMARY_PRICE, STR_ENTER_NEW_VALUE, STR_ENTER_NEW_VALUE, {}, _moneyInputText,
|
|
|
|
|
MONEY_STRING_MAXLENGTH);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
}
|
2017-07-24 10:56:08 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeTogglePrimaryPrice(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_SECONDARY_PRICE:
|
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
money32 price32 = static_cast<money32>(WindowRideIncomeGetSecondaryPrice(w));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
|
|
|
|
|
money_to_string(price32, _moneyInputText, MONEY_STRING_MAXLENGTH, true);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowTextInputRawOpen(
|
2021-08-24 20:12:05 +02:00
|
|
|
|
w, WIDX_SECONDARY_PRICE, STR_ENTER_NEW_VALUE, STR_ENTER_NEW_VALUE, {}, _moneyInputText, MONEY_STRING_MAXLENGTH);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeToggleSecondaryPrice(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE2F8
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeResize(rct_window* w)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2018-05-31 22:53:04 +02:00
|
|
|
|
window_set_resize(w, 316, 194, 316, 194);
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ADED4
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeMousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
|
|
|
|
case WIDX_PRIMARY_PRICE_INCREASE:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeIncreasePrimaryPrice(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_PRIMARY_PRICE_DECREASE:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeDecreasePrimaryPrice(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_SECONDARY_PRICE_INCREASE:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeIncreaseSecondaryPrice(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_SECONDARY_PRICE_DECREASE:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeDecreaseSecondaryPrice(w);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AE2BF
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeUpdate(rct_window* w)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->frame_no++;
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_9);
|
2014-09-06 00:44:02 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_INCOME)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_INCOME;
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeTextinput(rct_window* w, rct_widgetindex widgetIndex, char* text)
|
2017-07-24 10:56:08 +02:00
|
|
|
|
{
|
|
|
|
|
if ((widgetIndex != WIDX_PRIMARY_PRICE && widgetIndex != WIDX_SECONDARY_PRICE) || text == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
money32 price = string_to_money(text);
|
|
|
|
|
if (price == MONEY32_UNDEFINED)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-12 13:50:40 +02:00
|
|
|
|
price = std::clamp(price, MONEY(0, 00), MONEY(20, 00));
|
2020-04-18 13:32:48 +02:00
|
|
|
|
money16 price16 = static_cast<money16>(price);
|
2017-07-24 10:56:08 +02:00
|
|
|
|
|
|
|
|
|
if (widgetIndex == WIDX_PRIMARY_PRICE)
|
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeSetPrimaryPrice(w, price16);
|
2017-07-24 10:56:08 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideIncomeSetSecondaryPrice(w, price16);
|
2017-07-24 10:56:08 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-06 00:44:02 +02:00
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ADAA3
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomeInvalidate(rct_window* w)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto widgets = window_ride_page_widgets[w->page];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->widgets != widgets)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = widgets;
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPressedTab(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
2019-07-21 13:09:23 +02:00
|
|
|
|
|
2021-04-10 17:00:50 +02:00
|
|
|
|
w->widgets[WIDX_TITLE].text = STR_ARG_18_STRINGID;
|
2020-06-25 02:02:08 +02:00
|
|
|
|
|
|
|
|
|
auto ft = Formatter::Common();
|
2021-04-10 17:00:50 +02:00
|
|
|
|
ft.Increment(18);
|
2020-06-25 02:02:08 +02:00
|
|
|
|
ride->FormatNameTo(ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Primary item
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets &= ~(1ULL << WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK);
|
|
|
|
|
w->disabled_widgets &= ~(1ULL << WIDX_PRIMARY_PRICE);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
window_ride_income_widgets[WIDX_PRIMARY_PRICE_LABEL].tooltip = STR_NONE;
|
|
|
|
|
window_ride_income_widgets[WIDX_PRIMARY_PRICE].tooltip = STR_NONE;
|
|
|
|
|
|
2017-10-10 11:57:25 +02:00
|
|
|
|
// If ride prices are locked, do not allow setting the price, unless we're dealing with a shop or toilet.
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if (!park_ride_prices_unlocked() && rideEntry->shop_item[0] == ShopItem::None && ride->type != RIDE_TYPE_TOILETS)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
{
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->disabled_widgets |= (1ULL << WIDX_PRIMARY_PRICE);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_income_widgets[WIDX_PRIMARY_PRICE_LABEL].tooltip = STR_RIDE_INCOME_ADMISSION_PAY_FOR_ENTRY_TIP;
|
|
|
|
|
window_ride_income_widgets[WIDX_PRIMARY_PRICE].tooltip = STR_RIDE_INCOME_ADMISSION_PAY_FOR_ENTRY_TIP;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window_ride_income_widgets[WIDX_PRIMARY_PRICE_LABEL].text = STR_RIDE_INCOME_ADMISSION_PRICE;
|
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE_LABEL].text = STR_SHOP_ITEM_PRICE_LABEL_ON_RIDE_PHOTO;
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_income_widgets[WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Empty;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-04-10 17:00:50 +02:00
|
|
|
|
window_ride_income_widgets[WIDX_PRIMARY_PRICE].text = STR_BOTTOM_TOOLBAR_CASH;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
money16 ridePrimaryPrice = ride_get_price(ride);
|
2020-06-25 02:02:08 +02:00
|
|
|
|
ft.Rewind();
|
2021-04-10 17:00:50 +02:00
|
|
|
|
ft.Add<money64>(ridePrimaryPrice);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (ridePrimaryPrice == 0)
|
|
|
|
|
window_ride_income_widgets[WIDX_PRIMARY_PRICE].text = STR_FREE;
|
|
|
|
|
|
2020-12-04 01:15:59 +01:00
|
|
|
|
ShopItem primaryItem = ShopItem::Admission;
|
|
|
|
|
if (ride->type == RIDE_TYPE_TOILETS || ((primaryItem = rideEntry->shop_item[0]) != ShopItem::None))
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_income_widgets[WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Checkbox;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
if (shop_item_has_common_price(primaryItem))
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets |= (1ULL << WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-12-04 01:15:59 +01:00
|
|
|
|
window_ride_income_widgets[WIDX_PRIMARY_PRICE_LABEL].text = GetShopItemDescriptor(primaryItem).Naming.PriceLabel;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get secondary item
|
2021-02-24 14:02:58 +01:00
|
|
|
|
auto secondaryItem = ride->GetRideTypeDescriptor().PhotoItem;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO))
|
|
|
|
|
{
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if ((secondaryItem = rideEntry->shop_item[1]) != ShopItem::None)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-12-04 01:15:59 +01:00
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE_LABEL].text = GetShopItemDescriptor(secondaryItem)
|
|
|
|
|
.Naming.PriceLabel;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if (secondaryItem == ShopItem::None)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Hide secondary item widgets
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE_LABEL].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE_INCREASE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE_DECREASE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Empty;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
// Set same price throughout park checkbox
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets &= ~(1ULL << WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (shop_item_has_common_price(secondaryItem))
|
2021-06-26 14:23:15 +02:00
|
|
|
|
w->pressed_widgets |= (1ULL << WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Show widgets
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE_LABEL].type = WindowWidgetType::Label;
|
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE].type = WindowWidgetType::Spinner;
|
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE_INCREASE].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE_DECREASE].type = WindowWidgetType::Button;
|
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Checkbox;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Set secondary item price
|
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE].text = STR_RIDE_SECONDARY_PRICE_VALUE;
|
2021-04-10 17:00:50 +02:00
|
|
|
|
ft.Rewind();
|
|
|
|
|
ft.Increment(10);
|
|
|
|
|
ft.Add<money64>(ride->price[1]);
|
2020-05-11 17:50:30 +02:00
|
|
|
|
if (ride->price[1] == 0)
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_ride_income_widgets[WIDX_SECONDARY_PRICE].text = STR_FREE;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideAnchorBorderWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ADCE5
|
2014-09-06 00:44:02 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideIncomePaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-09-06 00:44:02 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_string_id stringId;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
money64 profit;
|
2020-12-04 01:15:59 +01:00
|
|
|
|
ShopItem primaryItem, secondaryItem;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowDrawWidgets(w, dpi);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabImages(dpi, w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto rideEntry = ride->GetRideEntry();
|
|
|
|
|
if (rideEntry == nullptr)
|
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-06-20 21:09:45 +02:00
|
|
|
|
auto screenCoords = w->windowPos
|
|
|
|
|
+ ScreenCoordsXY{ window_ride_income_widgets[WIDX_PAGE_BACKGROUND].left + 4,
|
|
|
|
|
window_ride_income_widgets[WIDX_PAGE_BACKGROUND].top + 33 };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Primary item profit / loss per item sold
|
2020-05-11 17:50:30 +02:00
|
|
|
|
primaryItem = rideEntry->shop_item[0];
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if (primaryItem != ShopItem::None)
|
2018-05-31 22:53:04 +02:00
|
|
|
|
{
|
2020-05-11 17:50:30 +02:00
|
|
|
|
profit = ride->price[0];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
stringId = STR_PROFIT_PER_ITEM_SOLD;
|
2020-12-04 01:15:59 +01:00
|
|
|
|
profit -= GetShopItemDescriptor(primaryItem).Cost;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (profit < 0)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
profit *= -1;
|
|
|
|
|
stringId = STR_LOSS_PER_ITEM_SOLD;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<money64>(profit);
|
|
|
|
|
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += 44;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Secondary item profit / loss per item sold
|
2021-02-24 14:02:58 +01:00
|
|
|
|
secondaryItem = ride->GetRideTypeDescriptor().PhotoItem;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO))
|
2020-05-11 17:50:30 +02:00
|
|
|
|
secondaryItem = rideEntry->shop_item[1];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if (secondaryItem != ShopItem::None)
|
2018-05-31 22:53:04 +02:00
|
|
|
|
{
|
2020-05-11 17:50:30 +02:00
|
|
|
|
profit = ride->price[1];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
stringId = STR_PROFIT_PER_ITEM_SOLD;
|
2020-12-04 01:15:59 +01:00
|
|
|
|
profit -= GetShopItemDescriptor(secondaryItem).Cost;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (profit < 0)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
profit *= -1;
|
|
|
|
|
stringId = STR_LOSS_PER_ITEM_SOLD;
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<money64>(profit);
|
|
|
|
|
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += 18;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Income per hour
|
2021-04-10 17:00:50 +02:00
|
|
|
|
if (ride->income_per_hour != MONEY64_UNDEFINED)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<money64>(ride->income_per_hour);
|
|
|
|
|
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_INCOME_PER_HOUR, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Running cost per hour
|
2021-07-27 20:32:27 +02:00
|
|
|
|
money64 costPerHour = ride->upkeep_cost * 16;
|
2017-10-17 17:12:49 +02:00
|
|
|
|
stringId = ride->upkeep_cost == MONEY16_UNDEFINED ? STR_RUNNING_COST_UNKNOWN : STR_RUNNING_COST_PER_HOUR;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<money64>(costPerHour);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Profit per hour
|
2021-04-10 17:00:50 +02:00
|
|
|
|
if (ride->profit != MONEY64_UNDEFINED)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<money64>(ride->profit);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_PROFIT_PER_HOUR, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += 5;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Total profit
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<money64>(ride->total_profit);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_TOTAL_PROFIT, ft);
|
2014-09-06 00:44:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
|
2014-09-04 20:59:42 +02:00
|
|
|
|
#pragma region Customer
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD986
|
2014-09-04 20:59:42 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideCustomerMouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-09-04 20:59:42 +02:00
|
|
|
|
{
|
2017-09-10 11:02:16 +02:00
|
|
|
|
switch (widgetIndex)
|
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
|
window_close(w);
|
|
|
|
|
break;
|
|
|
|
|
case WIDX_TAB_1:
|
|
|
|
|
case WIDX_TAB_2:
|
|
|
|
|
case WIDX_TAB_3:
|
|
|
|
|
case WIDX_TAB_4:
|
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
|
case WIDX_TAB_6:
|
|
|
|
|
case WIDX_TAB_7:
|
|
|
|
|
case WIDX_TAB_8:
|
|
|
|
|
case WIDX_TAB_9:
|
|
|
|
|
case WIDX_TAB_10:
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPage(w, widgetIndex - WIDX_TAB_1);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
break;
|
|
|
|
|
case WIDX_SHOW_GUESTS_THOUGHTS:
|
|
|
|
|
{
|
|
|
|
|
auto intent = Intent(WC_GUEST_LIST);
|
2020-09-02 17:50:16 +02:00
|
|
|
|
intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast<int32_t>(GuestListFilterType::GuestsThinkingAboutRide));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number);
|
|
|
|
|
context_open_intent(&intent);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case WIDX_SHOW_GUESTS_ON_RIDE:
|
|
|
|
|
{
|
|
|
|
|
auto intent = Intent(WC_GUEST_LIST);
|
2020-09-02 17:50:16 +02:00
|
|
|
|
intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast<int32_t>(GuestListFilterType::GuestsOnRide));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number);
|
|
|
|
|
context_open_intent(&intent);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case WIDX_SHOW_GUESTS_QUEUING:
|
|
|
|
|
{
|
|
|
|
|
auto intent = Intent(WC_GUEST_LIST);
|
2020-09-02 17:50:16 +02:00
|
|
|
|
intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast<int32_t>(GuestListFilterType::GuestsInQueue));
|
2018-06-22 23:21:44 +02:00
|
|
|
|
intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number);
|
|
|
|
|
context_open_intent(&intent);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2017-09-10 11:02:16 +02:00
|
|
|
|
}
|
2014-09-04 20:59:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006ADA29
|
2014-09-04 20:59:42 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideCustomerResize(rct_window* w)
|
2014-09-04 20:59:42 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->flags |= WF_RESIZABLE;
|
2017-10-21 15:51:20 +02:00
|
|
|
|
window_set_resize(w, 316, 163, 316, 163);
|
2014-09-04 20:59:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD9DD
|
2014-09-04 20:59:42 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideCustomerUpdate(rct_window* w)
|
2014-09-04 20:59:42 +02:00
|
|
|
|
{
|
2020-03-01 21:51:29 +01:00
|
|
|
|
w->picked_peep_frame++;
|
|
|
|
|
if (w->picked_peep_frame >= 24)
|
|
|
|
|
w->picked_peep_frame = 0;
|
2014-09-04 20:59:42 +02:00
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_10);
|
2014-09-04 20:59:42 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride != nullptr && ride->window_invalidate_flags & RIDE_INVALIDATE_RIDE_CUSTOMER)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
ride->window_invalidate_flags &= ~RIDE_INVALIDATE_RIDE_CUSTOMER;
|
2019-06-15 17:20:16 +02:00
|
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-04 20:59:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD5F8
|
2014-09-04 20:59:42 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideCustomerInvalidate(rct_window* w)
|
2014-09-04 20:59:42 +02:00
|
|
|
|
{
|
2019-08-09 09:06:25 +02:00
|
|
|
|
auto widgets = window_ride_page_widgets[w->page];
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (w->widgets != widgets)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
w->widgets = widgets;
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowInitScrollWidgets(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2014-09-04 20:59:42 +02:00
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideSetPressedTab(w);
|
2014-09-04 20:59:42 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
if (ride != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2020-06-25 02:02:08 +02:00
|
|
|
|
auto ft = Formatter::Common();
|
|
|
|
|
ride->FormatNameTo(ft);
|
2014-09-04 20:59:42 +02:00
|
|
|
|
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_customer_widgets[WIDX_SHOW_GUESTS_THOUGHTS].type = WindowWidgetType::FlatBtn;
|
2021-02-24 13:53:01 +01:00
|
|
|
|
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP))
|
2019-08-09 09:06:25 +02:00
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_customer_widgets[WIDX_SHOW_GUESTS_ON_RIDE].type = WindowWidgetType::Empty;
|
|
|
|
|
window_ride_customer_widgets[WIDX_SHOW_GUESTS_QUEUING].type = WindowWidgetType::Empty;
|
2019-08-09 09:06:25 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
|
window_ride_customer_widgets[WIDX_SHOW_GUESTS_ON_RIDE].type = WindowWidgetType::FlatBtn;
|
|
|
|
|
window_ride_customer_widgets[WIDX_SHOW_GUESTS_QUEUING].type = WindowWidgetType::FlatBtn;
|
2019-08-09 09:06:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideAnchorBorderWidgets(w);
|
2019-08-09 09:06:25 +02:00
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
|
|
|
|
}
|
2014-09-04 20:59:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
|
* rct2: 0x006AD6CD
|
2014-09-04 20:59:42 +02:00
|
|
|
|
*/
|
2021-11-23 14:18:07 +01:00
|
|
|
|
static void WindowRideCustomerPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
2014-09-04 20:59:42 +02:00
|
|
|
|
{
|
2020-12-04 01:15:59 +01:00
|
|
|
|
ShopItem shopItem;
|
2020-05-12 20:11:29 +02:00
|
|
|
|
int16_t popularity, satisfaction, queueTime;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
rct_string_id stringId;
|
|
|
|
|
|
2020-11-04 05:52:23 +01:00
|
|
|
|
WindowDrawWidgets(w, dpi);
|
2021-11-23 14:18:07 +01:00
|
|
|
|
WindowRideDrawTabImages(dpi, w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
2021-09-04 18:04:53 +02:00
|
|
|
|
auto ride = get_ride(w->rideId);
|
2019-08-09 15:20:59 +02:00
|
|
|
|
if (ride == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-06-20 21:09:45 +02:00
|
|
|
|
auto screenCoords = w->windowPos
|
|
|
|
|
+ ScreenCoordsXY{ window_ride_customer_widgets[WIDX_PAGE_BACKGROUND].left + 4,
|
|
|
|
|
window_ride_customer_widgets[WIDX_PAGE_BACKGROUND].top + 4 };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Customers currently on ride
|
2019-08-03 19:11:30 +02:00
|
|
|
|
if (ride->IsRide())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<int16_t>(ride->num_riders);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_ON_RIDE, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Customers per hour
|
2021-07-27 20:32:27 +02:00
|
|
|
|
auto ft = Formatter();
|
|
|
|
|
ft.Add<int32_t>(ride_customers_per_hour(ride));
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_PER_HOUR, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Popularity
|
|
|
|
|
popularity = ride->popularity;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (popularity == 255)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_POPULARITY_UNKNOWN;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_POPULARITY_PERCENT;
|
|
|
|
|
popularity *= 4;
|
|
|
|
|
}
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<int16_t>(popularity);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Satisfaction
|
|
|
|
|
satisfaction = ride->satisfaction;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
if (satisfaction == 255)
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_SATISFACTION_UNKNOWN;
|
2018-06-22 23:21:44 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = STR_SATISFACTION_PERCENT;
|
|
|
|
|
satisfaction *= 5;
|
|
|
|
|
}
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<int16_t>(satisfaction);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Queue time
|
2019-08-03 19:11:30 +02:00
|
|
|
|
if (ride->IsRide())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2019-04-20 22:22:39 +02:00
|
|
|
|
queueTime = ride->GetMaxQueueTime();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
stringId = queueTime == 1 ? STR_QUEUE_TIME_MINUTE : STR_QUEUE_TIME_MINUTES;
|
2021-08-21 09:42:05 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<int32_t>(queueTime);
|
|
|
|
|
screenCoords.y += DrawTextWrapped(dpi, screenCoords, 308, stringId, ft, { TextAlignment::LEFT });
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += 5;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Primary shop items sold
|
2020-05-11 17:50:30 +02:00
|
|
|
|
shopItem = ride->GetRideEntry()->shop_item[0];
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if (shopItem != ShopItem::None)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
2020-12-04 01:15:59 +01:00
|
|
|
|
ft.Add<rct_string_id>(GetShopItemDescriptor(shopItem).Naming.Plural);
|
2020-06-03 11:20:29 +02:00
|
|
|
|
ft.Add<uint32_t>(ride->no_primary_items_sold);
|
2021-02-27 16:49:13 +01:00
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_ITEMS_SOLD, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Secondary shop items sold / on-ride photos sold
|
2021-02-24 14:02:58 +01:00
|
|
|
|
shopItem = (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) ? ride->GetRideTypeDescriptor().PhotoItem
|
2020-05-11 17:50:30 +02:00
|
|
|
|
: ride->GetRideEntry()->shop_item[1];
|
2020-12-04 01:15:59 +01:00
|
|
|
|
if (shopItem != ShopItem::None)
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
2020-12-04 01:15:59 +01:00
|
|
|
|
ft.Add<rct_string_id>(GetShopItemDescriptor(shopItem).Naming.Plural);
|
2020-06-03 11:20:29 +02:00
|
|
|
|
ft.Add<uint32_t>(ride->no_secondary_items_sold);
|
2021-02-27 16:49:13 +01:00
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_ITEMS_SOLD, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Total customers
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<uint32_t>(ride->total_customers);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, STR_TOTAL_CUSTOMERS, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Guests favourite
|
2019-08-03 19:11:30 +02:00
|
|
|
|
if (ride->IsRide())
|
2018-06-22 23:21:44 +02:00
|
|
|
|
{
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<uint16_t>(ride->guests_favourite);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
stringId = ride->guests_favourite == 1 ? STR_FAVOURITE_RIDE_OF_GUEST : STR_FAVOURITE_RIDE_OF_GUESTS;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
}
|
2020-06-20 21:09:45 +02:00
|
|
|
|
screenCoords.y += 2;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
|
|
// Age
|
2018-06-22 23:21:44 +02:00
|
|
|
|
// If the ride has a build date that is in the future, show it as built this year.
|
2020-05-12 20:11:29 +02:00
|
|
|
|
int16_t age = std::max(date_get_year(ride->GetAge()), 0);
|
2018-06-22 23:21:44 +02:00
|
|
|
|
stringId = age == 0 ? STR_BUILT_THIS_YEAR : age == 1 ? STR_BUILT_LAST_YEAR : STR_BUILT_YEARS_AGO;
|
2021-07-27 20:32:27 +02:00
|
|
|
|
ft = Formatter();
|
|
|
|
|
ft.Add<int16_t>(age);
|
|
|
|
|
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
2014-09-04 20:59:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-14 16:52:48 +01:00
|
|
|
|
#pragma endregion
|