mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Merge pull request #25199 from spacek531/vehicle/cleanup-car-entry-flags
Convert legacy sprite groups to FlagHolder
This commit is contained in:
@@ -142,6 +142,28 @@ namespace OpenRCT2::Json
|
||||
return flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to convert a json object and an initializer list to a FlagHolder
|
||||
* @param THolderType FlagHolder type
|
||||
* @param TEnumType Flag enum type
|
||||
* @param jsonObj JSON object containing boolean values
|
||||
* @param list List of pairs of keys and bits to enable if that key in the object is true
|
||||
* @return FlagHolder with the relevant flags set
|
||||
*/
|
||||
template<typename THolderType, typename TEnumType>
|
||||
THolderType GetFlagHolder(const json_t& jsonObj, std::initializer_list<std::pair<std::string, TEnumType>> list)
|
||||
{
|
||||
THolderType flagholder;
|
||||
for (const auto& item : list)
|
||||
{
|
||||
if (jsonObj.contains(item.first) && Json::GetBoolean(jsonObj[item.first]))
|
||||
{
|
||||
flagholder.set(item.second);
|
||||
}
|
||||
}
|
||||
return flagholder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the GetFlags function to allow for inverted values
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../audio/Audio.h"
|
||||
#include "../core/EnumMap.hpp"
|
||||
#include "../core/FlagHolder.hpp"
|
||||
#include "../core/IStream.hpp"
|
||||
#include "../core/Json.hpp"
|
||||
#include "../core/Memory.hpp"
|
||||
@@ -131,6 +132,29 @@ namespace OpenRCT2
|
||||
}
|
||||
}
|
||||
|
||||
enum CarSpriteFlag : uint8_t
|
||||
{
|
||||
flat,
|
||||
gentleSlopes,
|
||||
steepSlopes,
|
||||
verticalSlopes,
|
||||
diagonalSlopes,
|
||||
flatBanked,
|
||||
inlineTwists,
|
||||
flatToGentleSlopeBankedTransitions,
|
||||
diagonalGentleSlopeBankedTransitions,
|
||||
gentleSlopeBankedTransitions,
|
||||
gentleSlopeBankedTurns,
|
||||
flatToGentleSlopeWhileBankedTransitions,
|
||||
corkscrews,
|
||||
restraintAnimation,
|
||||
curvedLiftHill,
|
||||
has4RotationFrames,
|
||||
};
|
||||
using CarSpriteFlags = FlagHolder<uint32_t, CarSpriteFlag>;
|
||||
|
||||
static void ReadLegacySpriteGroups(CarEntry& car, CarSpriteFlags carSpriteFlags);
|
||||
|
||||
void RideObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
|
||||
{
|
||||
stream->Seek(8, STREAM_SEEK_CURRENT);
|
||||
@@ -158,7 +182,7 @@ namespace OpenRCT2
|
||||
|
||||
for (auto& carEntry : _legacyType.Cars)
|
||||
{
|
||||
ReadLegacyCar(context, stream, &carEntry);
|
||||
ReadLegacyCar(context, stream, carEntry);
|
||||
}
|
||||
stream->Seek(4, STREAM_SEEK_CURRENT);
|
||||
_legacyType.excitement_multiplier = stream->ReadValue<int8_t>();
|
||||
@@ -396,55 +420,56 @@ namespace OpenRCT2
|
||||
item->RideInfo.RideFlags = 0;
|
||||
}
|
||||
|
||||
void RideObject::ReadLegacyCar([[maybe_unused]] IReadObjectContext* context, IStream* stream, CarEntry* car)
|
||||
void RideObject::ReadLegacyCar([[maybe_unused]] IReadObjectContext* context, IStream* stream, CarEntry& car)
|
||||
{
|
||||
car->TabRotationMask = stream->ReadValue<uint16_t>();
|
||||
car.TabRotationMask = stream->ReadValue<uint16_t>();
|
||||
stream->Seek(2 * 1, STREAM_SEEK_CURRENT);
|
||||
car->spacing = stream->ReadValue<uint32_t>();
|
||||
car->car_mass = stream->ReadValue<uint16_t>();
|
||||
car->tab_height = stream->ReadValue<int8_t>();
|
||||
car->num_seats = stream->ReadValue<uint8_t>();
|
||||
uint16_t spriteGroups = stream->ReadValue<uint16_t>();
|
||||
car->sprite_width = stream->ReadValue<uint8_t>();
|
||||
car->sprite_height_negative = stream->ReadValue<uint8_t>();
|
||||
car->sprite_height_positive = stream->ReadValue<uint8_t>();
|
||||
car.spacing = stream->ReadValue<uint32_t>();
|
||||
car.car_mass = stream->ReadValue<uint16_t>();
|
||||
car.tab_height = stream->ReadValue<int8_t>();
|
||||
car.num_seats = stream->ReadValue<uint8_t>();
|
||||
CarSpriteFlags carSpriteFlags;
|
||||
carSpriteFlags.holder = stream->ReadValue<uint16_t>();
|
||||
car.sprite_width = stream->ReadValue<uint8_t>();
|
||||
car.sprite_height_negative = stream->ReadValue<uint8_t>();
|
||||
car.sprite_height_positive = stream->ReadValue<uint8_t>();
|
||||
auto legacyAnimation = stream->ReadValue<uint8_t>();
|
||||
car->flags = stream->ReadValue<uint32_t>();
|
||||
car.flags = stream->ReadValue<uint32_t>();
|
||||
// Implied in vanilla, but can be turned off in OpenRCT2.
|
||||
car->flags |= CAR_ENTRY_FLAG_ENABLE_BODY_COLOUR;
|
||||
car->base_num_frames = stream->ReadValue<uint16_t>();
|
||||
car.flags |= CAR_ENTRY_FLAG_ENABLE_BODY_COLOUR;
|
||||
car.base_num_frames = stream->ReadValue<uint16_t>();
|
||||
stream->Seek(15 * 4, STREAM_SEEK_CURRENT);
|
||||
car->no_seating_rows = stream->ReadValue<uint8_t>();
|
||||
car->spinning_inertia = stream->ReadValue<uint8_t>();
|
||||
car->spinning_friction = stream->ReadValue<uint8_t>();
|
||||
car->friction_sound_id = stream->ReadValue<OpenRCT2::Audio::SoundId>();
|
||||
car->ReversedCarIndex = stream->ReadValue<uint8_t>();
|
||||
car->soundRange = stream->ReadValue<SoundRange>();
|
||||
car->double_sound_frequency = stream->ReadValue<uint8_t>();
|
||||
car->powered_acceleration = stream->ReadValue<uint8_t>();
|
||||
car->powered_max_speed = stream->ReadValue<uint8_t>();
|
||||
car->PaintStyle = stream->ReadValue<uint8_t>();
|
||||
car->effect_visual = stream->ReadValue<uint8_t>();
|
||||
car->draw_order = stream->ReadValue<uint8_t>();
|
||||
car->num_vertical_frames_override = stream->ReadValue<uint8_t>();
|
||||
car.no_seating_rows = stream->ReadValue<uint8_t>();
|
||||
car.spinning_inertia = stream->ReadValue<uint8_t>();
|
||||
car.spinning_friction = stream->ReadValue<uint8_t>();
|
||||
car.friction_sound_id = stream->ReadValue<OpenRCT2::Audio::SoundId>();
|
||||
car.ReversedCarIndex = stream->ReadValue<uint8_t>();
|
||||
car.soundRange = stream->ReadValue<SoundRange>();
|
||||
car.double_sound_frequency = stream->ReadValue<uint8_t>();
|
||||
car.powered_acceleration = stream->ReadValue<uint8_t>();
|
||||
car.powered_max_speed = stream->ReadValue<uint8_t>();
|
||||
car.PaintStyle = stream->ReadValue<uint8_t>();
|
||||
car.effect_visual = stream->ReadValue<uint8_t>();
|
||||
car.draw_order = stream->ReadValue<uint8_t>();
|
||||
car.num_vertical_frames_override = stream->ReadValue<uint8_t>();
|
||||
stream->Seek(4, STREAM_SEEK_CURRENT);
|
||||
|
||||
// OpenRCT2-specific features below
|
||||
auto animationProperties = GetDefaultAnimationParameters(legacyAnimation);
|
||||
car->animation = animationProperties.Alias;
|
||||
car->AnimationSpeed = animationProperties.Speed;
|
||||
car->AnimationFrames = animationProperties.NumFrames;
|
||||
car->SteamEffect.Longitudinal = DefaultSteamSpawnPosition[0];
|
||||
car->SteamEffect.Vertical = DefaultSteamSpawnPosition[1];
|
||||
if (car->flags & CAR_ENTRY_FLAG_SPINNING)
|
||||
car.animation = animationProperties.Alias;
|
||||
car.AnimationSpeed = animationProperties.Speed;
|
||||
car.AnimationFrames = animationProperties.NumFrames;
|
||||
car.SteamEffect.Longitudinal = DefaultSteamSpawnPosition[0];
|
||||
car.SteamEffect.Vertical = DefaultSteamSpawnPosition[1];
|
||||
if (car.flags & CAR_ENTRY_FLAG_SPINNING)
|
||||
{
|
||||
car->spinningNumFrames = 8;
|
||||
car.spinningNumFrames = 8;
|
||||
}
|
||||
if (car->flags & CAR_ENTRY_FLAG_SPINNING_COMBINED_WITH_NONSPINNING)
|
||||
if (car.flags & CAR_ENTRY_FLAG_SPINNING_COMBINED_WITH_NONSPINNING)
|
||||
{
|
||||
car->spinningNumFrames = 32;
|
||||
car.spinningNumFrames = 32;
|
||||
}
|
||||
ReadLegacySpriteGroups(car, spriteGroups);
|
||||
ReadLegacySpriteGroups(car, carSpriteFlags);
|
||||
}
|
||||
|
||||
uint8_t RideObject::CalculateNumVerticalFrames(const CarEntry& carEntry)
|
||||
@@ -864,28 +889,27 @@ namespace OpenRCT2
|
||||
auto jFrames = jCar["frames"];
|
||||
if (jFrames.is_object())
|
||||
{
|
||||
uint16_t spriteFlags = Json::GetFlags<uint32_t>(
|
||||
auto carSpriteFlags = Json::GetFlagHolder<CarSpriteFlags, CarSpriteFlag>(
|
||||
jFrames,
|
||||
{
|
||||
{ "flat", CAR_SPRITE_FLAG_FLAT },
|
||||
{ "gentleSlopes", CAR_SPRITE_FLAG_GENTLE_SLOPES },
|
||||
{ "steepSlopes", CAR_SPRITE_FLAG_STEEP_SLOPES },
|
||||
{ "verticalSlopes", CAR_SPRITE_FLAG_VERTICAL_SLOPES },
|
||||
{ "diagonalSlopes", CAR_SPRITE_FLAG_DIAGONAL_SLOPES },
|
||||
{ "flatBanked", CAR_SPRITE_FLAG_FLAT_BANKED },
|
||||
{ "inlineTwists", CAR_SPRITE_FLAG_INLINE_TWISTS },
|
||||
{ "flatToGentleSlopeBankedTransitions", CAR_SPRITE_FLAG_FLAT_TO_GENTLE_SLOPE_BANKED_TRANSITIONS },
|
||||
{ "diagonalGentleSlopeBankedTransitions", CAR_SPRITE_FLAG_DIAGONAL_GENTLE_SLOPE_BANKED_TRANSITIONS },
|
||||
{ "gentleSlopeBankedTransitions", CAR_SPRITE_FLAG_GENTLE_SLOPE_BANKED_TRANSITIONS },
|
||||
{ "gentleSlopeBankedTurns", CAR_SPRITE_FLAG_GENTLE_SLOPE_BANKED_TURNS },
|
||||
{ "flatToGentleSlopeWhileBankedTransitions",
|
||||
CAR_SPRITE_FLAG_FLAT_TO_GENTLE_SLOPE_WHILE_BANKED_TRANSITIONS },
|
||||
{ "corkscrews", CAR_SPRITE_FLAG_CORKSCREWS },
|
||||
{ "restraintAnimation", CAR_SPRITE_FLAG_RESTRAINT_ANIMATION },
|
||||
{ "curvedLiftHill", CAR_SPRITE_FLAG_CURVED_LIFT_HILL },
|
||||
{ "VEHICLE_SPRITE_FLAG_15", CAR_SPRITE_FLAG_USE_4_ROTATION_FRAMES },
|
||||
{ "flat", CarSpriteFlag::flat },
|
||||
{ "gentleSlopes", CarSpriteFlag::gentleSlopes },
|
||||
{ "steepSlopes", CarSpriteFlag::steepSlopes },
|
||||
{ "verticalSlopes", CarSpriteFlag::verticalSlopes },
|
||||
{ "diagonalSlopes", CarSpriteFlag::diagonalSlopes },
|
||||
{ "flatBanked", CarSpriteFlag::flatBanked },
|
||||
{ "inlineTwists", CarSpriteFlag::inlineTwists },
|
||||
{ "flatToGentleSlopeBankedTransitions", CarSpriteFlag::flatToGentleSlopeBankedTransitions },
|
||||
{ "diagonalGentleSlopeBankedTransitions", CarSpriteFlag::diagonalGentleSlopeBankedTransitions },
|
||||
{ "gentleSlopeBankedTransitions", CarSpriteFlag::gentleSlopeBankedTransitions },
|
||||
{ "gentleSlopeBankedTurns", CarSpriteFlag::gentleSlopeBankedTurns },
|
||||
{ "flatToGentleSlopeWhileBankedTransitions", CarSpriteFlag::flatToGentleSlopeWhileBankedTransitions },
|
||||
{ "corkscrews", CarSpriteFlag::corkscrews },
|
||||
{ "restraintAnimation", CarSpriteFlag::restraintAnimation },
|
||||
{ "curvedLiftHill", CarSpriteFlag::curvedLiftHill },
|
||||
{ "VEHICLE_SPRITE_FLAG_15", CarSpriteFlag::has4RotationFrames },
|
||||
});
|
||||
ReadLegacySpriteGroups(&car, spriteFlags);
|
||||
ReadLegacySpriteGroups(car, carSpriteFlags);
|
||||
return car;
|
||||
}
|
||||
|
||||
@@ -1058,85 +1082,85 @@ namespace OpenRCT2
|
||||
}
|
||||
|
||||
// Converts legacy sprite groups into OpenRCT2 sprite groups
|
||||
void RideObject::ReadLegacySpriteGroups(CarEntry* vehicle, uint16_t spriteGroups)
|
||||
void ReadLegacySpriteGroups(CarEntry& car, CarSpriteFlags carSpriteFlags)
|
||||
{
|
||||
auto baseSpritePrecision = SpritePrecision::Sprites32;
|
||||
if (vehicle->flags & CAR_ENTRY_FLAG_USE_16_ROTATION_FRAMES)
|
||||
if (car.flags & CAR_ENTRY_FLAG_USE_16_ROTATION_FRAMES)
|
||||
baseSpritePrecision = SpritePrecision::Sprites16;
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_USE_4_ROTATION_FRAMES)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::has4RotationFrames))
|
||||
baseSpritePrecision = SpritePrecision::Sprites4;
|
||||
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_FLAT)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::flat))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::SlopeFlat)].spritePrecision = baseSpritePrecision;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::SlopeFlat)].spritePrecision = baseSpritePrecision;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_GENTLE_SLOPES)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::gentleSlopes))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes12)].spritePrecision = SpritePrecision::Sprites4;
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes25)].spritePrecision = baseSpritePrecision;
|
||||
if (vehicle->flags & CAR_ENTRY_FLAG_SPINNING_COMBINED_WITH_NONSPINNING)
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes25)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes12)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes25)].spritePrecision = baseSpritePrecision;
|
||||
if (car.flags & CAR_ENTRY_FLAG_SPINNING_COMBINED_WITH_NONSPINNING)
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes25)].spritePrecision = SpritePrecision::Sprites4;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_STEEP_SLOPES)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::steepSlopes))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes42)].spritePrecision = SpritePrecision::Sprites8;
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes60)].spritePrecision = baseSpritePrecision;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes42)].spritePrecision = SpritePrecision::Sprites8;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes60)].spritePrecision = baseSpritePrecision;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_VERTICAL_SLOPES)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::verticalSlopes))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes75)].spritePrecision = SpritePrecision::Sprites4;
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes90)].spritePrecision = baseSpritePrecision;
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::SlopesLoop)].spritePrecision = SpritePrecision::Sprites4;
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::SlopeInverted)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes75)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes90)].spritePrecision = baseSpritePrecision;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::SlopesLoop)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::SlopeInverted)].spritePrecision = SpritePrecision::Sprites4;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_DIAGONAL_SLOPES)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::diagonalSlopes))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes8)].spritePrecision = SpritePrecision::Sprites4;
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes16)].spritePrecision = SpritePrecision::Sprites4;
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes50)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes8)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes16)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes50)].spritePrecision = SpritePrecision::Sprites4;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_FLAT_BANKED)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::flatBanked))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::FlatBanked22)].spritePrecision = SpritePrecision::Sprites8;
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::FlatBanked45)].spritePrecision = baseSpritePrecision;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::FlatBanked22)].spritePrecision = SpritePrecision::Sprites8;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::FlatBanked45)].spritePrecision = baseSpritePrecision;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_INLINE_TWISTS)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::inlineTwists))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::FlatBanked67)].spritePrecision = SpritePrecision::Sprites4;
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::FlatBanked90)].spritePrecision = SpritePrecision::Sprites4;
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::InlineTwists)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::FlatBanked67)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::FlatBanked90)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::InlineTwists)].spritePrecision = SpritePrecision::Sprites4;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_FLAT_TO_GENTLE_SLOPE_BANKED_TRANSITIONS)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::flatToGentleSlopeBankedTransitions))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes12Banked22)].spritePrecision = baseSpritePrecision;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes12Banked22)].spritePrecision = baseSpritePrecision;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_DIAGONAL_GENTLE_SLOPE_BANKED_TRANSITIONS)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::diagonalGentleSlopeBankedTransitions))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes8Banked22)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes8Banked22)].spritePrecision = SpritePrecision::Sprites4;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_GENTLE_SLOPE_BANKED_TRANSITIONS)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::gentleSlopeBankedTransitions))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes25Banked22)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes25Banked22)].spritePrecision = SpritePrecision::Sprites4;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_GENTLE_SLOPE_BANKED_TURNS)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::gentleSlopeBankedTurns))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes25Banked45)].spritePrecision = baseSpritePrecision;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes25Banked45)].spritePrecision = baseSpritePrecision;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_FLAT_TO_GENTLE_SLOPE_WHILE_BANKED_TRANSITIONS)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::flatToGentleSlopeWhileBankedTransitions))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Slopes12Banked45)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Slopes12Banked45)].spritePrecision = SpritePrecision::Sprites4;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_CORKSCREWS)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::corkscrews))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::Corkscrews)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::Corkscrews)].spritePrecision = SpritePrecision::Sprites4;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_RESTRAINT_ANIMATION)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::restraintAnimation))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::RestraintAnimation)].spritePrecision = SpritePrecision::Sprites4;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::RestraintAnimation)].spritePrecision = SpritePrecision::Sprites4;
|
||||
}
|
||||
if (spriteGroups & CAR_SPRITE_FLAG_CURVED_LIFT_HILL)
|
||||
if (carSpriteFlags.has(CarSpriteFlag::curvedLiftHill))
|
||||
{
|
||||
vehicle->SpriteGroups[EnumValue(SpriteGroupType::CurvedLiftHillUp)].spritePrecision = baseSpritePrecision;
|
||||
car.SpriteGroups[EnumValue(SpriteGroupType::CurvedLiftHillUp)].spritePrecision = baseSpritePrecision;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRCT2
|
||||
static ride_type_t ParseRideType(const std::string& s);
|
||||
|
||||
private:
|
||||
void ReadLegacyCar(IReadObjectContext* context, OpenRCT2::IStream* stream, CarEntry* car);
|
||||
void ReadLegacyCar(IReadObjectContext* context, OpenRCT2::IStream* stream, CarEntry& car);
|
||||
|
||||
void ReadJsonVehicleInfo(IReadObjectContext* context, json_t& properties);
|
||||
std::vector<CarEntry> ReadJsonCars([[maybe_unused]] IReadObjectContext* context, json_t& jCars);
|
||||
@@ -73,7 +73,6 @@ namespace OpenRCT2
|
||||
static ShopItem ParseShopItem(const std::string& s);
|
||||
static colour_t ParseColour(const std::string& s);
|
||||
|
||||
void ReadLegacySpriteGroups(CarEntry* vehicle, uint16_t spriteGroups);
|
||||
uint8_t GetDefaultClearance() const;
|
||||
};
|
||||
} // namespace OpenRCT2
|
||||
|
||||
@@ -88,27 +88,6 @@ enum : uint64_t
|
||||
CAR_ENTRY_FLAG_ENABLE_BODY_COLOUR = 1uLL << 32,
|
||||
};
|
||||
|
||||
enum : uint32_t
|
||||
{
|
||||
CAR_SPRITE_FLAG_FLAT = (1 << 0),
|
||||
CAR_SPRITE_FLAG_GENTLE_SLOPES = (1 << 1),
|
||||
CAR_SPRITE_FLAG_STEEP_SLOPES = (1 << 2),
|
||||
CAR_SPRITE_FLAG_VERTICAL_SLOPES = (1 << 3),
|
||||
CAR_SPRITE_FLAG_DIAGONAL_SLOPES = (1 << 4),
|
||||
CAR_SPRITE_FLAG_FLAT_BANKED = (1 << 5),
|
||||
CAR_SPRITE_FLAG_INLINE_TWISTS = (1 << 6),
|
||||
CAR_SPRITE_FLAG_FLAT_TO_GENTLE_SLOPE_BANKED_TRANSITIONS = (1 << 7),
|
||||
CAR_SPRITE_FLAG_DIAGONAL_GENTLE_SLOPE_BANKED_TRANSITIONS = (1 << 8),
|
||||
CAR_SPRITE_FLAG_GENTLE_SLOPE_BANKED_TRANSITIONS = (1 << 9),
|
||||
CAR_SPRITE_FLAG_GENTLE_SLOPE_BANKED_TURNS = (1 << 10),
|
||||
CAR_SPRITE_FLAG_FLAT_TO_GENTLE_SLOPE_WHILE_BANKED_TRANSITIONS = (1 << 11),
|
||||
CAR_SPRITE_FLAG_CORKSCREWS = (1 << 12),
|
||||
CAR_SPRITE_FLAG_RESTRAINT_ANIMATION = (1 << 13),
|
||||
CAR_SPRITE_FLAG_CURVED_LIFT_HILL = (1 << 14),
|
||||
// Used only on lifts (the transport ride), to only use 4 rotation sprites instead of 32.
|
||||
CAR_SPRITE_FLAG_USE_4_ROTATION_FRAMES = (1 << 15),
|
||||
};
|
||||
|
||||
/*
|
||||
* When adding a sprite group, add multiplier to SpriteGroupMultiplier in RideObject.cpp and add sprite group data to cable
|
||||
* lifthill vehicle in RideData.cpp and update the SpriteGroups interface in distribution/openrct2.d.ts
|
||||
|
||||
Reference in New Issue
Block a user