1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-03 14:34:34 +00:00

make RenderObject::followCamera not modified during rendering

This takes out the last of the RenderObject mutables.

This also fixes the long-standing editor bug that map tiles
that are once moved to parallax layers and then back to a
normal layer keep their scroll factor until the tile is deleted
or the map saved and reloaded.
This commit is contained in:
fgenesis 2023-03-02 03:41:00 +01:00
parent 76ba2b1211
commit 28766f0d5a
6 changed files with 60 additions and 54 deletions

View file

@ -34,9 +34,16 @@ inline bool RenderObject::isOnScreen() const
Vector RenderObject::getFollowCameraPosition() const
{
assert(!parent); // this makes no sense when we're not a root object
float f = followCamera;
if (f == 0 && layer != -1)
f = core->renderObjectLayers[layer].followCamera;
int fcl = 0;
if (layer != LR_NONE)
{
const RenderObjectLayer &rl = core->renderObjectLayers[layer];
if(!f)
f = rl.followCamera;
fcl = rl.followCameraLock;
}
if (f <= 0)
{
@ -45,9 +52,6 @@ Vector RenderObject::getFollowCameraPosition() const
else
{
Vector pos = position;
int fcl = 0;
if (layer != -1)
fcl = core->renderObjectLayers[layer].followCameraLock;
switch (fcl)
{