diff --git a/src/openrct2/world/Particle.cpp b/src/openrct2/world/Particle.cpp index 4aad321830..3e49b924d0 100644 --- a/src/openrct2/world/Particle.cpp +++ b/src/openrct2/world/Particle.cpp @@ -25,26 +25,27 @@ */ void crashed_vehicle_particle_create(rct_vehicle_colour colours, sint32 x, sint32 y, sint32 z) { - rct_crashed_vehicle_particle *sprite = (rct_crashed_vehicle_particle*)create_sprite(2); - if (sprite != NULL) { + rct_crashed_vehicle_particle * sprite = (rct_crashed_vehicle_particle *) create_sprite(2); + if (sprite != nullptr) + { sprite->colour[0] = colours.body_colour; sprite->colour[1] = colours.trim_colour; - sprite->sprite_width = 8; + sprite->sprite_width = 8; sprite->sprite_height_negative = 8; sprite->sprite_height_positive = 8; - sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC; - sprite_move(x, y, z, (rct_sprite*)sprite); + sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC; + sprite_move(x, y, z, (rct_sprite *) sprite); sprite->misc_identifier = SPRITE_MISC_CRASHED_VEHICLE_PARTICLE; - sprite->frame = (scenario_rand() & 0xFF) * 12; - sprite->var_24 = (scenario_rand() & 0x7F) + 140; - sprite->var_2E = ((scenario_rand() & 0xFF) * 5) >> 8; - sprite->acceleration_x = ((sint16)(scenario_rand() & 0xFFFF)) * 4; - sprite->acceleration_y = ((sint16)(scenario_rand() & 0xFFFF)) * 4; + sprite->frame = (scenario_rand() & 0xFF) * 12; + sprite->var_24 = (scenario_rand() & 0x7F) + 140; + sprite->var_2E = ((scenario_rand() & 0xFF) * 5) >> 8; + sprite->acceleration_x = ((sint16) (scenario_rand() & 0xFFFF)) * 4; + sprite->acceleration_y = ((sint16) (scenario_rand() & 0xFFFF)) * 4; sprite->acceleration_z = (scenario_rand() & 0xFFFF) * 4 + 0x10000; - sprite->velocity_x = 0; - sprite->velocity_y = 0; - sprite->velocity_z = 0; + sprite->velocity_x = 0; + sprite->velocity_y = 0; + sprite->velocity_z = 0; } } @@ -52,12 +53,13 @@ void crashed_vehicle_particle_create(rct_vehicle_colour colours, sint32 x, sint3 * * rct2: 0x00673298 */ -void crashed_vehicle_particle_update(rct_crashed_vehicle_particle *particle) +void crashed_vehicle_particle_update(rct_crashed_vehicle_particle * particle) { - invalidate_sprite_0((rct_sprite*)particle); + invalidate_sprite_0((rct_sprite *) particle); particle->var_24--; - if (particle->var_24 == 0) { - sprite_remove((rct_sprite*)particle); + if (particle->var_24 == 0) + { + sprite_remove((rct_sprite *) particle); return; } @@ -84,27 +86,30 @@ void crashed_vehicle_particle_update(rct_crashed_vehicle_particle *particle) // Check collision with land / water uint32 waterLand = tile_element_height(x, y); - sint16 landZ = (waterLand & 0xFFFF); - sint16 waterZ = (waterLand >> 16); + sint16 landZ = (waterLand & 0xFFFF); + sint16 waterZ = (waterLand >> 16); - if (waterZ != 0 && particle->z >= waterZ && z <= waterZ) { + if (waterZ != 0 && particle->z >= waterZ && z <= waterZ) + { // Splash audio_play_sound_at_location(SOUND_WATER_2, particle->x, particle->y, waterZ); crash_splash_create(particle->x, particle->y, waterZ); - sprite_remove((rct_sprite*)particle); + sprite_remove((rct_sprite *) particle); return; } - if (particle->z >= landZ && z <= landZ) { + if (particle->z >= landZ && z <= landZ) + { // Bounce particle->acceleration_z *= -1; z = landZ; } - sprite_move(x, y, z, (rct_sprite*)particle); - invalidate_sprite_0((rct_sprite*)particle); + sprite_move(x, y, z, (rct_sprite *) particle); + invalidate_sprite_0((rct_sprite *) particle); particle->frame += 85; - if (particle->frame >= 3072) { + if (particle->frame >= 3072) + { particle->frame = 0; } } @@ -115,15 +120,16 @@ void crashed_vehicle_particle_update(rct_crashed_vehicle_particle *particle) */ void crash_splash_create(sint32 x, sint32 y, sint32 z) { - rct_unk_sprite *sprite = (rct_unk_sprite*)create_sprite(2); - if (sprite != NULL) { - sprite->sprite_width = 33; + rct_unk_sprite * sprite = (rct_unk_sprite *) create_sprite(2); + if (sprite != nullptr) + { + sprite->sprite_width = 33; sprite->sprite_height_negative = 51; sprite->sprite_height_positive = 16; - sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC; - sprite_move(x, y, z + 3, (rct_sprite*)sprite); + sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC; + sprite_move(x, y, z + 3, (rct_sprite *) sprite); sprite->misc_identifier = SPRITE_MISC_CRASH_SPLASH; - sprite->frame = 0; + sprite->frame = 0; } } @@ -131,11 +137,12 @@ void crash_splash_create(sint32 x, sint32 y, sint32 z) * * rct2: 0x0067339D */ -void crash_splash_update(rct_crash_splash *splash) +void crash_splash_update(rct_crash_splash * splash) { - invalidate_sprite_2((rct_sprite*)splash); + invalidate_sprite_2((rct_sprite *) splash); splash->frame += 85; - if (splash->frame >= 7168) { - sprite_remove((rct_sprite*)splash); + if (splash->frame >= 7168) + { + sprite_remove((rct_sprite *) splash); } }