From ef8db35a49c04992d498151439cd3f1f4b93378e Mon Sep 17 00:00:00 2001 From: Borja Ferrer Date: Sat, 24 Nov 2007 18:17:00 +0000 Subject: [PATCH] added SetEntityModel native --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401726 --- extensions/sdktools/vnatives.cpp | 24 ++++++++++++++ gamedata/sdktools.games.ep2.txt | 5 +++ gamedata/sdktools.games.txt | 45 ++++++++++++++++++++++++++ plugins/include/sdktools_functions.inc | 10 ++++++ 4 files changed, 84 insertions(+) diff --git a/extensions/sdktools/vnatives.cpp b/extensions/sdktools/vnatives.cpp index 017084ee..886ad887 100644 --- a/extensions/sdktools/vnatives.cpp +++ b/extensions/sdktools/vnatives.cpp @@ -802,6 +802,29 @@ static cell_t sm_GetClientAimTarget(IPluginContext *pContext, const cell_t *para return GetClientAimTarget(pPlayer->GetEdict(), params[2] ? true : false); } +static cell_t sm_SetEntityModel(IPluginContext *pContext, const cell_t *params) +{ + static ValveCall *pCall = NULL; + if (!pCall) + { + ValvePassInfo pass[1]; + InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL); + if (!CreateBaseCall("SetEntityModel", ValveCall_Entity, NULL, pass, 1, &pCall)) + { + return pContext->ThrowNativeError("\"SetEntityModel\" not supported by this mod"); + } else if (!pCall) { + return pContext->ThrowNativeError("\"SetEntityModel\" wrapper failed to initialized"); + } + } + + START_CALL(); + DECODE_VALVE_PARAM(1, thisinfo, 0); + DECODE_VALVE_PARAM(2, vparams, 0); + FINISH_CALL_SIMPLE(NULL); + + return 1; +} + sp_nativeinfo_t g_Natives[] = { {"ExtinguishPlayer", ExtinguishEntity}, @@ -826,5 +849,6 @@ sp_nativeinfo_t g_Natives[] = {"DispatchKeyValueFloat", DispatchKeyValueFloat}, {"DispatchKeyValueVector", DispatchKeyValueVector}, {"GetClientAimTarget", sm_GetClientAimTarget}, + {"SetEntityModel", sm_SetEntityModel}, {NULL, NULL}, }; diff --git a/gamedata/sdktools.games.ep2.txt b/gamedata/sdktools.games.ep2.txt index e1caf9b5..51c53b1e 100644 --- a/gamedata/sdktools.games.ep2.txt +++ b/gamedata/sdktools.games.ep2.txt @@ -203,6 +203,11 @@ "windows" "27" "linux" "30" } + "SetEntityModel" + { + "windows" "23" + "linux" "24" + } /** * THESE ARE DISABLED FOR NOW. diff --git a/gamedata/sdktools.games.txt b/gamedata/sdktools.games.txt index 361cf2b5..b2d75206 100644 --- a/gamedata/sdktools.games.txt +++ b/gamedata/sdktools.games.txt @@ -326,6 +326,11 @@ "windows" "29" "linux" "32" } + "SetEntityModel" + { + "windows" "25" + "linux" "26" + } } } @@ -399,6 +404,11 @@ "windows" "29" "linux" "32" } + "SetEntityModel" + { + "windows" "25" + "linux" "26" + } } } @@ -472,6 +482,11 @@ "windows" "29" "linux" "32" } + "SetEntityModel" + { + "windows" "25" + "linux" "26" + } } } @@ -546,6 +561,11 @@ "windows" "39" "linux" "40" } + "SetEntityModel" + { + "windows" "30" + "linux" "31" + } /* Temp Entities */ "TE_GetServerClass" @@ -628,6 +648,11 @@ "windows" "29" "linux" "32" } + "SetEntityModel" + { + "windows" "25" + "linux" "26" + } /* Offset into CBaseTempEntity constructor. * On Windows Dsytopia is heavily inlined; we use the function @@ -719,6 +744,11 @@ "windows" "28" "linux" "31" } + "SetEntityModel" + { + "windows" "24" + "linux" "25" + } } } @@ -813,6 +843,11 @@ "windows" "29" "linux" "32" } + "SetEntityModel" + { + "windows" "25" + "linux" "26" + } /* Temp Entities */ "s_pTempEntities" @@ -888,6 +923,11 @@ "windows" "34" "linux" "35" } + "SetEntityModel" + { + "windows" "25" + "linux" "26" + } /* Temp Entities */ "s_pTempEntities" @@ -981,6 +1021,11 @@ "windows" "33" "linux" "36" } + "SetEntityModel" + { + "windows" "27" + "linux" "28" + } } } } diff --git a/plugins/include/sdktools_functions.inc b/plugins/include/sdktools_functions.inc index 2b7f27c9..4fc3958e 100644 --- a/plugins/include/sdktools_functions.inc +++ b/plugins/include/sdktools_functions.inc @@ -254,6 +254,16 @@ native SetTeamScore(index, value); */ native GetTeamClientCount(index); +/** + * Sets the model to a given entity. + * + * @param entity Entity index. + * @param model Model name. + * @noreturn + * @error Invalid entity index, or no mod support. + */ +native SetEntityModel(entity, const String:model[]); + /** * @deprecated */