]> icculus.org git repositories - theoddone33/hhexen.git/blob - include/m_bams.h
Initial revision
[theoddone33/hhexen.git] / include / m_bams.h
1 #ifndef __MY_BAMS_MATH_H__
2 #define __MY_BAMS_MATH_H__
3
4 typedef unsigned short  binangle;
5
6 // Some predefined angles.
7 #define BANG_0          0                       // To the east.
8 #define BANG_45         0x2000          // To the northeast.
9 #define BANG_90         0x4000          // To the north.
10 #define BANG_135        0x6000          // To the northwest.
11 #define BANG_180        0x8000          // To the west.
12 #define BANG_225        0xa000          // To the southwest.
13 #define BANG_270        0xc000          // To the south.
14 #define BANG_315        0xe000          // To the southeast.
15 #define BANG_360        0x10000         // Actually the same than angle 0.
16 #define BANG_MAX        0xffff          // The largest possible angle.
17
18 // Compass directions, for convenience.
19 #define BANG_EAST               BANG_0
20 #define BANG_NORTHEAST  BANG_45
21 #define BANG_NORTH              BANG_90
22 #define BANG_NORTHWEST  BANG_135
23 #define BANG_WEST               BANG_180
24 #define BANG_SOUTHWEST  BANG_225
25 #define BANG_SOUTH              BANG_270
26 #define BANG_SOUTHEAST  BANG_315
27
28 #define BAMS_PI                         3.14159265359
29 #define RAD2BANG(x)                     ((binangle)((x)/BAMS_PI*BANG_180))
30 #define BANG2RAD(x)                     ((float)((x)/(float)BANG_180*BAMS_PI))
31
32 void bamsInit();        // Fill in the tables.
33 binangle bamsAtan2(int y,int x);
34
35 #endif