-
Notifications
You must be signed in to change notification settings - Fork 0
/
Data.h
494 lines (425 loc) · 8.83 KB
/
Data.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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
enum //FillType
{
FILL_NONE,
//Inbuilt
FILL_COLOR,
FILL_GRADIENT,
FILL_MOSAIC,
//Custom
FILL_USER,
FILL_RADIAL,
//Image flag
FILL_IMAGE = 0xf0000000
};
typedef int FillType;
struct FillGuide
{
FillType type;
uint param; //Image index for FILL_MOSAIC
CFillData* fill;
bool img;
};
struct PolyCoord
{
float x;
float y;
};
typedef map<string,FillGuide*> FillDB;
struct ColorCond
{
char channel;
char condition[2];
int parameter;
};
struct CondOp
{
char symbol[3];
int length;
int precedence;
};
struct SImage
{
//Whether or not the surface was created by the extension
bool local;
//The actual image
cSurface* surf;
//Hot-spot
int hotX;
int hotY;
SImage(cSurface* surf, bool local = true, int hotX = 0, int hotY = 0)
{
this->local = local;
this->surf = surf;
this->hotX = hotX;
this->hotY = hotY;
}
~SImage()
{
if(local)
delete surf;
}
};
typedef vector<SImage*> ImageBank;
typedef map<string,ImageBank*> ImageDB;
typedef vector<PolyCoord> PolyPoints;
struct OvlStruct;
typedef struct OvlStruct Overlay;
struct BlitSet
{
BlitMode mode;
BlitOp operation;
LPARAM param;
DWORD flags;
int destX;
int destY;
int destW;
int destH;
int StretchMode;
int srcX;
int srcY;
int srcW;
int srcH;
bool srcUse;
int angle;
bool angleResample;
TCHAR callback[32];
TCHAR procOp[4];
float procOpSrc;
bool composeAlpha;
int hotX;
int hotY;
int hotspotMode;
};
// --------------------------------
// RUNNING OBJECT DATA STRUCTURE
// --------------------------------
// If you want to store anything between actions/conditions/expressions
// you should store it here
class rRundata;
typedef rRundata * LPRRDATA;
typedef struct tagRDATA
{
#include "MagicRDATA.h"
ImageBank* surf;
cSurface* target;
short targetId;
bool targetValid;
cSurface* current;
short currentId;
short lastId;
//Functions
cSurface* (*imageAt)(tagRDATA*,int);
int (*imageCount)(tagRDATA*);
//Display surface for rotations and scaling
cSurface* display;
//The default image depth
int depth;
//Internal blit
BlitSet b;
BlitSet blitStack[5];
int blitStackCursor;
//Callback
COLORREF colSrc;
COLORREF colDest;
COLORREF colNew;
int colAlphaSrc;
int colAlphaDest;
int colAlphaNew;
bool colRet;
bool colAlphaRet;
TCHAR* callback;
int callX;
int callY;
//Data
sMask* collision;
PolyPoints* points;
FillDB* fill;
//Font
HFONT hFont;
DWORD hFlags;
LOGFONT textFont;
//Options
bool useAbs;
bool keepPoints;
bool threadedIO;
bool dispTarget;
bool selectLast;
//Settings of non-existent surfaces
COLORREF transCol;
//Buffer lock
BYTE* buffer;
cSurface* buffSurf;
int buffPitch;
//Overlay compatibility
Overlay* ovl;
//Flood fill
int floodL;
int floodR;
int floodT;
int floodB;
//I/O stuff
TCHAR* ioFile;
DWORD ioFilter;
HANDLE ioHandle;
bool ioSave;
//Stored image for quick undo
cSurface* stored;
// Misc
bool isHWA;
int randomSeed;
} RUNDATA;
typedef RUNDATA * LPRDATA;
typedef struct
{
headerObject rHo; // Header
rCom roc;
rSpr rs;
rMvt rm;
rVal rv;
bool FlipHoz;
bool FlipVer;
int Angle;
bool RotationAA;
long SourceX;
long SourceY;
long SourceWidth;
long SourceHeight;
LPSURFACE PSoverride;
bool StretchResample;
LPSURFACE sourceImg;
LPSURFACE rotateImg;
} Viewport;
typedef struct
{
headerObject rHo; // Header
rCom roc;
rSpr rs;
rMvt rm;
cSurface * TempImage;
int Effect;
bool Direction;
int ZoomValue;
int Offset;
int SineWaveWaves;
bool PerspectiveDir;
int * CustomArray;
bool resample;
} Perspective;
//RECT rect;
//BOOL useRect;
//long oldX;
//long oldY;
//long oldWidth;
//long oldHeight;
//cSurface* background;
// --------------------------------
// EDITION OF OBJECT DATA STRUCTURE
// --------------------------------
// These values let you store data in your extension that will be saved in the MFA
// You should use these with properties
typedef struct tagEDATAA_V1
{
extHeader eHeader;
//Image bank
short width;
short height;
short width_def; //Width & height of the default image
short height_def;
WORD images[MAX_IMAGES];
short imageCount;
bool loadFirst;
bool useAbs;
bool threadedIO;
bool keepPoints;
bool multiImg;
bool dispTarget;
bool selectLast;
LOGFONTA textFont;
COLORREF textColor;
DWORD textFlags;
} EDITDATAA;
typedef struct tagEDATAW_V1
{
extHeader eHeader;
//Image bank
short width;
short height;
short width_def; //Width & height of the default image
short height_def;
WORD images[MAX_IMAGES];
short imageCount;
bool loadFirst;
bool useAbs;
bool threadedIO;
bool keepPoints;
bool multiImg;
bool dispTarget;
bool selectLast;
LOGFONTW textFont;
COLORREF textColor;
DWORD textFlags;
} EDITDATAW;
#ifdef _UNICODE
#define EDITDATA EDITDATAW
#define LPEDATA LPEDATAW
#else
#define EDITDATA EDITDATAA
#define LPEDATA LPEDATAA
#endif
typedef EDITDATA * LPEDATA;
struct OvlStruct
{
headerObject rHo; // Header
rVal rv; // Values
LPSURFACE runSurface;
long X;
long Y;
long OldX;
long OldY;
short swidth;
short sheight;
short oldwidth; //For stretching
short oldheight; //For stretching
char rFilename[_MAX_PATH];
BOOL debugmode; //Is debug mode on? (visibility)
BOOL stretching; //Is stretching on?
BOOL AbsolutePos; //drawing position absolute
BOOL Immediate; //update display immediately
BOOL Automatic; //update display automatically
BOOL AntiA; //anti-aliasing
BlitMode Mode; //display mode (opaque or trans)
BlitOp Effect; //blit effect
int EffectParam; //effect parameter
POINT * Points; //points for "Plot Polygon"
unsigned long NumPoints; //number of points to plot
unsigned long SizePoints; //size of array of points
BOOL RemovePoints; //remove points after plotting polygon
BOOL Fade; //true if we should be fading
float FadeSpeed; //speed at which to fade
float FadeInk; //current ink effect param as a float
/* ADDITION lolwut? */
int image;
};
typedef struct APDATA
{
headerObject rHo; // Header
rCom rc; // Structure commune pour les mouvements/animations
rMvt rm; // Structure de mouvements
rSpr rs;
rVal rv; // Alterable values
char szImageName[_MAX_PATH];
DWORD dwImageFlags;
DWORD dwTranspColor;
DWORD dwPictureWidth;
DWORD dwPictureHeight;
DWORD dwScreenWidth;
DWORD dwScreenHeight;
DWORD dwEditorWidth;
DWORD dwEditorHeight;
int iHotSpotX;
int iHotSpotY;
// int iRealBlendCoef;
#ifdef HWABETA
float fAngle;
#else
int iAngle;
#endif
LPSURFACE psfOrg;
LPSURFACE psf;
RECT rBkd;
LPSURFACE pSfBkd;
int nOffsetX;
int nOffsetY;
#ifdef HWABETA
bool bHWA;
bool bAlpha;
// bool m_bReloadAfterLostDevice;
#endif
} ActivePicture;
typedef struct
{
headerObject rHo;
rCom rc;
rMvt rm;
rSpr rs;
rVal rv;
LPRRDATA rRd;
int width;
int height;
int shape;
int fillType;
int gradDir;
COLORREF fillColor;
COLORREF fillColor2;
COLORREF lineColor;
int lineWeight;
bool useTrans;
DWORD imageOptions;
COLORREF transColor;
WORD* patterns;
WORD* images;
size_t patternCount;
size_t imageCount;
char* text;
COLORREF textColor;
HFONT textFont;
DWORD textAlignFlags;
DWORD textEffect;
DWORD textCoef;
int polyn;
char* polyCoords;
tagPOINT* polySet;
int rebuild;
int rebuildPoly;
int rebuildTrans;
cSurface* pSf;
sMask* pMask;
int hotX;
int hotY;
// Transformed data
cSurface* transSf;
sMask* transMask;
int diffWidth;
int diffHeight;
} ActiveShape;
//Callback
class CFillUser : public CFillData
{
public:
RUNDATA* rdPtr;
TCHAR* fillName;
public:
CFillUser(RUNDATA* __rdPtr,const TCHAR* name);
~CFillUser();
virtual BOOL Fill(cSurface FAR * pSf, int l, int t, int r, int b, BOOL bForceOpaqueBlack=FALSE);
};
//Radial gradient
class CFillRadial : public CFillData
{
public:
COLORREF m_crFrom;
COLORREF m_crTo;
public:
CFillRadial(COLORREF crFrom, COLORREF crTo);
void SetColors(COLORREF crFrom, COLORREF crTo);
virtual BOOL Fill(cSurface FAR * pSf, int l, int t, int r, int b, BOOL bForceOpaqueBlack=FALSE);
};
//Linear gradient
class CFillDirEx : public CFillData
{
public:
// Constructors
CFillDirEx(COLORREF crFrom, COLORREF crTo, BOOL Vertical);
public:
int m_xOrg;
int m_yOrg;
// Attributes
COLORREF m_crFrom;
COLORREF m_crTo;
BOOL m_vert;
public:
void SetColors(COLORREF crFrom, COLORREF crTo);
void SetDir(BOOL vert);
// Implementation
virtual BOOL Fill(cSurface FAR * pSf, int l, int t, int r, int b, BOOL bForceOpaqueBlack=FALSE);
};