whoops, i should have done this a long time ago

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40616
This commit is contained in:
David Anderson 2007-03-14 04:08:59 +00:00
parent c4a677df79
commit 3f7180aa65

View File

@ -18,6 +18,14 @@
#endif
#define _entity_included
/**
* Property types for entities.
*/
enum PropType
{
Prop_Send = 0, /**< This property is networked. */
Prop_Data = 1, /**< This property is for saved game files. */
};
/**
* For more information on these, see the HL2SDK (public/edict.h)
@ -300,12 +308,13 @@ stock GetEntSendPropOffs(ent, const String:prop[])
* Gets a network property as an integer; wrapper around GetEntData().
*
* @param entity Edict index.
* @param type Property type.
* @param prop Property to use.
* @param size Number of bytes to read (valid values are 1, 2, or 4).
* @return Value at the given property offset.
* @error Invalid entity or property not found.
*/
stock GetEntProp(entity, const String:prop[], size=4)
stock GetEntProp(entity, PropType:type, const String:prop[], size=4)
{
new offs = GetEntSendPropOffs(entity, prop);
if (offs == -1)
@ -319,12 +328,13 @@ stock GetEntProp(entity, const String:prop[], size=4)
* Sets a network property as an integer; wrapper around GetEntData().
*
* @param entity Edict index.
* @param type Property type.
* @param prop Property to use.
* @param size Number of bytes to write (valid values are 1, 2, or 4).
* @error Invalid entity or offset out of reasonable bounds.
* @noreturn
*/
stock SetEntProp(entity, const String:prop[], value, size=4)
stock SetEntProp(entity, PropType:type, const String:prop[], value, size=4)
{
new offs = GetEntSendPropOffs(entity, prop);
if (offs == -1)
@ -338,11 +348,12 @@ stock SetEntProp(entity, const String:prop[], value, size=4)
* Gets a network property as a float; wrapper around GetEntDataFloat().
*
* @param entity Edict index.
* @param type Property type.
* @param prop Property to use.
* @return Value at the given property offset..
* @error Invalid entity or offset out of reasonable bounds.
*/
stock Float:GetEntPropFloat(entity, const String:prop[])
stock Float:GetEntPropFloat(entity, PropType:type, const String:prop[])
{
new offs = GetEntSendPropOffs(entity, prop);
if (offs == -1)
@ -356,12 +367,13 @@ stock Float:GetEntPropFloat(entity, const String:prop[])
* Sets a network property as a float; wrapper around SetEntDataFloat().
*
* @param entity Edict index.
* @param type Property type.
* @param prop Property to use.
* @param value Value to set.
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
stock SetEntPropFloat(entity, const String:prop[], Float:value)
stock SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value)
{
new offs = GetEntSendPropOffs(entity, prop);
if (offs == -1)
@ -375,11 +387,12 @@ stock SetEntPropFloat(entity, const String:prop[], Float:value)
* Gets a network property as a handle entity; wrapper around GetEntDataEnt().
*
* @param entity Edict index.
* @param type Property type.
* @param prop Property to use.
* @return Entity index at the given property, or 0 if none.
* @error Invalid entity or offset out of reasonable bounds.
*/
stock GetEntPropEnt(entity, const String:prop[])
stock GetEntPropEnt(entity, PropType:type, const String:prop[])
{
new offs = GetEntSendPropOffs(entity, prop);
if (offs == -1)
@ -393,12 +406,13 @@ stock GetEntPropEnt(entity, const String:prop[])
* Sets a network property as a handle entity; wrapper around SetEntDataEnt().
*
* @param entity Edict index.
* @param type Property type.
* @param prop Property to use.
* @param other Entity index to set, or 0 to unset.
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
stock SetEntPropEnt(entity, const String:prop[], other)
stock SetEntPropEnt(entity, PropType:type, const String:prop[], other)
{
new offs = GetEntSendPropOffs(entity, prop);
if (offs == -1)
@ -414,12 +428,13 @@ stock SetEntPropEnt(entity, const String:prop[], other)
* convenience function and will work with both types.
*
* @param entity Edict index.
* @param type Property type.
* @param prop Property to use.
* @param vec Vector buffer to store data in.
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
stock GetEntPropVector(entity, const String:prop[], Float:vec[3])
stock GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3])
{
new offs = GetEntSendPropOffs(entity, prop);
if (offs == -1)
@ -435,12 +450,13 @@ stock GetEntPropVector(entity, const String:prop[], Float:vec[3])
* convenience function and will work with both types.
*
* @param entity Edict index.
* @param type Property type.
* @param prop Property to use.
* @param vec Vector to set.
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
stock SetEntPropVector(entity, const String:prop[], const Float:vec[3])
stock SetEntPropVector(entity, PropType:type, const String:prop[], const Float:vec[3])
{
new offs = GetEntSendPropOffs(entity, prop);
if (offs == -1)