Add weapon cycling bindings for mouse and joystick buttons. Add weapon cycling bindi...
[chocolate-doom.git] / src / tables.h
blobbaf785ca073d220169f2945b725d38981d22ab25
1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // Copyright(C) 1993-1996 Id Software, Inc.
5 // Copyright(C) 2005 Simon Howard
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 // 02111-1307, USA.
22 // DESCRIPTION:
23 // Lookup tables.
24 // Do not try to look them up :-).
25 // In the order of appearance:
27 // int finetangent[4096] - Tangens LUT.
28 // Should work with BAM fairly well (12 of 16bit,
29 // effectively, by shifting).
31 // int finesine[10240] - Sine lookup.
32 // Guess what, serves as cosine, too.
33 // Remarkable thing is, how to use BAMs with this?
35 // int tantoangle[2049] - ArcTan LUT,
36 // maps tan(angle) to angle fast. Gotta search.
37 //
38 //-----------------------------------------------------------------------------
41 #ifndef __TABLES__
42 #define __TABLES__
46 #include "m_fixed.h"
48 #define FINEANGLES 8192
49 #define FINEMASK (FINEANGLES-1)
52 // 0x100000000 to 0x2000
53 #define ANGLETOFINESHIFT 19
55 // Effective size is 10240.
56 extern const fixed_t finesine[5*FINEANGLES/4];
58 // Re-use data, is just PI/2 pahse shift.
59 extern const fixed_t *finecosine;
62 // Effective size is 4096.
63 extern const fixed_t finetangent[FINEANGLES/2];
65 // Binary Angle Measument, BAM.
66 #define ANG45 0x20000000
67 #define ANG90 0x40000000
68 #define ANG180 0x80000000
69 #define ANG270 0xc0000000
72 #define SLOPERANGE 2048
73 #define SLOPEBITS 11
74 #define DBITS (FRACBITS-SLOPEBITS)
76 typedef unsigned angle_t;
79 // Effective size is 2049;
80 // The +1 size is to handle the case when x==y
81 // without additional checking.
82 extern const angle_t tantoangle[SLOPERANGE+1];
85 // Utility function,
86 // called by R_PointToAngle.
87 int
88 SlopeDiv
89 ( unsigned num,
90 unsigned den);
93 #endif