Merge pull request #26178 from Gymnasiast/rct1-spinning-cars-paint-mode

RCT1 spinning cars paint mode
This commit is contained in:
Michael Steenbeek authored and GitHub committed 2026-03-11 13:17:04 +01:00
commit e0b3a9e968
12 files changed
+141 -6

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
{
"objects": {
"url": "https://github.com/OpenRCT2/objects/releases/download/v1.7.7/objects.zip",
"sha256": "54d28a134a1af12fb2a863564def6e6e226a003559856c7df4ae0e94ef7334fd"
"url": "https://github.com/OpenRCT2/objects/releases/download/v1.7.8/objects.zip",
"sha256": "3d1d98802c6a0cd27f195a0ae7aa05067a071157d776f3326b49f3012c2311bb"
},
"openmusic": {
"url": "https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6.1/openmusic.zip",
+2
View File
@@ -1,6 +1,8 @@
0.4.33 (in development)
------------------------------------------------------------------------
- Feature: [#26178] Port of the Spinning Cars from RollerCoaster Tycoon 1.
- Change: [#25962] The station style dropdown now shows entrance icons next to the labels for easier selection.
- Change: [#26178] Symmetric spinning trains and legacy ‘pre-reversed’ trains can no longer be reversed.
- Fix: [#10616] Quarter-tile trees cannot be placed on dry portions of half-water tiles.
- Fix: [#25735] Ride synchronisation z-check works incorrectly.
- Fix: [#25962] Dropdown triangle glyphs are not optically centred.
+2 -1
View File
@@ -2908,7 +2908,8 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE].type = WidgetType::empty;
}
if (ride->getRideTypeDescriptor().flags.has(RtdFlag::allowReversedTrains)
if ((ride->getRideTypeDescriptor().flags.has(RtdFlag::allowReversedTrains)
&& !rideEntry->flags.has(RideEntryFlag::noReverseOption))
|| (gameState.cheats.disableTrainLengthLimit && !ride->getRideTypeDescriptor().flags.has(RtdFlag::isFlatRide)))
{
widgets[WIDX_VEHICLE_REVERSED_TRAINS_CHECKBOX].type = WidgetType::checkbox;
+1 -1
View File
@@ -2860,7 +2860,7 @@ namespace OpenRCT2::Ui::Windows
// Non-default vehicle visuals do not use this system, so we have to assume it supports all the track pieces.
auto& firstCar = currentRideEntry->Cars[0];
if (firstCar.PaintStyle != VEHICLE_VISUAL_DEFAULT
if ((firstCar.PaintStyle != VEHICLE_VISUAL_DEFAULT && firstCar.PaintStyle != VEHICLE_VISUAL_SPINNING_CARS)
|| firstCar.flags.hasAny(CarEntryFlag::isChairlift, CarEntryFlag::useSlideSwing))
{
disabledGroups.reset();
+1
View File
@@ -1080,6 +1080,7 @@
<ClCompile Include="paint\vehicle\Vehicle.RiverRapids.cpp" />
<ClCompile Include="paint\vehicle\Vehicle.RotoDrop.cpp" />
<ClCompile Include="paint\vehicle\Vehicle.SplashBoats.cpp" />
<ClCompile Include="paint\vehicle\Vehicle.ClassicMiniSpinning.cpp" />
<ClCompile Include="paint\vehicle\Vehicle.Submarine.cpp" />
<ClCompile Include="paint\vehicle\Vehicle.VirginiaReel.cpp" />
<ClCompile Include="paint\VirtualFloor.cpp" />
+11
View File
@@ -451,6 +451,9 @@ namespace OpenRCT2
car.powered_acceleration = stream->ReadValue<uint8_t>();
car.powered_max_speed = stream->ReadValue<uint8_t>();
car.PaintStyle = stream->ReadValue<uint8_t>();
// Since this animation style may be replaced with a generic spinner system, make sure it gets limited to just our port.
if (car.PaintStyle == VEHICLE_VISUAL_SPINNING_CARS)
car.PaintStyle = VEHICLE_VISUAL_DEFAULT;
car.effect_visual = stream->ReadValue<uint8_t>();
car.draw_order = stream->ReadValue<uint8_t>();
car.num_vertical_frames_override = stream->ReadValue<uint8_t>();
@@ -669,6 +672,7 @@ namespace OpenRCT2
{ "disablePainting", RideEntryFlag::disableColourTab },
{ "riderControlsSpeed", RideEntryFlag::riderControlsSpeed },
{ "hideEmptyTrains", RideEntryFlag::hideEmptyTrains },
{ "noReverseOption", RideEntryFlag::noReverseOption },
});
}
@@ -763,6 +767,13 @@ namespace OpenRCT2
car.powered_acceleration = Json::GetNumber<uint8_t>(jCar["poweredAcceleration"]);
car.powered_max_speed = Json::GetNumber<uint8_t>(jCar["poweredMaxSpeed"]);
car.PaintStyle = Json::GetNumber<uint8_t>(jCar["carVisual"]);
// Since this animation style may be replaced with a generic spinner system, make sure it gets limited to just our port.
if (car.PaintStyle == VEHICLE_VISUAL_SPINNING_CARS
&& (GetIdentifier() != "rct1.ride.spinning_cars"
|| _legacyType.ride_type[0] != RIDE_TYPE_CLASSIC_MINI_ROLLER_COASTER))
{
car.PaintStyle = VEHICLE_VISUAL_DEFAULT;
}
car.effect_visual = Json::GetNumber<uint8_t>(jCar["effectVisual"], 1);
car.draw_order = Json::GetNumber<uint8_t>(jCar["drawOrder"]);
car.num_vertical_frames_override = Json::GetNumber<uint8_t>(jCar["numVerticalFramesOverride"]);
@@ -0,0 +1,110 @@
/*****************************************************************************
* Copyright (c) 2014-2025 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "../../ride/Vehicle.h"
#include "../../ride/Angles.h"
#include "../Paint.h"
#include "VehiclePaint.h"
#include <cstdint>
namespace OpenRCT2
{
struct PitchInfo
{
uint8_t imageIndex = 0;
uint8_t precisionShift = Entity::Yaw::kPrecisionOffset[EnumValue(Entity::Yaw::SpritePrecision::Sprites1)];
uint8_t rotation = 0;
uint8_t boundingBoxIndex = 0;
uint8_t boundingBoxPrecisionShift = Entity::Yaw::kPrecisionOffset[EnumValue(Entity::Yaw::SpritePrecision::Sprites16)];
};
constexpr const std::array<PitchInfo, EnumValue(VehiclePitch::pitchCount)> kPitchInfos = []() consteval {
std::array<PitchInfo, EnumValue(VehiclePitch::pitchCount)> pitchInfo;
namespace Yaw = OpenRCT2::Entity::Yaw;
const uint8_t reverse = Yaw::kBaseRotation / 2;
const uint8_t shift4 = Yaw::kPrecisionOffset[EnumValue(Yaw::SpritePrecision::Sprites4)];
const uint8_t shift8 = Yaw::kPrecisionOffset[EnumValue(Yaw::SpritePrecision::Sprites8)];
const uint8_t shift16 = Yaw::kPrecisionOffset[EnumValue(Yaw::SpritePrecision::Sprites16)];
pitchInfo[EnumValue(VehiclePitch::up12)] = { 4, shift4, 0, 0, shift16 };
pitchInfo[EnumValue(VehiclePitch::up25)] = { 68, shift16, 0, 16, shift16 };
pitchInfo[EnumValue(VehiclePitch::up42)] = { 20, shift8, 0, 32, shift8 };
pitchInfo[EnumValue(VehiclePitch::up60)] = { 52, shift4, 0, 40, shift16 };
pitchInfo[EnumValue(VehiclePitch::down12)] = { 4, shift4, reverse, 0, shift16 };
pitchInfo[EnumValue(VehiclePitch::down25)] = { 68, shift16, reverse, 16, shift16 };
pitchInfo[EnumValue(VehiclePitch::down42)] = { 20, shift8, reverse, 32, shift8 };
pitchInfo[EnumValue(VehiclePitch::down60)] = { 52, shift4, reverse, 40, shift16 };
pitchInfo[EnumValue(VehiclePitch::up8)] = { 135, shift4, 0, 0, shift16 };
pitchInfo[EnumValue(VehiclePitch::up16)] = { 151, shift4, 0, 0, shift16 };
pitchInfo[EnumValue(VehiclePitch::up50)] = { 167, shift4, 0, 104, shift4 };
pitchInfo[EnumValue(VehiclePitch::down8)] = { 135, shift4, reverse, 0, shift16 };
pitchInfo[EnumValue(VehiclePitch::down16)] = { 151, shift4, reverse, 0, shift16 };
pitchInfo[EnumValue(VehiclePitch::down50)] = { 167, shift4, reverse, 104, shift4 };
return pitchInfo;
}();
void VehicleVisualClassicMiniSpinning(
PaintSession& session, const int32_t x, const int32_t imageDirection, const int32_t y, const int32_t z,
const Vehicle* const vehicle, const CarEntry* const carEntry)
{
constexpr const int32_t spriteCount = 183;
constexpr const int32_t spriteRotationPrecision = 4;
constexpr const int32_t rotationPrecision = 16;
const PitchInfo& pitchInfo = kPitchInfos[EnumValue(vehicle->pitch)];
const int32_t rotatedImageDirection = OpenRCT2::Entity::Yaw::YawTo32(imageDirection) ^ pitchInfo.rotation;
const ImageIndex pitchImageIndex = pitchInfo.imageIndex
+ (rotatedImageDirection >> pitchInfo.precisionShift) * spriteRotationPrecision;
const int32_t spin = vehicle->spin_sprite >> 4;
const ImageIndex rotationImageIndex = spin & (spriteRotationPrecision - 1);
const ImageIndex carImageIndex = carEntry->base_image_id + pitchImageIndex + rotationImageIndex;
constexpr const int32_t restraintsImageIndexOffset = 132;
constexpr const int32_t restraintsInterval = 64;
const bool restraints = vehicle->restraints_position >= restraintsInterval;
const ImageIndex restraintsImageIndex = carEntry->base_image_id + restraintsImageIndexOffset
+ ((vehicle->restraints_position - restraintsInterval) / restraintsInterval);
const ImageIndex imageIndex = ((!restraints) * carImageIndex) + (restraints * restraintsImageIndex);
const ImageId imageId = vehicle->IsGhost() ? ConstructionMarker.WithIndex(imageIndex)
: ImageId(imageIndex, vehicle->colours.Body, vehicle->colours.Trim);
const uint32_t boundingBoxIndex = pitchInfo.boundingBoxIndex
+ (rotatedImageDirection >> pitchInfo.boundingBoxPrecisionShift);
const VehicleBoundBox& bb = VehicleBoundboxes[carEntry->draw_order][boundingBoxIndex];
const BoundBoxXYZ boundingBox = { { bb.offset_x, bb.offset_y, bb.offset_z + z },
{ bb.length_x, bb.length_y, bb.length_z } };
PaintAddImageAsParent(session, imageId, { 0, 0, z }, boundingBox);
if (session.rt.zoom_level < ZoomLevel{ 2 })
{
for (int32_t i = 0; i < vehicle->num_peeps / 2; i++)
{
const int32_t seatRotation = i * spriteRotationPrecision;
const int32_t guestRotationPrecision = rotationPrecision / 2;
const int32_t rotation = spin + (session.CurrentRotation * 4) + seatRotation;
const int32_t guestRotation = rotation & (guestRotationPrecision - 1);
const ImageIndex guestImageIndexOffset = guestRotation >= 4 ? spriteCount * 2 : spriteCount;
const ImageIndex guestImageIndex = imageIndex + guestImageIndexOffset;
const bool swapGuestColours = (rotation & (rotationPrecision - 1)) >= guestRotationPrecision;
const Drawing::Colour guestColour0 = vehicle->peep_tshirt_colours[(i * 2) + swapGuestColours];
const Drawing::Colour guestColour1 = vehicle->peep_tshirt_colours[(i * 2) + !swapGuestColours];
const ImageId guestImageId = vehicle->IsGhost() ? ConstructionMarker.WithIndex(guestImageIndex)
: ImageId(guestImageIndex, guestColour0, guestColour1);
PaintAddImageAsChild(session, guestImageId, { 0, 0, z }, boundingBox);
}
}
}
} // namespace OpenRCT2
@@ -4783,5 +4783,8 @@ void Vehicle::Paint(PaintSession& session, int32_t imageDirection) const
case VEHICLE_VISUAL_SUBMARINE:
VehicleVisualSubmarine(session, x, imageDirection, y, z + zOffset, this, carEntry);
break;
case VEHICLE_VISUAL_SPINNING_CARS:
VehicleVisualClassicMiniSpinning(session, x, imageDirection, y, z + zOffset, this, carEntry);
break;
}
}
@@ -61,4 +61,7 @@ namespace OpenRCT2
PaintSession& session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const Vehicle* vehicle);
void VehicleVisualMiniGolfBall(
PaintSession& session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const Vehicle* vehicle);
void VehicleVisualClassicMiniSpinning(
PaintSession& session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const Vehicle* vehicle,
const CarEntry* carEntry);
} // namespace OpenRCT2
+1 -1
View File
@@ -806,7 +806,7 @@ namespace OpenRCT2::RCT1
"rct1.ride.suspended_swinging_cars", // VehicleType::suspendedSwingingCars
"rct1.ride.ladybird_trains", // VehicleType::ladybirdCars
"rct1.ride.stand_up_trains", // VehicleType::standupRollerCoasterCars
"rct2.ride.wmspin", // VehicleType::spinningCars
"rct1.ride.spinning_cars", // VehicleType::spinningCars
"rct1.ride.single_person_swinging_cars", // VehicleType::singlePersonSwingingChairs
"rct2.ride.swans", // VehicleType::swansPedalBoats
"rct1.ride.streamlined_monorail_trains", // VehicleType::largeMonorailTrain
+3
View File
@@ -67,6 +67,9 @@ enum class RideEntryFlag : uint8_t
magicCarpetSwingMode,
riderControlsSpeed,
hideEmptyTrains,
// Hide the ‘Reverse trains’ checkbox in the Ride window. Used for symmetrical spinning trains and legacy pre-reversed
// vehicles (to avoid double-dipping on the reverse bonus).
noReverseOption,
};
using RideEntryFlags = FlagHolder<uint32_t, RideEntryFlag>;
+2 -1
View File
@@ -506,7 +506,8 @@ enum
VEHICLE_VISUAL_SPLASH4_EFFECT,
VEHICLE_VISUAL_SPLASH5_EFFECT,
VEHICLE_VISUAL_VIRGINIA_REEL,
VEHICLE_VISUAL_SUBMARINE
VEHICLE_VISUAL_SUBMARINE,
VEHICLE_VISUAL_SPINNING_CARS,
};
enum : uint32_t