Open khiav223577 opened 3 years ago
mkxp uses the single-precision floating-point format for this and similar attributes while RGSS uses double-precision.
However even if it would be changed to double-precision you would still be able to find differences in very few cases. 1.8.1 is ancient and the code to convert between floating-point numbers and strings contained some bugs.
Maybe a wrapper class is one possible solution?
Sprite
class implemented by mkxp as MkxpSprite
Sprite
class that inherits from MkxpSprite
Override zoom_x
and zoom_x=
method.
class Sprite < MkxpSprite
attr_reader :zoom_x
def zoom_x=(val)
@zoom_x = val
super
end
end
It will be nice if mkxp can implement it. Make mkxp behave more consistent with original engine.
The following is a surprising behavior I found in current implementation:
# let (xxxxx / yyyyy.to_f) to be 0.9
sprite.zoom_x = xxxxx / yyyyy.to_f
# ...
# ...
# sprite.zoom_x is 0.8999 here and fail to enter the if-condition since 0.8999 is not larger than or equals to 0.9
if sprite.zoom_x >= 0.9
# ...
# ...
end
I am curious what exact in-game issues this inaccuracy is causing.
Example:
In original RPG Maker XP engine, it prints 0.9 But it prints 0.8999999761581421 in mkxp (OSX binary)