mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 06:44:38 +01:00
Name num_sheltered_sections flags
This commit is contained in:
committed by
GitHub
parent
ea961aed93
commit
7c73e271ad
@@ -7347,3 +7347,17 @@ void Ride::SetMaxCarsPerTrain(uint8_t newValue)
|
||||
min_max_cars_per_train &= ~0x0F;
|
||||
min_max_cars_per_train |= newValue & 0x0F;
|
||||
}
|
||||
|
||||
uint8_t Ride::GetNumShelteredSections() const
|
||||
{
|
||||
return num_sheltered_sections & ShelteredSectionsBits::NumShelteredSectionsMask;
|
||||
}
|
||||
|
||||
void Ride::IncreaseNumShelteredSections()
|
||||
{
|
||||
auto newNumShelteredSections = GetNumShelteredSections();
|
||||
if (newNumShelteredSections != 0x1F)
|
||||
newNumShelteredSections++;
|
||||
num_sheltered_sections &= ~ShelteredSectionsBits::NumShelteredSectionsMask;
|
||||
num_sheltered_sections |= newNumShelteredSections;
|
||||
}
|
||||
|
||||
@@ -190,6 +190,13 @@ enum class RideClassification
|
||||
KioskOrFacility
|
||||
};
|
||||
|
||||
namespace ShelteredSectionsBits
|
||||
{
|
||||
constexpr const uint8_t NumShelteredSectionsMask = 0b00011111;
|
||||
constexpr const uint8_t RotatingWhileSheltered = 0b00100000;
|
||||
constexpr const uint8_t BankingWhileSheltered = 0b01000000;
|
||||
}; // namespace ShelteredSectionsBits
|
||||
|
||||
struct TrackDesign;
|
||||
enum class RideMode : uint8_t;
|
||||
|
||||
@@ -453,6 +460,9 @@ public:
|
||||
uint8_t GetMaxCarsPerTrain() const;
|
||||
void SetMinCarsPerTrain(uint8_t newValue);
|
||||
void SetMaxCarsPerTrain(uint8_t newValue);
|
||||
|
||||
uint8_t GetNumShelteredSections() const;
|
||||
void IncreaseNumShelteredSections();
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
@@ -1326,19 +1326,19 @@ static RatingTuple ride_ratings_get_sheltered_ratings(Ride* ride)
|
||||
/*eax = (ride->var_11C * 30340) >> 16;*/
|
||||
/*nausea += eax;*/
|
||||
|
||||
if (ride->num_sheltered_sections & 0x40)
|
||||
if (ride->num_sheltered_sections & ShelteredSectionsBits::BankingWhileSheltered)
|
||||
{
|
||||
excitement += 20;
|
||||
nausea += 15;
|
||||
}
|
||||
|
||||
if (ride->num_sheltered_sections & 0x20)
|
||||
if (ride->num_sheltered_sections & ShelteredSectionsBits::RotatingWhileSheltered)
|
||||
{
|
||||
excitement += 20;
|
||||
nausea += 15;
|
||||
}
|
||||
|
||||
uint8_t lowerVal = ride->num_sheltered_sections & 0x1F;
|
||||
uint8_t lowerVal = ride->GetNumShelteredSections();
|
||||
lowerVal = std::min<uint8_t>(lowerVal, 11);
|
||||
excitement += (lowerVal * 774516) >> 16;
|
||||
|
||||
|
||||
@@ -1909,20 +1909,16 @@ void Vehicle::UpdateMeasurements()
|
||||
{
|
||||
curRide->testing_flags |= RIDE_TESTING_SHELTERED;
|
||||
|
||||
uint8_t numShelteredSections = curRide->num_sheltered_sections & 0x1F;
|
||||
if (numShelteredSections != 0x1F)
|
||||
numShelteredSections++;
|
||||
curRide->num_sheltered_sections &= ~0x1F;
|
||||
curRide->num_sheltered_sections |= numShelteredSections;
|
||||
curRide->IncreaseNumShelteredSections();
|
||||
|
||||
if (vehicle_sprite_type != 0)
|
||||
{
|
||||
curRide->num_sheltered_sections |= (1 << 5);
|
||||
curRide->num_sheltered_sections |= ShelteredSectionsBits::RotatingWhileSheltered;
|
||||
}
|
||||
|
||||
if (bank_rotation != 0)
|
||||
{
|
||||
curRide->num_sheltered_sections |= (1 << 6);
|
||||
curRide->num_sheltered_sections |= ShelteredSectionsBits::BankingWhileSheltered;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user