diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 0789e35b39..37adbefce9 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -593,7 +593,7 @@ void reset_all_sprite_quadrant_placements() rct_sprite* spr = get_sprite(i); if (spr->generic.sprite_identifier != SPRITE_IDENTIFIER_NULL) { - sprite_move(spr->generic.x, spr->generic.y, spr->generic.z, spr); + sprite_move(spr->generic.x, spr->generic.y, spr->generic.z, &spr->generic); } } } diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index e702e482ac..e71204abca 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -228,7 +228,7 @@ private: // NOTE: This state is required for the window to act. newPeep->state = PEEP_STATE_PICKED; - sprite_move(newPeep->x, newPeep->y, newPeep->z, (rct_sprite*)newPeep); + sprite_move(newPeep->x, newPeep->y, newPeep->z, newPeep); invalidate_sprite_2((rct_sprite*)newPeep); } @@ -335,7 +335,7 @@ private: } } - sprite_move(x, y, z + 16, (rct_sprite*)newPeep); + sprite_move(x, y, z + 16, newPeep); invalidate_sprite_2((rct_sprite*)newPeep); } }; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index afbb6f5769..1fd4f92619 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -348,7 +348,7 @@ void Peep::Invalidate() void Peep::MoveTo(int16_t destX, int16_t destY, int16_t destZ) { Invalidate(); // Invalidate current position. - sprite_move(destX, destY, destZ, (rct_sprite*)this); + sprite_move(destX, destY, destZ, this); Invalidate(); // Invalidate new position. } diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 6414519fa8..5233b76251 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1232,7 +1232,7 @@ private: dst->mini_golf_current_animation = src->mini_golf_current_animation; dst->mini_golf_flags = src->mini_golf_flags; - sprite_move(src->x, src->y, src->z, (rct_sprite*)dst); + sprite_move(src->x, src->y, src->z, dst); invalidate_sprite_2((rct_sprite*)dst); dst->num_peeps = src->num_peeps; @@ -1391,7 +1391,7 @@ private: dst->sprite_height_negative = spriteBounds[dst->action_sprite_type].sprite_height_negative; dst->sprite_height_positive = spriteBounds[dst->action_sprite_type].sprite_height_positive; - sprite_move(src->x, src->y, src->z, (rct_sprite*)dst); + sprite_move(src->x, src->y, src->z, dst); invalidate_sprite_2((rct_sprite*)dst); dst->sprite_direction = src->sprite_direction; @@ -1636,7 +1636,7 @@ private: litter->sprite_height_positive = srcLitter->sprite_height_positive; litter->sprite_height_negative = srcLitter->sprite_height_negative; - sprite_move(srcLitter->x, srcLitter->y, srcLitter->z, (rct_sprite*)litter); + sprite_move(srcLitter->x, srcLitter->y, srcLitter->z, litter); invalidate_sprite_2((rct_sprite*)litter); } } @@ -1658,7 +1658,7 @@ private: dst->sprite_height_negative = src->sprite_height_negative; dst->sprite_height_positive = src->sprite_height_positive; - sprite_move(src->x, src->y, src->z, (rct_sprite*)dst); + sprite_move(src->x, src->y, src->z, dst); switch (src->type) { @@ -1687,7 +1687,7 @@ private: break; } - sprite_move(src->x, src->y, src->z, (rct_sprite*)dst); + sprite_move(src->x, src->y, src->z, dst); invalidate_sprite_2((rct_sprite*)dst); } } diff --git a/src/openrct2/ride/CableLift.cpp b/src/openrct2/ride/CableLift.cpp index eb3cfc7f54..b10e9b75ec 100644 --- a/src/openrct2/ride/CableLift.cpp +++ b/src/openrct2/ride/CableLift.cpp @@ -79,7 +79,7 @@ Vehicle* cable_lift_segment_create( current->track_z = z; z += RideData5[ride.type].z_offset; - sprite_move(16, 16, z, (rct_sprite*)current); + sprite_move(16, 16, z, current); current->track_type = (TRACK_ELEM_CABLE_LIFT_HILL << 2) | (current->sprite_direction >> 3); current->track_progress = 164; current->update_flags = VEHICLE_UPDATE_FLAG_1; @@ -457,7 +457,7 @@ int32_t cable_lift_update_track_motion(Vehicle* cableLift) } } } - sprite_move(unk_F64E20.x, unk_F64E20.y, unk_F64E20.z, (rct_sprite*)vehicle); + sprite_move(unk_F64E20.x, unk_F64E20.y, unk_F64E20.z, vehicle); invalidate_sprite_2((rct_sprite*)vehicle); } diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index b1918449f2..3a66e3c204 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -1138,11 +1138,11 @@ void ride_remove_peeps(Ride* ride) if (peep->GetNextIsSloped()) z += 8; z++; - sprite_move(x, y, z, (rct_sprite*)peep); + sprite_move(x, y, z, peep); } else { - sprite_move(exitX, exitY, exitZ, (rct_sprite*)peep); + sprite_move(exitX, exitY, exitZ, peep); peep->sprite_direction = exitDirection; } @@ -4475,7 +4475,7 @@ static Vehicle* vehicle_create_car( chosenLoc.x = x + (scenario_rand() & 0xFF); } while (vehicle_update_dodgems_collision(vehicle, chosenLoc.x, chosenLoc.y, nullptr)); - sprite_move(chosenLoc.x, chosenLoc.y, z, (rct_sprite*)vehicle); + sprite_move(chosenLoc.x, chosenLoc.y, z, vehicle); } else { @@ -4553,7 +4553,7 @@ static Vehicle* vehicle_create_car( z = tileElement->GetBaseZ(); z += RideData5[ride->type].z_offset; - sprite_move(x, y, z, (rct_sprite*)vehicle); + sprite_move(x, y, z, vehicle); vehicle->track_type = (tileElement->AsTrack()->GetTrackType() << 2) | (vehicle->sprite_direction >> 3); vehicle->track_progress = 31; if (vehicleEntry->flags & VEHICLE_ENTRY_FLAG_MINI_GOLF) diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 52571a22e8..f7a700ff6b 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -3578,7 +3578,7 @@ static void vehicle_update_collision_setup(Vehicle* vehicle) train->sprite_height_negative = 45; train->sprite_height_positive = 5; - sprite_move(train->x, train->y, train->z, (rct_sprite*)train); + sprite_move(train->x, train->y, train->z, train); invalidate_sprite_2((rct_sprite*)train); train->var_4E = 0; @@ -4534,7 +4534,7 @@ static void vehicle_update_motion_boat_hire(Vehicle* vehicle) _vehicleUnkF64E10++; } - sprite_move(unk_F64E20.x, unk_F64E20.y, unk_F64E20.z, (rct_sprite*)vehicle); + sprite_move(unk_F64E20.x, unk_F64E20.y, unk_F64E20.z, vehicle); vehicle->Invalidate(); } @@ -5300,7 +5300,7 @@ static void vehicle_crash_on_land(Vehicle* vehicle) vehicle->sprite_height_negative = 45; vehicle->sprite_height_positive = 5; - sprite_move(vehicle->x, vehicle->y, vehicle->z, (rct_sprite*)vehicle); + sprite_move(vehicle->x, vehicle->y, vehicle->z, vehicle); vehicle->Invalidate(); vehicle->crash_z = 0; @@ -5364,7 +5364,7 @@ static void vehicle_crash_on_water(Vehicle* vehicle) vehicle->sprite_height_negative = 45; vehicle->sprite_height_positive = 5; - sprite_move(vehicle->x, vehicle->y, vehicle->z, (rct_sprite*)vehicle); + sprite_move(vehicle->x, vehicle->y, vehicle->z, vehicle); vehicle->Invalidate(); vehicle->crash_z = -1; @@ -5452,7 +5452,7 @@ static void vehicle_update_crash(Vehicle* vehicle) continue; } - sprite_move(curPosition.x, curPosition.y, curPosition.z, (rct_sprite*)curVehicle); + sprite_move(curPosition.x, curPosition.y, curPosition.z, curVehicle); invalidate_sprite_2((rct_sprite*)curVehicle); if (curVehicle->sub_state == 1) @@ -6317,7 +6317,7 @@ static int32_t vehicle_update_motion_dodgems(Vehicle* vehicle) if (!vehicle_update_dodgems_collision(vehicle, location.x, location.y, &collideSprite)) { vehicle->Invalidate(); - sprite_move(location.x, location.y, location.z, (rct_sprite*)vehicle); + sprite_move(location.x, location.y, location.z, vehicle); vehicle->Invalidate(); } } @@ -6385,7 +6385,7 @@ static int32_t vehicle_update_motion_dodgems(Vehicle* vehicle) } } - sprite_move(unk_F64E20.x, unk_F64E20.y, unk_F64E20.z, (rct_sprite*)vehicle); + sprite_move(unk_F64E20.x, unk_F64E20.y, unk_F64E20.z, vehicle); vehicle->Invalidate(); } @@ -7226,7 +7226,7 @@ static void steam_particle_create(int16_t x, int16_t y, int16_t z) steam->type = SPRITE_MISC_STEAM_PARTICLE; steam->frame = 256; steam->time_to_move = 0; - sprite_move(x, y, z, (rct_sprite*)steam); + sprite_move(x, y, z, steam); } } @@ -7615,7 +7615,7 @@ static void vehicle_update_reverser_car_bogies(Vehicle* vehicle) int32_t x = vehicle->track_x + moveInfo->x; int32_t y = vehicle->track_y + moveInfo->y; int32_t z = vehicle->z; - sprite_move(x, y, z, (rct_sprite*)vehicle); + sprite_move(x, y, z, vehicle); } /** @@ -9250,7 +9250,7 @@ loc_6DCD6B: goto loc_6DC99A; loc_6DCDE4: - sprite_move(unk_F64E20.x, unk_F64E20.y, unk_F64E20.z, (rct_sprite*)vehicle); + sprite_move(unk_F64E20.x, unk_F64E20.y, unk_F64E20.z, vehicle); vehicle->Invalidate(); loc_6DCE02: @@ -9685,7 +9685,7 @@ int32_t vehicle_update_track_motion(Vehicle* vehicle, int32_t* outStation) } } // loc_6DBF20 - sprite_move(unk_F64E20.x, unk_F64E20.y, unk_F64E20.z, (rct_sprite*)car); + sprite_move(unk_F64E20.x, unk_F64E20.y, unk_F64E20.z, car); invalidate_sprite_2((rct_sprite*)car); loc_6DBF3E: diff --git a/src/openrct2/world/Balloon.cpp b/src/openrct2/world/Balloon.cpp index ea7323f689..4537dfccd4 100644 --- a/src/openrct2/world/Balloon.cpp +++ b/src/openrct2/world/Balloon.cpp @@ -47,7 +47,7 @@ void Balloon::Update() { time_to_move = 0; frame++; - sprite_move(x, y, z + 1, (rct_sprite*)this); + sprite_move(x, y, z + 1, this); int32_t maxZ = 1967 - ((x ^ y) & 31); if (z >= maxZ) @@ -72,7 +72,7 @@ void Balloon::Press() else { int16_t shift = ((random & 0x80000000) ? -6 : 6); - sprite_move(x + shift, y, z, (rct_sprite*)this); + sprite_move(x + shift, y, z, this); } } } @@ -93,7 +93,7 @@ void create_balloon(int32_t x, int32_t y, int32_t z, int32_t colour, bool isPopp sprite->balloon.sprite_height_negative = 22; sprite->balloon.sprite_height_positive = 11; sprite->balloon.sprite_identifier = SPRITE_IDENTIFIER_MISC; - sprite_move(x, y, z, sprite); + sprite_move(x, y, z, &sprite->balloon); sprite->balloon.type = SPRITE_MISC_BALLOON; sprite->balloon.time_to_move = 0; sprite->balloon.frame = 0; diff --git a/src/openrct2/world/Duck.cpp b/src/openrct2/world/Duck.cpp index 48551de1ea..94e1245228 100644 --- a/src/openrct2/world/Duck.cpp +++ b/src/openrct2/world/Duck.cpp @@ -102,7 +102,7 @@ void Duck::Remove() void Duck::MoveTo(const CoordsXYZ& destination) { - sprite_move(destination.x, destination.y, destination.z, (rct_sprite*)this); + sprite_move(destination.x, destination.y, destination.z, this); } void Duck::UpdateFlyToWater() @@ -339,7 +339,7 @@ void create_duck(const CoordsXY& pos) break; } sprite->duck.sprite_direction = direction << 3; - sprite_move(targetPos.x, targetPos.y, 496, sprite); + sprite_move(targetPos.x, targetPos.y, 496, &sprite->duck); sprite->duck.state = DUCK_STATE::FLY_TO_WATER; sprite->duck.frame = 0; } diff --git a/src/openrct2/world/Fountain.cpp b/src/openrct2/world/Fountain.cpp index 365f0ccb2a..7f7c250c51 100644 --- a/src/openrct2/world/Fountain.cpp +++ b/src/openrct2/world/Fountain.cpp @@ -142,7 +142,7 @@ void JumpingFountain::Create( jumpingFountain->sprite_height_negative = 36; jumpingFountain->sprite_height_positive = 12; jumpingFountain->sprite_identifier = SPRITE_IDENTIFIER_MISC; - sprite_move(newLoc.x, newLoc.y, newLoc.z, reinterpret_cast(jumpingFountain)); + sprite_move(newLoc.x, newLoc.y, newLoc.z, jumpingFountain); jumpingFountain->type = newType == JUMPING_FOUNTAIN_TYPE_SNOW ? SPRITE_MISC_JUMPING_FOUNTAIN_SNOW : SPRITE_MISC_JUMPING_FOUNTAIN_WATER; jumpingFountain->NumTicksAlive = 0; diff --git a/src/openrct2/world/MoneyEffect.cpp b/src/openrct2/world/MoneyEffect.cpp index 9439fab554..3894b3a52a 100644 --- a/src/openrct2/world/MoneyEffect.cpp +++ b/src/openrct2/world/MoneyEffect.cpp @@ -53,7 +53,7 @@ void MoneyEffect::CreateAt(money32 value, int32_t x, int32_t y, int32_t z, bool moneyEffect->sprite_height_negative = 20; moneyEffect->sprite_height_positive = 30; moneyEffect->sprite_identifier = SPRITE_IDENTIFIER_MISC; - sprite_move(x, y, z, (rct_sprite*)moneyEffect); + sprite_move(x, y, z, moneyEffect); moneyEffect->type = SPRITE_MISC_MONEY_EFFECT; moneyEffect->num_movements = 0; moneyEffect->move_delay = 0; @@ -134,7 +134,7 @@ void MoneyEffect::Update() newY += _moneyEffectMoveOffset[get_current_rotation()].y; newX += _moneyEffectMoveOffset[get_current_rotation()].x; - sprite_move(newX, newY, newZ, (rct_sprite*)this); + sprite_move(newX, newY, newZ, this); num_movements++; if (num_movements < 55) diff --git a/src/openrct2/world/Particle.cpp b/src/openrct2/world/Particle.cpp index eed815878e..1d48c0ad6f 100644 --- a/src/openrct2/world/Particle.cpp +++ b/src/openrct2/world/Particle.cpp @@ -29,7 +29,7 @@ void crashed_vehicle_particle_create(rct_vehicle_colour colours, int32_t x, int3 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_move(x, y, z, sprite); sprite->type = SPRITE_MISC_CRASHED_VEHICLE_PARTICLE; sprite->frame = (scenario_rand() & 0xFF) * 12; @@ -98,7 +98,7 @@ void crashed_vehicle_particle_update(VehicleCrashParticle* particle) particle->acceleration_z *= -1; z = landZ; } - sprite_move(x, y, z, (rct_sprite*)particle); + sprite_move(x, y, z, particle); invalidate_sprite_0((rct_sprite*)particle); particle->frame += 85; @@ -121,7 +121,7 @@ void crash_splash_create(int32_t x, int32_t y, int32_t z) 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_move(x, y, z + 3, sprite); sprite->type = SPRITE_MISC_CRASH_SPLASH; sprite->frame = 0; } diff --git a/src/openrct2/world/Sprite.cpp b/src/openrct2/world/Sprite.cpp index aea2484aea..699bc270bb 100644 --- a/src/openrct2/world/Sprite.cpp +++ b/src/openrct2/world/Sprite.cpp @@ -485,7 +485,7 @@ static void sprite_steam_particle_update(SteamParticle* steam) if (steam->time_to_move >= 4) { steam->time_to_move = 1; - sprite_move(steam->x, steam->y, steam->z + 1, (rct_sprite*)steam); + sprite_move(steam->x, steam->y, steam->z + 1, steam); } steam->frame += 64; if (steam->frame >= (56 * 64)) @@ -507,7 +507,7 @@ void sprite_misc_explosion_cloud_create(int32_t x, int32_t y, int32_t z) sprite->sprite_height_negative = 32; sprite->sprite_height_positive = 34; sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC; - sprite_move(x, y, z + 4, (rct_sprite*)sprite); + sprite_move(x, y, z + 4, sprite); sprite->type = SPRITE_MISC_EXPLOSION_CLOUD; sprite->frame = 0; } @@ -540,7 +540,7 @@ void sprite_misc_explosion_flare_create(int32_t x, int32_t y, int32_t z) sprite->sprite_height_negative = 85; sprite->sprite_height_positive = 8; sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC; - sprite_move(x, y, z + 4, (rct_sprite*)sprite); + sprite_move(x, y, z + 4, sprite); sprite->type = SPRITE_MISC_EXPLOSION_FLARE; sprite->frame = 0; } @@ -626,7 +626,7 @@ void sprite_misc_update_all() * @param z (dx) * @param sprite (esi) */ -void sprite_move(int16_t x, int16_t y, int16_t z, rct_sprite* sprite) +void sprite_move(int16_t x, int16_t y, int16_t z, SpriteBase* sprite) { if (x < 0 || y < 0 || x > 0x1FFF || y > 0x1FFF) { @@ -634,14 +634,14 @@ void sprite_move(int16_t x, int16_t y, int16_t z, rct_sprite* sprite) } size_t newIndex = GetSpatialIndexOffset(x, y); - size_t currentIndex = GetSpatialIndexOffset(sprite->generic.x, sprite->generic.y); + size_t currentIndex = GetSpatialIndexOffset(sprite->x, sprite->y); if (newIndex != currentIndex) { uint16_t* spriteIndex = &gSpriteSpatialIndex[currentIndex]; if (*spriteIndex != SPRITE_INDEX_NULL) { rct_sprite* sprite2 = get_sprite(*spriteIndex); - while (sprite != sprite2) + while (sprite != &sprite2->generic) { spriteIndex = &sprite2->generic.next_in_quadrant; if (*spriteIndex == SPRITE_INDEX_NULL) @@ -651,23 +651,23 @@ void sprite_move(int16_t x, int16_t y, int16_t z, rct_sprite* sprite) sprite2 = get_sprite(*spriteIndex); } } - *spriteIndex = sprite->generic.next_in_quadrant; + *spriteIndex = sprite->next_in_quadrant; int32_t tempSpriteIndex = gSpriteSpatialIndex[newIndex]; - gSpriteSpatialIndex[newIndex] = sprite->generic.sprite_index; - sprite->generic.next_in_quadrant = tempSpriteIndex; + gSpriteSpatialIndex[newIndex] = sprite->sprite_index; + sprite->next_in_quadrant = tempSpriteIndex; } if (x == LOCATION_NULL) { - sprite->generic.sprite_left = LOCATION_NULL; - sprite->generic.x = x; - sprite->generic.y = y; - sprite->generic.z = z; + sprite->sprite_left = LOCATION_NULL; + sprite->x = x; + sprite->y = y; + sprite->z = z; } else { - sprite_set_coordinates(x, y, z, sprite); + sprite_set_coordinates(x, y, z, (rct_sprite*)sprite); } } @@ -783,7 +783,7 @@ void litter_create(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t t litter->sprite_height_positive = 3; litter->sprite_identifier = SPRITE_IDENTIFIER_LITTER; litter->type = type; - sprite_move(x, y, z, (rct_sprite*)litter); + sprite_move(x, y, z, litter); invalidate_sprite_0((rct_sprite*)litter); litter->creationTick = gScenarioTicks; } diff --git a/src/openrct2/world/Sprite.h b/src/openrct2/world/Sprite.h index eeed06eb60..33632359d9 100644 --- a/src/openrct2/world/Sprite.h +++ b/src/openrct2/world/Sprite.h @@ -201,7 +201,7 @@ void reset_sprite_spatial_index(); void sprite_clear_all_unused(); void move_sprite_to_list(SpriteBase* sprite, SPRITE_LIST newList); void sprite_misc_update_all(); -void sprite_move(int16_t x, int16_t y, int16_t z, rct_sprite* sprite); +void sprite_move(int16_t x, int16_t y, int16_t z, SpriteBase* sprite); void sprite_set_coordinates(int16_t x, int16_t y, int16_t z, rct_sprite* sprite); void invalidate_sprite_0(rct_sprite* sprite); void invalidate_sprite_1(rct_sprite* sprite);