Repository navigation
Expand file tree
/
Copy pathhldem.hexpat
More file actions
225 lines (207 loc) · 3.83 KB
/
Copy pathhldem.hexpat
File metadata and controls
225 lines (207 loc) · 3.83 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
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
/*
* Simple GoldSRC demo pattern.
* Regions of data:
* * Demo header with all info
* * Actual demo data (simplified)
* * Directory of entries
*/
#pragma author den4iklovelinux
#pragma description GoldSRC DEM
#pragma magic [ 48 4C 44 45 4D 4F ] @ 0x00
#pragma endian little
struct header_t
{
char MAGIC[8];
s32 demproto;
s32 netproto;
char mapname[260];
char dlldir[260];
s32 crc;
s32 diroffset;
};
header_t Header @ 0x00;
struct entry_t
{
s32 type;
char desc[64];
s32 flags;
s32 cdtrack;
float pb_time;
s32 pb_frames;
s32 offset;
s32 length;
};
struct demdir_t
{
s32 numentries;
entry_t entries[2];
};
demdir_t Dirs @ Header.diroffset;
struct vec3_t {
float y;
float x;
float z;
};
struct camprefs_t {
vec3_t position;
vec3_t orientation;
vec3_t forward;
vec3_t right;
vec3_t up;
};
struct refparams_t
{
float frametime;
float time;
s32 intermission;
s32 paused;
s32 spectator;
s32 onground;
s32 waterlevel;
vec3_t velocity;
vec3_t origin;
vec3_t viewHeight;
float idealPitch;
vec3_t viewangles;
s32 health;
vec3_t xhairAngle;
float viewsize;
vec3_t punchAngle;
s32 maxClients;
s32 viewEntity;
s32 playerCount;
s32 maxEnts;
s32 demoPlayback;
s32 hardware;
s32 smoothing;
s32 ptr_cmd;
s32 ptr_mvars;
s32 viewport[4];
s32 nextview;
s32 onlyClientDraw;
};
struct usercmd_t
{
s16 lerp_msec;
u8 msec;
u8 UNUSED1;
vec3_t viewAngles;
float fwdMove;
float sideMove;
float upMove;
s8 lightLevel;
u8 UNUSED2;
u16 buttons;
s8 impulse;
s8 weaponSel;
s16 UNUSED3;
s32 impactIndex;
vec3_t impactPos;
};
struct movevars_t
{
float gravity;
float stopSpeed;
float maxSpeed;
float specMaxSpeed;
float accel;
float airAccel;
float waterAccel;
float friction;
float edgeFriction;
float waterFrict;
float entGravity;
float bounce;
float stepSize;
float maxVel;
float zMax;
float waveHeight;
s32 footsteps;
char skyname[32];
float rollAngle;
float rollSpeed;
vec3_t skyColor;
vec3_t skyVec;
};
struct mainframes_t {
u32 pad1;
camprefs_t camprefs;
refparams_t params;
usercmd_t usercmds;
movevars_t movevars;
u8 etcdata[44];
s32 length;
u8 data[length];
};
struct cmd_t {
char command[64];
};
struct clientdata_t {
vec3_t position;
vec3_t rotation;
u32 weaponFlags;
float fov;
};
struct args_t
{
u32 flags;
u32 entIdx;
vec3_t pos;
vec3_t rot;
vec3_t vel;
u32 ducking;
float fparam1;
float fparam2;
s32 iparam1;
s32 iparam2;
s32 bparam1;
s32 bparam2;
};
struct eventdata_t {
u32 flags;
u32 index;
float delay;
args_t args;
};
struct weaponanim_t {
s32 animIdx;
s32 body;
};
struct sounddata_t {
s32 channel;
s32 charslen;
char sample[charslen];
float attenuation;
float vol;
u32 flags;
s32 pitch;
};
struct macro_data_9 {
s32 length;
u8 data[length];
};
struct frame_t
{
u8 type;
float time;
u32 frame;
if (type == 0 || type == 1) {
mainframes_t framedata;
} else if (type == 3) {
cmd_t cmdstring;
} else if (type == 4) {
clientdata_t cldata;
} else if (type == 6) {
eventdata_t eventdata;
} else if (type == 7) {
weaponanim_t weaponanimdata;
} else if (type == 8) {
sounddata_t snddata;
} else if (type == 9) {
macro_data_9 data;
}
};
#pragma array_limit 16777215
#pragma pattern_limit 16777215
frame_t Frames1[while($ < Dirs.entries[0].offset + Dirs.entries[0].length)] @ Dirs.entries[0].offset;
frame_t Frames2[while($ < Dirs.entries[1].offset + Dirs.entries[1].length)] @ Dirs.entries[1].offset;