fixed the cursed bug of throwing knives

This commit is contained in:
David Anderson 2006-03-04 08:16:00 +00:00
parent 74cd310504
commit 943b902e23
2 changed files with 7 additions and 6 deletions

View File

@ -42,7 +42,7 @@
#ifndef __linux__ #ifndef __linux__
#define TSKNIFE_OFFSET 31 // owner offset in knife entity #define TSKNIFE_OFFSET 31 // owner offset in knife entity
#else #else
#define TSKNIFE_OFFSET 36 #define TSKNIFE_OFFSET 35
#endif #endif
#define TSPWUP_SLOWMO 1 #define TSPWUP_SLOWMO 1

View File

@ -102,6 +102,7 @@ void Client_ClipInfo(void* mValue)
void Client_TSHealth_End(void* mValue){ void Client_TSHealth_End(void* mValue){
edict_t *enemy = mPlayer->pEdict->v.dmg_inflictor; edict_t *enemy = mPlayer->pEdict->v.dmg_inflictor;
int damage = (int)mPlayer->pEdict->v.dmg_take; int damage = (int)mPlayer->pEdict->v.dmg_take;
if ( !damage || !enemy ) if ( !damage || !enemy )
return; return;
@ -129,14 +130,15 @@ void Client_TSHealth_End(void* mValue){
} }
} }
else if ( szCName[0] == 'k' ) { else if ( szCName[0] == 'k' ) {
int pOwner = *( (int*)enemy->pvPrivateData + gKnifeOffset ); edict_t *pOwner = (edict_t *)*( (int*)enemy->pvPrivateData + gKnifeOffset );
if ( FNullEnt( (edict_t*)pOwner) ) if ( FNullEnt( (edict_t*)pOwner) )
return; return;
pAttacker = GET_PLAYER_POINTER( (edict_t*)pOwner );
pAttacker = GET_PLAYER_POINTER( pOwner );
weapon = 37; // throwing knife weapon = 37; // throwing knife
aim = pAttacker->aiming; aim = pAttacker ? pAttacker->aiming : 0;
pAttacker->saveHit( mPlayer , weapon , damage, aim ); pAttacker->saveHit( mPlayer , weapon , damage, aim );
} }
} }
@ -171,7 +173,6 @@ void Client_TSHealth_End(void* mValue){
int killFlags = 0; int killFlags = 0;
if ( !TA && mPlayer!=pAttacker ) { if ( !TA && mPlayer!=pAttacker ) {
int sflags = pAttacker->pEdict->v.iuser4; int sflags = pAttacker->pEdict->v.iuser4;
int stuntKill = 0; int stuntKill = 0;
@ -287,4 +288,4 @@ void Client_PwUp(void* mValue)
mPlayer->PwUpValue = *(int*)mValue; mPlayer->PwUpValue = *(int*)mValue;
break; break;
} }
} }