#include "g_local.h"
Include dependency graph for g_missile.c:

Go to the source code of this file.
Defines | |
| #define | MISSILE_PRESTEP_TIME 50 |
Functions | |
| gentity_t * | fire_bfg (gentity_t *self, vec3_t start, vec3_t dir) |
| gentity_t * | fire_grapple (gentity_t *self, vec3_t start, vec3_t dir) |
| gentity_t * | fire_grenade (gentity_t *self, vec3_t start, vec3_t dir) |
| gentity_t * | fire_plasma (gentity_t *self, vec3_t start, vec3_t dir) |
| gentity_t * | fire_rocket (gentity_t *self, vec3_t start, vec3_t dir) |
| void | G_BounceMissile (gentity_t *ent, trace_t *trace) |
| void | G_ExplodeMissile (gentity_t *ent) |
| void | G_MissileImpact (gentity_t *ent, trace_t *trace) |
| void | G_RunMissile (gentity_t *ent) |
|
|
Definition at line 25 of file g_missile.c. |
|
||||||||||||||||
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 681 of file g_missile.c. References gentity_s::classname, gentity_s::clipmask, entityShared_t::currentOrigin, entityState_s::eType, G_Spawn(), gentity_t, level, gentity_s::methodOfDeath, gentity_s::nextthink, entityState_s::number, entityState_s::otherEntityNum, entityShared_t::ownerNum, gentity_s::parent, entityState_s::pos, gentity_s::r, entityShared_t::s, gentity_s::s, SnapVector, entityShared_t::svFlags, gentity_s::target_ent, gentity_s::think, level_locals_t::time, trajectory_t::trBase, trajectory_t::trDelta, trajectory_t::trTime, trajectory_t::trType, VectorCopy, VectorNormalize(), VectorScale, and entityState_s::weapon. Referenced by Weapon_GrapplingHook_Fire(). 00681 {
00682 gentity_t *hook;
00683
00684 VectorNormalize (dir);
00685
00686 hook = G_Spawn();
00687 hook->classname = "hook";
00688 hook->nextthink = level.time + 10000;
00689 hook->think = Weapon_HookFree;
00690 hook->s.eType = ET_MISSILE;
00691 hook->r.svFlags = SVF_USE_CURRENT_ORIGIN;
00692 hook->s.weapon = WP_GRAPPLING_HOOK;
00693 hook->r.ownerNum = self->s.number;
00694 hook->methodOfDeath = MOD_GRAPPLE;
00695 hook->clipmask = MASK_SHOT;
00696 hook->parent = self;
00697 hook->target_ent = NULL;
00698
00699 hook->s.pos.trType = TR_LINEAR;
00700 hook->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame
00701 hook->s.otherEntityNum = self->s.number; // use to match beam in client
00702 VectorCopy( start, hook->s.pos.trBase );
00703 VectorScale( dir, 800, hook->s.pos.trDelta );
00704 SnapVector( hook->s.pos.trDelta ); // save net bandwidth
00705 VectorCopy (start, hook->r.currentOrigin);
00706
00707 self->client->hook = hook;
00708
00709 return hook;
00710 }
|
Here is the call graph for this function:

|
||||||||||||||||
Here is the call graph for this function:

|
||||||||||||||||
Here is the call graph for this function:

|
||||||||||||||||
Here is the call graph for this function:

|
||||||||||||
Here is the call graph for this function:

|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 269 of file g_missile.c. References gclient_s::accuracy_hits, entityState_s::angles, BG_EvaluateTrajectoryDelta(), gentity_s::classname, gentity_s::client, entityShared_t::currentOrigin, gentity_s::damage, gentity_s::die, DirToByte(), EF_BOUNCE, entityState_s::eFlags, trace_t::endpos, gentity_s::enemy, trace_t::entityNum, ET_PLAYER, entityState_s::eType, EV_GRENADE_BOUNCE, EV_MISSILE_HIT, EV_MISSILE_MISS, EV_MISSILE_MISS_METAL, EV_PROXIMITY_MINE_STICK, gentity_s::freeAfterEvent, G_AddEvent(), G_BounceMissile(), G_Damage(), g_entities, G_InvulnerabilityEffect(), G_RadiusDamage(), G_SetOrigin(), G_Spawn(), gentity_t, playerState_s::grapplePoint, gentity_s::health, level, LogAccuracyHit(), entityShared_t::maxs, gentity_s::methodOfDeath, entityShared_t::mins, gentity_s::movedir, gentity_s::nextthink, cplane_s::normal, entityState_s::number, entityState_s::origin, entityState_s::otherEntityNum, entityShared_t::ownerNum, gentity_s::parent, trace_t::plane, playerState_s::pm_flags, entityState_s::pos, gclient_s::ps, qboolean, gentity_s::r, gentity_s::s, SnapVectorTowards(), gentity_s::splashDamage, gentity_s::splashMethodOfDeath, gentity_s::splashRadius, strcmp(), trace_t::surfaceFlags, gentity_s::takedamage, gentity_s::target_ent, gentity_s::think, level_locals_t::time, trap_LinkEntity(), trajectory_t::trBase, trajectory_t::trDelta, trajectory_t::trType, v, vec3_t, vectoangles(), VectorClear, VectorCopy, VectorLength(), VectorNormalize(), VectorSet, and entityState_s::weapon. Referenced by G_RunMissile(). 00269 {
00270 gentity_t *other;
00271 qboolean hitClient = qfalse;
00272 #ifdef MISSIONPACK
00273 vec3_t forward, impactpoint, bouncedir;
00274 int eFlags;
00275 #endif
00276 other = &g_entities[trace->entityNum];
00277
00278 // check for bounce
00279 if ( !other->takedamage &&
00280 ( ent->s.eFlags & ( EF_BOUNCE | EF_BOUNCE_HALF ) ) ) {
00281 G_BounceMissile( ent, trace );
00282 G_AddEvent( ent, EV_GRENADE_BOUNCE, 0 );
00283 return;
00284 }
00285
00286 #ifdef MISSIONPACK
00287 if ( other->takedamage ) {
00288 if ( ent->s.weapon != WP_PROX_LAUNCHER ) {
00289 if ( other->client && other->client->invulnerabilityTime > level.time ) {
00290 //
00291 VectorCopy( ent->s.pos.trDelta, forward );
00292 VectorNormalize( forward );
00293 if (G_InvulnerabilityEffect( other, forward, ent->s.pos.trBase, impactpoint, bouncedir )) {
00294 VectorCopy( bouncedir, trace->plane.normal );
00295 eFlags = ent->s.eFlags & EF_BOUNCE_HALF;
00296 ent->s.eFlags &= ~EF_BOUNCE_HALF;
00297 G_BounceMissile( ent, trace );
00298 ent->s.eFlags |= eFlags;
00299 }
00300 ent->target_ent = other;
00301 return;
00302 }
00303 }
00304 }
00305 #endif
00306 // impact damage
00307 if (other->takedamage) {
00308 // FIXME: wrong damage direction?
00309 if ( ent->damage ) {
00310 vec3_t velocity;
00311
00312 if( LogAccuracyHit( other, &g_entities[ent->r.ownerNum] ) ) {
00313 g_entities[ent->r.ownerNum].client->accuracy_hits++;
00314 hitClient = qtrue;
00315 }
00316 BG_EvaluateTrajectoryDelta( &ent->s.pos, level.time, velocity );
00317 if ( VectorLength( velocity ) == 0 ) {
00318 velocity[2] = 1; // stepped on a grenade
00319 }
00320 G_Damage (other, ent, &g_entities[ent->r.ownerNum], velocity,
00321 ent->s.origin, ent->damage,
00322 0, ent->methodOfDeath);
00323 }
00324 }
00325
00326 #ifdef MISSIONPACK
00327 if( ent->s.weapon == WP_PROX_LAUNCHER ) {
00328 if( ent->s.pos.trType != TR_GRAVITY ) {
00329 return;
00330 }
00331
00332 // if it's a player, stick it on to them (flag them and remove this entity)
00333 if( other->s.eType == ET_PLAYER && other->health > 0 ) {
00334 ProximityMine_Player( ent, other );
00335 return;
00336 }
00337
00338 SnapVectorTowards( trace->endpos, ent->s.pos.trBase );
00339 G_SetOrigin( ent, trace->endpos );
00340 ent->s.pos.trType = TR_STATIONARY;
00341 VectorClear( ent->s.pos.trDelta );
00342
00343 G_AddEvent( ent, EV_PROXIMITY_MINE_STICK, trace->surfaceFlags );
00344
00345 ent->think = ProximityMine_Activate;
00346 ent->nextthink = level.time + 2000;
00347
00348 vectoangles( trace->plane.normal, ent->s.angles );
00349 ent->s.angles[0] += 90;
00350
00351 // link the prox mine to the other entity
00352 ent->enemy = other;
00353 ent->die = ProximityMine_Die;
00354 VectorCopy(trace->plane.normal, ent->movedir);
00355 VectorSet(ent->r.mins, -4, -4, -4);
00356 VectorSet(ent->r.maxs, 4, 4, 4);
00357 trap_LinkEntity(ent);
00358
00359 return;
00360 }
00361 #endif
00362
00363 if (!strcmp(ent->classname, "hook")) {
00364 gentity_t *nent;
00365 vec3_t v;
00366
00367 nent = G_Spawn();
00368 if ( other->takedamage && other->client ) {
00369
00370 G_AddEvent( nent, EV_MISSILE_HIT, DirToByte( trace->plane.normal ) );
00371 nent->s.otherEntityNum = other->s.number;
00372
00373 ent->enemy = other;
00374
00375 v[0] = other->r.currentOrigin[0] + (other->r.mins[0] + other->r.maxs[0]) * 0.5;
00376 v[1] = other->r.currentOrigin[1] + (other->r.mins[1] + other->r.maxs[1]) * 0.5;
00377 v[2] = other->r.currentOrigin[2] + (other->r.mins[2] + other->r.maxs[2]) * 0.5;
00378
00379 SnapVectorTowards( v, ent->s.pos.trBase ); // save net bandwidth
00380 } else {
00381 VectorCopy(trace->endpos, v);
00382 G_AddEvent( nent, EV_MISSILE_MISS, DirToByte( trace->plane.normal ) );
00383 ent->enemy = NULL;
00384 }
00385
00386 SnapVectorTowards( v, ent->s.pos.trBase ); // save net bandwidth
00387
00388 nent->freeAfterEvent = qtrue;
00389 // change over to a normal entity right at the point of impact
00390 nent->s.eType = ET_GENERAL;
00391 ent->s.eType = ET_GRAPPLE;
00392
00393 G_SetOrigin( ent, v );
00394 G_SetOrigin( nent, v );
00395
00396 ent->think = Weapon_HookThink;
00397 ent->nextthink = level.time + FRAMETIME;
00398
00399 ent->parent->client->ps.pm_flags |= PMF_GRAPPLE_PULL;
00400 VectorCopy( ent->r.currentOrigin, ent->parent->client->ps.grapplePoint);
00401
00402 trap_LinkEntity( ent );
00403 trap_LinkEntity( nent );
00404
00405 return;
00406 }
00407
00408 // is it cheaper in bandwidth to just remove this ent and create a new
00409 // one, rather than changing the missile into the explosion?
00410
00411 if ( other->takedamage && other->client ) {
00412 G_AddEvent( ent, EV_MISSILE_HIT, DirToByte( trace->plane.normal ) );
00413 ent->s.otherEntityNum = other->s.number;
00414 } else if( trace->surfaceFlags & SURF_METALSTEPS ) {
00415 G_AddEvent( ent, EV_MISSILE_MISS_METAL, DirToByte( trace->plane.normal ) );
00416 } else {
00417 G_AddEvent( ent, EV_MISSILE_MISS, DirToByte( trace->plane.normal ) );
00418 }
00419
00420 ent->freeAfterEvent = qtrue;
00421
00422 // change over to a normal entity right at the point of impact
00423 ent->s.eType = ET_GENERAL;
00424
00425 SnapVectorTowards( trace->endpos, ent->s.pos.trBase ); // save net bandwidth
00426
00427 G_SetOrigin( ent, trace->endpos );
00428
00429 // splash damage (doesn't apply to person directly hit)
00430 if ( ent->splashDamage ) {
00431 if( G_RadiusDamage( trace->endpos, ent->parent, ent->splashDamage, ent->splashRadius,
00432 other, ent->splashMethodOfDeath ) ) {
00433 if( !hitClient ) {
00434 g_entities[ent->r.ownerNum].client->accuracy_hits++;
00435 }
00436 }
00437 }
00438
00439 trap_LinkEntity( ent );
00440 }
|
Here is the call graph for this function:

|
|
Definition at line 447 of file g_missile.c. References BG_EvaluateTrajectory(), gentity_s::client, gentity_s::clipmask, gentity_s::count, entityShared_t::currentOrigin, ENTITYNUM_NONE, entityState_s::eType, G_FreeEntity(), G_MissileImpact(), G_RunThink(), gentity_t, gclient_s::hook, level, entityShared_t::maxs, entityShared_t::mins, entityState_s::number, entityShared_t::ownerNum, gentity_s::parent, entityState_s::pos, gentity_s::r, gentity_s::s, gentity_s::target_ent, level_locals_t::time, tr, trap_LinkEntity(), trap_Trace(), vec3_t, VectorCopy, and entityState_s::weapon. Referenced by G_RunFrame(). 00447 {
00448 vec3_t origin;
00449 trace_t tr;
00450 int passent;
00451
00452 // get current position
00453 BG_EvaluateTrajectory( &ent->s.pos, level.time, origin );
00454
00455 // if this missile bounced off an invulnerability sphere
00456 if ( ent->target_ent ) {
00457 passent = ent->target_ent->s.number;
00458 }
00459 #ifdef MISSIONPACK
00460 // prox mines that left the owner bbox will attach to anything, even the owner
00461 else if (ent->s.weapon == WP_PROX_LAUNCHER && ent->count) {
00462 passent = ENTITYNUM_NONE;
00463 }
00464 #endif
00465 else {
00466 // ignore interactions with the missile owner
00467 passent = ent->r.ownerNum;
00468 }
00469 // trace a line from the previous position to the current position
00470 trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, origin, passent, ent->clipmask );
00471
00472 if ( tr.startsolid || tr.allsolid ) {
00473 // make sure the tr.entityNum is set to the entity we're stuck in
00474 trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, ent->r.currentOrigin, passent, ent->clipmask );
00475 tr.fraction = 0;
00476 }
00477 else {
00478 VectorCopy( tr.endpos, ent->r.currentOrigin );
00479 }
00480
00481 trap_LinkEntity( ent );
00482
00483 if ( tr.fraction != 1 ) {
00484 // never explode or bounce on sky
00485 if ( tr.surfaceFlags & SURF_NOIMPACT ) {
00486 // If grapple, reset owner
00487 if (ent->parent && ent->parent->client && ent->parent->client->hook == ent) {
00488 ent->parent->client->hook = NULL;
00489 }
00490 G_FreeEntity( ent );
00491 return;
00492 }
00493 G_MissileImpact( ent, &tr );
00494 if ( ent->s.eType != ET_MISSILE ) {
00495 return; // exploded
00496 }
00497 }
00498 #ifdef MISSIONPACK
00499 // if the prox mine wasn't yet outside the player body
00500 if (ent->s.weapon == WP_PROX_LAUNCHER && !ent->count) {
00501 // check if the prox mine is outside the owner bbox
00502 trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, ent->r.currentOrigin, ENTITYNUM_NONE, ent->clipmask );
00503 if (!tr.startsolid || tr.entityNum != ent->r.ownerNum) {
00504 ent->count = 1;
00505 }
00506 }
00507 #endif
00508 // check think function after bouncing
00509 G_RunThink( ent );
00510 }
|
Here is the call graph for this function:

1.3.9.1