mirror of
https://github.com/yquake2/rogue.git
synced 2025-02-19 18:42:21 +00:00
Merge pull request #83 from BjossiAlfreds/player-sounds
Fix for some player sound bugs
This commit is contained in:
commit
25b453f1b8
3 changed files with 25 additions and 7 deletions
|
@ -1257,7 +1257,7 @@ struct edict_s
|
||||||
int dmg;
|
int dmg;
|
||||||
int radius_dmg;
|
int radius_dmg;
|
||||||
float dmg_radius;
|
float dmg_radius;
|
||||||
int sounds; /* make this a spawntemp var? */
|
int sounds; /* now also used for player death sound aggregation */
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
edict_t *chain;
|
edict_t *chain;
|
||||||
|
|
|
@ -730,8 +730,8 @@ player_die(edict_t *self, edict_t *inflictor, edict_t *attacker,
|
||||||
/* don't toss gibs if we got vaped by the nuke */
|
/* don't toss gibs if we got vaped by the nuke */
|
||||||
if (!(self->flags & FL_NOGIB))
|
if (!(self->flags & FL_NOGIB))
|
||||||
{
|
{
|
||||||
/* gib */
|
/* gib (play sound at end of server frame) */
|
||||||
gi.sound(self, CHAN_BODY, gi.soundindex( "misc/udeath.wav"), 1, ATTN_NORM, 0);
|
self->sounds = gi.soundindex( "misc/udeath.wav");
|
||||||
|
|
||||||
/* more meaty gibs for your dollar! */
|
/* more meaty gibs for your dollar! */
|
||||||
if ((deathmatch->value) && (self->health < -80))
|
if ((deathmatch->value) && (self->health < -80))
|
||||||
|
@ -788,7 +788,11 @@ player_die(edict_t *self, edict_t *inflictor, edict_t *attacker,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,13 @@ P_DamageFeedback(edict_t *player)
|
||||||
return;
|
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;
|
client = player->client;
|
||||||
|
|
||||||
/* flash the backgrounds behind the status numbers */
|
/* flash the backgrounds behind the status numbers */
|
||||||
|
@ -131,7 +138,8 @@ P_DamageFeedback(edict_t *player)
|
||||||
/* play an apropriate pain sound */
|
/* play an apropriate pain sound */
|
||||||
if ((level.time > player->pain_debounce_time) &&
|
if ((level.time > player->pain_debounce_time) &&
|
||||||
!(player->flags & FL_GODMODE) &&
|
!(player->flags & FL_GODMODE) &&
|
||||||
(client->invincible_framenum <= level.framenum))
|
(client->invincible_framenum <= level.framenum) &&
|
||||||
|
player->health > 0)
|
||||||
{
|
{
|
||||||
r = 1 + (rand() & 1);
|
r = 1 + (rand() & 1);
|
||||||
player->pain_debounce_time = level.time + 0.7;
|
player->pain_debounce_time = level.time + 0.7;
|
||||||
|
@ -940,7 +948,8 @@ P_WorldEffects(void)
|
||||||
{
|
{
|
||||||
if ((current_player->health > 0) &&
|
if ((current_player->health > 0) &&
|
||||||
(current_player->pain_debounce_time <= level.time) &&
|
(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)
|
if (rand() & 1)
|
||||||
{
|
{
|
||||||
|
@ -1089,6 +1098,11 @@ G_SetClientEvent(edict_t *ent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ent->health <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_footsteps->value == 1)
|
if (g_footsteps->value == 1)
|
||||||
{
|
{
|
||||||
if (ent->groundentity && (xyspeed > 225))
|
if (ent->groundentity && (xyspeed > 225))
|
||||||
|
@ -1099,7 +1113,7 @@ G_SetClientEvent(edict_t *ent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (g_footsteps->value == 2)
|
else if (g_footsteps->value == 2)
|
||||||
{
|
{
|
||||||
if ((int)(current_client->bobtime + bobmove) != bobcycle)
|
if ((int)(current_client->bobtime + bobmove) != bobcycle)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue