本文整理汇总了C++中P_AimLineAttack函数的典型用法代码示例。如果您正苦于以下问题:C++ P_AimLineAttack函数的具体用法?C++ P_AimLineAttack怎么用?C++ P_AimLineAttack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了P_AimLineAttack函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}