Added global loop sounds ...

This commit is contained in:
Walter Julius Hennecke 2013-07-20 23:10:39 +02:00
parent 21602f912e
commit 0080fe29f9
4 changed files with 22 additions and 4 deletions

View file

@ -111,8 +111,13 @@ static void CG_EntityEffects( centity_t *cent ) {
// add loop sound
if ( cent->currentState.loopSound && cent->currentState.loopSound < 256 ) {
trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin,
cgs.gameSounds[ cent->currentState.loopSound ] );
if(cent->currentState.eType == ET_GLOBALSPEAKER) {
trap_S_AddLoopingSound( cent->currentState.number, cg.snap->ps.origin, vec3_origin,
cgs.gameSounds[ cent->currentState.loopSound] );
} else {
trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin,
cgs.gameSounds[ cent->currentState.loopSound ] );
}
}
@ -323,7 +328,11 @@ static void CG_Speaker( centity_t *cent ) {
return;
}
trap_S_StartSound (NULL, cent->currentState.number, CHAN_ITEM, cgs.gameSounds[cent->currentState.eventParm] );
if(cent->currentState.eType == ET_SPEAKER) {
trap_S_StartSound (NULL, cent->currentState.number, CHAN_ITEM, cgs.gameSounds[cent->currentState.eventParm] );
} else {
trap_S_StartSound (NULL, cent->currentState.number, CHAN_AUTO, cgs.gameSounds[cent->currentState.eventParm] );
}
cent->miscTime = cg.time + cent->currentState.frame * 100 + cent->currentState.clientNum * 100 * crandom();
}
@ -931,6 +940,7 @@ static void CG_AddCEntity( centity_t *cent ) {
CG_Portal( cent );
break;
case ET_SPEAKER:
case ET_GLOBALSPEAKER:
CG_Speaker( cent );
break;
case ET_LASER:

View file

@ -1010,6 +1010,7 @@ typedef enum {
ET_BEAM,
ET_PORTAL,
ET_SPEAKER,
ET_GLOBALSPEAKER,
ET_PUSH_TRIGGER,
ET_TELEPORT_TRIGGER,
ET_INVISIBLE,

View file

@ -692,6 +692,9 @@ void Svcmd_EntityList_f (void) {
case ET_SPEAKER:
G_Printf("ET_SPEAKER ");
break;
case ET_GLOBALSPEAKER:
G_Printf("ET_GLOBALSPEAKER ");
break;
case ET_PUSH_TRIGGER:
G_Printf("ET_PUSH_TRIGGER ");
break;

View file

@ -302,7 +302,11 @@ void SP_target_speaker( gentity_t *ent ) {
}
// a repeating speaker can be done completely client side
ent->s.eType = ET_SPEAKER;
if((ent->spawnflags & 4) == 0) {
ent->s.eType = ET_SPEAKER;
} else {
ent->s.eType = ET_GLOBALSPEAKER;
}
ent->s.eventParm = ent->noise_index;
ent->s.frame = (int)(ent->wait * 10);
ent->s.clientNum = (int)(ent->random * 10);