Fixed: A_CStaffCheck needed more NULL pointer checks

This commit is contained in:
Randy Heit 2015-02-20 20:17:15 -06:00
parent 2827c13d0c
commit 19ab774dc8

View file

@ -71,8 +71,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
if (linetarget)
{
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindClass ("CStaffPuff"), false, &linetarget);
pmo->angle = R_PointToAngle2 (pmo->x, pmo->y,
linetarget->x, linetarget->y);
if (linetarget != NULL)
{
pmo->angle = R_PointToAngle2 (pmo->x, pmo->y, linetarget->x, linetarget->y);
if (((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0))|| linetarget->flags3&MF3_ISMONSTER)
&& (!(linetarget->flags2&(MF2_DORMANT+MF2_INVULNERABLE))))
{
@ -88,6 +89,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
{
weapon->DepleteAmmo (weapon->bAltFire, false);
}
}
break;
}
angle = pmo->angle-i*(ANG45/16);
@ -95,8 +97,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
if (linetarget)
{
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindClass ("CStaffPuff"), false, &linetarget);
pmo->angle = R_PointToAngle2 (pmo->x, pmo->y,
linetarget->x, linetarget->y);
if (linetarget != NULL)
{
pmo->angle = R_PointToAngle2 (pmo->x, pmo->y, linetarget->x, linetarget->y);
if ((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER)
{
newLife = player->health+(damage>>4);
@ -104,7 +107,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
pmo->health = player->health = newLife;
P_SetPsprite (player, ps_weapon, weapon->FindState ("Drain"));
}
if (weapon != NULL)
{
weapon->DepleteAmmo (weapon->bAltFire, false);
}
}
break;
}
}