It looks like there is an offset to the hip and leg x position that is dependent on direction.
Recommend start checking the code where you are drawing the legs and specifically look at lengthdir_x functions.
Hope this helps
I didn't change your code in draw_leg. I tried to find offset there, but I couldn't. =("//argument 5 is an offset using the horizontal component of the facing direction"It's not that
Fixed Thx!