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

Go to the source code of this file.
|
|
Definition at line 263 of file g_weapon.c. Referenced by ShotgunPellet(). |
|
|
Definition at line 156 of file g_weapon.c. Referenced by FireWeapon(). |
|
|
Definition at line 155 of file g_weapon.c. Referenced by FireWeapon(). |
|
|
Definition at line 157 of file g_weapon.c. Referenced by FireWeapon(). |
|
|
Definition at line 440 of file g_weapon.c. |
|
|
Definition at line 32 of file g_weapon.c. |
|
|
Definition at line 242 of file g_weapon.c. References gentity_s::damage, fire_bfg(), forward, gentity_t, m, muzzle, and gentity_s::splashDamage. Referenced by FireWeapon(). 00242 {
00243 gentity_t *m;
00244
00245 m = fire_bfg (ent, muzzle, forward);
00246 m->damage *= s_quadFactor;
00247 m->splashDamage *= s_quadFactor;
00248
00249 // VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
00250 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 159 of file g_weapon.c. References gclient_s::accuracy_hits, gentity_s::client, cos(), crandom, DirToByte(), EV_BULLET_HIT_FLESH, EV_BULLET_HIT_WALL, entityState_s::eventParm, forward, G_BounceProjectile(), G_Damage(), g_entities, G_InvulnerabilityEffect(), G_TempEntity(), gentity_t, i, level, LogAccuracyHit(), M_PI, MASK_SHOT, MOD_MACHINEGUN, muzzle, NULL, entityState_s::number, entityState_s::otherEntityNum, r, random, right, gentity_s::s, sin(), SnapVectorTowards(), gentity_s::takedamage, level_locals_t::time, tr, trap_Trace(), up, vec3_t, VectorCopy, and VectorMA. Referenced by FireWeapon(). 00159 {
00160 trace_t tr;
00161 vec3_t end;
00162 #ifdef MISSIONPACK
00163 vec3_t impactpoint, bouncedir;
00164 #endif
00165 float r;
00166 float u;
00167 gentity_t *tent;
00168 gentity_t *traceEnt;
00169 int i, passent;
00170
00171 damage *= s_quadFactor;
00172
00173 r = random() * M_PI * 2.0f;
00174 u = sin(r) * crandom() * spread * 16;
00175 r = cos(r) * crandom() * spread * 16;
00176 VectorMA (muzzle, 8192*16, forward, end);
00177 VectorMA (end, r, right, end);
00178 VectorMA (end, u, up, end);
00179
00180 passent = ent->s.number;
00181 for (i = 0; i < 10; i++) {
00182
00183 trap_Trace (&tr, muzzle, NULL, NULL, end, passent, MASK_SHOT);
00184 if ( tr.surfaceFlags & SURF_NOIMPACT ) {
00185 return;
00186 }
00187
00188 traceEnt = &g_entities[ tr.entityNum ];
00189
00190 // snap the endpos to integers, but nudged towards the line
00191 SnapVectorTowards( tr.endpos, muzzle );
00192
00193 // send bullet impact
00194 if ( traceEnt->takedamage && traceEnt->client ) {
00195 tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_FLESH );
00196 tent->s.eventParm = traceEnt->s.number;
00197 if( LogAccuracyHit( traceEnt, ent ) ) {
00198 ent->client->accuracy_hits++;
00199 }
00200 } else {
00201 tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_WALL );
00202 tent->s.eventParm = DirToByte( tr.plane.normal );
00203 }
00204 tent->s.otherEntityNum = ent->s.number;
00205
00206 if ( traceEnt->takedamage) {
00207 #ifdef MISSIONPACK
00208 if ( traceEnt->client && traceEnt->client->invulnerabilityTime > level.time ) {
00209 if (G_InvulnerabilityEffect( traceEnt, forward, tr.endpos, impactpoint, bouncedir )) {
00210 G_BounceProjectile( muzzle, impactpoint, bouncedir, end );
00211 VectorCopy( impactpoint, muzzle );
00212 // the player can hit him/herself with the bounced rail
00213 passent = ENTITYNUM_NONE;
00214 }
00215 else {
00216 VectorCopy( tr.endpos, muzzle );
00217 passent = traceEnt->s.number;
00218 }
00219 continue;
00220 }
00221 else {
00222 #endif
00223 G_Damage( traceEnt, ent, ent, forward, tr.endpos,
00224 damage, 0, MOD_MACHINEGUN);
00225 #ifdef MISSIONPACK
00226 }
00227 #endif
00228 }
00229 break;
00230 }
00231 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 782 of file g_weapon.c. References gentity_s::client, forward, gentity_t, entityState_s::pos, gclient_s::ps, gentity_s::s, SnapVector, trajectory_t::trBase, VectorCopy, VectorMA, and playerState_s::viewheight. Referenced by CheckGauntletAttack(). 00782 {
00783 VectorCopy( ent->s.pos.trBase, muzzlePoint );
00784 muzzlePoint[2] += ent->client->ps.viewheight;
00785 VectorMA( muzzlePoint, 14, forward, muzzlePoint );
00786 // snap to integer coordinates for more efficient network bandwidth usage
00787 SnapVector( muzzlePoint );
00788 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 797 of file g_weapon.c. References gentity_s::client, forward, gentity_t, entityState_s::pos, gclient_s::ps, gentity_s::s, SnapVector, trajectory_t::trBase, VectorCopy, VectorMA, and playerState_s::viewheight. Referenced by FireWeapon(). 00797 {
00798 VectorCopy( ent->s.pos.trBase, muzzlePoint );
00799 muzzlePoint[2] += ent->client->ps.viewheight;
00800 VectorMA( muzzlePoint, 14, forward, muzzlePoint );
00801 // snap to integer coordinates for more efficient network bandwidth usage
00802 SnapVector( muzzlePoint );
00803 }
|
|
|
Definition at line 69 of file g_weapon.c. References AngleVectors(), CalcMuzzlePoint(), gentity_s::client, DirToByte(), EV_MISSILE_HIT, EV_POWERUP_QUAD, entityState_s::eventParm, forward, G_AddEvent(), G_Damage(), g_entities, g_quadfactor, G_TempEntity(), gentity_t, MASK_SHOT, MOD_GAUNTLET, muzzle, NULL, entityState_s::number, entityState_s::otherEntityNum, playerState_s::powerups, gclient_s::ps, qboolean, right, gentity_s::s, s_quadFactor, gentity_s::takedamage, tr, trap_Trace(), up, vmCvar_t::value, vec3_t, VectorMA, playerState_s::viewangles, and entityState_s::weapon. Referenced by ClientThink_real(). 00069 {
00070 trace_t tr;
00071 vec3_t end;
00072 gentity_t *tent;
00073 gentity_t *traceEnt;
00074 int damage;
00075
00076 // set aiming directions
00077 AngleVectors (ent->client->ps.viewangles, forward, right, up);
00078
00079 CalcMuzzlePoint ( ent, forward, right, up, muzzle );
00080
00081 VectorMA (muzzle, 32, forward, end);
00082
00083 trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT);
00084 if ( tr.surfaceFlags & SURF_NOIMPACT ) {
00085 return qfalse;
00086 }
00087
00088 traceEnt = &g_entities[ tr.entityNum ];
00089
00090 // send blood impact
00091 if ( traceEnt->takedamage && traceEnt->client ) {
00092 tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT );
00093 tent->s.otherEntityNum = traceEnt->s.number;
00094 tent->s.eventParm = DirToByte( tr.plane.normal );
00095 tent->s.weapon = ent->s.weapon;
00096 }
00097
00098 if ( !traceEnt->takedamage) {
00099 return qfalse;
00100 }
00101
00102 if (ent->client->ps.powerups[PW_QUAD] ) {
00103 G_AddEvent( ent, EV_POWERUP_QUAD, 0 );
00104 s_quadFactor = g_quadfactor.value;
00105 } else {
00106 s_quadFactor = 1;
00107 }
00108 #ifdef MISSIONPACK
00109 if( ent->client->persistantPowerup && ent->client->persistantPowerup->item && ent->client->persistantPowerup->item->giTag == PW_DOUBLER ) {
00110 s_quadFactor *= 2;
00111 }
00112 #endif
00113
00114 damage = 50 * s_quadFactor;
00115 G_Damage( traceEnt, ent, ent, forward, tr.endpos,
00116 damage, 0, MOD_GAUNTLET );
00117
00118 return qtrue;
00119 }
|
Here is the call graph for this function:

|
|
Definition at line 812 of file g_weapon.c. References gclient_s::accuracy_shots, AngleVectors(), BFG_Fire(), Bullet_Fire(), CalcMuzzlePointOrigin(), gentity_s::client, forward, g_gametype, g_quadfactor, gentity_t, MACHINEGUN_DAMAGE, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE, muzzle, gclient_s::oldOrigin, playerState_s::powerups, gclient_s::ps, right, gentity_s::s, s_quadFactor, up, vmCvar_t::value, playerState_s::viewangles, entityState_s::weapon, Weapon_Gauntlet(), Weapon_GrapplingHook_Fire(), weapon_grenadelauncher_fire(), Weapon_LightningFire(), Weapon_Plasmagun_Fire(), weapon_railgun_fire(), Weapon_RocketLauncher_Fire(), weapon_supershotgun_fire(), WP_BFG, WP_GAUNTLET, WP_GRAPPLING_HOOK, WP_GRENADE_LAUNCHER, WP_LIGHTNING, WP_MACHINEGUN, WP_PLASMAGUN, WP_RAILGUN, WP_ROCKET_LAUNCHER, and WP_SHOTGUN. Referenced by ClientEvents(). 00812 {
00813 if (ent->client->ps.powerups[PW_QUAD] ) {
00814 s_quadFactor = g_quadfactor.value;
00815 } else {
00816 s_quadFactor = 1;
00817 }
00818 #ifdef MISSIONPACK
00819 if( ent->client->persistantPowerup && ent->client->persistantPowerup->item && ent->client->persistantPowerup->item->giTag == PW_DOUBLER ) {
00820 s_quadFactor *= 2;
00821 }
00822 #endif
00823
00824 // track shots taken for accuracy tracking. Grapple is not a weapon and gauntet is just not tracked
00825 if( ent->s.weapon != WP_GRAPPLING_HOOK && ent->s.weapon != WP_GAUNTLET ) {
00826 #ifdef MISSIONPACK
00827 if( ent->s.weapon == WP_NAILGUN ) {
00828 ent->client->accuracy_shots += NUM_NAILSHOTS;
00829 } else {
00830 ent->client->accuracy_shots++;
00831 }
00832 #else
00833 ent->client->accuracy_shots++;
00834 #endif
00835 }
00836
00837 // set aiming directions
00838 AngleVectors (ent->client->ps.viewangles, forward, right, up);
00839
00840 CalcMuzzlePointOrigin ( ent, ent->client->oldOrigin, forward, right, up, muzzle );
00841
00842 // fire the specific weapon
00843 switch( ent->s.weapon ) {
00844 case WP_GAUNTLET:
00845 Weapon_Gauntlet( ent );
00846 break;
00847 case WP_LIGHTNING:
00848 Weapon_LightningFire( ent );
00849 break;
00850 case WP_SHOTGUN:
00851 weapon_supershotgun_fire( ent );
00852 break;
00853 case WP_MACHINEGUN:
00854 if ( g_gametype.integer != GT_TEAM ) {
00855 Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE );
00856 } else {
00857 Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE );
00858 }
00859 break;
00860 case WP_GRENADE_LAUNCHER:
00861 weapon_grenadelauncher_fire( ent );
00862 break;
00863 case WP_ROCKET_LAUNCHER:
00864 Weapon_RocketLauncher_Fire( ent );
00865 break;
00866 case WP_PLASMAGUN:
00867 Weapon_Plasmagun_Fire( ent );
00868 break;
00869 case WP_RAILGUN:
00870 weapon_railgun_fire( ent );
00871 break;
00872 case WP_BFG:
00873 BFG_Fire( ent );
00874 break;
00875 case WP_GRAPPLING_HOOK:
00876 Weapon_GrapplingHook_Fire( ent );
00877 break;
00878 #ifdef MISSIONPACK
00879 case WP_NAILGUN:
00880 Weapon_Nailgun_Fire( ent );
00881 break;
00882 case WP_PROX_LAUNCHER:
00883 weapon_proxlauncher_fire( ent );
00884 break;
00885 case WP_CHAINGUN:
00886 Bullet_Fire( ent, CHAINGUN_SPREAD, MACHINEGUN_DAMAGE );
00887 break;
00888 #endif
00889 default:
00890 // FIXME G_Error( "Bad ent->s.weapon" );
00891 break;
00892 }
00893 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 39 of file g_weapon.c. References DotProduct, v, vec3_t, VectorMA, VectorNormalize(), and VectorSubtract. Referenced by Bullet_Fire(), ShotgunPellet(), Weapon_LightningFire(), and weapon_railgun_fire(). 00039 {
00040 vec3_t v, newv;
00041 float dot;
00042
00043 VectorSubtract( impact, start, v );
00044 dot = DotProduct( v, dir );
00045 VectorMA( v, -2*dot, dir, newv );
00046
00047 VectorNormalize(newv);
00048 VectorMA(impact, 8192, newv, endout);
00049 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 746 of file g_weapon.c. References gentity_s::client, gentity_t, OnSameTeam(), gclient_s::ps, qboolean, playerState_s::stats, and gentity_s::takedamage. Referenced by Bullet_Fire(), G_MissileImpact(), G_RadiusDamage(), ShotgunPellet(), Weapon_LightningFire(), and weapon_railgun_fire(). 00746 {
00747 if( !target->takedamage ) {
00748 return qfalse;
00749 }
00750
00751 if ( target == attacker ) {
00752 return qfalse;
00753 }
00754
00755 if( !target->client ) {
00756 return qfalse;
00757 }
00758
00759 if( !attacker->client ) {
00760 return qfalse;
00761 }
00762
00763 if( target->client->ps.stats[STAT_HEALTH] <= 0 ) {
00764 return qfalse;
00765 }
00766
00767 if ( OnSameTeam( target, attacker ) ) {
00768 return qfalse;
00769 }
00770
00771 return qtrue;
00772 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 322 of file g_weapon.c. References gclient_s::accuracy_hits, gentity_s::client, CrossProduct(), DEFAULT_SHOTGUN_SPREAD, forward, gentity_t, i, PerpendicularVector(), playerState_s::persistant, gclient_s::ps, Q_crandom(), qboolean, r, right, ShotgunPellet(), up, vec3_t, VectorMA, and VectorNormalize2(). Referenced by weapon_supershotgun_fire(). 00322 {
00323 int i;
00324 float r, u;
00325 vec3_t end;
00326 vec3_t forward, right, up;
00327 int oldScore;
00328 qboolean hitClient = qfalse;
00329
00330 // derive the right and up vectors from the forward vector, because
00331 // the client won't have any other information
00332 VectorNormalize2( origin2, forward );
00333 PerpendicularVector( right, forward );
00334 CrossProduct( forward, right, up );
00335
00336 oldScore = ent->client->ps.persistant[PERS_SCORE];
00337
00338 // generate the "random" spread pattern
00339 for ( i = 0 ; i < DEFAULT_SHOTGUN_COUNT ; i++ ) {
00340 r = Q_crandom( &seed ) * DEFAULT_SHOTGUN_SPREAD * 16;
00341 u = Q_crandom( &seed ) * DEFAULT_SHOTGUN_SPREAD * 16;
00342 VectorMA( origin, 8192 * 16, forward, end);
00343 VectorMA (end, r, right, end);
00344 VectorMA (end, u, up, end);
00345 if( ShotgunPellet( origin, end, ent ) && !hitClient ) {
00346 hitClient = qtrue;
00347 ent->client->accuracy_hits++;
00348 }
00349 }
00350 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 265 of file g_weapon.c. References gentity_s::client, DEFAULT_SHOTGUN_DAMAGE, forward, G_BounceProjectile(), G_Damage(), g_entities, G_InvulnerabilityEffect(), gentity_t, i, level, LogAccuracyHit(), MASK_SHOT, MOD_SHOTGUN, NULL, entityState_s::number, qboolean, gentity_s::s, gentity_s::takedamage, level_locals_t::time, tr, trap_Trace(), vec3_t, and VectorCopy. Referenced by ShotgunPattern(). 00265 {
00266 trace_t tr;
00267 int damage, i, passent;
00268 gentity_t *traceEnt;
00269 #ifdef MISSIONPACK
00270 vec3_t impactpoint, bouncedir;
00271 #endif
00272 vec3_t tr_start, tr_end;
00273
00274 passent = ent->s.number;
00275 VectorCopy( start, tr_start );
00276 VectorCopy( end, tr_end );
00277 for (i = 0; i < 10; i++) {
00278 trap_Trace (&tr, tr_start, NULL, NULL, tr_end, passent, MASK_SHOT);
00279 traceEnt = &g_entities[ tr.entityNum ];
00280
00281 // send bullet impact
00282 if ( tr.surfaceFlags & SURF_NOIMPACT ) {
00283 return qfalse;
00284 }
00285
00286 if ( traceEnt->takedamage) {
00287 damage = DEFAULT_SHOTGUN_DAMAGE * s_quadFactor;
00288 #ifdef MISSIONPACK
00289 if ( traceEnt->client && traceEnt->client->invulnerabilityTime > level.time ) {
00290 if (G_InvulnerabilityEffect( traceEnt, forward, tr.endpos, impactpoint, bouncedir )) {
00291 G_BounceProjectile( tr_start, impactpoint, bouncedir, tr_end );
00292 VectorCopy( impactpoint, tr_start );
00293 // the player can hit him/herself with the bounced rail
00294 passent = ENTITYNUM_NONE;
00295 }
00296 else {
00297 VectorCopy( tr.endpos, tr_start );
00298 passent = traceEnt->s.number;
00299 }
00300 continue;
00301 }
00302 else {
00303 G_Damage( traceEnt, ent, ent, forward, tr.endpos,
00304 damage, 0, MOD_SHOTGUN);
00305 if( LogAccuracyHit( traceEnt, ent ) ) {
00306 return qtrue;
00307 }
00308 }
00309 #else
00310 G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, 0, MOD_SHOTGUN);
00311 if( LogAccuracyHit( traceEnt, ent ) ) {
00312 return qtrue;
00313 }
00314 #endif
00315 }
00316 return qfalse;
00317 }
00318 return qfalse;
00319 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 140 of file g_weapon.c. Referenced by Bullet_Fire(), G_MissileImpact(), Weapon_HookThink(), and weapon_railgun_fire(). 00140 {
00141 int i;
00142
00143 for ( i = 0 ; i < 3 ; i++ ) {
00144 if ( to[i] <= v[i] ) {
00145 v[i] = (int)v[i];
00146 } else {
00147 v[i] = (int)v[i] + 1;
00148 }
00149 }
00150 }
|
|
|
Definition at line 60 of file g_weapon.c. References gentity_t. Referenced by FireWeapon(). 00060 {
00061
00062 }
|
|
|
Definition at line 572 of file g_weapon.c. References gentity_s::client, fire_grapple(), gclient_s::fireHeld, forward, gentity_t, gclient_s::hook, and muzzle. Referenced by FireWeapon(). 00573 {
00574 if (!ent->client->fireHeld && !ent->client->hook)
00575 fire_grapple (ent, muzzle, forward);
00576
00577 ent->client->fireHeld = qtrue;
00578 }
|
Here is the call graph for this function:

|
|
Definition at line 375 of file g_weapon.c. References gentity_s::damage, fire_grenade(), forward, gentity_t, m, muzzle, gentity_s::splashDamage, and VectorNormalize(). Referenced by FireWeapon(). 00375 {
00376 gentity_t *m;
00377
00378 // extra vertical velocity
00379 forward[2] += 0.2f;
00380 VectorNormalize( forward );
00381
00382 m = fire_grenade (ent, muzzle, forward);
00383 m->damage *= s_quadFactor;
00384 m->splashDamage *= s_quadFactor;
00385
00386 // VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
00387 }
|
Here is the call graph for this function:

|
|
Definition at line 580 of file g_weapon.c. References gentity_s::client, G_FreeEntity(), gentity_t, gclient_s::hook, gentity_s::parent, playerState_s::pm_flags, and gclient_s::ps. Referenced by ClientThink_real(), and player_die(). 00581 {
00582 ent->parent->client->hook = NULL;
00583 ent->parent->client->ps.pm_flags &= ~PMF_GRAPPLE_PULL;
00584 G_FreeEntity( ent );
00585 }
|
Here is the call graph for this function:

|
|
Definition at line 587 of file g_weapon.c. References gentity_s::client, entityShared_t::currentOrigin, gentity_s::enemy, G_SetOrigin(), gentity_t, playerState_s::grapplePoint, entityShared_t::maxs, entityShared_t::mins, gentity_s::parent, gclient_s::ps, gentity_s::r, SnapVectorTowards(), v, vec3_t, and VectorCopy. 00588 {
00589 if (ent->enemy) {
00590 vec3_t v, oldorigin;
00591
00592 VectorCopy(ent->r.currentOrigin, oldorigin);
00593 v[0] = ent->enemy->r.currentOrigin[0] + (ent->enemy->r.mins[0] + ent->enemy->r.maxs[0]) * 0.5;
00594 v[1] = ent->enemy->r.currentOrigin[1] + (ent->enemy->r.mins[1] + ent->enemy->r.maxs[1]) * 0.5;
00595 v[2] = ent->enemy->r.currentOrigin[2] + (ent->enemy->r.mins[2] + ent->enemy->r.maxs[2]) * 0.5;
00596 SnapVectorTowards( v, oldorigin ); // save net bandwidth
00597
00598 G_SetOrigin( ent, v );
00599 }
00600
00601 VectorCopy( ent->r.currentOrigin, ent->parent->client->ps.grapplePoint);
00602 }
|
Here is the call graph for this function:

|
|
Definition at line 612 of file g_weapon.c. References gclient_s::accuracy_hits, gentity_s::client, DirToByte(), EV_LIGHTNINGBOLT, EV_MISSILE_HIT, EV_MISSILE_MISS, entityState_s::eventParm, forward, G_BounceProjectile(), G_Damage(), g_entities, G_InvulnerabilityEffect(), G_TempEntity(), gentity_t, i, level, LIGHTNING_RANGE, LogAccuracyHit(), MASK_SHOT, MOD_LIGHTNING, muzzle, NULL, entityState_s::number, entityState_s::origin2, entityState_s::otherEntityNum, gentity_s::s, SnapVector, gentity_s::takedamage, level_locals_t::time, tr, trap_Trace(), vec3_t, VectorCopy, VectorMA, VectorNormalize(), VectorSubtract, and entityState_s::weapon. Referenced by FireWeapon(). 00612 {
00613 trace_t tr;
00614 vec3_t end;
00615 #ifdef MISSIONPACK
00616 vec3_t impactpoint, bouncedir;
00617 #endif
00618 gentity_t *traceEnt, *tent;
00619 int damage, i, passent;
00620
00621 damage = 8 * s_quadFactor;
00622
00623 passent = ent->s.number;
00624 for (i = 0; i < 10; i++) {
00625 VectorMA( muzzle, LIGHTNING_RANGE, forward, end );
00626
00627 trap_Trace( &tr, muzzle, NULL, NULL, end, passent, MASK_SHOT );
00628
00629 #ifdef MISSIONPACK
00630 // if not the first trace (the lightning bounced of an invulnerability sphere)
00631 if (i) {
00632 // add bounced off lightning bolt temp entity
00633 // the first lightning bolt is a cgame only visual
00634 //
00635 tent = G_TempEntity( muzzle, EV_LIGHTNINGBOLT );
00636 VectorCopy( tr.endpos, end );
00637 SnapVector( end );
00638 VectorCopy( end, tent->s.origin2 );
00639 }
00640 #endif
00641 if ( tr.entityNum == ENTITYNUM_NONE ) {
00642 return;
00643 }
00644
00645 traceEnt = &g_entities[ tr.entityNum ];
00646
00647 if ( traceEnt->takedamage) {
00648 #ifdef MISSIONPACK
00649 if ( traceEnt->client && traceEnt->client->invulnerabilityTime > level.time ) {
00650 if (G_InvulnerabilityEffect( traceEnt, forward, tr.endpos, impactpoint, bouncedir )) {
00651 G_BounceProjectile( muzzle, impactpoint, bouncedir, end );
00652 VectorCopy( impactpoint, muzzle );
00653 VectorSubtract( end, impactpoint, forward );
00654 VectorNormalize(forward);
00655 // the player can hit him/herself with the bounced lightning
00656 passent = ENTITYNUM_NONE;
00657 }
00658 else {
00659 VectorCopy( tr.endpos, muzzle );
00660 passent = traceEnt->s.number;
00661 }
00662 continue;
00663 }
00664 else {
00665 G_Damage( traceEnt, ent, ent, forward, tr.endpos,
00666 damage, 0, MOD_LIGHTNING);
00667 }
00668 #else
00669 G_Damage( traceEnt, ent, ent, forward, tr.endpos,
00670 damage, 0, MOD_LIGHTNING);
00671 #endif
00672 }
00673
00674 if ( traceEnt->takedamage && traceEnt->client ) {
00675 tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT );
00676 tent->s.otherEntityNum = traceEnt->s.number;
00677 tent->s.eventParm = DirToByte( tr.plane.normal );
00678 tent->s.weapon = ent->s.weapon;
00679 if( LogAccuracyHit( traceEnt, ent ) ) {
00680 ent->client->accuracy_hits++;
00681 }
00682 } else if ( !( tr.surfaceFlags & SURF_NOIMPACT ) ) {
00683 tent = G_TempEntity( tr.endpos, EV_MISSILE_MISS );
00684 tent->s.eventParm = DirToByte( tr.plane.normal );
00685 }
00686
00687 break;
00688 }
00689 }
|
Here is the call graph for this function:

|