After a whole lot of revisions, floatPosToTilePos is now finally optimized properly.