extensions/tf2/extension.cpp
changeset 2136 7e8bf503bc9e
parent 2123 1f9f3580bb9c
child 2289 44045ead61cd
     1.1 --- a/extensions/tf2/extension.cpp	Tue Jul 01 06:13:09 2008 +0000
     1.2 +++ b/extensions/tf2/extension.cpp	Tue Jul 01 09:04:00 2008 +0000
     1.3 @@ -35,6 +35,7 @@
     1.4  #include "iplayerinfo.h"
     1.5  #include "sm_trie_tpl.h"
     1.6  #include "criticals.h"
     1.7 +#include "CDetour/detours.h"
     1.8  
     1.9  /**
    1.10   * @file extension.cpp
    1.11 @@ -96,12 +97,14 @@
    1.12  		return false;
    1.13  	}
    1.14  
    1.15 +	CDetourManager::Init(g_pSM->GetScriptingEngine(), g_pGameConf);
    1.16 +
    1.17  	sharesys->AddNatives(myself, g_TFNatives);
    1.18  	sharesys->RegisterLibrary(myself, "tf2");
    1.19  
    1.20  	playerhelpers->RegisterCommandTargetProcessor(this);
    1.21  
    1.22 -	spengine = g_pSM->GetScriptingEngine();
    1.23 +	g_critForward = forwards->CreateForward("TF2_CalcIsAttackCritical", ET_Hook, 4, NULL, Param_Cell, Param_Cell, Param_String, Param_CellByRef);
    1.24  
    1.25  	g_pCVar = icvar;
    1.26  
    1.27 @@ -133,13 +136,17 @@
    1.28  	g_RegNatives.UnregisterAll();
    1.29  	gameconfs->CloseGameConfigFile(g_pGameConf);
    1.30  	playerhelpers->UnregisterCommandTargetProcessor(this);
    1.31 +
    1.32 +	forwards->ReleaseForward(g_critForward);
    1.33 +
    1.34 +	RemoveDetours();
    1.35  }
    1.36  
    1.37  void TF2Tools::SDK_OnAllLoaded()
    1.38  {
    1.39  	SM_GET_LATE_IFACE(BINTOOLS, g_pBinTools);
    1.40  
    1.41 -	g_CriticalHitManager.Init();
    1.42 +	InitialiseDetours();
    1.43  }
    1.44  
    1.45  bool TF2Tools::RegisterConCommandBase(ConCommandBase *pVar)