mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #12024 from tupaschoal/coords-for-sprites
Make sprite interfaces use CoordsXY*
This commit is contained in:
commit
80efc26a80
|
@ -714,8 +714,8 @@ void Guest::Tick128UpdateGuest(int32_t index)
|
||||||
{
|
{
|
||||||
audio_play_sound_at_location(SoundId::Crash, { x, y, z });
|
audio_play_sound_at_location(SoundId::Crash, { x, y, z });
|
||||||
|
|
||||||
sprite_misc_explosion_cloud_create(x, y, z + 16);
|
sprite_misc_explosion_cloud_create({ x, y, z + 16 });
|
||||||
sprite_misc_explosion_flare_create(x, y, z + 16);
|
sprite_misc_explosion_flare_create({ x, y, z + 16 });
|
||||||
|
|
||||||
Remove();
|
Remove();
|
||||||
return;
|
return;
|
||||||
|
@ -2357,7 +2357,7 @@ void Guest::SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureTyp
|
||||||
// needing to be synchronised
|
// needing to be synchronised
|
||||||
if (network_get_mode() == NETWORK_MODE_NONE && !gOpenRCT2Headless)
|
if (network_get_mode() == NETWORK_MODE_NONE && !gOpenRCT2Headless)
|
||||||
{
|
{
|
||||||
MoneyEffect::CreateAt(amount, x, y, z, true);
|
MoneyEffect::CreateAt(amount, { x, y, z }, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5314,9 +5314,9 @@ void Guest::UpdateWalking()
|
||||||
int32_t litterType = litter_types[scenario_rand() & 0x3];
|
int32_t litterType = litter_types[scenario_rand() & 0x3];
|
||||||
int32_t litterX = x + (scenario_rand() & 0x7) - 3;
|
int32_t litterX = x + (scenario_rand() & 0x7) - 3;
|
||||||
int32_t litterY = y + (scenario_rand() & 0x7) - 3;
|
int32_t litterY = y + (scenario_rand() & 0x7) - 3;
|
||||||
int32_t litterDirection = (scenario_rand() & 0x3);
|
Direction litterDirection = (scenario_rand() & 0x3);
|
||||||
|
|
||||||
litter_create(litterX, litterY, z, litterDirection, litterType);
|
litter_create({ litterX, litterY, z, litterDirection }, litterType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5352,9 +5352,9 @@ void Guest::UpdateWalking()
|
||||||
|
|
||||||
int32_t litterX = x + (scenario_rand() & 0x7) - 3;
|
int32_t litterX = x + (scenario_rand() & 0x7) - 3;
|
||||||
int32_t litterY = y + (scenario_rand() & 0x7) - 3;
|
int32_t litterY = y + (scenario_rand() & 0x7) - 3;
|
||||||
int32_t litterDirection = (scenario_rand() & 0x3);
|
Direction litterDirection = (scenario_rand() & 0x3);
|
||||||
|
|
||||||
litter_create(litterX, litterY, z, litterDirection, litterType);
|
litter_create({ litterX, litterY, z, litterDirection }, litterType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5917,7 +5917,7 @@ void Guest::UpdateUsingBin()
|
||||||
int32_t litterX = x + (scenario_rand() & 7) - 3;
|
int32_t litterX = x + (scenario_rand() & 7) - 3;
|
||||||
int32_t litterY = y + (scenario_rand() & 7) - 3;
|
int32_t litterY = y + (scenario_rand() & 7) - 3;
|
||||||
|
|
||||||
litter_create(litterX, litterY, z, scenario_rand() & 3, litterType);
|
litter_create({ litterX, litterY, z, static_cast<Direction>(scenario_rand() & 3) }, litterType);
|
||||||
ItemStandardFlags &= ~(1 << cur_container);
|
ItemStandardFlags &= ~(1 << cur_container);
|
||||||
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
|
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
|
||||||
|
|
||||||
|
@ -5951,7 +5951,7 @@ void Guest::UpdateUsingBin()
|
||||||
int32_t litterX = x + (scenario_rand() & 7) - 3;
|
int32_t litterX = x + (scenario_rand() & 7) - 3;
|
||||||
int32_t litterY = y + (scenario_rand() & 7) - 3;
|
int32_t litterY = y + (scenario_rand() & 7) - 3;
|
||||||
|
|
||||||
litter_create(litterX, litterY, z, scenario_rand() & 3, litterType);
|
litter_create({ litterX, litterY, z, static_cast<Direction>(scenario_rand() & 3) }, litterType);
|
||||||
ItemExtraFlags &= ~(1 << cur_container);
|
ItemExtraFlags &= ~(1 << cur_container);
|
||||||
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
|
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
|
||||||
|
|
||||||
|
@ -6831,7 +6831,7 @@ void Guest::UpdateSpriteType()
|
||||||
isBalloonPopped = true;
|
isBalloonPopped = true;
|
||||||
audio_play_sound_at_location(SoundId::BalloonPop, { x, y, z });
|
audio_play_sound_at_location(SoundId::BalloonPop, { x, y, z });
|
||||||
}
|
}
|
||||||
create_balloon(x, y, z + 9, BalloonColour, isBalloonPopped);
|
create_balloon({ x, y, z + 9 }, BalloonColour, isBalloonPopped);
|
||||||
}
|
}
|
||||||
ItemStandardFlags &= ~PEEP_ITEM_BALLOON;
|
ItemStandardFlags &= ~PEEP_ITEM_BALLOON;
|
||||||
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
|
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
|
||||||
|
|
|
@ -653,7 +653,7 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
|
||||||
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_2;
|
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_2;
|
||||||
|
|
||||||
// Create sick at location
|
// Create sick at location
|
||||||
litter_create(x, y, z, sprite_direction, (sprite_index & 1) ? LITTER_TYPE_SICK_ALT : LITTER_TYPE_SICK);
|
litter_create({ x, y, z, sprite_direction }, (sprite_index & 1) ? LITTER_TYPE_SICK_ALT : LITTER_TYPE_SICK);
|
||||||
|
|
||||||
SoundId coughs[4] = { SoundId::Cough1, SoundId::Cough2, SoundId::Cough3, SoundId::Cough4 };
|
SoundId coughs[4] = { SoundId::Cough1, SoundId::Cough2, SoundId::Cough3, SoundId::Cough4 };
|
||||||
auto soundId = coughs[scenario_rand() & 3];
|
auto soundId = coughs[scenario_rand() & 3];
|
||||||
|
@ -3362,7 +3362,7 @@ static void peep_release_balloon(Guest* peep, int16_t spawn_height)
|
||||||
|
|
||||||
if (peep->SpriteType == PEEP_SPRITE_TYPE_BALLOON && peep->x != LOCATION_NULL)
|
if (peep->SpriteType == PEEP_SPRITE_TYPE_BALLOON && peep->x != LOCATION_NULL)
|
||||||
{
|
{
|
||||||
create_balloon(peep->x, peep->y, spawn_height, peep->BalloonColour, false);
|
create_balloon({ peep->x, peep->y, spawn_height }, peep->BalloonColour, false);
|
||||||
peep->WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
|
peep->WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
|
||||||
peep->UpdateSpriteType();
|
peep->UpdateSpriteType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1386,7 +1386,7 @@ void Staff::UpdateSweeping()
|
||||||
if (Action == PEEP_ACTION_STAFF_SWEEP && ActionFrame == 8)
|
if (Action == PEEP_ACTION_STAFF_SWEEP && ActionFrame == 8)
|
||||||
{
|
{
|
||||||
// Remove sick at this location
|
// Remove sick at this location
|
||||||
litter_remove_at(x, y, z);
|
litter_remove_at({ x, y, z });
|
||||||
StaffLitterSwept++;
|
StaffLitterSwept++;
|
||||||
WindowInvalidateFlags |= PEEP_INVALIDATE_STAFF_STATS;
|
WindowInvalidateFlags |= PEEP_INVALIDATE_STAFF_STATS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3570,11 +3570,11 @@ void Vehicle::UpdateCollisionSetup()
|
||||||
|
|
||||||
audio_play_sound_at_location(SoundId::Crash, { train->x, train->y, train->z });
|
audio_play_sound_at_location(SoundId::Crash, { train->x, train->y, train->z });
|
||||||
|
|
||||||
sprite_misc_explosion_cloud_create(train->x, train->y, train->z);
|
sprite_misc_explosion_cloud_create({ train->x, train->y, train->z });
|
||||||
|
|
||||||
for (int32_t i = 0; i < 10; i++)
|
for (int32_t i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
crashed_vehicle_particle_create(train->colours, train->x, train->y, train->z);
|
crashed_vehicle_particle_create(train->colours, { train->x, train->y, train->z });
|
||||||
}
|
}
|
||||||
|
|
||||||
train->flags |= SPRITE_FLAGS_IS_CRASHED_VEHICLE_SPRITE;
|
train->flags |= SPRITE_FLAGS_IS_CRASHED_VEHICLE_SPRITE;
|
||||||
|
@ -5294,13 +5294,13 @@ void Vehicle::CrashOnLand()
|
||||||
sub_state = 2;
|
sub_state = 2;
|
||||||
audio_play_sound_at_location(SoundId::Crash, { x, y, z });
|
audio_play_sound_at_location(SoundId::Crash, { x, y, z });
|
||||||
|
|
||||||
sprite_misc_explosion_cloud_create(x, y, z);
|
sprite_misc_explosion_cloud_create({ x, y, z });
|
||||||
sprite_misc_explosion_flare_create(x, y, z);
|
sprite_misc_explosion_flare_create({ x, y, z });
|
||||||
|
|
||||||
uint8_t numParticles = std::min(sprite_width, static_cast<uint8_t>(7));
|
uint8_t numParticles = std::min(sprite_width, static_cast<uint8_t>(7));
|
||||||
|
|
||||||
while (numParticles-- != 0)
|
while (numParticles-- != 0)
|
||||||
crashed_vehicle_particle_create(colours, x, y, z);
|
crashed_vehicle_particle_create(colours, { x, y, z });
|
||||||
|
|
||||||
flags |= SPRITE_FLAGS_IS_CRASHED_VEHICLE_SPRITE;
|
flags |= SPRITE_FLAGS_IS_CRASHED_VEHICLE_SPRITE;
|
||||||
animation_frame = 0;
|
animation_frame = 0;
|
||||||
|
@ -5357,14 +5357,14 @@ void Vehicle::CrashOnWater()
|
||||||
sub_state = 2;
|
sub_state = 2;
|
||||||
audio_play_sound_at_location(SoundId::Water1, { x, y, z });
|
audio_play_sound_at_location(SoundId::Water1, { x, y, z });
|
||||||
|
|
||||||
crash_splash_create(x, y, z);
|
crash_splash_create({ x, y, z });
|
||||||
crash_splash_create(x - 8, y - 9, z);
|
crash_splash_create({ x - 8, y - 9, z });
|
||||||
crash_splash_create(x + 11, y - 9, z);
|
crash_splash_create({ x + 11, y - 9, z });
|
||||||
crash_splash_create(x + 11, y + 8, z);
|
crash_splash_create({ x + 11, y + 8, z });
|
||||||
crash_splash_create(x - 4, y + 8, z);
|
crash_splash_create({ x - 4, y + 8, z });
|
||||||
|
|
||||||
for (int32_t i = 0; i < 10; ++i)
|
for (int32_t i = 0; i < 10; ++i)
|
||||||
crashed_vehicle_particle_create(colours, x - 4, y + 8, z);
|
crashed_vehicle_particle_create(colours, { x - 4, y + 8, z });
|
||||||
|
|
||||||
flags |= SPRITE_FLAGS_IS_CRASHED_VEHICLE_SPRITE;
|
flags |= SPRITE_FLAGS_IS_CRASHED_VEHICLE_SPRITE;
|
||||||
animation_frame = 0;
|
animation_frame = 0;
|
||||||
|
@ -5397,9 +5397,9 @@ void Vehicle::UpdateCrash()
|
||||||
curVehicle->crash_z++;
|
curVehicle->crash_z++;
|
||||||
if ((scenario_rand() & 0xFFFF) <= 0x1555)
|
if ((scenario_rand() & 0xFFFF) <= 0x1555)
|
||||||
{
|
{
|
||||||
auto xOffset = (scenario_rand() & 2) - 1;
|
int32_t xOffset = (scenario_rand() & 2) - 1;
|
||||||
auto yOffset = (scenario_rand() & 2) - 1;
|
int32_t yOffset = (scenario_rand() & 2) - 1;
|
||||||
sprite_misc_explosion_cloud_create(curVehicle->x + xOffset, curVehicle->y + yOffset, curVehicle->z);
|
sprite_misc_explosion_cloud_create({ curVehicle->x + xOffset, curVehicle->y + yOffset, curVehicle->z });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (curVehicle->var_C8 + 7281 > 0xFFFF)
|
if (curVehicle->var_C8 + 7281 > 0xFFFF)
|
||||||
|
|
|
@ -79,7 +79,7 @@ void Balloon::Pop()
|
||||||
audio_play_sound_at_location(SoundId::BalloonPop, { x, y, z });
|
audio_play_sound_at_location(SoundId::BalloonPop, { x, y, z });
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_balloon(int32_t x, int32_t y, int32_t z, int32_t colour, bool isPopped)
|
void create_balloon(const CoordsXYZ& balloonPos, int32_t colour, bool isPopped)
|
||||||
{
|
{
|
||||||
rct_sprite* sprite = create_sprite(SPRITE_IDENTIFIER_MISC);
|
rct_sprite* sprite = create_sprite(SPRITE_IDENTIFIER_MISC);
|
||||||
if (sprite != nullptr)
|
if (sprite != nullptr)
|
||||||
|
@ -88,7 +88,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_negative = 22;
|
||||||
sprite->balloon.sprite_height_positive = 11;
|
sprite->balloon.sprite_height_positive = 11;
|
||||||
sprite->balloon.sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
sprite->balloon.sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
||||||
sprite->balloon.MoveTo({ x, y, z });
|
sprite->balloon.MoveTo(balloonPos);
|
||||||
sprite->balloon.type = SPRITE_MISC_BALLOON;
|
sprite->balloon.type = SPRITE_MISC_BALLOON;
|
||||||
sprite->balloon.time_to_move = 0;
|
sprite->balloon.time_to_move = 0;
|
||||||
sprite->balloon.frame = 0;
|
sprite->balloon.frame = 0;
|
||||||
|
|
|
@ -27,7 +27,7 @@ template<> bool SpriteBase::Is<MoneyEffect>() const
|
||||||
*
|
*
|
||||||
* rct2: 0x0067351F
|
* rct2: 0x0067351F
|
||||||
*/
|
*/
|
||||||
void MoneyEffect::CreateAt(money32 value, int32_t x, int32_t y, int32_t z, bool vertical)
|
void MoneyEffect::CreateAt(money32 value, const CoordsXYZ& effectPos, bool vertical)
|
||||||
{
|
{
|
||||||
if (value == MONEY(0, 00))
|
if (value == MONEY(0, 00))
|
||||||
return;
|
return;
|
||||||
|
@ -42,7 +42,7 @@ void MoneyEffect::CreateAt(money32 value, int32_t x, int32_t y, int32_t z, bool
|
||||||
moneyEffect->sprite_height_negative = 20;
|
moneyEffect->sprite_height_negative = 20;
|
||||||
moneyEffect->sprite_height_positive = 30;
|
moneyEffect->sprite_height_positive = 30;
|
||||||
moneyEffect->sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
moneyEffect->sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
||||||
moneyEffect->MoveTo({ x, y, z });
|
moneyEffect->MoveTo(effectPos);
|
||||||
moneyEffect->type = SPRITE_MISC_MONEY_EFFECT;
|
moneyEffect->type = SPRITE_MISC_MONEY_EFFECT;
|
||||||
moneyEffect->NumMovements = 0;
|
moneyEffect->NumMovements = 0;
|
||||||
moneyEffect->MoveDelay = 0;
|
moneyEffect->MoveDelay = 0;
|
||||||
|
@ -64,8 +64,9 @@ void MoneyEffect::CreateAt(money32 value, int32_t x, int32_t y, int32_t z, bool
|
||||||
*
|
*
|
||||||
* rct2: 0x0069C5D0
|
* rct2: 0x0069C5D0
|
||||||
*/
|
*/
|
||||||
void MoneyEffect::Create(money32 value, CoordsXYZ loc)
|
void MoneyEffect::Create(money32 value, const CoordsXYZ& loc)
|
||||||
{
|
{
|
||||||
|
auto offsetLoc = loc;
|
||||||
if (loc.isNull())
|
if (loc.isNull())
|
||||||
{
|
{
|
||||||
// If game actions return no valid location of the action we can not use the screen
|
// If game actions return no valid location of the action we can not use the screen
|
||||||
|
@ -86,10 +87,10 @@ void MoneyEffect::Create(money32 value, CoordsXYZ loc)
|
||||||
if (!mapPositionXY)
|
if (!mapPositionXY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
loc = { *mapPositionXY, tile_element_height(*mapPositionXY) };
|
offsetLoc = { *mapPositionXY, tile_element_height(*mapPositionXY) };
|
||||||
}
|
}
|
||||||
loc.z += 10;
|
offsetLoc.z += 10;
|
||||||
CreateAt(-value, loc.x, loc.y, loc.z, false);
|
CreateAt(-value, offsetLoc, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,7 +27,7 @@ template<> bool SpriteBase::Is<CrashSplashParticle>() const
|
||||||
*
|
*
|
||||||
* rct2: 0x006735A1
|
* rct2: 0x006735A1
|
||||||
*/
|
*/
|
||||||
void crashed_vehicle_particle_create(rct_vehicle_colour colours, int32_t x, int32_t y, int32_t z)
|
void crashed_vehicle_particle_create(rct_vehicle_colour colours, const CoordsXYZ& vehiclePos)
|
||||||
{
|
{
|
||||||
VehicleCrashParticle* sprite = &create_sprite(SPRITE_IDENTIFIER_MISC)->crashed_vehicle_particle;
|
VehicleCrashParticle* sprite = &create_sprite(SPRITE_IDENTIFIER_MISC)->crashed_vehicle_particle;
|
||||||
if (sprite != nullptr)
|
if (sprite != nullptr)
|
||||||
|
@ -38,7 +38,7 @@ void crashed_vehicle_particle_create(rct_vehicle_colour colours, int32_t x, int3
|
||||||
sprite->sprite_height_negative = 8;
|
sprite->sprite_height_negative = 8;
|
||||||
sprite->sprite_height_positive = 8;
|
sprite->sprite_height_positive = 8;
|
||||||
sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
||||||
sprite->MoveTo({ x, y, z });
|
sprite->MoveTo(vehiclePos);
|
||||||
sprite->type = SPRITE_MISC_CRASHED_VEHICLE_PARTICLE;
|
sprite->type = SPRITE_MISC_CRASHED_VEHICLE_PARTICLE;
|
||||||
|
|
||||||
sprite->frame = (scenario_rand() & 0xFF) * 12;
|
sprite->frame = (scenario_rand() & 0xFF) * 12;
|
||||||
|
@ -96,7 +96,7 @@ void crashed_vehicle_particle_update(VehicleCrashParticle* particle)
|
||||||
{
|
{
|
||||||
// Splash
|
// Splash
|
||||||
audio_play_sound_at_location(SoundId::Water2, { particle->x, particle->y, waterZ });
|
audio_play_sound_at_location(SoundId::Water2, { particle->x, particle->y, waterZ });
|
||||||
crash_splash_create(particle->x, particle->y, waterZ);
|
crash_splash_create({ particle->x, particle->y, waterZ });
|
||||||
sprite_remove(particle);
|
sprite_remove(particle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ void crashed_vehicle_particle_update(VehicleCrashParticle* particle)
|
||||||
*
|
*
|
||||||
* rct2: 0x00673699
|
* rct2: 0x00673699
|
||||||
*/
|
*/
|
||||||
void crash_splash_create(int32_t x, int32_t y, int32_t z)
|
void crash_splash_create(const CoordsXYZ& splashPos)
|
||||||
{
|
{
|
||||||
SpriteGeneric* sprite = &create_sprite(SPRITE_IDENTIFIER_MISC)->generic;
|
SpriteGeneric* sprite = &create_sprite(SPRITE_IDENTIFIER_MISC)->generic;
|
||||||
if (sprite != nullptr)
|
if (sprite != nullptr)
|
||||||
|
@ -130,7 +130,7 @@ void crash_splash_create(int32_t x, int32_t y, int32_t z)
|
||||||
sprite->sprite_height_negative = 51;
|
sprite->sprite_height_negative = 51;
|
||||||
sprite->sprite_height_positive = 16;
|
sprite->sprite_height_positive = 16;
|
||||||
sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
||||||
sprite->MoveTo({ x, y, z + 3 });
|
sprite->MoveTo(splashPos + CoordsXYZ{ 0, 0, 3 });
|
||||||
sprite->type = SPRITE_MISC_CRASH_SPLASH;
|
sprite->type = SPRITE_MISC_CRASH_SPLASH;
|
||||||
sprite->frame = 0;
|
sprite->frame = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,9 +122,9 @@ SpriteBase* GetEntity(size_t sprite_idx)
|
||||||
return GetEntity<SpriteBase>(sprite_idx);
|
return GetEntity<SpriteBase>(sprite_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t sprite_get_first_in_quadrant(int32_t x, int32_t y)
|
uint16_t sprite_get_first_in_quadrant(const CoordsXY& spritePos)
|
||||||
{
|
{
|
||||||
return gSpriteSpatialIndex[GetSpatialIndexOffset(x, y)];
|
return gSpriteSpatialIndex[GetSpatialIndexOffset(spritePos.x, spritePos.y)];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void invalidate_sprite_max_zoom(SpriteBase* sprite, int32_t maxZoom)
|
static void invalidate_sprite_max_zoom(SpriteBase* sprite, int32_t maxZoom)
|
||||||
|
@ -521,7 +521,7 @@ static void sprite_steam_particle_update(SteamParticle* steam)
|
||||||
*
|
*
|
||||||
* rct2: 0x0067363D
|
* rct2: 0x0067363D
|
||||||
*/
|
*/
|
||||||
void sprite_misc_explosion_cloud_create(int32_t x, int32_t y, int32_t z)
|
void sprite_misc_explosion_cloud_create(const CoordsXYZ& cloudPos)
|
||||||
{
|
{
|
||||||
SpriteGeneric* sprite = &create_sprite(SPRITE_IDENTIFIER_MISC)->generic;
|
SpriteGeneric* sprite = &create_sprite(SPRITE_IDENTIFIER_MISC)->generic;
|
||||||
if (sprite != nullptr)
|
if (sprite != nullptr)
|
||||||
|
@ -530,7 +530,7 @@ void sprite_misc_explosion_cloud_create(int32_t x, int32_t y, int32_t z)
|
||||||
sprite->sprite_height_negative = 32;
|
sprite->sprite_height_negative = 32;
|
||||||
sprite->sprite_height_positive = 34;
|
sprite->sprite_height_positive = 34;
|
||||||
sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
||||||
sprite->MoveTo({ x, y, z + 4 });
|
sprite->MoveTo(cloudPos + CoordsXYZ{ 0, 0, 4 });
|
||||||
sprite->type = SPRITE_MISC_EXPLOSION_CLOUD;
|
sprite->type = SPRITE_MISC_EXPLOSION_CLOUD;
|
||||||
sprite->frame = 0;
|
sprite->frame = 0;
|
||||||
}
|
}
|
||||||
|
@ -554,7 +554,7 @@ static void sprite_misc_explosion_cloud_update(rct_sprite* sprite)
|
||||||
*
|
*
|
||||||
* rct2: 0x0067366B
|
* rct2: 0x0067366B
|
||||||
*/
|
*/
|
||||||
void sprite_misc_explosion_flare_create(int32_t x, int32_t y, int32_t z)
|
void sprite_misc_explosion_flare_create(const CoordsXYZ& flarePos)
|
||||||
{
|
{
|
||||||
SpriteGeneric* sprite = &create_sprite(SPRITE_IDENTIFIER_MISC)->generic;
|
SpriteGeneric* sprite = &create_sprite(SPRITE_IDENTIFIER_MISC)->generic;
|
||||||
if (sprite != nullptr)
|
if (sprite != nullptr)
|
||||||
|
@ -563,7 +563,7 @@ void sprite_misc_explosion_flare_create(int32_t x, int32_t y, int32_t z)
|
||||||
sprite->sprite_height_negative = 85;
|
sprite->sprite_height_negative = 85;
|
||||||
sprite->sprite_height_positive = 8;
|
sprite->sprite_height_positive = 8;
|
||||||
sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
sprite->sprite_identifier = SPRITE_IDENTIFIER_MISC;
|
||||||
sprite->MoveTo({ x, y, z + 4 });
|
sprite->MoveTo(flarePos + CoordsXYZ{ 0, 0, 4 });
|
||||||
sprite->type = SPRITE_MISC_EXPLOSION_FLARE;
|
sprite->type = SPRITE_MISC_EXPLOSION_FLARE;
|
||||||
sprite->frame = 0;
|
sprite->frame = 0;
|
||||||
}
|
}
|
||||||
|
@ -715,22 +715,21 @@ void SpriteBase::MoveTo(const CoordsXYZ& newLocation)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprite_set_coordinates(loc.x, loc.y, loc.z, this);
|
sprite_set_coordinates(loc, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sprite_set_coordinates(int16_t x, int16_t y, int16_t z, SpriteBase* sprite)
|
void sprite_set_coordinates(const CoordsXYZ& spritePos, SpriteBase* sprite)
|
||||||
{
|
{
|
||||||
CoordsXYZ coords3d = { x, y, z };
|
auto screenCoords = translate_3d_to_2d_with_z(get_current_rotation(), spritePos);
|
||||||
auto screenCoords = translate_3d_to_2d_with_z(get_current_rotation(), coords3d);
|
|
||||||
|
|
||||||
sprite->sprite_left = screenCoords.x - sprite->sprite_width;
|
sprite->sprite_left = screenCoords.x - sprite->sprite_width;
|
||||||
sprite->sprite_right = screenCoords.x + sprite->sprite_width;
|
sprite->sprite_right = screenCoords.x + sprite->sprite_width;
|
||||||
sprite->sprite_top = screenCoords.y - sprite->sprite_height_negative;
|
sprite->sprite_top = screenCoords.y - sprite->sprite_height_negative;
|
||||||
sprite->sprite_bottom = screenCoords.y + sprite->sprite_height_positive;
|
sprite->sprite_bottom = screenCoords.y + sprite->sprite_height_positive;
|
||||||
sprite->x = x;
|
sprite->x = spritePos.x;
|
||||||
sprite->y = y;
|
sprite->y = spritePos.y;
|
||||||
sprite->z = z;
|
sprite->z = spritePos.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -759,14 +758,14 @@ void sprite_remove(SpriteBase* sprite)
|
||||||
*spriteIndex = sprite->next_in_quadrant;
|
*spriteIndex = sprite->next_in_quadrant;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool litter_can_be_at(int32_t x, int32_t y, int32_t z)
|
static bool litter_can_be_at(const CoordsXYZ& mapPos)
|
||||||
{
|
{
|
||||||
TileElement* tileElement;
|
TileElement* tileElement;
|
||||||
|
|
||||||
if (!map_is_location_owned({ x, y, z }))
|
if (!map_is_location_owned(mapPos))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
tileElement = map_get_first_element_at({ x, y });
|
tileElement = map_get_first_element_at(mapPos);
|
||||||
if (tileElement == nullptr)
|
if (tileElement == nullptr)
|
||||||
return false;
|
return false;
|
||||||
do
|
do
|
||||||
|
@ -775,7 +774,7 @@ static bool litter_can_be_at(int32_t x, int32_t y, int32_t z)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int32_t pathZ = tileElement->GetBaseZ();
|
int32_t pathZ = tileElement->GetBaseZ();
|
||||||
if (pathZ < z || pathZ >= z + 32)
|
if (pathZ < mapPos.z || pathZ >= mapPos.z + 32)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return !tile_element_is_underground(tileElement);
|
return !tile_element_is_underground(tileElement);
|
||||||
|
@ -787,15 +786,16 @@ static bool litter_can_be_at(int32_t x, int32_t y, int32_t z)
|
||||||
*
|
*
|
||||||
* rct2: 0x0067375D
|
* rct2: 0x0067375D
|
||||||
*/
|
*/
|
||||||
void litter_create(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t type)
|
void litter_create(const CoordsXYZD& litterPos, int32_t type)
|
||||||
{
|
{
|
||||||
if (gCheatsDisableLittering)
|
if (gCheatsDisableLittering)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
x += CoordsDirectionDelta[direction >> 3].x / 8;
|
auto offsetLitterPos = litterPos
|
||||||
y += CoordsDirectionDelta[direction >> 3].y / 8;
|
+ CoordsXY{ CoordsDirectionDelta[litterPos.direction >> 3].x / 8,
|
||||||
|
CoordsDirectionDelta[litterPos.direction >> 3].y / 8 };
|
||||||
|
|
||||||
if (!litter_can_be_at(x, y, z))
|
if (!litter_can_be_at(offsetLitterPos))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gSpriteListCount[SPRITE_LIST_LITTER] >= 500)
|
if (gSpriteListCount[SPRITE_LIST_LITTER] >= 500)
|
||||||
|
@ -822,13 +822,13 @@ void litter_create(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t t
|
||||||
if (litter == nullptr)
|
if (litter == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
litter->sprite_direction = direction;
|
litter->sprite_direction = offsetLitterPos.direction;
|
||||||
litter->sprite_width = 6;
|
litter->sprite_width = 6;
|
||||||
litter->sprite_height_negative = 6;
|
litter->sprite_height_negative = 6;
|
||||||
litter->sprite_height_positive = 3;
|
litter->sprite_height_positive = 3;
|
||||||
litter->sprite_identifier = SPRITE_IDENTIFIER_LITTER;
|
litter->sprite_identifier = SPRITE_IDENTIFIER_LITTER;
|
||||||
litter->type = type;
|
litter->type = type;
|
||||||
litter->MoveTo({ x, y, z });
|
litter->MoveTo(offsetLitterPos);
|
||||||
litter->Invalidate0();
|
litter->Invalidate0();
|
||||||
litter->creationTick = gScenarioTicks;
|
litter->creationTick = gScenarioTicks;
|
||||||
}
|
}
|
||||||
|
@ -837,13 +837,13 @@ void litter_create(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t t
|
||||||
*
|
*
|
||||||
* rct2: 0x006738E1
|
* rct2: 0x006738E1
|
||||||
*/
|
*/
|
||||||
void litter_remove_at(int32_t x, int32_t y, int32_t z)
|
void litter_remove_at(const CoordsXYZ& litterPos)
|
||||||
{
|
{
|
||||||
for (auto litter : EntityTileList<Litter>({ x, y }))
|
for (auto litter : EntityTileList<Litter>(litterPos))
|
||||||
{
|
{
|
||||||
if (abs(litter->z - z) <= 16)
|
if (abs(litter->z - litterPos.z) <= 16)
|
||||||
{
|
{
|
||||||
if (abs(litter->x - x) <= 8 && abs(litter->y - y) <= 8)
|
if (abs(litter->x - litterPos.x) <= 8 && abs(litter->y - litterPos.y) <= 8)
|
||||||
{
|
{
|
||||||
litter->Invalidate0();
|
litter->Invalidate0();
|
||||||
sprite_remove(litter);
|
sprite_remove(litter);
|
||||||
|
@ -938,8 +938,10 @@ void sprite_position_tween_all(float alpha)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sprite_set_coordinates(
|
sprite_set_coordinates(
|
||||||
std::round(posB.x * alpha + posA.x * inv), std::round(posB.y * alpha + posA.y * inv),
|
{ static_cast<int32_t>(std::round(posB.x * alpha + posA.x * inv)),
|
||||||
std::round(posB.z * alpha + posA.z * inv), sprite);
|
static_cast<int32_t>(std::round(posB.y * alpha + posA.y * inv)),
|
||||||
|
static_cast<int32_t>(std::round(posB.z * alpha + posA.z * inv)) },
|
||||||
|
sprite);
|
||||||
sprite->Invalidate2();
|
sprite->Invalidate2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -958,7 +960,7 @@ void sprite_position_tween_restore()
|
||||||
sprite->Invalidate2();
|
sprite->Invalidate2();
|
||||||
|
|
||||||
auto pos = _spritelocations2[i];
|
auto pos = _spritelocations2[i];
|
||||||
sprite_set_coordinates(pos.x, pos.y, pos.z, sprite);
|
sprite_set_coordinates(pos, sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,8 @@ struct MoneyEffect : SpriteBase
|
||||||
int16_t OffsetX;
|
int16_t OffsetX;
|
||||||
uint16_t Wiggle;
|
uint16_t Wiggle;
|
||||||
|
|
||||||
static void CreateAt(money32 value, int32_t x, int32_t y, int32_t z, bool vertical);
|
static void CreateAt(money32 value, const CoordsXYZ& effectPos, bool vertical);
|
||||||
static void Create(money32 value, CoordsXYZ loc);
|
static void Create(money32 value, const CoordsXYZ& loc);
|
||||||
void Update();
|
void Update();
|
||||||
std::pair<rct_string_id, money32> GetStringId() const;
|
std::pair<rct_string_id, money32> GetStringId() const;
|
||||||
};
|
};
|
||||||
|
@ -217,14 +217,14 @@ void reset_sprite_list();
|
||||||
void reset_sprite_spatial_index();
|
void reset_sprite_spatial_index();
|
||||||
void sprite_clear_all_unused();
|
void sprite_clear_all_unused();
|
||||||
void sprite_misc_update_all();
|
void sprite_misc_update_all();
|
||||||
void sprite_set_coordinates(int16_t x, int16_t y, int16_t z, SpriteBase* sprite);
|
void sprite_set_coordinates(const CoordsXYZ& spritePos, SpriteBase* sprite);
|
||||||
void sprite_remove(SpriteBase* sprite);
|
void sprite_remove(SpriteBase* sprite);
|
||||||
void litter_create(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t type);
|
void litter_create(const CoordsXYZD& litterPos, int32_t type);
|
||||||
void litter_remove_at(int32_t x, int32_t y, int32_t z);
|
void litter_remove_at(const CoordsXYZ& litterPos);
|
||||||
uint16_t remove_floating_sprites();
|
uint16_t remove_floating_sprites();
|
||||||
void sprite_misc_explosion_cloud_create(int32_t x, int32_t y, int32_t z);
|
void sprite_misc_explosion_cloud_create(const CoordsXYZ& cloudPos);
|
||||||
void sprite_misc_explosion_flare_create(int32_t x, int32_t y, int32_t z);
|
void sprite_misc_explosion_flare_create(const CoordsXYZ& flarePos);
|
||||||
uint16_t sprite_get_first_in_quadrant(int32_t x, int32_t y);
|
uint16_t sprite_get_first_in_quadrant(const CoordsXY& spritePos);
|
||||||
void sprite_position_tween_store_a();
|
void sprite_position_tween_store_a();
|
||||||
void sprite_position_tween_store_b();
|
void sprite_position_tween_store_b();
|
||||||
void sprite_position_tween_all(float nudge);
|
void sprite_position_tween_all(float nudge);
|
||||||
|
@ -234,7 +234,7 @@ void sprite_position_tween_reset();
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Balloon
|
// Balloon
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
void create_balloon(int32_t x, int32_t y, int32_t z, int32_t colour, bool isPopped);
|
void create_balloon(const CoordsXYZ& balloonPos, int32_t colour, bool isPopped);
|
||||||
void balloon_update(Balloon* balloon);
|
void balloon_update(Balloon* balloon);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
@ -249,9 +249,9 @@ uint32_t duck_get_frame_image(const Duck* duck, int32_t direction);
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Crash particles
|
// Crash particles
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
void crashed_vehicle_particle_create(rct_vehicle_colour colours, int32_t x, int32_t y, int32_t z);
|
void crashed_vehicle_particle_create(rct_vehicle_colour colours, const CoordsXYZ& vehiclePos);
|
||||||
void crashed_vehicle_particle_update(VehicleCrashParticle* particle);
|
void crashed_vehicle_particle_update(VehicleCrashParticle* particle);
|
||||||
void crash_splash_create(int32_t x, int32_t y, int32_t z);
|
void crash_splash_create(const CoordsXYZ& splashPos);
|
||||||
void crash_splash_update(CrashSplashParticle* splash);
|
void crash_splash_update(CrashSplashParticle* splash);
|
||||||
|
|
||||||
rct_sprite_checksum sprite_checksum();
|
rct_sprite_checksum sprite_checksum();
|
||||||
|
@ -326,7 +326,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EntityTileList(const CoordsXY& loc)
|
EntityTileList(const CoordsXY& loc)
|
||||||
: FirstEntity(sprite_get_first_in_quadrant(loc.x, loc.y))
|
: FirstEntity(sprite_get_first_in_quadrant(loc))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue