mirror of
https://github.com/yquake2/zaero.git
synced 2024-11-10 06:32:04 +00:00
Merge pull request #22 from BjossiAlfreds/player-sounds
Fix for some player sound bugs
This commit is contained in:
commit
7dae34726f
3 changed files with 20 additions and 6 deletions
|
@ -1164,7 +1164,7 @@ struct edict_s
|
|||
int dmg;
|
||||
int radius_dmg;
|
||||
float dmg_radius;
|
||||
int sounds; //make this a spawntemp var?
|
||||
int sounds; // now also used for player death sound aggregation
|
||||
int count;
|
||||
|
||||
edict_t *chain;
|
||||
|
|
|
@ -610,8 +610,8 @@ void player_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damag
|
|||
memset(self->client->pers.inventory, 0, sizeof(self->client->pers.inventory));
|
||||
|
||||
if (self->health < -40)
|
||||
{ // gib
|
||||
gi.sound (self, CHAN_BODY, gi.soundindex ("misc/udeath.wav"), 1, ATTN_NORM, 0);
|
||||
{ // gib (play sound at end of server frame)
|
||||
self->sounds = gi.soundindex ("misc/udeath.wav");
|
||||
for (n= 0; n < 4; n++)
|
||||
ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
|
||||
ThrowClientHead (self, damage);
|
||||
|
@ -647,7 +647,10 @@ void player_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damag
|
|||
self->client->anim_end = FRAME_death308;
|
||||
break;
|
||||
}
|
||||
gi.sound (self, CHAN_VOICE, gi.soundindex(va("*death%i.wav", (rand()%4)+1)), 1, ATTN_NORM, 0);
|
||||
|
||||
// play sound at end of server frame
|
||||
if (!self->sounds)
|
||||
self->sounds = gi.soundindex(va("*death%i.wav", (rand()%4)+1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,13 @@ void P_DamageFeedback (edict_t *player)
|
|||
return;
|
||||
}
|
||||
|
||||
// death/gib sound is now aggregated and played here
|
||||
if (player->sounds)
|
||||
{
|
||||
gi.sound (player, CHAN_VOICE, player->sounds, 1, ATTN_NORM, 0);
|
||||
player->sounds = 0;
|
||||
}
|
||||
|
||||
client = player->client;
|
||||
|
||||
// flash the backgrounds behind the status numbers
|
||||
|
@ -116,7 +123,7 @@ void P_DamageFeedback (edict_t *player)
|
|||
count = 10; // always make a visible effect
|
||||
|
||||
// play an apropriate pain sound
|
||||
if ((level.time > player->pain_debounce_time) && !(player->flags & FL_GODMODE) && (client->invincible_framenum <= level.framenum))
|
||||
if ((level.time > player->pain_debounce_time) && !(player->flags & FL_GODMODE) && (client->invincible_framenum <= level.framenum) && player->health > 0)
|
||||
{
|
||||
r = 1 + (rand()&1);
|
||||
player->pain_debounce_time = level.time + 0.7;
|
||||
|
@ -787,7 +794,8 @@ void P_WorldEffects (void)
|
|||
{
|
||||
if (current_player->health > 0
|
||||
&& current_player->pain_debounce_time <= level.time
|
||||
&& current_client->invincible_framenum < level.framenum)
|
||||
&& current_client->invincible_framenum < level.framenum
|
||||
&& !(current_player->flags & FL_GODMODE))
|
||||
{
|
||||
if (rand()&1)
|
||||
gi.sound (current_player, CHAN_VOICE, gi.soundindex("player/burn1.wav"), 1, ATTN_NORM, 0);
|
||||
|
@ -895,6 +903,9 @@ void G_SetClientEvent (edict_t *ent)
|
|||
if (ent->s.event)
|
||||
return;
|
||||
|
||||
if (ent->health <= 0)
|
||||
return;
|
||||
|
||||
if ( ent->groundentity && xyspeed > 225)
|
||||
{
|
||||
if ( (int)(current_client->bobtime+bobmove) != bobcycle )
|
||||
|
|
Loading…
Reference in a new issue