From d43807a2483ae82f699f403a3d331d50cf17b308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Thu, 16 Sep 2004 11:02:51 +0000 Subject: [PATCH] Added get_string() to engine: /* Converts a string offset into a real string. Some of the forwards in fakemeta uses string offsets. (FM_CreateNamedEntity) */ native get_string(_string, _returnString[], _len); --- dlls/engine/engine.cpp | 13 +++++++++++++ plugins/include/engine.inc | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/dlls/engine/engine.cpp b/dlls/engine/engine.cpp index e6a5a7e2..1ad9f24f 100755 --- a/dlls/engine/engine.cpp +++ b/dlls/engine/engine.cpp @@ -8,6 +8,10 @@ int g_CameraCount; TraceResult g_tr; +#define BUFFERSIZE 1023 +char g_buffer[BUFFERSIZE + 1]; + + void UTIL_SetSize(edict_t *pev, const Vector &vecMin, const Vector &vecMax) { SET_SIZE(ENT(pev), vecMin, vecMax); @@ -898,6 +902,13 @@ static cell AMX_NATIVE_CALL traceresult(AMX *amx, cell *params) return 0; } +// (jghg) +static cell AMX_NATIVE_CALL get_string(AMX *amx, cell *params) // (string, returnstring[], length) +{ + snprintf(g_buffer, BUFFERSIZE, "%s", STRING(params[1])); + return MF_SetAmxString(amx, params[2], g_buffer, params[3]); +} + AMX_NATIVE_INFO engine_Natives[] = { {"halflife_time", halflife_time}, @@ -938,6 +949,8 @@ AMX_NATIVE_INFO engine_Natives[] = { {"register_think", register_think}, {"register_touch", register_touch}, + {"get_string", get_string}, + {NULL, NULL}, /////////////////// }; diff --git a/plugins/include/engine.inc b/plugins/include/engine.inc index af7d264c..2f4670ef 100755 --- a/plugins/include/engine.inc +++ b/plugins/include/engine.inc @@ -222,6 +222,10 @@ native get_usercmd(type,{Float,Sql,Result,_}:...); Note that your changes will be seen by any other plugin doing get_usercmd() */ native set_usercmd(type,{Float,Sql,Result,_}:...); +/* Converts a string offset into a real string. Some of the forwards in fakemeta + uses string offsets. (FM_CreateNamedEntity) */ +native get_string(_string, _returnString[], _len); + /* FORWARDS **********/