mirror of
https://github.com/nmlgc/ReC98.git
synced 2025-02-26 20:55:09 +00:00

Which, for some reason, is also found in the MAIN.EXE of every later game in between completely unrelated hardware and file format functions. Separate commit because it has its own segment in REIIDEN.EXE, and because coming up with the nice function names took pretty long, since I haven't done anything involving trigonometry in the past 5 years...
21 lines
530 B
C
21 lines
530 B
C
/* ReC98
|
|
* -----
|
|
* Code segment #14 of TH01's REIIDEN.EXE
|
|
*/
|
|
|
|
#include <master.h>
|
|
|
|
// Slightly different parameter lists compared to later games!
|
|
void vector_between(int x1, int y1, int x2, int y2, int *dx, int *dy, int r)
|
|
{
|
|
unsigned char angle = iatan2(y2 - y1, x2 - x1);
|
|
*dx = ((long)r * CosTable8[angle]) >> 8;
|
|
*dy = ((long)r * SinTable8[angle]) >> 8;
|
|
}
|
|
|
|
void vector(int *dx, int *dy, int r, unsigned char angle)
|
|
{
|
|
*dx = ((long)r * CosTable8[angle]) >> 8;
|
|
*dy = ((long)r * SinTable8[angle]) >> 8;
|
|
}
|