diff --git a/src/g_hexen/a_clericmace.cpp b/src/g_hexen/a_clericmace.cpp index ecd28da4f3..c9b2e4f8de 100644 --- a/src/g_hexen/a_clericmace.cpp +++ b/src/g_hexen/a_clericmace.cpp @@ -36,26 +36,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack) damage = 25+(pr_maceatk()&15); for (i = 0; i < 16; i++) { - angle = player->mo->angle+i*(ANG45/16); - slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE, &linetarget); - if (linetarget) + for (int j = 1; j >= -1; j -= 2) { - P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, hammertime, true, &linetarget); - if (linetarget != NULL) + angle = player->mo->angle + j*i*(ANG45 / 16); + slope = P_AimLineAttack(player->mo, angle, 2 * MELEERANGE, &linetarget); + if (linetarget) { - AdjustPlayerAngle (player->mo, linetarget); - goto macedone; - } - } - angle = player->mo->angle-i*(ANG45/16); - slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE, &linetarget); - if (linetarget) - { - P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, hammertime, true, &linetarget); - if (linetarget != NULL) - { - AdjustPlayerAngle (player->mo, linetarget); - goto macedone; + P_LineAttack(player->mo, angle, 2 * MELEERANGE, slope, damage, NAME_Melee, hammertime, true, &linetarget); + if (linetarget != NULL) + { + AdjustPlayerAngle(player->mo, linetarget); + goto macedone; + } } } } diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index 1653e5ebc8..457a54738b 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -70,60 +70,38 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck) puff = PClass::FindActor("CStaffPuff"); for (i = 0; i < 3; i++) { - angle = pmo->angle + i*(ANG45 / 16); - slope = P_AimLineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D); - if (linetarget) + for (int j = 1; j >= -1; j -= 2) { - P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget); - if (linetarget != NULL) + angle = pmo->angle + j*i*(ANG45 / 16); + slope = P_AimLineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D); + if (linetarget) { - pmo->angle = pmo->AngleTo(linetarget); - if (((linetarget->player && (!linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER) - && (!(linetarget->flags2&(MF2_DORMANT | MF2_INVULNERABLE)))) + P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget); + if (linetarget != NULL) { - newLife = player->health + (damage >> 3); - newLife = newLife > max ? max : newLife; - if (newLife > player->health) + pmo->angle = pmo->AngleTo(linetarget); + 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; + } + if (weapon != NULL) + { + FState * newstate = weapon->FindState("Drain"); + if (newstate != NULL) P_SetPsprite(player, ps_weapon, newstate); + } } if (weapon != NULL) { - FState * newstate = weapon->FindState("Drain"); - if (newstate != NULL) P_SetPsprite(player, ps_weapon, newstate); + weapon->DepleteAmmo(weapon->bAltFire, false); } } - if (weapon != NULL) - { - weapon->DepleteAmmo(weapon->bAltFire, false); - } + return 0; } - break; - } - angle = pmo->angle - i*(ANG45 / 16); - slope = P_AimLineAttack(player->mo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D); - if (linetarget) - { - P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget); - if (linetarget != NULL) - { - pmo->angle = pmo->AngleTo(linetarget); - if ((linetarget->player && (!linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER) - { - newLife = player->health + (damage >> 4); - 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); - } - } - break; } } return 0; diff --git a/src/g_hexen/a_fighteraxe.cpp b/src/g_hexen/a_fighteraxe.cpp index 575b8d8c13..047c02fc82 100644 --- a/src/g_hexen/a_fighteraxe.cpp +++ b/src/g_hexen/a_fighteraxe.cpp @@ -236,36 +236,23 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack) } for (i = 0; i < 16; i++) { - angle = pmo->angle+i*(ANG45/16); - slope = P_AimLineAttack (pmo, angle, AXERANGE, &linetarget); - if (linetarget) + for (int j = 1; j >= -1; j -= 2) { - P_LineAttack (pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); - if (linetarget != NULL) + angle = pmo->angle + j*i*(ANG45 / 16); + slope = P_AimLineAttack(pmo, angle, AXERANGE, &linetarget); + if (linetarget) { - if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) + P_LineAttack(pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); + 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); - slope = P_AimLineAttack (pmo, angle, AXERANGE, &linetarget); - if (linetarget) - { - P_LineAttack (pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); - if (linetarget != NULL) - { - if (linetarget->flags3&MF3_ISMONSTER) - { - P_ThrustMobj (linetarget, angle, power); - } - AdjustPlayerAngle (pmo, linetarget); - useMana++; - goto axedone; } } }