test fix for bug am44973 (knife headshots)

This commit is contained in:
David Anderson 2006-09-22 03:47:04 +00:00
parent 3720810b61
commit 020b3a5963
6 changed files with 71 additions and 22 deletions

View File

@ -11,6 +11,7 @@
#define CSW_HEGRENADE 4 #define CSW_HEGRENADE 4
#define CSW_C4 6 #define CSW_C4 6
#define CSW_SMOKEGRENADE 9 #define CSW_SMOKEGRENADE 9
#define CSW_KNIFE 29
#define CSW_FLASHBANG 25 #define CSW_FLASHBANG 25
// ***************************************************** // *****************************************************

View File

@ -2773,7 +2773,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_FindLibrary(NULL, LibType_Class); MF_FindLibrary(NULL, LibType_Class);
MF_AddLibraries(NULL, LibType_Class, NULL); MF_AddLibraries(NULL, LibType_Class, NULL);
MF_RemoveLibraries(NULL); MF_RemoveLibraries(NULL);
MF_OverrideNatives(NULL); MF_OverrideNatives(NULL, "");
} }
#endif #endif

View File

@ -43,7 +43,6 @@ int gmsgResetHUD;
int gmsgAmmoX; int gmsgAmmoX;
int gmsgScoreInfo; int gmsgScoreInfo;
int gmsgAmmoPickup; int gmsgAmmoPickup;
int gmsgSendAudio; int gmsgSendAudio;
int gmsgTextMsg; int gmsgTextMsg;
int gmsgBarTime; int gmsgBarTime;
@ -62,7 +61,8 @@ cvar_t* csstats_pause;
cvar_t init_csstats_rankbots ={"csstats_rankbots","1"}; cvar_t init_csstats_rankbots ={"csstats_rankbots","1"};
cvar_t init_csstats_pause = {"csstats_pause","0"}; cvar_t init_csstats_pause = {"csstats_pause","0"};
struct sUserMsg { struct sUserMsg
{
const char* name; const char* name;
int* id; int* id;
funEventCall func; funEventCall func;
@ -76,10 +76,10 @@ struct sUserMsg {
{"AmmoX", &gmsgAmmoX, Client_AmmoX, false}, {"AmmoX", &gmsgAmmoX, Client_AmmoX, false},
{"ScoreInfo", &gmsgScoreInfo, Client_ScoreInfo, false}, {"ScoreInfo", &gmsgScoreInfo, Client_ScoreInfo, false},
{"AmmoPickup", &gmsgAmmoPickup, Client_AmmoPickup, false}, {"AmmoPickup", &gmsgAmmoPickup, Client_AmmoPickup, false},
{"SendAudio", &gmsgSendAudio, Client_SendAudio, false}, {"SendAudio", &gmsgSendAudio, Client_SendAudio, false},
{"TextMsg", &gmsgTextMsg, Client_TextMsg, false}, {"TextMsg", &gmsgTextMsg, Client_TextMsg, false},
{"BarTime", &gmsgBarTime, Client_BarTime, false}, {"BarTime", &gmsgBarTime, Client_BarTime, false},
{"DeathMsg", &gmsgDeathMsg, Client_DeathMsg, false},
{0, 0, 0, false} {0, 0, 0, false}
}; };
@ -330,10 +330,20 @@ void EmitSound_Post(edict_t *entity, int channel, const char *sample, /*int*/flo
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *e, TraceResult *ptr) { void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *e, TraceResult *ptr)
if (ptr->pHit&&(ptr->pHit->v.flags& (FL_CLIENT | FL_FAKECLIENT) )&& {
e&&(e->v.flags& (FL_CLIENT | FL_FAKECLIENT) )&&ptr->iHitgroup) if (ptr->pHit && (ptr->pHit->v.flags & (FL_CLIENT|FL_FAKECLIENT))
GET_PLAYER_POINTER(e)->aiming = ptr->iHitgroup; && e
&& (e->v.flags & (FL_CLIENT|FL_FAKECLIENT))
&& ptr->iHitgroup)
{
CPlayer *pPlayer = GET_PLAYER_POINTER(e);
if (pPlayer->current != CSW_KNIFE)
{
pPlayer->aiming = ptr->iHitgroup;
}
}
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }

View File

@ -88,10 +88,10 @@ void Client_AmmoPickup(void*);
void Client_Damage_End(void*); void Client_Damage_End(void*);
void Client_ScoreInfo(void*); void Client_ScoreInfo(void*);
void Client_ResetHUD(void*); void Client_ResetHUD(void*);
void Client_SendAudio(void*); void Client_SendAudio(void*);
void Client_TextMsg(void*); void Client_TextMsg(void*);
void Client_BarTime(void*); void Client_BarTime(void*);
void Client_DeathMsg(void*);
bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL ); bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL );
bool isModuleActive(); bool isModuleActive();

View File

@ -17,6 +17,44 @@ void Client_ResetHUD(void* mValue){
} }
} }
void Client_DeathMsg(void *mValue)
{
static int killer_id;
static int victim_id;
static int is_headshot;
const char *name;
switch (mState++)
{
case 0:
{
killer_id = *(int *)mValue;
break;
}
case 1:
{
victim_id = *(int *)mValue;
break;
}
case 2:
{
is_headshot = *(int *)mValue;
break;
}
case 3:
{
name = (const char *)mValue;
if (killer_id
&& (strcmp(name, "knife") == 0))
{
CPlayer *pPlayer = GET_PLAYER_POINTER_I(killer_id);
pPlayer->aiming = is_headshot ? 1 : 0;
}
break;
}
}
}
void Client_WeaponList(void* mValue){ void Client_WeaponList(void* mValue){
static int wpnList; static int wpnList;
static int iSlot; static int iSlot;