r_data.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Emacs style mode select -*- C++ -*-
  2. *-----------------------------------------------------------------------------
  3. *
  4. *
  5. * PrBoom: a Doom port merged with LxDoom and LSDLDoom
  6. * based on BOOM, a modified and improved DOOM engine
  7. * Copyright (C) 1999 by
  8. * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
  9. * Copyright (C) 1999-2000 by
  10. * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
  11. * Copyright 2005, 2006 by
  12. * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License
  16. * as published by the Free Software Foundation; either version 2
  17. * of the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  27. * 02111-1307, USA.
  28. *
  29. * DESCRIPTION:
  30. * Refresh module, data I/O, caching, retrieval of graphics
  31. * by name.
  32. *
  33. *-----------------------------------------------------------------------------*/
  34. #ifndef __R_DATA__
  35. #define __R_DATA__
  36. #include "r_defs.h"
  37. #include "r_state.h"
  38. #include "r_patch.h"
  39. // A single patch from a texture definition, basically
  40. // a rectangular area within the texture rectangle.
  41. typedef struct
  42. {
  43. int originx, originy; // Block origin, which has already accounted
  44. int patch; // for the internal origin of the patch.
  45. } texpatch_t;
  46. //
  47. // Texture definition.
  48. // A DOOM wall texture is a list of patches
  49. // which are to be combined in a predefined order.
  50. //
  51. typedef struct
  52. {
  53. char name[8]; // Keep name for switch changing, etc.
  54. int next, index; // killough 1/31/98: used in hashing algorithm
  55. // CPhipps - moved arrays with per-texture entries to elements here
  56. unsigned widthmask;
  57. // CPhipps - end of additions
  58. short width, height;
  59. short patchcount; // All the patches[patchcount] are drawn
  60. texpatch_t patches[1]; // back-to-front into the cached texture.
  61. } texture_t;
  62. extern int numtextures;
  63. extern texture_t **textures;
  64. const byte *R_GetTextureColumn(const rpatch_t *texpatch, int col);
  65. // I/O, setting up the stuff.
  66. void R_InitData (void);
  67. void R_PrecacheLevel (void);
  68. // Retrieval.
  69. // Floor/ceiling opaque texture tiles,
  70. // lookup by name. For animation?
  71. int R_FlatNumForName (const char* name); // killough -- const added
  72. // R_*TextureNumForName returns the texture number for the texture name, or NO_TEXTURE if
  73. // there is no texture (i.e. "-") specified.
  74. /* cph 2006/07/23 - defined value for no-texture marker (texture "-" in the WAD file) */
  75. #define NO_TEXTURE 0
  76. int PUREFUNC R_TextureNumForName (const char *name); // killough -- const added; cph - now PUREFUNC
  77. int PUREFUNC R_SafeTextureNumForName (const char *name, int snum);
  78. int PUREFUNC R_CheckTextureNumForName (const char *name);
  79. void R_InitTranMap(int); // killough 3/6/98: translucency initialization
  80. int R_ColormapNumForName(const char *name); // killough 4/4/98
  81. /* cph 2001/11/17 - new func to do lighting calcs and get suitable colour map */
  82. const lighttable_t* R_ColourMap(int lightlevel, fixed_t spryscale);
  83. extern const byte *main_tranmap, *tranmap;
  84. /* Proff - Added for OpenGL - cph - const char* param */
  85. void R_SetPatchNum(patchnum_t *patchnum, const char *name);
  86. #endif