2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "m_random.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "a_hexenglobal.h"
|
2008-08-10 20:48:55 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-04-10 14:38:43 +00:00
|
|
|
extern void AdjustPlayerAngle (AActor *pmo, AActor *linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-15 14:11:05 +00:00
|
|
|
static FRandom pr_maceatk ("CMaceAttack");
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_CMaceAttack
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
PARAM_ACTION_PROLOGUE;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
angle_t angle;
|
|
|
|
int damage;
|
|
|
|
int slope;
|
|
|
|
int i;
|
|
|
|
player_t *player;
|
2008-04-10 14:38:43 +00:00
|
|
|
AActor *linetarget;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (NULL == (player = self->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2010-09-16 03:14:32 +00:00
|
|
|
PClassActor *hammertime = PClass::FindActor("HammerPuff");
|
|
|
|
|
2008-09-15 14:11:05 +00:00
|
|
|
damage = 25+(pr_maceatk()&15);
|
2006-02-24 04:48:15 +00:00
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
{
|
2016-02-28 15:06:48 +00:00
|
|
|
for (int j = 1; j >= -1; j -= 2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2016-02-28 15:06:48 +00:00
|
|
|
angle = player->mo->angle + j*i*(ANG45 / 16);
|
|
|
|
slope = P_AimLineAttack(player->mo, angle, 2 * MELEERANGE, &linetarget);
|
|
|
|
if (linetarget)
|
2010-07-08 21:16:01 +00:00
|
|
|
{
|
2016-02-28 15:06:48 +00:00
|
|
|
P_LineAttack(player->mo, angle, 2 * MELEERANGE, slope, damage, NAME_Melee, hammertime, true, &linetarget);
|
|
|
|
if (linetarget != NULL)
|
|
|
|
{
|
|
|
|
AdjustPlayerAngle(player->mo, linetarget);
|
|
|
|
goto macedone;
|
|
|
|
}
|
2010-07-08 21:16:01 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// didn't find any creatures, so try to strike any walls
|
2014-09-13 10:38:16 +00:00
|
|
|
player->mo->weaponspecial = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
angle = player->mo->angle;
|
2008-04-10 14:38:43 +00:00
|
|
|
slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget);
|
2010-09-16 03:14:32 +00:00
|
|
|
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, hammertime);
|
2006-02-24 04:48:15 +00:00
|
|
|
macedone:
|
2010-02-12 06:04:57 +00:00
|
|
|
return 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|