- fixed: Hexen's melee weapons were missing some NULL pointer checks in the code that determines whether they hit something or not.

SVN r2415 (trunk)
This commit is contained in:
Christoph Oelckers 2010-07-08 21:16:01 +00:00
parent ea04d2bbdf
commit 5bb4ca5bc6
4 changed files with 56 additions and 36 deletions

View file

@ -37,20 +37,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
if (linetarget) if (linetarget)
{ {
P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true, &linetarget); P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true, &linetarget);
AdjustPlayerAngle (player->mo, linetarget); if (linetarget != NULL)
// player->mo->angle = R_PointToAngle2(player->mo->x, {
// player->mo->y, linetarget->x, linetarget->y); AdjustPlayerAngle (player->mo, linetarget);
goto macedone; goto macedone;
}
} }
angle = player->mo->angle-i*(ANG45/16); angle = player->mo->angle-i*(ANG45/16);
slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE, &linetarget); slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE, &linetarget);
if (linetarget) if (linetarget)
{ {
P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true, &linetarget); P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true, &linetarget);
AdjustPlayerAngle (player->mo, linetarget); if (linetarget != NULL)
// player->mo->angle = R_PointToAngle2(player->mo->x, {
// player->mo->y, linetarget->x, linetarget->y); AdjustPlayerAngle (player->mo, linetarget);
goto macedone; goto macedone;
}
} }
} }
// didn't find any creatures, so try to strike any walls // didn't find any creatures, so try to strike any walls

View file

@ -226,26 +226,32 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
if (linetarget) if (linetarget)
{ {
P_LineAttack (pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); P_LineAttack (pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) if (linetarget != NULL)
{ {
P_ThrustMobj (linetarget, angle, power); if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{
P_ThrustMobj (linetarget, angle, power);
}
AdjustPlayerAngle (pmo, linetarget);
useMana++;
goto axedone;
} }
AdjustPlayerAngle (pmo, linetarget);
useMana++;
goto axedone;
} }
angle = pmo->angle-i*(ANG45/16); angle = pmo->angle-i*(ANG45/16);
slope = P_AimLineAttack (pmo, angle, AXERANGE, &linetarget); slope = P_AimLineAttack (pmo, angle, AXERANGE, &linetarget);
if (linetarget) if (linetarget)
{ {
P_LineAttack (pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); P_LineAttack (pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget);
if (linetarget->flags3&MF3_ISMONSTER) if (linetarget != NULL)
{ {
P_ThrustMobj (linetarget, angle, power); if (linetarget->flags3&MF3_ISMONSTER)
{
P_ThrustMobj (linetarget, angle, power);
}
AdjustPlayerAngle (pmo, linetarget);
useMana++;
goto axedone;
} }
AdjustPlayerAngle (pmo, linetarget);
useMana++;
goto axedone;
} }
} }
// didn't find any creatures, so try to strike any walls // didn't find any creatures, so try to strike any walls

View file

@ -50,26 +50,32 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
if (linetarget) if (linetarget)
{ {
P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true, &linetarget); P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true, &linetarget);
AdjustPlayerAngle(pmo, linetarget); if (linetarget != NULL)
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{ {
P_ThrustMobj (linetarget, angle, power); AdjustPlayerAngle(pmo, linetarget);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{
P_ThrustMobj (linetarget, angle, power);
}
pmo->special1 = false; // Don't throw a hammer
goto hammerdone;
} }
pmo->special1 = false; // Don't throw a hammer
goto hammerdone;
} }
angle = pmo->angle-i*(ANG45/32); angle = pmo->angle-i*(ANG45/32);
slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &linetarget, 0, ALF_CHECK3D); slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &linetarget, 0, ALF_CHECK3D);
if(linetarget) if(linetarget)
{ {
P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true, &linetarget); P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true, &linetarget);
AdjustPlayerAngle(pmo, linetarget); if (linetarget != NULL)
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{ {
P_ThrustMobj(linetarget, angle, power); AdjustPlayerAngle(pmo, linetarget);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{
P_ThrustMobj(linetarget, angle, power);
}
pmo->special1 = false; // Don't throw a hammer
goto hammerdone;
} }
pmo->special1 = false; // Don't throw a hammer
goto hammerdone;
} }
} }
// didn't find any targets in meleerange, so set to throw out a hammer // didn't find any targets in meleerange, so set to throw out a hammer

View file

@ -166,12 +166,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
pufftype = PClass::FindClass ("HammerPuff"); pufftype = PClass::FindClass ("HammerPuff");
} }
P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) if (linetarget != NULL)
{ {
P_ThrustMobj (linetarget, angle, power); if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{
P_ThrustMobj (linetarget, angle, power);
}
AdjustPlayerAngle (pmo, linetarget);
goto punchdone;
} }
AdjustPlayerAngle (pmo, linetarget);
goto punchdone;
} }
angle = pmo->angle-i * (ANG45/16); angle = pmo->angle-i * (ANG45/16);
slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &linetarget); slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &linetarget);
@ -185,12 +188,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
pufftype = PClass::FindClass ("HammerPuff"); pufftype = PClass::FindClass ("HammerPuff");
} }
P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) if (linetarget != NULL)
{ {
P_ThrustMobj (linetarget, angle, power); if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{
P_ThrustMobj (linetarget, angle, power);
}
AdjustPlayerAngle (pmo, linetarget);
goto punchdone;
} }
AdjustPlayerAngle (pmo, linetarget);
goto punchdone;
} }
} }
// didn't find any creatures, so try to strike any walls // didn't find any creatures, so try to strike any walls