1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-03 10:04:01 +00:00

fix Lua func obj_fhTo() and variants, minor related cleanups in RenderObject

This commit is contained in:
fgenesis 2025-01-13 04:57:35 +01:00
parent 0e1283a4d7
commit 140aa4d78d
2 changed files with 3 additions and 9 deletions

View file

@ -1672,7 +1672,7 @@ luaFunc(obj_fh)
luaFunc(obj_fhTo)
{
RenderObject *r = robj(L);
bool b = getBool(L);
bool b = getBool(L, 2);
if (r)
r->fhTo(b);
luaReturnNil();

View file

@ -227,7 +227,7 @@ Vector RenderObject::getWorldCollidePosition(const Vector &vec) const
void RenderObject::fhTo(bool fh)
{
if ((fh && !_fh) || (!fh && _fh))
if (fh != _fh)
{
flipHorizontal();
}
@ -235,14 +235,8 @@ void RenderObject::fhTo(bool fh)
void RenderObject::flipHorizontal()
{
bool wasFlippedHorizontal = _fh;
_fh = !_fh;
if (wasFlippedHorizontal != _fh)
{
onFH();
}
onFH();
}