Valve: Satchel and Handgrenade now play the proper bounce sounds.
This commit is contained in:
parent
e3a9a0149e
commit
8ceb0a54a1
4 changed files with 25 additions and 11 deletions
|
@ -34,7 +34,7 @@ int Rules_IsTeamPlay(void);
|
|||
entity eActivator;
|
||||
entity g_eAttacker;
|
||||
|
||||
// Generic entity fields
|
||||
/* Generic entity fields */
|
||||
.void() PlayerUse;
|
||||
.int iBleeds;
|
||||
.void(int iHitBody) vPain;
|
||||
|
@ -45,6 +45,10 @@ entity g_eAttacker;
|
|||
.float deaths;
|
||||
.float fStepTime;
|
||||
|
||||
/* in idTech the .owner field causes collisions to fail against set entity,
|
||||
* we don't want this all of the time. so use this as a fallback */
|
||||
.entity real_owner;
|
||||
|
||||
string startspot;
|
||||
string __fullspawndata;
|
||||
hashtable hashMaterials;
|
||||
|
|
|
@ -28,11 +28,9 @@ enum
|
|||
|
||||
void w_handgrenade_precache(void)
|
||||
{
|
||||
precache_sound("weapons/g_bounce1.wav");
|
||||
precache_sound("weapons/g_bounce2.wav");
|
||||
precache_sound("weapons/g_bounce3.wav");
|
||||
precache_sound("weapons/g_bounce4.wav");
|
||||
precache_sound("weapons/g_bounce5.wav");
|
||||
precache_sound("weapons/grenade_hit1.wav");
|
||||
precache_sound("weapons/grenade_hit2.wav");
|
||||
precache_sound("weapons/grenade_hit3.wav");
|
||||
precache_model("models/v_grenade.mdl");
|
||||
precache_model("models/w_grenade.mdl");
|
||||
precache_model("models/p_grenade.mdl");
|
||||
|
@ -86,8 +84,8 @@ void w_handgrenade_throw(void)
|
|||
if (other.takedamage == DAMAGE_YES) {
|
||||
Damage_Apply(other, self.owner, 15, WEAPON_HANDGRENADE, DMG_BLUNT);
|
||||
}
|
||||
int r = floor(random(0,6));
|
||||
string sample = sprintf("weapons/g_bounce%i.wav", r);
|
||||
int r = floor(random(1,4));
|
||||
string sample = sprintf("weapons/grenade_hit%i.wav", r);
|
||||
sound( self, CHAN_BODY, sample, 1, ATTN_NORM );
|
||||
self.frame = 0;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,11 @@ string w_satchel_deathmsg(void)
|
|||
}
|
||||
void w_satchel_precache(void)
|
||||
{
|
||||
precache_sound("weapons/g_bounce1.wav");
|
||||
precache_sound("weapons/g_bounce2.wav");
|
||||
precache_sound("weapons/g_bounce3.wav");
|
||||
precache_sound("weapons/g_bounce4.wav");
|
||||
precache_sound("weapons/g_bounce5.wav");
|
||||
precache_model("models/w_satchel.mdl");
|
||||
precache_model("models/v_satchel.mdl");
|
||||
precache_model("models/v_satchel_radio.mdl");
|
||||
|
@ -89,6 +94,12 @@ void w_satchel_holster(void)
|
|||
#ifdef SSQC
|
||||
void s_satchel_drop(entity master, vector src, vector vel)
|
||||
{
|
||||
static void s_satchel_touch(void)
|
||||
{
|
||||
int r = floor(random(1,6));
|
||||
string sample = sprintf("weapons/g_bounce%i.wav", r);
|
||||
sound(self, CHAN_BODY, sample, 1, ATTN_NORM);
|
||||
}
|
||||
entity satch;
|
||||
satch = spawn();
|
||||
satch.owner = master;
|
||||
|
@ -100,6 +111,7 @@ void s_satchel_drop(entity master, vector src, vector vel)
|
|||
satch.friction = 0.8f;
|
||||
satch.velocity = vel;
|
||||
satch.avelocity = [0,400,0];
|
||||
satch.touch = s_satchel_touch;
|
||||
setmodel(satch, "models/w_satchel.mdl");
|
||||
setsize(satch, [-4,-4,-4], [4,4,4]);
|
||||
setorigin(satch, src);
|
||||
|
|
|
@ -83,7 +83,7 @@ void w_tripmine_holster(void)
|
|||
void w_tripmine_trip(int walkthrough)
|
||||
{
|
||||
if (!walkthrough) {
|
||||
self.owner = g_eAttacker;
|
||||
self.real_owner = g_eAttacker;
|
||||
}
|
||||
|
||||
/* This is to prevent infinite loops in Damage_Radius */
|
||||
|
@ -92,7 +92,7 @@ void w_tripmine_trip(int walkthrough)
|
|||
self.takedamage = DAMAGE_NO;
|
||||
|
||||
Effect_CreateExplosion(self.origin);
|
||||
Damage_Radius(self.origin, self.owner, 150, 150 * 2.5f, TRUE, WEAPON_TRIPMINE);
|
||||
Damage_Radius(self.origin, self.real_owner, 150, 150 * 2.5f, TRUE, WEAPON_TRIPMINE);
|
||||
sound(self, CHAN_WEAPON, sprintf( "weapons/explode%d.wav", floor( random() * 2 ) + 3 ), 1, ATTN_NORM);
|
||||
remove(self);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ void w_tripmine_primary(void)
|
|||
mine.nextthink = time + 4.0f;
|
||||
mine.SendEntity = w_tripmine_sendentity;
|
||||
mine.SendFlags = 1;
|
||||
mine.owner = self;
|
||||
mine.real_owner = self;
|
||||
setorigin(mine, trace_endpos - (v_forward * 8));
|
||||
sound(mine, CHAN_WEAPON, "weapons/mine_charge.wav", 1, ATTN_NORM);
|
||||
sound(self, CHAN_WEAPON, "weapons/mine_deploy.wav", 1, ATTN_NORM);
|
||||
|
|
Loading…
Reference in a new issue