コード例 #1
0
ファイル: cg_weapons.c プロジェクト: ztdretcher/zt-tremulous
/*
=================
CG_MissileHitPlayer
=================
*/
void CG_MissileHitPlayer( weapon_t weaponNum, weaponMode_t weaponMode,
    vec3_t origin, vec3_t dir, int entityNum )
{
  vec3_t        normal;
  weaponInfo_t  *weapon = &cg_weapons[ weaponNum ];

  VectorCopy( dir, normal );
  VectorInverse( normal );

  CG_Bleed( origin, normal, entityNum );

  if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES )
    weaponMode = WPM_PRIMARY;

  if( weapon->wim[ weaponMode ].alwaysImpact )
    CG_MissileHitWall( weaponNum, weaponMode, 0, origin, dir, IMPACTSOUND_FLESH );
}
コード例 #2
0
ファイル: cg_weapons.c プロジェクト: ztdretcher/zt-tremulous
/*
======================
CG_Bullet

Renders bullet effects.
======================
*/
void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum )
{
  vec3_t  start;

  // if the shooter is currently valid, calc a source point and possibly
  // do trail effects
  if( sourceEntityNum >= 0 && cg_tracerChance.value > 0 )
  {
    if( CG_CalcMuzzlePoint( sourceEntityNum, start ) )
    {
      // draw a tracer
      if( random( ) < cg_tracerChance.value )
        CG_Tracer( start, end );
    }
  }

  // impact splash and mark
  if( flesh )
    CG_Bleed( end, normal, fleshEntityNum );
  else
    CG_MissileHitWall( WP_MACHINEGUN, WPM_PRIMARY, 0, end, normal, IMPACTSOUND_DEFAULT );
}
コード例 #3
0
ファイル: cg_weapons.c プロジェクト: ZdrytchX/cuboid
/*
=================
CG_MissileHitEntity
=================
*/
void CG_MissileHitEntity( weapon_t weaponNum, weaponMode_t weaponMode,
    vec3_t origin, vec3_t dir, int entityNum, int charge )
{
  vec3_t        normal;
  weaponInfo_t  *weapon = &cg_weapons[ weaponNum ];

  VectorCopy( dir, normal );
  VectorInverse( normal );

  CG_Bleed( origin, normal, entityNum );

  if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES )
    weaponMode = WPM_PRIMARY;

  // always impact!
  //if( weapon->wim[ weaponMode ].alwaysImpact )
  {
    int sound;

    if( cg_entities[ entityNum ].currentState.eType == ET_PLAYER )
    {
      // Players
      sound = IMPACTSOUND_FLESH;
    }
    else if( cg_entities[ entityNum ].currentState.eType == ET_BUILDABLE &&
             BG_Buildable( cg_entities[ entityNum ].currentState.modelindex, NULL )->team == TEAM_ALIENS )
    {
      // Alien buildables
      sound = IMPACTSOUND_FLESH;
    }
    else
      sound = IMPACTSOUND_DEFAULT;
          
    CG_MissileHitWall( weaponNum, weaponMode, 0, origin, dir, sound, charge );
  }
}