Odamex
Setting the Standard in Multiplayer Doom
common/tables.h
Go to the documentation of this file.
00001 // Emacs style mode select   -*- C++ -*-
00002 //-----------------------------------------------------------------------------
00003 //
00004 // $Id: tables.h 2079 2011-02-05 01:48:56Z russellrice $
00005 //
00006 // Copyright (C) 1993-1996 by id Software, Inc.
00007 // Copyright (C) 2006-2010 by The Odamex Team.
00008 //
00009 // This source is available for distribution and/or modification
00010 // only under the terms of the DOOM Source Code License as
00011 // published by id Software. All rights reserved.
00012 //
00013 // The source is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
00016 // for more details.
00017 //
00018 // DESCRIPTION:
00019 //      Lookup tables.
00020 //      Do not try to look them up :-).
00021 //      In the order of appearance:
00022 //
00023 //      int finetangent[4096]   - Tangens LUT.
00024 //       Should work with BAM fairly well (12 of 16bit,
00025 //      effectively, by shifting).
00026 //
00027 //      int finesine[10240]             - Sine lookup.
00028 //       Guess what, serves as cosine, too.
00029 //       Remarkable thing is, how to use BAMs with this?
00030 //
00031 //      int tantoangle[2049]    - ArcTan LUT,
00032 //        maps tan(angle) to angle fast. Gotta search.
00033 //
00034 //-----------------------------------------------------------------------------
00035 
00036 
00037 #ifndef __TABLES_H__
00038 #define __TABLES_H__
00039 
00040 #include "m_fixed.h"
00041 
00042 #define PI                              3.141592657
00043 
00044 #define FINEANGLES              8192
00045 #define FINEMASK                (FINEANGLES-1)
00046 
00047 
00048 // 0x100000000 to 0x2000
00049 #define ANGLETOFINESHIFT                19
00050 
00051 // Effective size is 10240.
00052 extern  const fixed_t           finesine[5*FINEANGLES/4];
00053 
00054 // Re-use data, is just PI/2 phase shift.
00055 extern const fixed_t*           finecosine;
00056 
00057 
00058 // Effective size is 4096.
00059 extern const fixed_t            finetangent[FINEANGLES/2];
00060 
00061 // Binary Angle Measument, BAM.
00062 #define ANG45                   0x20000000
00063 #define ANG90                   0x40000000
00064 #define ANG180                  0x80000000
00065 #define ANG270                  0xc0000000
00066 #define ANG(n)                  ((ANG45/45)*(n))
00067 
00068 #define ANG360  0xffffffff
00069 
00070 #define SLOPERANGE              2048
00071 #define SLOPEBITS               11
00072 #define DBITS                   (FRACBITS-SLOPEBITS)
00073 
00074 typedef DWORD                   angle_t;
00075 
00076 
00077 // Effective size is 2049;
00078 // The +1 size is to handle the case when x==y without additional checking.
00079 // [ML] 2/2/10: Updated with R_PointToAngle2 changes (from EE)
00080 extern const angle_t tantoangle[2049];
00081 extern angle_t tantoangle_acc[2049];
00082 
00083 extern const angle_t *p_tantoangle;
00084 
00085 void Table_InitTanToAngle(void);
00086 void Table_SetTanToAngle(int version);
00087 
00088 
00089 
00090 #endif // __TABLES_H__
00091 
00092 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends