-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynExt.h
More file actions
127 lines (104 loc) · 3.49 KB
/
DynExt.h
File metadata and controls
127 lines (104 loc) · 3.49 KB
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
#ifndef __DynExt_h__
#define __DynExt_h__
// Make identifier
#define MAKEID(a,b,c,d) ((#@a << 24)|(#@b << 16)|(#@c << 8)|(#@d))
#define IS_SET(flags, flag) (((flags) & (flag)) ? true : false)
#define PACK_FLOAT(f) *((long*)&(f))
#define UNPACK_FLOAT(f) *((float*)&(f))
////
__inline rCom* getrCom(LPRO object)
{
DWORD OEFlags = object->roHo.hoOEFlags;
if(!IS_SET(OEFlags, OEFLAG_MOVEMENTS) && !IS_SET(OEFlags, OEFLAG_ANIMATIONS))
return 0;
return (rCom*)((__int8*)object + sizeof(headerObject));
}
__inline rMvt* getrMvt(LPRO object)
{
DWORD OEFlags = object->roHo.hoOEFlags;
if(!IS_SET(OEFlags, OEFLAG_MOVEMENTS))
return 0;
return (rMvt*)((__int8*)object + sizeof(headerObject) + sizeof(rCom));
}
__inline rAni* getrAni(LPRO object)
{
DWORD OEFlags = object->roHo.hoOEFlags;
if(!IS_SET(OEFlags, OEFLAG_ANIMATIONS))
return 0;
return (rAni*)((__int8*)object + sizeof(headerObject) + sizeof(rCom) +
(IS_SET(OEFlags, OEFLAG_MOVEMENTS) ? sizeof(rMvt) : 0));
}
__inline rSpr* getrSpr(LPRO object)
{
DWORD OEFlags = object->roHo.hoOEFlags;
if(!IS_SET(OEFlags, OEFLAG_SPRITES))
return 0;
return (rSpr*)((__int8*)object + sizeof(headerObject) +
((IS_SET(OEFlags, OEFLAG_MOVEMENTS) ||
IS_SET(OEFlags, OEFLAG_ANIMATIONS)) ? sizeof(rCom) : 0) +
(IS_SET(OEFlags, OEFLAG_MOVEMENTS) ? sizeof(rMvt) : 0) +
(IS_SET(OEFlags, OEFLAG_ANIMATIONS) ? sizeof(rAni) : 0));
}
__inline rVal* getrVal(LPRO object)
{
DWORD OEFlags = object->roHo.hoOEFlags;
if(!IS_SET(OEFlags, OEFLAG_VALUES))
return 0;
return (rVal*)((__int8*)object + sizeof(headerObject) +
((IS_SET(OEFlags, OEFLAG_MOVEMENTS) ||
IS_SET(OEFlags, OEFLAG_ANIMATIONS)) ? sizeof(rCom) : 0) +
(IS_SET(OEFlags, OEFLAG_MOVEMENTS) ? sizeof(rMvt) : 0) +
(IS_SET(OEFlags, OEFLAG_ANIMATIONS) ? sizeof(rAni) : 0) +
(IS_SET(OEFlags, OEFLAG_SPRITES) ? sizeof(rSpr) : 0));
}
////
__inline rCom* getrCom(headerObject* object)
{
DWORD OEFlags = object->hoOEFlags;
if(!IS_SET(OEFlags, OEFLAG_MOVEMENTS) && !IS_SET(OEFlags, OEFLAG_ANIMATIONS))
return 0;
return (rCom*)((__int8*)object + sizeof(headerObject));
}
__inline rMvt* getrMvt(headerObject* object)
{
DWORD OEFlags = object->hoOEFlags;
if(!IS_SET(OEFlags, OEFLAG_MOVEMENTS))
return 0;
return (rMvt*)((__int8*)object + sizeof(headerObject) + sizeof(rCom));
}
__inline rAni* getrAni(headerObject* object)
{
DWORD OEFlags = object->hoOEFlags;
if(!IS_SET(OEFlags, OEFLAG_ANIMATIONS))
return 0;
return (rAni*)((__int8*)object + sizeof(headerObject) + sizeof(rCom) +
(IS_SET(OEFlags, OEFLAG_MOVEMENTS) ? sizeof(rMvt) : 0));
}
__inline rSpr* getrSpr(headerObject* object)
{
DWORD OEFlags = object->hoOEFlags;
if(!IS_SET(OEFlags, OEFLAG_SPRITES))
return 0;
return (rSpr*)((__int8*)object + sizeof(headerObject) +
((IS_SET(OEFlags, OEFLAG_MOVEMENTS) ||
IS_SET(OEFlags, OEFLAG_ANIMATIONS)) ? sizeof(rCom) : 0) +
(IS_SET(OEFlags, OEFLAG_MOVEMENTS) ? sizeof(rMvt) : 0) +
(IS_SET(OEFlags, OEFLAG_ANIMATIONS) ? sizeof(rAni) : 0));
}
__inline rVal* getrVal(headerObject* object)
{
DWORD OEFlags = object->hoOEFlags;
if(!IS_SET(OEFlags, OEFLAG_VALUES))
return 0;
return (rVal*)((__int8*)object + sizeof(headerObject) +
((IS_SET(OEFlags, OEFLAG_MOVEMENTS) ||
IS_SET(OEFlags, OEFLAG_ANIMATIONS)) ? sizeof(rCom) : 0) +
(IS_SET(OEFlags, OEFLAG_MOVEMENTS) ? sizeof(rMvt) : 0) +
(IS_SET(OEFlags, OEFLAG_ANIMATIONS) ? sizeof(rAni) : 0) +
(IS_SET(OEFlags, OEFLAG_SPRITES) ? sizeof(rSpr) : 0));
}
#else
#ifdef WARNING_MULTI_INCLUDE
#pragma message(__FILE__ " included multiple times")
#endif
#endif