mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-02-01 03:05:24 +01:00
Fix #23206: Desyncs when using uncapped FPS
Because the position is one tick behind the spatial mapping was incorrect, it's not allowed to modify that during interpolation.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
- Feature: [#23166] Add Galician translation.
|
||||
- Improved: [#23051] Add large sloped turns and new inversions to the Twister, Vertical Drop, Hyper and Flying Roller Coasters.
|
||||
- Improved: [#23123] Improve sorting of roller coasters in build new ride menu.
|
||||
- Fix: [#23206] Multiplayer desyncs when FPS is uncapped.
|
||||
|
||||
0.4.16 (2024-11-03)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
@@ -481,6 +481,16 @@ void EntityBase::SetLocation(const CoordsXYZ& newLocation)
|
||||
SpatialIndex |= kSpatialIndexDirtyMask;
|
||||
}
|
||||
|
||||
static void EntitySetCoordinates(const CoordsXYZ& entityPos, EntityBase* entity)
|
||||
{
|
||||
auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), entityPos);
|
||||
|
||||
entity->SpriteData.SpriteRect = ScreenRect(
|
||||
screenCoords - ScreenCoordsXY{ entity->SpriteData.Width, entity->SpriteData.HeightMin },
|
||||
screenCoords + ScreenCoordsXY{ entity->SpriteData.Width, entity->SpriteData.HeightMax });
|
||||
entity->SetLocation(entityPos);
|
||||
}
|
||||
|
||||
void EntityBase::MoveTo(const CoordsXYZ& newLocation)
|
||||
{
|
||||
if (x != kLocationNull)
|
||||
@@ -506,16 +516,6 @@ void EntityBase::MoveTo(const CoordsXYZ& newLocation)
|
||||
}
|
||||
}
|
||||
|
||||
void EntitySetCoordinates(const CoordsXYZ& entityPos, EntityBase* entity)
|
||||
{
|
||||
auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), entityPos);
|
||||
|
||||
entity->SpriteData.SpriteRect = ScreenRect(
|
||||
screenCoords - ScreenCoordsXY{ entity->SpriteData.Width, entity->SpriteData.HeightMin },
|
||||
screenCoords + ScreenCoordsXY{ entity->SpriteData.Width, entity->SpriteData.HeightMax });
|
||||
entity->SetLocation(entityPos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees any dynamically attached memory to the entity, such as peep name.
|
||||
*/
|
||||
|
||||
@@ -67,7 +67,6 @@ void ResetAllEntities();
|
||||
void ResetEntitySpatialIndices();
|
||||
void UpdateAllMiscEntities();
|
||||
void UpdateMoneyEffect();
|
||||
void EntitySetCoordinates(const CoordsXYZ& entityPos, EntityBase* entity);
|
||||
void EntityRemove(EntityBase* entity);
|
||||
uint16_t RemoveFloatingEntities();
|
||||
void UpdateEntitiesSpatialIndex();
|
||||
|
||||
@@ -101,8 +101,6 @@ void EntityTweener::Tween(float alpha)
|
||||
static_cast<int32_t>(std::round(posB.y * alpha + posA.y * inv)),
|
||||
static_cast<int32_t>(std::round(posB.z * alpha + posA.z * inv)) });
|
||||
}
|
||||
|
||||
UpdateEntitiesSpatialIndex();
|
||||
}
|
||||
|
||||
void EntityTweener::Restore()
|
||||
@@ -113,9 +111,7 @@ void EntityTweener::Restore()
|
||||
if (ent == nullptr)
|
||||
continue;
|
||||
|
||||
ent->Invalidate();
|
||||
EntitySetCoordinates(PostPos[i], ent);
|
||||
ent->Invalidate();
|
||||
ent->MoveTo(PostPos[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user