• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ P_AimLineAttack函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: 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


示例3: P_BulletSlope

angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget)
{
	static const int angdiff[3] = { -1<<26, 1<<26, 0 };
	int i;
	angle_t an;
	angle_t pitch;
	AActor *linetarget;

	// see which target is to be aimed at
	i = 2;
	do
	{
		an = mo->angle + angdiff[i];
		pitch = P_AimLineAttack (mo, an, 16*64*FRACUNIT, &linetarget);

		if (mo->player != NULL &&
			level.IsFreelookAllowed() &&
			mo->player->userinfo.GetAimDist() <= ANGLE_1/2)
		{
			break;
		}
	} while (linetarget == NULL && --i >= 0);
	if (pLineTarget != NULL)
	{
		*pLineTarget = linetarget;
	}
	return pitch;
}
开发者ID:BadSanta1980,项目名称:gzdoom,代码行数:28,代码来源:p_pspr.cpp


示例4: 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


示例5: 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


示例6: A_BFGSpray

//
// A_BFGSpray
// Spawn a BFG explosion on every monster in view
//
void A_BFGSpray(mobj_t *mo)
{
    int i;

    // offset angles from its attack angle
    for (i = 0; i < 40; i++)
    {
        int     j;
        int     damage;
        angle_t an = mo->angle - ANG90 / 2 + ANG90 / 40 * i;

        // mo->target is the originator (player)
        //  of the missile
        P_AimLineAttack(mo->target, an, 16 * 64 * FRACUNIT);

        if (!linetarget)
            continue;

        P_SpawnMobj(linetarget->x, linetarget->y, linetarget->z + (linetarget->height >> 2),
                    MT_EXTRABFG);

        damage = 0;
        for (j = 0; j < 15; j++)
            damage += (P_Random() & 7) + 1;

        P_DamageMobj(linetarget, mo->target, mo->target, damage);
    }
}
开发者ID:arneolavhal,项目名称:doomretro,代码行数:32,代码来源:p_pspr.c


示例7: 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


示例8: 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


示例9: TryPunch

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


示例10: Spawn

AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target)
{
	AActor *other = Spawn (type, source->Pos(), ALLOW_REPLACE);

	if (other == NULL)
	{
		return NULL;
	}

	other->target = target;
	other->Angles.Yaw = source->Angles.Yaw;
	other->VelFromAngle();

	if (other->flags4 & MF4_SPECTRAL)
	{
		if (source->flags & MF_MISSILE && source->flags4 & MF4_SPECTRAL)
		{
			other->FriendPlayer = source->FriendPlayer;
		}
		else
		{
			other->SetFriendPlayer(target->player);
		}
	}

	if (P_CheckMissileSpawn (other, source->radius))
	{
		DAngle pitch = P_AimLineAttack (source, source->Angles.Yaw, 1024.);
		other->Vel.Z = -other->Speed * pitch.Sin();
		return other;
	}
	return NULL;
}
开发者ID:Jayman2000,项目名称:zdoom-pull,代码行数:33,代码来源:a_strifeweapons.cpp


示例11: 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


示例12: P_BulletSlope

DAngle P_BulletSlope (AActor *mo, FTranslatedLineTarget *pLineTarget, int aimflags)
{
	static const double angdiff[3] = { -5.625f, 5.625f, 0 };
	int i;
	DAngle an;
	DAngle pitch;
	FTranslatedLineTarget scratch;

	if (pLineTarget == NULL) pLineTarget = &scratch;
	// see which target is to be aimed at
	i = 2;
	do
	{
		an = mo->Angles.Yaw + angdiff[i];
		pitch = P_AimLineAttack (mo, an, 16.*64, pLineTarget, 0., aimflags);

		if (mo->player != NULL &&
			level.IsFreelookAllowed() &&
			mo->player->userinfo.GetAimDist() <= 0.5)
		{
			break;
		}
	} while (pLineTarget->linetarget == NULL && --i >= 0);

	return pitch;
}
开发者ID:Jayman2000,项目名称:zdoom-pull,代码行数:26,代码来源:p_pspr.cpp


示例13: 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


示例14: Spawn

AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target)
{
	AActor *other = Spawn (type, source->Pos(), ALLOW_REPLACE);

	if (other == NULL)
	{
		return NULL;
	}

	other->target = target;
	other->angle = source->angle;

	other->velx = FixedMul (other->Speed, finecosine[source->angle >> ANGLETOFINESHIFT]);
	other->vely = FixedMul (other->Speed, finesine[source->angle >> ANGLETOFINESHIFT]);

	if (other->flags4 & MF4_SPECTRAL)
	{
		if (source->flags & MF_MISSILE && source->flags4 & MF4_SPECTRAL)
		{
			other->FriendPlayer = source->FriendPlayer;
		}
		else
		{
			other->SetFriendPlayer(target->player);
		}
	}

	if (P_CheckMissileSpawn (other, source->radius))
	{
		angle_t pitch = P_AimLineAttack (source, source->angle, 1024*FRACUNIT);
		other->velz = FixedMul (-finesine[pitch>>ANGLETOFINESHIFT], other->Speed);
		return other;
	}
开发者ID:Edward850,项目名称:zdoom,代码行数:33,代码来源:a_strifeweapons.cpp


示例15: 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


示例16: 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


示例17: A_Punch

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:hexameron,项目名称:DOOM,代码行数:26,代码来源:p_pspr.c


示例18: 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


示例19: DEFINE_ACTION_FUNCTION

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


示例20: P_BulletSlope

static void P_BulletSlope(mobj_t *mo)
{
  angle_t an = mo->angle;    // see which target is to be aimed at

  /* killough 8/2/98: make autoaiming prefer enemies */
  uint_64_t mask = mbf_features ? MF_FRIEND : 0;

  do
    {
      bulletslope = P_AimLineAttack(mo, an, 16*64*FRACUNIT, mask);
      if (!linetarget)
  bulletslope = P_AimLineAttack(mo, an += 1<<26, 16*64*FRACUNIT, mask);
      if (!linetarget)
  bulletslope = P_AimLineAttack(mo, an -= 2<<26, 16*64*FRACUNIT, mask);
    }
  while (mask && (mask=0, !linetarget));  /* killough 8/2/98 */
}
开发者ID:jukeri12,项目名称:musket-doom,代码行数:17,代码来源:p_pspr.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ P_DamageMobj函数代码示例发布时间:2022-05-30
下一篇:
C++ P_AddThinker函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap