forked from rosebudai/OpenRCT2-Web
Merge pull request #22216 from Gymnasiast/refactor/more-track-3
More track design refactors
This commit is contained in:
32 files changed
+659
-623
No files matched your search
@@ -169,8 +169,8 @@ static Widget window_install_track_widgets[] = {
|
||||
screenPos = windowPos + ScreenCoordsXY{ widget->midX(), widget->bottom - 12 };
|
||||
|
||||
// Warnings
|
||||
const TrackDesign* td6 = _trackDesign.get();
|
||||
if (td6->trackFlags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE)
|
||||
const TrackDesign* td = _trackDesign.get();
|
||||
if (td->trackFlags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE)
|
||||
{
|
||||
if (!gTrackDesignSceneryToggle)
|
||||
{
|
||||
@@ -198,17 +198,17 @@ static Widget window_install_track_widgets[] = {
|
||||
{
|
||||
auto ft = Formatter();
|
||||
|
||||
const auto* objectEntry = ObjectManagerLoadObject(&td6->vehicleObject.Entry);
|
||||
const auto* objectEntry = ObjectManagerLoadObject(&td->vehicleObject.Entry);
|
||||
if (objectEntry != nullptr)
|
||||
{
|
||||
auto groupIndex = ObjectManagerGetLoadedObjectEntryIndex(objectEntry);
|
||||
auto rideName = GetRideNaming(td6->type, *GetRideEntryByIndex(groupIndex));
|
||||
auto rideName = GetRideNaming(td->type, *GetRideEntryByIndex(groupIndex));
|
||||
ft.Add<StringId>(rideName.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fall back on the technical track name if the vehicle object cannot be loaded
|
||||
ft.Add<StringId>(GetRideTypeDescriptor(td6->type).Naming.Name);
|
||||
ft.Add<StringId>(GetRideTypeDescriptor(td->type).Naming.Name);
|
||||
}
|
||||
|
||||
DrawTextBasic(dpi, screenPos, STR_TRACK_DESIGN_TYPE, ft);
|
||||
@@ -217,34 +217,34 @@ static Widget window_install_track_widgets[] = {
|
||||
|
||||
// Stats
|
||||
{
|
||||
fixed32_2dp rating = td6->excitement * 10;
|
||||
fixed32_2dp rating = td->statistics.excitement * 10;
|
||||
auto ft = Formatter();
|
||||
ft.Add<int32_t>(rating);
|
||||
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_EXCITEMENT_RATING, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
{
|
||||
fixed32_2dp rating = td6->intensity * 10;
|
||||
fixed32_2dp rating = td->statistics.intensity * 10;
|
||||
auto ft = Formatter();
|
||||
ft.Add<int32_t>(rating);
|
||||
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_INTENSITY_RATING, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
{
|
||||
fixed32_2dp rating = td6->nausea * 10;
|
||||
fixed32_2dp rating = td->statistics.nausea * 10;
|
||||
auto ft = Formatter();
|
||||
ft.Add<int32_t>(rating);
|
||||
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_NAUSEA_RATING, ft);
|
||||
screenPos.y += kListRowHeight + 4;
|
||||
}
|
||||
|
||||
const auto& rtd = GetRideTypeDescriptor(td6->type);
|
||||
const auto& rtd = GetRideTypeDescriptor(td->type);
|
||||
if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
{
|
||||
if (td6->type == RIDE_TYPE_MINI_GOLF)
|
||||
if (td->type == RIDE_TYPE_MINI_GOLF)
|
||||
{
|
||||
// Holes
|
||||
uint16_t holes = td6->holes & 0x1F;
|
||||
uint16_t holes = td->statistics.holes & 0x1F;
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(holes);
|
||||
DrawTextBasic(dpi, screenPos, STR_HOLES, ft);
|
||||
@@ -254,7 +254,7 @@ static Widget window_install_track_widgets[] = {
|
||||
{
|
||||
// Maximum speed
|
||||
{
|
||||
uint16_t speed = ((td6->maxSpeed << 16) * 9) >> 18;
|
||||
uint16_t speed = ((td->statistics.maxSpeed << 16) * 9) >> 18;
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(speed);
|
||||
DrawTextBasic(dpi, screenPos, STR_MAX_SPEED, ft);
|
||||
@@ -262,7 +262,7 @@ static Widget window_install_track_widgets[] = {
|
||||
}
|
||||
// Average speed
|
||||
{
|
||||
uint16_t speed = ((td6->averageSpeed << 16) * 9) >> 18;
|
||||
uint16_t speed = ((td->statistics.averageSpeed << 16) * 9) >> 18;
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(speed);
|
||||
DrawTextBasic(dpi, screenPos, STR_AVERAGE_SPEED, ft);
|
||||
@@ -273,16 +273,16 @@ static Widget window_install_track_widgets[] = {
|
||||
// Ride length
|
||||
auto ft = Formatter();
|
||||
ft.Add<StringId>(STR_RIDE_LENGTH_ENTRY);
|
||||
ft.Add<uint16_t>(td6->rideLength);
|
||||
ft.Add<uint16_t>(td->statistics.rideLength);
|
||||
DrawTextEllipsised(dpi, screenPos, 214, STR_TRACK_LIST_RIDE_LENGTH, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
|
||||
if (GetRideTypeDescriptor(td6->type).HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES))
|
||||
if (GetRideTypeDescriptor(td->type).HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES))
|
||||
{
|
||||
// Maximum positive vertical Gs
|
||||
{
|
||||
int32_t gForces = td6->maxPositiveVerticalG * 32;
|
||||
int32_t gForces = td->statistics.maxPositiveVerticalG * 32;
|
||||
auto ft = Formatter();
|
||||
ft.Add<int32_t>(gForces);
|
||||
DrawTextBasic(dpi, screenPos, STR_MAX_POSITIVE_VERTICAL_G, ft);
|
||||
@@ -290,7 +290,7 @@ static Widget window_install_track_widgets[] = {
|
||||
}
|
||||
// Maximum negative vertical Gs
|
||||
{
|
||||
int32_t gForces = td6->maxNegativeVerticalG * 32;
|
||||
int32_t gForces = td->statistics.maxNegativeVerticalG * 32;
|
||||
auto ft = Formatter();
|
||||
ft.Add<int32_t>(gForces);
|
||||
DrawTextBasic(dpi, screenPos, STR_MAX_NEGATIVE_VERTICAL_G, ft);
|
||||
@@ -298,16 +298,16 @@ static Widget window_install_track_widgets[] = {
|
||||
}
|
||||
// Maximum lateral Gs
|
||||
{
|
||||
int32_t gForces = td6->maxLateralG * 32;
|
||||
int32_t gForces = td->statistics.maxLateralG * 32;
|
||||
auto ft = Formatter();
|
||||
ft.Add<int32_t>(gForces);
|
||||
DrawTextBasic(dpi, screenPos, STR_MAX_LATERAL_G, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
if (td6->totalAirTime != 0)
|
||||
if (td->statistics.totalAirTime != 0)
|
||||
{
|
||||
// Total air time
|
||||
int32_t airTime = td6->totalAirTime * 25;
|
||||
int32_t airTime = td->statistics.totalAirTime * 25;
|
||||
auto ft = Formatter();
|
||||
ft.Add<int32_t>(airTime);
|
||||
DrawTextBasic(dpi, screenPos, STR_TOTAL_AIR_TIME, ft);
|
||||
@@ -315,10 +315,10 @@ static Widget window_install_track_widgets[] = {
|
||||
}
|
||||
}
|
||||
|
||||
if (GetRideTypeDescriptor(td6->type).HasFlag(RIDE_TYPE_FLAG_HAS_DROPS))
|
||||
if (GetRideTypeDescriptor(td->type).HasFlag(RIDE_TYPE_FLAG_HAS_DROPS))
|
||||
{
|
||||
// Drops
|
||||
uint16_t drops = td6->drops & 0x3F;
|
||||
uint16_t drops = td->statistics.drops & 0x3F;
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(drops);
|
||||
DrawTextBasic(dpi, screenPos, STR_DROPS, ft);
|
||||
@@ -329,9 +329,9 @@ static Widget window_install_track_widgets[] = {
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
|
||||
if (td6->type != RIDE_TYPE_MINI_GOLF)
|
||||
if (td->type != RIDE_TYPE_MINI_GOLF)
|
||||
{
|
||||
uint16_t inversions = td6->inversions & 0x1F;
|
||||
uint16_t inversions = td->statistics.inversions & 0x1F;
|
||||
if (inversions != 0)
|
||||
{
|
||||
// Inversions
|
||||
@@ -343,20 +343,20 @@ static Widget window_install_track_widgets[] = {
|
||||
}
|
||||
screenPos.y += 4;
|
||||
|
||||
if (td6->spaceRequiredX != 0xFF)
|
||||
if (!td->statistics.spaceRequired.IsNull())
|
||||
{
|
||||
// Space required
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(td6->spaceRequiredX);
|
||||
ft.Add<uint16_t>(td6->spaceRequiredY);
|
||||
ft.Add<uint16_t>(td->statistics.spaceRequired.x);
|
||||
ft.Add<uint16_t>(td->statistics.spaceRequired.y);
|
||||
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_SPACE_REQUIRED, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
|
||||
if (td6->cost != 0)
|
||||
if (td->cost != 0)
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<money64>(td6->cost);
|
||||
ft.Add<money64>(td->cost);
|
||||
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_COST_AROUND, ft);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,12 +506,12 @@ static_assert(std::size(RatingNames) == 6);
|
||||
|
||||
// Used in other places as well
|
||||
const StringId ColourSchemeNames[4] = {
|
||||
STR_MAIN_COLOUR_SCHEME, // RIDE_COLOUR_SCHEME_MAIN
|
||||
STR_ALTERNATIVE_COLOUR_SCHEME_1, // RIDE_COLOUR_SCHEME_ADDITIONAL_1
|
||||
STR_ALTERNATIVE_COLOUR_SCHEME_2, // RIDE_COLOUR_SCHEME_ADDITIONAL_2
|
||||
STR_ALTERNATIVE_COLOUR_SCHEME_3, // RIDE_COLOUR_SCHEME_ADDITIONAL_3
|
||||
STR_MAIN_COLOUR_SCHEME, // RideColourScheme::main
|
||||
STR_ALTERNATIVE_COLOUR_SCHEME_1, // RideColourScheme::additional1
|
||||
STR_ALTERNATIVE_COLOUR_SCHEME_2, // RideColourScheme::additional2
|
||||
STR_ALTERNATIVE_COLOUR_SCHEME_3, // RideColourScheme::additional3
|
||||
};
|
||||
static_assert(std::size(ColourSchemeNames) == RIDE_COLOUR_SCHEME_COUNT);
|
||||
static_assert(std::size(ColourSchemeNames) == kNumRideColourSchemes);
|
||||
|
||||
static constexpr std::array VehicleLoadNames = {
|
||||
static_cast<StringId>(STR_QUARTER_LOAD), // WAIT_FOR_LOAD_QUARTER
|
||||
@@ -523,11 +523,11 @@ static_assert(std::size(RatingNames) == 6);
|
||||
static_assert(std::size(VehicleLoadNames) == WAIT_FOR_LOAD_COUNT);
|
||||
|
||||
static constexpr std::array VehicleColourSchemeNames = {
|
||||
static_cast<StringId>(STR_ALL_VEHICLES_IN_SAME_COLOURS), // RIDE_COLOUR_SCHEME_MODE_ALL_SAME,
|
||||
static_cast<StringId>(STR_DIFFERENT_COLOURS_PER), // RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_TRAIN,
|
||||
static_cast<StringId>(STR_DIFFERENT_COLOURS_PER_VEHICLE), // RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_CAR,
|
||||
static_cast<StringId>(STR_ALL_VEHICLES_IN_SAME_COLOURS), // VehicleColourSettings::same,
|
||||
static_cast<StringId>(STR_DIFFERENT_COLOURS_PER), // VehicleColourSettings::perTrain,
|
||||
static_cast<StringId>(STR_DIFFERENT_COLOURS_PER_VEHICLE), // VehicleColourSettings::perCar,
|
||||
};
|
||||
static_assert(std::size(VehicleColourSchemeNames) == RIDE_COLOUR_SCHEME_MODE_COUNT);
|
||||
static_assert(std::size(VehicleColourSchemeNames) == kNumVehicleColourSettings);
|
||||
|
||||
static constexpr std::array VehicleStatusNames = {
|
||||
static_cast<StringId>(STR_MOVING_TO_END_OF), // Vehicle::Status::MovingToEndOfStation
|
||||
@@ -1202,7 +1202,7 @@ static_assert(std::size(RatingNames) == 6);
|
||||
const auto vehicle = RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, rideEntry->TabCar);
|
||||
const auto& carEntry = rideEntry->Cars[vehicle];
|
||||
|
||||
auto vehicleId = ((ride->colour_scheme_type & 3) == VEHICLE_COLOUR_SCHEME_PER_VEHICLE) ? rideEntry->TabCar : 0;
|
||||
auto vehicleId = (ride->vehicleColourSettings == VehicleColourSettings::perCar) ? rideEntry->TabCar : 0;
|
||||
VehicleColour vehicleColour = RideGetVehicleColour(*ride, vehicleId);
|
||||
|
||||
// imageIndex represents a precision of 64
|
||||
@@ -2915,15 +2915,15 @@ static_assert(std::size(RatingNames) == 6);
|
||||
|
||||
// Get colour of vehicle
|
||||
int32_t vehicleColourIndex = 0;
|
||||
switch (ride->colour_scheme_type & 3)
|
||||
switch (ride->vehicleColourSettings)
|
||||
{
|
||||
case VEHICLE_COLOUR_SCHEME_SAME:
|
||||
case VehicleColourSettings::same:
|
||||
vehicleColourIndex = 0;
|
||||
break;
|
||||
case VEHICLE_COLOUR_SCHEME_PER_TRAIN:
|
||||
case VehicleColourSettings::perTrain:
|
||||
vehicleColourIndex = i;
|
||||
break;
|
||||
case VEHICLE_COLOUR_SCHEME_PER_VEHICLE:
|
||||
case VehicleColourSettings::perCar:
|
||||
vehicleColourIndex = carIndex;
|
||||
break;
|
||||
}
|
||||
@@ -4176,7 +4176,7 @@ static_assert(std::size(RatingNames) == 6);
|
||||
void ColourOnMouseDown(WidgetIndex widgetIndex)
|
||||
{
|
||||
VehicleColour vehicleColour;
|
||||
int32_t i, numItems;
|
||||
int32_t numItems;
|
||||
StringId stringId;
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
@@ -4193,7 +4193,8 @@ static_assert(std::size(RatingNames) == 6);
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_TRACK_COLOUR_SCHEME_DROPDOWN:
|
||||
for (i = 0; i < OpenRCT2::Limits::kNumColourSchemes; i++)
|
||||
{
|
||||
for (size_t i = 0; i < std::size(ColourSchemeNames); i++)
|
||||
{
|
||||
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItems[i].Args = ColourSchemeNames[i];
|
||||
@@ -4205,6 +4206,7 @@ static_assert(std::size(RatingNames) == 6);
|
||||
|
||||
Dropdown::SetChecked(colourSchemeIndex, true);
|
||||
break;
|
||||
}
|
||||
case WIDX_TRACK_MAIN_COLOUR:
|
||||
WindowDropdownShowColour(
|
||||
this, &widgets[widgetIndex], colours[1], ride->track_colour[colourSchemeIndex].main);
|
||||
@@ -4218,7 +4220,8 @@ static_assert(std::size(RatingNames) == 6);
|
||||
this, &widgets[widgetIndex], colours[1], ride->track_colour[colourSchemeIndex].supports);
|
||||
break;
|
||||
case WIDX_MAZE_STYLE_DROPDOWN:
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (auto i = 0; i < 4; i++)
|
||||
{
|
||||
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItems[i].Args = MazeOptions[i].text;
|
||||
@@ -4230,11 +4233,13 @@ static_assert(std::size(RatingNames) == 6);
|
||||
|
||||
Dropdown::SetChecked(ride->track_colour[colourSchemeIndex].supports, true);
|
||||
break;
|
||||
}
|
||||
case WIDX_ENTRANCE_STYLE_DROPDOWN:
|
||||
ShowEntranceStyleDropdown();
|
||||
break;
|
||||
case WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN:
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
for (auto i = 0; i < 3; i++)
|
||||
{
|
||||
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItems[i].Args = (GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle)
|
||||
@@ -4248,17 +4253,18 @@ static_assert(std::size(RatingNames) == 6);
|
||||
colours[1], 0, Dropdown::Flag::StayOpen, rideEntry->max_cars_in_train > 1 ? 3 : 2,
|
||||
widgets[widgetIndex].right - dropdownWidget->left);
|
||||
|
||||
Dropdown::SetChecked(ride->colour_scheme_type & 3, true);
|
||||
Dropdown::SetChecked(EnumValue(ride->vehicleColourSettings), true);
|
||||
break;
|
||||
}
|
||||
case WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN:
|
||||
{
|
||||
numItems = ride->NumTrains;
|
||||
if ((ride->colour_scheme_type & 3) != VEHICLE_COLOUR_SCHEME_PER_TRAIN)
|
||||
if (ride->vehicleColourSettings != VehicleColourSettings::perTrain)
|
||||
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;
|
||||
for (i = 0; i < std::min(numItems, Dropdown::ItemsMaxSize); i++)
|
||||
stringId = ride->vehicleColourSettings == VehicleColourSettings::perTrain ? STR_RIDE_COLOUR_TRAIN_OPTION
|
||||
: STR_RIDE_COLOUR_VEHICLE_OPTION;
|
||||
for (auto i = 0; i < std::min(numItems, Dropdown::ItemsMaxSize); i++)
|
||||
{
|
||||
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItems[i].Args = (static_cast<int64_t>(i + 1) << 32)
|
||||
@@ -4272,6 +4278,7 @@ static_assert(std::size(RatingNames) == 6);
|
||||
|
||||
Dropdown::SetChecked(_vehicleIndex, true);
|
||||
break;
|
||||
}
|
||||
case WIDX_VEHICLE_BODY_COLOUR:
|
||||
vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex);
|
||||
WindowDropdownShowColour(this, &widgets[widgetIndex], colours[1], vehicleColour.Body);
|
||||
@@ -4549,8 +4556,7 @@ static_assert(std::size(RatingNames) == 6);
|
||||
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)
|
||||
&& ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_VEHICLE_COLOURS))
|
||||
{
|
||||
int32_t vehicleColourSchemeType = ride->colour_scheme_type & 3;
|
||||
if (vehicleColourSchemeType == 0)
|
||||
if (ride->vehicleColourSettings == VehicleColourSettings::same)
|
||||
_vehicleIndex = 0;
|
||||
|
||||
vehicleColour = RideGetVehicleColour(*ride, _vehicleIndex);
|
||||
@@ -4611,18 +4617,19 @@ static_assert(std::size(RatingNames) == 6);
|
||||
}
|
||||
ft.Rewind();
|
||||
ft.Increment(6);
|
||||
ft.Add<StringId>(VehicleColourSchemeNames[vehicleColourSchemeType]);
|
||||
ft.Add<StringId>(VehicleColourSchemeNames[EnumValue(ride->vehicleColourSettings)]);
|
||||
ft.Add<StringId>(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).singular);
|
||||
ft.Add<StringId>(GetRideComponentName(ride->GetRideTypeDescriptor().NameConvention.vehicle).capitalised);
|
||||
ft.Add<uint16_t>(_vehicleIndex + 1);
|
||||
|
||||
// Vehicle index
|
||||
if (vehicleColourSchemeType != 0)
|
||||
if (ride->vehicleColourSettings != VehicleColourSettings::same)
|
||||
{
|
||||
widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WindowWidgetType::DropdownMenu;
|
||||
widgets[WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN].type = WindowWidgetType::Button;
|
||||
widgets[WIDX_VEHICLE_COLOUR_INDEX].text = vehicleColourSchemeType == 1 ? STR_RIDE_COLOUR_TRAIN_VALUE
|
||||
: STR_RIDE_COLOUR_VEHICLE_VALUE;
|
||||
widgets[WIDX_VEHICLE_COLOUR_INDEX].text = ride->vehicleColourSettings == VehicleColourSettings::perTrain
|
||||
? STR_RIDE_COLOUR_TRAIN_VALUE
|
||||
: STR_RIDE_COLOUR_VEHICLE_VALUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4788,9 +4795,8 @@ static_assert(std::size(RatingNames) == 6);
|
||||
auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 15 };
|
||||
|
||||
// ?
|
||||
auto trainCarIndex = (ride->colour_scheme_type & 3) == RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_CAR
|
||||
? _vehicleIndex
|
||||
: rideEntry->TabCar;
|
||||
auto trainCarIndex = ride->vehicleColourSettings == VehicleColourSettings::perCar ? _vehicleIndex
|
||||
: rideEntry->TabCar;
|
||||
|
||||
const auto& carEntry = rideEntry->Cars[RideEntryGetVehicleAtPosition(
|
||||
ride->subtype, ride->num_cars_per_train, trainCarIndex)];
|
||||
|
||||
@@ -2655,7 +2655,7 @@ static Widget _rideConstructionWidgets[] = {
|
||||
tempTrackTileElement.AsTrack()->SetRideType(currentRide->type);
|
||||
tempTrackTileElement.AsTrack()->SetHasCableLift(false);
|
||||
tempTrackTileElement.AsTrack()->SetInverted((liftHillAndInvertedState & CONSTRUCTION_INVERTED_TRACK_SELECTED) != 0);
|
||||
tempTrackTileElement.AsTrack()->SetColourScheme(RIDE_COLOUR_SCHEME_MAIN);
|
||||
tempTrackTileElement.AsTrack()->SetColourScheme(RideColourScheme::main);
|
||||
// Skipping seat rotation, should not be necessary for a temporary piece.
|
||||
tempTrackTileElement.AsTrack()->SetRideIndex(rideIndex);
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ static Widget _trackPlaceWidgets[] = {
|
||||
_trackDesign = std::move(trackDesign);
|
||||
}
|
||||
|
||||
void DrawMiniPreview(TrackDesign* td6)
|
||||
void DrawMiniPreview(TrackDesign* td)
|
||||
{
|
||||
ClearMiniPreview();
|
||||
|
||||
@@ -366,14 +366,14 @@ static Widget _trackPlaceWidgets[] = {
|
||||
origin.y -= ((max.y + min.y) >> 6) * COORDS_XY_STEP;
|
||||
}
|
||||
|
||||
const auto& rtd = GetRideTypeDescriptor(td6->type);
|
||||
const auto& rtd = GetRideTypeDescriptor(td->type);
|
||||
if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
{
|
||||
DrawMiniPreviewMaze(td6, pass, origin, min, max);
|
||||
DrawMiniPreviewMaze(td, pass, origin, min, max);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawMiniPreviewTrack(td6, pass, origin, min, max);
|
||||
DrawMiniPreviewTrack(td, pass, origin, min, max);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -436,9 +436,9 @@ static Widget _trackPlaceWidgets[] = {
|
||||
}
|
||||
|
||||
void DrawMiniPreviewEntrances(
|
||||
const TrackDesign& td6, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max, Direction rotation)
|
||||
const TrackDesign& td, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max, Direction rotation)
|
||||
{
|
||||
for (const auto& entrance : td6.entranceElements)
|
||||
for (const auto& entrance : td.entranceElements)
|
||||
{
|
||||
auto rotatedAndOffsetEntrance = origin + entrance.location.ToCoordsXY().Rotate(rotation);
|
||||
|
||||
@@ -468,16 +468,16 @@ static Widget _trackPlaceWidgets[] = {
|
||||
}
|
||||
}
|
||||
|
||||
void DrawMiniPreviewTrack(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max)
|
||||
void DrawMiniPreviewTrack(TrackDesign* td, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max)
|
||||
{
|
||||
const uint8_t rotation = (_currentTrackPieceDirection + GetCurrentRotation()) & 3;
|
||||
|
||||
CoordsXY curTrackStart = origin;
|
||||
uint8_t curTrackRotation = rotation;
|
||||
for (const auto& trackElement : td6->trackElements)
|
||||
for (const auto& trackElement : td->trackElements)
|
||||
{
|
||||
// Follow a single track piece shape
|
||||
const auto& ted = GetTrackElementDescriptor(trackElement.Type);
|
||||
const auto& ted = GetTrackElementDescriptor(trackElement.type);
|
||||
const PreviewTrack* trackBlock = ted.Block;
|
||||
while (trackBlock->index != 255)
|
||||
{
|
||||
@@ -539,13 +539,13 @@ static Widget _trackPlaceWidgets[] = {
|
||||
}
|
||||
}
|
||||
|
||||
DrawMiniPreviewEntrances(*td6, pass, origin, min, max, rotation);
|
||||
DrawMiniPreviewEntrances(*td, pass, origin, min, max, rotation);
|
||||
}
|
||||
|
||||
void DrawMiniPreviewMaze(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max)
|
||||
void DrawMiniPreviewMaze(TrackDesign* td, int32_t pass, const CoordsXY& origin, CoordsXY& min, CoordsXY& max)
|
||||
{
|
||||
uint8_t rotation = (_currentTrackPieceDirection + GetCurrentRotation()) & 3;
|
||||
for (const auto& mazeElement : td6->mazeElements)
|
||||
for (const auto& mazeElement : td->mazeElements)
|
||||
{
|
||||
auto rotatedMazeCoords = origin + mazeElement.location.ToCoordsXY().Rotate(rotation);
|
||||
|
||||
@@ -575,7 +575,7 @@ static Widget _trackPlaceWidgets[] = {
|
||||
}
|
||||
}
|
||||
|
||||
DrawMiniPreviewEntrances(*td6, pass, origin, min, max, rotation);
|
||||
DrawMiniPreviewEntrances(*td, pass, origin, min, max, rotation);
|
||||
}
|
||||
|
||||
ScreenCoordsXY DrawMiniPreviewGetPixelPosition(const CoordsXY& location)
|
||||
|
||||
@@ -544,17 +544,17 @@ static Widget _trackListWidgets[] = {
|
||||
|
||||
// Stats
|
||||
ft = Formatter();
|
||||
ft.Add<fixed32_2dp>(_loadedTrackDesign->excitement * 10);
|
||||
ft.Add<fixed32_2dp>(_loadedTrackDesign->statistics.excitement * 10);
|
||||
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_EXCITEMENT_RATING, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
|
||||
ft = Formatter();
|
||||
ft.Add<fixed32_2dp>(_loadedTrackDesign->intensity * 10);
|
||||
ft.Add<fixed32_2dp>(_loadedTrackDesign->statistics.intensity * 10);
|
||||
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_INTENSITY_RATING, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
|
||||
ft = Formatter();
|
||||
ft.Add<fixed32_2dp>(_loadedTrackDesign->nausea * 10);
|
||||
ft.Add<fixed32_2dp>(_loadedTrackDesign->statistics.nausea * 10);
|
||||
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_NAUSEA_RATING, ft);
|
||||
screenPos.y += kListRowHeight + 4;
|
||||
|
||||
@@ -568,7 +568,7 @@ static Widget _trackListWidgets[] = {
|
||||
{
|
||||
// Holes
|
||||
ft = Formatter();
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->holes & 0x1F);
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->statistics.holes & 0x1F);
|
||||
DrawTextBasic(dpi, screenPos, STR_HOLES, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
@@ -576,13 +576,13 @@ static Widget _trackListWidgets[] = {
|
||||
{
|
||||
// Maximum speed
|
||||
ft = Formatter();
|
||||
ft.Add<uint16_t>(((_loadedTrackDesign->maxSpeed << 16) * 9) >> 18);
|
||||
ft.Add<uint16_t>(((_loadedTrackDesign->statistics.maxSpeed << 16) * 9) >> 18);
|
||||
DrawTextBasic(dpi, screenPos, STR_MAX_SPEED, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
|
||||
// Average speed
|
||||
ft = Formatter();
|
||||
ft.Add<uint16_t>(((_loadedTrackDesign->averageSpeed << 16) * 9) >> 18);
|
||||
ft.Add<uint16_t>(((_loadedTrackDesign->statistics.averageSpeed << 16) * 9) >> 18);
|
||||
DrawTextBasic(dpi, screenPos, STR_AVERAGE_SPEED, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
@@ -590,7 +590,7 @@ static Widget _trackListWidgets[] = {
|
||||
// Ride length
|
||||
ft = Formatter();
|
||||
ft.Add<StringId>(STR_RIDE_LENGTH_ENTRY);
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->rideLength);
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->statistics.rideLength);
|
||||
DrawTextEllipsised(dpi, screenPos, 214, STR_TRACK_LIST_RIDE_LENGTH, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
@@ -599,27 +599,27 @@ static Widget _trackListWidgets[] = {
|
||||
{
|
||||
// Maximum positive vertical Gs
|
||||
ft = Formatter();
|
||||
ft.Add<int32_t>(_loadedTrackDesign->maxPositiveVerticalG * 32);
|
||||
ft.Add<int32_t>(_loadedTrackDesign->statistics.maxPositiveVerticalG * 32);
|
||||
DrawTextBasic(dpi, screenPos, STR_MAX_POSITIVE_VERTICAL_G, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
|
||||
// Maximum negative vertical Gs
|
||||
ft = Formatter();
|
||||
ft.Add<int32_t>(_loadedTrackDesign->maxNegativeVerticalG * 32);
|
||||
ft.Add<int32_t>(_loadedTrackDesign->statistics.maxNegativeVerticalG * 32);
|
||||
DrawTextBasic(dpi, screenPos, STR_MAX_NEGATIVE_VERTICAL_G, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
|
||||
// Maximum lateral Gs
|
||||
ft = Formatter();
|
||||
ft.Add<int32_t>(_loadedTrackDesign->maxLateralG * 32);
|
||||
ft.Add<int32_t>(_loadedTrackDesign->statistics.maxLateralG * 32);
|
||||
DrawTextBasic(dpi, screenPos, STR_MAX_LATERAL_G, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
|
||||
if (_loadedTrackDesign->totalAirTime != 0)
|
||||
if (_loadedTrackDesign->statistics.totalAirTime != 0)
|
||||
{
|
||||
// Total air time
|
||||
ft = Formatter();
|
||||
ft.Add<int32_t>(_loadedTrackDesign->totalAirTime * 25);
|
||||
ft.Add<int32_t>(_loadedTrackDesign->statistics.totalAirTime * 25);
|
||||
DrawTextBasic(dpi, screenPos, STR_TOTAL_AIR_TIME, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
@@ -629,20 +629,20 @@ static Widget _trackListWidgets[] = {
|
||||
{
|
||||
// Drops
|
||||
ft = Formatter();
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->drops & 0x3F);
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->statistics.drops & 0x3F);
|
||||
DrawTextBasic(dpi, screenPos, STR_DROPS, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
|
||||
// Drop height is multiplied by 0.75
|
||||
ft = Formatter();
|
||||
ft.Add<uint16_t>((_loadedTrackDesign->highestDropHeight * 3) / 4);
|
||||
ft.Add<uint16_t>((_loadedTrackDesign->statistics.highestDropHeight * 3) / 4);
|
||||
DrawTextBasic(dpi, screenPos, STR_HIGHEST_DROP_HEIGHT, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
|
||||
if (_loadedTrackDesign->type != RIDE_TYPE_MINI_GOLF)
|
||||
{
|
||||
uint16_t inversions = _loadedTrackDesign->inversions & 0x1F;
|
||||
uint16_t inversions = _loadedTrackDesign->statistics.inversions & 0x1F;
|
||||
if (inversions != 0)
|
||||
{
|
||||
ft = Formatter();
|
||||
@@ -655,12 +655,12 @@ static Widget _trackListWidgets[] = {
|
||||
screenPos.y += 4;
|
||||
}
|
||||
|
||||
if (_loadedTrackDesign->spaceRequiredX != 0xFF)
|
||||
if (!_loadedTrackDesign->statistics.spaceRequired.IsNull())
|
||||
{
|
||||
// Space required
|
||||
ft = Formatter();
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->spaceRequiredX);
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->spaceRequiredY);
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->statistics.spaceRequired.x);
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->statistics.spaceRequired.y);
|
||||
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_SPACE_REQUIRED, ft);
|
||||
screenPos.y += kListRowHeight;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace OpenRCT2::Limits
|
||||
static_assert(kMaxVehicleColours >= kMaxCarsPerTrain);
|
||||
constexpr uint8_t kMaxCircuitsPerRide = 20;
|
||||
constexpr uint8_t kMaxAwards = RCT12::Limits::kMaxAwards;
|
||||
constexpr uint8_t kNumColourSchemes = RCT12::Limits::kNumColourSchemes;
|
||||
constexpr uint8_t kDowntimeHistorySize = RCT2::Limits::kDowntimeHistorySize;
|
||||
constexpr uint16_t kMaxPeepSpawns = 256;
|
||||
constexpr uint16_t kMaxParkEntrances = 256;
|
||||
|
||||
@@ -128,9 +128,7 @@ GameActions::Result RideSetAppearanceAction::Execute() const
|
||||
RideUpdateVehicleColours(*ride);
|
||||
break;
|
||||
case RideSetAppearanceType::VehicleColourScheme:
|
||||
ride->colour_scheme_type &= ~(
|
||||
RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_TRAIN | RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_CAR);
|
||||
ride->colour_scheme_type |= _value;
|
||||
ride->vehicleColourSettings = static_cast<VehicleColourSettings>(_value);
|
||||
for (uint32_t i = 1; i < std::size(ride->vehicle_colours); i++)
|
||||
{
|
||||
ride->vehicle_colours[i] = ride->vehicle_colours[0];
|
||||
|
||||
@@ -64,7 +64,7 @@ GameActions::Result RideSetColourSchemeAction::Query() const
|
||||
GameActions::Status::InvalidParameters, STR_CANT_SET_COLOUR_SCHEME, STR_INVALID_TRACK_PARAMETERS);
|
||||
}
|
||||
}
|
||||
if (_newColourScheme >= OpenRCT2::Limits::kNumColourSchemes)
|
||||
if (_newColourScheme >= kNumRideColourSchemes)
|
||||
{
|
||||
return GameActions::Result(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_SET_COLOUR_SCHEME, STR_INVALID_COLOUR_SCHEME_PARAMETER);
|
||||
|
||||
@@ -69,7 +69,7 @@ GameActions::Result TrackDesignAction::Query() const
|
||||
auto entryIndex = objManager.GetLoadedObjectEntryIndex(_td.vehicleObject);
|
||||
if (entryIndex == OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
// Force a fallback if the entry is not invented yet a td6 of it is selected,
|
||||
// Force a fallback if the entry is not invented yet a track design of it is selected,
|
||||
// which can happen in select-by-track-type mode
|
||||
if (!RideEntryIsInvented(entryIndex) && !gameState.Cheats.IgnoreResearchStatus)
|
||||
{
|
||||
@@ -224,45 +224,40 @@ GameActions::Result TrackDesignAction::Execute() const
|
||||
GameActions::ExecuteNested(&rideSetVehicleAction);
|
||||
}
|
||||
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::Mode, static_cast<uint8_t>(_td.rideMode), GAME_COMMAND_FLAG_APPLY);
|
||||
SetOperatingSettingNested(
|
||||
ride->id, RideSetSetting::Mode, static_cast<uint8_t>(_td.operation.rideMode), GAME_COMMAND_FLAG_APPLY);
|
||||
auto rideSetVehicleAction2 = RideSetVehicleAction(ride->id, RideSetVehicleType::NumTrains, _td.numberOfTrains);
|
||||
GameActions::ExecuteNested(&rideSetVehicleAction2);
|
||||
|
||||
auto rideSetVehicleAction3 = RideSetVehicleAction(ride->id, RideSetVehicleType::NumCarsPerTrain, _td.numberOfCarsPerTrain);
|
||||
GameActions::ExecuteNested(&rideSetVehicleAction3);
|
||||
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::Departure, _td.departFlags, GAME_COMMAND_FLAG_APPLY);
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::MinWaitingTime, _td.minWaitingTime, GAME_COMMAND_FLAG_APPLY);
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::MaxWaitingTime, _td.maxWaitingTime, GAME_COMMAND_FLAG_APPLY);
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::Operation, _td.operationSetting, GAME_COMMAND_FLAG_APPLY);
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::LiftHillSpeed, _td.liftHillSpeed & 0x1F, GAME_COMMAND_FLAG_APPLY);
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::Departure, _td.operation.departFlags, GAME_COMMAND_FLAG_APPLY);
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::MinWaitingTime, _td.operation.minWaitingTime, GAME_COMMAND_FLAG_APPLY);
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::MaxWaitingTime, _td.operation.maxWaitingTime, GAME_COMMAND_FLAG_APPLY);
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::Operation, _td.operation.operationSetting, GAME_COMMAND_FLAG_APPLY);
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::LiftHillSpeed, _td.operation.liftHillSpeed, GAME_COMMAND_FLAG_APPLY);
|
||||
|
||||
uint8_t num_circuits = _td.numCircuits;
|
||||
if (num_circuits == 0)
|
||||
{
|
||||
num_circuits = 1;
|
||||
}
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::NumCircuits, num_circuits, GAME_COMMAND_FLAG_APPLY);
|
||||
auto numCircuits = std::max<uint8_t>(1, _td.operation.numCircuits);
|
||||
SetOperatingSettingNested(ride->id, RideSetSetting::NumCircuits, numCircuits, GAME_COMMAND_FLAG_APPLY);
|
||||
ride->SetToDefaultInspectionInterval();
|
||||
ride->lifecycle_flags |= RIDE_LIFECYCLE_NOT_CUSTOM_DESIGN;
|
||||
ride->colour_scheme_type = _td.colourScheme;
|
||||
ride->vehicleColourSettings = _td.appearance.vehicleColourSettings;
|
||||
|
||||
ride->entrance_style = objManager.GetLoadedObjectEntryIndex(_td.stationObjectIdentifier);
|
||||
ride->entrance_style = objManager.GetLoadedObjectEntryIndex(_td.appearance.stationObjectIdentifier);
|
||||
if (ride->entrance_style == OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
ride->entrance_style = gameState.LastEntranceStyle;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < Limits::kNumColourSchemes; i++)
|
||||
for (size_t i = 0; i < std::min(std::size(ride->track_colour), std::size(_td.appearance.trackColours)); i++)
|
||||
{
|
||||
ride->track_colour[i].main = _td.trackSpineColour[i];
|
||||
ride->track_colour[i].additional = _td.trackRailColour[i];
|
||||
ride->track_colour[i].supports = _td.trackSupportColour[i];
|
||||
ride->track_colour[i] = _td.appearance.trackColours[i];
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < Limits::kMaxVehicleColours; i++)
|
||||
{
|
||||
ride->vehicle_colours[i] = _td.vehicleColours[i];
|
||||
ride->vehicle_colours[i] = _td.appearance.vehicleColours[i];
|
||||
}
|
||||
|
||||
for (int32_t count = 1; count == 1 || r.Error != GameActions::Status::Ok; ++count)
|
||||
|
||||
@@ -624,7 +624,7 @@ GameActions::Result TrackPlaceAction::Execute() const
|
||||
{
|
||||
trackElement->SetInverted(true);
|
||||
}
|
||||
trackElement->SetColourScheme(_colour);
|
||||
trackElement->SetColourScheme(static_cast<RideColourScheme>(_colour));
|
||||
|
||||
entranceDirections = std::get<0>(ted.SequenceProperties);
|
||||
if (entranceDirections & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)
|
||||
|
||||
@@ -675,26 +675,26 @@ template<> struct DataSerializerTraitsT<TrackDesignTrackElement>
|
||||
{
|
||||
static void encode(OpenRCT2::IStream* stream, const TrackDesignTrackElement& val)
|
||||
{
|
||||
stream->Write(&val.Type);
|
||||
stream->Write(&val.Flags);
|
||||
stream->Write(&val.ColourScheme);
|
||||
stream->Write(&val.StationIndex);
|
||||
stream->Write(&val.BrakeBoosterSpeed);
|
||||
stream->Write(&val.SeatRotation);
|
||||
stream->Write(&val.type);
|
||||
stream->Write(&val.flags);
|
||||
stream->Write(&val.colourScheme);
|
||||
stream->Write(&val.stationIndex);
|
||||
stream->Write(&val.brakeBoosterSpeed);
|
||||
stream->Write(&val.seatRotation);
|
||||
}
|
||||
static void decode(OpenRCT2::IStream* stream, TrackDesignTrackElement& val)
|
||||
{
|
||||
stream->Read(&val.Type);
|
||||
stream->Read(&val.Flags);
|
||||
stream->Read(&val.ColourScheme);
|
||||
stream->Read(&val.StationIndex);
|
||||
stream->Read(&val.BrakeBoosterSpeed);
|
||||
stream->Read(&val.SeatRotation);
|
||||
stream->Read(&val.type);
|
||||
stream->Read(&val.flags);
|
||||
stream->Read(&val.colourScheme);
|
||||
stream->Read(&val.stationIndex);
|
||||
stream->Read(&val.brakeBoosterSpeed);
|
||||
stream->Read(&val.seatRotation);
|
||||
}
|
||||
static void log(OpenRCT2::IStream* stream, const TrackDesignTrackElement& val)
|
||||
{
|
||||
char msg[128] = {};
|
||||
snprintf(msg, sizeof(msg), "TrackDesignTrackElement(type = %d, flags = %d)", val.Type, val.Flags);
|
||||
snprintf(msg, sizeof(msg), "TrackDesignTrackElement(type = %d, flags = %d)", val.type, val.flags);
|
||||
stream->Write(msg, strlen(msg));
|
||||
}
|
||||
};
|
||||
@@ -779,6 +779,29 @@ template<> struct DataSerializerTraitsT<TrackDesignSceneryElement>
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct DataSerializerTraitsT<TrackColour>
|
||||
{
|
||||
static void encode(OpenRCT2::IStream* stream, const TrackColour& val)
|
||||
{
|
||||
stream->Write(&val.main);
|
||||
stream->Write(&val.additional);
|
||||
stream->Write(&val.supports);
|
||||
}
|
||||
static void decode(OpenRCT2::IStream* stream, TrackColour& val)
|
||||
{
|
||||
stream->Read(&val.main);
|
||||
stream->Read(&val.additional);
|
||||
stream->Read(&val.supports);
|
||||
}
|
||||
static void log(OpenRCT2::IStream* stream, const TrackColour& val)
|
||||
{
|
||||
char msg[128] = {};
|
||||
snprintf(
|
||||
msg, sizeof(msg), "TrackColour(main = %d, additional = %d, supports = %d)", val.main, val.additional, val.supports);
|
||||
stream->Write(msg, strlen(msg));
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct DataSerializerTraitsT<VehicleColour>
|
||||
{
|
||||
static void encode(OpenRCT2::IStream* stream, const VehicleColour& val)
|
||||
|
||||
@@ -1322,7 +1322,7 @@ namespace OpenRCT2
|
||||
|
||||
// Colours
|
||||
cs.ReadWrite(ride.entrance_style);
|
||||
cs.ReadWrite(ride.colour_scheme_type);
|
||||
cs.ReadWrite(ride.vehicleColourSettings);
|
||||
cs.ReadWriteArray(ride.track_colour, [&cs](TrackColour& tc) {
|
||||
cs.ReadWrite(tc.main);
|
||||
cs.ReadWrite(tc.additional);
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../world/Park.h"
|
||||
#include "Limits.h"
|
||||
|
||||
enum class VehicleColourSettings : uint8_t;
|
||||
|
||||
namespace RCT1
|
||||
{
|
||||
constexpr uint8_t RCT1ResearchFlagsSeparator = 0xFF;
|
||||
@@ -237,11 +239,11 @@ namespace RCT1
|
||||
*/
|
||||
struct Ride
|
||||
{
|
||||
RideType Type; // 0x000
|
||||
RCT1::VehicleType VehicleType; // 0x001
|
||||
uint16_t LifecycleFlags; // 0x002
|
||||
uint8_t OperatingMode; // 0x004
|
||||
uint8_t ColourScheme; // 0x005
|
||||
RideType Type; // 0x000
|
||||
RCT1::VehicleType VehicleType; // 0x001
|
||||
uint16_t LifecycleFlags; // 0x002
|
||||
uint8_t OperatingMode; // 0x004
|
||||
VehicleColourSettings vehicleColourSettings; // 0x005
|
||||
struct
|
||||
{
|
||||
colour_t Body;
|
||||
|
||||
@@ -1090,7 +1090,7 @@ namespace RCT1
|
||||
void SetRideColourScheme(::Ride* dst, RCT1::Ride* src)
|
||||
{
|
||||
// Colours
|
||||
dst->colour_scheme_type = src->ColourScheme;
|
||||
dst->vehicleColourSettings = src->vehicleColourSettings;
|
||||
if (_gameVersion == FILE_VERSION_RCT1)
|
||||
{
|
||||
dst->track_colour[0].main = RCT1::GetColour(src->TrackPrimaryColour);
|
||||
|
||||
@@ -89,9 +89,9 @@ namespace RCT1
|
||||
|
||||
for (int32_t i = 0; i < Limits::kNumColourSchemes; i++)
|
||||
{
|
||||
td->trackSpineColour[i] = RCT1::GetColour(td4aa.TrackSpineColour[i]);
|
||||
td->trackRailColour[i] = RCT1::GetColour(td4aa.TrackRailColour[i]);
|
||||
td->trackSupportColour[i] = RCT1::GetColour(td4aa.TrackSupportColour[i]);
|
||||
td->appearance.trackColours[i].main = RCT1::GetColour(td4aa.TrackSpineColour[i]);
|
||||
td->appearance.trackColours[i].additional = RCT1::GetColour(td4aa.TrackRailColour[i]);
|
||||
td->appearance.trackColours[i].supports = RCT1::GetColour(td4aa.TrackSupportColour[i]);
|
||||
}
|
||||
|
||||
return ImportTD4Base(std::move(td), td4aa);
|
||||
@@ -102,21 +102,21 @@ namespace RCT1
|
||||
std::unique_ptr<TrackDesign> td = std::make_unique<TrackDesign>();
|
||||
TD4 td4{};
|
||||
_stream.Read(&td4, sizeof(TD4));
|
||||
for (int32_t i = 0; i < OpenRCT2::Limits::kNumColourSchemes; i++)
|
||||
for (size_t i = 0; i < std::size(td->appearance.trackColours); i++)
|
||||
{
|
||||
td->trackSpineColour[i] = RCT1::GetColour(td4.TrackSpineColourV0);
|
||||
td->trackRailColour[i] = RCT1::GetColour(td4.TrackRailColourV0);
|
||||
td->trackSupportColour[i] = RCT1::GetColour(td4.TrackSupportColourV0);
|
||||
td->appearance.trackColours[i].main = RCT1::GetColour(td4.TrackSpineColourV0);
|
||||
td->appearance.trackColours[i].additional = RCT1::GetColour(td4.TrackRailColourV0);
|
||||
td->appearance.trackColours[i].supports = RCT1::GetColour(td4.TrackSupportColourV0);
|
||||
|
||||
// Mazes were only hedges
|
||||
if (td4.Type == RideType::HedgeMaze)
|
||||
{
|
||||
td->trackSupportColour[i] = MAZE_WALL_TYPE_HEDGE;
|
||||
td->appearance.trackColours[i].supports = MAZE_WALL_TYPE_HEDGE;
|
||||
}
|
||||
else if (td4.Type == RideType::RiverRapids)
|
||||
{
|
||||
td->trackSpineColour[i] = COLOUR_WHITE;
|
||||
td->trackRailColour[i] = COLOUR_WHITE;
|
||||
td->appearance.trackColours[i].main = COLOUR_WHITE;
|
||||
td->appearance.trackColours[i].additional = COLOUR_WHITE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,10 +128,10 @@ namespace RCT1
|
||||
td->type = RCT1::GetRideType(td4Base.Type, td4Base.VehicleType);
|
||||
|
||||
// All TD4s that use powered launch use the type that doesn't pass the station.
|
||||
td->rideMode = static_cast<RideMode>(td4Base.Mode);
|
||||
td->operation.rideMode = static_cast<RideMode>(td4Base.Mode);
|
||||
if (td4Base.Mode == RCT1_RIDE_MODE_POWERED_LAUNCH)
|
||||
{
|
||||
td->rideMode = RideMode::PoweredLaunch;
|
||||
td->operation.rideMode = RideMode::PoweredLaunch;
|
||||
}
|
||||
|
||||
std::string_view vehicleObject;
|
||||
@@ -145,9 +145,7 @@ namespace RCT1
|
||||
}
|
||||
assert(!vehicleObject.empty());
|
||||
td->vehicleObject = ObjectEntryDescriptor(vehicleObject);
|
||||
td->vehicleType = EnumValue(td4Base.VehicleType);
|
||||
|
||||
td->colourScheme = td4Base.VersionAndColourScheme & 0x3;
|
||||
td->appearance.vehicleColourSettings = static_cast<VehicleColourSettings>(td4Base.VersionAndColourScheme & 0x3);
|
||||
|
||||
// Vehicle colours
|
||||
for (int32_t i = 0; i < Limits::kMaxTrainsPerRide; i++)
|
||||
@@ -157,84 +155,84 @@ namespace RCT1
|
||||
td4Base.VehicleType);
|
||||
if (colourSchemeCopyDescriptor.colour1 == COPY_COLOUR_1)
|
||||
{
|
||||
td->vehicleColours[i].Body = RCT1::GetColour(td4Base.VehicleColours[i].BodyColour);
|
||||
td->appearance.vehicleColours[i].Body = RCT1::GetColour(td4Base.VehicleColours[i].BodyColour);
|
||||
}
|
||||
else if (colourSchemeCopyDescriptor.colour1 == COPY_COLOUR_2)
|
||||
{
|
||||
td->vehicleColours[i].Body = RCT1::GetColour(td4Base.VehicleColours[i].TrimColour);
|
||||
td->appearance.vehicleColours[i].Body = RCT1::GetColour(td4Base.VehicleColours[i].TrimColour);
|
||||
}
|
||||
else
|
||||
{
|
||||
td->vehicleColours[i].Body = colourSchemeCopyDescriptor.colour1;
|
||||
td->appearance.vehicleColours[i].Body = colourSchemeCopyDescriptor.colour1;
|
||||
}
|
||||
|
||||
if (colourSchemeCopyDescriptor.colour2 == COPY_COLOUR_1)
|
||||
{
|
||||
td->vehicleColours[i].Trim = RCT1::GetColour(td4Base.VehicleColours[i].BodyColour);
|
||||
td->appearance.vehicleColours[i].Trim = RCT1::GetColour(td4Base.VehicleColours[i].BodyColour);
|
||||
}
|
||||
else if (colourSchemeCopyDescriptor.colour2 == COPY_COLOUR_2)
|
||||
{
|
||||
td->vehicleColours[i].Trim = RCT1::GetColour(td4Base.VehicleColours[i].TrimColour);
|
||||
td->appearance.vehicleColours[i].Trim = RCT1::GetColour(td4Base.VehicleColours[i].TrimColour);
|
||||
}
|
||||
else
|
||||
{
|
||||
td->vehicleColours[i].Trim = colourSchemeCopyDescriptor.colour2;
|
||||
td->appearance.vehicleColours[i].Trim = colourSchemeCopyDescriptor.colour2;
|
||||
}
|
||||
|
||||
if (colourSchemeCopyDescriptor.colour3 == COPY_COLOUR_1)
|
||||
{
|
||||
td->vehicleColours[i].Tertiary = RCT1::GetColour(td4Base.VehicleColours[i].BodyColour);
|
||||
td->appearance.vehicleColours[i].Tertiary = RCT1::GetColour(td4Base.VehicleColours[i].BodyColour);
|
||||
}
|
||||
else if (colourSchemeCopyDescriptor.colour3 == COPY_COLOUR_2)
|
||||
{
|
||||
td->vehicleColours[i].Tertiary = RCT1::GetColour(td4Base.VehicleColours[i].TrimColour);
|
||||
td->appearance.vehicleColours[i].Tertiary = RCT1::GetColour(td4Base.VehicleColours[i].TrimColour);
|
||||
}
|
||||
else
|
||||
{
|
||||
td->vehicleColours[i].Tertiary = colourSchemeCopyDescriptor.colour3;
|
||||
td->appearance.vehicleColours[i].Tertiary = colourSchemeCopyDescriptor.colour3;
|
||||
}
|
||||
}
|
||||
// Set remaining vehicles to same colour as first vehicle
|
||||
for (size_t i = Limits::kMaxTrainsPerRide; i < std::size(td->vehicleColours); i++)
|
||||
for (size_t i = Limits::kMaxTrainsPerRide; i < std::size(td->appearance.vehicleColours); i++)
|
||||
{
|
||||
td->vehicleColours[i] = td->vehicleColours[0];
|
||||
td->appearance.vehicleColours[i] = td->appearance.vehicleColours[0];
|
||||
}
|
||||
|
||||
td->stationObjectIdentifier = GetStationIdentifierFromStyle(RCT12_STATION_STYLE_PLAIN);
|
||||
td->departFlags = td4Base.DepartFlags;
|
||||
td->appearance.stationObjectIdentifier = GetStationIdentifierFromStyle(RCT12_STATION_STYLE_PLAIN);
|
||||
td->operation.departFlags = td4Base.DepartFlags;
|
||||
td->numberOfTrains = td4Base.NumberOfTrains;
|
||||
td->numberOfCarsPerTrain = td4Base.NumberOfCarsPerTrain;
|
||||
td->minWaitingTime = td4Base.MinWaitingTime;
|
||||
td->maxWaitingTime = td4Base.MaxWaitingTime;
|
||||
td->operationSetting = std::min(
|
||||
td->operation.minWaitingTime = td4Base.MinWaitingTime;
|
||||
td->operation.maxWaitingTime = td4Base.MaxWaitingTime;
|
||||
td->operation.operationSetting = std::min(
|
||||
td4Base.OperationSetting, GetRideTypeDescriptor(td->type).OperatingSettings.MaxValue);
|
||||
td->maxSpeed = td4Base.MaxSpeed;
|
||||
td->averageSpeed = td4Base.AverageSpeed;
|
||||
td->rideLength = td4Base.RideLength;
|
||||
td->maxPositiveVerticalG = td4Base.MaxPositiveVerticalG;
|
||||
td->maxNegativeVerticalG = td4Base.MaxNegativeVerticalG;
|
||||
td->maxLateralG = td4Base.MaxLateralG;
|
||||
td->statistics.maxSpeed = td4Base.MaxSpeed;
|
||||
td->statistics.averageSpeed = td4Base.AverageSpeed;
|
||||
td->statistics.rideLength = td4Base.RideLength;
|
||||
td->statistics.maxPositiveVerticalG = td4Base.MaxPositiveVerticalG;
|
||||
td->statistics.maxNegativeVerticalG = td4Base.MaxNegativeVerticalG;
|
||||
td->statistics.maxLateralG = td4Base.MaxLateralG;
|
||||
|
||||
if (td->type == RIDE_TYPE_MINI_GOLF)
|
||||
{
|
||||
td->holes = td4Base.NumHoles;
|
||||
td->statistics.holes = td4Base.NumHoles;
|
||||
}
|
||||
else
|
||||
{
|
||||
td->inversions = td4Base.NumInversions;
|
||||
td->statistics.inversions = td4Base.NumInversions;
|
||||
}
|
||||
|
||||
td->drops = td4Base.NumDrops;
|
||||
td->highestDropHeight = td4Base.HighestDropHeight / 2;
|
||||
td->excitement = td4Base.Excitement;
|
||||
td->intensity = td4Base.Intensity;
|
||||
td->nausea = td4Base.Nausea;
|
||||
td->upkeepCost = ToMoney64(td4Base.UpkeepCost);
|
||||
td->spaceRequiredX = 255;
|
||||
td->spaceRequiredY = 255;
|
||||
td->liftHillSpeed = 5;
|
||||
td->numCircuits = 0;
|
||||
td->operationSetting = std::min(td->operationSetting, GetRideTypeDescriptor(td->type).OperatingSettings.MaxValue);
|
||||
td->statistics.drops = td4Base.NumDrops;
|
||||
td->statistics.highestDropHeight = td4Base.HighestDropHeight / 2;
|
||||
td->statistics.excitement = td4Base.Excitement;
|
||||
td->statistics.intensity = td4Base.Intensity;
|
||||
td->statistics.nausea = td4Base.Nausea;
|
||||
td->statistics.upkeepCost = ToMoney64(td4Base.UpkeepCost);
|
||||
td->statistics.spaceRequired.SetNull();
|
||||
td->operation.liftHillSpeed = 5;
|
||||
td->operation.numCircuits = 0;
|
||||
td->operation.operationSetting = std::min(
|
||||
td->operation.operationSetting, GetRideTypeDescriptor(td->type).OperatingSettings.MaxValue);
|
||||
|
||||
const auto& rtd = GetRideTypeDescriptor(td->type);
|
||||
if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
@@ -258,7 +256,7 @@ namespace RCT1
|
||||
_stream.SetPosition(_stream.GetPosition() - 1);
|
||||
_stream.Read(&t4TrackElement, sizeof(TD46TrackElement));
|
||||
TrackDesignTrackElement trackElement{};
|
||||
trackElement.Type = RCT1TrackTypeToOpenRCT2(t4TrackElement.Type, td->type);
|
||||
trackElement.type = RCT1TrackTypeToOpenRCT2(t4TrackElement.Type, td->type);
|
||||
ConvertFromTD46Flags(trackElement, t4TrackElement.Flags);
|
||||
td->trackElements.push_back(trackElement);
|
||||
}
|
||||
|
||||
@@ -216,9 +216,9 @@ uint8_t RCT12TrackElement::GetRideIndex() const
|
||||
return RideIndex;
|
||||
}
|
||||
|
||||
uint8_t RCT12TrackElement::GetColourScheme() const
|
||||
RideColourScheme RCT12TrackElement::GetColourScheme() const
|
||||
{
|
||||
return Colour & 0x3;
|
||||
return static_cast<RideColourScheme>(Colour & 0x3);
|
||||
}
|
||||
|
||||
uint8_t RCT12TrackElement::GetStationIndex() const
|
||||
@@ -882,53 +882,53 @@ ResearchItem RCT12ResearchItem::ToResearchItem() const
|
||||
|
||||
void ConvertFromTD46Flags(TrackDesignTrackElement& target, uint8_t flags)
|
||||
{
|
||||
target.BrakeBoosterSpeed = kRCT2DefaultBlockBrakeSpeed;
|
||||
if (TrackTypeIsStation(target.Type))
|
||||
target.brakeBoosterSpeed = kRCT2DefaultBlockBrakeSpeed;
|
||||
if (TrackTypeIsStation(target.type))
|
||||
{
|
||||
auto stationIndex = flags & EnumValue(TD46Flags::StationId);
|
||||
target.StationIndex = StationIndex::FromUnderlying(stationIndex);
|
||||
target.stationIndex = StationIndex::FromUnderlying(stationIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto speedOrSeatRotation = flags & EnumValue(TD46Flags::SpeedOrSeatRotation);
|
||||
if (TrackTypeHasSpeedSetting(target.Type) && target.Type != TrackElemType::BlockBrakes)
|
||||
if (TrackTypeHasSpeedSetting(target.type) && target.type != TrackElemType::BlockBrakes)
|
||||
{
|
||||
target.BrakeBoosterSpeed = speedOrSeatRotation << 1;
|
||||
target.brakeBoosterSpeed = speedOrSeatRotation << 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
target.SeatRotation = speedOrSeatRotation;
|
||||
target.seatRotation = speedOrSeatRotation;
|
||||
}
|
||||
}
|
||||
|
||||
target.ColourScheme = (flags & EnumValue(TD46Flags::ColourScheme)) >> 4;
|
||||
target.colourScheme = (flags & EnumValue(TD46Flags::ColourScheme)) >> 4;
|
||||
if (flags & EnumValue(TD46Flags::IsInverted))
|
||||
target.SetFlag(TrackDesignTrackElementFlag::IsInverted);
|
||||
target.SetFlag(TrackDesignTrackElementFlag::isInverted);
|
||||
if (flags & EnumValue(TD46Flags::HasChain))
|
||||
target.SetFlag(TrackDesignTrackElementFlag::HasChain);
|
||||
target.SetFlag(TrackDesignTrackElementFlag::hasChain);
|
||||
}
|
||||
|
||||
uint8_t ConvertToTD46Flags(const TrackDesignTrackElement& source)
|
||||
{
|
||||
uint8_t trackFlags = 0;
|
||||
if (TrackTypeIsStation(source.Type))
|
||||
if (TrackTypeIsStation(source.type))
|
||||
{
|
||||
trackFlags = (source.StationIndex.ToUnderlying() & EnumValue(TD46Flags::StationId));
|
||||
trackFlags = (source.stationIndex.ToUnderlying() & EnumValue(TD46Flags::StationId));
|
||||
}
|
||||
else if (TrackTypeHasSpeedSetting(source.Type) && source.Type != TrackElemType::BlockBrakes)
|
||||
else if (TrackTypeHasSpeedSetting(source.type) && source.type != TrackElemType::BlockBrakes)
|
||||
{
|
||||
trackFlags = (source.BrakeBoosterSpeed >> 1);
|
||||
trackFlags = (source.brakeBoosterSpeed >> 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
trackFlags = source.SeatRotation;
|
||||
trackFlags = source.seatRotation;
|
||||
}
|
||||
|
||||
trackFlags |= source.ColourScheme << 4;
|
||||
trackFlags |= source.colourScheme << 4;
|
||||
|
||||
if (source.HasFlag(TrackDesignTrackElementFlag::HasChain))
|
||||
if (source.HasFlag(TrackDesignTrackElementFlag::hasChain))
|
||||
trackFlags |= EnumValue(TD46Flags::HasChain);
|
||||
if (source.HasFlag(TrackDesignTrackElementFlag::IsInverted))
|
||||
if (source.HasFlag(TrackDesignTrackElementFlag::isInverted))
|
||||
trackFlags |= EnumValue(TD46Flags::IsInverted);
|
||||
|
||||
return trackFlags;
|
||||
|
||||
@@ -76,6 +76,7 @@ constexpr uint8_t RCT12ParkHistoryUndefined = std::numeric_limits<uint8_t>::max(
|
||||
|
||||
struct TrackDesign;
|
||||
struct TrackDesignTrackElement;
|
||||
enum class RideColourScheme : uint8_t;
|
||||
|
||||
enum class RCT12TrackDesignVersion : uint8_t
|
||||
{
|
||||
@@ -527,7 +528,7 @@ public:
|
||||
uint8_t GetTrackType() const;
|
||||
uint8_t GetSequenceIndex() const;
|
||||
uint8_t GetRideIndex() const;
|
||||
uint8_t GetColourScheme() const;
|
||||
RideColourScheme GetColourScheme() const;
|
||||
uint8_t GetStationIndex() const;
|
||||
bool HasChain() const;
|
||||
bool HasCableLift() const;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
struct RideObjectEntry;
|
||||
class ObjectList;
|
||||
enum class EditorStep : uint8_t;
|
||||
enum class VehicleColourSettings : uint8_t;
|
||||
|
||||
namespace RCT2
|
||||
{
|
||||
@@ -77,7 +78,7 @@ namespace RCT2
|
||||
RCT12ObjectEntryIndex Subtype; // 0x001
|
||||
uint16_t Pad002; // 0x002
|
||||
uint8_t Mode; // 0x004
|
||||
uint8_t ColourSchemeType; // 0x005
|
||||
VehicleColourSettings vehicleColourSettings; // 0x005
|
||||
RCT12VehicleColour VehicleColours[Limits::kMaxVehicleColours]; // 0x006
|
||||
uint8_t Pad046[0x03]; // 0x046, Used to be track colours in RCT1 without expansions
|
||||
// 0 = closed, 1 = open, 2 = test
|
||||
|
||||
@@ -1316,7 +1316,7 @@ namespace RCT2
|
||||
dst->subtype = subtype;
|
||||
// Pad002;
|
||||
dst->mode = static_cast<RideMode>(src->Mode);
|
||||
dst->colour_scheme_type = src->ColourSchemeType;
|
||||
dst->vehicleColourSettings = src->vehicleColourSettings;
|
||||
|
||||
for (uint8_t i = 0; i < Limits::kMaxVehicleColours; i++)
|
||||
{
|
||||
|
||||
@@ -53,51 +53,60 @@ namespace RCT2
|
||||
{
|
||||
OpenRCT2::MemoryStream tempStream;
|
||||
tempStream.WriteValue<uint8_t>(OpenRCT2RideTypeToRCT2RideType(_trackDesign->type));
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->vehicleType);
|
||||
tempStream.WriteValue<uint8_t>(0);
|
||||
tempStream.WriteValue<uint32_t>(0);
|
||||
tempStream.WriteValue<uint8_t>(static_cast<uint8_t>(_trackDesign->rideMode));
|
||||
tempStream.WriteValue<uint8_t>((_trackDesign->colourScheme & 0x3) | (2 << 2));
|
||||
tempStream.WriteValue<uint8_t>(static_cast<uint8_t>(_trackDesign->operation.rideMode));
|
||||
tempStream.WriteValue<uint8_t>(EnumValue(_trackDesign->appearance.vehicleColourSettings) | (2 << 2));
|
||||
for (auto i = 0; i < RCT2::Limits::kMaxVehicleColours; i++)
|
||||
{
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->vehicleColours[i].Body);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->vehicleColours[i].Trim);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->appearance.vehicleColours[i].Body);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->appearance.vehicleColours[i].Trim);
|
||||
}
|
||||
tempStream.WriteValue<uint8_t>(0);
|
||||
auto entranceStyle = GetStationStyleFromIdentifier(_trackDesign->stationObjectIdentifier);
|
||||
auto entranceStyle = GetStationStyleFromIdentifier(_trackDesign->appearance.stationObjectIdentifier);
|
||||
tempStream.WriteValue<uint8_t>(entranceStyle);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->totalAirTime);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->departFlags);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->statistics.totalAirTime);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->operation.departFlags);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->numberOfTrains);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->numberOfCarsPerTrain);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->minWaitingTime);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->maxWaitingTime);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->operationSetting);
|
||||
tempStream.WriteValue<int8_t>(_trackDesign->maxSpeed);
|
||||
tempStream.WriteValue<int8_t>(_trackDesign->averageSpeed);
|
||||
tempStream.WriteValue<uint16_t>(_trackDesign->rideLength);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->maxPositiveVerticalG);
|
||||
tempStream.WriteValue<int8_t>(_trackDesign->maxNegativeVerticalG);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->maxLateralG);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->operation.minWaitingTime);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->operation.maxWaitingTime);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->operation.operationSetting);
|
||||
tempStream.WriteValue<int8_t>(_trackDesign->statistics.maxSpeed);
|
||||
tempStream.WriteValue<int8_t>(_trackDesign->statistics.averageSpeed);
|
||||
tempStream.WriteValue<uint16_t>(_trackDesign->statistics.rideLength);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->statistics.maxPositiveVerticalG);
|
||||
tempStream.WriteValue<int8_t>(_trackDesign->statistics.maxNegativeVerticalG);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->statistics.maxLateralG);
|
||||
tempStream.WriteValue<uint8_t>(
|
||||
_trackDesign->type == RIDE_TYPE_MINI_GOLF ? _trackDesign->holes : _trackDesign->inversions);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->drops);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->highestDropHeight);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->excitement);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->intensity);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->nausea);
|
||||
tempStream.WriteValue<money16>(ToMoney16(_trackDesign->upkeepCost));
|
||||
tempStream.WriteArray(_trackDesign->trackSpineColour, Limits::kNumColourSchemes);
|
||||
tempStream.WriteArray(_trackDesign->trackRailColour, Limits::kNumColourSchemes);
|
||||
tempStream.WriteArray(_trackDesign->trackSupportColour, Limits::kNumColourSchemes);
|
||||
_trackDesign->type == RIDE_TYPE_MINI_GOLF ? _trackDesign->statistics.holes : _trackDesign->statistics.inversions);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->statistics.drops);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->statistics.highestDropHeight);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->statistics.excitement);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->statistics.intensity);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->statistics.nausea);
|
||||
tempStream.WriteValue<money16>(ToMoney16(_trackDesign->statistics.upkeepCost));
|
||||
for (auto i = 0; i < Limits::kNumColourSchemes; i++)
|
||||
{
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->appearance.trackColours[i].main);
|
||||
}
|
||||
for (auto i = 0; i < Limits::kNumColourSchemes; i++)
|
||||
{
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->appearance.trackColours[i].additional);
|
||||
}
|
||||
for (auto i = 0; i < Limits::kNumColourSchemes; i++)
|
||||
{
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->appearance.trackColours[i].supports);
|
||||
}
|
||||
tempStream.WriteValue<uint32_t>(0);
|
||||
tempStream.Write(&_trackDesign->vehicleObject.Entry, sizeof(RCTObjectEntry));
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->spaceRequiredX);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->spaceRequiredY);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->statistics.spaceRequired.x);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->statistics.spaceRequired.y);
|
||||
for (auto i = 0; i < RCT2::Limits::kMaxVehicleColours; i++)
|
||||
{
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->vehicleColours[i].Tertiary);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->appearance.vehicleColours[i].Tertiary);
|
||||
}
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->liftHillSpeed | (_trackDesign->numCircuits << 5));
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->operation.liftHillSpeed | (_trackDesign->operation.numCircuits << 5));
|
||||
|
||||
const auto& rtd = GetRideTypeDescriptor(_trackDesign->type);
|
||||
if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
@@ -124,7 +133,7 @@ namespace RCT2
|
||||
{
|
||||
for (const auto& trackElement : _trackDesign->trackElements)
|
||||
{
|
||||
auto trackType = OpenRCT2TrackTypeToRCT2(trackElement.Type);
|
||||
auto trackType = OpenRCT2TrackTypeToRCT2(trackElement.type);
|
||||
if (trackType == TrackElemType::MultiDimInvertedUp90ToFlatQuarterLoop)
|
||||
{
|
||||
trackType = TrackElemType::InvertedUp90ToFlatQuarterLoopAlias;
|
||||
|
||||
@@ -72,59 +72,57 @@ namespace RCT2
|
||||
_stream.Read(&td6, 0xA3);
|
||||
|
||||
td->type = td6.Type; // 0x00
|
||||
td->vehicleType = td6.VehicleType;
|
||||
|
||||
td->cost = 0.00_GBP;
|
||||
td->rideMode = static_cast<RideMode>(td6.RideMode);
|
||||
td->operation.rideMode = static_cast<RideMode>(td6.RideMode);
|
||||
td->trackFlags = 0;
|
||||
td->colourScheme = td6.VersionAndColourScheme & 0x3;
|
||||
td->appearance.vehicleColourSettings = static_cast<VehicleColourSettings>(td6.VersionAndColourScheme & 0x3);
|
||||
for (auto i = 0; i < Limits::kMaxVehicleColours; ++i)
|
||||
{
|
||||
td->vehicleColours[i].Body = td6.VehicleColours[i].BodyColour;
|
||||
td->vehicleColours[i].Trim = td6.VehicleColours[i].TrimColour;
|
||||
td->vehicleColours[i].Tertiary = td6.VehicleAdditionalColour[i];
|
||||
td->appearance.vehicleColours[i].Body = td6.VehicleColours[i].BodyColour;
|
||||
td->appearance.vehicleColours[i].Trim = td6.VehicleColours[i].TrimColour;
|
||||
td->appearance.vehicleColours[i].Tertiary = td6.VehicleAdditionalColour[i];
|
||||
}
|
||||
td->stationObjectIdentifier = GetStationIdentifierFromStyle(td6.EntranceStyle);
|
||||
td->totalAirTime = td6.TotalAirTime;
|
||||
td->departFlags = td6.DepartFlags;
|
||||
td->appearance.stationObjectIdentifier = GetStationIdentifierFromStyle(td6.EntranceStyle);
|
||||
td->statistics.totalAirTime = td6.TotalAirTime;
|
||||
td->operation.departFlags = td6.DepartFlags;
|
||||
td->numberOfTrains = td6.NumberOfTrains;
|
||||
td->numberOfCarsPerTrain = td6.NumberOfCarsPerTrain;
|
||||
td->minWaitingTime = td6.MinWaitingTime;
|
||||
td->maxWaitingTime = td6.MaxWaitingTime;
|
||||
td->operationSetting = td6.OperationSetting;
|
||||
td->maxSpeed = td6.MaxSpeed;
|
||||
td->averageSpeed = td6.AverageSpeed;
|
||||
td->rideLength = td6.RideLength;
|
||||
td->maxPositiveVerticalG = td6.MaxPositiveVerticalG;
|
||||
td->maxNegativeVerticalG = td6.MaxNegativeVerticalG;
|
||||
td->maxLateralG = td6.MaxLateralG;
|
||||
td->operation.minWaitingTime = td6.MinWaitingTime;
|
||||
td->operation.maxWaitingTime = td6.MaxWaitingTime;
|
||||
td->operation.operationSetting = td6.OperationSetting;
|
||||
td->statistics.maxSpeed = td6.MaxSpeed;
|
||||
td->statistics.averageSpeed = td6.AverageSpeed;
|
||||
td->statistics.rideLength = td6.RideLength;
|
||||
td->statistics.maxPositiveVerticalG = td6.MaxPositiveVerticalG;
|
||||
td->statistics.maxNegativeVerticalG = td6.MaxNegativeVerticalG;
|
||||
td->statistics.maxLateralG = td6.MaxLateralG;
|
||||
|
||||
if (td->type == RIDE_TYPE_MINI_GOLF)
|
||||
{
|
||||
td->holes = td6.Holes;
|
||||
td->statistics.holes = td6.Holes;
|
||||
}
|
||||
else
|
||||
{
|
||||
td->inversions = td6.Inversions;
|
||||
td->statistics.inversions = td6.Inversions;
|
||||
}
|
||||
|
||||
td->drops = td6.Drops;
|
||||
td->highestDropHeight = td6.HighestDropHeight;
|
||||
td->excitement = td6.Excitement;
|
||||
td->intensity = td6.Intensity;
|
||||
td->nausea = td6.Nausea;
|
||||
td->upkeepCost = ToMoney64(td6.UpkeepCost);
|
||||
td->statistics.drops = td6.Drops;
|
||||
td->statistics.highestDropHeight = td6.HighestDropHeight;
|
||||
td->statistics.excitement = td6.Excitement;
|
||||
td->statistics.intensity = td6.Intensity;
|
||||
td->statistics.nausea = td6.Nausea;
|
||||
td->statistics.upkeepCost = ToMoney64(td6.UpkeepCost);
|
||||
for (auto i = 0; i < Limits::kNumColourSchemes; ++i)
|
||||
{
|
||||
td->trackSpineColour[i] = td6.TrackSpineColour[i];
|
||||
td->trackRailColour[i] = td6.TrackRailColour[i];
|
||||
td->trackSupportColour[i] = td6.TrackSupportColour[i];
|
||||
td->appearance.trackColours[i].main = td6.TrackSpineColour[i];
|
||||
td->appearance.trackColours[i].additional = td6.TrackRailColour[i];
|
||||
td->appearance.trackColours[i].supports = td6.TrackSupportColour[i];
|
||||
}
|
||||
td->vehicleObject = ObjectEntryDescriptor(td6.VehicleObject);
|
||||
td->spaceRequiredX = td6.SpaceRequiredX;
|
||||
td->spaceRequiredY = td6.SpaceRequiredY;
|
||||
td->liftHillSpeed = td6.LiftHillSpeedNumCircuits & 0b00011111;
|
||||
td->numCircuits = td6.LiftHillSpeedNumCircuits >> 5;
|
||||
td->statistics.spaceRequired = { td6.SpaceRequiredX, td6.SpaceRequiredY };
|
||||
td->operation.liftHillSpeed = td6.LiftHillSpeedNumCircuits & 0b00011111;
|
||||
td->operation.numCircuits = td6.LiftHillSpeedNumCircuits >> 5;
|
||||
|
||||
auto version = static_cast<RCT12TrackDesignVersion>((td6.VersionAndColourScheme >> 2) & 3);
|
||||
if (version != RCT12TrackDesignVersion::TD6)
|
||||
@@ -133,7 +131,8 @@ namespace RCT2
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
td->operationSetting = std::min(td->operationSetting, GetRideTypeDescriptor(td->type).OperatingSettings.MaxValue);
|
||||
td->operation.operationSetting = std::min(
|
||||
td->operation.operationSetting, GetRideTypeDescriptor(td->type).OperatingSettings.MaxValue);
|
||||
|
||||
const auto& rtd = GetRideTypeDescriptor(td->type);
|
||||
if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
@@ -164,7 +163,7 @@ namespace RCT2
|
||||
trackType = TrackElemType::MultiDimInvertedUp90ToFlatQuarterLoop;
|
||||
}
|
||||
|
||||
trackElement.Type = trackType;
|
||||
trackElement.type = trackType;
|
||||
ConvertFromTD46Flags(trackElement, t6TrackElement.Flags);
|
||||
td->trackElements.push_back(trackElement);
|
||||
}
|
||||
|
||||
@@ -2255,12 +2255,12 @@ void RideSetVehicleColoursToRandomPreset(Ride& ride, uint8_t preset_index)
|
||||
{
|
||||
assert(preset_index < presetList->count);
|
||||
|
||||
ride.colour_scheme_type = RIDE_COLOUR_SCHEME_MODE_ALL_SAME;
|
||||
ride.vehicleColourSettings = VehicleColourSettings::same;
|
||||
ride.vehicle_colours[0] = presetList->list[preset_index];
|
||||
}
|
||||
else
|
||||
{
|
||||
ride.colour_scheme_type = RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_TRAIN;
|
||||
ride.vehicleColourSettings = VehicleColourSettings::perTrain;
|
||||
for (uint32_t i = 0; i < presetList->count; i++)
|
||||
{
|
||||
const auto index = i % 32U;
|
||||
@@ -4318,13 +4318,13 @@ void Ride::SetColourPreset(uint8_t index)
|
||||
{
|
||||
colours = colourPresets->list[index];
|
||||
}
|
||||
for (int32_t i = 0; i < OpenRCT2::Limits::kNumColourSchemes; i++)
|
||||
for (size_t i = 0; i < std::size(track_colour); i++)
|
||||
{
|
||||
track_colour[i].main = colours.main;
|
||||
track_colour[i].additional = colours.additional;
|
||||
track_colour[i].supports = colours.supports;
|
||||
}
|
||||
colour_scheme_type = 0;
|
||||
vehicleColourSettings = VehicleColourSettings::same;
|
||||
}
|
||||
|
||||
money64 RideGetCommonPrice(const Ride& forRide)
|
||||
@@ -4706,15 +4706,15 @@ void RideUpdateVehicleColours(const Ride& ride)
|
||||
for (Vehicle* vehicle = GetEntity<Vehicle>(ride.vehicles[i]); vehicle != nullptr;
|
||||
vehicle = GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
switch (ride.colour_scheme_type & 3)
|
||||
switch (ride.vehicleColourSettings)
|
||||
{
|
||||
case RIDE_COLOUR_SCHEME_MODE_ALL_SAME:
|
||||
case VehicleColourSettings::same:
|
||||
colours = ride.vehicle_colours[0];
|
||||
break;
|
||||
case RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_TRAIN:
|
||||
case VehicleColourSettings::perTrain:
|
||||
colours = ride.vehicle_colours[i];
|
||||
break;
|
||||
case RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_CAR:
|
||||
case VehicleColourSettings::perCar:
|
||||
if (vehicle->HasFlag(VehicleFlags::CarIsReversed))
|
||||
{
|
||||
colours = ride.vehicle_colours[std::min(
|
||||
|
||||
@@ -120,7 +120,7 @@ struct Ride
|
||||
// 0x4c.
|
||||
ObjectEntryIndex subtype{ OBJECT_ENTRY_INDEX_NULL };
|
||||
RideMode mode{};
|
||||
uint8_t colour_scheme_type{};
|
||||
VehicleColourSettings vehicleColourSettings{};
|
||||
VehicleColour vehicle_colours[OpenRCT2::Limits::kMaxVehicleColours]{};
|
||||
// 0 = closed, 1 = open, 2 = test
|
||||
RideStatus status{};
|
||||
@@ -261,7 +261,7 @@ struct Ride
|
||||
uint8_t connected_message_throttle{};
|
||||
money64 income_per_hour{};
|
||||
money64 profit{};
|
||||
TrackColour track_colour[OpenRCT2::Limits::kNumColourSchemes]{};
|
||||
TrackColour track_colour[kNumRideColourSchemes]{};
|
||||
ObjectEntryIndex music{ OBJECT_ENTRY_INDEX_NULL };
|
||||
ObjectEntryIndex entrance_style{ OBJECT_ENTRY_INDEX_NULL };
|
||||
uint16_t vehicle_change_timeout{};
|
||||
@@ -413,8 +413,6 @@ public:
|
||||
bool HasStation() const;
|
||||
|
||||
bool FindTrackGap(const CoordsXYE& input, CoordsXYE* output) const;
|
||||
|
||||
uint8_t GetEntranceStyle() const;
|
||||
};
|
||||
void UpdateSpiralSlide(Ride& ride);
|
||||
void UpdateChairlift(Ride& ride);
|
||||
@@ -672,15 +670,6 @@ enum class RideMode : uint8_t
|
||||
|
||||
RideMode& operator++(RideMode& d, int);
|
||||
|
||||
enum
|
||||
{
|
||||
RIDE_COLOUR_SCHEME_MODE_ALL_SAME,
|
||||
RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_TRAIN,
|
||||
RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_CAR,
|
||||
|
||||
RIDE_COLOUR_SCHEME_MODE_COUNT,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RIDE_CATEGORY_TRANSPORT,
|
||||
@@ -776,23 +765,6 @@ enum
|
||||
WAIT_FOR_LOAD_COUNT,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RIDE_COLOUR_SCHEME_MAIN,
|
||||
RIDE_COLOUR_SCHEME_ADDITIONAL_1,
|
||||
RIDE_COLOUR_SCHEME_ADDITIONAL_2,
|
||||
RIDE_COLOUR_SCHEME_ADDITIONAL_3,
|
||||
|
||||
RIDE_COLOUR_SCHEME_COUNT,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
VEHICLE_COLOUR_SCHEME_SAME,
|
||||
VEHICLE_COLOUR_SCHEME_PER_TRAIN,
|
||||
VEHICLE_COLOUR_SCHEME_PER_VEHICLE
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RIDE_INSPECTION_EVERY_10_MINUTES,
|
||||
|
||||
@@ -9,11 +9,30 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
struct TrackColour
|
||||
{
|
||||
uint8_t main;
|
||||
uint8_t additional;
|
||||
uint8_t supports;
|
||||
colour_t main;
|
||||
colour_t additional;
|
||||
colour_t supports;
|
||||
};
|
||||
|
||||
enum class RideColourScheme : uint8_t
|
||||
{
|
||||
main,
|
||||
additional1,
|
||||
additional2,
|
||||
additional3,
|
||||
};
|
||||
constexpr uint8_t kNumRideColourSchemes = 4;
|
||||
|
||||
enum class VehicleColourSettings : uint8_t
|
||||
{
|
||||
same,
|
||||
perTrain,
|
||||
perCar,
|
||||
};
|
||||
constexpr uint8_t kNumVehicleColourSettings = 3;
|
||||
@@ -437,7 +437,7 @@ std::optional<CoordsXYZ> GetTrackElementOriginAndApplyChanges(
|
||||
}
|
||||
if (flags & TRACK_ELEMENT_SET_COLOUR_SCHEME)
|
||||
{
|
||||
trackElement->SetColourScheme(static_cast<uint8_t>(extra_params & 0xFF));
|
||||
trackElement->SetColourScheme(static_cast<RideColourScheme>(extra_params & 0xFF));
|
||||
}
|
||||
if (flags & TRACK_ELEMENT_SET_SEAT_ROTATION)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "../network/network.h"
|
||||
#include "../platform/Platform.h"
|
||||
#include "../rct1/RCT1.h"
|
||||
#include "../ride/RideColour.h"
|
||||
#include "../util/SawyerCoding.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/Footpath.h"
|
||||
@@ -894,10 +895,10 @@ uint8_t TrackElement::GetColourScheme() const
|
||||
return URide.ColourScheme & TRACK_ELEMENT_COLOUR_SCHEME_MASK;
|
||||
}
|
||||
|
||||
void TrackElement::SetColourScheme(uint8_t newColourScheme)
|
||||
void TrackElement::SetColourScheme(RideColourScheme newColourScheme)
|
||||
{
|
||||
URide.ColourScheme &= ~TRACK_ELEMENT_COLOUR_SCHEME_MASK;
|
||||
URide.ColourScheme |= (newColourScheme & TRACK_ELEMENT_COLOUR_SCHEME_MASK);
|
||||
URide.ColourScheme |= (EnumValue(newColourScheme) & TRACK_ELEMENT_COLOUR_SCHEME_MASK);
|
||||
}
|
||||
|
||||
bool TrackElement::HasCableLift() const
|
||||
|
||||
+225
-233
File diff suppressed because it is too large.
Load diff
@@ -13,6 +13,7 @@
|
||||
#include "../actions/GameActionResult.h"
|
||||
#include "../common.h"
|
||||
#include "../object/Object.h"
|
||||
#include "../ride/RideColour.h"
|
||||
#include "../world/Map.h"
|
||||
#include "VehicleColour.h"
|
||||
|
||||
@@ -36,16 +37,16 @@ enum class TrackPlaceOperation : uint8_t
|
||||
|
||||
struct TrackDesignState
|
||||
{
|
||||
CoordsXYZ PreviewMin;
|
||||
CoordsXYZ PreviewMax;
|
||||
CoordsXYZ Origin;
|
||||
TrackPlaceOperation PlaceOperation{};
|
||||
int16_t PlaceZ{};
|
||||
int16_t PlaceSceneryZ{};
|
||||
bool EntranceExitPlaced{};
|
||||
bool HasScenery{};
|
||||
bool PlaceScenery{};
|
||||
bool IsReplay{};
|
||||
CoordsXYZ previewMin;
|
||||
CoordsXYZ previewMax;
|
||||
CoordsXYZ origin;
|
||||
TrackPlaceOperation placeOperation{};
|
||||
int16_t placeZ{};
|
||||
int16_t placeSceneryZ{};
|
||||
bool entranceExitPlaced{};
|
||||
bool hasScenery{};
|
||||
bool placeScenery{};
|
||||
bool isReplay{};
|
||||
};
|
||||
|
||||
/* Track Entrance entry */
|
||||
@@ -90,33 +91,33 @@ struct TrackDesignSceneryElement
|
||||
|
||||
enum class TrackDesignTrackElementFlag : uint8_t
|
||||
{
|
||||
HasChain = (1 << 0),
|
||||
IsInverted = (1 << 1),
|
||||
IsCovered = (1 << 2), // Reserved
|
||||
hasChain = (1 << 0),
|
||||
isInverted = (1 << 1),
|
||||
isCovered = (1 << 2), // Reserved
|
||||
};
|
||||
|
||||
struct TrackDesignTrackElement
|
||||
{
|
||||
track_type_t Type = 0;
|
||||
uint8_t Flags = 0;
|
||||
uint8_t ColourScheme = 0;
|
||||
::StationIndex StationIndex = StationIndex::FromUnderlying(0);
|
||||
uint8_t BrakeBoosterSpeed = 0;
|
||||
uint8_t SeatRotation = 4;
|
||||
track_type_t type = 0;
|
||||
uint8_t flags = 0;
|
||||
uint8_t colourScheme = 0;
|
||||
::StationIndex stationIndex = StationIndex::FromUnderlying(0);
|
||||
uint8_t brakeBoosterSpeed = 0;
|
||||
uint8_t seatRotation = 4;
|
||||
|
||||
constexpr bool HasFlag(const TrackDesignTrackElementFlag flag) const
|
||||
{
|
||||
return Flags & EnumValue(flag);
|
||||
return flags & EnumValue(flag);
|
||||
}
|
||||
|
||||
constexpr void SetFlag(const TrackDesignTrackElementFlag flag)
|
||||
{
|
||||
Flags |= EnumValue(flag);
|
||||
flags |= EnumValue(flag);
|
||||
}
|
||||
|
||||
constexpr void ClearFlag(const TrackDesignTrackElementFlag flag)
|
||||
{
|
||||
Flags &= ~EnumValue(flag);
|
||||
flags &= ~EnumValue(flag);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -129,45 +130,64 @@ struct TrackDesignMazeElement
|
||||
class DataSerialiser;
|
||||
enum class RideMode : uint8_t;
|
||||
|
||||
struct TrackDesignOperatingSettings
|
||||
{
|
||||
RideMode rideMode{};
|
||||
uint8_t liftHillSpeed{};
|
||||
uint8_t numCircuits{};
|
||||
uint8_t operationSetting{};
|
||||
uint8_t departFlags{};
|
||||
uint8_t minWaitingTime{};
|
||||
uint8_t maxWaitingTime{};
|
||||
};
|
||||
|
||||
struct TrackDesignAppearanceSettings
|
||||
{
|
||||
std::array<TrackColour, kNumRideColourSchemes> trackColours{};
|
||||
u8string stationObjectIdentifier{};
|
||||
VehicleColourSettings vehicleColourSettings{};
|
||||
std::array<VehicleColour, OpenRCT2::Limits::kMaxVehicleColours> vehicleColours{};
|
||||
};
|
||||
|
||||
struct TrackDesignStatistics
|
||||
{
|
||||
uint8_t excitement{};
|
||||
uint8_t intensity{};
|
||||
uint8_t nausea{};
|
||||
int8_t maxSpeed{};
|
||||
int8_t averageSpeed{};
|
||||
|
||||
// TODO: move to a struct of its own, together with rideTime, that can be repeated for multiple stations.
|
||||
uint16_t rideLength;
|
||||
|
||||
uint8_t maxPositiveVerticalG{};
|
||||
int8_t maxNegativeVerticalG{};
|
||||
uint8_t maxLateralG{};
|
||||
uint8_t totalAirTime{};
|
||||
uint8_t drops{};
|
||||
uint8_t highestDropHeight{};
|
||||
union
|
||||
{
|
||||
uint8_t inversions{};
|
||||
uint8_t holes;
|
||||
};
|
||||
|
||||
money64 upkeepCost;
|
||||
TileCoordsXY spaceRequired{};
|
||||
};
|
||||
|
||||
struct TrackDesign
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t vehicleType;
|
||||
money64 cost;
|
||||
RideMode rideMode;
|
||||
uint8_t trackFlags;
|
||||
uint8_t colourScheme;
|
||||
std::array<VehicleColour, OpenRCT2::Limits::kMaxVehicleColours> vehicleColours;
|
||||
u8string stationObjectIdentifier{};
|
||||
uint8_t totalAirTime;
|
||||
uint8_t departFlags;
|
||||
uint8_t numberOfTrains;
|
||||
uint8_t numberOfCarsPerTrain;
|
||||
uint8_t minWaitingTime;
|
||||
uint8_t maxWaitingTime;
|
||||
uint8_t operationSetting;
|
||||
int8_t maxSpeed;
|
||||
int8_t averageSpeed;
|
||||
uint16_t rideLength;
|
||||
uint8_t maxPositiveVerticalG;
|
||||
int8_t maxNegativeVerticalG;
|
||||
uint8_t maxLateralG;
|
||||
uint8_t inversions;
|
||||
uint8_t holes;
|
||||
uint8_t drops;
|
||||
uint8_t highestDropHeight;
|
||||
uint8_t excitement;
|
||||
uint8_t intensity;
|
||||
uint8_t nausea;
|
||||
money64 upkeepCost;
|
||||
uint8_t trackSpineColour[OpenRCT2::Limits::kNumColourSchemes];
|
||||
uint8_t trackRailColour[OpenRCT2::Limits::kNumColourSchemes];
|
||||
uint8_t trackSupportColour[OpenRCT2::Limits::kNumColourSchemes];
|
||||
ObjectEntryDescriptor vehicleObject;
|
||||
uint8_t spaceRequiredX;
|
||||
uint8_t spaceRequiredY;
|
||||
uint8_t liftHillSpeed;
|
||||
uint8_t numCircuits;
|
||||
|
||||
TrackDesignOperatingSettings operation{};
|
||||
TrackDesignAppearanceSettings appearance{};
|
||||
TrackDesignStatistics statistics{};
|
||||
|
||||
std::vector<TrackDesignMazeElement> mazeElements;
|
||||
std::vector<TrackDesignTrackElement> trackElements;
|
||||
@@ -210,17 +230,17 @@ extern RideId gTrackDesignSaveRideIndex;
|
||||
|
||||
[[nodiscard]] std::unique_ptr<TrackDesign> TrackDesignImport(const utf8* path);
|
||||
|
||||
void TrackDesignMirror(TrackDesign* td6);
|
||||
void TrackDesignMirror(TrackDesign* td);
|
||||
|
||||
GameActions::Result TrackDesignPlace(TrackDesign* td6, uint32_t flags, bool placeScenery, Ride& ride, const CoordsXYZD& coords);
|
||||
void TrackDesignPreviewRemoveGhosts(TrackDesign* td6, Ride& ride, const CoordsXYZD& coords);
|
||||
void TrackDesignPreviewDrawOutlines(TrackDesignState& tds, TrackDesign* td6, Ride& ride, const CoordsXYZD& coords);
|
||||
int32_t TrackDesignGetZPlacement(TrackDesign* td6, Ride& ride, const CoordsXYZD& coords);
|
||||
GameActions::Result TrackDesignPlace(TrackDesign* td, uint32_t flags, bool placeScenery, Ride& ride, const CoordsXYZD& coords);
|
||||
void TrackDesignPreviewRemoveGhosts(TrackDesign* td, Ride& ride, const CoordsXYZD& coords);
|
||||
void TrackDesignPreviewDrawOutlines(TrackDesignState& tds, TrackDesign* td, Ride& ride, const CoordsXYZD& coords);
|
||||
int32_t TrackDesignGetZPlacement(TrackDesign* td, Ride& ride, const CoordsXYZD& coords);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Track design preview
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void TrackDesignDrawPreview(TrackDesign* td6, uint8_t* pixels);
|
||||
void TrackDesignDrawPreview(TrackDesign* td, uint8_t* pixels);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Track design saving
|
||||
|
||||
@@ -73,14 +73,14 @@ public:
|
||||
public:
|
||||
std::optional<TrackRepositoryItem> Create(int32_t, const std::string& path) const override
|
||||
{
|
||||
auto td6 = TrackDesignImport(path.c_str());
|
||||
if (td6 != nullptr)
|
||||
auto td = TrackDesignImport(path.c_str());
|
||||
if (td != nullptr)
|
||||
{
|
||||
TrackRepositoryItem item;
|
||||
item.Name = GetNameFromTrackPath(path);
|
||||
item.Path = path;
|
||||
item.RideType = td6->type;
|
||||
item.ObjectEntry = std::string(td6->vehicleObject.Entry.name, 8);
|
||||
item.RideType = td->type;
|
||||
item.ObjectEntry = std::string(td->vehicleObject.Entry.name, 8);
|
||||
item.Flags = 0;
|
||||
if (IsTrackReadOnly(path))
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ static void PaintSpaceRingsStructure(
|
||||
frameNum += static_cast<int8_t>(vehicle->Pitch) * 4;
|
||||
}
|
||||
|
||||
if ((ride.colour_scheme_type & 3) != RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_TRAIN)
|
||||
if (ride.vehicleColourSettings != VehicleColourSettings::perTrain)
|
||||
{
|
||||
vehicleIndex = 0;
|
||||
}
|
||||
|
||||
@@ -919,7 +919,7 @@ namespace OpenRCT2::Scripting
|
||||
if (rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
throw DukException() << "Cannot set 'colourScheme' property, TrackElement belongs to a maze.";
|
||||
|
||||
el->SetColourScheme(value.as_uint());
|
||||
el->SetColourScheme(static_cast<RideColourScheme>(value.as_uint()));
|
||||
Invalidate();
|
||||
}
|
||||
catch (const DukException& e)
|
||||
|
||||
@@ -31,6 +31,7 @@ class TerrainEdgeObject;
|
||||
class FootpathObject;
|
||||
class FootpathSurfaceObject;
|
||||
class FootpathRailingsObject;
|
||||
enum class RideColourScheme : uint8_t;
|
||||
using track_type_t = uint16_t;
|
||||
|
||||
constexpr uint8_t MAX_ELEMENT_HEIGHT = 255;
|
||||
@@ -373,7 +374,7 @@ public:
|
||||
void SetRideIndex(RideId newRideIndex);
|
||||
|
||||
uint8_t GetColourScheme() const;
|
||||
void SetColourScheme(uint8_t newColourScheme);
|
||||
void SetColourScheme(RideColourScheme newColourScheme);
|
||||
|
||||
StationIndex GetStationIndex() const;
|
||||
void SetStationIndex(StationIndex newStationIndex);
|
||||
|
||||
Reference in new issue
Block a user