mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
Fixed: A_CStaffCheck needed more NULL pointer checks
This commit is contained in:
parent
2827c13d0c
commit
19ab774dc8
1 changed files with 28 additions and 21 deletions
|
@ -71,22 +71,24 @@ 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->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0))|| linetarget->flags3&MF3_ISMONSTER)
|
||||
&& (!(linetarget->flags2&(MF2_DORMANT+MF2_INVULNERABLE))))
|
||||
if (linetarget != NULL)
|
||||
{
|
||||
newLife = player->health+(damage>>3);
|
||||
newLife = newLife > max ? max : newLife;
|
||||
if (newLife > player->health)
|
||||
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))))
|
||||
{
|
||||
pmo->health = player->health = newLife;
|
||||
newLife = player->health+(damage>>3);
|
||||
newLife = newLife > max ? max : newLife;
|
||||
if (newLife > player->health)
|
||||
{
|
||||
pmo->health = player->health = newLife;
|
||||
}
|
||||
P_SetPsprite (player, ps_weapon, weapon->FindState ("Drain"));
|
||||
}
|
||||
if (weapon != NULL)
|
||||
{
|
||||
weapon->DepleteAmmo (weapon->bAltFire, false);
|
||||
}
|
||||
P_SetPsprite (player, ps_weapon, weapon->FindState ("Drain"));
|
||||
}
|
||||
if (weapon != NULL)
|
||||
{
|
||||
weapon->DepleteAmmo (weapon->bAltFire, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -95,16 +97,21 @@ 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->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER)
|
||||
if (linetarget != NULL)
|
||||
{
|
||||
newLife = player->health+(damage>>4);
|
||||
newLife = newLife > max ? max : newLife;
|
||||
pmo->health = player->health = newLife;
|
||||
P_SetPsprite (player, ps_weapon, weapon->FindState ("Drain"));
|
||||
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);
|
||||
newLife = newLife > max ? max : newLife;
|
||||
pmo->health = player->health = newLife;
|
||||
P_SetPsprite (player, ps_weapon, weapon->FindState ("Drain"));
|
||||
}
|
||||
if (weapon != NULL)
|
||||
{
|
||||
weapon->DepleteAmmo (weapon->bAltFire, false);
|
||||
}
|
||||
}
|
||||
weapon->DepleteAmmo (weapon->bAltFire, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue