1 #if !defined(_FUNCTIONS_HPP_) && (defined(COD2_VERSION) || defined(COD_VERSION))
2 #define _FUNCTIONS_HPP_
9 #if COD_VERSION == COD2_1_0
10 return *(
int *)0x0819BE80;
11 #elif COD_VERSION == COD2_1_2
12 return *(
int *)0x0819E080;
13 #elif COD_VERSION == COD2_1_3
14 return *(
int *)0x0819F100;
15 #elif COD_VERSION == COD4_1_7
16 return ((
int *)0x08878D04)[*(
int *)0x08878CC0];
17 #elif COD_VERSION == COD4_1_7_L
18 return ((
int *)0x08879A84)[*(
int *)0x08879A40];
20 #warning trap_Argc() return *(int *)NULL;
25 typedef char * (*Cmd_Argv_t)(
int arg);
26 #if COD_VERSION == COD2_1_0
27 static Cmd_Argv_t Cmd_Argv = (Cmd_Argv_t)0x0806001C;
28 #elif COD_VERSION == COD2_1_2
29 static Cmd_Argv_t Cmd_Argv = (Cmd_Argv_t)0x08060228;
30 #elif COD_VERSION == COD2_1_3
31 static Cmd_Argv_t Cmd_Argv = (Cmd_Argv_t)0x08060220;
33 #warning static Cmd_Argv_t Cmd_Argv = (Cmd_Argv_t)NULL;
34 static Cmd_Argv_t Cmd_Argv = (Cmd_Argv_t)NULL;
37 typedef int (*trap_Argv_t)(
unsigned int param,
char *buf,
int bufLen);
38 #if COD_VERSION == COD2_1_0
39 static trap_Argv_t trap_Argv = (trap_Argv_t)0x08060074;
40 #elif COD_VERSION == COD2_1_2
41 static trap_Argv_t trap_Argv = (trap_Argv_t)0x08060280;
42 #elif COD_VERSION == COD2_1_3
43 static trap_Argv_t trap_Argv = (trap_Argv_t)0x08060278;
44 #elif COD_VERSION == COD4_1_7 || COD_VERSION == COD4_1_7_L
45 static trap_Argv_t trap_Argv = (trap_Argv_t)0x08110E08;
47 #warning static trap_Argv_t trap_Argv = (trap_Argv_t)NULL;
48 static trap_Argv_t trap_Argv = (trap_Argv_t)NULL;
51 #if COD_VERSION == COD4_1_7 || COD_VERSION == COD4_1_7_L
52 typedef int (*Com_Printf_t)(
int a1,
const char *format, ...);
54 typedef int (*Com_Printf_t)(
const char *format, ...);
57 #if COD_VERSION == COD2_1_0
58 static Com_Printf_t Com_Printf = (Com_Printf_t)0x08060B2C;
59 #elif COD_VERSION == COD2_1_2
60 static Com_Printf_t Com_Printf = (Com_Printf_t)0x08060DF2;
61 #elif COD_VERSION == COD2_1_3
62 static Com_Printf_t Com_Printf = (Com_Printf_t)0x08060DEA;
63 #elif COD_VERSION == COD4_1_7
64 static Com_Printf_t Com_Printf = (Com_Printf_t)0x08122B0E;
65 #elif COD_VERSION == COD4_1_7_L
66 static Com_Printf_t Com_Printf = (Com_Printf_t)0x08122B2E;
68 #warning static Com_Printf_t Com_Printf = (Com_Printf_t)NULL;
69 static Com_Printf_t Com_Printf = (Com_Printf_t)NULL;
76 typedef int (*Cmd_ExecuteString_t)(
const char *text);
78 #if COD_VERSION == COD2_1_0
79 static Cmd_ExecuteString_t Cmd_ExecuteString = (Cmd_ExecuteString_t)0x08060754;
80 #elif COD_VERSION == COD2_1_2
81 static Cmd_ExecuteString_t Cmd_ExecuteString = (Cmd_ExecuteString_t)0x080609D4;
82 #elif COD_VERSION == COD2_1_3
83 static Cmd_ExecuteString_t Cmd_ExecuteString = (Cmd_ExecuteString_t)0x080609CC;
84 #elif COD_VERSION == COD4_1_7 || COD_VERSION == COD4_1_7_L
85 static Cmd_ExecuteString_t Cmd_ExecuteString = (Cmd_ExecuteString_t)0x08111F32;
87 static Cmd_ExecuteString_t Cmd_ExecuteString = (Cmd_ExecuteString_t)NULL;
88 #warning Cmd_ExecuteString_t Cmd_ExecuteString = NULL;
91 typedef int (*ClientCommand_t)(
int clientNum);
92 #if COD_VERSION == COD2_1_0
93 static ClientCommand_t ClientCommand = (ClientCommand_t)0x080FE998;
94 static int hook_ClientCommand_call = 0x0808F281;
95 #elif COD_VERSION == COD2_1_2
96 static ClientCommand_t ClientCommand = (ClientCommand_t)0x08100D1E;
97 static int hook_ClientCommand_call = 0x08090B0C;
98 #elif COD_VERSION == COD2_1_3
99 static ClientCommand_t ClientCommand = (ClientCommand_t)0x08100E62;
100 static int hook_ClientCommand_call = 0x08090BA0;
101 #elif COD_VERSION == COD4_1_7
102 static ClientCommand_t ClientCommand = (ClientCommand_t)0x080B070C;
103 static int hook_ClientCommand_call = 0x08170E70;
104 #elif COD_VERSION == COD4_1_7_L
105 static ClientCommand_t ClientCommand = (ClientCommand_t)0x080B070C;
106 static int hook_ClientCommand_call = 0x08170F20;
108 #warning static ClientCommand_t ClientCommand = (ClientCommand_t)NULL;
109 #warning static int hook_ClientCommand_call = NULL;
110 static ClientCommand_t ClientCommand = (ClientCommand_t)NULL;
111 static int hook_ClientCommand_call = (int)NULL;
114 typedef long double (*calc_player_speed_t)(
int a1,
int a2);
115 #if COD_VERSION == COD2_1_0
116 static calc_player_speed_t calc_player_speed = (calc_player_speed_t)0x080DF534;
117 #elif COD_VERSION == COD2_1_2
118 static calc_player_speed_t calc_player_speed = (calc_player_speed_t)0x080E1B14;
119 #elif COD_VERSION == COD2_1_3
120 static calc_player_speed_t calc_player_speed = (calc_player_speed_t)0x080E1C58;
122 #warning static calc_player_speed_t calc_player_speed = NULL;
123 static calc_player_speed_t calc_player_speed = (calc_player_speed_t)NULL;
126 typedef int (*Cvar_VariableValue_t)(
const char *var_name);
127 #if COD_VERSION == COD2_1_0
128 static Cvar_VariableValue_t CvarVariableValue = (Cvar_VariableValue_t)0x080B0BB6;
129 #elif COD_VERSION == COD2_1_2
130 static Cvar_VariableValue_t CvarVariableValue = (Cvar_VariableValue_t)0x080B2E66;
131 #elif COD_VERSION == COD2_1_3
132 static Cvar_VariableValue_t CvarVariableValue = (Cvar_VariableValue_t)0x080B2FAA;
133 #elif COD_VERSION == COD4_1_7
134 static Cvar_VariableValue_t CvarVariableValue = (Cvar_VariableValue_t)0x0819E090;
135 #elif COD_VERSION == COD4_1_7_L
136 static Cvar_VariableValue_t CvarVariableValue = (Cvar_VariableValue_t)0x0819E7C0;
138 #warning static Cvar_VariableValue_t CvarVariableValue = NULL;
139 static Cvar_VariableValue_t CvarVariableValue = (Cvar_VariableValue_t)NULL;
142 typedef char * (*Cvar_VariableString_t)(
const char *var_name);
143 #if COD_VERSION == COD2_1_0
144 static Cvar_VariableString_t Cvar_VariableString = (Cvar_VariableString_t)0x080B0D96;
145 #elif COD_VERSION == COD2_1_2
146 static Cvar_VariableString_t Cvar_VariableString = (Cvar_VariableString_t)0x080B3046;
147 #elif COD_VERSION == COD2_1_3
148 static Cvar_VariableString_t Cvar_VariableString = (Cvar_VariableString_t)0x080B318A;
150 #warning static Cvar_VariableValue_t CvarVariableValue = NULL;
151 static Cvar_VariableString_t Cvar_VariableString = (Cvar_VariableString_t)NULL;
154 typedef int (*FS_ReadFile_t)(
const char *qpath,
void **buffer);
155 #if COD_VERSION == COD2_1_0
156 static FS_ReadFile_t FS_ReadFile = (FS_ReadFile_t)0x0809E892;
157 #elif COD_VERSION == COD2_1_2
158 static FS_ReadFile_t FS_ReadFile = (FS_ReadFile_t)0x080A0958;
159 #elif COD_VERSION == COD2_1_3
160 static FS_ReadFile_t FS_ReadFile = (FS_ReadFile_t)0x080A0A9C;
162 #warning static FS_ReadFile_t FS_ReadFile = NULL;
163 static FS_ReadFile_t FS_ReadFile = (FS_ReadFile_t)NULL;
167 typedef int (*FS_LoadDir_t)(
char *path,
char *dir);
168 #if COD_VERSION == COD2_1_0
169 static FS_LoadDir_t FS_LoadDir = (FS_LoadDir_t)0x080A01A4;
170 #elif COD_VERSION == COD2_1_2
171 static FS_LoadDir_t FS_LoadDir = (FS_LoadDir_t)0x080A22D8;
172 #elif COD_VERSION == COD2_1_3
173 static FS_LoadDir_t FS_LoadDir = (FS_LoadDir_t)0x080A241C;
175 #warning static FS_LoadDir_t FS_LoadDir = NULL;
176 static FS_LoadDir_t FS_LoadDir = (FS_LoadDir_t)NULL;
179 #if COD_VERSION == COD2_1_0
180 static int rconPasswordAddress = 0x0848B1C0;
181 #elif COD_VERSION == COD2_1_2
182 static int rconPasswordAddress = 0x0849E6C0;
183 #elif COD_VERSION == COD2_1_3
184 static int rconPasswordAddress = 0x0849F740;
186 #warning static int rconPasswordAddress = NULL;
187 static int rconPasswordAddress = (int)NULL;
190 typedef int (*Com_Milliseconds_t)(void);
191 #if COD_VERSION == COD2_1_0
192 static Com_Milliseconds_t Com_Milliseconds = (Com_Milliseconds_t)0x08061878;
193 static int hook_RemoteCommandTime_call = 0x080951BE;
194 static int remoteCommandLastTimeAddress = 0x0848B674;
195 #elif COD_VERSION == COD2_1_2
196 static Com_Milliseconds_t Com_Milliseconds = (Com_Milliseconds_t)0x08061B84;
197 static int hook_RemoteCommandTime_call = 0x080970D6;
198 static int remoteCommandLastTimeAddress = 0x0849EB74;
199 #elif COD_VERSION == COD2_1_3
200 static Com_Milliseconds_t Com_Milliseconds = (Com_Milliseconds_t)0x08061B7C;
201 static int hook_RemoteCommandTime_call = 0x080971BC;
202 static int remoteCommandLastTimeAddress = 0x0849FBF4;
204 #warning static Com_Milliseconds_t Com_Milliseconds = NULL;
205 #warning static int hook_RemoteCommandTime_call = NULL;
206 #warning static int remoteCommandLastTimeAddress = NULL;
207 static Com_Milliseconds_t Com_Milliseconds = (Com_Milliseconds_t)NULL;
208 static int hook_RemoteCommandTime_call = (int)NULL;
209 static int remoteCommandLastTimeAddress = (int)NULL;
212 #if COD_VERSION == COD2_1_0
213 static int hook_findMap_call = 0x0808AD00;
214 #elif COD_VERSION == COD2_1_2
215 static int hook_findMap_call = 0x0808BCFC;
216 #elif COD_VERSION == COD2_1_3
217 static int hook_findMap_call = 0x0808BDC8;
219 #warning static int hook_findMap_call = NULL;
220 static int hook_findMap_call = (int)NULL;
223 #if COD_VERSION == COD2_1_0
224 static int hook_AuthorizeState_call = 0x0808C8C0;
225 #elif COD_VERSION == COD2_1_2
226 static int hook_AuthorizeState_call = 0x0808DA52;
227 #elif COD_VERSION == COD2_1_3
228 static int hook_AuthorizeState_call = 0x0808DB12;
230 #warning static int hook_AuthorizeState_call = NULL;
231 static int hook_AuthorizeState_call = (int)NULL;
260 typedef int (*SV_ConnectionlessPacket_t)(netadr_t from, msg_t * msg);
261 #if COD_VERSION == COD2_1_0
262 static SV_ConnectionlessPacket_t SV_ConnectionlessPacket = (SV_ConnectionlessPacket_t)0x08093F1E;
263 #elif COD_VERSION == COD2_1_2
264 static SV_ConnectionlessPacket_t SV_ConnectionlessPacket = (SV_ConnectionlessPacket_t)0x08095894;
265 #elif COD_VERSION == COD2_1_3
266 static SV_ConnectionlessPacket_t SV_ConnectionlessPacket = (SV_ConnectionlessPacket_t)0x0809594E;
268 #warning static SV_ConnectionlessPacket_t SV_ConnectionlessPacket = NULL;
269 static SV_ConnectionlessPacket_t SV_ConnectionlessPacket = (SV_ConnectionlessPacket_t)NULL;
272 typedef int (*NET_OutOfBandPrint_t)(
int sock, netadr_t adr,
const char *msg );
273 #if COD_VERSION == COD2_1_0
274 static NET_OutOfBandPrint_t NET_OutOfBandPrint = (NET_OutOfBandPrint_t)0x0806C40C;
275 #elif COD_VERSION == COD2_1_2
276 static NET_OutOfBandPrint_t NET_OutOfBandPrint = (NET_OutOfBandPrint_t)0x0806C8D4;
277 #elif COD_VERSION == COD2_1_3
278 static NET_OutOfBandPrint_t NET_OutOfBandPrint = (NET_OutOfBandPrint_t)0x0806C8CC;
280 #warning NET_OutOfBandPrint_t NET_OutOfBandPrint = NULL;
281 static NET_OutOfBandPrint_t NET_OutOfBandPrint = (NET_OutOfBandPrint_t)NULL;
284 typedef int (*SV_FlushRedirect_t)(
const char *outputbuf);
285 #if COD_VERSION == COD2_1_0
286 static SV_FlushRedirect_t SV_FlushRedirect = (SV_FlushRedirect_t)0x0809507C;
287 #elif COD_VERSION == COD2_1_2
288 static SV_FlushRedirect_t SV_FlushRedirect = (SV_FlushRedirect_t)0x08096F94;
289 #elif COD_VERSION == COD2_1_3
290 static SV_FlushRedirect_t SV_FlushRedirect = (SV_FlushRedirect_t)0x08097050;
292 #warning SV_FlushRedirect_t SV_FlushRedirect = NULL;
293 static SV_FlushRedirect_t SV_FlushRedirect = (SV_FlushRedirect_t)NULL;
296 typedef int (*SV_GameSendServerCommand_t)(
int clientNum,
signed int a2,
const char *msg);
297 #if COD_VERSION == COD2_1_0
298 static SV_GameSendServerCommand_t SV_GameSendServerCommand = (SV_GameSendServerCommand_t)0x0808FE96;
299 #elif COD_VERSION == COD2_1_2
300 static SV_GameSendServerCommand_t SV_GameSendServerCommand = (SV_GameSendServerCommand_t)0x080916A6;
301 #elif COD_VERSION == COD2_1_3
302 static SV_GameSendServerCommand_t SV_GameSendServerCommand = (SV_GameSendServerCommand_t)0x080917AA;
304 #warning static SV_GameSendServerCommand_t SV_GameSendServerCommand = NULL;
305 static SV_GameSendServerCommand_t SV_GameSendServerCommand = (SV_GameSendServerCommand_t)NULL;
308 typedef int (*SV_DropClient_t)(
int a1,
char* message);
309 #if COD_VERSION == COD2_1_0
310 static SV_DropClient_t SV_DropClient = (SV_DropClient_t)0x0808DC8C;
311 #elif COD_VERSION == COD2_1_2
312 static SV_DropClient_t SV_DropClient = (SV_DropClient_t)0x0808EF9A;
313 #elif COD_VERSION == COD2_1_3
314 static SV_DropClient_t SV_DropClient = (SV_DropClient_t)0x0808F02E;
316 #warning SV_DropClient_t SV_DropClient = (SV_DropClient_t)NULL;
317 static SV_DropClient_t SV_DropClient = (SV_DropClient_t)NULL;
320 typedef int (*SV_WriteDownloadToClient_t)(
int a1,
int a2);
321 #if COD_VERSION == COD2_1_0
322 static SV_WriteDownloadToClient_t SV_WriteDownloadToClient = (SV_WriteDownloadToClient_t)0x0808E544;
323 #elif COD_VERSION == COD2_1_2
324 static SV_WriteDownloadToClient_t SV_WriteDownloadToClient = (SV_WriteDownloadToClient_t)0x0808FD2E;
325 #elif COD_VERSION == COD2_1_3
326 static SV_WriteDownloadToClient_t SV_WriteDownloadToClient = (SV_WriteDownloadToClient_t)0x0808FDC2;
328 #warning static SV_WriteDownloadToClient_t SV_WriteDownloadToClient = (SV_WriteDownloadToClient_t)NULL;
329 static SV_WriteDownloadToClient_t SV_WriteDownloadToClient = (SV_WriteDownloadToClient_t)NULL;
332 typedef int (*SV_BeginDownload_f_t)(
int a1);
333 static SV_BeginDownload_f_t SV_BeginDownload_f = (SV_BeginDownload_f_t)NULL;
335 typedef int (*ClientUserinfoChanged_t)(
int a1);
336 #if COD_VERSION == COD2_1_0
337 static ClientUserinfoChanged_t changeClientUserinfo = (ClientUserinfoChanged_t)0x080F6506;
338 #elif COD_VERSION == COD2_1_2
339 static ClientUserinfoChanged_t changeClientUserinfo = (ClientUserinfoChanged_t)0x080F8B1A;
340 #elif COD_VERSION == COD2_1_3
341 static ClientUserinfoChanged_t changeClientUserinfo = (ClientUserinfoChanged_t)0x080F8C5E;
343 #warning ClientUserinfoChanged_t changeClientUserinfo = (ClientUserinfoChanged_t)NULL;
344 static ClientUserinfoChanged_t changeClientUserinfo = (ClientUserinfoChanged_t)NULL;
347 typedef int (*Info_SetValueForKey_t)(
char *s,
const char *key,
const char *value);
348 #if COD_VERSION == COD2_1_0
349 static Info_SetValueForKey_t Info_SetValueForKey = (Info_SetValueForKey_t)0x080B5FF6;
350 #elif COD_VERSION == COD2_1_2
351 static Info_SetValueForKey_t Info_SetValueForKey = (Info_SetValueForKey_t)0x080B848A;
352 #elif COD_VERSION == COD2_1_3
353 static Info_SetValueForKey_t Info_SetValueForKey = (Info_SetValueForKey_t)0x080B85CE;
355 #warning Info_SetValueForKey_t Info_SetValueForKey = (Info_SetValueForKey_t)NULL;
356 static Info_SetValueForKey_t Info_SetValueForKey = (Info_SetValueForKey_t)NULL;
359 typedef char* (*Info_ValueForKey_t)(
char *s,
const char *key);
360 #if COD_VERSION == COD2_1_0
361 static Info_ValueForKey_t Info_ValueForKey = (Info_ValueForKey_t)0x080B5B30;
362 #elif COD_VERSION == COD2_1_2
363 static Info_ValueForKey_t Info_ValueForKey = (Info_ValueForKey_t)0x080B7FC4;
364 #elif COD_VERSION == COD2_1_3
365 static Info_ValueForKey_t Info_ValueForKey = (Info_ValueForKey_t)0x080B8108;
367 #warning Info_ValueForKey_t Info_ValueForKey = (Info_ValueForKey_t)NULL;
368 static Info_ValueForKey_t Info_ValueForKey = (Info_ValueForKey_t)NULL;
371 typedef short (*codscript_call_callback_entity_t)(
int self,
int callback,
int params);
372 #if COD_VERSION == COD2_1_0
373 static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)0x08118DF4;
374 #elif COD_VERSION == COD2_1_2
375 static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)0x0811B128;
376 #elif COD_VERSION == COD2_1_3
377 static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)0x0811B284;
378 #elif COD_VERSION == COD4_1_7 || COD_VERSION == COD4_1_7_L
379 static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)0x080C765C;
381 #warning static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)NULL;
382 static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)NULL;
385 typedef int (*codscript_callback_finish_t)(
short callback_handle);
386 #if COD_VERSION == COD2_1_0
387 static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)0x08083B8E;
388 #elif COD_VERSION == COD2_1_2
389 static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)0x0808410A;
390 #elif COD_VERSION == COD2_1_3
391 static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)0x080841D6;
392 #elif COD_VERSION == COD4_1_7
393 static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)0x0815D042;
394 #elif COD_VERSION == COD4_1_7_L
395 static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)0x0815D062;
397 #warning static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)NULL;
398 static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)NULL;