Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

178 lines
3.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Implementation of the IEditorTexture interface for WAD textures.
  4. //
  5. //=============================================================================//
  6. #ifndef WADTEXTURE_H
  7. #define WADTEXTURE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <afxtempl.h>
  12. #include "BlockArray.h"
  13. #include "IEditorTexture.h"
  14. class IMaterial;
  15. class CWADTexture : public IEditorTexture
  16. {
  17. public:
  18. CWADTexture(void);
  19. virtual ~CWADTexture(void);
  20. static bool Initialize(void);
  21. static void ShutDown(void);
  22. BOOL Init(int, DWORD, BOOL, LPCTSTR);
  23. BOOL AdjustTexture(char *pLoadBuf);
  24. inline const char *GetName(void) const
  25. {
  26. return(m_szName);
  27. }
  28. int GetShortName(char *pszName) const;
  29. int GetKeywords(char *pszKeywords) const;
  30. void Draw(CDC *pDC, RECT &rect, int iFontHeight, int iIconHeight, DrawTexData_t &DrawTexData);//, DWORD dwFlags = (drawCaption|drawIcons));
  31. void GetSize(SIZE &size);
  32. const char *GetFileName(void) const;
  33. int GetImageDataRGB( void *pImageRGB );
  34. int GetImageDataRGBA( void *pImageRGBA );
  35. inline int GetImageWidth() const
  36. {
  37. return( m_datawidth );
  38. }
  39. inline int GetImageHeight() const
  40. {
  41. return( m_dataheight );
  42. }
  43. inline int GetWidth() const
  44. {
  45. return(m_nWidth);
  46. }
  47. inline int GetHeight() const
  48. {
  49. return(m_nHeight);
  50. }
  51. inline float GetDecalScale() const
  52. {
  53. return( 1.0f );
  54. }
  55. CPalette *GetPalette() const;
  56. inline int GetTextureID() const
  57. {
  58. return( m_nTextureID );
  59. }
  60. inline TEXTUREFORMAT GetTextureFormat() const
  61. {
  62. return(format);
  63. }
  64. inline int GetSurfaceAttributes() const
  65. {
  66. return(m_WALsurface);
  67. }
  68. inline int GetSurfaceContents() const
  69. {
  70. return(m_WALcontents);
  71. }
  72. inline int GetSurfaceValue() const
  73. {
  74. return(m_WALvalue);
  75. }
  76. inline bool HasAlpha() const
  77. {
  78. return( false );
  79. }
  80. inline bool HasData( void ) const
  81. {
  82. return(m_pData != NULL);
  83. }
  84. inline bool HasPalette() const
  85. {
  86. return(m_bLocalPalette == TRUE);
  87. }
  88. inline bool IsDummy( void ) const
  89. {
  90. return( false );
  91. }
  92. bool Load( void );
  93. void Reload( bool bFullReload ) {}
  94. bool IsLoaded() const;
  95. inline void SetTextureFormat(TEXTUREFORMAT eFormat)
  96. {
  97. format = eFormat;
  98. }
  99. inline void SetTextureID( int nTextureID )
  100. {
  101. m_nTextureID = nTextureID;
  102. }
  103. bool IsWater( void ) const
  104. {
  105. return false;
  106. }
  107. protected:
  108. BOOL Load(int fd, HANDLE hFile);
  109. void DrawNoImage(CDC *pDC, RECT &rect, int iFontHeight);
  110. char m_szName[MAX_PATH];
  111. char m_szFileName[MAX_PATH];
  112. // additional data for new .WAL textures:
  113. int m_WALsurface;
  114. int m_WALvalue;
  115. int m_WALcontents;
  116. // Used when the texture is in a .WAD or a .PAK file.
  117. // Otherwise, texture is loaded automatically.
  118. DWORD m_ulFileOffset; // Offset to texture in WAD file.
  119. DWORD m_ulFileID; // ID of WAD file the texture is in.
  120. TEXTUREFORMAT format;
  121. LOGPALETTE *m_pPalette; // This texture's palette.
  122. BOOL m_bLocalPalette; // Use m_pPalette?
  123. int m_nTextureID; // Uniquely identifies this texture in all 3D renderers.
  124. int m_datawidth;
  125. int m_dataheight;
  126. int m_nWidth;
  127. int m_nHeight;
  128. void *m_pData; // Loaded pixel data (NULL if not loaded)
  129. };
  130. #endif // WADTEXTURE_H