- 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,22 +37,24 @@ 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);
if (linetarget != NULL)
{
AdjustPlayerAngle (player->mo, linetarget); AdjustPlayerAngle (player->mo, linetarget);
// player->mo->angle = R_PointToAngle2(player->mo->x,
// player->mo->y, linetarget->x, linetarget->y);
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);
if (linetarget != NULL)
{
AdjustPlayerAngle (player->mo, linetarget); AdjustPlayerAngle (player->mo, linetarget);
// player->mo->angle = R_PointToAngle2(player->mo->x,
// player->mo->y, linetarget->x, linetarget->y);
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
player->mo->special1 = 0; player->mo->special1 = 0;

View file

@ -226,6 +226,8 @@ 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 != NULL)
{
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{ {
P_ThrustMobj (linetarget, angle, power); P_ThrustMobj (linetarget, angle, power);
@ -234,11 +236,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
useMana++; useMana++;
goto axedone; 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 != NULL)
{
if (linetarget->flags3&MF3_ISMONSTER) if (linetarget->flags3&MF3_ISMONSTER)
{ {
P_ThrustMobj (linetarget, angle, power); P_ThrustMobj (linetarget, angle, power);
@ -248,6 +253,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
goto axedone; goto axedone;
} }
} }
}
// didn't find any creatures, so try to strike any walls // didn't find any creatures, so try to strike any walls
pmo->special1 = 0; pmo->special1 = 0;

View file

@ -50,6 +50,8 @@ 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);
if (linetarget != NULL)
{
AdjustPlayerAngle(pmo, linetarget); AdjustPlayerAngle(pmo, linetarget);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{ {
@ -58,11 +60,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
pmo->special1 = false; // Don't throw a hammer pmo->special1 = false; // Don't throw a hammer
goto hammerdone; 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);
if (linetarget != NULL)
{
AdjustPlayerAngle(pmo, linetarget); AdjustPlayerAngle(pmo, linetarget);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{ {
@ -72,6 +77,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
goto hammerdone; 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
angle = pmo->angle; angle = pmo->angle;
slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &linetarget, 0, ALF_CHECK3D); slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &linetarget, 0, ALF_CHECK3D);

View file

@ -166,6 +166,8 @@ 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 != NULL)
{
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{ {
P_ThrustMobj (linetarget, angle, power); P_ThrustMobj (linetarget, angle, power);
@ -173,6 +175,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
AdjustPlayerAngle (pmo, linetarget); AdjustPlayerAngle (pmo, linetarget);
goto punchdone; 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);
if (linetarget) if (linetarget)
@ -185,6 +188,8 @@ 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 != NULL)
{
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{ {
P_ThrustMobj (linetarget, angle, power); P_ThrustMobj (linetarget, angle, power);
@ -193,6 +198,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
goto punchdone; goto punchdone;
} }
} }
}
// didn't find any creatures, so try to strike any walls // didn't find any creatures, so try to strike any walls
pmo->special1 = 0; pmo->special1 = 0;