Exemplo n.º 1
0
DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
{
	angle_t angle;
	int damage;
	int slope;
	int i;
	player_t *player;
	AActor *linetarget;

	if (NULL == (player = self->player))
	{
		return;
	}

	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)
		{
			P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true, &linetarget);
			if (linetarget != NULL)
			{
				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, PClass::FindClass ("HammerPuff"), true, &linetarget);
			if (linetarget != NULL)
			{
				AdjustPlayerAngle (player->mo, linetarget);
				goto macedone;
			}
		}
	}
	// didn't find any creatures, so try to strike any walls
	player->mo->special1 = 0;

	angle = player->mo->angle;
	slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget);
	P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"));
macedone:
	return;		
}
Exemplo n.º 2
0
void C_DECL A_Punch(player_t *player, pspdef_t *psp)
{
    angle_t angle;
    int damage;
    float slope;

    P_ShotAmmo(player);
    player->update |= PSF_AMMO;

    if(IS_CLIENT) return;

    damage = (P_Random() % 10 + 1) * 2;
    if(player->powers[PT_STRENGTH])
        damage *= 10;

    angle = player->plr->mo->angle;
    angle += (P_Random() - P_Random()) << 18;
    slope = P_AimLineAttack(player->plr->mo, angle, PLRMELEERANGE);
    P_LineAttack(player->plr->mo, angle, PLRMELEERANGE, slope, damage, MT_PUFF);

    // Turn to face target.
    if(lineTarget)
    {
        S_StartSound(SFX_PUNCH, player->plr->mo);

        player->plr->mo->angle = M_PointToAngle2(player->plr->mo->origin, lineTarget->origin);
        player->plr->flags |= DDPF_FIXANGLES;
    }
}
Exemplo n.º 3
0
DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL2)
{
	angle_t angle;
	int damage;
	int slope;
	player_t *player;
	AActor *linetarget;

	if (NULL == (player = self->player))
	{
		return;
	}

	damage = pr_beakatkpl2.HitDice (4);
	angle = player->mo->angle;
	slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget);
	P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &linetarget);
	if (linetarget)
	{
		player->mo->angle = player->mo->AngleTo(linetarget);
	}
	P_PlayPeck (player->mo);
	player->chickenPeck = 12;
	player->psprites[ps_weapon].tics -= pr_beakatkpl2()&3;
}
Exemplo n.º 4
0
DEFINE_ACTION_FUNCTION(AActor, A_TemplarAttack)
{
	int damage;
	angle_t angle;
	int pitch;
	int pitchdiff;

	if (self->target == NULL)
		return;

	S_Sound (self, CHAN_WEAPON, "templar/shoot", 1, ATTN_NORM);

	// [CW] Tell clients to play the sound.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_SoundActor( self, CHAN_WEAPON, "templar/shoot", 1, ATTN_NORM );

	A_FaceTarget (self);
	pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);

	for (int i = 0; i < 10; ++i)
	{
		damage = (pr_templar() & 4) * 2;
		angle = self->angle + (pr_templar.Random2() << 19);
		pitchdiff = pr_templar.Random2() * 332063;
		P_LineAttack (self, angle, MISSILERANGE+64*FRACUNIT, pitch+pitchdiff, damage, NAME_None, NAME_MaulerPuff);
	}
}
Exemplo n.º 5
0
void A_FireShotgun2(player_t *player, pspdef_t *psp)
{
  int i;

  CHECK_WEAPON_CODEPOINTER("A_FireShotgun2", player);

  S_StartSound(player->mo, sfx_dshtgn);
  P_SetMobjState(player->mo, S_PLAY_ATK2);
  player->ammo[weaponinfo[player->readyweapon].ammo] -= 2;

  A_FireSomething(player,0);                                      // phares

  P_BulletSlope(player->mo);

  for (i=0; i<20; i++)
    {
      int damage = 5*(P_Random(pr_shotgun)%3+1);
      angle_t angle = player->mo->angle;
      // killough 5/5/98: remove dependence on order of evaluation:
      int t = P_Random(pr_shotgun);
      angle += (t - P_Random(pr_shotgun))<<19;
      t = P_Random(pr_shotgun);
      P_LineAttack(player->mo, angle, MISSILERANGE, bulletslope +
                   ((t - P_Random(pr_shotgun))<<5), damage);
    }
}
Exemplo n.º 6
0
DEFINE_ACTION_FUNCTION(AActor, A_JabDagger)
{
	angle_t 	angle;
	int 		damage;
	int 		pitch;
	int			power;
	AActor *linetarget;

	power = MIN(10, self->player->mo->stamina / 10);
	damage = (pr_jabdagger() % (power + 8)) * (power + 2);

	if (self->FindInventory<APowerStrength>())
	{
		damage *= 10;
	}

	angle = self->angle + (pr_jabdagger.Random2() << 18);
	pitch = P_AimLineAttack (self, angle, 80*FRACUNIT, &linetarget);
	P_LineAttack (self, angle, 80*FRACUNIT, pitch, damage, NAME_Melee, "StrifeSpark", true, &linetarget);

	// turn to face target
	if (linetarget)
	{
		S_Sound (self, CHAN_WEAPON,
			linetarget->flags & MF_NOBLOOD ? "misc/metalhit" : "misc/meathit",
			1, ATTN_NORM);
		self->angle = self->AngleTo(linetarget);
		self->flags |= MF_JUSTATTACKED;
		P_DaggerAlert (self, linetarget);
	}
	else
	{
		S_Sound (self, CHAN_WEAPON, "misc/swish", 1, ATTN_NORM);
	}
}
Exemplo n.º 7
0
//
// A_Saw
//
void A_Saw(player_t *player, pspdef_t *psp)
{
    int     damage = 2 * (P_Random() % 10 + 1);
    angle_t angle = player->mo->angle + ((P_Random() - P_Random()) << 18);
    int     slope = P_AimLineAttack(player->mo, angle, MELEERANGE + 1);

    // use meleerange + 1 so the puff doesn't skip the flash
    P_LineAttack(player->mo, angle, MELEERANGE + 1, slope, damage);

    if (!linetarget)
    {
        S_StartSound(player->mo, sfx_sawful);
        return;
    }
    S_StartSound (player->mo, sfx_sawhit);

    // turn to face target
    angle = R_PointToAngle2(player->mo->x, player->mo->y, linetarget->x, linetarget->y);
    if (angle - player->mo->angle > ANG180)
    {
        if (angle - player->mo->angle < -ANG90 / 20)
            player->mo->angle = angle + ANG90 / 21;
        else
            player->mo->angle -= ANG90 / 20;
    }
    else
    {
        if (angle - player->mo->angle > ANG90 / 20)
            player->mo->angle = angle - ANG90 / 21;
        else
            player->mo->angle += ANG90 / 20;
    }
    player->mo->flags |= MF_JUSTATTACKED;
}
Exemplo n.º 8
0
void A_Punch(player_t* player, pspdef_t* psp)
{
    angle_t 	angle;
    int 		damage;
    int 		slope = 0;
    
    damage = ((P_Random() & 7) + 1) * 3;
    
    if(player->powers[pw_strength])
        damage *= 10;
    
    angle = player->mo->angle;
    angle += P_RandomShift(18);
    
    slope = P_AimLineAttack(player->mo, angle, 0, MELEERANGE);
    
    P_LineAttack(player->mo, angle, MELEERANGE, slope, damage);
    
    // turn to face target
    if(linetarget)
    {
        S_StartSound(player->mo, sfx_punch);
        player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y,
            linetarget->x, linetarget->y);
    }
}
Exemplo n.º 9
0
DEFINE_ACTION_FUNCTION(AActor, A_SnoutAttack)
{
	angle_t angle;
	int damage;
	int slope;
	player_t *player;
	AActor *puff;
	AActor *linetarget;

	if (NULL == (player = self->player))
	{
		return;
	}

	damage = 3+(pr_snoutattack()&3);
	angle = player->mo->angle;
	slope = P_AimLineAttack(player->mo, angle, MELEERANGE, &linetarget);
	puff = P_LineAttack(player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "SnoutPuff", true, &linetarget);
	S_Sound(player->mo, CHAN_VOICE, "PigActive", 1, ATTN_NORM);
	if(linetarget)
	{
		AdjustPlayerAngle(player->mo, linetarget);
		if(puff != NULL)
		{ // Bit something
			S_Sound(player->mo, CHAN_VOICE, "PigAttack", 1, ATTN_NORM);
		}
	}
}
Exemplo n.º 10
0
DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun2)
{
	int pitch;

	// [BC] Don't do this in client mode.
	if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) ||
		( CLIENTDEMO_IsPlaying( )))
	{
		return;
	}

	if (self->target == NULL)
		return;

	S_Sound (self, CHAN_WEAPON, "weapons/sshotf", 1, ATTN_NORM);

	// [BC] If we're the server, tell clients to play this sound.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_SoundActor( self, CHAN_WEAPON, "weapons/sshotf", 1, ATTN_NORM );

	A_FaceTarget (self);
	pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);
	for (int i = 0; i < 20; ++i)
	{
		int damage = 5*(pr_m_fireshotgun2()%3+1);
		angle_t angle = self->angle + (pr_m_fireshotgun2.Random2() << 19);

		P_LineAttack (self, angle, MISSILERANGE,
					  pitch + (pr_m_fireshotgun2.Random2() * 332063), damage,
					  NAME_None, PClass::FindClass(NAME_BulletPuff));
	}
	self->special1 = level.maptime;
}
Exemplo n.º 11
0
//
// A_PosAttack
//
DEFINE_ACTION_FUNCTION(AActor, A_PosAttack)
{
	int angle;
	int damage;
	int slope;
		
	// [BC] Server takes care of the rest of this.
	if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) ||
		( CLIENTDEMO_IsPlaying( )))
	{
		S_Sound( self, CHAN_WEAPON, "grunt/attack", 1, ATTN_NORM );
		return;
	}

	if (!self->target)
		return;
				
	A_FaceTarget (self);
	angle = self->angle;
	slope = P_AimLineAttack (self, angle, MISSILERANGE);

	S_Sound (self, CHAN_WEAPON, "grunt/attack", 1, ATTN_NORM);
	angle += pr_posattack.Random2() << 20;
	damage = ((pr_posattack()%5)+1)*3;
	P_LineAttack (self, angle, MISSILERANGE, slope, damage, NAME_None, NAME_BulletPuff);
}
Exemplo n.º 12
0
static bool TryPunch(APlayerPawn *pmo, DAngle angle, int damage, int power)
{
	PClassActor *pufftype;
	FTranslatedLineTarget t;
	DAngle slope;

	slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &t);
	if (t.linetarget != NULL)
	{
		if (++pmo->weaponspecial >= 3)
		{
			damage <<= 1;
			power *= 3;
			pufftype = PClass::FindActor("HammerPuff");
		}
		else
		{
			pufftype = PClass::FindActor("PunchPuff");
		}
		P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true, &t);
		if (t.linetarget != NULL)
		{
			if (t.linetarget->player != NULL || 
				(t.linetarget->Mass != INT_MAX && (t.linetarget->flags3 & MF3_ISMONSTER)))
			{
				t.linetarget->Thrust(t.angleFromSource, power);
			}
			AdjustPlayerAngle (pmo, &t);
			return true;
		}
	}
	return false;
}
Exemplo n.º 13
0
static void MarinePunch(AActor *self, int damagemul)
{
	angle_t 	angle;
	int 		damage;
	int 		pitch;
	AActor		*linetarget;

	if (self->target == NULL)
		return;

	damage = ((pr_m_punch()%10+1) << 1) * damagemul;

	A_FaceTarget (self);
	angle = self->angle + (pr_m_punch.Random2() << 18);
	pitch = P_AimLineAttack (self, angle, MELEERANGE, &linetarget);
	P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, true, &linetarget);

	// turn to face target
	if (linetarget)
	{
		S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM);
		self->angle = self->AngleTo(linetarget);

	}
}
Exemplo n.º 14
0
void A_SnoutAttack (AActor *actor)
{
    angle_t angle;
    int damage;
    int slope;
    player_t *player;

    if (NULL == (player = actor->player))
    {
        return;
    }

    damage = 3+(pr_snoutattack()&3);
    angle = player->mo->angle;
    slope = P_AimLineAttack(player->mo, angle, MELEERANGE);
    PuffSpawned = NULL;
    P_LineAttack(player->mo, angle, MELEERANGE, slope, damage, MOD_HIT, RUNTIME_CLASS(ASnoutPuff));
    S_Sound(player->mo, CHAN_VOICE, "PigActive", 1, ATTN_NORM);
    if(linetarget)
    {
        AdjustPlayerAngle(player->mo);
        if(PuffSpawned)
        {   // Bit something
            S_Sound(player->mo, CHAN_VOICE, "PigAttack", 1, ATTN_NORM);
        }
    }
}
Exemplo n.º 15
0
DEFINE_ACTION_FUNCTION(AActor, A_CPosAttack)
{
    int angle;
    int bangle;
    int damage;
    int slope;

    if (!self->target)
        return;

    // [RH] Andy Baker's stealth monsters
    if (self->flags & MF_STEALTH)
    {
        self->visdir = 1;
    }

    S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
    A_FaceTarget (self);
    bangle = self->angle;
    slope = P_AimLineAttack (self, bangle, MISSILERANGE);

    angle = bangle + (pr_cposattack.Random2() << 20);
    damage = ((pr_cposattack()%5)+1)*3;
    P_LineAttack (self, angle, MISSILERANGE, slope, damage, NAME_Hitscan, NAME_BulletPuff);
}
Exemplo n.º 16
0
void A_FireShotgun2(player_t* player, pspdef_t* psp)
{
    int 		i;
    angle_t 	angle;
    int 		damage;
    
    S_StartSound(player->mo, sfx_sht2fire);
    P_SetMobjState(player->mo, S_007);
    player->ammo[weaponinfo[player->readyweapon].ammo] -= 2;
    
    P_SetPsprite(player, ps_flash, weaponinfo[player->readyweapon].flashstate);
    P_BulletSlope(player->mo);
    
    player->recoilpitch = RECOILPITCH;
    
    if(player->onground)
        P_Thrust(player, player->mo->angle + ANG180, FRACUNIT);
    
    for(i = 0; i < 20; i++)
    {
        damage = 5 * (P_Random() % 3 + 1);
        angle = player->mo->angle;
        angle += P_RandomShift(ANGLETOFINESHIFT);
        P_LineAttack(player->mo, angle, MISSILERANGE, bulletslope + P_RandomShift(5), damage);
    }
}
Exemplo n.º 17
0
OVERLAY void A_Punch(player_t *player, pspdef_t *psp)
{
  angle_t angle;
  int t, slope, damage = (P_Random(pr_punch)%10+1)<<1;

  if (player->powers[pw_strength])
    damage *= 10;

  angle = player->mo->angle;

  // killough 5/5/98: remove dependence on order of evaluation:
  t = P_Random(pr_punchangle);
  angle += (t - P_Random(pr_punchangle))<<18;
  slope = P_AimLineAttack(player->mo, angle, MELEERANGE);
  P_LineAttack(player->mo, angle, MELEERANGE, slope, damage);

  if (!linetarget)
    return;

  S_StartSound(player->mo, sfx_punch);

  // turn to face target

  player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y,
                                      linetarget->x, linetarget->y);
}
Exemplo n.º 18
0
DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL2)
{
	PARAM_ACTION_PROLOGUE;

	DAngle angle;
	int damage;
	DAngle slope;
	player_t *player;
	FTranslatedLineTarget t;

	if (NULL == (player = self->player))
	{
		return 0;
	}

	damage = pr_beakatkpl2.HitDice (4);
	angle = player->mo->Angles.Yaw;
	slope = P_AimLineAttack (player->mo, angle, MELEERANGE);
	P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &t);
	if (t.linetarget)
	{
		player->mo->Angles.Yaw = t.angleFromSource;
	}
	P_PlayPeck (player->mo);
	player->chickenPeck = 12;
	player->psprites[ps_weapon].tics -= pr_beakatkpl2()&3;
	return 0;
}
Exemplo n.º 19
0
static bool TryPunch(APlayerPawn *pmo, angle_t angle, int damage, fixed_t power)
{
	const PClass *pufftype;
	AActor *linetarget;
	int slope;

	slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &linetarget);
	if (linetarget != NULL)
	{
		if (++pmo->weaponspecial >= 3)
		{
			damage <<= 1;
			power *= 3;
			pufftype = PClass::FindClass ("HammerPuff");
		}
		else
		{
			pufftype = PClass::FindClass ("PunchPuff");
		}
		P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget);
		if (linetarget != NULL)
		{
			if (linetarget->player != NULL || 
				(linetarget->Mass != INT_MAX && (linetarget->flags3 & MF3_ISMONSTER)))
			{
				P_ThrustMobj (linetarget, angle, power);
			}
			AdjustPlayerAngle (pmo, linetarget);
			return true;
		}
	}
	return false;
}
Exemplo n.º 20
0
void A_Punch(player_t *player, pspdef_t *psp)
{
  angle_t angle;
  int t, slope, damage = (P_Random(pr_punch)%10+1)<<1;

  if (player->powers[pw_strength])
    damage *= 10;

  angle = player->mo->angle;

  // killough 5/5/98: remove dependence on order of evaluation:
  t = P_Random(pr_punchangle);
  angle += (t - P_Random(pr_punchangle))<<18;

  /* killough 8/2/98: make autoaiming prefer enemies */
  if (!mbf_features ||
      (slope = P_AimLineAttack(player->mo, angle, MELEERANGE, MF_FRIEND),
       !linetarget))
    slope = P_AimLineAttack(player->mo, angle, MELEERANGE, 0);

  P_LineAttack(player->mo, angle, MELEERANGE, slope, damage);

  if (!linetarget)
    return;

  S_StartSound(player->mo, sfx_punch);

  // turn to face target

  player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y,
                                      linetarget->x, linetarget->y);
  R_SmoothPlaying_Reset(player); // e6y
}
Exemplo n.º 21
0
DEFINE_ACTION_FUNCTION(AActor, A_FireMauler1)
{
	PARAM_ACTION_PROLOGUE;

	if (self->player != NULL)
	{
		AWeapon *weapon = self->player->ReadyWeapon;
		if (weapon != NULL)
		{
			if (!weapon->DepleteAmmo (weapon->bAltFire))
				return 0;
		}
		// Strife apparently didn't show the player shooting. Let's fix that.
		self->player->mo->PlayAttacking2 ();
	}

	S_Sound (self, CHAN_WEAPON, "weapons/mauler1", 1, ATTN_NORM);


	int bpitch = P_BulletSlope (self);

	for (int i = 0; i < 20; ++i)
	{
		int damage = 5 * (pr_mauler1() % 3 + 1);
		angle_t angle = self->angle + (pr_mauler1.Random2() << 19);
		int pitch = bpitch + (pr_mauler1.Random2() * 332063);
		
		// Strife used a range of 2112 units for the mauler to signal that
		// it should use a different puff. ZDoom's default range is longer
		// than this, so let's not handicap it by being too faithful to the
		// original.
		P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, NAME_MaulerPuff);
	}
	return 0;
}
Exemplo n.º 22
0
//
// P_GunShot
//
void P_GunShot(mobj_t *mo, boolean accurate)
{
    int     damage = 5 * (P_Random() % 3 + 1);
    angle_t angle = mo->angle;

    if (!accurate)
        angle += (P_Random() - P_Random()) << 18;

    P_LineAttack(mo, angle, MISSILERANGE, bulletslope, damage);
}
Exemplo n.º 23
0
///
/// P_MusketShot
/// variation of P_GunShot
/// A never accurate version of gunshot for musket weaponry
/// -jukeri12 14.8.2015
///
static void P_MusketShot(mobj_t *mo, int spread, int bdmg)
{
  int damage = bdmg;
  angle_t angle = mo->angle;

  //Muskets are never accurate!
  //Use spread var to set accuracy
  int t = P_Random(pr_misfire);
  angle += (t - P_Random(pr_misfire))<<spread;

  P_LineAttack(mo, angle, MISSILERANGE, bulletslope, damage);
}
Exemplo n.º 24
0
//
// P_GunShot
//
void P_GunShot(mobj_t* mo, dboolean accurate)
{
    angle_t 	angle;
    int 		damage;
    
    damage = ((P_Random()&3)<<2)+4;
    angle = mo->angle;
    
    if (!accurate)
        angle += P_RandomShift(18);
    
    P_LineAttack (mo, angle, MISSILERANGE, bulletslope, damage);
}
Exemplo n.º 25
0
OVERLAY void P_GunShot(mobj_t *mo, boolean accurate)
{
  int damage = 5*(P_Random(pr_gunshot)%3+1);
  angle_t angle = mo->angle;

  if (!accurate)
    {  // killough 5/5/98: remove dependence on order of evaluation:
      int t = P_Random(pr_misfire);
      angle += (t - P_Random(pr_misfire))<<18;
    }

  P_LineAttack(mo, angle, MISSILERANGE, bulletslope, damage);
}
Exemplo n.º 26
0
void A_Saw(player_t *player, pspdef_t *psp)
{
  int slope, damage;
  angle_t angle;
  int t;

  CHECK_WEAPON_CODEPOINTER("A_Saw", player);

  damage = 2*(P_Random(pr_saw)%10+1);
  angle = player->mo->angle;
  // killough 5/5/98: remove dependence on order of evaluation:
  t = P_Random(pr_saw);
  angle += (t - P_Random(pr_saw))<<18;

  /* Use meleerange + 1 so that the puff doesn't skip the flash
   * killough 8/2/98: make autoaiming prefer enemies */
  if (!mbf_features ||
      (slope = P_AimLineAttack(player->mo, angle, MELEERANGE+1, MF_FRIEND),
       !linetarget))
    slope = P_AimLineAttack(player->mo, angle, MELEERANGE+1, 0);

  P_LineAttack(player->mo, angle, MELEERANGE+1, slope, damage);

  if (!linetarget)
    {
      S_StartSound(player->mo, sfx_sawful);
      return;
    }

  S_StartSound(player->mo, sfx_sawhit);

  // turn to face target
  angle = R_PointToAngle2(player->mo->x, player->mo->y,
                          linetarget->x, linetarget->y);

  if (angle - player->mo->angle > ANG180) {
    if (angle - player->mo->angle < -ANG90/20)
      player->mo->angle = angle + ANG90/21;
    else
      player->mo->angle -= ANG90/20;
  } else {
    if (angle - player->mo->angle > ANG90/20)
      player->mo->angle = angle - ANG90/21;
    else
      player->mo->angle += ANG90/20;
  }

  player->mo->flags |= MF_JUSTATTACKED;
  R_SmoothPlaying_Reset(player); // e6y
}
Exemplo n.º 27
0
//
// A_Saw
//
void A_Saw (AActor *mo)
{
	angle_t 	angle;
	int 		damage;

    player_t *player = mo->player;

	damage = 2 * (P_Random (player->mo)%10+1);
	angle = player->mo->angle;
	angle += P_RandomDiff(player->mo) << 18;

	// [SL] 2011-07-12 - Move players and sectors back to their positions when
	// this player hit the fire button clientside.
	Unlag::getInstance().reconcile(player->id);

	// use meleerange + 1 so the puff doesn't skip the flash
	P_LineAttack (player->mo, angle, MELEERANGE+1,
				  P_AimLineAttack (player->mo, angle, MELEERANGE+1), damage);

	// [SL] 2011-07-12 - Restore players and sectors to their current position
	// according to the server.
	Unlag::getInstance().restore(player->id);

	if (!linetarget)
	{
		A_FireSound (player, "weapons/sawfull");
		return;
	}
	A_FireSound (player, "weapons/sawhit");

	// turn to face target
	angle = P_PointToAngle (player->mo->x, player->mo->y,
							 linetarget->x, linetarget->y);
	if (angle - player->mo->angle > ANG180)
	{
		if (angle - player->mo->angle < (angle_t)(-ANG90/20))
			player->mo->angle = angle + ANG90/21;
		else
			player->mo->angle -= ANG90/20;
	}
	else
	{
		if (angle - player->mo->angle > ANG90/20)
			player->mo->angle = angle - ANG90/21;
		else
			player->mo->angle += ANG90/20;
	}
	player->mo->flags |= MF_JUSTATTACKED;
}
Exemplo n.º 28
0
void P_GunShot2 (AActor *mo, bool accurate, int pitch, PClassActor *pufftype)
{
	angle_t 	angle;
	int 		damage;
		
	damage = 5*(pr_m_gunshot()%3+1);
	angle = mo->angle;

	if (!accurate)
	{
		angle += pr_m_gunshot.Random2 () << 18;
	}

	P_LineAttack (mo, angle, MISSILERANGE, pitch, damage, NAME_Hitscan, pufftype);
}
Exemplo n.º 29
0
//
// P_GunShot
//
void P_GunShot (AActor *mo, bool accurate, PClassActor *pufftype, DAngle pitch)
{
	DAngle 	angle;
	int 		damage;
		
	damage = 5*(pr_gunshot()%3+1);
	angle = mo->Angles.Yaw;

	if (!accurate)
	{
		angle += pr_gunshot.Random2 () * (5.625 / 256);
	}

	P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, pufftype);
}
Exemplo n.º 30
0
void P_StrifeGunShot (AActor *mo, bool accurate, angle_t pitch)
{
	angle_t angle;
	int damage;

	damage = 4*(pr_sgunshot()%3+1);
	angle = mo->angle;

	if (mo->player != NULL && !accurate)
	{
		angle += pr_sgunshot.Random2() << (20 - mo->player->mo->accuracy * 5 / 100);
	}

	P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, NAME_StrifePuff);
}