Skip to content
Permalink
Browse files

mod: BREAK move mortar impact sound in weapon files

This break the timing when mortar missile is enough close to ground for playing impact sound (event sended by EV_MORTAR_IMPACT.

I need to deal with this case by doing same way as artillery and airstrike approach sound (done game side).

And make it one day client side ...
  • Loading branch information...
Aranud committed May 13, 2019
1 parent 9324ba0 commit 71798db832d36b0ae05f4d2b4dad5ed122a7587c
@@ -44,6 +44,12 @@ weaponDef
impactMarkRadius 64
impactFunction "SmallExplosionImpact" // supports "MeleeImpact", "BulletImpact", "SmallExplosionImpact", "BigExplosionImpact", "MapMortarImpact" and "DynamiteExplosionImpact"

impactSound {
default 4 "sound/weapons/mortar/mortar_expl"
far "sound/weapons/mortar/mortar_expl_far.wav"
water "sound/weapons/grenade/gren_expl_water.wav"
}

impactMark { // each surface supports up to 1 marks shader. available surface : default, far, wood, metal, roof, gravel, glass, snow, water, flesh
default "gfx/damage/burn_med_mrk"
}
@@ -17,8 +17,9 @@ weaponDef
impactMarkRadius 96
impactSound { // each surface supports up to 5 hits sounds. available surface : default, far, wood, metal, roof, gravel, glass, snow, water, flesh

default "sound/weapons/rocket/rocket_expl.wav"
far "sound/weapons/rocket/rocket_expl_far.wav"
default "sound/weapons/mortar/mortar_expl"
far "sound/weapons/mortar/mortar_expl_far.wav"
water "sound/weapons/grenade/gren_expl_water.wav"
}
impactMark { // each surface supports up to 1 marks shader. available surface : default, far, wood, metal, roof, gravel, glass, snow, water, flesh
default "gfx/damage/burn_med_mrk"
@@ -43,6 +43,11 @@ weaponDef
impactFunction "SmallExplosionImpact" // supports "MeleeImpact", "BulletImpact", "SmallExplosionImpact", "BigExplosionImpact", "MapMortarImpact" and "DynamiteExplosionImpact"
impactSoundVolume 127
impactMarkRadius 64
impactSound {
default 4 "sound/weapons/mortar/mortar_expl"
far "sound/weapons/mortar/mortar_expl_far.wav"
water "sound/weapons/grenade/gren_expl_water.wav"
}
impactMark { // each surface supports up to 1 marks shader. available surface : default, far, wood, metal, roof, gravel, glass, snow, water, flesh
default "gfx/damage/burn_med_mrk"
}
@@ -1754,36 +1754,14 @@ void CG_Debris(centity_t *cent, vec3_t origin, vec3_t dir)
* @brief CG_MortarImpact
* @param[in] cent
* @param[in] origin
* @param[in] sfx
* @param[in] dist
*/
void CG_MortarImpact(centity_t *cent, vec3_t origin, int sfx, qboolean dist)
void CG_MortarImpact(centity_t *cent, vec3_t origin)
{
if (sfx >= 0)
{
trap_S_StartSound(origin, -1, CHAN_AUTO, cgs.media.sfx_mortarexp[sfx]);
}

if (dist)
if (cent->currentState.clientNum == cg.snap->ps.clientNum && cg.mortarImpactTime != -2)
{
vec3_t gorg, norm;
float gdist;

VectorSubtract(origin, cg.refdef_current->vieworg, norm);
gdist = VectorNormalize(norm);
if (gdist > 1200 && gdist < 8000) // 1200 is max cam shakey dist (2*600) use gorg as the new sound origin
{
VectorMA(cg.refdef_current->vieworg, 800, norm, gorg); // non-distance falloff makes more sense; sfx2range was gdist*0.2
// sfx2range is variable to give us minimum volume control different explosion sizes (see mortar, panzerfaust, and grenade)
trap_S_StartSoundEx(gorg, -1, CHAN_WEAPON, cgs.media.sfx_mortarexpDist, SND_NOCUT);
}

if (cent->currentState.clientNum == cg.snap->ps.clientNum && cg.mortarImpactTime != -2)
{
VectorCopy(origin, cg.mortarImpactPos);
cg.mortarImpactTime = cg.time;
cg.mortarImpactOutOfMap = qfalse;
}
VectorCopy(origin, cg.mortarImpactPos);
cg.mortarImpactTime = cg.time;
cg.mortarImpactOutOfMap = qfalse;
}
}

@@ -2242,17 +2220,6 @@ void CG_EntityEvent(centity_t *cent, vec3_t position)

ByteToDir(es->eventParm, dir);
CG_MissileHitPlayer(cent, es->weapon, position, dir, es->otherEntityNum);
if (CHECKBITWISE(GetWeaponTableData(es->weapon)->type, WEAPON_TYPE_MORTAR | WEAPON_TYPE_SET))
{
if (!es->legsAnim)
{
CG_MortarImpact(cent, position, 3, qtrue);
}
else
{
CG_MortarImpact(cent, position, -1, qtrue);
}
}
}
break;
case EV_MISSILE_MISS_SMALL:
@@ -2273,17 +2240,6 @@ void CG_EntityEvent(centity_t *cent, vec3_t position)

ByteToDir(es->eventParm, dir);
CG_MissileHitWall(es->weapon, effect, position, dir, 0);
if (CHECKBITWISE(GetWeaponTableData(es->weapon)->type, WEAPON_TYPE_MORTAR | WEAPON_TYPE_SET))
{
if (!es->legsAnim)
{
CG_MortarImpact(cent, position, 3, qtrue);
}
else
{
CG_MortarImpact(cent, position, -1, qtrue);
}
}
}
break;
case EV_MISSILE_MISS_LARGE:
@@ -2305,7 +2261,7 @@ void CG_EntityEvent(centity_t *cent, vec3_t position)
}
break;
case EV_MORTAR_IMPACT:
CG_MortarImpact(cent, position, rand() % 3, qfalse);
CG_MortarImpact(cent, position);
break;
case EV_MORTAR_MISS:
CG_MortarMiss(cent, position);
@@ -1585,8 +1585,6 @@ typedef struct

sfxHandle_t footsteps[FOOTSTEP_TOTAL][4];
sfxHandle_t sfx_rockexp;
sfxHandle_t sfx_mortarexp[4];
sfxHandle_t sfx_mortarexpDist;
sfxHandle_t sfx_brassSound[BRASSSOUND_MAX][3][2];
sfxHandle_t sfx_rubbleBounce[3];

@@ -1441,11 +1441,6 @@ static void CG_RegisterSounds(void)

cgs.media.sfx_rockexp = trap_S_RegisterSound("sound/weapons/rocket/rocket_expl.wav", qfalse);

cgs.media.sfx_mortarexp[0] = trap_S_RegisterSound("sound/weapons/mortar/mortar_expl1.wav", qfalse);
cgs.media.sfx_mortarexp[1] = trap_S_RegisterSound("sound/weapons/mortar/mortar_expl2.wav", qfalse);
cgs.media.sfx_mortarexp[2] = trap_S_RegisterSound("sound/weapons/mortar/mortar_expl3.wav", qfalse);
cgs.media.sfx_mortarexp[3] = trap_S_RegisterSound("sound/weapons/mortar/mortar_expl.wav", qfalse);

for (i = 0; i < 3; i++)
{
// bouncy shell sounds \o/
@@ -255,7 +255,6 @@ void G_MissileImpact(gentity_t *ent, trace_t *trace, int impactDamage)

if (CHECKBITWISE(GetWeaponTableData(ent->s.weapon)->type, WEAPON_TYPE_MORTAR | WEAPON_TYPE_SET))
{
temp->s.legsAnim = ent->s.legsAnim; // need this one as well
temp->r.svFlags |= SVF_BROADCAST;
}

@@ -600,7 +599,6 @@ void G_RunMissile(gentity_t *ent)
tent->r.svFlags |= SVF_BROADCAST;

ent->count2 = 2;
ent->s.legsAnim = 1;

/*{
gentity_t *tent;

0 comments on commit 71798db

Please sign in to comment.
You can’t perform that action at this time.