-
Notifications
You must be signed in to change notification settings - Fork 59
/
structs.h
441 lines (359 loc) · 7.18 KB
/
structs.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
#ifndef __STRUCTS__H
#define __STRUCTS__H
//typedefs
typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned long u32;
typedef signed long s32;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
struct KEYELEMENT
{
KEYELEMENT() { isPressed = false; sdlKeycode = 0; }
Uint16 isPressed, sdlKeycode;
};
//now lets define a command
#define PLC_KEYMOD_MUST_BE_HELD ( 1 << 0 )
#define PLC_KEYMOD_DETECT_AS_4WAY ( 1 << 1 )
#define PLC_KEYMOD_BAN_OTHER_INPUT ( 1 << 2 )
#define PLC_KEYMOD_ON_RELEASE ( 1 << 3 )
#define PLC_KEYCODE(x) ( 1 << x )
#define IsKeyInPLCKeyCode( k, c ) ((( PLC_KEYCODE( k ) & c ) > 0 )
#define PLC_ALL_DIRECTIONS_BITFIELD ( PLC_KEYCODE( KEY_UP ) + PLC_KEYCODE( KEY_DOWN ) + PLC_KEYCODE( KEY_LEFT ) + PLC_KEYCODE( KEY_RIGHT ) )
struct PLCOMMANDELEMENT
{
PLCOMMANDELEMENT() { keyCode = 0; keyModifier = 0; gameTicksForHold = 0; }
int keyCode;
Uint16 keyModifier;
Uint16 gameTicksForHold;
};
struct PLCOMMANDFRAMEINPUT
{
PLCOMMANDFRAMEINPUT() { keyBitfield = gameTicks = 0; }
Uint16 keyBitfield;
Uint32 gameTicks;
};
struct PLCOMMAND
{
PLCOMMANDELEMENT nCommand[MAXCOMMAND];
Uint8 nHowManyCommand;
Uint8 nCommandTime, nBufferTime;
char strCommand[255];
};
//Movedata Struct for Saving the current Button States
struct KEYBOARDDATA
{
KEYELEMENT keyInfo[ KEY_COUNT ];
bool bKeyBoard;
};
//memlist for Allocater class
struct MEMLIST
{
u8 nType;
size_t nSize;
void *adrress;
};
//font struct
struct MUGENFONT
{
u8 c;
s16 x;
u8 nWidth;
};
struct PCXHEADER
{
u8 Manufacturer;
u8 Version;
u8 Encoding;
u8 BPP;
u16 x,y;
u16 widht,height;
u16 HRES,VRES;
u8 ColorMap[48];
u8 reserved;
u8 NPlanes;
u8 bytesPerLine;
u8 palletInfo;
u8 Filler[58];
};
struct SFFHEADER
{
u8 signature[11];
u8 verhi;
u8 verlo;
u8 verhi2;
u8 verlo2;
u32 NumberOfGroups;
u32 NumberOfImage;
u32 SubHeaderFileOffset;
u32 SizeOfSubheader;
u8 PaletteType;
u8 BLANK[476];
};
//Sff Subheader
struct SFFSUBHEADER
{
u32 NextSubheaderFileOffset;
u32 LenghtOfSubheader;
s16 x;
s16 y;
s16 GroubNumber;
s16 ImageNumber;
s16 IndexOfPrevious;
bool PalletSame;
u8 BALNK[13];
};
//Sound header
struct SNDHEADER
{
u8 strSignatur[12];
s16 verhi;
s16 verlo;
u32 nNumberOfSounds;
u32 SubHeaderFileOffset;
u8 strBlank[488];
};
//Sound SubHeader
struct SNDSUBHEADER
{
u32 NextSubHeaderFileOffset;
u32 SubFileLenght;
s32 nGroupNumber;
s32 SampleNumber;
};
struct RGBColor
{
u8 R;
u8 G;
u8 B;
};
struct PalFX
{
u8 dummy;
};
struct SFFSPRITE
{
s16 x;
s16 y;
PCXHEADER PcxHeader;
s16 GroupNumber;
s16 ImageNumber;
u16 ColorPallet[256];
u8 *byPcxFile;
};
struct Stacktype
{
float Value;
char string[50];
// 扩展字段,用于方向键是否按下,尚待支持
//char stringEx[50];
};
struct XYVALUE
{
float x;
float y;
};
// 操作堆栈的元素
struct INSTRUCTION
{
Uint16 n_OpCode;
float Value;
char *strValue;
};
// 触发器,一个触发器就是一个表达式
struct PLTRIGGER
{
u8 nTriggerType;
INSTRUCTION* pInts;
};
// 触发器执行需要的值,用表达式保存,
struct CONTROLLERPARAMS
{
ConParmName nParam;
//TODO:动态生成内存
INSTRUCTION pInts[INSPerConParam];
};
// HitDef 保存的值
struct CONTROLHITDEF
{
CONTROLHITDEFParmName nParam;
//TODO:动态生成内存
INSTRUCTION pInts[INSPerConParam];
};
// TODO control中的执行语句只有这三个是表达式,其他的都是数值,为保险还是用CONTROLLERPARAMS统一保存
//struct CHANGESTATE
//{
// INSTRUCTION *value;
// INSTRUCTION *ctrl;
// INSTRUCTION *anim;
//
//};
struct PLSTATE
{
// control所属的state num
s32 nStateNumber;
u16 nType;
PLTRIGGER *triggers;
u16 nHowManyTriggers;
bool bPresist;
bool bIgnorPause;
// 暂时无用,存储的control都直接由nType,映射成函数了
//void *controller;
// http://elecbyte.com/wiki/index.php/Category:State_Controllers
// 里面有说明persistent和ignorehitpause是必须的字段,其他非必须,用map映射存储
//TODO: 定义40参数的列表,可以改为动态产生
CONTROLLERPARAMS pConParm[ConParmPerState];
u16 nParamCount;
// HitDef参数比较多,单独解析
CONTROLHITDEF pConHDParm[ConHDParmPerState];
u16 nParamHDCount;
};
struct PLSTATEDEF
{
//recommend parameters
s32 StateNumber;
u8 type;
u8 movetype;
u8 physics;
s32 nAnim;
//optional param
XYVALUE Velset;
s8 bCtrl;
s16 nPoweradd;
s16 nJuggle;
bool bFacep2;
///Some flags
bool bHitdefpersist;
bool bMovehitpersist;
bool bHitcountpersist;
//////////////////////
u8 nSprpriority;
u16 nHowManyState;
PLSTATE* lpState;
};
struct ClsnRECT
{
s16 x,y;
s16 h,w;
};
//Clsn Struct to hold one Clns Rectangle with type
struct Clsn
{
bool bClsn1;
ClsnRECT ClsnRect;
};
//Element Strcut to save one Elment of an Action Block
struct Element
{
s16 nGroupNumber;
s16 nImageNumber;
s16 x;
s16 y;
u32 nDuringTime;
u16 FlipFlags;
u32 ColorFlags;
Clsn *pClnsData;
u16 nNumberOfClsn;
};
//Action Element to hold one Action Block with its Elements
struct ActionElement
{
s32 nActionNumber;
Element* AnimationElement;
s16 loopStart;
u16 nNumberOfElements;
u16 nCurrentImage;
u32 nDuringTime;
s16 nCompletAnimTime;
u32 nCurrTime;
u16 nCurrentImageTime;
bool bLooped;
};
//Player Data
struct PLDATA
{
s16 nLife;
s16 nAttack;
s16 nDefence;
s16 nFallDefenceUp;
s16 nLieDownTime;
s16 nAirjuggle;
s16 nSparkno;
s16 nGuardSparkno;
bool bKoEcho;
s16 nVolumen;
u8 nIntPersistIndex;
u8 nFloatPersistIndex;
char szPlayerName[10];
};
//Player Size
struct PLAYERSIZE
{
float nXscale;
float nYscale;
s16 nGroundBack;
s16 nGroundFront;
s16 nAirBack;
s16 nAirFront;
s16 nHeight;
XYVALUE nAttackWidth;
s16 nAttackDistance;
s16 nProjAttackDist;
bool bProjDoScale;
XYVALUE nHeadPos;
XYVALUE nMidPos;
s16 nShadowOffset;
XYVALUE nDrawOffset;
};
//Playervelocity struct
struct PLAYERVELOCITY
{
float nWalkFwd;
float nWalkBack;
XYVALUE RunFwd;
XYVALUE RunBack;
XYVALUE JumpNeu;
XYVALUE JumpBack;
XYVALUE JumpFwd;
XYVALUE RunjumpBack;
XYVALUE RunjumpFwd;
XYVALUE AirjumpNeu;
XYVALUE AirjumpBack;
XYVALUE AirjumpFwd;
};
//Playermovement Struct
struct PLAYERMOVEMENT
{
s16 AirJumpNum;
s16 nAirJumpHight;
float yaccel;
float StandFriction;
float CrouchFriction;
};
//Playerconstant struct
struct PLAYERCONST
{
PLDATA PlayerData;
PLAYERSIZE PlayerSize;
PLAYERVELOCITY PlayerVelocity;
PLAYERMOVEMENT PlayerMovement;
};
class CError
{
char strMessage[100];
public:
CError(const char* strError,...)
{
char string[100]; // Temporary string
va_list ap; // Pointer To List Of Arguments
va_start(ap, strError); // Parses The String For Variables
vsprintf(string, strError, ap); // Converts Symbols To Actual Numbers
va_end(ap);
strcpy(strMessage,string);
}
const char *GetError(){return strMessage;}
};
#endif