rotate_sprite 旋转太小了 ~65625 次

rotate_sprite rotation is ~65625 times too small

我正在使用 c++98 和 Allegro 4,并且正在尝试使用 rotate_sprite 函数。 documentation声称在角度参数中,256为整圆,64为直角。

void rotate_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, fixed angle);

测试时,我发现精灵没有旋转,但也发现当我显着增加参数时,我能够旋转,数字 4200000 似乎提供了一个直角。

rotate_sprite(world, plane, plane_x, plane_y, 4200000 * plane_r);
//plane_r is an int 0 to 3

所以我的问题是,为什么 4200000 会产生直角,而文档声称 64 会产生直角?直角的实际值是多少? 4200000 在这种情况下有效,但未来的确切数字是多少?

itofix函数用于将整数转为定点16.16数,即参数的类型。所以上面示例的工作版本是:

rotate_sprite(world, plane, plane_x, plane_y, itofix(plane_r * 64));