void CG_PlayPMItemSound( centity_t *cent ) { switch( cent->currentState.effect1Time ) { case PM_DYNAMITE: switch( cent->currentState.effect2Time ) { case 0: if( cent->currentState.teamNum == TEAM_AXIS ) CG_SoundPlaySoundScript( "axis_hq_dynamite_planted", NULL, -1, qtrue ); else CG_SoundPlaySoundScript( "allies_hq_dynamite_planted", NULL, -1, qtrue ); break; case 1: if( cent->currentState.teamNum == TEAM_AXIS ) CG_SoundPlaySoundScript( "axis_hq_dynamite_defused", NULL, -1, qtrue ); else CG_SoundPlaySoundScript( "allies_hq_dynamite_defused", NULL, -1, qtrue ); break; } break; case PM_MINES: // CHRUKER: b009 - Prevent spectators from being // informed when a mine is spotted if(cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR) return; if( cgs.clientinfo[cg.clientNum].team != cent->currentState.effect2Time ) { // inverted teams if( cent->currentState.effect2Time == TEAM_AXIS ) { CG_SoundPlaySoundScript( "allies_hq_mines_spotted", NULL, -1, qtrue ); } else { CG_SoundPlaySoundScript( "axis_hq_mines_spotted", NULL, -1, qtrue ); } } break; case PM_OBJECTIVE: switch( cent->currentState.density ) { case 0: if( cent->currentState.effect2Time == TEAM_AXIS ) CG_SoundPlaySoundScript( "axis_hq_objective_taken", NULL, -1, qtrue ); else CG_SoundPlaySoundScript( "allies_hq_objective_taken", NULL, -1, qtrue ); break; case 1: if( cent->currentState.effect2Time == TEAM_AXIS ) CG_SoundPlaySoundScript( "axis_hq_objective_secure", NULL, -1, qtrue ); else CG_SoundPlaySoundScript( "allies_hq_objective_secure", NULL, -1, qtrue ); break; } break; default: break; } }
void CG_PlayPMItemSound( centity_t *cent ) { switch ( cent->currentState.effect1Time ) { case PM_DYNAMITE: switch ( cent->currentState.effect2Time ) { case 0: if ( cent->currentState.teamNum == TEAM_AXIS ) { CG_SoundPlaySoundScript( "axis_hq_dynamite_planted", NULL, -1, true ); } else { CG_SoundPlaySoundScript( "allies_hq_dynamite_planted", NULL, -1, true ); } break; case 1: if ( cent->currentState.teamNum == TEAM_AXIS ) { CG_SoundPlaySoundScript( "axis_hq_dynamite_defused", NULL, -1, true ); } else { CG_SoundPlaySoundScript( "allies_hq_dynamite_defused", NULL, -1, true ); } break; } break; case PM_MINES: if ( cgs.clientinfo[cg.clientNum].team != cent->currentState.effect2Time ) { // inverted teams if ( cent->currentState.effect2Time == TEAM_AXIS ) { CG_SoundPlaySoundScript( "allies_hq_mines_spotted", NULL, -1, true ); } else { CG_SoundPlaySoundScript( "axis_hq_mines_spotted", NULL, -1, true ); } } break; case PM_OBJECTIVE: switch ( cent->currentState.density ) { case 0: if ( cent->currentState.effect2Time == TEAM_AXIS ) { CG_SoundPlaySoundScript( "axis_hq_objective_taken", NULL, -1, true ); } else { CG_SoundPlaySoundScript( "allies_hq_objective_taken", NULL, -1, true ); } break; case 1: if ( cent->currentState.effect2Time == TEAM_AXIS ) { CG_SoundPlaySoundScript( "axis_hq_objective_secure", NULL, -1, true ); } else { CG_SoundPlaySoundScript( "allies_hq_objective_secure", NULL, -1, true ); } break; } break; default: break; } }
/** * @brief CG_PlayPMItemSound * @param[in] cent */ void CG_PlayPMItemSound(centity_t *cent) { switch (cent->currentState.effect1Time) { case PM_DYNAMITE: switch (cent->currentState.effect2Time) { case 0: if (cent->currentState.teamNum == TEAM_AXIS) { CG_SoundPlaySoundScript("axis_hq_dynamite_planted", NULL, -1, qtrue); } else { CG_SoundPlaySoundScript("allies_hq_dynamite_planted", NULL, -1, qtrue); } break; case 1: if (cent->currentState.teamNum == TEAM_AXIS) { CG_SoundPlaySoundScript("axis_hq_dynamite_defused", NULL, -1, qtrue); } else { CG_SoundPlaySoundScript("allies_hq_dynamite_defused", NULL, -1, qtrue); } break; } break; case PM_MINES: // Prevent spectators from being informed when a mine is spotted if (cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR) { break; } // don't spam landmine spotted sounds ... play once per 10 secs if (!lastSoundTime || cg.time > lastSoundTime) { if (cgs.clientinfo[cg.clientNum].team != cent->currentState.effect2Time) { // inverted teams if (cent->currentState.effect2Time == TEAM_AXIS) { CG_SoundPlaySoundScript("allies_hq_mines_spotted", NULL, -1, qtrue); } else { CG_SoundPlaySoundScript("axis_hq_mines_spotted", NULL, -1, qtrue); } lastSoundTime = cg.time + 10000; // 10 secs } } break; case PM_OBJECTIVE: switch (cent->currentState.density) { case 0: if (cent->currentState.effect2Time == TEAM_AXIS) { CG_SoundPlaySoundScript("axis_hq_objective_taken", NULL, -1, qtrue); } else { CG_SoundPlaySoundScript("allies_hq_objective_taken", NULL, -1, qtrue); } break; case 1: if (cent->currentState.effect2Time == TEAM_AXIS) { CG_SoundPlaySoundScript("axis_hq_objective_secure", NULL, -1, qtrue); } else { CG_SoundPlaySoundScript("allies_hq_objective_secure", NULL, -1, qtrue); } break; } break; default: break; } }
/* ================== CG_CheckLocalSounds ================== */ void CG_CheckLocalSounds(playerState_t *ps, playerState_t *ops) { // health changes of more than -1 should make pain sounds if (ps->stats[STAT_HEALTH] < ops->stats[STAT_HEALTH] - 1) { if (ps->stats[STAT_HEALTH] > 0) { CG_PainEvent(&cg.predictedPlayerEntity, ps->stats[STAT_HEALTH], qfalse); cg.painTime = cg.time; } } // hitsounds // add server control cvars?! - no, admins just have to force cg_hitSounds if (ops->persistant[PERS_HITS] != ps->persistant[PERS_HITS] && (cg_hitSounds.integer & HITSOUNDS_ON)) { if (ps->persistant[PERS_HITS] < ops->persistant[PERS_HITS]) { if (!(cg_hitSounds.integer & HITSOUNDS_NOTEAMSHOT)) { trap_S_StartSound(NULL, ps->clientNum, CHAN_AUTO, cgs.media.teamShot); } } else if (ps->persistant[PERS_HEADSHOTS] > ops->persistant[PERS_HEADSHOTS]) { if (!(cg_hitSounds.integer & HITSOUNDS_NOHEADSHOT)) { trap_S_StartSound(NULL, ps->clientNum, CHAN_AUTO, cgs.media.headShot); } else if (!(cg_hitSounds.integer & HITSOUNDS_NOBODYSHOT)) { trap_S_StartSound(NULL, ps->clientNum, CHAN_AUTO, cgs.media.bodyShot); } } else { if (!(cg_hitSounds.integer & HITSOUNDS_NOBODYSHOT)) { trap_S_StartSound(NULL, ps->clientNum, CHAN_AUTO, cgs.media.bodyShot); } } } // timelimit warnings if (cgs.timelimit > 0 && cgs.gamestate == GS_PLAYING) { int msec = cg.time - cgs.levelStartTime; if (cgs.timelimit > 5 && !(cg.timelimitWarnings & 1) && (msec > (cgs.timelimit - 5) * 60 * 1000) && (msec < (cgs.timelimit - 5) * 60 * 1000 + 1000)) { cg.timelimitWarnings |= 1; if (ps->persistant[PERS_TEAM] == TEAM_AXIS) { if (cgs.media.fiveMinuteSound_g == -1) { CG_SoundPlaySoundScript(cg.fiveMinuteSound_g, NULL, -1, qtrue); } else if (cgs.media.fiveMinuteSound_g) { trap_S_StartLocalSound(cgs.media.fiveMinuteSound_g, CHAN_ANNOUNCER); } } else if (ps->persistant[PERS_TEAM] == TEAM_ALLIES) { if (cgs.media.fiveMinuteSound_a == -1) { CG_SoundPlaySoundScript(cg.fiveMinuteSound_a, NULL, -1, qtrue); } else if (cgs.media.fiveMinuteSound_a) { trap_S_StartLocalSound(cgs.media.fiveMinuteSound_a, CHAN_ANNOUNCER); } } } if (cgs.timelimit > 2 && !(cg.timelimitWarnings & 2) && (msec > (cgs.timelimit - 2) * 60 * 1000) && (msec < (cgs.timelimit - 2) * 60 * 1000 + 1000)) { cg.timelimitWarnings |= 2; if (ps->persistant[PERS_TEAM] == TEAM_AXIS) { if (cgs.media.twoMinuteSound_g == -1) { CG_SoundPlaySoundScript(cg.twoMinuteSound_g, NULL, -1, qtrue); } else if (cgs.media.twoMinuteSound_g) { trap_S_StartLocalSound(cgs.media.twoMinuteSound_g, CHAN_ANNOUNCER); } } else if (ps->persistant[PERS_TEAM] == TEAM_ALLIES) { if (cgs.media.twoMinuteSound_a == -1) { CG_SoundPlaySoundScript(cg.twoMinuteSound_a, NULL, -1, qtrue); } else if (cgs.media.twoMinuteSound_a) { trap_S_StartLocalSound(cgs.media.twoMinuteSound_a, CHAN_ANNOUNCER); } } } if (!(cg.timelimitWarnings & 4) && (msec > (cgs.timelimit) * 60 * 1000 - 30000) && (msec < (cgs.timelimit) * 60 * 1000 - 29000)) { cg.timelimitWarnings |= 4; if (ps->persistant[PERS_TEAM] == TEAM_AXIS) { if (cgs.media.thirtySecondSound_g == -1) { CG_SoundPlaySoundScript(cg.thirtySecondSound_g, NULL, -1, qtrue); } else if (cgs.media.thirtySecondSound_g) { trap_S_StartLocalSound(cgs.media.thirtySecondSound_g, CHAN_ANNOUNCER); } } else if (ps->persistant[PERS_TEAM] == TEAM_ALLIES) { if (cgs.media.thirtySecondSound_a == -1) { CG_SoundPlaySoundScript(cg.thirtySecondSound_a, NULL, -1, qtrue); } else if (cgs.media.thirtySecondSound_a) { trap_S_StartLocalSound(cgs.media.thirtySecondSound_a, CHAN_ANNOUNCER); } } } } }
/* ================== CG_CheckLocalSounds ================== */ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) { // health changes of more than -1 should make pain sounds if ( ps->stats[STAT_HEALTH] < ops->stats[STAT_HEALTH] - 1 ) { if ( ps->stats[STAT_HEALTH] > 0 ) { CG_PainEvent( &cg.predictedPlayerEntity, ps->stats[STAT_HEALTH], qfalse ); cg.painTime = cg.time; } } // timelimit warnings if ( cgs.timelimit > 0 && cgs.gamestate == GS_PLAYING) { int msec; msec = cg.time - cgs.levelStartTime; if ( cgs.timelimit > 5 && !( cg.timelimitWarnings & 1 ) && (msec > (cgs.timelimit - 5) * 60 * 1000) && ( msec < (cgs.timelimit-5)*60*1000+1000 ) ) { cg.timelimitWarnings |= 1; if( ps->persistant[PERS_TEAM] == TEAM_AXIS ) { if( cgs.media.fiveMinuteSound_g == -1 ) { CG_SoundPlaySoundScript( cg.fiveMinuteSound_g, NULL, -1, qtrue ); } else if( cgs.media.fiveMinuteSound_g ) { trap_S_StartLocalSound( cgs.media.fiveMinuteSound_g, CHAN_ANNOUNCER ); } } else if( ps->persistant[PERS_TEAM] == TEAM_ALLIES ) { if( cgs.media.fiveMinuteSound_a == -1 ) { CG_SoundPlaySoundScript( cg.fiveMinuteSound_a, NULL, -1, qtrue ); } else if( cgs.media.fiveMinuteSound_a ) { trap_S_StartLocalSound( cgs.media.fiveMinuteSound_a, CHAN_ANNOUNCER ); } } } if ( cgs.timelimit > 2 && !( cg.timelimitWarnings & 2 ) && (msec > (cgs.timelimit - 2) * 60 * 1000) && ( msec < (cgs.timelimit-2)*60*1000+1000 ) ) { cg.timelimitWarnings |= 2; if( ps->persistant[PERS_TEAM] == TEAM_AXIS ) { if( cgs.media.twoMinuteSound_g == -1 ) { CG_SoundPlaySoundScript( cg.twoMinuteSound_g, NULL, -1, qtrue ); } else if( cgs.media.twoMinuteSound_g ) { trap_S_StartLocalSound( cgs.media.twoMinuteSound_g, CHAN_ANNOUNCER ); } } else if( ps->persistant[PERS_TEAM] == TEAM_ALLIES ) { if( cgs.media.twoMinuteSound_a == -1 ) { CG_SoundPlaySoundScript( cg.twoMinuteSound_a, NULL, -1, qtrue ); } else if( cgs.media.twoMinuteSound_a ) { trap_S_StartLocalSound( cgs.media.twoMinuteSound_a, CHAN_ANNOUNCER ); } } } if ( !( cg.timelimitWarnings & 4 ) && (msec > (cgs.timelimit) * 60 * 1000 - 30000) && (msec < (cgs.timelimit) * 60 * 1000 - 29000 ) ) { cg.timelimitWarnings |= 4; if( ps->persistant[PERS_TEAM] == TEAM_AXIS ) { if( cgs.media.thirtySecondSound_g == -1 ) { CG_SoundPlaySoundScript( cg.thirtySecondSound_g, NULL, -1, qtrue ); } else if( cgs.media.thirtySecondSound_g ) { trap_S_StartLocalSound( cgs.media.thirtySecondSound_g, CHAN_ANNOUNCER ); } } else if( ps->persistant[PERS_TEAM] == TEAM_ALLIES ) { if( cgs.media.thirtySecondSound_a == -1 ) { CG_SoundPlaySoundScript( cg.thirtySecondSound_a, NULL, -1, qtrue ); } else if( cgs.media.thirtySecondSound_a ) { trap_S_StartLocalSound( cgs.media.thirtySecondSound_a, CHAN_ANNOUNCER ); } } } } }
/* ================== CG_CheckLocalSounds ================== */ void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops ) { if ( cg_hitsounds.integer && ps->clientNum == ops->clientNum && ps->persistant[PERS_SPAWN_COUNT] == ops->persistant[PERS_SPAWN_COUNT] ) { int* const h = ps->holdable; int* const oh = ops->holdable; /////////////////////////////////////////////////////////////////// if ((h[HOLDABLE_HIT] & 0x000f) > (oh[HOLDABLE_HIT] & 0x000f)) trap_S_StartLocalSound( cgs.media.hitsound_head, CHAN_LOCAL_SOUND ); if (cg_hitsounds.integer != 2) { if ((h[HOLDABLE_HIT] & 0x00f0) != (oh[HOLDABLE_HIT] & 0x00f0)) trap_S_StartLocalSound( cgs.media.hitsound_hand, CHAN_LOCAL_SOUND ); if ((h[HOLDABLE_HIT] & 0x0f00) != (oh[HOLDABLE_HIT] & 0x0f00)) trap_S_StartLocalSound( cgs.media.hitsound_torso, CHAN_LOCAL_SOUND ); if ((h[HOLDABLE_HIT] & 0xf000) != (oh[HOLDABLE_HIT] & 0xf000)) trap_S_StartLocalSound( cgs.media.hitsound_foot, CHAN_LOCAL_SOUND ); } /////////////////////////////////////////////////////////////////// if ((h[HOLDABLE_HITF] & 0x000f) != (oh[HOLDABLE_HITF] & 0x000f)) trap_S_StartLocalSound( cgs.media.hitsound_fhead, CHAN_LOCAL_SOUND ); if (cg_hitsounds.integer != 2) { if ((h[HOLDABLE_HITF] & 0x00f0) != (oh[HOLDABLE_HITF] & 0x00f0)) trap_S_StartLocalSound( cgs.media.hitsound_fhand, CHAN_LOCAL_SOUND ); if ((h[HOLDABLE_HITF] & 0x0f00) != (oh[HOLDABLE_HITF] & 0x0f00)) trap_S_StartLocalSound( cgs.media.hitsound_ftorso, CHAN_LOCAL_SOUND ); if ((h[HOLDABLE_HITF] & 0xf000) != (oh[HOLDABLE_HITF] & 0xf000)) trap_S_StartLocalSound( cgs.media.hitsound_ffoot, CHAN_LOCAL_SOUND ); } } // health changes of more than -1 should make pain sounds if ( ps->stats[STAT_HEALTH] < ops->stats[STAT_HEALTH] - 1 ) { if ( ps->stats[STAT_HEALTH] > 0 ) { CG_PainEvent( &cg.predictedPlayerEntity, ps->stats[STAT_HEALTH], qfalse ); cg.painTime = cg.time; } } // timelimit warnings if ( cgs.timelimit > 0 && cgs.gamestate == GS_PLAYING) { int msec; msec = cg.time - cgs.levelStartTime; if ( cgs.timelimit > 5 && !( cg.timelimitWarnings & 1 ) && (msec > (cgs.timelimit - 5) * 60 * 1000) && ( msec < (cgs.timelimit-5)*60*1000+1000 ) ) { cg.timelimitWarnings |= 1; if( ps->persistant[PERS_TEAM] == TEAM_AXIS ) { if( cgs.media.fiveMinuteSound_g == -1 ) { CG_SoundPlaySoundScript( cg.fiveMinuteSound_g, NULL, -1, qtrue ); } else if( cgs.media.fiveMinuteSound_g ) { trap_S_StartLocalSound( cgs.media.fiveMinuteSound_g, CHAN_ANNOUNCER ); } } else if( ps->persistant[PERS_TEAM] == TEAM_ALLIES ) { if( cgs.media.fiveMinuteSound_a == -1 ) { CG_SoundPlaySoundScript( cg.fiveMinuteSound_a, NULL, -1, qtrue ); } else if( cgs.media.fiveMinuteSound_a ) { trap_S_StartLocalSound( cgs.media.fiveMinuteSound_a, CHAN_ANNOUNCER ); } } } if ( cgs.timelimit > 2 && !( cg.timelimitWarnings & 2 ) && (msec > (cgs.timelimit - 2) * 60 * 1000) && ( msec < (cgs.timelimit-2)*60*1000+1000 ) ) { cg.timelimitWarnings |= 2; if( ps->persistant[PERS_TEAM] == TEAM_AXIS ) { if( cgs.media.twoMinuteSound_g == -1 ) { CG_SoundPlaySoundScript( cg.twoMinuteSound_g, NULL, -1, qtrue ); } else if( cgs.media.twoMinuteSound_g ) { trap_S_StartLocalSound( cgs.media.twoMinuteSound_g, CHAN_ANNOUNCER ); } } else if( ps->persistant[PERS_TEAM] == TEAM_ALLIES ) { if( cgs.media.twoMinuteSound_a == -1 ) { CG_SoundPlaySoundScript( cg.twoMinuteSound_a, NULL, -1, qtrue ); } else if( cgs.media.twoMinuteSound_a ) { trap_S_StartLocalSound( cgs.media.twoMinuteSound_a, CHAN_ANNOUNCER ); } } } if ( !( cg.timelimitWarnings & 4 ) && (msec > (cgs.timelimit) * 60 * 1000 - 30000) && (msec < (cgs.timelimit) * 60 * 1000 - 29000 ) ) { cg.timelimitWarnings |= 4; if( ps->persistant[PERS_TEAM] == TEAM_AXIS ) { if( cgs.media.thirtySecondSound_g == -1 ) { CG_SoundPlaySoundScript( cg.thirtySecondSound_g, NULL, -1, qtrue ); } else if( cgs.media.thirtySecondSound_g ) { trap_S_StartLocalSound( cgs.media.thirtySecondSound_g, CHAN_ANNOUNCER ); } } else if( ps->persistant[PERS_TEAM] == TEAM_ALLIES ) { if( cgs.media.thirtySecondSound_a == -1 ) { CG_SoundPlaySoundScript( cg.thirtySecondSound_a, NULL, -1, qtrue ); } else if( cgs.media.thirtySecondSound_a ) { trap_S_StartLocalSound( cgs.media.thirtySecondSound_a, CHAN_ANNOUNCER ); } } } } }