Counter Strike : Global Offensive Source Code
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.

188 lines
3.4 KiB

  1. //========= Copyright � 1996-2005, 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 GetPreviewImageWidth() const
  36. {
  37. return( m_datawidth );
  38. }
  39. inline int GetPreviewImageHeight() 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 int GetMappingWidth() const
  52. {
  53. return(m_nWidth);
  54. }
  55. inline int GetMappingHeight() const
  56. {
  57. return(m_nHeight);
  58. }
  59. inline float GetDecalScale() const
  60. {
  61. return( 1.0f );
  62. }
  63. CPalette *GetPalette() const;
  64. inline int GetTextureID() const
  65. {
  66. return( m_nTextureID );
  67. }
  68. inline TEXTUREFORMAT GetTextureFormat() const
  69. {
  70. return(format);
  71. }
  72. inline int GetSurfaceAttributes() const
  73. {
  74. return(m_WALsurface);
  75. }
  76. inline int GetSurfaceContents() const
  77. {
  78. return(m_WALcontents);
  79. }
  80. inline int GetSurfaceValue() const
  81. {
  82. return(m_WALvalue);
  83. }
  84. inline bool HasAlpha() const
  85. {
  86. return( false );
  87. }
  88. inline bool HasData( void ) const
  89. {
  90. return(m_pData != NULL);
  91. }
  92. inline bool HasPalette() const
  93. {
  94. return(m_bLocalPalette == TRUE);
  95. }
  96. inline bool IsDummy( void ) const
  97. {
  98. return( false );
  99. }
  100. bool Load( void );
  101. void Reload( bool bFullReload ) {}
  102. bool IsLoaded() const;
  103. inline void SetTextureFormat(TEXTUREFORMAT eFormat)
  104. {
  105. format = eFormat;
  106. }
  107. inline void SetTextureID( int nTextureID )
  108. {
  109. m_nTextureID = nTextureID;
  110. }
  111. bool IsWater( void ) const
  112. {
  113. return false;
  114. }
  115. protected:
  116. BOOL Load(int fd, HANDLE hFile);
  117. void DrawNoImage(CDC *pDC, RECT &rect, int iFontHeight);
  118. char m_szName[MAX_PATH];
  119. char m_szFileName[MAX_PATH];
  120. // additional data for new .WAL textures:
  121. int m_WALsurface;
  122. int m_WALvalue;
  123. int m_WALcontents;
  124. // Used when the texture is in a .WAD or a .PAK file.
  125. // Otherwise, texture is loaded automatically.
  126. DWORD m_ulFileOffset; // Offset to texture in WAD file.
  127. DWORD m_ulFileID; // ID of WAD file the texture is in.
  128. TEXTUREFORMAT format;
  129. LOGPALETTE *m_pPalette; // This texture's palette.
  130. BOOL m_bLocalPalette; // Use m_pPalette?
  131. int m_nTextureID; // Uniquely identifies this texture in all 3D renderers.
  132. int m_datawidth;
  133. int m_dataheight;
  134. int m_nWidth;
  135. int m_nHeight;
  136. void *m_pData; // Loaded pixel data (NULL if not loaded)
  137. };
  138. #endif // WADTEXTURE_H