-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathUITextures.h
235 lines (188 loc) · 7.42 KB
/
UITextures.h
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
/*
* MacroQuest: The extension platform for EverQuest
* Copyright (C) 2002-present MacroQuest Authors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#pragma once
#include "Common.h"
#include "Containers.h"
#include "CXStr.h"
namespace eqlib {
//============================================================================
// Forward Declarations
//============================================================================
class CTextureAnimation;
//============================================================================
// CUITexturePiece
//============================================================================
enum enDir
{
cUIDirectory,
cUIDirectoryAtlas,
cUIDirectoryTexture,
cUIDirectoryMaps,
cUIDirectoryCount,
};
struct [[offsetcomments]] CUITextureInfo
{
FORCE_SYMBOLS;
public:
EQLIB_OBJECT CUITextureInfo();
EQLIB_OBJECT CUITextureInfo(const CXStr& name, int size);
EQLIB_OBJECT CUITextureInfo(const CXStr& name, const CXSize& size);
EQLIB_OBJECT CUITextureInfo(uint32_t id, int size);
EQLIB_OBJECT CUITextureInfo(uint32_t id, const CXSize& size);
//EQLIB_OBJECT int Draw(const CXRect&, const CXRect&, const CXRect&, D3DCOLOR*, D3DCOLOR*) const;
//EQLIB_OBJECT int Draw(const CXRect&, const CXRect&, const CXRect&, D3DCOLOR, D3DCOLOR) const;
//EQLIB_OBJECT int Preload();
//EQLIB_OBJECT int Tile(const CXRect&, D3DCOLOR*, D3DCOLOR*) const;
//EQLIB_OBJECT int Tile(const CXRect&, D3DCOLOR, D3DCOLOR) const;
//----------------------------------------------------------------------------
// data members
/*0x00*/ bool bValid = false;
/*0x04*/ enDir Directory = cUIDirectory;
/*0x08*/ CXStr Name;
/*0x10*/ CXSize TextureSize;
/*0x18*/ uint32_t TextureId = -1;
/*0x1c*/
};
class [[offsetcomments]] CUITexturePiece
{
FORCE_SYMBOLS;
public:
EQLIB_OBJECT CUITexturePiece();
EQLIB_OBJECT CUITexturePiece(const CUITextureInfo&, const CXRect&);
EQLIB_OBJECT CUITexturePiece(const CUITextureInfo&);
//EQLIB_OBJECT int Draw(const CXRect&, const CXRect&, const CXRect&, D3DCOLOR, D3DCOLOR) const;
//EQLIB_OBJECT int Draw(const CXRect&, const CXRect&, D3DCOLOR, D3DCOLOR) const;
const CUITextureInfo& GetTextureInfo() const { return m_info; }
CXSize GetSize() const { return m_rect.GetSize(); }
const CXRect& GetRect() const { return m_rect; }
private:
/*0x00*/ CUITextureInfo m_info;
/*0x20*/ CXRect m_rect;
/*0x30*/
};
//============================================================================
// CTextureAnimation
//============================================================================
struct [[offsetcomments]] STextureAnimationFrame
{
FORCE_SYMBOLS;
/*0x00*/ CUITexturePiece Piece;
/*0x30*/ uint32_t Ticks = 0;
/*0x34*/ CXPoint Hotspot;
/*0x3c*/
};
class [[offsetcomments]] CTextureAnimation
{
FORCE_SYMBOLS;
public:
EQLIB_OBJECT CTextureAnimation();
EQLIB_OBJECT CTextureAnimation(const CXStr& name);
EQLIB_OBJECT CTextureAnimation(CUITexturePiece tp);
EQLIB_OBJECT CTextureAnimation(const CTextureAnimation& other);
EQLIB_OBJECT virtual ~CTextureAnimation();
EQLIB_OBJECT int AddFrame(const CUITextureInfo* ti, const CXRect& rect, uint32_t ticks, CXPoint hotspot = {});
EQLIB_OBJECT int AddFrame(CUITexturePiece tp, uint32_t ticks, CXPoint hotspot = {});
EQLIB_OBJECT int AddBlankFrame(uint32_t ticks, CXPoint hotspot = {});
EQLIB_OBJECT void Pause(bool pause);
EQLIB_OBJECT CXPoint GetHotspot() const;
EQLIB_OBJECT void SetCurFrame(int);
EQLIB_OBJECT int GetCurFrame() const;
EQLIB_OBJECT void SetCurCell(int);
int GetCurCell() const { return CurCell; }
const CXRect& GetCurCellRect() const { return CellRect; }
const CXStr& GetName() const { return Name; }
const CXSize& GetSize() const { return Size; }
int GetWidth() const { return Size.cx; }
int GetHeight() const { return Size.cy; }
bool IsGrid() const { return bGrid; }
// todo
EQLIB_OBJECT int Draw(const CXRect& rect, const CXRect& clip, COLORREF color = 0xffffffff, COLORREF color2 = 0xff000000) const;
//EQLIB_OBJECT int Draw(const CXPoint&, const CXRect&, unsigned long, unsigned long) const;
//EQLIB_OBJECT int Draw(const CXRect&, const CXRect&, unsigned long, unsigned long) const;
//EQLIB_OBJECT int Preload();
//EQLIB_OBJECT void Reset();
const CUITexturePiece& GetCurTexturePiece() const { return Frames[GetCurFrame()].Piece; }
//----------------------------------------------------------------------------
// data members
/*0x08*/ CXStr Name;
/*0x10*/ ArrayClass<STextureAnimationFrame> Frames;
/*0x28*/ uint32_t TotalTicks = 0;
/*0x2c*/ int ZeroFrame = 0;
/*0x30*/ uint32_t StartTicks = GetTickCount();
/*0x34*/ CXSize Size;
/*0x3c*/ bool bPaused = false;
/*0x3d*/ bool bCycle = true;
/*0x3e*/ bool bGrid = false;
/*0x3f*/ bool bVertical = false;
/*0x40*/ int CellWidth = 0;
/*0x44*/ int CellHeight = 0;
/*0x48*/ int CurCell = -1;
/*0x4c*/ int CurCellInFrame = -1;
/*0x50*/ CXRect CellRect;
/*0x60*/
};
//============================================================================
// CTAFrameDraw
//============================================================================
class [[offsetcomments]] CTAFrameDraw
{
FORCE_SYMBOLS;
public:
EQLIB_OBJECT CTAFrameDraw(CXStr = {});
enum EFrameDrawPiece
{
FrameDraw_TopLeft = 0,
FrameDraw_Top,
FrameDraw_TopRight,
FrameDraw_RightTop,
FrameDraw_Right,
FrameDraw_RightBottom,
FrameDraw_BottomRight,
FrameDraw_Bottom,
FrameDraw_BottomLeft,
FrameDraw_LeftTop,
FrameDraw_Left,
FrameDraw_LeftBottom,
FrameDraw_Middle,
FrameDraw_Max,
};
EQLIB_OBJECT CTextureAnimation* GetAnimation(EFrameDrawPiece) const;
EQLIB_OBJECT void SetAnimation(EFrameDrawPiece which, CTextureAnimation* tex);
EQLIB_OBJECT CXRect GetHitTestRect(const CXRect&, int) const;
EQLIB_OBJECT CXRect GetInnerRect(const CXRect&) const;
EQLIB_OBJECT CXRect GetPieceRect(const CXRect&, int) const;
EQLIB_OBJECT CXSize GetFrameSize() const;
EQLIB_OBJECT CXStr GetName() const { return m_name; }
EQLIB_OBJECT void SetName(const CXStr& name) { m_name = name; }
EQLIB_OBJECT bool IsHorizontal() const;
EQLIB_OBJECT bool IsVertical() const;
EQLIB_OBJECT int Draw(const CXRect&, const CXRect&) const;
EQLIB_OBJECT int Draw(const CXRect&, const CXRect&, EFrameDrawPiece) const;
EQLIB_OBJECT int GetExtent() const;
EQLIB_OBJECT int GetMinLength() const;
EQLIB_OBJECT void Set(CTextureAnimation* pta[FrameDraw_Max]);
EQLIB_OBJECT static const char* FrameDrawPieceToString(EFrameDrawPiece);
//----------------------------------------------------------------------------
// data members
private:
/*0x00*/ CXStr m_name;
/*0x08*/ CTextureAnimation* m_pta[FrameDraw_Max];
/*0x70*/ int Unknown0x38 = -1; // FIXME: Check this
/*0x74*/ int m_nOverlapTop = 0;
/*0x78*/ int m_nOverlapLeft = 0;
/*0x7c*/ int m_nOverlapBottom = 0;
/*0x80*/ int m_nOverlapRight = 0;
/*0x84*/
};
} // namespace eqlib