当前位置: 首页>>代码示例>>C++>>正文


C++ P_LineAttack函数代码示例

本文整理汇总了C++中P_LineAttack函数的典型用法代码示例。如果您正苦于以下问题:C++ P_LineAttack函数的具体用法?C++ P_LineAttack怎么用?C++ P_LineAttack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了P_LineAttack函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DEFINE_ACTION_FUNCTION

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;		
}
开发者ID:Krazygamr,项目名称:D-Touch,代码行数:49,代码来源:a_clericmace.cpp

示例2: DEFINE_ACTION_FUNCTION

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;
}
开发者ID:BenJamesbabala,项目名称:ViZDoom,代码行数:25,代码来源:a_chicken.cpp

示例3: DEFINE_ACTION_FUNCTION

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);
	}
}
开发者ID:WChrisK,项目名称:Zandronum,代码行数:27,代码来源:a_templar.cpp

示例4: A_FireShotgun2

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);
    }
}
开发者ID:Mistranger,项目名称:prboom-plus,代码行数:26,代码来源:p_pspr.c

示例5: DEFINE_ACTION_FUNCTION

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);
	}
}
开发者ID:loismustdie555,项目名称:GZDoom-GPL,代码行数:35,代码来源:a_strifeweapons.cpp

示例6: A_Saw

//
// 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;
}
开发者ID:arneolavhal,项目名称:doomretro,代码行数:37,代码来源:p_pspr.c

示例7: A_Punch

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);
    }
}
开发者ID:alexey-lysiuk,项目名称:doom64ex-osx,代码行数:26,代码来源:p_pspr.c

示例8: DEFINE_ACTION_FUNCTION

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);
		}
	}
}
开发者ID:BenJamesbabala,项目名称:ViZDoom,代码行数:28,代码来源:a_pig.cpp

示例9: DEFINE_ACTION_FUNCTION

//
// 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);
}
开发者ID:WChrisK,项目名称:Zandronum,代码行数:29,代码来源:a_possessed.cpp

示例10: TryPunch

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;
}
开发者ID:FlameNeon,项目名称:gzdoom,代码行数:33,代码来源:a_fighterplayer.cpp

示例11: MarinePunch

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);

	}
}
开发者ID:Edward850,项目名称:zdoom,代码行数:25,代码来源:a_scriptedmarine.cpp

示例12: A_SnoutAttack

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);
        }
    }
}
开发者ID:doomtech,项目名称:zdoom-old,代码行数:27,代码来源:a_pig.cpp

示例13: DEFINE_ACTION_FUNCTION

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);
}
开发者ID:BadSanta1980,项目名称:gzdoom,代码行数:25,代码来源:a_possessed.cpp

示例14: A_FireShotgun2

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);
    }
}
开发者ID:alexey-lysiuk,项目名称:doom64ex-osx,代码行数:26,代码来源:p_pspr.c

示例15: A_Punch

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);
}
开发者ID:rlsosborne,项目名称:doom,代码行数:26,代码来源:p_pspr.cpp


注:本文中的P_LineAttack函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。