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)
|
if (linetarget)
|
||||||
{
|
{
|
||||||
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindClass ("CStaffPuff"), false, &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,
|
if (linetarget != NULL)
|
||||||
linetarget->x, linetarget->y);
|
|
||||||
if (((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0))|| linetarget->flags3&MF3_ISMONSTER)
|
|
||||||
&& (!(linetarget->flags2&(MF2_DORMANT+MF2_INVULNERABLE))))
|
|
||||||
{
|
{
|
||||||
newLife = player->health+(damage>>3);
|
pmo->angle = R_PointToAngle2 (pmo->x, pmo->y, linetarget->x, linetarget->y);
|
||||||
newLife = newLife > max ? max : newLife;
|
if (((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0))|| linetarget->flags3&MF3_ISMONSTER)
|
||||||
if (newLife > player->health)
|
&& (!(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;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -95,16 +97,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
|
||||||
if (linetarget)
|
if (linetarget)
|
||||||
{
|
{
|
||||||
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindClass ("CStaffPuff"), false, &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,
|
if (linetarget != NULL)
|
||||||
linetarget->x, linetarget->y);
|
|
||||||
if ((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER)
|
|
||||||
{
|
{
|
||||||
newLife = player->health+(damage>>4);
|
pmo->angle = R_PointToAngle2 (pmo->x, pmo->y, linetarget->x, linetarget->y);
|
||||||
newLife = newLife > max ? max : newLife;
|
if ((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER)
|
||||||
pmo->health = player->health = newLife;
|
{
|
||||||
P_SetPsprite (player, ps_weapon, weapon->FindState ("Drain"));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue