Remove knife critical stuff and previous "fix" (bug 3791, r=pred)

This commit is contained in:
Fyren 2009-04-22 19:06:19 -07:00
parent d9f5801a68
commit 5096aef6e7
2 changed files with 2 additions and 42 deletions

View File

@ -35,7 +35,6 @@ IServerGameEnts *gameents = NULL;
CDetour *calcIsAttackCriticalDetour = NULL; CDetour *calcIsAttackCriticalDetour = NULL;
CDetour *calcIsAttackCriticalMeleeDetour = NULL; CDetour *calcIsAttackCriticalMeleeDetour = NULL;
CDetour *calcIsAttackCriticalKnifeDetour = NULL;
IForward *g_critForward = NULL; IForward *g_critForward = NULL;
@ -103,12 +102,6 @@ DetourResult DetourCallback(CBaseEntity *pEnt)
return Result_Ignore; return Result_Ignore;
} }
const char *cls = pEdict->GetClassName();
if (strcmp(cls, "tf_weapon_medigun") == 0)
{
return Result_Ignore;
}
int returnValue=0; int returnValue=0;
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEnt + info.actual_offset); CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEnt + info.actual_offset);
@ -116,7 +109,7 @@ DetourResult DetourCallback(CBaseEntity *pEnt)
g_critForward->PushCell(index); //Client index g_critForward->PushCell(index); //Client index
g_critForward->PushCell(engine->IndexOfEdict(pEdict)); // Weapon index g_critForward->PushCell(engine->IndexOfEdict(pEdict)); // Weapon index
g_critForward->PushString(cls); //Weapon classname g_critForward->PushString(pEdict->GetClassName()); //Weapon classname
g_critForward->PushCellByRef(&returnValue); //return value g_critForward->PushCellByRef(&returnValue); //return value
cell_t result = 0; cell_t result = 0;
@ -158,24 +151,6 @@ DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelperMelee, bool)
} }
} }
DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelperKnife, bool)
{
DetourResult result = DetourCallback((CBaseEntity *)this);
if (result == Result_Ignore)
{
return DETOUR_MEMBER_CALL(CalcIsAttackCriticalHelperKnife)();
}
else if (result == Result_NoCrit)
{
return 0;
}
else
{
return 1;
}
}
DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelper, bool) DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelper, bool)
{ {
DetourResult result = DetourCallback((CBaseEntity *)this); DetourResult result = DetourCallback((CBaseEntity *)this);
@ -198,7 +173,6 @@ void InitialiseDetours()
{ {
calcIsAttackCriticalDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelper, "CalcCritical"); calcIsAttackCriticalDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelper, "CalcCritical");
calcIsAttackCriticalMeleeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelperMelee, "CalcCriticalMelee"); calcIsAttackCriticalMeleeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelperMelee, "CalcCriticalMelee");
calcIsAttackCriticalKnifeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelperKnife, "CalcCriticalKnife");
bool HookCreated = false; bool HookCreated = false;
@ -214,12 +188,6 @@ void InitialiseDetours()
HookCreated = true; HookCreated = true;
} }
if (calcIsAttackCriticalKnifeDetour != NULL)
{
calcIsAttackCriticalKnifeDetour->EnableDetour();
HookCreated = true;
}
if (!HookCreated) if (!HookCreated)
{ {
g_pSM->LogError(myself, "No critical hit forwards could be initialized - Disabled critical hit hooks"); g_pSM->LogError(myself, "No critical hit forwards could be initialized - Disabled critical hit hooks");
@ -232,5 +200,4 @@ void RemoveDetours()
{ {
calcIsAttackCriticalDetour->Destroy(); calcIsAttackCriticalDetour->Destroy();
calcIsAttackCriticalMeleeDetour->Destroy(); calcIsAttackCriticalMeleeDetour->Destroy();
calcIsAttackCriticalKnifeDetour->Destroy();
} }

View File

@ -34,13 +34,6 @@
"linux" "@_ZN18CTFWeaponBaseMelee26CalcIsAttackCriticalHelperEv" "linux" "@_ZN18CTFWeaponBaseMelee26CalcIsAttackCriticalHelperEv"
"windows" "\x83\xEC\x08\x53\x57\x8B\xF9\xE8\x2A\x2A\x2A\x2A\x8B\xD8" "windows" "\x83\xEC\x08\x53\x57\x8B\xF9\xE8\x2A\x2A\x2A\x2A\x8B\xD8"
} }
"CalcCriticalKnife"
{
"library" "server"
"linux" "@_ZN8CTFKnife26CalcIsAttackCriticalHelperEv"
"windows" "\x8B\x81\xF0\x13\x00\x00\x83\xF8\xFF\x74\x29\x8B\x15"
}
} }
"Offsets" "Offsets"
{ {
@ -51,4 +44,4 @@
} }
} }
} }
} }