我正在努力理解 Chocolate Doom 如何分配其余弦表。注释解释说,为了计算余弦表,它在正弦表上进行了 PI/2 移位,但我不明白它是如何使用 C 完成的。
这是 Chocolate Doom 的原始源代码tables.h和tables.c
#define FINEANGLES 8192
const fixed_t finesine[10240] =
{
25,75,125,175,226,276,326,376,
...
}
const fixed_t *finecosine = &finesine[FINEANGLES/4];
Run Code Online (Sandbox Code Playgroud)
这就是我试图在 Kotlin 中实现的目标
val fineSine: Array<Fixed_t> = arrayOf(25,75,125,175,226,276,326,376, ...)
val fineCosine: Array<Fixed_t> = arrayOf() // This is where I'm stuck
Run Code Online (Sandbox Code Playgroud)