tables.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __TABLES__
  21. #define __TABLES__
  22. #ifdef LINUX
  23. #include <math.h>
  24. #else
  25. const float PI = 3.141592657f;
  26. #endif
  27. #include "m_fixed.h"
  28. #define FINEANGLES 8192
  29. #define FINEMASK (FINEANGLES-1)
  30. // 0x100000000 to 0x2000
  31. #define ANGLETOFINESHIFT 19
  32. // Effective size is 10240.
  33. const extern fixed_t finesine[5*FINEANGLES/4];
  34. // Re-use data, is just PI/2 pahse shift.
  35. const extern fixed_t* finecosine;
  36. // Effective size is 4096.
  37. const extern fixed_t finetangent[FINEANGLES/2];
  38. // Binary Angle Measument, BAM.
  39. #define ANG45 0x20000000u
  40. #define ANG90 0x40000000u
  41. #define ANG180 0x80000000u
  42. #define ANG270 0xc0000000u
  43. #define SLOPERANGE 2048
  44. #define SLOPEBITS 11
  45. #define DBITS (FRACBITS-SLOPEBITS)
  46. typedef unsigned angle_t;
  47. // Effective size is 2049;
  48. // The +1 size is to handle the case when x==y
  49. // without additional checking.
  50. const extern angle_t tantoangle[SLOPERANGE+1];
  51. // Utility function,
  52. // called by R_PointToAngle.
  53. int
  54. SlopeDiv
  55. ( unsigned num,
  56. unsigned den);
  57. #endif