Add set_ent_rendering native (bug 5773, r=Nextra)

Former-commit-id: d322cd2e79497eae463e941973db952079219c80
This commit is contained in:
Vincent Herbet 2013-08-10 14:16:26 +02:00
parent ec644cf1a4
commit ddacdb0ab2
2 changed files with 39 additions and 0 deletions

View File

@ -1518,9 +1518,33 @@ static cell AMX_NATIVE_CALL get_grenade_id(AMX *amx, cell *params) /* 4 param *
return 0;
}
static cell AMX_NATIVE_CALL set_ent_rendering(AMX *amx, cell *params) // set_user_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0); = 7 arguments
{
// params[1] = index
// params[2] = fx
// params[3] = r
// params[4] = g
// params[5] = b
// params[6] = render
// params[7] = amount
CHECK_ENTITY_SIMPLE(params[1]);
edict_t *pEntity = MF_GetPlayerEdict(params[1]);
pEntity->v.renderfx = params[2];
pEntity->v.rendercolor = Vector(float(params[3]), float(params[4]), float(params[5]));
pEntity->v.rendermode = params[6];
pEntity->v.renderamt = float(params[7]);
return 1;
}
AMX_NATIVE_INFO ent_NewNatives[] =
{
{"DispatchKeyValue", DispatchKeyValue},
{"set_ent_rendering", set_ent_rendering},
{NULL, NULL}
};

View File

@ -241,4 +241,19 @@ native is_visible(entity, target);
//Added at twistedeuphoria's request, see funcwiki for details
native trace_forward(const Float:start[3], const Float:angle[3], Float:give, ignoreEnt, &Float:hitX, &Float:hitY, &Float:shortestDistance, &Float:shortestDistLow, &Float:shortestDistHigh);
/**
* Sets rendering of an entity, including player entities.
* This is basically the same as set_rendering() stock.
*
* @param index The entity index to apply the render.
* @param fx The render effect. See kRenderFx* constants.
* @param r The amount of red.
* @param g The amount of green.
* @param b The amount of blue.
* @param render The render mode. See kRender* constants.
* @param amount The render thickness generally. It can have others meaning depending effect/mode.
* @noreturn
*/
native set_ent_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0);
#include <engine_stocks>