added amb964, DispatchKeyValue natives

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401510
This commit is contained in:
Borja Ferrer 2007-09-29 22:26:36 +00:00
parent 8154fb4897
commit b609c4eb86
3 changed files with 237 additions and 0 deletions

View File

@ -699,6 +699,87 @@ static cell_t DispatchSpawn(IPluginContext *pContext, const cell_t *params)
return (ret == -1) ? 0 : 1;
}
static cell_t DispatchKeyValue(IPluginContext *pContext, const cell_t *params)
{
static ValveCall *pCall = NULL;
if (!pCall)
{
ValvePassInfo pass[3];
InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[1], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[2], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
if (!CreateBaseCall("DispatchKeyValue", ValveCall_Entity, &pass[2], pass, 2, &pCall))
{
return pContext->ThrowNativeError("\"DispatchKeyValue\" not supported by this mod");
} else if (!pCall) {
return pContext->ThrowNativeError("\"DispatchKeyValue\" wrapper failed to initialized");
}
}
bool ret;
START_CALL();
DECODE_VALVE_PARAM(1, thisinfo, 0);
DECODE_VALVE_PARAM(2, vparams, 0);
DECODE_VALVE_PARAM(3, vparams, 1);
FINISH_CALL_SIMPLE(&ret);
return (ret) ? 1 : 0;
}
static cell_t DispatchKeyValueFloat(IPluginContext *pContext, const cell_t *params)
{
static ValveCall *pCall = NULL;
if (!pCall)
{
ValvePassInfo pass[3];
InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[1], Valve_Float, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[2], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
if (!CreateBaseCall("DispatchKeyValueFloat", ValveCall_Entity, &pass[2], pass, 2, &pCall))
{
return pContext->ThrowNativeError("\"DispatchKeyValueFloat\" not supported by this mod");
} else if (!pCall) {
return pContext->ThrowNativeError("\"DispatchKeyValueFloat\" wrapper failed to initialized");
}
}
bool ret;
START_CALL();
DECODE_VALVE_PARAM(1, thisinfo, 0);
DECODE_VALVE_PARAM(2, vparams, 0);
DECODE_VALVE_PARAM(3, vparams, 1);
FINISH_CALL_SIMPLE(&ret);
return (ret) ? 1 : 0;
}
static cell_t DispatchKeyValueVector(IPluginContext *pContext, const cell_t *params)
{
static ValveCall *pCall = NULL;
if (!pCall)
{
ValvePassInfo pass[3];
InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[1], Valve_Vector, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[2], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
if (!CreateBaseCall("DispatchKeyValueVector", ValveCall_Entity, &pass[2], pass, 2, &pCall))
{
return pContext->ThrowNativeError("\"DispatchKeyValueVector\" not supported by this mod");
} else if (!pCall) {
return pContext->ThrowNativeError("\"DispatchKeyValueVector\" wrapper failed to initialized");
}
}
bool ret;
START_CALL();
DECODE_VALVE_PARAM(1, thisinfo, 0);
DECODE_VALVE_PARAM(2, vparams, 0);
DECODE_VALVE_PARAM(3, vparams, 1);
FINISH_CALL_SIMPLE(&ret);
return (ret) ? 1 : 0;
}
sp_nativeinfo_t g_Natives[] =
{
{"ExtinguishPlayer", ExtinguishEntity},
@ -720,5 +801,8 @@ sp_nativeinfo_t g_Natives[] =
{"IsPlayerAlive", IsPlayerAlive},
{"CreateEntityByName", CreateEntityByName},
{"DispatchSpawn", DispatchSpawn},
{"DispatchKeyValue", DispatchKeyValue},
{"DispatchKeyValueFloat", DispatchKeyValueFloat},
{"DispatchKeyValueVector", DispatchKeyValueVector},
{NULL, NULL},
};

View File

@ -304,6 +304,21 @@
"windows" "35"
"linux" "36"
}
"DispatchKeyValue"
{
"windows" "29"
"linux" "30"
}
"DispatchKeyValueFloat"
{
"windows" "30"
"linux" "31"
}
"DispatchKeyValueVector"
{
"windows" "31"
"linux" "32"
}
}
}
@ -362,6 +377,21 @@
"windows" "35"
"linux" "36"
}
"DispatchKeyValue"
{
"windows" "29"
"linux" "30"
}
"DispatchKeyValueFloat"
{
"windows" "30"
"linux" "31"
}
"DispatchKeyValueVector"
{
"windows" "31"
"linux" "32"
}
}
}
@ -420,6 +450,21 @@
"windows" "35"
"linux" "36"
}
"DispatchKeyValue"
{
"windows" "29"
"linux" "30"
}
"DispatchKeyValueFloat"
{
"windows" "30"
"linux" "31"
}
"DispatchKeyValueVector"
{
"windows" "31"
"linux" "32"
}
}
}
@ -474,6 +519,21 @@
"windows" "116"
"linux" "117"
}
"DispatchKeyValue"
{
"windows" "33"
"linux" "34"
}
"DispatchKeyValueFloat"
{
"windows" "34"
"linux" "35"
}
"DispatchKeyValueVector"
{
"windows" "35"
"linux" "36"
}
/* Temp Entities */
"TE_GetServerClass"
@ -541,6 +601,21 @@
"windows" "35"
"linux" "36"
}
"DispatchKeyValue"
{
"windows" "29"
"linux" "30"
}
"DispatchKeyValueFloat"
{
"windows" "30"
"linux" "31"
}
"DispatchKeyValueVector"
{
"windows" "31"
"linux" "32"
}
/* Offset into CBaseTempEntity constructor.
* On Windows Dsytopia is heavily inlined; we use the function
@ -618,6 +693,21 @@
{
"linux" "28"
}
"DispatchKeyValue"
{
"windows" "28"
"linux" "29"
}
"DispatchKeyValueFloat"
{
"windows" "29"
"linux" "30"
}
"DispatchKeyValueVector"
{
"windows" "30"
"linux" "31"
}
}
}
@ -697,6 +787,21 @@
"windows" "35"
"linux" "36"
}
"DispatchKeyValue"
{
"windows" "29"
"linux" "30"
}
"DispatchKeyValueFloat"
{
"windows" "30"
"linux" "31"
}
"DispatchKeyValueVector"
{
"windows" "31"
"linux" "32"
}
/* Temp Entities */
"s_pTempEntities"
@ -752,6 +857,21 @@
"windows" "106"
"linux" "107"
}
"DispatchKeyValue"
{
"windows" "28"
"linux" "29"
}
"DispatchKeyValueFloat"
{
"windows" "29"
"linux" "30"
}
"DispatchKeyValueVector"
{
"windows" "30"
"linux" "31"
}
/* Temp Entities */
"s_pTempEntities"

View File

@ -172,6 +172,39 @@ native CreateEntityByName(const String:classname[], ForceEdictIndex=-1);
*/
native bool:DispatchSpawn(entity);
/**
* Dispatches a KeyValue into given entity using a string value.
*
* @param entity Destination entity index.
* @param keyName Name of the key.
* @param value String value.
* @return True on success, false otherwise.
* @error Invalid entity index, or no mod support.
*/
native bool:DispatchKeyValue(entity, const String:keyName[], const String:value[]);
/**
* Dispatches a KeyValue into given entity using a floating point value.
*
* @param entity Destination entity index.
* @param keyName Name of the key.
* @param value Floating point value.
* @return True on success, false otherwise.
* @error Invalid entity index, or no mod support.
*/
native bool:DispatchKeyValueFloat(entity, const String:keyName[], Float:value);
/**
* Dispatches a KeyValue into given entity using a vector value.
*
* @param entity Destination entity index.
* @param keyName Name of the key.
* @param vec Vector value.
* @return True on success, false otherwise.
* @error Invalid entity index, or no mod support.
*/
native bool:DispatchKeyValueVector(entity, const String:keyName[], const Float:vector[3]);
/**
* @deprecated
*/