[Half-Life AMXX] / include / fakemeta.inc Repository:
ViewVC logotype

Diff of /include/fakemeta.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 16, Fri Nov 16 15:12:40 2007 UTC revision 17, Fri Nov 16 15:29:57 2007 UTC
# Line 21  Line 21 
21   #pragma library fakemeta   #pragma library fakemeta
22  #endif  #endif
23    
24  /* Returns entvar data from an entity   Use the pev_* enum to specify which form of data you want returned.  /**
25     * Returns entvar data from an entity.  Use the pev_* enum (in fakemeta_const.inc) to specify which data you want retrieved.
26   *   *
27   * If retrieving strings, you may optionally get a pointer into the global string table. Depending on   * @note        This function uses "read_data" style data syntax.  It returns integer values,
28     *                              by-references float data, and sets a buffer for string data.
29     *
30     * @note        If retrieving strings, you may optionally get a pointer into the global string table. Depending on
31   * your situation, there are two ways to do this.   * your situation, there are two ways to do this.
32   * 1: This simply gets the pointer.   * 1: This simply gets the pointer.
33   *    new ptr = pev(entid, pev_classname)   *    new ptr = pev(entid, pev_classname)
34   * 2: The pointer will be stored in ptr AND the actual string is retrieved.   * 2: The pointer will be stored in ptr AND the actual string is retrieved.
35   *    new ptr, classname[32]   *    new ptr, classname[32]
36   *    pev(entid, pev_classname, ptr, classname, 31)   *    pev(entid, pev_classname, ptr, classname, 31)
37     *
38     * @param       _index          The entity index to lookup.
39     * @param       _value          The pev field to lookup (look in fakemeta_const.inc)
40   */   */
41  native pev(_index,_value,{Float,Sql,Result,_}:...);  native pev(_index,_value,any:...);
42    
43  /* Sets entvar data for an entity.  Use the pev_* enum */  /**
44  native set_pev(_index,_value,{Float,Sql,Result,_}:...);   * Sets entvar data for an entity.  Use the pev_* enum from fakemeta_const.inc for reference.
45     *
46     * @note        Setting string data will automatically allocate a new string (via AllocString)
47     *                      If you have a string already allocated with your own call to AllocString, use
48     *                      set_pev_string_ptr instead.
49     *
50     * @param       _index          The entity index to set the value on.
51     * @param       _value          The pev field to set, (look in fakemeta_const.inc)
52     */
53    native set_pev(_index,_value,any:...);
54    
55  /* returns 0 if ent is invalid, >0 if valid  /**
56   * (1 == valid, 2 == valid+pvPrivateData valid)   * Use this native to set a pev field to a string that is already allocated (via a function such
57     * as EngFunc_AllocString).
58     *
59     * @note        If you specify _value as anything other than string fields, an error will be thrown.
60     * @note        Pass 0 as the _string field to set it to an empty string.
61     *
62     * @param       _index          The entity index to set the value on.
63     * @param       _value          The pev field to set - MUST be a string field.
64     * @param       _string         The string handle, retrieved from places like AllocString.
65     */
66    native set_pev_string(_index, _value, _string);
67    
68    
69    /**
70     * Checks the validity of an entity.
71     *
72     * @param entindex              The entity id to check.
73     *
74     * @return                      0 on invalid entity
75     *                                              1 on entity is valid
76     *                                              2 on entity is valid and it has private data (safe to use pdata natives on).
77   */   */
78  native pev_valid(entindex);  native pev_valid(entindex);
79    
80    /**
81     * Returns the serial number for each entity.  The serial number is a unique identity
82     * generated when an entity is created.
83     *
84     * @param       entindex        The entity id.
85     *
86     * @return                              The serial number for the entity.
87     */
88    native pev_serial(entindex);
89    
90  /* Returns any global variable inside globalvars_t structure. Use the glb_* enum.  /* Returns any global variable inside globalvars_t structure. Use the glb_* enum.
91   *   *
92   * When returning data from glb_pStringBase (the global string table), you may give a pointer into that table   * When returning data from glb_pStringBase (the global string table), you may give a pointer into that table
# Line 50  Line 96 
96   * new ptr = pev(id, pev_viewmodel)   * new ptr = pev(id, pev_viewmodel)
97   * global_get(glb_pStringBase, ptr, model, 127)   * global_get(glb_pStringBase, ptr, model, 127)
98   */   */
99  native global_get(_value, {Float,Sql,Result,_}:...);  native global_get(_value, any:...);
100    
101  /* Returns an integer from private data.  _linuxdiff is added into the _Offset if it's used on a linux server. */  /* Returns an integer from private data.  _linuxdiff is added into the _Offset if it's used on a linux server. */
102  native get_pdata_int(_index,_Offset,_linuxdiff=5);  native get_pdata_int(_index,_Offset,_linuxdiff=5);
# Line 64  Line 110 
110  /* Sets a float from private data.  _linuxdiff is added into the _Offset if it's used on a linux server. */  /* Sets a float from private data.  _linuxdiff is added into the _Offset if it's used on a linux server. */
111  native set_pdata_float(_index,_Offset,Float:_Value,_linuxdiff=5);  native set_pdata_float(_index,_Offset,Float:_Value,_linuxdiff=5);
112    
113    /**
114     * Tries to retrieve an edict (entity encapsulation) pointer from an entity's private data.
115     *
116     * This function is byte-addressable.  Unlike get_pdata_int() which searches in byte increments of 4,
117     * get_pdata_end searches in increments of 1.
118     *
119     * @param _index                Entity index.
120     * @param _offset               Offset to search.
121     * @param _linuxdiff    Linux difference.
122     * @return                              -2 if an invalid entity was found.
123     *                                              -1 if an empty entity was found.
124     *                                              Otherwise, an entity index is returned.
125     */
126    native get_pdata_ent(_index, _offset, _linuxdiff=20);
127    
128  /* Registers a forward.  /* Registers a forward.
129   * Returns an id you can pass to unregister_forward   * Returns an id you can pass to unregister_forward
# Line 77  Line 137 
137  native unregister_forward(_forwardType, registerId, post=0);  native unregister_forward(_forwardType, registerId, post=0);
138    
139  /* Returns data for metamod */  /* Returns data for metamod */
140  native forward_return(type,{Float,Sql,Result,_}:...);  native forward_return(type,any:...);
141    
142  /* Returns the original return value of an engine function.  /* Returns the original return value of an engine function.
143   * This is only valid in forwards that were registered as post.   * This is only valid in forwards that were registered as post.
# Line 88  Line 148 
148   */   */
149  native get_orig_retval({Float,_}:...);  native get_orig_retval({Float,_}:...);
150    
151  native engfunc(type,{Float,Sql,Result,AlertType,_}:...);  native engfunc(type,any:...);
152  native dllfunc(type,{Float,Sql,Result,_}:...);  native dllfunc(type,any:...);
153    
154  //only use this with functions that pass a Trace  //only use this with functions that pass a Trace
155  // get: zero extra params - return int, one extra param = byref float or vector  // get: zero extra params - return int, one extra param = byref float or vector
# Line 103  Line 163 
163  native get_tr2(tr_handle, TraceResult:tr_member, {Float,_}:...);  native get_tr2(tr_handle, TraceResult:tr_member, {Float,_}:...);
164  native set_tr2(tr_handle, TraceResult:tr_member, {Float,_}:...);  native set_tr2(tr_handle, TraceResult:tr_member, {Float,_}:...);
165    
166    /**
167     * Creates a traceresult handle.  This value should never be altered.
168     * The handle can be used in get/set_tr2 and various traceresult engine functions.
169     *
170     * NOTE: You must call free_tr2() on every handle made with create_tr2().
171     *
172     * @return              A new TraceResult handle.
173     */
174    native create_tr2();
175    
176    /**
177     * Frees a traceresult handle created with free_tr2().  Do not call
178     * this more than once per handle, or on handles not created through
179     * create_tr2().
180     *
181     * @param tr_handle     TraceResult handle created via create_tr2().
182     * @noreturn
183     */
184    native free_tr2(tr_handle);
185    
186  //Same as above, use either a kvd_handle or 0 for global reserved kvd data  //Same as above, use either a kvd_handle or 0 for global reserved kvd data
187  //kvd_handle is passed by the kvd hook, last param  //kvd_handle is passed by the kvd hook, last param
188  native get_kvd(kvd_handle, KeyValueData:member, {Float,_}:...);  native get_kvd(kvd_handle, KeyValueData:member, {Float,_}:...);
# Line 136  Line 216 
216  //NOTE that for the string offsets below, on AMD64, a byref (char **) offset is NOT the same as an int offset  //NOTE that for the string offsets below, on AMD64, a byref (char **) offset is NOT the same as an int offset
217  //In fact it's QWORD aligned rather than DWORD aligned, so the offset will be exactly half.  //In fact it's QWORD aligned rather than DWORD aligned, so the offset will be exactly half.
218  //Gets a string from a private offset.  If byref is false, the string is treated as static rather than dynamic.  //Gets a string from a private offset.  If byref is false, the string is treated as static rather than dynamic.
219  native get_pdata_string(entity, offset, dest[], maxlength, byref=1, linux=-5);  //linux value is what to add to the offset for linux servers.
220    //this cannot use a default value due to older version using an awkward default value.
221    native get_pdata_string(entity, offset, dest[], maxlength, byref=1, linux);
222    
223  //Sets a string in a private offset.  //Sets a string in a private offset.
224  //realloc = -1 - nonbyref copy (static  //realloc = -1 - nonbyref copy (static
225  //realloc = 0 - copy byref, no realloc *(char **)  //realloc = 0 - copy byref, no realloc *(char **)
226  //realloc = 1 - reallocate new string with free+malloc  //realloc = 1 - reallocate new string with free+malloc
227  //realloc = 2 - reallocate new string with delete[]+new[]  //realloc = 2 - reallocate new string with delete[]+new[]
228  native set_pdata_string(entity, offset, const source[], realloc=2, linux=-5);  //linux value is what to add to the offset for linux servers.
229    //this cannot use a default value due to older version using an awkward default value.
230    native set_pdata_string(entity, offset, const source[], realloc=2, linux);
231    
232  // Copies the given infoBuffer pointer into out[]  // Copies the given infoBuffer pointer into out[]
233  // An infoBuffer pointer is returned by EngFunc_GetInfoKeyBuffer  // An infoBuffer pointer is returned by EngFunc_GetInfoKeyBuffer
234  native copy_infokey_buffer(infoBuffer, out[], maxlen);  native copy_infokey_buffer(infoBuffer, out[], maxlen);
235    
236    
237    /**
238     * Looks up the sequence for the entity.
239     *
240     * @param entity                The entity id to lookup.
241     * @param name                  The sequence name to lookup, case insensitive. ("JUMP" would match "jump")
242     * @param framerate             The framerate of the sequence, if found.
243     * @param loops                 Whether or not the sequence loops.
244     * @param groundspeed   The groundspeed setting of the sequence.
245     * @return                              -1 on failed lookup, the sequence number on successful lookup.
246     */
247    native lookup_sequence(entity, const name[], &Float:framerate = 0.0, &bool:loops = false, &Float:groundspeed = 0.0);
248    
249    /**
250     * Sets a bone controller with the specified value.
251     *
252     * @param entity                The entity id to set the value on.
253     * @param controller    Which controller to set (0 through 3).
254     * @param value                 The value to set it to.
255     * @return                              The percentage that the controller is extended (0.0 through 1.0)
256     */
257    native Float:set_controller(entity, controller, Float:value);

Legend:
Removed from v.16  
changed lines
  Added in v.17

Contact
ViewVC Help
Powered by ViewVC 1.0.4