by Edward-san » Mon May 14, 2012 3:41 pm
OT: new patch related to previous post:
Code: Select all
Index: src/g_hexen/a_fighterplayer.cpp
===================================================================
--- src/g_hexen/a_fighterplayer.cpp (revision 3651)
+++ src/g_hexen/a_fighterplayer.cpp (working copy)
@@ -61,10 +61,11 @@
int damage;
int slope;
fixed_t power;
- int i;
+ int i,j;
player_t *player;
const PClass *pufftype;
AActor *linetarget;
+ bool punchdone;
if (NULL == (player = self->player))
{
@@ -75,9 +76,12 @@
damage = 40+(pr_fpatk()&15);
power = 2*FRACUNIT;
pufftype = PClass::FindClass ("PunchPuff");
+ punchdone = false;
for (i = 0; i < 16; i++)
{
- angle = pmo->angle + i*(ANG45/16);
+ for (j = 1; j >= -1; j -= 2)
+ {
+ angle = pmo->angle + i*j*(ANG45/16);
slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &linetarget);
if (linetarget)
{
@@ -96,40 +100,24 @@
P_ThrustMobj (linetarget, angle, power);
}
AdjustPlayerAngle (pmo, linetarget);
- goto punchdone;
+ punchdone = true;
+ break;
}
}
- angle = pmo->angle-i * (ANG45/16);
- slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &linetarget);
- if (linetarget)
- {
- pmo->special1++;
- if (pmo->special1 == 3)
- {
- damage <<= 1;
- power = 6*FRACUNIT;
- pufftype = PClass::FindClass ("HammerPuff");
- }
- P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget);
- if (linetarget != NULL)
- {
- if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
- {
- P_ThrustMobj (linetarget, angle, power);
- }
- AdjustPlayerAngle (pmo, linetarget);
- goto punchdone;
- }
- }
}
+ if (punchdone)
+ break;
+ }
+ if (!punchdone)
+ {
// didn't find any creatures, so try to strike any walls
pmo->special1 = 0;
angle = pmo->angle;
slope = P_AimLineAttack (pmo, angle, MELEERANGE, &linetarget);
P_LineAttack (pmo, angle, MELEERANGE, slope, damage, NAME_Melee, pufftype, true);
+ }
-punchdone:
if (pmo->special1 == 3)
{
pmo->special1 = 0;
should remove the 'goto' hax and fixed the missing declaration of 'i'.
OT: new patch related to previous post:
[code]
Index: src/g_hexen/a_fighterplayer.cpp
===================================================================
--- src/g_hexen/a_fighterplayer.cpp (revision 3651)
+++ src/g_hexen/a_fighterplayer.cpp (working copy)
@@ -61,10 +61,11 @@
int damage;
int slope;
fixed_t power;
- int i;
+ int i,j;
player_t *player;
const PClass *pufftype;
AActor *linetarget;
+ bool punchdone;
if (NULL == (player = self->player))
{
@@ -75,9 +76,12 @@
damage = 40+(pr_fpatk()&15);
power = 2*FRACUNIT;
pufftype = PClass::FindClass ("PunchPuff");
+ punchdone = false;
for (i = 0; i < 16; i++)
{
- angle = pmo->angle + i*(ANG45/16);
+ for (j = 1; j >= -1; j -= 2)
+ {
+ angle = pmo->angle + i*j*(ANG45/16);
slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &linetarget);
if (linetarget)
{
@@ -96,40 +100,24 @@
P_ThrustMobj (linetarget, angle, power);
}
AdjustPlayerAngle (pmo, linetarget);
- goto punchdone;
+ punchdone = true;
+ break;
}
}
- angle = pmo->angle-i * (ANG45/16);
- slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &linetarget);
- if (linetarget)
- {
- pmo->special1++;
- if (pmo->special1 == 3)
- {
- damage <<= 1;
- power = 6*FRACUNIT;
- pufftype = PClass::FindClass ("HammerPuff");
- }
- P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget);
- if (linetarget != NULL)
- {
- if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
- {
- P_ThrustMobj (linetarget, angle, power);
- }
- AdjustPlayerAngle (pmo, linetarget);
- goto punchdone;
- }
- }
}
+ if (punchdone)
+ break;
+ }
+ if (!punchdone)
+ {
// didn't find any creatures, so try to strike any walls
pmo->special1 = 0;
angle = pmo->angle;
slope = P_AimLineAttack (pmo, angle, MELEERANGE, &linetarget);
P_LineAttack (pmo, angle, MELEERANGE, slope, damage, NAME_Melee, pufftype, true);
+ }
-punchdone:
if (pmo->special1 == 3)
{
pmo->special1 = 0;
[/code]
should remove the 'goto' hax and fixed the missing declaration of 'i'.