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
|
|
|
{
|
|
|
|
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
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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++)
|
|
|
|
{
|
|
|
|
angle = player->mo->angle+i*(ANG45/16);
|
2008-04-10 14:38:43 +00:00
|
|
|
slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE, &linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (linetarget)
|
|
|
|
{
|
2008-08-08 07:40:41 +00:00
|
|
|
P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true);
|
2008-04-10 14:38:43 +00:00
|
|
|
AdjustPlayerAngle (player->mo, linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
// player->mo->angle = R_PointToAngle2(player->mo->x,
|
|
|
|
// player->mo->y, linetarget->x, linetarget->y);
|
|
|
|
goto macedone;
|
|
|
|
}
|
|
|
|
angle = player->mo->angle-i*(ANG45/16);
|
2008-04-10 14:38:43 +00:00
|
|
|
slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE, &linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (linetarget)
|
|
|
|
{
|
2008-08-08 07:40:41 +00:00
|
|
|
P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true);
|
2008-04-10 14:38:43 +00:00
|
|
|
AdjustPlayerAngle (player->mo, linetarget);
|
2006-02-24 04:48:15 +00:00
|
|
|
// player->mo->angle = R_PointToAngle2(player->mo->x,
|
|
|
|
// player->mo->y, linetarget->x, linetarget->y);
|
|
|
|
goto macedone;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// didn't find any creatures, so try to strike any walls
|
|
|
|
player->mo->special1 = 0;
|
|
|
|
|
|
|
|
angle = player->mo->angle;
|
2008-04-10 14:38:43 +00:00
|
|
|
slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget);
|
2008-08-08 07:40:41 +00:00
|
|
|
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"));
|
2006-02-24 04:48:15 +00:00
|
|
|
macedone:
|
|
|
|
return;
|
|
|
|
}
|