示例#1
0
void A_FireCGun(player_t* player, pspdef_t* psp)
{
    int ammo = player->ammo[weaponinfo[player->readyweapon].ammo];
    int rand;

    if(!ammo)
        return;
    
    S_StartSound(player->mo, sfx_pistol);
    
    P_SetMobjState (player->mo, S_007);
    player->ammo[weaponinfo[player->readyweapon].ammo]--;
    
    // randomize sx
    rand = (((P_Random() & 1) << 1) - 1);
    psp->sx = (rand * FRACUNIT);

    // randomize sy
    rand = ((((ammo - 1) & 1) << 1) - 1);
    psp->sy = WEAPONTOP - (rand * (2*FRACUNIT));
    
    player->psprites[ps_flash].alpha = 160;

    P_SetPsprite(player, ps_flash,
        weaponinfo[player->readyweapon].flashstate + psp->state - &states[S_756]);
    
    player->recoilpitch = RECOILPITCH;
    
    P_BulletSlope(player->mo);
    P_GunShot(player->mo, !player->refire);
}
示例#2
0
//
// A_FirePistol
//
DEFINE_ACTION_FUNCTION(AActor, A_FirePistol)
{
	PARAM_ACTION_PROLOGUE;

	bool accurate;

	if (self->player != NULL)
	{
		AWeapon *weapon = self->player->ReadyWeapon;
		if (weapon != NULL && ACTION_CALL_FROM_WEAPON())
		{
			if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
				return 0;

			P_SetPsprite (self->player, ps_flash, weapon->FindState(NAME_Flash));
		}
		self->player->mo->PlayAttacking2 ();

		accurate = !self->player->refire;
	}
	else
	{
		accurate = true;
	}

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

	P_GunShot (self, accurate, PClass::FindActor(NAME_BulletPuff), P_BulletSlope (self));
	return 0;
}
示例#3
0
//
// A_FireShotgun
//
DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun)
{
	PARAM_ACTION_PROLOGUE;

	int i;
	player_t *player;

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

	S_Sound (self, CHAN_WEAPON,  "weapons/shotgf", 1, ATTN_NORM);
	AWeapon *weapon = self->player->ReadyWeapon;
	if (weapon != NULL && ACTION_CALL_FROM_WEAPON())
	{
		if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
			return 0;
		P_SetPsprite (player, ps_flash, weapon->FindState(NAME_Flash));
		self->player->psprites[ps_flash].processPending = true;
	}
	player->mo->PlayAttacking2 ();

	DAngle pitch = P_BulletSlope (self);

	for (i = 0; i < 7; i++)
	{
		P_GunShot (self, false, PClass::FindActor(NAME_BulletPuff), pitch);
	}
	return 0;
}
示例#4
0
OVERLAY void A_FirePistol(player_t *player, pspdef_t *psp)
{
  S_StartSound(player->mo, sfx_pistol);

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

  A_FireSomething(player,0);                                      // phares
  P_BulletSlope(player->mo);
  P_GunShot(player->mo, !player->refire);
}
示例#5
0
//
// A_FirePistol
//
void A_FirePistol(player_t *player, pspdef_t *psp)
{
    S_StartSound(player->mo, sfx_pistol);

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

    P_SetPsprite(player, ps_flash, (statenum_t)weaponinfo[player->readyweapon].flashstate);

    P_BulletSlope(player->mo);
    P_GunShot(player->mo, !player->refire);
}
示例#6
0
OVERLAY void A_FireCGun(player_t *player, pspdef_t *psp)
{
  S_StartSound(player->mo, sfx_pistol);

  if (!player->ammo[weaponinfo[player->readyweapon].ammo])
    return;

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

  A_FireSomething(player,psp->state - &states[S_CHAIN1]);           // phares

  P_BulletSlope(player->mo);

  P_GunShot(player->mo, !player->refire);
}
示例#7
0
OVERLAY void A_FireShotgun(player_t *player, pspdef_t *psp)
{
  int i;

  S_StartSound(player->mo, sfx_shotgn);
  P_SetMobjState(player->mo, S_PLAY_ATK2);

  player->ammo[weaponinfo[player->readyweapon].ammo]--;

  A_FireSomething(player,0);                                      // phares

  P_BulletSlope(player->mo);

  for (i=0; i<7; i++)
    P_GunShot(player->mo, false);
}
示例#8
0
//
// A_FireCGun
//
void A_FireCGun(player_t *player, pspdef_t *psp)
{
    if (player->ammo[weaponinfo[player->readyweapon].ammo])
        S_StartSound(player->mo, sfx_pistol);

    if (!player->ammo[weaponinfo[player->readyweapon].ammo])
        return;

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

    P_SetPsprite(player, ps_flash, (statenum_t)(weaponinfo[player->readyweapon].flashstate
                                   + psp->state - &states[S_CHAIN1]));

    P_BulletSlope(player->mo);

    P_GunShot(player->mo, !player->refire);
}
示例#9
0
//
// A_FireShotgun
//
void A_FireShotgun(player_t *player, pspdef_t *psp)
{
    int i;

    S_StartSound(player->mo, sfx_shotgn);
    P_SetMobjState(player->mo, S_PLAY_ATK2);

    player->ammo[weaponinfo[player->readyweapon].ammo]--;

    P_SetPsprite(player, ps_flash, (statenum_t)weaponinfo[player->readyweapon].flashstate);

    P_BulletSlope(player->mo);

    for (i = 0; i < 7; i++)
        P_GunShot(player->mo, false);

    player->preferredshotgun = wp_shotgun;
}
示例#10
0
void A_FireCGun(player_t *player, pspdef_t *psp)
{
  CHECK_WEAPON_CODEPOINTER("A_FireCGun", player);

  if (player->ammo[weaponinfo[player->readyweapon].ammo] || comp[comp_sound])
    S_StartSound(player->mo, sfx_pistol);

  if (!player->ammo[weaponinfo[player->readyweapon].ammo])
    return;

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

  A_FireSomething(player,psp->state - &states[S_CHAIN1]);           // phares

  P_BulletSlope(player->mo);

  P_GunShot(player->mo, !player->refire);
}
示例#11
0
//
// A_FireShotgun
//
void A_FireShotgun(player_t* player, pspdef_t* psp)
{
    int i;
    
    S_StartSound(player->mo, sfx_shotgun);
    P_SetMobjState (player->mo, S_007);
    
    player->ammo[weaponinfo[player->readyweapon].ammo]--;
    
    P_SetPsprite(player,
        ps_flash,
        weaponinfo[player->readyweapon].flashstate);
    
    P_BulletSlope(player->mo);
    
    player->recoilpitch = RECOILPITCH;
    
    for(i = 0; i < 7; i++)
        P_GunShot(player->mo, false);
}
示例#12
0
//
// A_FireCGun
//
DEFINE_ACTION_FUNCTION(AActor, A_FireCGun)
{
	PARAM_ACTION_PROLOGUE;

	player_t *player;

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

	AWeapon *weapon = player->ReadyWeapon;
	if (weapon != NULL && ACTION_CALL_FROM_WEAPON())
	{
		if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
			return 0;
		
		S_Sound (self, CHAN_WEAPON, "weapons/chngun", 1, ATTN_NORM);

		FState *flash = weapon->FindState(NAME_Flash);
		if (flash != NULL)
		{
			// [RH] Fix for Sparky's messed-up Dehacked patch! Blargh!
			FState * atk = weapon->FindState(NAME_Fire);

			int theflash = clamp (int(player->psprites[ps_weapon].state - atk), 0, 1);

			if (flash[theflash].sprite != flash->sprite)
			{
				theflash = 0;
			}

			P_SetSafeFlash (weapon, player, flash, theflash);
		}

	}
	player->mo->PlayAttacking2 ();

	P_GunShot (self, !player->refire, PClass::FindActor(NAME_BulletPuff), P_BulletSlope (self));
	return 0;
}