From 3529c0be3a3915abed68421b89646629d8cb4183 Mon Sep 17 00:00:00 2001 From: kysrit <102626439+kysrit@users.noreply.github.com> Date: Mon, 12 May 2025 17:09:50 -0400 Subject: [PATCH] Part of #16033: create constants for crash particles --- src/openrct2/SpriteIds.h | 11 +++++++++++ src/openrct2/entity/Particle.cpp | 16 +++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/openrct2/SpriteIds.h b/src/openrct2/SpriteIds.h index 81b3c3f487..2b4944c927 100644 --- a/src/openrct2/SpriteIds.h +++ b/src/openrct2/SpriteIds.h @@ -694,6 +694,17 @@ enum : ImageIndex SPR_RIDE_DESIGN_PREVIEW_MAZE_ICE_BLOCKS = 21992, SPR_RIDE_DESIGN_PREVIEW_MAZE_WOODEN_FENCES = 21993, + SPR_VEHICLE_CRASH_PARTICLE_1 = 22577, + SPR_VEHICLE_CRASH_PARTICLE_2 = 22589, + SPR_VEHICLE_CRASH_PARTICLE_3 = 22601, + SPR_VEHICLE_CRASH_PARTICLE_4 = 22613, + SPR_VEHICLE_CRASH_PARTICLE_5 = 22625, + + SPR_STEAM_PARTICLE = 22637, + SPR_EXPLOSION_CLOUD = 22878, + SPR_EXPLOSION_FLARE = 22896, + SPR_CRASH_SPLASH_PARTICLE = 22927, + SPR_LAND_OWNERSHIP_AVAILABLE = 22955, SPR_LAND_CONSTRUCTION_RIGHTS_AVAILABLE = 22956, diff --git a/src/openrct2/entity/Particle.cpp b/src/openrct2/entity/Particle.cpp index b6511573b4..f6150a12dc 100644 --- a/src/openrct2/entity/Particle.cpp +++ b/src/openrct2/entity/Particle.cpp @@ -8,6 +8,7 @@ *****************************************************************************/ #include "Particle.h" +#include "../SpriteIds.h" #include "../audio/Audio.h" #include "../core/DataSerialiser.h" #include "../paint/Paint.h" @@ -19,9 +20,9 @@ #include -// TODO: Create constants in SpriteIds.h static constexpr uint32_t kVehicleCrashParticleSprites[kCrashedVehicleParticleNumberTypes] = { - 22577, 22589, 22601, 22613, 22625, + SPR_VEHICLE_CRASH_PARTICLE_1, SPR_VEHICLE_CRASH_PARTICLE_2, SPR_VEHICLE_CRASH_PARTICLE_3, + SPR_VEHICLE_CRASH_PARTICLE_4, SPR_VEHICLE_CRASH_PARTICLE_5, }; template<> @@ -223,8 +224,7 @@ void CrashSplashParticle::Paint(PaintSession& session, int32_t imageDirection) c { PROFILED_FUNCTION(); - // TODO: Create constant in SpriteIds.h - uint32_t imageId = 22927 + (frame / 256); + uint32_t imageId = SPR_CRASH_SPLASH_PARTICLE + (frame / 256); PaintAddImageAsParent(session, ImageId(imageId), { 0, 0, z }, { 1, 1, 0 }); } @@ -282,8 +282,7 @@ void SteamParticle::Paint(PaintSession& session, int32_t imageDirection) const { PROFILED_FUNCTION(); - // TODO: Create constant in SpriteIds.h - uint32_t imageId = 22637 + (frame / 256); + uint32_t imageId = SPR_STEAM_PARTICLE + (frame / 256); PaintAddImageAsParent(session, ImageId(imageId), { 0, 0, z }, { 1, 1, 0 }); } @@ -328,7 +327,7 @@ void ExplosionCloud::Paint(PaintSession& session, int32_t imageDirection) const { PROFILED_FUNCTION(); - uint32_t imageId = 22878 + (frame / 256); + uint32_t imageId = SPR_EXPLOSION_CLOUD + (frame / 256); PaintAddImageAsParent(session, ImageId(imageId), { 0, 0, z }, { 1, 1, 0 }); } @@ -373,7 +372,6 @@ void ExplosionFlare::Paint(PaintSession& session, int32_t imageDirection) const { PROFILED_FUNCTION(); - // TODO: Create constant in SpriteIds.h - uint32_t imageId = 22896 + (frame / 256); + uint32_t imageId = SPR_EXPLOSION_FLARE + (frame / 256); PaintAddImageAsParent(session, ImageId(imageId), { 0, 0, z }, { 1, 1, 0 }); }