home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 28 / amigaformatcd28.iso / -screenplay- / otherstuff / adoomppc_src / tables.h < prev    next >
C/C++ Source or Header  |  1998-04-23  |  2KB  |  104 lines

  1. // Emacs style mode select   -*- C++ -*- 
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // DESCRIPTION:
  18. //    Lookup tables.
  19. //    Do not try to look them up :-).
  20. //    In the order of appearance: 
  21. //
  22. //    int finetangent[4096]    - Tangens LUT.
  23. //     Should work with BAM fairly well (12 of 16bit,
  24. //      effectively, by shifting).
  25. //
  26. //    int finesine[10240]        - Sine lookup.
  27. //     Guess what, serves as cosine, too.
  28. //     Remarkable thing is, how to use BAMs with this? 
  29. //
  30. //    int tantoangle[2049]    - ArcTan LUT,
  31. //      maps tan(angle) to angle fast. Gotta search.    
  32. //    
  33. //-----------------------------------------------------------------------------
  34.  
  35.  
  36. #ifndef __TABLES__
  37. #define __TABLES__
  38.  
  39.  
  40.  
  41. #ifdef LINUX
  42. #include <math.h>
  43. #else
  44. #ifndef __SASC
  45. #define PI                3.141592657
  46. #endif
  47. #endif
  48.  
  49.  
  50. #include "doomdef.h"
  51. #include "m_fixed.h"
  52.     
  53. #define FINEANGLES        8192
  54. #define FINEMASK        (FINEANGLES-1)
  55.  
  56.  
  57. // 0x100000000 to 0x2000
  58. #define ANGLETOFINESHIFT    19        
  59.  
  60. // Effective size is 10240.
  61. extern  FAR fixed_t        finesine[5*FINEANGLES/4];
  62.  
  63. // Re-use data, is just PI/2 pahse shift.
  64. extern  fixed_t*    finecosine;
  65.  
  66.  
  67. // Effective size is 4096.
  68. extern FAR fixed_t        finetangent[FINEANGLES/2];
  69.  
  70. // Binary Angle Measument, BAM.
  71. #define ANG45            0x20000000
  72. #define ANG90            0x40000000
  73. #define ANG180        0x80000000
  74. #define ANG270        0xc0000000
  75.  
  76.  
  77. #define SLOPERANGE        2048
  78. #define SLOPEBITS        11
  79. #define DBITS            (FRACBITS-SLOPEBITS)
  80.  
  81. typedef unsigned angle_t;
  82.  
  83.  
  84. // Effective size is 2049;
  85. // The +1 size is to handle the case when x==y
  86. //  without additional checking.
  87. extern FAR angle_t        tantoangle[SLOPERANGE+1];
  88.  
  89.  
  90. // Utility function,
  91. //  called by R_PointToAngle.
  92. int
  93. SlopeDiv
  94. ( unsigned    num,
  95.   unsigned    den);
  96.  
  97.  
  98. #endif
  99. //-----------------------------------------------------------------------------
  100. //
  101. // $Log:$
  102. //
  103. //-----------------------------------------------------------------------------
  104.