Amulets & Armor
v1.02
Open Source Game
Main Page
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Include
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
41
extern
T_sword32
G_sinTable
[
MATH_MAX_ANGLE
];
42
extern
T_sword32
G_tanTable
[
MATH_MAX_ANGLE
];
43
extern
T_sword32
G_cosTable
[
MATH_MAX_ANGLE
];
44
extern
T_sword32
G_invCosTable
[
MATH_MAX_ANGLE
];
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 ;
56
extern
T_sword32
G_invDistTable
[
MATH_MAX_DISTANCE
];
57
58
extern
T_sword32
G_viewTanTable
[
MAX_VIEW3D_WIDTH
] ;
59
extern
T_byte8
G_power2table
[257] ;
60
61
T_sword32
MathCosine
(
T_word16
angle) ;
62
63
T_void
MathInitializeInvDistTable
(
T_word32
screenWidth) ;
64
65
T_void
MathInitialize
(
T_word32
screenWidth) ;
66
67
T_void
MathFinish
(
void
) ;
68
69
T_sword32
MathInvCosine
(
T_word16
angle) ;
70
71
T_sword32
MathSine
(
T_word16
angle) ;
72
73
T_sword32
MathTangent
(
T_word16
angle) ;
74
75
T_sword16
MathXTimesCosAngle
(
76
T_sword16
x,
77
T_word16
angle) ;
78
79
T_sword16
MathXTimesSinAngle
(
80
T_sword16
x,
81
T_word16
angle) ;
82
83
T_word16
MathArcTangent
(
T_sword32
y,
T_sword32
x) ;
84
85
T_word16
MathArcTangent32
(
T_sword32
y,
T_sword32
x) ;
86
87
88
#endif
89
90
/****************************************************************************/
91
/* END OF FILE: 3D_TRIG.H */
92
/****************************************************************************/
Generated on Sun Aug 4 2013 15:35:47 for Amulets & Armor by
1.8.4