本文整理汇总了C++中T_RadiusDamage函数的典型用法代码示例。如果您正苦于以下问题:C++ T_RadiusDamage函数的具体用法?C++ T_RadiusDamage怎么用?C++ T_RadiusDamage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了T_RadiusDamage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mass
/*QUAKED func_explosive (0 .5 .8) ? Trigger_Spawn ANIMATED ANIMATED_FAST
Any brush that you want to explode or break apart. If you want an
ex0plosion, set dmg and it will do a radius explosion of that amount
at the center of the bursh.
If targeted it will not be shootable.
health defaults to 100.
mass defaults to 75. This determines how much debris is emitted when
it explodes. You get one large chunk per 100 of mass (up to 8) and
one small chunk per 25 of mass (up to 16). So 800 gives the most.
*/
void func_explosive_explode(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
vec3_t origin;
vec3_t chunkorigin;
vec3_t size;
int count;
int mass;
// bmodel origins are (0 0 0), we need to adjust that here
VectorScale(self->size, 0.5f, size);
VectorAdd(self->absmin, size, origin);
VectorCopy(origin, self->s.origin);
self->takedamage = DAMAGE_NO;
if (self->dmg)
T_RadiusDamage(self, attacker, self->dmg, NULL, self->dmg + 40, MOD_EXPLOSIVE);
VectorSubtract(self->s.origin, inflictor->s.origin, self->velocity);
VectorNormalize(self->velocity);
VectorScale(self->velocity, 150, self->velocity);
// start chunks towards the center
VectorScale(size, 0.5f, size);
mass = self->mass;
if (!mass)
mass = 75;
// big chunks
if (mass >= 100) {
count = mass / 100;
if (count > 8)
count = 8;
while (count--) {
chunkorigin[0] = origin[0] + crandom() * size[0];
chunkorigin[1] = origin[1] + crandom() * size[1];
chunkorigin[2] = origin[2] + crandom() * size[2];
ThrowDebris(self, "models/objects/debris1/tris.md2", 1, chunkorigin);
}
}
// small chunks
count = mass / 25;
if (count > 16)
count = 16;
while (count--) {
chunkorigin[0] = origin[0] + crandom() * size[0];
chunkorigin[1] = origin[1] + crandom() * size[1];
chunkorigin[2] = origin[2] + crandom() * size[2];
ThrowDebris(self, "models/objects/debris2/tris.md2", 2, chunkorigin);
}
G_UseTargets(self, attacker);
if (self->dmg)
BecomeExplosion1(self);
else
G_FreeEdict(self);
}
示例2: Plasmaball_Explode
void Plasmaball_Explode (edict_t *ent)
{
//FIXME: if we are onground then raise our Z just a bit since we are a point?
if (ent->enemy)
{
float points;
vec3_t v;
vec3_t dir;
VectorAdd (ent->enemy->mins, ent->enemy->maxs, v);
VectorMA (ent->enemy->s.origin, 0.5, v, v);
VectorSubtract (ent->s.origin, v, v);
points = ent->dmg - 0.5 * VectorLength (v);
VectorSubtract (ent->enemy->s.origin, ent->s.origin, dir);
T_Damage (ent->enemy, ent, ent->owner, dir, ent->s.origin, vec3_origin, (int)points, (int)points, DAMAGE_RADIUS, MOD_UNKNOWN);
}
T_RadiusDamage(ent, ent->owner, ent->dmg, ent->enemy, ent->dmg_radius, MOD_UNKNOWN);
VectorMA (ent->s.origin, -0.02, ent->velocity, ent->s.origin);
VectorClear(ent->velocity);
ent->movetype = MOVETYPE_NONE;
ent->s.modelindex = gi.modelindex("models/objects/b_explode/tris.md2");
ent->s.effects &= ~EF_BFG & ~EF_ANIM_ALLFAST;
ent->s.frame = 0;
ent->s.skinnum = 6;
// ent->s.renderfx = RF_TRANSLUCENT | RF_FULLBRIGHT;
// ent->s.renderfx = RF_TRANSLUCENT;
gi.sound (ent, CHAN_AUTO, sound_plamsaballexplode, 1, ATTN_NORM, 0);
ent->think = PlasmaballBlastAnim;
ent->nextthink = level.time + FRAMETIME;
}
示例3: monster_autocannon_explode
void monster_autocannon_explode (edict_t *ent)
{
vec3_t origin;
T_RadiusDamage(ent, ent, AC_EXPLODE_DMG, ent->enemy, AC_EXPLODE_RADIUS, MOD_TRIPBOMB);
VectorMA (ent->s.origin, -0.02, ent->velocity, origin);
gi.WriteByte (svc_temp_entity);
if (ent->waterlevel)
{
if (ent->groundentity)
gi.WriteByte (TE_GRENADE_EXPLOSION_WATER);
else
gi.WriteByte (TE_ROCKET_EXPLOSION_WATER);
}
else
{
if (ent->groundentity)
gi.WriteByte (TE_GRENADE_EXPLOSION);
else
gi.WriteByte (TE_ROCKET_EXPLOSION);
}
gi.WritePosition (origin);
gi.multicast (ent->s.origin, MULTICAST_PHS);
// set the pain skin
ent->chain->chain->s.skinnum = 1; // pain
ent->chain->chain->rideWith[0] = NULL;
ent->chain->chain->rideWith[1] = NULL;
G_FreeEdict(ent->chain);
G_FreeEdict(ent);
}
示例4: plasma_touch
void plasma_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
{
vec3_t origin;
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);
}
示例5: bfg_touch
void bfg_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
if (other == self->owner)
return;
if (surf && (surf->flags & SURF_SKY)) {
G_FreeEdict(self);
return;
}
// core explosion - prevents firing it into the wall/floor
if (other->takedamage)
T_Damage(other, self, self->owner, self->velocity, self->s.origin, plane->normal, 200, 0, 0, MOD_BFG_BLAST);
T_RadiusDamage(self, self->owner, 200, other, 100, MOD_BFG_BLAST);
gi.sound(self, CHAN_VOICE, gi.soundindex("weapons/bfg__x1b.wav"), 1, ATTN_NORM, 0);
self->solid = SOLID_NOT;
self->touch = NULL;
VectorMA(self->s.origin, -1 * FRAMETIME, self->velocity, self->s.origin);
VectorClear(self->velocity);
self->s.modelindex = gi.modelindex("sprites/s_bfg3.sp2");
self->s.frame = 0;
self->s.sound = 0;
self->s.effects &= ~EF_ANIM_ALLFAST;
NEXT_KEYFRAME(self, bfg_explode);
self->enemy = other;
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_BFG_BIGEXPLOSION);
gi.WritePosition(self->s.origin);
gi.multicast(self->s.origin, MULTICAST_PVS);
}
示例6: Pipe_Think
/* ** wicked ** fire_pipebomb declaration*
=================
fire_pipebomb
=================
*/
void Pipe_Think (edict_t *ent)
{
vec3_t origin;
int mod;
if (ent->owner->client)
PlayerNoise(ent->owner, ent->s.origin, PNOISE_IMPACT);
//FIXME: if we are onground then raise our Z just a bit since we are a point?
if (ent->enemy)
{
float points;
vec3_t v;
vec3_t dir;
VectorAdd (ent->enemy->mins, ent->enemy->maxs, v);
VectorMA (ent->enemy->s.origin, 0.5, v, v);
VectorSubtract (ent->s.origin, v, v);
points = ent->dmg - 0.5 * VectorLength (v);
VectorSubtract (ent->enemy->s.origin, ent->s.origin, dir);
if (ent->spawnflags & 1)
mod = MOD_HANDGRENADE;
else
mod = MOD_GRENADE;
T_Damage (ent->enemy, ent, ent->owner, dir, ent->s.origin, vec3_origin, (int)points, (int)points, DAMAGE_RADIUS, mod);
}
if (ent->spawnflags & 2)
mod = MOD_HELD_GRENADE;
else if (ent->spawnflags & 1)
mod = MOD_HG_SPLASH;
else
mod = MOD_PIPE_SPLASH;
T_RadiusDamage(ent, ent->owner, ent->dmg, ent->enemy, ent->dmg_radius, mod);
VectorMA (ent->s.origin, -0.02, ent->velocity, origin);
gi.WriteByte (svc_temp_entity);
if (ent->waterlevel)
{
if (ent->groundentity)
gi.WriteByte (TE_GRENADE_EXPLOSION_WATER);
else
gi.WriteByte (TE_ROCKET_EXPLOSION_WATER);
}
else
{
if (ent->groundentity)
gi.WriteByte (TE_GRENADE_EXPLOSION);
else
gi.WriteByte (TE_ROCKET_EXPLOSION);
}
gi.WritePosition (origin);
gi.multicast (ent->s.origin, MULTICAST_PHS);
G_FreeEdict (ent);
}
示例7: misc_viper_bomb_touch
/*QUAKED misc_viper_bomb (1 0 0) (-8 -8 -8) (8 8 8)
"dmg" how much boom should the bomb make?
*/
void misc_viper_bomb_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
G_UseTargets (self, self->activator);
self->s.origin[2] = self->absmin[2] + 1;
T_RadiusDamage (self, self, self->dmg, NULL, self->dmg+40, MOD_BOMB);
BecomeExplosion2 (self);
}
示例8: Cluster_Spread2
/* ** wicked ** Cluster Spread2 *
=================
Cluster Spread2
divide the new cluster into 5 clusters again
=================
*/
void Cluster_Spread2 (edict_t *ent)
{
vec3_t origin;
int mod;
//Sean added these 4 vectors
vec3_t grenade1;
vec3_t grenade2;
vec3_t grenade3;
vec3_t grenade4;
vec3_t grenade5;
mod = MOD_CLUSTER;
if (ent->owner->client)
PlayerNoise(ent->owner, ent->s.origin, PNOISE_IMPACT);
//FIXME: if we are onground then raise our Z just a bit since we are a point?
T_RadiusDamage(ent, ent->owner, ent->dmg, NULL, ent->dmg_radius, mod);
VectorMA (ent->s.origin, -0.02, ent->velocity, origin);
gi.WriteByte (svc_temp_entity);
if (ent->waterlevel)
{
if (ent->groundentity)
gi.WriteByte (TE_GRENADE_EXPLOSION_WATER);
else
gi.WriteByte (TE_ROCKET_EXPLOSION_WATER);
}
else
{
if (ent->groundentity)
gi.WriteByte (TE_GRENADE_EXPLOSION);
else
gi.WriteByte (TE_ROCKET_EXPLOSION);
}
gi.WritePosition (origin);
gi.multicast (ent->s.origin, MULTICAST_PVS);
// SumFuka did this bit : give grenades up/outwards velocities
//VectorSet(grenade1, 10, 20, 0);
VectorSet(grenade1, 30, 0, 30);
VectorSet(grenade2, 0,-30, 30);
VectorSet(grenade3,-30, 0, 30);
VectorSet(grenade4, 0, 30, 30);
VectorSet(grenade5, 0, 0, 30);
// Sean : explode the four grenades outwards
fire_cluster3(ent, origin, grenade1, 80, 8, 1.0, 120);
fire_cluster3(ent, origin, grenade2, 80, 8, 1.0, 120);
fire_cluster3(ent, origin, grenade3, 80, 8, 1.0, 120);
fire_cluster3(ent, origin, grenade4, 80, 8, 1.0, 120);
fire_cluster3(ent, origin, grenade5, 100, 0, 1.0, 150);
G_FreeEdict (ent);
}
示例9: fake_flyer_touch
//mxd
void fake_flyer_touch(edict_t *self, edict_t *other, cplane_t* p, csurface_t* s)
{
// Ingnore baaad touches and tracers...
if (strcmp(other->classname, "freed") != 0 && strcmp(other->classname, "tracer") != 0)
{
T_RadiusDamage(self, self, 45 + 5 * skill->value, NULL, 128 + 16 * skill->value, MOD_EXPLOSIVE, -2.0 / (4.0 + skill->value));
flyer_spawn_gibs(self, self->dmg); // Removes self, must be called last
}
}
示例10: supplystation_explode
void supplystation_explode (edict_t *self, char *message)
{
if (self->creator && self->creator->inuse)
{
safe_cprintf(self->creator, PRINT_HIGH, message);
self->creator->supplystation = NULL;
T_RadiusDamage(self, self->creator, 150, self, 150, MOD_SUPPLYSTATION);
}
BecomeExplosion1(self);
}
示例11: Cmd_Nova_f
void Cmd_Nova_f (edict_t *ent, int frostLevel, float skill_mult, float cost_mult)
{
int damage, cost=NOVA_COST*cost_mult;
if (!G_CanUseAbilities(ent, ent->myskills.abilities[NOVA].current_level, cost))
return;
if (ent->myskills.abilities[NOVA].disable)
return;
damage = (NOVA_DEFAULT_DAMAGE+NOVA_ADDON_DAMAGE*ent->myskills.abilities[NOVA].current_level)*skill_mult;
T_RadiusDamage(ent, ent, damage, ent, NOVA_RADIUS, MOD_NOVA);
//Talent: Frost Nova
if(frostLevel > 0)
{
edict_t *target = NULL;
while ((target = findradius(target, ent->s.origin, FROSTNOVA_RADIUS)) != NULL)
{
if (target == ent)
continue;
if (!target->takedamage)
continue;
if (!visible1(ent, target))
continue;
//curse with holyfreeze
target->chill_level = 2 * frostLevel;
target->chill_time = level.time + 3.0; //3 second duration
if (random() > 0.5)
gi.sound(target, CHAN_ITEM, gi.soundindex("spells/blue1.wav"), 1, ATTN_NORM, 0);
else
gi.sound(target, CHAN_ITEM, gi.soundindex("spells/blue3.wav"), 1, ATTN_NORM, 0);
}
}
// write a nice effect so everyone knows we've cast a spell
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_TELEPORT_EFFECT);
gi.WritePosition (ent->s.origin);
gi.multicast (ent->s.origin, MULTICAST_PVS);
NovaExplosionEffect(ent->s.origin);
gi.sound (ent, CHAN_WEAPON, gi.soundindex("spells/novaelec.wav"), 1, ATTN_NORM, 0);
ent->client->ability_delay = level.time + NOVA_DELAY/* * cost_mult*/;
ent->client->pers.inventory[power_cube_index] -= cost;
// calling entity made a sound, used to alert monsters
ent->lastsound = level.framenum;
}
示例12: flyer_kamikaze_explode
//mxd. ROGUE - kamikaze stuff
void flyer_kamikaze_explode(edict_t *self)
{
vec3_t dir;
if (self->enemy)
{
VectorSubtract(self->enemy->s.origin, self->s.origin, dir);
T_RadiusDamage(self, self, 45 + 5 * skill->value, NULL, 128 + 16 * skill->value, MOD_EXPLOSIVE, -2.0 / (4.0 + skill->value)); //mxd. We can explode when stuck, so no direct damage to the target
}
flyer_die(self, NULL, NULL, 0, dir);
}
示例13: bfg_touch
void
bfg_touch ( edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf )
{
if ( !self || !other ) {
G_FreeEdict ( self );
return;
}
if ( other == self->owner ) {
return;
}
if ( surf && ( surf->flags & SURF_SKY ) ) {
G_FreeEdict ( self );
return;
}
if ( self->owner && self->owner->client ) {
PlayerNoise ( self->owner, self->s.origin, PNOISE_IMPACT );
}
/* core explosion - prevents firing it into the wall/floor */
if ( other->takedamage ) {
if ( plane ) {
T_Damage ( other, self, self->owner, self->velocity, self->s.origin,
plane->normal, 200, 0, 0, MOD_BFG_BLAST );
} else {
T_Damage ( other, self, self->owner, self->velocity, self->s.origin,
vec3_origin, 200, 0, 0, MOD_BFG_BLAST );
}
}
T_RadiusDamage ( self, self->owner, 200, other, 100, MOD_BFG_BLAST );
gi.sound ( self, CHAN_VOICE, gi.soundindex (
"weapons/bfg__x1b.wav" ), 1, ATTN_NORM, 0 );
self->solid = SOLID_NOT;
self->touch = NULL;
VectorMA ( self->s.origin, -1 * FRAMETIME, self->velocity, self->s.origin );
VectorClear ( self->velocity );
self->s.modelindex = gi.modelindex ( "sprites/s_bfg3.sp2" );
self->s.frame = 0;
self->s.sound = 0;
self->s.effects &= ~EF_ANIM_ALLFAST;
self->think = bfg_explode;
self->nextthink = level.time + FRAMETIME;
self->enemy = other;
gi.WriteByte ( svc_temp_entity );
gi.WriteByte ( TE_BFG_BIGEXPLOSION );
gi.WritePosition ( self->s.origin );
gi.multicast ( self->s.origin, MULTICAST_PVS );
}
示例14: sphere_touch
void
sphere_touch(edict_t *self, edict_t *other, cplane_t *plane,
csurface_t *surf, int mod)
{
if (!self || !other || !plane || !surf)
{
return;
}
if (self->spawnflags & SPHERE_DOPPLEGANGER)
{
if (other == self->teammaster)
{
return;
}
self->takedamage = DAMAGE_NO;
self->owner = self->teammaster;
self->teammaster = NULL;
}
else
{
if (other == self->owner)
{
return;
}
/* Don't blow up on bodies */
if (!strcmp(other->classname, "bodyque"))
{
return;
}
}
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict(self);
return;
}
if (other->takedamage)
{
T_Damage(other, self, self->owner, self->velocity, self->s.origin,
plane->normal, 10000, 1, DAMAGE_DESTROY_ARMOR, mod);
}
else
{
T_RadiusDamage(self, self->owner, 512, self->owner, 256, mod);
}
sphere_think_explode(self);
}
示例15: rocket_touch
/*
=================
fire_rocket
=================
*/
void rocket_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
{
vec3_t origin;
int n;
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);
fire_grenade3 (ent, ent->s.origin, ent->s.origin, 150, 0, 2.5, 200);
if (other->takedamage)
{
T_Damage (other, ent, ent->owner, ent->velocity, ent->s.origin, plane->normal, ent->dmg, 0, 0, MOD_ROCKET);
}
else
{
// don't throw any debris in net games
if (!deathmatch->value && !coop->value)
{
if ((surf) && !(surf->flags & (SURF_WARP|SURF_TRANS33|SURF_TRANS66|SURF_FLOWING)))
{
n = rand() % 5;
while(n--)
ThrowDebris (ent, "models/objects/debris2/tris.md2", 2, ent->s.origin);
}
}
}
T_RadiusDamage(ent, ent->owner, ent->radius_dmg, other, ent->dmg_radius, MOD_R_SPLASH);
gi.WriteByte (svc_temp_entity);
if (ent->waterlevel)
gi.WriteByte (TE_ROCKET_EXPLOSION_WATER);
else
gi.WriteByte (TE_ROCKET_EXPLOSION);
gi.WritePosition (origin);
gi.multicast (ent->s.origin, MULTICAST_PHS);
G_FreeEdict (ent);
}