mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 03:53:07 +01:00
Move particle functions into class
This commit is contained in:
committed by
Gymnasiast
parent
243142664e
commit
24a5446e8c
@@ -3603,7 +3603,7 @@ void Vehicle::UpdateCollisionSetup()
|
||||
|
||||
for (int32_t i = 0; i < 10; i++)
|
||||
{
|
||||
crashed_vehicle_particle_create(train->colours, { train->x, train->y, train->z });
|
||||
VehicleCrashParticle::Create(train->colours, { train->x, train->y, train->z });
|
||||
}
|
||||
|
||||
train->IsCrashedVehicle = true;
|
||||
@@ -5363,7 +5363,7 @@ void Vehicle::CrashOnLand()
|
||||
uint8_t numParticles = std::min(sprite_width, static_cast<uint8_t>(7));
|
||||
|
||||
while (numParticles-- != 0)
|
||||
crashed_vehicle_particle_create(colours, { x, y, z });
|
||||
VehicleCrashParticle::Create(colours, { x, y, z });
|
||||
|
||||
IsCrashedVehicle = true;
|
||||
animation_frame = 0;
|
||||
@@ -5419,14 +5419,14 @@ void Vehicle::CrashOnWater()
|
||||
sub_state = 2;
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Water1, { x, y, z });
|
||||
|
||||
crash_splash_create({ x, y, z });
|
||||
crash_splash_create({ x - 8, y - 9, z });
|
||||
crash_splash_create({ x + 11, y - 9, z });
|
||||
crash_splash_create({ x + 11, y + 8, z });
|
||||
crash_splash_create({ x - 4, y + 8, z });
|
||||
CrashSplashParticle::Create({ x, y, z });
|
||||
CrashSplashParticle::Create({ x - 8, y - 9, z });
|
||||
CrashSplashParticle::Create({ x + 11, y - 9, z });
|
||||
CrashSplashParticle::Create({ x + 11, y + 8, z });
|
||||
CrashSplashParticle::Create({ x - 4, y + 8, z });
|
||||
|
||||
for (int32_t i = 0; i < 10; ++i)
|
||||
crashed_vehicle_particle_create(colours, { x - 4, y + 8, z });
|
||||
VehicleCrashParticle::Create(colours, { x - 4, y + 8, z });
|
||||
|
||||
IsCrashedVehicle = true;
|
||||
animation_frame = 0;
|
||||
|
||||
@@ -28,7 +28,7 @@ template<> bool SpriteBase::Is<CrashSplashParticle>() const
|
||||
*
|
||||
* rct2: 0x006735A1
|
||||
*/
|
||||
void crashed_vehicle_particle_create(rct_vehicle_colour colours, const CoordsXYZ& vehiclePos)
|
||||
void VehicleCrashParticle::Create(rct_vehicle_colour colours, const CoordsXYZ& vehiclePos)
|
||||
{
|
||||
VehicleCrashParticle* sprite = CreateEntity<VehicleCrashParticle>();
|
||||
if (sprite != nullptr)
|
||||
@@ -93,7 +93,7 @@ void VehicleCrashParticle::Update()
|
||||
{
|
||||
// Splash
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Water2, { x, y, waterZ });
|
||||
crash_splash_create({ x, y, waterZ });
|
||||
CrashSplashParticle::Create({ x, y, waterZ });
|
||||
sprite_remove(this);
|
||||
return;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ void VehicleCrashParticle::Update()
|
||||
*
|
||||
* rct2: 0x00673699
|
||||
*/
|
||||
void crash_splash_create(const CoordsXYZ& splashPos)
|
||||
void CrashSplashParticle::Create(const CoordsXYZ& splashPos)
|
||||
{
|
||||
auto* sprite = CreateEntity<CrashSplashParticle>();
|
||||
if (sprite != nullptr)
|
||||
|
||||
@@ -27,7 +27,7 @@ struct VehicleCrashParticle : MiscEntity
|
||||
int32_t acceleration_x;
|
||||
int32_t acceleration_y;
|
||||
int32_t acceleration_z;
|
||||
|
||||
static void Create(rct_vehicle_colour colours, const CoordsXYZ& vehiclePos);
|
||||
void Update();
|
||||
void Serialise(DataSerialiser& stream);
|
||||
};
|
||||
@@ -35,9 +35,7 @@ struct VehicleCrashParticle : MiscEntity
|
||||
struct CrashSplashParticle : MiscEntity
|
||||
{
|
||||
static constexpr auto cEntityType = EntityType::CrashSplash;
|
||||
static void Create(const CoordsXYZ& splashPos);
|
||||
void Update();
|
||||
void Serialise(DataSerialiser& stream);
|
||||
};
|
||||
|
||||
void crashed_vehicle_particle_create(rct_vehicle_colour colours, const CoordsXYZ& vehiclePos);
|
||||
void crash_splash_create(const CoordsXYZ& splashPos);
|
||||
|
||||
Reference in New Issue
Block a user