71@implementation PlayerEntity (Sound)
78 [sInterfaceBeepSource
setPosition:kInterfaceBeepPosition];
81 [sBreakPatternSource
setPosition:kBreakPatternPosition];
87 [sHyperspaceSoundSource
setPosition:kWitchspacePosition];
98 [sAfterburnerSources[0]
setPosition:kAfterburner1Position];
100 [sAfterburnerSources[1]
setPosition:kAfterburner2Position];
108 NSMutableDictionary *shotMissSounds = [NSMutableDictionary dictionary];
109 NSMutableDictionary *shotHitSounds = [NSMutableDictionary dictionary];
110 NSMutableDictionary *shieldHitSounds = [NSMutableDictionary dictionary];
111 NSMutableDictionary *unshieldedHitSounds = [NSMutableDictionary dictionary];
112 NSMutableDictionary *weaponLaunchedSounds = [NSMutableDictionary dictionary];
113 NSEnumerator *eqTypeEnum =
nil;
119 [shieldHitSounds setObject:@"[player-hit-by-weapon]" forKey:@"EQ_WEAPON_PLASMA_SHOT"];
120 [unshieldedHitSounds setObject:@"[player-direct-hit]" forKey:@"EQ_WEAPON_PLASMA_SHOT"];
123 #define OO_ASSIGN_SOUNDSTR_TO_SOUNDS(soundStr, sounds) do { \
124 fxString = [eqType soundStr]; \
125 if (!fxString) fxString = @""; \
126 [sounds setObject:fxString forKey:[eqType identifier]]; \
129 for (eqTypeEnum = [eqTypes objectEnumerator]; (eqType = [eqTypeEnum nextObject]); )
131 NSString *fxString =
nil;
132 if ([[eqType identifier] hasPrefix:
@"EQ_WEAPON"])
139 if ([eqType isMissileOrMine])
153 weaponShotMiss = [[NSDictionary alloc] initWithDictionary:shotMissSounds];
154 weaponShotHit = [[NSDictionary alloc] initWithDictionary:shotHitSounds];
155 weaponShieldHit = [[NSDictionary alloc] initWithDictionary:shieldHitSounds];
157 weaponLaunched = [[NSDictionary alloc] initWithDictionary:weaponLaunchedSounds];
184- (void) playInterfaceBeep:(NSString *)beepKey
187 if ([
self status] == STATUS_START_GAME) {
return; }
201 [
self playInterfaceBeep:@"[general-boop]"];
207 [
self playInterfaceBeep:@"[ident-on]"];
213 [
self playInterfaceBeep:@"[ident-off]"];
219 [
self playInterfaceBeep:@"[ident-locked-on]"];
225 [
self playInterfaceBeep:@"[missile-armed]"];
231 [
self playInterfaceBeep:@"[mine-armed]"];
237 [
self playInterfaceBeep:@"[missile-safe]"];
243 [
self playInterfaceBeep:@"[missile-locked-on]"];
249 [
self playInterfaceBeep:@"[next-equipment-selected]"];
255 [
self playInterfaceBeep:@"[next-missile-selected]"];
261 [
self playInterfaceBeep:@"[weapons-online]"];
267 [
self playInterfaceBeep:@"[weapons-offline]"];
273 [
self playInterfaceBeep:@"[cargo-jettisoned]"];
279 [
self playInterfaceBeep:@"[autopilot-on]"];
288 [
self playInterfaceBeep:@"[autopilot-off]"];
295 [
self playInterfaceBeep:@"[autopilot-out-of-range]"];
301 [
self playInterfaceBeep:@"[autopilot-cannot-dock-with-target]"];
307 [
self playInterfaceBeep:@"[save-overwrite-yes]"];
313 [
self playInterfaceBeep:@"[save-overwrite-no]"];
319 [
self playInterfaceBeep:@"[hold-full]"];
325 [
self playInterfaceBeep:@"[jump-mass-locked]"];
331 [
self playInterfaceBeep:@"[target-lost]"];
337 [
self playInterfaceBeep:@"[no-target-in-memory]"];
343 [
self playInterfaceBeep:@"[target-switched]"];
349 [
self playInterfaceBeep:@"[witch-no-target]"];
355 [
self playInterfaceBeep:@"[witch-no-fuel]"];
361 [
self playInterfaceBeep:@"[hyperspace-blocked]"];
366 [
self playInterfaceBeep:@"[witch-too-far]"];
371 [
self playInterfaceBeep:@"[cloaking-device-on]"];
377 [
self playInterfaceBeep:@"[cloaking-device-off]"];
383 [
self playInterfaceBeep:@"[menu-navigation-up]"];
389 [
self playInterfaceBeep:@"[menu-navigation-down]"];
395 [
self playInterfaceBeep:@"[menu-navigation-not]"];
401 [
self playInterfaceBeep:@"[menu-next-page]"];
407 [
self playInterfaceBeep:@"[menu-previous-page]"];
413 [
self playInterfaceBeep:@"[dismissed-report-screen]"];
419 [
self playInterfaceBeep:@"[dismissed-mission-screen]"];
425 [
self playInterfaceBeep:@"[changed-option]"];
429- (void) updateFuelScoopSoundWithInterval:(
OOTimeDelta)delta_t
431 static double scoopSoundPlayTime = 0.0;
432 scoopSoundPlayTime -= delta_t;
433 if (scoopSoundPlayTime < 0.0)
439 [
self playInterfaceBeep:@"[scoop]"];
440 scoopSoundPlayTime = 0.5;
442 else scoopSoundPlayTime = 0.0;
444 if (![
self scoopOverride])
446 scoopSoundPlayTime = 0.0;
456 static uint8_t which = 0;
458 if (!afterburner_engaged)
460 afterburnerSoundLooping = NO;
463 if (afterburnerSoundLooping)
465 [sAfterburnerSources[which]
play];
468 [
self performSelector:@selector(updateAfterburnerSound)
477 if (!afterburnerSoundLooping)
479 afterburnerSoundLooping = YES;
480 [
self updateAfterburnerSound];
493 [
self playInterfaceBeep:@"[cloaking-device-insufficent-energy]"];
593- (void) playIncomingMissile:(Vector)missileVector
647- (void) playShieldHit:(Vector)attackVector weaponIdentifier:(NSString *)weaponIdentifier
649 NSString *identifier = [weaponShieldHit objectForKey:weaponIdentifier];
650 if (!identifier) identifier =
@"[player-hit-by-weapon]";
655- (void) playDirectHit:(Vector)attackVector weaponIdentifier:(NSString *) weaponIdentifier
657 NSString *identifier = [weaponUnshieldedHit objectForKey:weaponIdentifier];
658 if (!identifier) identifier =
@"[player-direct-hit]";
663- (void) playScrapeDamage:(Vector)attackVector
669- (void) playLaserHit:(BOOL)hit offset:(Vector)weaponOffset weaponIdentifier:(NSString *)weaponIdentifier
671 NSString *identifier =
nil;
674 identifier = [weaponShotHit objectForKey:weaponIdentifier];
675 if (!identifier) identifier =
@"[player-laser-hit]";
680 identifier = [weaponShotMiss objectForKey:weaponIdentifier];
681 if (!identifier) identifier =
@"[player-laser-miss]";
688- (void) playWeaponOverheated:(Vector)weaponOffset
694- (void) playMissileLaunched:(Vector)weaponOffset weaponIdentifier:(NSString *)weaponIdentifier
696 NSString *identifier = [weaponLaunched objectForKey:weaponIdentifier];
697 if (!identifier) identifier =
@"[missile_launched]";
702- (void) playMineLaunched:(Vector)weaponOffset weaponIdentifier:(NSString *)weaponIdentifier
704 NSString *identifier = [weaponLaunched objectForKey:weaponIdentifier];
705 if (!identifier) identifier =
@"[mine_launched]";
734- (void) playLegacyScriptSound:(NSString *)key
static OOSoundSourcePool * sDamageSoundPool
static OOSoundSource * sEcmSource
static NSDictionary * weaponUnshieldedHit
static OOSoundSourcePool * sWeaponSoundPool
static OOSoundSource * sHyperspaceSoundSource
static OOSoundSourcePool * sBuySellSourcePool
static const Vector kAfterburner2Position
static const Vector kEcmPosition
static NSDictionary * weaponShotHit
static const Vector kWitchspacePosition
static OOSoundSource * sBreakPatternSource
static OOSoundSource * sAfterburnerSources[2]
static NSDictionary * weaponLaunched
static const Vector kInterfaceWarningPosition
static const Vector kBreakPatternPosition
static OOSoundSource * sInterfaceBeepSource
#define OO_ASSIGN_SOUNDSTR_TO_SOUNDS(soundStr, sounds)
static OOSoundSourcePool * sMiscSoundPool
static OOSoundSourcePool * sWarningSoundPool
static const Vector kInterfaceBeepPosition
static const Vector kAfterburner1Position
static NSDictionary * weaponShieldHit
static NSDictionary * weaponShotMiss
void playAutopilotOutOfRange()
void playWitchjumpFailure()
void playNextEquipmentSelected()
void playHostileWarning()
void playTargetSwitched()
void playMenuPagePrevious()
void playSaveOverwriteNo()
void playMenuNavigationDown()
void playHyperspaceNoFuel()
void playGalacticHyperspace()
void playMenuNavigationNot()
void playWitchjumpInsufficientFuel()
void playWitchjumpDistanceTooGreat()
void playCloakingDeviceOn()
void stopAfterburnerSound()
void playCantBuyCommodity()
void playNoTargetInMemory()
void playHyperspaceDistanceTooGreat()
void playAlertConditionRed()
void playHyperspaceNoTarget()
void playMenuNavigationUp()
void playHyperspaceBlocked()
void playWitchjumpBlocked()
void playJumpMassLocked()
void playCloakingDeviceOff()
void startAfterburnerSound()
void playCantSellCommodity()
void playAutopilotCannotDockWithTarget()
void playDismissedMissionScreen()
void playCloakingDeviceInsufficientEnergy()
void playWitchjumpMisjump()
void playStandardHyperspace()
void playSaveOverwriteYes()
void playMissileLockedOn()
void playDockWithStation()
void playDismissedReportScreen()
void playNextMissileSelected()
void updateAfterburnerSound()
void playHyperspaceAborted()
void playWeaponsOffline()
void playAegisCloseToPlanet()
void playAegisCloseToStation()
void playCargoJettisioned()
void playEscapePodScooped()
void playLaunchFromStation()
void playExitWitchspace()
NSArray * allEquipmentTypes()
void playSoundWithKey:priority:expiryTime:overlap:position:(NSString *key,[priority] float priority,[expiryTime] OOTimeDelta expiryTime,[overlap] BOOL overlap,[position] Vector position)
void playSoundWithKey:position:(NSString *key,[position] Vector position)
void playSoundWithKey:priority:position:(NSString *key,[priority] float priority,[position] Vector position)
void playSoundWithKey:(NSString *key)
void playSoundWithKey:overlap:position:(NSString *key,[overlap] BOOL overlap,[position] Vector position)
void playSoundWithKey:priority:(NSString *key,[priority] float priority)
void playCustomSoundWithKey:(NSString *key)
void playSound:(OOSound *inSound)
void setPosition:(Vector inPosition)
id soundWithCustomSoundKey:(NSString *key)
OOSound * ooSoundNamed:inFolder:(NSString *fileName,[inFolder] NSString *folderName)