Pararena2/Sources/SoundUtils.c

1 line
7.8 KiB
C
Raw Permalink Normal View History

/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Sound Handling Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "SoundUtils.h" #include "SMS.h" /*======================================================== Functions */ /*======================================================== TurnSMSOn */ void TurnSMSOn (void) { if (!smsActivated) { SMSINIT(); SMSSETMODE(kFourChannel); smsActivated = TRUE; } } /*======================================================== TurnSMSOff */ void TurnSMSOff (void) { long dummyLong; if (smsActivated) { SMSSTOP(); SMSEXIT(); Delay(2, &dummyLong); smsActivated = FALSE; } } /*======================================================== PlaySoundSMS */ void PlaySoundSMS (short theSoundID) { if ((netGameInSession) && (imTheMaster) && (theSoundID < kMaxNumberOfSounds) && (soundPriorities[theSoundID] > lastSoundPriority)) { wasLastSound = theSoundID; lastSoundPriority = soundPriorities[theSoundID]; } if (smsActivated && soundLoaded[theSoundID] && soundOn) { switch (theSoundID) { case 0: break; case kClashSound: case kRicochetSound: case kBallPickUpSound: case kBallDropSound: case kBrakeSound: if (collisionSoundOn) { SMSSTART(theSoundID); } break; case kBallFiringSound: case kBeamInSound: case kBeamOutSound: if (beamSoundOn) { SMSSTART(theSoundID); } break; case kCrowdSound: case kCrowdSwellSound: case kApplauseSound: case kCrowdFadeSound: case kMobSwellSound: case kMobSound: case kMobFadeSound: if (crowdSoundOn) { SMSSTART(theSoundID); } break; default: SMSSTART(theSoundID); break; } } } /*======================================================== PlayIncidentSoundSMS */ void PlayIncidentSoundSMS (short theSoundID) { if ((smsActivated) && (soundOn) && (incidentSoundOn) && (incidentSoundLoaded[theSoundID - kMaxNumberOfSounds])) { if ((netGameInSession) && (imTheMaster) && (lastSoundPriority < 10)) { wasLastSound = theSoundID; lastSoundPriority = 10; } switch (theSoundID) { case 0: break; case kBeerManSound: case kHotDogSound: case kProgramSound: if (soundFileRefNum != -1) { SMSSTART(theSoundID); } break; default: break; } } } /*======================================================== FlushSoundQueues */ void FlushSoundQueues (void) { crowdQueue.number = 0; crowdQueue.when = 0; crowdQueue.priority = 0; incidentalQueue.number = 0; incidentalQueue.when = 0; incidentalQueue.priority = 0; } /*======================================================== BeginGamePointSound */ void BeginGamePointSound (void) { incidentalQueue.number = kGameSound; incidentalQueue.when = 180; incidentalQueue.priority = 100; } /*======================================================== BeginAllTiedSound */ void BeginAllTiedSound (void) { incidentalQueue.number = kAllSound; incidentalQueue.when = 180; incidentalQueue.priority = 100; } /*======================================================== StartCrowdSound */ void StartCrowdSound (void) { if ((smsActivated) && (crowdSoundOn) && (soundOn) && (whichGame > kPracticeScoring)) { SMSSTARTCHAN(kCrowdSound, 3); crowdQueue.number = 0; crowdQueue.when = 0; } } /*======================================================== StartApplauseSound */ void StartApplauseSound (void) { if ((smsActivated) && (crowdSoundOn) && (soundOn) && (whichGame > kPracticeScoring)) { SMSSTARTCHAN(kCrowdSwellSound, 3); crowdQueue.number = kApplauseSound; crowdQueue.when = kApplauseSwellTicks; } } /*================================================