From 8f18856e912b4632e124fe35e8ca6a7b76b2cd9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Wed, 27 Oct 2004 19:06:43 +0000 Subject: [PATCH] Fixed SetView (by always hooking Spawn and precaching the needed dummy model rpgrocket.mdl) --- dlls/engine/amxxapi.cpp | 4 ++-- dlls/engine/forwards.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/engine/amxxapi.cpp b/dlls/engine/amxxapi.cpp index 6d273768..1f260272 100755 --- a/dlls/engine/amxxapi.cpp +++ b/dlls/engine/amxxapi.cpp @@ -90,8 +90,8 @@ void OnPluginsLoaded() g_pFunctionTable->pfnPlayerPostThink=PlayerPostThink_Post; g_pFunctionTable->pfnSpawn=NULL; // "pfn_spawn" - if (CheckForPublic("pfn_spawn")) - g_pFunctionTable->pfnSpawn=Spawn; + //if (CheckForPublic("pfn_spawn")) // JGHG: I commented this if out because we always need the Spawn to precache the rocket mdl used with SetView native + g_pFunctionTable->pfnSpawn=Spawn; g_pFunctionTable->pfnClientKill=NULL; // "client_kill" if (CheckForPublic("client_kill")) diff --git a/dlls/engine/forwards.cpp b/dlls/engine/forwards.cpp index cc3f9e31..d58294f3 100755 --- a/dlls/engine/forwards.cpp +++ b/dlls/engine/forwards.cpp @@ -20,6 +20,7 @@ CVector Thinks; CVector Touches; KeyValueData *g_pkvd; bool g_inKeyValue=false; +bool g_precachedStuff = false; int fstrcmp(const char *s1, const char *s2) { @@ -37,6 +38,11 @@ int fstrcmp(const char *s1, const char *s2) } int Spawn(edict_t *pEntity) { + if (!g_precachedStuff) { + // Used for SetView, added by JGHG + int returnValue = PRECACHE_MODEL("models/rpgrocket.mdl"); + g_precachedStuff = true; + } if (SpawnForward != -1) { int retVal = 0; int id = ENTINDEX(pEntity);