Z Sine Table Format

From ModdingWiki
Jump to navigation Jump to search

SINCOS.DAT supplies the trigonometric lookup data used by Z.

File format

The 1280-byte file contains 640 signed big-endian 16-bit words. At load time, FUN_0006f0eb swaps each word read on the little-endian machine, sign-extends it, and shifts it right arithmetically by five bits.

runtime[i] = signed16(readBE16(file, 2*i)) >> 5

The conversion runs for exactly 0x280 words. The complete angle-to-index mapping is not specified here.

Notes

This is a big-endian exception among Z data files. Writing already-shifted runtime words back as file words would apply the scale conversion twice.

Source code

From re-z, the open-source browser port:

Credits

This file format was reverse engineered by VorticonCmdr. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)