Amulets & Armor  v1.02
Open Source Game
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
3D_TRIG.H
Go to the documentation of this file.
1 /****************************************************************************/
2 /* FILE: 3D_TRIG.H */
3 /****************************************************************************/
4 
5 #ifndef _3D_TRIG_H_
6 #define _3D_TRIG_H_
7 
8 #include "3D_VIEW.H"
9 #include "GENERAL.H"
10 
11 #define MATH_MAX_DISTANCE 10000
12 #define MATH_MAX_ANGLE 1024
13 #define MATH_ANGLE_ACCURACY 64
14 
15 #define MATH_ANGLE_360 1024
16 #define MATH_ANGLE_90 256
17 #define MATH_ANGLE_45 128
18 
19 #define SIN(X) G_sinTable[ (X) & 0x3FF ]
20 #define TAN(X) G_tanTable[ (X) & 0x3FF ]
21 #define COS(X) G_cosTable[ (X) & 0x3FF ]
22 #define ICOS(X) G_invCosTable[ (X) & 0x3FF ]
23 
24 #if 0
25 #define MathSineLookup(x) SIN( (x) >> 6 )
26 #define MathCosineLookup(x) COS( (x) >> 6 )
27 #else
28 #include "math.h"
29 #define M_PI 3.14159265358979323846
30 //#define MathSineLookup(x) SIN( (x) >> 6 )
31 #define MathSineLookup(x) ((T_sword32)(sin(((double)(x))*2.0*M_PI/65536.0)*65536.0))
32 //#define MathCosineLookup(x) COS( (x) >> 6 )
33 #define MathCosineLookup(x) ((T_sword32)(cos(((double)(x))*2.0*M_PI/65536.0)*65536.0))
34 #endif
35 #define MathTangentLookup(x) TAN( (x) >> 6 )
36 #define MathInvCosineLookup(x) ICOS( (x) >> 6 )
37 #define MathInvDistanceLookup(x) (G_invDistTable[x])
38 #define MathViewTanTableLookup(x) (G_viewTanTable[x])
39 #define MathPower2Lookup(x) (G_power2table[x])
40 
45 extern T_word16 G_distanceTable[256][256] ;
46 extern T_byte8 G_translucentTable[256][256] ;
47 
48 /*
49 extern T_sword32 *G_sinTable ;
50 extern T_sword32 *G_tanTable ;
51 extern T_sword32 *G_cosTable ;
52 extern T_sword32 *G_invCosTable ;
53 extern T_word16 *G_distanceTable ;
54 */
55 //extern T_byte8 *G_palIndex ;
57 
59 extern T_byte8 G_power2table[257] ;
60 
62 
64 
65 T_void MathInitialize(T_word32 screenWidth) ;
66 
67 T_void MathFinish(void) ;
68 
70 
72 
74 
76  T_sword16 x,
77  T_word16 angle) ;
78 
80  T_sword16 x,
81  T_word16 angle) ;
82 
84 
86 
87 
88 #endif
89 
90 /****************************************************************************/
91 /* END OF FILE: 3D_TRIG.H */
92 /****************************************************************************/