forked from haithun/CoD4X17a_testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscr_vm.h
377 lines (344 loc) · 10.8 KB
/
scr_vm.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
/*
===========================================================================
Copyright (C) 2010-2013 Ninja and TheKelm of the IceOps-Team
This file is part of CoD4X17a-Server source code.
CoD4X17a-Server source code is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
CoD4X17a-Server source code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
===========================================================================
*/
#ifndef __SCR_VM_H__
#define __SCR_VM_H__
#define SCRSTRUCT_ADDR 0x895bf08
#define STRINGINDEX_ADDR 0x836fe20
#define stringIndex (*((stringIndex_t*)(STRINGINDEX_ADDR)))
#include "q_shared.h"
#include "q_math.h"
#include "entity.h"
#include "g_hud.h"
#include "filesystem.h"
typedef struct{
short emptystring;
short active;
short j_spine4;
short j_helmet;
short j_head;
short all;
short allies;
short axis;
short bad_path;
short begin_firing;
short cancel_location;
short confirm_location;
short crouch;
short current;
short damage;
short dead;
short death;
short detonate;
short direct;
short dlight;
short done;
short empty;
short end_firing;
short entity;
short explode;
short failed;
short fraction;
short free;
short goal;
short goal_changed;
short goal_yaw;
short grenade;
short grenade_danger;
short grenade_fire;
short grenade_pullback;
short info_notnull;
short invisible;
short key1;
short key2;
short killanimscript;
short left;
short light;
short movedone;
short noclass;
short none;
short normal;
short player;
short position;
short projectile_impact;
short prone;
short right;
short reload;
short reload_start;
short rocket;
short rotatedone;
short script_brushmodel;
short script_model;
short script_origin;
short snd_enveffectsprio_level;
short snd_enveffectsprio_shellshock;
short snd_channelvolprio_holdbreath;
short snd_channelvolprio_pain;
short snd_channelvolprio_shellshock;
short stand;
short suppression;
short suppression_end;
short surfacetype;
short tag_aim;
short tag_aim_animated;
short tag_brass;
short tag_butt;
short tag_clip;
short tag_flash;
short tag_flash_11;
short tag_flash_2;
short tag_flash_22;
short tag_flash_3;
short tag_fx;
short tag_inhand;
short tag_knife_attach;
short tag_knife_fx;
short tag_laser;
short tag_origin;
short tag_weapon;
short tag_player;
short tag_camera;
short tag_weapon_right;
short tag_gasmask;
short tag_gasmask2;
short tag_sync;
short target_script_trigger;
short tempEntity;
short top;
short touch;
short trigger;
short trigger_use;
short trigger_use_touch;
short trigger_damage;
short trigger_lookat;
short truck_cam;
short weapon_change;
short weapon_fired;
short worldspawn;
short flashbang;
short flash;
short smoke;
short night_vision_on;
short night_vision_off;
short MOD_UNKNOWN;
short MOD_PISTOL_BULLET;
short MOD_RIFLE_BULLET;
short MOD_GRENADE;
short MOD_GRENADE_SPLASH;
short MOD_PROJECTILE;
short MOD_PROJECTILE_SPLASH;
short MOD_MELEE;
short MOD_HEAD_SHOT;
short MOD_CRUSH;
short MOD_TELEFRAG;
short MOD_FALLING;
short MOD_SUICIDE;
short MOD_TRIGGER_HURT;
short MOD_EXPLOSIVE;
short MOD_IMPACT;
short script_vehicle;
short script_vehicle_collision;
short script_vehicle_collmap;
short script_vehicle_corpse;
short turret_fire;
short turret_on_target;
short turret_not_on_target;
short turret_on_vistarget;
short turret_no_vis;
short turret_rotate_stopped;
short turret_deactivate;
short turretstatechange;
short turretownerchange;
short reached_end_node;
short reached_wait_node;
short reached_wait_speed;
short near_goal;
short veh_collision;
short veh_predictedcollision;
short auto_change;
short back_low;
short back_mid;
short back_up;
short begin;
short call_vote;
short freelook;
short head;
short intermission;
short j_head_dup;
short manual_change;
short menuresponse;
short neck;
short pelvis;
short pistol;
short plane_waypoint;
short playing;
short spectator;
short vote;
short sprint_begin;
short sprint_end;
short tag_driver;
short tag_passenger;
short tag_gunner;
short tag_wheel_front_left;
short tag_wheel_front_right;
short tag_wheel_back_left;
short tag_wheel_back_right;
short tag_wheel_middle_left;
short tag_wheel_middle_right;
short script_vehicle_collision_dup;
short script_vehicle_collmap_dup;
short script_vehicle_corpse_dup;
short tag_detach;
short tag_popout;
short tag_body;
short tag_turret;
short tag_turret_base;
short tag_barrel;
short tag_engine_left;
short tag_engine_right;
short front_left;
short front_right;
short back_left;
short back_right;
short tag_gunner_pov;
}stringIndex_t;
typedef void *xfunction_t;
typedef struct scr_function_s
{
struct scr_function_s *next;
char *name;
xfunction_t function;
qboolean developer;
} scr_function_t;
typedef byte PrecacheEntry[8192];
typedef unsigned int sval_u;
typedef int scr_entref_t;
/**************** Additional *************************/
typedef enum{
SCR_CB_NEW_SAY,
SCR_CB_NEW_SEQMSG,
SCR_CB_NEW_SEQPLAYERMSG
}script_CallBacks_new_t;
int script_CallBacks_new[8];
qboolean say_forwardAll;
typedef int fieldtype_t;
typedef struct
{
char* name;
int val1;
fieldtype_t type;
void (*setfun)();
void (*getfun)();
}client_fields_t;
void __cdecl Scr_InitVariables(void); //VM
void __cdecl Scr_Init(void); //VM_Init
void __cdecl Scr_Settings(int, int, int);
void __cdecl Scr_AddEntity(gentity_t* ent);
void __cdecl Scr_Cleanup(void);
void __cdecl GScr_Shutdown(void);
short __cdecl Scr_AllocArray();
int __cdecl Scr_GetNumParam( void );
int __cdecl Scr_GetInt( unsigned int );
float __cdecl Scr_GetFloat( unsigned int );
char* __cdecl Scr_GetString( unsigned int );
gentity_t* __cdecl Scr_GetEntity( unsigned int );
short __cdecl Scr_GetConstString( unsigned int );
unsigned int __cdecl Scr_GetType( unsigned int );
void __cdecl Scr_GetVector( unsigned int, vec3_t* );
void __cdecl Scr_Error( const char *string);
void __cdecl Scr_SetLoading( qboolean );
void __cdecl Scr_ParamError( int, const char *string);
void __cdecl Scr_ObjectError( const char *string);
void __cdecl Scr_AddInt(int value);
void __cdecl Scr_AddFloat(float);
void __cdecl Scr_AddBool(qboolean);
void __cdecl Scr_AddString(const char *string);
void __cdecl Scr_AddUndefined(void);
void __cdecl Scr_AddVector( vec3_t vec );
void __cdecl Scr_AddArray( void );
void __cdecl Scr_MakeArray( void );
void __cdecl Scr_Notify( gentity_t*, unsigned short, unsigned int);
void __cdecl Scr_NotifyNum( int, unsigned int, unsigned int, unsigned int);
/*Not working :( */
void __cdecl Scr_PrintPrevCodePos( int printDest, const char* unk, qboolean unk2 );
int __cdecl Scr_GetFunctionHandle( const char* scriptName, const char* labelName);
short __cdecl Scr_ExecEntThread( gentity_t* ent, int callbackHook, unsigned int numArgs);
short __cdecl Scr_ExecThread( int callbackHook, unsigned int numArgs);
void __cdecl Scr_FreeThread( short threadId);
unsigned int __cdecl Scr_CreateCanonicalFilename( const char* name );
//Unknown real returntype
unsigned int __cdecl FindVariable( unsigned int, unsigned int );
unsigned int __cdecl FindObject( unsigned int );
unsigned int __cdecl GetNewVariable( unsigned int, unsigned int );
void * __cdecl TempMalloc( int );
void __cdecl ScriptParse( sval_u* , byte);
unsigned int __cdecl GetObjectA( unsigned int );
unsigned int __cdecl GetVariable( unsigned int, unsigned int );
void __cdecl ScriptCompile( sval_u, unsigned int, unsigned int, PrecacheEntry*, int);
void* __cdecl Scr_AddSourceBuffer( const char*, const char*, const char*, byte );
void __cdecl Scr_InitAllocNode( void );
void __cdecl Scr_BeginLoadScripts( void );
void __cdecl Scr_SetClassMap( unsigned int );
void __cdecl Scr_AddFields( unsigned int, const char*, unsigned int );
void __cdecl Scr_SetGenericField( void*, fieldtype_t, int );
void __cdecl Scr_GetGenericField( void*, fieldtype_t, int );
/*
void __cdecl GScr_AddFieldsForEntity( void );
tGScr_AddFieldsForEntity GScr_AddFieldsForEntity = (tGScr_AddFieldsForEntity(0x80c7808);
*/
void __cdecl GScr_AddFieldsForHudElems( void );
void __cdecl GScr_AddFieldsForRadiant( void );
void __cdecl Scr_AddHudElem( game_hudelem_t* );
void __cdecl Scr_FreeHudElem( game_hudelem_t* );
void __cdecl Scr_EndLoadScripts( void );
void __cdecl Scr_ConstructMessageString( int, int, const char*, char*, unsigned int );
qboolean Scr_PlayerSay(gentity_t*, int mode, const char* text);
void GScr_LoadGameTypeScript(void);
unsigned int Scr_LoadScript(const char* scriptname, PrecacheEntry *precache, int iarg_02);
qboolean Scr_ExecuteMasterResponse(char* s);
void Scr_AddStockFunctions(void);
void Scr_AddStockMethods(void);
qboolean Scr_AddFunction( const char *cmd_name, xfunction_t function, qboolean developer);
qboolean Scr_RemoveFunction( const char *cmd_name );
void Scr_ClearFunctions( void );
__cdecl void* Scr_GetFunction( const char** v_functionName, qboolean* v_developer );
qboolean Scr_AddMethod( const char *cmd_name, xfunction_t function, qboolean developer);
qboolean Scr_RemoveMethod( const char *cmd_name );
void Scr_ClearMethods( void );
__cdecl void* Scr_GetMethod( const char** v_functionName, qboolean* v_developer );
#define MAX_SCRIPT_FILEHANDLES 10
typedef enum{
SCR_FH_FILE,
SCR_FH_PARALIST,
SCR_FH_INDEXPARALIST
}scr_fileHandleType_t;
typedef struct{
FILE* fh;
scr_fileHandleType_t type;
char filename[MAX_QPATH];
int baseOffset;
int fileSize;
}scr_fileHandle_t;
qboolean Scr_FS_CloseFile( scr_fileHandle_t* f );
int Scr_FS_ReadLine( void *buffer, int len, fileHandle_t f );
qboolean Scr_FS_AlreadyOpened( char* qpath, char* filename, size_t fnamelen);
qboolean Scr_FS_FOpenFile( const char *filename, fsMode_t mode, scr_fileHandle_t* f );
fileHandle_t Scr_OpenScriptFile( char* qpath, scr_fileHandleType_t ft, fsMode_t mode);
qboolean Scr_CloseScriptFile( fileHandle_t fh);
int Scr_FS_Read( void *buffer, int len, fileHandle_t f );
int Scr_FS_Write( const void *buffer, int len, fileHandle_t h );
int Scr_FS_Seek( fileHandle_t f, long offset, int origin );
#endif