mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #19119
This commit is contained in:
commit
b1bf62177f
|
@ -105,7 +105,7 @@ static void DrawResearchItem(
|
||||||
if (researchItem.type == Research::EntryType::Ride
|
if (researchItem.type == Research::EntryType::Ride
|
||||||
&& !GetRideTypeDescriptor(researchItem.baseRideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY))
|
&& !GetRideTypeDescriptor(researchItem.baseRideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY))
|
||||||
{
|
{
|
||||||
const StringId rideTypeName = get_ride_naming(researchItem.baseRideType, get_ride_entry(researchItem.entryIndex)).Name;
|
const StringId rideTypeName = get_ride_naming(researchItem.baseRideType, *get_ride_entry(researchItem.entryIndex)).Name;
|
||||||
|
|
||||||
// Draw group name
|
// Draw group name
|
||||||
auto ft = Formatter();
|
auto ft = Formatter();
|
||||||
|
@ -413,7 +413,7 @@ public:
|
||||||
&& !GetRideTypeDescriptor(researchItem->baseRideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY))
|
&& !GetRideTypeDescriptor(researchItem->baseRideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY))
|
||||||
{
|
{
|
||||||
drawString = STR_WINDOW_COLOUR_2_STRINGID_STRINGID;
|
drawString = STR_WINDOW_COLOUR_2_STRINGID_STRINGID;
|
||||||
StringId rideTypeName = get_ride_naming(researchItem->baseRideType, get_ride_entry(researchItem->entryIndex)).Name;
|
StringId rideTypeName = get_ride_naming(researchItem->baseRideType, *get_ride_entry(researchItem->entryIndex)).Name;
|
||||||
ft.Add<StringId>(rideTypeName);
|
ft.Add<StringId>(rideTypeName);
|
||||||
ft.Add<StringId>(stringId);
|
ft.Add<StringId>(stringId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ public:
|
||||||
if (objectEntry != nullptr)
|
if (objectEntry != nullptr)
|
||||||
{
|
{
|
||||||
auto groupIndex = object_manager_get_loaded_object_entry_index(objectEntry);
|
auto groupIndex = object_manager_get_loaded_object_entry_index(objectEntry);
|
||||||
auto rideName = get_ride_naming(td6->type, get_ride_entry(groupIndex));
|
auto rideName = get_ride_naming(td6->type, *get_ride_entry(groupIndex));
|
||||||
ft.Add<StringId>(rideName.Name);
|
ft.Add<StringId>(rideName.Name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -825,7 +825,7 @@ private:
|
||||||
void DrawRideInformation(rct_drawpixelinfo& dpi, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth)
|
void DrawRideInformation(rct_drawpixelinfo& dpi, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth)
|
||||||
{
|
{
|
||||||
rct_ride_entry* rideEntry = get_ride_entry(item.EntryIndex);
|
rct_ride_entry* rideEntry = get_ride_entry(item.EntryIndex);
|
||||||
RideNaming rideNaming = get_ride_naming(item.Type, rideEntry);
|
RideNaming rideNaming = get_ride_naming(item.Type, *rideEntry);
|
||||||
auto ft = Formatter();
|
auto ft = Formatter();
|
||||||
|
|
||||||
UpdateVehicleAvailability(item.Type);
|
UpdateVehicleAvailability(item.Type);
|
||||||
|
|
|
@ -2751,7 +2751,7 @@ static void WindowRideConstructionUpdateDisabledPieces(ObjectEntryIndex rideType
|
||||||
}
|
}
|
||||||
|
|
||||||
// Any pieces that this ride entry supports must be taken out of the array.
|
// Any pieces that this ride entry supports must be taken out of the array.
|
||||||
auto supportedPieces = ride_entry_get_supported_track_pieces(currentRideEntry);
|
auto supportedPieces = ride_entry_get_supported_track_pieces(*currentRideEntry);
|
||||||
disabledPieces &= supportedPieces.flip();
|
disabledPieces &= supportedPieces.flip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,7 +367,7 @@ public:
|
||||||
|
|
||||||
if (entry != nullptr)
|
if (entry != nullptr)
|
||||||
{
|
{
|
||||||
RideNaming rideName = get_ride_naming(_window_track_list_item.Type, entry);
|
RideNaming rideName = get_ride_naming(_window_track_list_item.Type, *entry);
|
||||||
stringId = rideName.Name;
|
stringId = rideName.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -458,7 +458,7 @@
|
||||||
<ClInclude Include="ride\Vehicle.h" />
|
<ClInclude Include="ride\Vehicle.h" />
|
||||||
<ClInclude Include="ride\VehicleColour.h" />
|
<ClInclude Include="ride\VehicleColour.h" />
|
||||||
<ClInclude Include="ride\VehicleData.h" />
|
<ClInclude Include="ride\VehicleData.h" />
|
||||||
<ClInclude Include="ride\VehicleEntry.h" />
|
<ClInclude Include="ride\CarEntry.h" />
|
||||||
<ClInclude Include="ride\VehiclePaint.h" />
|
<ClInclude Include="ride\VehiclePaint.h" />
|
||||||
<ClInclude Include="ride\VehicleRiderControl.h" />
|
<ClInclude Include="ride\VehicleRiderControl.h" />
|
||||||
<ClInclude Include="ride\VehicleSubpositionData.h" />
|
<ClInclude Include="ride\VehicleSubpositionData.h" />
|
||||||
|
@ -851,6 +851,7 @@
|
||||||
<ClCompile Include="rct2\T6Importer.cpp" />
|
<ClCompile Include="rct2\T6Importer.cpp" />
|
||||||
<ClCompile Include="ReplayManager.cpp" />
|
<ClCompile Include="ReplayManager.cpp" />
|
||||||
<ClCompile Include="ride\CableLift.cpp" />
|
<ClCompile Include="ride\CableLift.cpp" />
|
||||||
|
<ClCompile Include="ride\CarEntry.cpp" />
|
||||||
<ClCompile Include="ride\coaster\AirPoweredVerticalCoaster.cpp" />
|
<ClCompile Include="ride\coaster\AirPoweredVerticalCoaster.cpp" />
|
||||||
<ClCompile Include="ride\coaster\AlpineCoaster.cpp" />
|
<ClCompile Include="ride\coaster\AlpineCoaster.cpp" />
|
||||||
<ClCompile Include="ride\coaster\BobsleighCoaster.cpp" />
|
<ClCompile Include="ride\coaster\BobsleighCoaster.cpp" />
|
||||||
|
|
|
@ -159,7 +159,7 @@ static bool award_is_deserved_best_rollercoasters([[maybe_unused]] int32_t activ
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ride_entry_has_category(rideEntry, RIDE_CATEGORY_ROLLERCOASTER))
|
if (!ride_entry_has_category(*rideEntry, RIDE_CATEGORY_ROLLERCOASTER))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ static bool award_is_deserved_best_water_rides([[maybe_unused]] int32_t activeAw
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ride_entry_has_category(rideEntry, RIDE_CATEGORY_WATER))
|
if (!ride_entry_has_category(*rideEntry, RIDE_CATEGORY_WATER))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ static bool award_is_deserved_best_gentle_rides([[maybe_unused]] int32_t activeA
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ride_entry_has_category(rideEntry, RIDE_CATEGORY_GENTLE))
|
if (!ride_entry_has_category(*rideEntry, RIDE_CATEGORY_GENTLE))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,7 +255,7 @@ void research_finish_item(ResearchItem* researchItem)
|
||||||
if (GetRideTypeDescriptor(base_ride_type).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)
|
if (GetRideTypeDescriptor(base_ride_type).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY)
|
||||||
|| researchItem->flags & RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE)
|
|| researchItem->flags & RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE)
|
||||||
{
|
{
|
||||||
RideNaming naming = get_ride_naming(base_ride_type, rideEntry);
|
RideNaming naming = get_ride_naming(base_ride_type, *rideEntry);
|
||||||
availabilityString = STR_NEWS_ITEM_RESEARCH_NEW_RIDE_AVAILABLE;
|
availabilityString = STR_NEWS_ITEM_RESEARCH_NEW_RIDE_AVAILABLE;
|
||||||
ft.Add<StringId>(naming.Name);
|
ft.Add<StringId>(naming.Name);
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ void research_finish_item(ResearchItem* researchItem)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
availabilityString = STR_NEWS_ITEM_RESEARCH_NEW_VEHICLE_AVAILABLE;
|
availabilityString = STR_NEWS_ITEM_RESEARCH_NEW_VEHICLE_AVAILABLE;
|
||||||
RideNaming baseRideNaming = get_ride_naming(base_ride_type, rideEntry);
|
RideNaming baseRideNaming = get_ride_naming(base_ride_type, *rideEntry);
|
||||||
|
|
||||||
ft.Add<StringId>(baseRideNaming.Name);
|
ft.Add<StringId>(baseRideNaming.Name);
|
||||||
ft.Add<StringId>(rideEntry->naming.Name);
|
ft.Add<StringId>(rideEntry->naming.Name);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "../localisation/Language.h"
|
#include "../localisation/Language.h"
|
||||||
#include "../rct2/DATLimits.h"
|
#include "../rct2/DATLimits.h"
|
||||||
#include "../rct2/RCT2.h"
|
#include "../rct2/RCT2.h"
|
||||||
|
#include "../ride/CarEntry.h"
|
||||||
#include "../ride/Ride.h"
|
#include "../ride/Ride.h"
|
||||||
#include "../ride/RideData.h"
|
#include "../ride/RideData.h"
|
||||||
#include "../ride/ShopItem.h"
|
#include "../ride/ShopItem.h"
|
||||||
|
@ -50,19 +51,14 @@ static constexpr SpritePrecision PrecisionFromNumFrames(uint8_t numRotationFrame
|
||||||
return static_cast<SpritePrecision>(bitscanforward(numRotationFrames) + 1);
|
return static_cast<SpritePrecision>(bitscanforward(numRotationFrames) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RideObjectUpdateRideType(rct_ride_entry* rideEntry)
|
static void RideObjectUpdateRideType(rct_ride_entry& rideEntry)
|
||||||
{
|
{
|
||||||
if (rideEntry == nullptr)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
for (auto i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
||||||
{
|
{
|
||||||
auto oldRideType = rideEntry->ride_type[i];
|
auto oldRideType = rideEntry.ride_type[i];
|
||||||
if (oldRideType != RIDE_TYPE_NULL)
|
if (oldRideType != RIDE_TYPE_NULL)
|
||||||
{
|
{
|
||||||
rideEntry->ride_type[i] = RCT2::RCT2RideTypeToOpenRCT2RideType(oldRideType, rideEntry);
|
rideEntry.ride_type[i] = RCT2::RCT2RideTypeToOpenRCT2RideType(oldRideType, rideEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,7 +195,7 @@ void RideObject::ReadLegacy(IReadObjectContext* context, IStream* stream)
|
||||||
{
|
{
|
||||||
context->LogError(ObjectError::InvalidProperty, "Nausea multiplier too high.");
|
context->LogError(ObjectError::InvalidProperty, "Nausea multiplier too high.");
|
||||||
}
|
}
|
||||||
RideObjectUpdateRideType(&_legacyType);
|
RideObjectUpdateRideType(_legacyType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RideObject::Load()
|
void RideObject::Load()
|
||||||
|
@ -216,59 +212,59 @@ void RideObject::Load()
|
||||||
int32_t currentCarImagesOffset = _legacyType.images_offset + RCT2::ObjectLimits::MaxRideTypesPerRideEntry;
|
int32_t currentCarImagesOffset = _legacyType.images_offset + RCT2::ObjectLimits::MaxRideTypesPerRideEntry;
|
||||||
for (int32_t i = 0; i < RCT2::ObjectLimits::MaxCarTypesPerRideEntry; i++)
|
for (int32_t i = 0; i < RCT2::ObjectLimits::MaxCarTypesPerRideEntry; i++)
|
||||||
{
|
{
|
||||||
CarEntry* carEntry = &_legacyType.Cars[i];
|
CarEntry& carEntry = _legacyType.Cars[i];
|
||||||
if (carEntry->GroupEnabled(SpriteGroupType::SlopeFlat))
|
if (carEntry.GroupEnabled(SpriteGroupType::SlopeFlat))
|
||||||
{
|
{
|
||||||
// RCT2 calculates num_vertical_frames and num_horizontal_frames and overwrites these properties on the car
|
// RCT2 calculates num_vertical_frames and num_horizontal_frames and overwrites these properties on the car
|
||||||
// entry. Immediately afterwards, the two were multiplied in order to calculate base_num_frames and were never used
|
// entry. Immediately afterwards, the two were multiplied in order to calculate base_num_frames and were never used
|
||||||
// again. This has been changed to use the calculation results directly - num_vertical_frames and
|
// again. This has been changed to use the calculation results directly - num_vertical_frames and
|
||||||
// num_horizontal_frames are no longer set on the car entry.
|
// num_horizontal_frames are no longer set on the car entry.
|
||||||
// 0x6DE946
|
// 0x6DE946
|
||||||
carEntry->base_num_frames = CalculateNumVerticalFrames(carEntry) * CalculateNumHorizontalFrames(carEntry);
|
carEntry.base_num_frames = CalculateNumVerticalFrames(carEntry) * CalculateNumHorizontalFrames(carEntry);
|
||||||
uint32_t baseImageId = currentCarImagesOffset;
|
uint32_t baseImageId = currentCarImagesOffset;
|
||||||
uint32_t imageIndex = baseImageId;
|
uint32_t imageIndex = baseImageId;
|
||||||
carEntry->base_image_id = baseImageId;
|
carEntry.base_image_id = baseImageId;
|
||||||
|
|
||||||
for (uint8_t spriteGroup = 0; spriteGroup < EnumValue(SpriteGroupType::Count); spriteGroup++)
|
for (uint8_t spriteGroup = 0; spriteGroup < EnumValue(SpriteGroupType::Count); spriteGroup++)
|
||||||
{
|
{
|
||||||
if (carEntry->SpriteGroups[spriteGroup].Enabled())
|
if (carEntry.SpriteGroups[spriteGroup].Enabled())
|
||||||
{
|
{
|
||||||
carEntry->SpriteGroups[spriteGroup].imageId = imageIndex;
|
carEntry.SpriteGroups[spriteGroup].imageId = imageIndex;
|
||||||
const auto spriteCount = carEntry->base_num_frames
|
const auto spriteCount = carEntry.base_num_frames
|
||||||
* carEntry->NumRotationSprites(static_cast<SpriteGroupType>(spriteGroup))
|
* carEntry.NumRotationSprites(static_cast<SpriteGroupType>(spriteGroup))
|
||||||
* SpriteGroupMultiplier[spriteGroup];
|
* SpriteGroupMultiplier[spriteGroup];
|
||||||
imageIndex += spriteCount;
|
imageIndex += spriteCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
carEntry->NumCarImages = imageIndex - currentCarImagesOffset;
|
carEntry.NumCarImages = imageIndex - currentCarImagesOffset;
|
||||||
|
|
||||||
// Move the offset over this car’s images. Including peeps
|
// Move the offset over this car’s images. Including peeps
|
||||||
currentCarImagesOffset = imageIndex + carEntry->no_seating_rows * carEntry->NumCarImages;
|
currentCarImagesOffset = imageIndex + carEntry.no_seating_rows * carEntry.NumCarImages;
|
||||||
// 0x6DEB0D
|
// 0x6DEB0D
|
||||||
|
|
||||||
if (!(carEntry->flags & CAR_ENTRY_FLAG_RECALCULATE_SPRITE_BOUNDS))
|
if (!(carEntry.flags & CAR_ENTRY_FLAG_RECALCULATE_SPRITE_BOUNDS))
|
||||||
{
|
{
|
||||||
int32_t num_images = currentCarImagesOffset - baseImageId;
|
int32_t num_images = currentCarImagesOffset - baseImageId;
|
||||||
if (carEntry->flags & CAR_ENTRY_FLAG_SPRITE_BOUNDS_INCLUDE_INVERTED_SET)
|
if (carEntry.flags & CAR_ENTRY_FLAG_SPRITE_BOUNDS_INCLUDE_INVERTED_SET)
|
||||||
{
|
{
|
||||||
num_images *= 2;
|
num_images *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gOpenRCT2NoGraphics)
|
if (!gOpenRCT2NoGraphics)
|
||||||
{
|
{
|
||||||
set_vehicle_type_image_max_sizes(carEntry, num_images);
|
CarEntrySetImageMaxSizes(carEntry, num_images);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_peepLoadingPositions[i].empty())
|
if (!_peepLoadingPositions[i].empty())
|
||||||
{
|
{
|
||||||
carEntry->peep_loading_positions = std::move(_peepLoadingPositions[i]);
|
carEntry.peep_loading_positions = std::move(_peepLoadingPositions[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_peepLoadingWaypoints[i].empty())
|
if (!_peepLoadingWaypoints[i].empty())
|
||||||
{
|
{
|
||||||
carEntry->peep_loading_waypoints = std::move(_peepLoadingWaypoints[i]);
|
carEntry.peep_loading_waypoints = std::move(_peepLoadingWaypoints[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,22 +370,22 @@ void RideObject::ReadLegacyCar([[maybe_unused]] IReadObjectContext* context, ISt
|
||||||
ReadLegacySpriteGroups(car, spriteGroups);
|
ReadLegacySpriteGroups(car, spriteGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t RideObject::CalculateNumVerticalFrames(const CarEntry* carEntry)
|
uint8_t RideObject::CalculateNumVerticalFrames(const CarEntry& carEntry)
|
||||||
{
|
{
|
||||||
// 0x6DE90B
|
// 0x6DE90B
|
||||||
uint8_t numVerticalFrames;
|
uint8_t numVerticalFrames;
|
||||||
if (carEntry->flags & CAR_ENTRY_FLAG_OVERRIDE_NUM_VERTICAL_FRAMES)
|
if (carEntry.flags & CAR_ENTRY_FLAG_OVERRIDE_NUM_VERTICAL_FRAMES)
|
||||||
{
|
{
|
||||||
numVerticalFrames = carEntry->num_vertical_frames_override;
|
numVerticalFrames = carEntry.num_vertical_frames_override;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(carEntry->flags & CAR_ENTRY_FLAG_SPINNING_ADDITIONAL_FRAMES))
|
if (!(carEntry.flags & CAR_ENTRY_FLAG_SPINNING_ADDITIONAL_FRAMES))
|
||||||
{
|
{
|
||||||
if (carEntry->flags & CAR_ENTRY_FLAG_VEHICLE_ANIMATION
|
if (carEntry.flags & CAR_ENTRY_FLAG_VEHICLE_ANIMATION
|
||||||
&& carEntry->animation != CAR_ENTRY_ANIMATION_OBSERVATION_TOWER)
|
&& carEntry.animation != CAR_ENTRY_ANIMATION_OBSERVATION_TOWER)
|
||||||
{
|
{
|
||||||
if (!(carEntry->flags & CAR_ENTRY_FLAG_DODGEM_INUSE_LIGHTS))
|
if (!(carEntry.flags & CAR_ENTRY_FLAG_DODGEM_INUSE_LIGHTS))
|
||||||
{
|
{
|
||||||
numVerticalFrames = 4;
|
numVerticalFrames = 4;
|
||||||
}
|
}
|
||||||
|
@ -412,14 +408,14 @@ uint8_t RideObject::CalculateNumVerticalFrames(const CarEntry* carEntry)
|
||||||
return numVerticalFrames;
|
return numVerticalFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t RideObject::CalculateNumHorizontalFrames(const CarEntry* carEntry)
|
uint8_t RideObject::CalculateNumHorizontalFrames(const CarEntry& carEntry)
|
||||||
{
|
{
|
||||||
uint8_t numHorizontalFrames;
|
uint8_t numHorizontalFrames;
|
||||||
if (carEntry->flags & CAR_ENTRY_FLAG_SWINGING)
|
if (carEntry.flags & CAR_ENTRY_FLAG_SWINGING)
|
||||||
{
|
{
|
||||||
if (!(carEntry->flags & CAR_ENTRY_FLAG_SUSPENDED_SWING) && !(carEntry->flags & CAR_ENTRY_FLAG_SLIDE_SWING))
|
if (!(carEntry.flags & CAR_ENTRY_FLAG_SUSPENDED_SWING) && !(carEntry.flags & CAR_ENTRY_FLAG_SLIDE_SWING))
|
||||||
{
|
{
|
||||||
if (carEntry->flags & CAR_ENTRY_FLAG_WOODEN_WILD_MOUSE_SWING)
|
if (carEntry.flags & CAR_ENTRY_FLAG_WOODEN_WILD_MOUSE_SWING)
|
||||||
{
|
{
|
||||||
numHorizontalFrames = 3;
|
numHorizontalFrames = 3;
|
||||||
}
|
}
|
||||||
|
@ -428,7 +424,7 @@ uint8_t RideObject::CalculateNumHorizontalFrames(const CarEntry* carEntry)
|
||||||
numHorizontalFrames = 5;
|
numHorizontalFrames = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!(carEntry->flags & CAR_ENTRY_FLAG_SUSPENDED_SWING) || !(carEntry->flags & CAR_ENTRY_FLAG_SLIDE_SWING))
|
else if (!(carEntry.flags & CAR_ENTRY_FLAG_SUSPENDED_SWING) || !(carEntry.flags & CAR_ENTRY_FLAG_SLIDE_SWING))
|
||||||
{
|
{
|
||||||
numHorizontalFrames = 7;
|
numHorizontalFrames = 7;
|
||||||
}
|
}
|
||||||
|
@ -568,7 +564,7 @@ void RideObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
RideObjectUpdateRideType(&_legacyType);
|
RideObjectUpdateRideType(_legacyType);
|
||||||
PopulateTablesFromJson(context, root);
|
PopulateTablesFromJson(context, root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ private:
|
||||||
vehicle_colour_preset_list ReadJsonCarColours(json_t& jCarColours);
|
vehicle_colour_preset_list ReadJsonCarColours(json_t& jCarColours);
|
||||||
std::vector<VehicleColour> ReadJsonColourConfiguration(json_t& jColourConfig);
|
std::vector<VehicleColour> ReadJsonColourConfiguration(json_t& jColourConfig);
|
||||||
|
|
||||||
static uint8_t CalculateNumVerticalFrames(const CarEntry* carEntry);
|
static uint8_t CalculateNumVerticalFrames(const CarEntry& carEntry);
|
||||||
static uint8_t CalculateNumHorizontalFrames(const CarEntry* carEntry);
|
static uint8_t CalculateNumHorizontalFrames(const CarEntry& carEntry);
|
||||||
|
|
||||||
static bool IsRideTypeShopOrFacility(ride_type_t rideType);
|
static bool IsRideTypeShopOrFacility(ride_type_t rideType);
|
||||||
static uint8_t ParseRideCategory(const std::string& s);
|
static uint8_t ParseRideCategory(const std::string& s);
|
||||||
|
|
|
@ -848,7 +848,7 @@ ResearchItem RCT12ResearchItem::ToResearchItem() const
|
||||||
if (newResearchItem.type == Research::EntryType::Ride)
|
if (newResearchItem.type == Research::EntryType::Ride)
|
||||||
{
|
{
|
||||||
auto* rideEntry = get_ride_entry(newResearchItem.entryIndex);
|
auto* rideEntry = get_ride_entry(newResearchItem.entryIndex);
|
||||||
newResearchItem.baseRideType = rideEntry != nullptr ? RCT2::RCT2RideTypeToOpenRCT2RideType(baseRideType, rideEntry)
|
newResearchItem.baseRideType = rideEntry != nullptr ? RCT2::RCT2RideTypeToOpenRCT2RideType(baseRideType, *rideEntry)
|
||||||
: baseRideType;
|
: baseRideType;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -21,28 +21,28 @@
|
||||||
|
|
||||||
namespace RCT2
|
namespace RCT2
|
||||||
{
|
{
|
||||||
ObjectEntryIndex RCT2RideTypeToOpenRCT2RideType(uint8_t rct2RideType, const rct_ride_entry* rideEntry)
|
ObjectEntryIndex RCT2RideTypeToOpenRCT2RideType(uint8_t rct2RideType, const rct_ride_entry& rideEntry)
|
||||||
{
|
{
|
||||||
switch (rct2RideType)
|
switch (rct2RideType)
|
||||||
{
|
{
|
||||||
case RIDE_TYPE_CORKSCREW_ROLLER_COASTER:
|
case RIDE_TYPE_CORKSCREW_ROLLER_COASTER:
|
||||||
if (rideEntry != nullptr && !ride_entry_get_supported_track_pieces(rideEntry).get(TRACK_VERTICAL_LOOP))
|
if (!ride_entry_get_supported_track_pieces(rideEntry).get(TRACK_VERTICAL_LOOP))
|
||||||
return RIDE_TYPE_HYPERCOASTER;
|
return RIDE_TYPE_HYPERCOASTER;
|
||||||
return RIDE_TYPE_CORKSCREW_ROLLER_COASTER;
|
return RIDE_TYPE_CORKSCREW_ROLLER_COASTER;
|
||||||
case RIDE_TYPE_JUNIOR_ROLLER_COASTER:
|
case RIDE_TYPE_JUNIOR_ROLLER_COASTER:
|
||||||
if (rideEntry != nullptr && ride_entry_get_supported_track_pieces(rideEntry).get(TRACK_SLOPE_STEEP_DOWN))
|
if (ride_entry_get_supported_track_pieces(rideEntry).get(TRACK_SLOPE_STEEP_DOWN))
|
||||||
return RIDE_TYPE_CLASSIC_MINI_ROLLER_COASTER;
|
return RIDE_TYPE_CLASSIC_MINI_ROLLER_COASTER;
|
||||||
return RIDE_TYPE_JUNIOR_ROLLER_COASTER;
|
return RIDE_TYPE_JUNIOR_ROLLER_COASTER;
|
||||||
case RIDE_TYPE_CAR_RIDE:
|
case RIDE_TYPE_CAR_RIDE:
|
||||||
if (rideEntry != nullptr && ride_entry_get_supported_track_pieces(rideEntry).get(TRACK_SLOPE_STEEP_DOWN))
|
if (ride_entry_get_supported_track_pieces(rideEntry).get(TRACK_SLOPE_STEEP_DOWN))
|
||||||
return RIDE_TYPE_MONSTER_TRUCKS;
|
return RIDE_TYPE_MONSTER_TRUCKS;
|
||||||
return RIDE_TYPE_CAR_RIDE;
|
return RIDE_TYPE_CAR_RIDE;
|
||||||
case RIDE_TYPE_TWISTER_ROLLER_COASTER:
|
case RIDE_TYPE_TWISTER_ROLLER_COASTER:
|
||||||
if (rideEntry != nullptr && rideEntry->flags & RIDE_ENTRY_FLAG_NO_INVERSIONS)
|
if (rideEntry.flags & RIDE_ENTRY_FLAG_NO_INVERSIONS)
|
||||||
return RIDE_TYPE_HYPER_TWISTER;
|
return RIDE_TYPE_HYPER_TWISTER;
|
||||||
return RIDE_TYPE_TWISTER_ROLLER_COASTER;
|
return RIDE_TYPE_TWISTER_ROLLER_COASTER;
|
||||||
case RIDE_TYPE_STEEL_WILD_MOUSE:
|
case RIDE_TYPE_STEEL_WILD_MOUSE:
|
||||||
if (rideEntry != nullptr && !ride_entry_get_supported_track_pieces(rideEntry).get(TRACK_SLOPE_STEEP_DOWN))
|
if (!ride_entry_get_supported_track_pieces(rideEntry).get(TRACK_SLOPE_STEEP_DOWN))
|
||||||
return RIDE_TYPE_SPINNING_WILD_MOUSE;
|
return RIDE_TYPE_SPINNING_WILD_MOUSE;
|
||||||
return RIDE_TYPE_STEEL_WILD_MOUSE;
|
return RIDE_TYPE_STEEL_WILD_MOUSE;
|
||||||
|
|
||||||
|
|
|
@ -1031,7 +1031,7 @@ namespace RCT2
|
||||||
assert_struct_size(StexEntry, 7);
|
assert_struct_size(StexEntry, 7);
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
ObjectEntryIndex RCT2RideTypeToOpenRCT2RideType(uint8_t rct2RideType, const rct_ride_entry* rideEntry);
|
ObjectEntryIndex RCT2RideTypeToOpenRCT2RideType(uint8_t rct2RideType, const rct_ride_entry& rideEntry);
|
||||||
bool RCT2TrackTypeIsBooster(ride_type_t rideType, uint16_t trackType);
|
bool RCT2TrackTypeIsBooster(ride_type_t rideType, uint16_t trackType);
|
||||||
bool RCT2RideTypeNeedsConversion(uint8_t rct2RideType);
|
bool RCT2RideTypeNeedsConversion(uint8_t rct2RideType);
|
||||||
uint8_t OpenRCT2RideTypeToRCT2RideType(ObjectEntryIndex openrct2Type);
|
uint8_t OpenRCT2RideTypeToRCT2RideType(ObjectEntryIndex openrct2Type);
|
||||||
|
|
|
@ -769,7 +769,7 @@ namespace RCT2
|
||||||
auto* rideEntry = get_ride_entry(subtype);
|
auto* rideEntry = get_ride_entry(subtype);
|
||||||
if (rideEntry != nullptr)
|
if (rideEntry != nullptr)
|
||||||
{
|
{
|
||||||
rideType = RCT2RideTypeToOpenRCT2RideType(src->type, rideEntry);
|
rideType = RCT2RideTypeToOpenRCT2RideType(src->type, *rideEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ namespace RCT2
|
||||||
static_cast<RideObject*>(rawObject.get())->GetLegacyData());
|
static_cast<RideObject*>(rawObject.get())->GetLegacyData());
|
||||||
if (rideEntry != nullptr)
|
if (rideEntry != nullptr)
|
||||||
{
|
{
|
||||||
td->type = RCT2RideTypeToOpenRCT2RideType(td->type, rideEntry);
|
td->type = RCT2RideTypeToOpenRCT2RideType(td->type, *rideEntry);
|
||||||
}
|
}
|
||||||
rawObject->Unload();
|
rawObject->Unload();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,140 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* Copyright (c) 2014-2023 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 "CarEntry.h"
|
||||||
|
|
||||||
|
#include "../drawing/Drawing.h"
|
||||||
|
#include "../entity/Yaw.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
uint32_t CarEntry::NumRotationSprites(SpriteGroupType spriteGroup) const
|
||||||
|
{
|
||||||
|
return NumSpritesPrecision(SpriteGroups[static_cast<uint8_t>(spriteGroup)].spritePrecision);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t CarEntry::SpriteByYaw(int32_t yaw, SpriteGroupType spriteGroup) const
|
||||||
|
{
|
||||||
|
return YawToPrecision(yaw, SpriteGroups[static_cast<uint8_t>(spriteGroup)].spritePrecision);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CarEntry::GroupEnabled(SpriteGroupType spriteGroup) const
|
||||||
|
{
|
||||||
|
return SpriteGroups[static_cast<uint8_t>(spriteGroup)].Enabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CarEntry::GroupImageId(SpriteGroupType spriteGroup) const
|
||||||
|
{
|
||||||
|
return SpriteGroups[static_cast<uint8_t>(spriteGroup)].imageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CarEntry::SpriteOffset(SpriteGroupType spriteGroup, int32_t imageDirection, uint8_t rankIndex) const
|
||||||
|
{
|
||||||
|
return ((SpriteByYaw(imageDirection, spriteGroup) + NumRotationSprites(spriteGroup) * rankIndex) * base_num_frames)
|
||||||
|
+ GroupImageId(spriteGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* rct2: 0x006847BA
|
||||||
|
*/
|
||||||
|
void CarEntrySetImageMaxSizes(CarEntry& carEntry, int32_t numImages)
|
||||||
|
{
|
||||||
|
uint8_t bitmap[200][200] = { 0 };
|
||||||
|
|
||||||
|
rct_drawpixelinfo dpi = {
|
||||||
|
/*.bits = */ reinterpret_cast<uint8_t*>(bitmap),
|
||||||
|
/*.x = */ -100,
|
||||||
|
/*.y = */ -100,
|
||||||
|
/*.width = */ 200,
|
||||||
|
/*.height = */ 200,
|
||||||
|
/*.pitch = */ 0,
|
||||||
|
/*.zoom_level = */ ZoomLevel{ 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < numImages; ++i)
|
||||||
|
{
|
||||||
|
gfx_draw_sprite_software(&dpi, ImageId(carEntry.base_image_id + i), { 0, 0 });
|
||||||
|
}
|
||||||
|
int32_t spriteWidth = -1;
|
||||||
|
for (int32_t i = 99; i != 0; --i)
|
||||||
|
{
|
||||||
|
for (int32_t j = 0; j < 200; j++)
|
||||||
|
{
|
||||||
|
if (bitmap[j][100 - i] != 0)
|
||||||
|
{
|
||||||
|
spriteWidth = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spriteWidth != -1)
|
||||||
|
break;
|
||||||
|
|
||||||
|
for (int32_t j = 0; j < 200; j++)
|
||||||
|
{
|
||||||
|
if (bitmap[j][100 + i] != 0)
|
||||||
|
{
|
||||||
|
spriteWidth = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spriteWidth != -1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
spriteWidth++;
|
||||||
|
int32_t spriteHeightNegative = -1;
|
||||||
|
|
||||||
|
for (int32_t i = 99; i != 0; --i)
|
||||||
|
{
|
||||||
|
for (int32_t j = 0; j < 200; j++)
|
||||||
|
{
|
||||||
|
if (bitmap[100 - i][j] != 0)
|
||||||
|
{
|
||||||
|
spriteHeightNegative = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spriteHeightNegative != -1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
spriteHeightNegative++;
|
||||||
|
|
||||||
|
int32_t spriteHeightPositive = -1;
|
||||||
|
|
||||||
|
for (int32_t i = 99; i != 0; --i)
|
||||||
|
{
|
||||||
|
for (int32_t j = 0; j < 200; j++)
|
||||||
|
{
|
||||||
|
if (bitmap[100 + i][j] != 0)
|
||||||
|
{
|
||||||
|
spriteHeightPositive = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spriteHeightPositive != -1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
spriteHeightPositive++;
|
||||||
|
|
||||||
|
// Moved from object paint
|
||||||
|
|
||||||
|
if (carEntry.flags & CAR_ENTRY_FLAG_SPRITE_BOUNDS_INCLUDE_INVERTED_SET)
|
||||||
|
{
|
||||||
|
spriteHeightNegative += 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
carEntry.sprite_width = spriteWidth;
|
||||||
|
carEntry.sprite_height_negative = spriteHeightNegative;
|
||||||
|
carEntry.sprite_height_positive = spriteHeightPositive;
|
||||||
|
}
|
|
@ -196,3 +196,5 @@ struct CarEntry
|
||||||
uint32_t GroupImageId(SpriteGroupType spriteGroup) const;
|
uint32_t GroupImageId(SpriteGroupType spriteGroup) const;
|
||||||
uint32_t SpriteOffset(SpriteGroupType spriteGroup, int32_t imageDirection, uint8_t rankIndex) const;
|
uint32_t SpriteOffset(SpriteGroupType spriteGroup, int32_t imageDirection, uint8_t rankIndex) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void CarEntrySetImageMaxSizes(CarEntry& carEntry, int32_t numImages);
|
|
@ -4214,14 +4214,14 @@ void Ride::SetNameToDefault()
|
||||||
/**
|
/**
|
||||||
* This will return the name of the ride, as seen in the New Ride window.
|
* This will return the name of the ride, as seen in the New Ride window.
|
||||||
*/
|
*/
|
||||||
RideNaming get_ride_naming(const ride_type_t rideType, rct_ride_entry* rideEntry)
|
RideNaming get_ride_naming(const ride_type_t rideType, const rct_ride_entry& rideEntry)
|
||||||
{
|
{
|
||||||
if (!GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY))
|
if (!GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_LIST_VEHICLES_SEPARATELY))
|
||||||
{
|
{
|
||||||
return GetRideTypeDescriptor(rideType).Naming;
|
return GetRideTypeDescriptor(rideType).Naming;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rideEntry->naming;
|
return rideEntry.naming;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4485,105 +4485,6 @@ bool ride_has_any_track_elements(const Ride& ride)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* rct2: 0x006847BA
|
|
||||||
*/
|
|
||||||
void set_vehicle_type_image_max_sizes(CarEntry* vehicle_type, int32_t num_images)
|
|
||||||
{
|
|
||||||
uint8_t bitmap[200][200] = { 0 };
|
|
||||||
|
|
||||||
rct_drawpixelinfo dpi = {
|
|
||||||
/*.bits = */ reinterpret_cast<uint8_t*>(bitmap),
|
|
||||||
/*.x = */ -100,
|
|
||||||
/*.y = */ -100,
|
|
||||||
/*.width = */ 200,
|
|
||||||
/*.height = */ 200,
|
|
||||||
/*.pitch = */ 0,
|
|
||||||
/*.zoom_level = */ ZoomLevel{ 0 },
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < num_images; ++i)
|
|
||||||
{
|
|
||||||
gfx_draw_sprite_software(&dpi, ImageId(vehicle_type->base_image_id + i), { 0, 0 });
|
|
||||||
}
|
|
||||||
int32_t al = -1;
|
|
||||||
for (int32_t i = 99; i != 0; --i)
|
|
||||||
{
|
|
||||||
for (int32_t j = 0; j < 200; j++)
|
|
||||||
{
|
|
||||||
if (bitmap[j][100 - i] != 0)
|
|
||||||
{
|
|
||||||
al = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (al != -1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
for (int32_t j = 0; j < 200; j++)
|
|
||||||
{
|
|
||||||
if (bitmap[j][100 + i] != 0)
|
|
||||||
{
|
|
||||||
al = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (al != -1)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
al++;
|
|
||||||
int32_t bl = -1;
|
|
||||||
|
|
||||||
for (int32_t i = 99; i != 0; --i)
|
|
||||||
{
|
|
||||||
for (int32_t j = 0; j < 200; j++)
|
|
||||||
{
|
|
||||||
if (bitmap[100 - i][j] != 0)
|
|
||||||
{
|
|
||||||
bl = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bl != -1)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
bl++;
|
|
||||||
|
|
||||||
int32_t bh = -1;
|
|
||||||
|
|
||||||
for (int32_t i = 99; i != 0; --i)
|
|
||||||
{
|
|
||||||
for (int32_t j = 0; j < 200; j++)
|
|
||||||
{
|
|
||||||
if (bitmap[100 + i][j] != 0)
|
|
||||||
{
|
|
||||||
bh = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bh != -1)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
bh++;
|
|
||||||
|
|
||||||
// Moved from object paint
|
|
||||||
|
|
||||||
if (vehicle_type->flags & CAR_ENTRY_FLAG_SPRITE_BOUNDS_INCLUDE_INVERTED_SET)
|
|
||||||
{
|
|
||||||
bl += 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
vehicle_type->sprite_width = al;
|
|
||||||
vehicle_type->sprite_height_negative = bl;
|
|
||||||
vehicle_type->sprite_height_positive = bh;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x006B59C6
|
* rct2: 0x006B59C6
|
||||||
|
@ -4711,7 +4612,7 @@ struct NecessarySpriteGroup
|
||||||
};
|
};
|
||||||
|
|
||||||
// Finds track pieces that a given ride entry has sprites for
|
// Finds track pieces that a given ride entry has sprites for
|
||||||
OpenRCT2::BitSet<TRACK_GROUP_COUNT> ride_entry_get_supported_track_pieces(const rct_ride_entry* rideEntry)
|
OpenRCT2::BitSet<TRACK_GROUP_COUNT> ride_entry_get_supported_track_pieces(const rct_ride_entry& rideEntry)
|
||||||
{
|
{
|
||||||
// TODO: Use a std::span when C++20 available as 6 is due to jagged array
|
// TODO: Use a std::span when C++20 available as 6 is due to jagged array
|
||||||
static const std::array<NecessarySpriteGroup, 6> trackPieceRequiredSprites[TRACK_GROUP_COUNT] = {
|
static const std::array<NecessarySpriteGroup, 6> trackPieceRequiredSprites[TRACK_GROUP_COUNT] = {
|
||||||
|
@ -4858,7 +4759,7 @@ OpenRCT2::BitSet<TRACK_GROUP_COUNT> ride_entry_get_supported_track_pieces(const
|
||||||
// exception, at least)
|
// exception, at least)
|
||||||
auto supportedPieces = OpenRCT2::BitSet<TRACK_GROUP_COUNT>();
|
auto supportedPieces = OpenRCT2::BitSet<TRACK_GROUP_COUNT>();
|
||||||
supportedPieces.flip();
|
supportedPieces.flip();
|
||||||
auto defaultVehicle = rideEntry->GetDefaultCar();
|
auto defaultVehicle = rideEntry.GetDefaultCar();
|
||||||
if (defaultVehicle != nullptr)
|
if (defaultVehicle != nullptr)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < std::size(trackPieceRequiredSprites); i++)
|
for (size_t i = 0; i < std::size(trackPieceRequiredSprites); i++)
|
||||||
|
@ -5424,9 +5325,9 @@ void fix_invalid_vehicle_sprite_sizes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ride_entry_has_category(const rct_ride_entry* rideEntry, uint8_t category)
|
bool ride_entry_has_category(const rct_ride_entry& rideEntry, uint8_t category)
|
||||||
{
|
{
|
||||||
auto rideType = rideEntry->GetFirstNonNullRideType();
|
auto rideType = rideEntry.GetFirstNonNullRideType();
|
||||||
return GetRideTypeDescriptor(rideType).Category == category;
|
return GetRideTypeDescriptor(rideType).Category == category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1073,7 +1073,7 @@ void ride_fix_breakdown(Ride& ride, int32_t reliabilityIncreaseFactor);
|
||||||
uint8_t ride_entry_get_vehicle_at_position(int32_t rideEntryIndex, int32_t numCarsPerTrain, int32_t position);
|
uint8_t ride_entry_get_vehicle_at_position(int32_t rideEntryIndex, int32_t numCarsPerTrain, int32_t position);
|
||||||
void ride_update_vehicle_colours(const Ride& ride);
|
void ride_update_vehicle_colours(const Ride& ride);
|
||||||
|
|
||||||
OpenRCT2::BitSet<TRACK_GROUP_COUNT> ride_entry_get_supported_track_pieces(const rct_ride_entry* rideEntry);
|
OpenRCT2::BitSet<TRACK_GROUP_COUNT> ride_entry_get_supported_track_pieces(const rct_ride_entry& rideEntry);
|
||||||
|
|
||||||
enum class RideSetSetting : uint8_t;
|
enum class RideSetSetting : uint8_t;
|
||||||
money32 set_operating_setting(RideId rideId, RideSetSetting setting, uint8_t value);
|
money32 set_operating_setting(RideId rideId, RideSetSetting setting, uint8_t value);
|
||||||
|
@ -1095,7 +1095,7 @@ bool ride_has_ratings(const Ride& ride);
|
||||||
|
|
||||||
int32_t get_booster_speed(ride_type_t rideType, int32_t rawSpeed);
|
int32_t get_booster_speed(ride_type_t rideType, int32_t rawSpeed);
|
||||||
void fix_invalid_vehicle_sprite_sizes();
|
void fix_invalid_vehicle_sprite_sizes();
|
||||||
bool ride_entry_has_category(const rct_ride_entry* rideEntry, uint8_t category);
|
bool ride_entry_has_category(const rct_ride_entry& rideEntry, uint8_t category);
|
||||||
|
|
||||||
int32_t ride_get_entry_index(int32_t rideType, int32_t rideSubType);
|
int32_t ride_get_entry_index(int32_t rideType, int32_t rideSubType);
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../rct2/DATLimits.h"
|
#include "../rct2/DATLimits.h"
|
||||||
|
#include "CarEntry.h"
|
||||||
#include "RideColour.h"
|
#include "RideColour.h"
|
||||||
#include "RideTypes.h"
|
#include "RideTypes.h"
|
||||||
#include "ShopItem.h"
|
#include "ShopItem.h"
|
||||||
#include "VehicleColour.h"
|
#include "VehicleColour.h"
|
||||||
#include "VehicleEntry.h"
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
@ -100,5 +100,4 @@ struct rct_ride_entry
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_vehicle_type_image_max_sizes(CarEntry* vehicle_type, int32_t num_images);
|
RideNaming get_ride_naming(const ride_type_t rideType, const rct_ride_entry& rideEntry);
|
||||||
RideNaming get_ride_naming(const ride_type_t rideType, rct_ride_entry* rideEntry);
|
|
||||||
|
|
|
@ -1834,13 +1834,13 @@ static SoundIdVolume sub_6D7AC0(
|
||||||
return { currentSoundId, currentVolume };
|
return { currentSoundId, currentVolume };
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vehicle::GetLiftHillSound(Ride* curRide, SoundIdVolume& curSound)
|
void Vehicle::GetLiftHillSound(const Ride& curRide, SoundIdVolume& curSound)
|
||||||
{
|
{
|
||||||
scream_sound_id = OpenRCT2::Audio::SoundId::Null;
|
scream_sound_id = OpenRCT2::Audio::SoundId::Null;
|
||||||
if (curRide->type < std::size(RideTypeDescriptors))
|
if (curRide.type < std::size(RideTypeDescriptors))
|
||||||
{
|
{
|
||||||
// Get lift hill sound
|
// Get lift hill sound
|
||||||
curSound.id = GetRideTypeDescriptor(curRide->type).LiftData.sound_id;
|
curSound.id = GetRideTypeDescriptor(curRide.type).LiftData.sound_id;
|
||||||
curSound.volume = 243;
|
curSound.volume = 243;
|
||||||
if (!(sound2_flags & VEHICLE_SOUND2_FLAGS_LIFT_HILL))
|
if (!(sound2_flags & VEHICLE_SOUND2_FLAGS_LIFT_HILL))
|
||||||
curSound.id = OpenRCT2::Audio::SoundId::Null;
|
curSound.id = OpenRCT2::Audio::SoundId::Null;
|
||||||
|
@ -5188,11 +5188,11 @@ void Vehicle::KillAllPassengersInTrain()
|
||||||
for (Vehicle* trainCar = GetEntity<Vehicle>(sprite_index); trainCar != nullptr;
|
for (Vehicle* trainCar = GetEntity<Vehicle>(sprite_index); trainCar != nullptr;
|
||||||
trainCar = GetEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
trainCar = GetEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||||
{
|
{
|
||||||
trainCar->KillPassengers(curRide);
|
trainCar->KillPassengers(*curRide);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vehicle::KillPassengers(Ride* curRide)
|
void Vehicle::KillPassengers(const Ride& curRide)
|
||||||
{
|
{
|
||||||
if (num_peeps != next_free_seat)
|
if (num_peeps != next_free_seat)
|
||||||
return;
|
return;
|
||||||
|
@ -5484,7 +5484,7 @@ void Vehicle::UpdateSound()
|
||||||
{
|
{
|
||||||
if (velocity < 0x40000 || scream_sound_id != OpenRCT2::Audio::SoundId::Null)
|
if (velocity < 0x40000 || scream_sound_id != OpenRCT2::Audio::SoundId::Null)
|
||||||
{
|
{
|
||||||
GetLiftHillSound(curRide, screamSound);
|
GetLiftHillSound(*curRide, screamSound);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5506,7 +5506,7 @@ void Vehicle::UpdateSound()
|
||||||
{
|
{
|
||||||
if (velocity < 0x40000 || scream_sound_id != OpenRCT2::Audio::SoundId::Null)
|
if (velocity < 0x40000 || scream_sound_id != OpenRCT2::Audio::SoundId::Null)
|
||||||
{
|
{
|
||||||
GetLiftHillSound(curRide, screamSound);
|
GetLiftHillSound(*curRide, screamSound);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5536,7 +5536,7 @@ void Vehicle::UpdateSound()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GetLiftHillSound(curRide, screamSound);
|
GetLiftHillSound(*curRide, screamSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Friction sound
|
// Friction sound
|
||||||
|
@ -6188,7 +6188,8 @@ void Vehicle::UpdateVelocity()
|
||||||
_vehicleVelocityF64E0C = (nextVelocity >> 10) * 42;
|
_vehicleVelocityF64E0C = (nextVelocity >> 10) * 42;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void block_brakes_open_previous_section(Ride& ride, const CoordsXYZ& vehicleTrackLocation, TileElement* tileElement)
|
static void block_brakes_open_previous_section(
|
||||||
|
const Ride& ride, const CoordsXYZ& vehicleTrackLocation, TileElement* tileElement)
|
||||||
{
|
{
|
||||||
auto location = vehicleTrackLocation;
|
auto location = vehicleTrackLocation;
|
||||||
track_begin_end trackBeginEnd, slowTrackBeginEnd;
|
track_begin_end trackBeginEnd, slowTrackBeginEnd;
|
||||||
|
@ -7390,7 +7391,7 @@ void Vehicle::Sub6DBF3E()
|
||||||
*
|
*
|
||||||
* rct2: 0x006DB08C
|
* rct2: 0x006DB08C
|
||||||
*/
|
*/
|
||||||
bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* curRide, rct_ride_entry* rideEntry)
|
bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, const Ride& curRide, const rct_ride_entry& rideEntry)
|
||||||
{
|
{
|
||||||
CoordsXYZD location = {};
|
CoordsXYZD location = {};
|
||||||
|
|
||||||
|
@ -7415,13 +7416,13 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur
|
||||||
|
|
||||||
if (trackType == TrackElemType::BlockBrakes || trackType == TrackElemType::EndStation)
|
if (trackType == TrackElemType::BlockBrakes || trackType == TrackElemType::EndStation)
|
||||||
{
|
{
|
||||||
if (!(rideEntry->Cars[0].flags & CAR_ENTRY_FLAG_POWERED))
|
if (!(rideEntry.Cars[0].flags & CAR_ENTRY_FLAG_POWERED))
|
||||||
{
|
{
|
||||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::BlockBrakeRelease, TrackLocation);
|
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::BlockBrakeRelease, TrackLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MapInvalidateElement(TrackLocation, tileElement);
|
MapInvalidateElement(TrackLocation, tileElement);
|
||||||
block_brakes_open_previous_section(*curRide, TrackLocation, tileElement);
|
block_brakes_open_previous_section(curRide, TrackLocation, tileElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7515,7 +7516,7 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur
|
||||||
{
|
{
|
||||||
trackType = tileElement->AsTrack()->GetTrackType();
|
trackType = tileElement->AsTrack()->GetTrackType();
|
||||||
if (trackType == TrackElemType::Flat
|
if (trackType == TrackElemType::Flat
|
||||||
|| ((curRide->lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING) && tileElement->AsTrack()->IsStation()))
|
|| ((curRide.lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING) && tileElement->AsTrack()->IsStation()))
|
||||||
{
|
{
|
||||||
UpdateGoKartAttemptSwitchLanes();
|
UpdateGoKartAttemptSwitchLanes();
|
||||||
}
|
}
|
||||||
|
@ -7526,11 +7527,11 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur
|
||||||
{
|
{
|
||||||
TileCoordsXYZ curLocation{ TrackLocation };
|
TileCoordsXYZ curLocation{ TrackLocation };
|
||||||
|
|
||||||
if (curLocation == curRide->ChairliftBullwheelLocation[1])
|
if (curLocation == curRide.ChairliftBullwheelLocation[1])
|
||||||
{
|
{
|
||||||
TrackSubposition = VehicleTrackSubposition::ChairliftEndBullwheel;
|
TrackSubposition = VehicleTrackSubposition::ChairliftEndBullwheel;
|
||||||
}
|
}
|
||||||
else if (curLocation == curRide->ChairliftBullwheelLocation[0])
|
else if (curLocation == curRide.ChairliftBullwheelLocation[0])
|
||||||
{
|
{
|
||||||
TrackSubposition = VehicleTrackSubposition::ChairliftStartBullwheel;
|
TrackSubposition = VehicleTrackSubposition::ChairliftStartBullwheel;
|
||||||
}
|
}
|
||||||
|
@ -7571,7 +7572,7 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* cur
|
||||||
*
|
*
|
||||||
* rct2: 0x006DAEB9
|
* rct2: 0x006DAEB9
|
||||||
*/
|
*/
|
||||||
bool Vehicle::UpdateTrackMotionForwards(CarEntry* carEntry, Ride* curRide, rct_ride_entry* rideEntry)
|
bool Vehicle::UpdateTrackMotionForwards(CarEntry* carEntry, const Ride& curRide, const rct_ride_entry& rideEntry)
|
||||||
{
|
{
|
||||||
EntityId otherVehicleIndex = EntityId::GetNull();
|
EntityId otherVehicleIndex = EntityId::GetNull();
|
||||||
loc_6DAEB9:
|
loc_6DAEB9:
|
||||||
|
@ -7594,9 +7595,9 @@ loc_6DAEB9:
|
||||||
}
|
}
|
||||||
else if (trackType == TrackElemType::Brakes)
|
else if (trackType == TrackElemType::Brakes)
|
||||||
{
|
{
|
||||||
bool hasBrakesFailure = curRide->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN
|
bool hasBrakesFailure = curRide.lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN
|
||||||
&& curRide->breakdown_reason_pending == BREAKDOWN_BRAKES_FAILURE;
|
&& curRide.breakdown_reason_pending == BREAKDOWN_BRAKES_FAILURE;
|
||||||
if (!hasBrakesFailure || curRide->mechanic_status == RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES)
|
if (!hasBrakesFailure || curRide.mechanic_status == RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES)
|
||||||
{
|
{
|
||||||
auto brakeSpeed = brake_speed << 16;
|
auto brakeSpeed = brake_speed << 16;
|
||||||
if (brakeSpeed < _vehicleVelocityF64E08)
|
if (brakeSpeed < _vehicleVelocityF64E08)
|
||||||
|
@ -7615,22 +7616,22 @@ loc_6DAEB9:
|
||||||
}
|
}
|
||||||
else if (trackType == TrackElemType::Booster)
|
else if (trackType == TrackElemType::Booster)
|
||||||
{
|
{
|
||||||
auto boosterSpeed = get_booster_speed(curRide->type, (brake_speed << 16));
|
auto boosterSpeed = get_booster_speed(curRide.type, (brake_speed << 16));
|
||||||
if (boosterSpeed > _vehicleVelocityF64E08)
|
if (boosterSpeed > _vehicleVelocityF64E08)
|
||||||
{
|
{
|
||||||
acceleration = GetRideTypeDescriptor(curRide->type).OperatingSettings.BoosterAcceleration
|
acceleration = GetRideTypeDescriptor(curRide.type).OperatingSettings.BoosterAcceleration
|
||||||
<< 16; //_vehicleVelocityF64E08 * 1.2;
|
<< 16; //_vehicleVelocityF64E08 * 1.2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (rideEntry->flags & RIDE_ENTRY_FLAG_RIDER_CONTROLS_SPEED && num_peeps > 0)
|
else if (rideEntry.flags & RIDE_ENTRY_FLAG_RIDER_CONTROLS_SPEED && num_peeps > 0)
|
||||||
{
|
{
|
||||||
acceleration += CalculateRiderBraking();
|
acceleration += CalculateRiderBraking();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((trackType == TrackElemType::Flat && curRide->type == RIDE_TYPE_REVERSE_FREEFALL_COASTER)
|
if ((trackType == TrackElemType::Flat && curRide.type == RIDE_TYPE_REVERSE_FREEFALL_COASTER)
|
||||||
|| (trackType == TrackElemType::PoweredLift))
|
|| (trackType == TrackElemType::PoweredLift))
|
||||||
{
|
{
|
||||||
acceleration = GetRideTypeDescriptor(curRide->type).OperatingSettings.PoweredLiftAcceleration << 16;
|
acceleration = GetRideTypeDescriptor(curRide.type).OperatingSettings.PoweredLiftAcceleration << 16;
|
||||||
}
|
}
|
||||||
if (trackType == TrackElemType::BrakeForDrop)
|
if (trackType == TrackElemType::BrakeForDrop)
|
||||||
{
|
{
|
||||||
|
@ -7693,7 +7694,7 @@ loc_6DAEB9:
|
||||||
uint8_t moveInfovehicleSpriteType;
|
uint8_t moveInfovehicleSpriteType;
|
||||||
{
|
{
|
||||||
auto nextVehiclePosition = TrackLocation
|
auto nextVehiclePosition = TrackLocation
|
||||||
+ CoordsXYZ{ moveInfo->x, moveInfo->y, moveInfo->z + GetRideTypeDescriptor(curRide->type).Heights.VehicleZOffset };
|
+ CoordsXYZ{ moveInfo->x, moveInfo->y, moveInfo->z + GetRideTypeDescriptor(curRide.type).Heights.VehicleZOffset };
|
||||||
|
|
||||||
uint8_t remainingDistanceFlags = 0;
|
uint8_t remainingDistanceFlags = 0;
|
||||||
if (nextVehiclePosition.x != _vehicleCurPosition.x)
|
if (nextVehiclePosition.x != _vehicleCurPosition.x)
|
||||||
|
@ -7764,7 +7765,7 @@ loc_6DAEB9:
|
||||||
auto head = otherVeh->TrainHead();
|
auto head = otherVeh->TrainHead();
|
||||||
|
|
||||||
auto velocityDelta = abs(velocity - head->velocity);
|
auto velocityDelta = abs(velocity - head->velocity);
|
||||||
if (!(rideEntry->flags & RIDE_ENTRY_FLAG_DISABLE_COLLISION_CRASHES))
|
if (!(rideEntry.flags & RIDE_ENTRY_FLAG_DISABLE_COLLISION_CRASHES))
|
||||||
{
|
{
|
||||||
if (velocityDelta > 0xE0000)
|
if (velocityDelta > 0xE0000)
|
||||||
{
|
{
|
||||||
|
@ -7803,18 +7804,18 @@ loc_6DAEB9:
|
||||||
goto loc_6DAEB9;
|
goto loc_6DAEB9;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PitchAndRoll PitchAndRollEnd(Ride* curRide, bool useInvertedSprites, uint16_t trackType, TileElement* tileElement)
|
static PitchAndRoll PitchAndRollEnd(const Ride& curRide, bool useInvertedSprites, uint16_t trackType, TileElement* tileElement)
|
||||||
{
|
{
|
||||||
bool isInverted = useInvertedSprites ^ tileElement->AsTrack()->IsInverted();
|
bool isInverted = useInvertedSprites ^ tileElement->AsTrack()->IsInverted();
|
||||||
const auto& ted = GetTrackElementDescriptor(trackType);
|
const auto& ted = GetTrackElementDescriptor(trackType);
|
||||||
return { ted.Definition.vangle_end, track_get_actual_bank_2(curRide->type, isInverted, ted.Definition.bank_end) };
|
return { ted.Definition.vangle_end, track_get_actual_bank_2(curRide.type, isInverted, ted.Definition.bank_end) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x006DBAA6
|
* rct2: 0x006DBAA6
|
||||||
*/
|
*/
|
||||||
bool Vehicle::UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* curRide, uint16_t* progress)
|
bool Vehicle::UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, const Ride& curRide, uint16_t* progress)
|
||||||
{
|
{
|
||||||
auto pitchAndRollStart = TrackPitchAndRollStart(trackType);
|
auto pitchAndRollStart = TrackPitchAndRollStart(trackType);
|
||||||
TileElement* tileElement = MapGetTrackElementAtOfTypeSeq(TrackLocation, trackType, 0);
|
TileElement* tileElement = MapGetTrackElementAtOfTypeSeq(TrackLocation, trackType, 0);
|
||||||
|
@ -7871,7 +7872,7 @@ bool Vehicle::UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* cu
|
||||||
|
|
||||||
// Update VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES
|
// Update VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES
|
||||||
ClearUpdateFlag(VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES);
|
ClearUpdateFlag(VEHICLE_UPDATE_FLAG_USE_INVERTED_SPRITES);
|
||||||
if (GetRideTypeDescriptor(curRide->type).HasFlag(RIDE_TYPE_FLAG_HAS_ALTERNATIVE_TRACK_TYPE))
|
if (GetRideTypeDescriptor(curRide.type).HasFlag(RIDE_TYPE_FLAG_HAS_ALTERNATIVE_TRACK_TYPE))
|
||||||
{
|
{
|
||||||
if (tileElement->AsTrack()->IsInverted())
|
if (tileElement->AsTrack()->IsInverted())
|
||||||
{
|
{
|
||||||
|
@ -7908,11 +7909,11 @@ bool Vehicle::UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* cu
|
||||||
{
|
{
|
||||||
TileCoordsXYZ curLocation{ TrackLocation };
|
TileCoordsXYZ curLocation{ TrackLocation };
|
||||||
|
|
||||||
if (curLocation == curRide->ChairliftBullwheelLocation[1])
|
if (curLocation == curRide.ChairliftBullwheelLocation[1])
|
||||||
{
|
{
|
||||||
TrackSubposition = VehicleTrackSubposition::ChairliftEndBullwheel;
|
TrackSubposition = VehicleTrackSubposition::ChairliftEndBullwheel;
|
||||||
}
|
}
|
||||||
else if (curLocation == curRide->ChairliftBullwheelLocation[0])
|
else if (curLocation == curRide.ChairliftBullwheelLocation[0])
|
||||||
{
|
{
|
||||||
TrackSubposition = VehicleTrackSubposition::ChairliftStartBullwheel;
|
TrackSubposition = VehicleTrackSubposition::ChairliftStartBullwheel;
|
||||||
}
|
}
|
||||||
|
@ -7969,14 +7970,14 @@ bool Vehicle::UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* cu
|
||||||
*
|
*
|
||||||
* rct2: 0x006DBA33
|
* rct2: 0x006DBA33
|
||||||
*/
|
*/
|
||||||
bool Vehicle::UpdateTrackMotionBackwards(CarEntry* carEntry, Ride* curRide, rct_ride_entry* rideEntry)
|
bool Vehicle::UpdateTrackMotionBackwards(CarEntry* carEntry, const Ride& curRide, const rct_ride_entry& rideEntry)
|
||||||
{
|
{
|
||||||
EntityId otherVehicleIndex = EntityId::GetNull();
|
EntityId otherVehicleIndex = EntityId::GetNull();
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
auto trackType = GetTrackType();
|
auto trackType = GetTrackType();
|
||||||
if (trackType == TrackElemType::Flat && curRide->type == RIDE_TYPE_REVERSE_FREEFALL_COASTER)
|
if (trackType == TrackElemType::Flat && curRide.type == RIDE_TYPE_REVERSE_FREEFALL_COASTER)
|
||||||
{
|
{
|
||||||
int32_t unkVelocity = _vehicleVelocityF64E08;
|
int32_t unkVelocity = _vehicleVelocityF64E08;
|
||||||
if (unkVelocity < -524288)
|
if (unkVelocity < -524288)
|
||||||
|
@ -7996,10 +7997,10 @@ bool Vehicle::UpdateTrackMotionBackwards(CarEntry* carEntry, Ride* curRide, rct_
|
||||||
|
|
||||||
if (trackType == TrackElemType::Booster)
|
if (trackType == TrackElemType::Booster)
|
||||||
{
|
{
|
||||||
auto boosterSpeed = get_booster_speed(curRide->type, (brake_speed << 16));
|
auto boosterSpeed = get_booster_speed(curRide.type, (brake_speed << 16));
|
||||||
if (boosterSpeed < _vehicleVelocityF64E08)
|
if (boosterSpeed < _vehicleVelocityF64E08)
|
||||||
{
|
{
|
||||||
acceleration = GetRideTypeDescriptor(curRide->type).OperatingSettings.BoosterAcceleration << 16;
|
acceleration = GetRideTypeDescriptor(curRide.type).OperatingSettings.BoosterAcceleration << 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8024,7 +8025,7 @@ bool Vehicle::UpdateTrackMotionBackwards(CarEntry* carEntry, Ride* curRide, rct_
|
||||||
const rct_vehicle_info* moveInfo = GetMoveInfo();
|
const rct_vehicle_info* moveInfo = GetMoveInfo();
|
||||||
auto nextVehiclePosition = TrackLocation
|
auto nextVehiclePosition = TrackLocation
|
||||||
+ CoordsXYZ{ moveInfo->x, moveInfo->y,
|
+ CoordsXYZ{ moveInfo->x, moveInfo->y,
|
||||||
moveInfo->z + GetRideTypeDescriptor(curRide->type).Heights.VehicleZOffset };
|
moveInfo->z + GetRideTypeDescriptor(curRide.type).Heights.VehicleZOffset };
|
||||||
|
|
||||||
uint8_t remainingDistanceFlags = 0;
|
uint8_t remainingDistanceFlags = 0;
|
||||||
if (nextVehiclePosition.x != _vehicleCurPosition.x)
|
if (nextVehiclePosition.x != _vehicleCurPosition.x)
|
||||||
|
@ -8071,7 +8072,7 @@ bool Vehicle::UpdateTrackMotionBackwards(CarEntry* carEntry, Ride* curRide, rct_
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(rideEntry->flags & RIDE_ENTRY_FLAG_DISABLE_COLLISION_CRASHES))
|
if (!(rideEntry.flags & RIDE_ENTRY_FLAG_DISABLE_COLLISION_CRASHES))
|
||||||
{
|
{
|
||||||
if (abs(v4->velocity - v3->velocity) > 0xE0000)
|
if (abs(v4->velocity - v3->velocity) > 0xE0000)
|
||||||
{
|
{
|
||||||
|
@ -8117,7 +8118,7 @@ bool Vehicle::UpdateTrackMotionBackwards(CarEntry* carEntry, Ride* curRide, rct_
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void Vehicle::UpdateTrackMotionMiniGolfVehicle(Ride* curRide, rct_ride_entry* rideEntry, CarEntry* carEntry)
|
void Vehicle::UpdateTrackMotionMiniGolfVehicle(const Ride& curRide, const rct_ride_entry& rideEntry, CarEntry* carEntry)
|
||||||
{
|
{
|
||||||
EntityId otherVehicleIndex = EntityId::GetNull();
|
EntityId otherVehicleIndex = EntityId::GetNull();
|
||||||
TileElement* tileElement = nullptr;
|
TileElement* tileElement = nullptr;
|
||||||
|
@ -8132,7 +8133,7 @@ void Vehicle::UpdateTrackMotionMiniGolfVehicle(Ride* curRide, rct_ride_entry* ri
|
||||||
}
|
}
|
||||||
if (remaining_distance >= 0 && remaining_distance < 0x368A)
|
if (remaining_distance >= 0 && remaining_distance < 0x368A)
|
||||||
{
|
{
|
||||||
Loc6DCE02(*curRide);
|
Loc6DCE02(curRide);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sound2_flags &= ~VEHICLE_SOUND2_FLAGS_LIFT_HILL;
|
sound2_flags &= ~VEHICLE_SOUND2_FLAGS_LIFT_HILL;
|
||||||
|
@ -8392,7 +8393,7 @@ loc_6DC743:
|
||||||
|
|
||||||
// loc_6DC8A1
|
// loc_6DC8A1
|
||||||
trackPos = { TrackLocation.x + moveInfo->x, TrackLocation.y + moveInfo->y,
|
trackPos = { TrackLocation.x + moveInfo->x, TrackLocation.y + moveInfo->y,
|
||||||
TrackLocation.z + moveInfo->z + GetRideTypeDescriptor(curRide->type).Heights.VehicleZOffset };
|
TrackLocation.z + moveInfo->z + GetRideTypeDescriptor(curRide.type).Heights.VehicleZOffset };
|
||||||
|
|
||||||
remaining_distance -= 0x368A;
|
remaining_distance -= 0x368A;
|
||||||
if (remaining_distance < 0)
|
if (remaining_distance < 0)
|
||||||
|
@ -8405,7 +8406,7 @@ loc_6DC743:
|
||||||
bank_rotation = moveInfo->bank_rotation;
|
bank_rotation = moveInfo->bank_rotation;
|
||||||
Pitch = moveInfo->Pitch;
|
Pitch = moveInfo->Pitch;
|
||||||
|
|
||||||
if (rideEntry->Cars[0].flags & CAR_ENTRY_FLAG_WOODEN_WILD_MOUSE_SWING)
|
if (rideEntry.Cars[0].flags & CAR_ENTRY_FLAG_WOODEN_WILD_MOUSE_SWING)
|
||||||
{
|
{
|
||||||
if (Pitch != 0)
|
if (Pitch != 0)
|
||||||
{
|
{
|
||||||
|
@ -8508,7 +8509,7 @@ loc_6DCA9A:
|
||||||
loc_6DCC2C:
|
loc_6DCC2C:
|
||||||
moveInfo = GetMoveInfo();
|
moveInfo = GetMoveInfo();
|
||||||
trackPos = { TrackLocation.x + moveInfo->x, TrackLocation.y + moveInfo->y,
|
trackPos = { TrackLocation.x + moveInfo->x, TrackLocation.y + moveInfo->y,
|
||||||
TrackLocation.z + moveInfo->z + GetRideTypeDescriptor(curRide->type).Heights.VehicleZOffset };
|
TrackLocation.z + moveInfo->z + GetRideTypeDescriptor(curRide.type).Heights.VehicleZOffset };
|
||||||
|
|
||||||
remaining_distance -= 0x368A;
|
remaining_distance -= 0x368A;
|
||||||
if (remaining_distance < 0)
|
if (remaining_distance < 0)
|
||||||
|
@ -8521,7 +8522,7 @@ loc_6DCC2C:
|
||||||
bank_rotation = moveInfo->bank_rotation;
|
bank_rotation = moveInfo->bank_rotation;
|
||||||
Pitch = moveInfo->Pitch;
|
Pitch = moveInfo->Pitch;
|
||||||
|
|
||||||
if (rideEntry->Cars[0].flags & CAR_ENTRY_FLAG_WOODEN_WILD_MOUSE_SWING)
|
if (rideEntry.Cars[0].flags & CAR_ENTRY_FLAG_WOODEN_WILD_MOUSE_SWING)
|
||||||
{
|
{
|
||||||
if (Pitch != 0)
|
if (Pitch != 0)
|
||||||
{
|
{
|
||||||
|
@ -8584,7 +8585,7 @@ loc_6DCD6B:
|
||||||
loc_6DCDE4:
|
loc_6DCDE4:
|
||||||
MoveTo(_vehicleCurPosition);
|
MoveTo(_vehicleCurPosition);
|
||||||
|
|
||||||
Loc6DCE02(*curRide);
|
Loc6DCE02(curRide);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vehicle::Loc6DCE02(const Ride& curRide)
|
void Vehicle::Loc6DCE02(const Ride& curRide)
|
||||||
|
@ -8740,6 +8741,9 @@ int32_t Vehicle::UpdateTrackMotionMiniGolf(int32_t* outStation)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
rct_ride_entry* rideEntry = GetRideEntry();
|
rct_ride_entry* rideEntry = GetRideEntry();
|
||||||
|
if (rideEntry == nullptr)
|
||||||
|
return 0;
|
||||||
|
|
||||||
CarEntry* carEntry = Entry();
|
CarEntry* carEntry = Entry();
|
||||||
|
|
||||||
gCurrentVehicle = this;
|
gCurrentVehicle = this;
|
||||||
|
@ -8751,7 +8755,7 @@ int32_t Vehicle::UpdateTrackMotionMiniGolf(int32_t* outStation)
|
||||||
|
|
||||||
for (Vehicle* vehicle = _vehicleFrontVehicle; vehicle != nullptr;)
|
for (Vehicle* vehicle = _vehicleFrontVehicle; vehicle != nullptr;)
|
||||||
{
|
{
|
||||||
vehicle->UpdateTrackMotionMiniGolfVehicle(curRide, rideEntry, carEntry);
|
vehicle->UpdateTrackMotionMiniGolfVehicle(*curRide, *rideEntry, carEntry);
|
||||||
if (vehicle->HasUpdateFlag(VEHICLE_UPDATE_FLAG_ON_LIFT_HILL))
|
if (vehicle->HasUpdateFlag(VEHICLE_UPDATE_FLAG_ON_LIFT_HILL))
|
||||||
{
|
{
|
||||||
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_VEHICLE_ON_LIFT_HILL;
|
_vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_VEHICLE_ON_LIFT_HILL;
|
||||||
|
@ -8978,7 +8982,7 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation)
|
||||||
if (car->remaining_distance < 0)
|
if (car->remaining_distance < 0)
|
||||||
{
|
{
|
||||||
// Backward loop
|
// Backward loop
|
||||||
if (car->UpdateTrackMotionBackwards(carEntry, curRide, rideEntry))
|
if (car->UpdateTrackMotionBackwards(carEntry, *curRide, *rideEntry))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8996,7 +9000,7 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation)
|
||||||
// Location found
|
// Location found
|
||||||
goto loc_6DBF3E;
|
goto loc_6DBF3E;
|
||||||
}
|
}
|
||||||
if (car->UpdateTrackMotionForwards(carEntry, curRide, rideEntry))
|
if (car->UpdateTrackMotionForwards(carEntry, *curRide, *rideEntry))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
#include "../entity/EntityBase.h"
|
#include "../entity/EntityBase.h"
|
||||||
#include "../ride/RideTypes.h"
|
#include "../ride/RideTypes.h"
|
||||||
#include "../world/Location.hpp"
|
#include "../world/Location.hpp"
|
||||||
|
#include "CarEntry.h"
|
||||||
#include "Station.h"
|
#include "Station.h"
|
||||||
#include "VehicleColour.h"
|
#include "VehicleColour.h"
|
||||||
#include "VehicleEntry.h"
|
|
||||||
#include "VehicleSubpositionData.h"
|
#include "VehicleSubpositionData.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
@ -323,7 +323,7 @@ private:
|
||||||
void UpdateDoingCircusShow();
|
void UpdateDoingCircusShow();
|
||||||
void UpdateCrossings() const;
|
void UpdateCrossings() const;
|
||||||
void UpdateSound();
|
void UpdateSound();
|
||||||
void GetLiftHillSound(Ride* curRide, SoundIdVolume& curSound);
|
void GetLiftHillSound(const Ride& curRide, SoundIdVolume& curSound);
|
||||||
OpenRCT2::Audio::SoundId UpdateScreamSound();
|
OpenRCT2::Audio::SoundId UpdateScreamSound();
|
||||||
OpenRCT2::Audio::SoundId ProduceScreamSound(const int32_t totalNumPeeps);
|
OpenRCT2::Audio::SoundId ProduceScreamSound(const int32_t totalNumPeeps);
|
||||||
void UpdateCrashSetup();
|
void UpdateCrashSetup();
|
||||||
|
@ -333,8 +333,8 @@ private:
|
||||||
void UpdateAdditionalAnimation();
|
void UpdateAdditionalAnimation();
|
||||||
void CheckIfMissing();
|
void CheckIfMissing();
|
||||||
bool CurrentTowerElementIsTop();
|
bool CurrentTowerElementIsTop();
|
||||||
bool UpdateTrackMotionForwards(CarEntry* carEntry, Ride* curRide, rct_ride_entry* rideEntry);
|
bool UpdateTrackMotionForwards(CarEntry* carEntry, const Ride& curRide, const rct_ride_entry& rideEntry);
|
||||||
bool UpdateTrackMotionBackwards(CarEntry* carEntry, Ride* curRide, rct_ride_entry* rideEntry);
|
bool UpdateTrackMotionBackwards(CarEntry* carEntry, const Ride& curRide, const rct_ride_entry& rideEntry);
|
||||||
int32_t UpdateTrackMotionPoweredRideAcceleration(CarEntry* carEntry, uint32_t totalMass, const int32_t curAcceleration);
|
int32_t UpdateTrackMotionPoweredRideAcceleration(CarEntry* carEntry, uint32_t totalMass, const int32_t curAcceleration);
|
||||||
int32_t NumPeepsUntilTrainTail() const;
|
int32_t NumPeepsUntilTrainTail() const;
|
||||||
void InvalidateWindow();
|
void InvalidateWindow();
|
||||||
|
@ -360,13 +360,13 @@ private:
|
||||||
void CrashOnLand();
|
void CrashOnLand();
|
||||||
void SimulateCrash() const;
|
void SimulateCrash() const;
|
||||||
void KillAllPassengersInTrain();
|
void KillAllPassengersInTrain();
|
||||||
void KillPassengers(Ride* curRide);
|
void KillPassengers(const Ride& curRide);
|
||||||
void TrainReadyToDepart(uint8_t num_peeps_on_train, uint8_t num_used_seats);
|
void TrainReadyToDepart(uint8_t num_peeps_on_train, uint8_t num_used_seats);
|
||||||
int32_t UpdateTrackMotionMiniGolfCalculateAcceleration(const CarEntry& carEntry);
|
int32_t UpdateTrackMotionMiniGolfCalculateAcceleration(const CarEntry& carEntry);
|
||||||
int32_t UpdateTrackMotionMiniGolf(int32_t* outStation);
|
int32_t UpdateTrackMotionMiniGolf(int32_t* outStation);
|
||||||
void UpdateTrackMotionMiniGolfVehicle(Ride* curRide, rct_ride_entry* rideEntry, CarEntry* carEntry);
|
void UpdateTrackMotionMiniGolfVehicle(const Ride& curRide, const rct_ride_entry& rideEntry, CarEntry* carEntry);
|
||||||
bool UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, Ride* curRide, rct_ride_entry* rideEntry);
|
bool UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, const Ride& curRide, const rct_ride_entry& rideEntry);
|
||||||
bool UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* curRide, uint16_t* progress);
|
bool UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, const Ride& curRide, uint16_t* progress);
|
||||||
bool UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* otherVehicleIndex);
|
bool UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* otherVehicleIndex);
|
||||||
void UpdateGoKartAttemptSwitchLanes();
|
void UpdateGoKartAttemptSwitchLanes();
|
||||||
void UpdateSceneryDoor() const;
|
void UpdateSceneryDoor() const;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "../entity/Yaw.hpp"
|
#include "../entity/Yaw.hpp"
|
||||||
#include "../interface/Viewport.h"
|
#include "../interface/Viewport.h"
|
||||||
#include "../paint/Paint.h"
|
#include "../paint/Paint.h"
|
||||||
|
#include "../ride/CarEntry.h"
|
||||||
#include "../ride/RideData.h"
|
#include "../ride/RideData.h"
|
||||||
#include "../ride/Vehicle.h"
|
#include "../ride/Vehicle.h"
|
||||||
#include "Track.h"
|
#include "Track.h"
|
||||||
|
@ -3741,29 +3742,3 @@ void Vehicle::Paint(PaintSession& session, int32_t imageDirection) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CarEntry::NumRotationSprites(SpriteGroupType spriteGroup) const
|
|
||||||
{
|
|
||||||
return NumSpritesPrecision(SpriteGroups[static_cast<uint8_t>(spriteGroup)].spritePrecision);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CarEntry::SpriteByYaw(int32_t yaw, SpriteGroupType spriteGroup) const
|
|
||||||
{
|
|
||||||
return YawToPrecision(yaw, SpriteGroups[static_cast<uint8_t>(spriteGroup)].spritePrecision);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CarEntry::GroupEnabled(SpriteGroupType spriteGroup) const
|
|
||||||
{
|
|
||||||
return SpriteGroups[static_cast<uint8_t>(spriteGroup)].Enabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t CarEntry::GroupImageId(SpriteGroupType spriteGroup) const
|
|
||||||
{
|
|
||||||
return SpriteGroups[static_cast<uint8_t>(spriteGroup)].imageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t CarEntry::SpriteOffset(SpriteGroupType spriteGroup, int32_t imageDirection, uint8_t rankIndex) const
|
|
||||||
{
|
|
||||||
return ((SpriteByYaw(imageDirection, spriteGroup) + NumRotationSprites(spriteGroup) * rankIndex) * base_num_frames)
|
|
||||||
+ GroupImageId(spriteGroup);
|
|
||||||
}
|
|
||||||
|
|
|
@ -548,7 +548,7 @@ static ResultWithMessage scenario_prepare_rides_for_save()
|
||||||
if (rideEntry != nullptr)
|
if (rideEntry != nullptr)
|
||||||
{
|
{
|
||||||
// If there are more than 5 roller coasters, only mark the first five.
|
// If there are more than 5 roller coasters, only mark the first five.
|
||||||
if (isFiveCoasterObjective && (ride_entry_has_category(rideEntry, RIDE_CATEGORY_ROLLERCOASTER) && rcs < 5))
|
if (isFiveCoasterObjective && (ride_entry_has_category(*rideEntry, RIDE_CATEGORY_ROLLERCOASTER) && rcs < 5))
|
||||||
{
|
{
|
||||||
ride.lifecycle_flags |= RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK;
|
ride.lifecycle_flags |= RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK;
|
||||||
rcs++;
|
rcs++;
|
||||||
|
@ -672,7 +672,7 @@ ObjectiveStatus Objective::Check10RollerCoasters() const
|
||||||
auto rideEntry = ride.GetRideEntry();
|
auto rideEntry = ride.GetRideEntry();
|
||||||
if (rideEntry != nullptr)
|
if (rideEntry != nullptr)
|
||||||
{
|
{
|
||||||
if (ride_entry_has_category(rideEntry, RIDE_CATEGORY_ROLLERCOASTER) && !type_already_counted[ride.subtype])
|
if (ride_entry_has_category(*rideEntry, RIDE_CATEGORY_ROLLERCOASTER) && !type_already_counted[ride.subtype])
|
||||||
{
|
{
|
||||||
type_already_counted[ride.subtype] = true;
|
type_already_counted[ride.subtype] = true;
|
||||||
rcs++;
|
rcs++;
|
||||||
|
@ -772,7 +772,7 @@ ObjectiveStatus Objective::Check10RollerCoastersLength() const
|
||||||
auto rideEntry = ride.GetRideEntry();
|
auto rideEntry = ride.GetRideEntry();
|
||||||
if (rideEntry != nullptr)
|
if (rideEntry != nullptr)
|
||||||
{
|
{
|
||||||
if (ride_entry_has_category(rideEntry, RIDE_CATEGORY_ROLLERCOASTER) && !type_already_counted[ride.subtype])
|
if (ride_entry_has_category(*rideEntry, RIDE_CATEGORY_ROLLERCOASTER) && !type_already_counted[ride.subtype])
|
||||||
{
|
{
|
||||||
if ((ride.GetTotalLength() >> 16) >= MinimumLength)
|
if ((ride.GetTotalLength() >> 16) >= MinimumLength)
|
||||||
{
|
{
|
||||||
|
@ -804,7 +804,7 @@ ObjectiveStatus Objective::CheckFinish5RollerCoasters() const
|
||||||
if (rideEntry != nullptr)
|
if (rideEntry != nullptr)
|
||||||
{
|
{
|
||||||
if ((ride.lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)
|
if ((ride.lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)
|
||||||
&& ride_entry_has_category(rideEntry, RIDE_CATEGORY_ROLLERCOASTER))
|
&& ride_entry_has_category(*rideEntry, RIDE_CATEGORY_ROLLERCOASTER))
|
||||||
{
|
{
|
||||||
rcs++;
|
rcs++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue