本文整理汇总了C++中T_Damage函数的典型用法代码示例。如果您正苦于以下问题:C++ T_Damage函数的具体用法?C++ T_Damage怎么用?C++ T_Damage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了T_Damage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: use_target_changelevel
/*
* QUAKED target_changelevel (1 0 0) (-8 -8 -8) (8 8 8)
* Changes level to "map" when fired
*/
void
use_target_changelevel(edict_t *self, edict_t *other, edict_t *activator)
{
if (!self || !other || !activator)
{
return;
}
if (level.intermissiontime)
{
return; /* already activated */
}
if (!deathmatch->value && !coop->value)
{
if (g_edicts[1].health <= 0)
{
return;
}
}
/* if noexit, do a ton of damage to other */
if (deathmatch->value && !((int)dmflags->value & DF_ALLOW_EXIT) &&
(other != world))
{
T_Damage(other, self, self, vec3_origin, other->s.origin,
vec3_origin, 10 * other->max_health, 1000,
0, MOD_EXIT);
return;
}
/* if multiplayer, let everyone know who hit the exit */
if (deathmatch->value)
{
if (activator && activator->client)
{
gi.bprintf(PRINT_HIGH, "%s exited the level.\n",
activator->client->pers.netname);
}
}
/* if going to a new unit, clear cross triggers */
if (strstr(self->map, "*"))
{
game.serverflags &= ~(SFL_CROSS_TRIGGER_MASK);
}
BeginIntermission(self);
}
示例2: parasite_drain_attack
void parasite_drain_attack (edict_t *self)
{
vec3_t offset, start, f, r, end, dir;
trace_t tr;
int damage;
AngleVectors (self->s.angles, f, r, NULL);
VectorSet (offset, 24, 0, 6);
G_ProjectSource (self->s.origin, offset, f, r, start);
VectorCopy (self->enemy->s.origin, end);
if (!parasite_drain_attack_ok(start, end))
{
end[2] = self->enemy->s.origin[2] + self->enemy->maxs[2] - 8;
if (!parasite_drain_attack_ok(start, end))
{
end[2] = self->enemy->s.origin[2] + self->enemy->mins[2] + 8;
if (!parasite_drain_attack_ok(start, end))
return;
}
}
VectorCopy (self->enemy->s.origin, end);
tr = gi.trace (start, NULL, NULL, end, self, MASK_SHOT);
if (tr.ent != self->enemy)
return;
if (self->s.frame == FRAME_drain03)
{
damage = 5;
gi.sound (self->enemy, CHAN_AUTO, sound_impact, 1, ATTN_NORM, 0);
}
else
{
if (self->s.frame == FRAME_drain04)
gi.sound (self, CHAN_WEAPON, sound_suck, 1, ATTN_NORM, 0);
damage = 2;
}
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_PARASITE_ATTACK);
gi.WriteShort (self - g_edicts);
gi.WritePosition (start);
gi.WritePosition (end);
gi.multicast (self->s.origin, MULTICAST_PVS);
VectorSubtract (start, end, dir);
T_Damage (self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin, damage, 0, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN);
}
示例3: forcewall_knockback
void forcewall_knockback (edict_t *self, edict_t *other)
{
int dmg;
vec3_t forward, zvec={0,0,0};
trace_t tr;
dmg = 20*self->activator->myskills.abilities[FORCE_WALL].current_level;
tr = gi.trace (other->s.origin, NULL, NULL, self->s.origin, other, MASK_SHOT);
T_Damage (other, self, self->activator, zvec, other->s.origin, NULL, dmg, 1, DAMAGE_ENERGY, MOD_BURN);
vectoangles(tr.plane.normal, forward);
AngleVectors(forward, forward, NULL, NULL);
other->velocity[0] = forward[0]*250;
other->velocity[1] = forward[1]*250;
other->velocity[2] = 200;
}
示例4: turret_blocked
void
turret_blocked (edict_t * self, edict_t * other)
{
edict_t *attacker;
if (other->takedamage)
{
if (self->teammaster->owner)
attacker = self->teammaster->owner;
else
attacker = self->teammaster;
T_Damage (other, self, attacker, vec3_origin, other->s.origin,
vec3_origin, self->teammaster->dmg, 10, 0, MOD_CRUSH);
}
}
示例5: door_blocked
void door_blocked()
{
other->deathtype = "squish";
T_Damage( other, self, PROG_TO_EDICT( self->s.v.goalentity ), self->dmg );
// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
if ( self->wait >= 0 )
{
if ( self->state == STATE_DOWN )
door_go_up();
else
door_go_down();
}
}
示例6: door_blocked
void door_blocked (edict_t *self, edict_t *other)
{
edict_t *ent;
if (!(other->svflags & SVF_MONSTER) && (!other->client) )
{
// give it a chance to go away on it's own terms (like gibs)
T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH);
// if it's still there, nuke it
if (other)
BecomeExplosion1 (other);
return;
}
T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0, MOD_CRUSH);
if (self->spawnflags & DOOR_CRUSHER)
return;
// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
if (self->moveinfo.wait >= 0)
{
if (self->moveinfo.state == STATE_DOWN)
{
for (ent = self->teammaster ; ent ; ent = ent->teamchain)
door_go_up (ent, ent->activator);
}
else
{
for (ent = self->teammaster ; ent ; ent = ent->teamchain)
door_go_down (ent);
}
}
}
示例7: T_RadiusDamage
void
T_RadiusDamage(edict_t *inflictor, edict_t *attacker, float damage,
edict_t *ignore, float radius, int mod)
{
float points;
edict_t *ent = NULL;
vec3_t v;
vec3_t dir;
if (!inflictor || !attacker)
{
return;
}
while ((ent = findradius(ent, inflictor->s.origin, radius)) != NULL)
{
if (ent == ignore)
{
continue;
}
if (!ent->takedamage)
{
continue;
}
VectorAdd(ent->mins, ent->maxs, v);
VectorMA(ent->s.origin, 0.5, v, v);
VectorSubtract(inflictor->s.origin, v, v);
points = damage - 0.5 * VectorLength(v);
if (ent == attacker)
{
points = points * 0.5;
}
if (points > 0)
{
if (CanDamage(ent, inflictor))
{
VectorSubtract(ent->s.origin, inflictor->s.origin, dir);
T_Damage(ent, inflictor, attacker, dir, inflictor->s.origin,
vec3_origin, (int)points, (int)points, DAMAGE_RADIUS,
mod);
}
}
}
}
示例8: T_RadiusDamage
/*
============
T_RadiusDamage
============
*/
void
T_RadiusDamage (edict_t * inflictor, edict_t * attacker, float damage,
edict_t * ignore, float radius, int mod)
{
float points;
edict_t *ent = NULL;
vec3_t v;
vec3_t dir;
while ((ent = findradius (ent, inflictor->s.origin, radius)) != NULL)
{
if (ent == ignore)
continue;
if (!ent->takedamage)
continue;
VectorAdd (ent->mins, ent->maxs, v);
VectorMA (ent->s.origin, 0.5, v, v);
VectorSubtract (inflictor->s.origin, v, v);
points = damage - 0.5 * VectorLength (v);
//zucc reduce damage for crouching, max is 32 when standing
if (ent->maxs[2] < 20)
{
points = points * 0.5; // hefty reduction in damage
}
//if (ent == attacker)
//points = points * 0.5;
if (points > 0)
{
#ifdef _DEBUG
if (0 == Q_stricmp (ent->classname, "func_explosive"))
{
CGF_SFX_ShootBreakableGlass (ent, inflictor, 0, mod);
}
else
#endif
if (CanDamage (ent, inflictor))
{
VectorSubtract (ent->s.origin, inflictor->s.origin, dir);
// zucc scaled up knockback(kick) of grenades
T_Damage (ent, inflictor, attacker, dir, ent->s.origin,
vec3_origin, (int) (points * .75),
(int) (points * .75), DAMAGE_RADIUS, mod);
}
}
}
}
示例9: ai_melee
/*
=============
ai_melee
=============
*/
void ai_melee()
{
vec3_t delta;
float ldmg;
if ( !self->s.v.enemy )
return; // removed before stroke
VectorSubtract( PROG_TO_EDICT( self->s.v.enemy )->s.v.origin, self->s.v.origin, delta );
if ( vlen( delta ) > 60 )
return;
ldmg = ( g_random() + g_random() + g_random() ) * 3;
PROG_TO_EDICT( self->s.v.enemy )->deathtype = dtSQUISH; // FIXME
T_Damage( PROG_TO_EDICT( self->s.v.enemy ), self, self, ldmg );
}
示例10: CTFGrappleTouch
void CTFGrappleTouch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
float volume = 1.0;
if (other == self->owner)
return;
if (self->owner->client->ctf_grapplestate != CTF_GRAPPLE_STATE_FLY)
return;
if (surf && (surf->flags & SURF_SKY))
{
CTFResetGrapple(self);
return;
}
VectorCopy(vec3_origin, self->velocity);
PlayerNoise(self->owner, self->s.origin, PNOISE_IMPACT);
if (other->takedamage) {
T_Damage (other, self, self->owner, self->velocity, self->s.origin, plane->normal, self->dmg, 1, 0, MOD_GRAPPLE);
CTFResetGrapple(self);
return;
}
self->owner->client->ctf_grapplestate = CTF_GRAPPLE_STATE_PULL; // we're on hook
self->enemy = other;
self->solid = SOLID_NOT;
if (self->owner->client->silencer_shots)
volume = 0.2;
gi.sound (self->owner, CHAN_RELIABLE+CHAN_WEAPON, gi.soundindex("weapons/grapple/grpull.wav"), volume, ATTN_NORM, 0);
gi.sound (self, CHAN_WEAPON, gi.soundindex("weapons/grapple/grhit.wav"), volume, ATTN_NORM, 0);
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_SPARKS);
gi.WritePosition (self->s.origin);
if (!plane)
gi.WriteDir (vec3_origin);
else
gi.WriteDir (plane->normal);
gi.multicast (self->s.origin, MULTICAST_PVS);
}
示例11: abortHeal
void abortHeal (edict_t *self, qboolean change_frame, qboolean gib, qboolean mark)
{
int hurt;
static vec3_t pain_normal = { 0, 0, 1 };
// clean up target
cleanupHeal (self, change_frame);
// gib em!
if ((mark) && (self->enemy) && (self->enemy->inuse))
{
// if ((g_showlogic) && (g_showlogic->value))
// gi.dprintf ("%s - marking target as bad\n", self->classname);
// if the first badMedic slot is filled by a medic, skip it and use the second one
if ((self->enemy->monsterinfo.badMedic1) && (self->enemy->monsterinfo.badMedic1->inuse)
&& (!strncmp(self->enemy->monsterinfo.badMedic1->classname, "monster_medic", 13)) )
{
self->enemy->monsterinfo.badMedic2 = self;
}
else
{
self->enemy->monsterinfo.badMedic1 = self;
}
}
if ((gib) && (self->enemy) && (self->enemy->inuse))
{
// if ((g_showlogic) && (g_showlogic->value))
// gi.dprintf ("%s - gibbing bad heal target", self->classname);
if(self->enemy->gib_health)
hurt = - self->enemy->gib_health;
else
hurt = 500;
T_Damage (self->enemy, self, self, vec3_origin, self->enemy->s.origin,
pain_normal, hurt, 0, 0, MOD_UNKNOWN);
}
// clean up self
self->monsterinfo.aiflags &= ~AI_MEDIC;
if ((self->oldenemy) && (self->oldenemy->inuse))
self->enemy = self->oldenemy;
else
self->enemy = NULL;
self->monsterinfo.medicTries = 0;
}
示例12: plasma_touch
void
plasma_touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
{
vec3_t origin;
if (!ent || !other || !plane || !surf)
{
return;
}
if (other == ent->owner)
{
return;
}
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict(ent);
return;
}
if (ent->owner->client)
{
PlayerNoise(ent->owner, ent->s.origin, PNOISE_IMPACT);
}
/* calculate position for the explosion entity */
VectorMA(ent->s.origin, -0.02, ent->velocity, origin);
if (other->takedamage)
{
T_Damage(other, ent, ent->owner, ent->velocity, ent->s.origin,
plane->normal, ent->dmg, 0, 0, MOD_PHALANX);
}
T_RadiusDamage(ent, ent->owner, ent->radius_dmg, other,
ent->dmg_radius, MOD_PHALANX);
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_PLASMA_EXPLOSION);
gi.WritePosition(origin);
gi.multicast(ent->s.origin, MULTICAST_PVS);
G_FreeEdict(ent);
}
示例13: mutant_jump_touch
void
mutant_jump_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */,
csurface_t *surf /* unused */)
{
if (!self || !other)
{
return;
}
if (self->health <= 0)
{
self->touch = NULL;
return;
}
if (other->takedamage)
{
if (VectorLength(self->velocity) > 400)
{
vec3_t point;
vec3_t normal;
int damage;
VectorCopy(self->velocity, normal);
VectorNormalize(normal);
VectorMA(self->s.origin, self->maxs[0], normal, point);
damage = 40 + 10 * random();
T_Damage(other, self, self, self->velocity, point,
normal, damage, damage, 0, MOD_UNKNOWN);
}
}
if (!M_CheckBottom(self))
{
if (self->groundentity)
{
self->monsterinfo.nextframe = FRAME_attack02;
self->touch = NULL;
}
return;
}
self->touch = NULL;
}
示例14: flyer_kamikaze_explode
void flyer_kamikaze_explode (edict_t *self)
{
vec3_t dir;
if (self->monsterinfo.commander && self->monsterinfo.commander->inuse &&
!strcmp(self->monsterinfo.commander->classname, "monster_carrier"))
{
self->monsterinfo.commander->monsterinfo.monster_slots++;
}
if (self->enemy)
{
VectorSubtract (self->enemy->s.origin, self->s.origin, dir);
T_Damage (self->enemy, self, self, dir, self->s.origin, vec3_origin, (int)50, (int)50, DAMAGE_RADIUS, MOD_UNKNOWN);
}
flyer_die (self, NULL, NULL, 0, dir);
}
示例15: KillChildren
void KillChildren (edict_t *self)
{
edict_t *ent;
int field;
ent = NULL;
field = FOFS(classname);
while (1)
{
ent = G_Find (ent, field, "monster_stalker");
if(!ent)
return;
// FIXME - may need to stagger
if ((ent->inuse) && (ent->health > 0))
T_Damage (ent, self, self, vec3_origin, self->enemy->s.origin, vec3_origin, (ent->health + 1), 0, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN);
}
}