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