|
Wing Commander II
Reconstructed Win32 source (1996)
|
Music and sound-effect control. More...
#include "game.h"Go to the source code of this file.
Macros | |
| #define | MUSIC_C |
Functions | |
| void | StopMusicStream (void) |
| void | SetMusBreakpt (int first, int second) |
| void | SetMusicOn (short enabled) |
| void | StopMusic (short enabled) |
| short | StartMusic (void *music) |
| short | StartInteractiveMusic (int track) |
| int | StartSoundEffectHook (const unsigned char *definition, int effectHandle, int volume, int pan, int sample, int looping) |
| void | FlushSoundEffect (void) |
| void | FlushSoundEffects (void) |
| void | FadeMusic (short duration) |
| void | SceneLeaveHook (void) |
| unsigned short | ProcessMusicScriptCommand (int track, int command, short enabled) |
| void | spacetrack (int track, int mode, int enabled) |
| void | StopMusicUnlessSuppressed (void) |
| unsigned int | IsMusicTrackComplete (void) |
| void | wait_for_end_of_music (void) |
| void | new_space_music_changes (short attacker, short victim) |
| int | changetrack (void) |
| void | gametrack (void) |
| void | ScaleFixedVector (FixedVector *vector, int scale, FixedVector *result) |
| void | AddFixedVectors (const FixedVector *left, const FixedVector *right, FixedVector *sum) |
| void | ComputeVectorDelta (FixedVector *from, FixedVector *to, FixedVector *delta) |
| void | servicetrack (void) |
| void | ResetSoundState (void) |
| void | ResetSoundStateForScene (void) |
| void | ResetSoundStateForFlight (void) |
| void | DisableMusicForSceneHook (void) |
| void | EnableMusicForScene (void) |
| int | LogUnknownSoundEffect (const unsigned char *definition, short sourceObject, short pan, short volume, short looping, short priority) |
| void | FlushSoundEffectsAndLog (void *effect, short flags) |
| void | sound_effect (signed char soundNumber, short sourceObject, short looping) |
| void | PlaySfxWaveFileByNumber (int soundNumber, int sourceObject, int looping) |
Variables | |
| static int | g_nActiveMusicStreamMask = 0 |
| static signed char | g_acMusicTrackStreamFlags [72] |
| short | g_nMusicTrackComplete = 1 |
| short | g_nMusicDriverMode = 1 |
| short | g_nCutsceneMusicVolume = 0 |
| short | g_nTitleMusicSequenceStage = 0 |
| int | g_nCurrentMusicTrack = -1 |
| struct LimitedMusicBuffer | g_aLimitedMusicBuffers [2] |
| short | g_nWaitForMusicEnabled = 1 |
| short | g_bFlightSoundEffectsEnabled = 1 |
| short | g_nInitialFlightMusicPending = 1 |
| short | g_nCombatMusicActive = 0 |
| short | g_nInFlightMusicActive = 0 |
| int | g_nUnusedMusicWord1 = 0 |
| short | g_nPassingShipSoundObject = -1 |
| short | g_nPassingShipSoundCountdown = 0 |
| unsigned char | g_abSoundEffectDefinitions [0x1b8] |
| int | g_aiSoundEffectSourceActiveValue [SPACE_OBJECT_COUNT] |
| MusicResource | g_aTuneResources [66] |
| int | g_nPassingShipSndCooldown |
| short | g_10_nAlternateSampleToggle |
| int | g_14_anObjectSoundEffects [SPACE_OBJECT_COUNT] |
| int | g_2_nUnusedMusicWord2 |
Music and sound-effect control.
Definition in file music.c.
| void AddFixedVectors | ( | const FixedVector * | left, |
| const FixedVector * | right, | ||
| FixedVector * | sum ) |
| int changetrack | ( | void | ) |
Definition at line 233 of file music.c.
References changetrack(), g_aMissionObjectives, g_asShipMissionType, g_cCurrentObjective, MISSION_TYPE_DEFEND, MISSION_TYPE_ESCORT, MISSION_TYPE_PATROL, MISSION_TYPE_RENDEZVOUS, MISSION_TYPE_STRIKE, OBJECTIVE_HOME_BASE, and triumph().
Referenced by changetrack(), gametrack(), and UpdateShipTurretGuns().
| void ComputeVectorDelta | ( | FixedVector * | from, |
| FixedVector * | to, | ||
| FixedVector * | delta ) |
Definition at line 408 of file music.c.
References DisableMusicForSceneHook().
Referenced by DisableMusicForSceneHook(), and UpdateShipTurretGuns().
Definition at line 413 of file music.c.
References EnableMusicForScene(), g_nWaitForMusicEnabled, and SetMusicOn().
Referenced by EnableMusicForScene(), and UpdateShipTurretGuns().
| void FadeMusic | ( | short | duration | ) |
Definition at line 75 of file music.c.
References FadeMusic().
Referenced by FadeMusic(), InitializeMusicResources(), RunCutsceneScript(), and UpdateShipTurretGuns().
Definition at line 61 of file music.c.
References FlushSoundEffect(), SoundDebugPrintf(), and stop_all_sounds().
Referenced by FindCutsceneSoundEffect(), FlushSoundEffect(), FlushSoundEffectsAndLog(), ReleaseCutsceneSoundEffects(), ShowVictoryScreen(), and UpdateShipTurretGuns().
Definition at line 68 of file music.c.
References FlushSoundEffects(), SoundDebugPrintf(), and stop_all_sounds().
Referenced by FlushSoundEffects(), ResetSoundState(), RunCutsceneScript(), RunLoadedCutscene(), ShowVictoryScreen(), and UpdateShipTurretGuns().
Definition at line 439 of file music.c.
References FlushSoundEffect(), FlushSoundEffectsAndLog(), SoundDebugPrintf(), and void().
Referenced by ClearTargetCameraView(), FlushSoundEffectsAndLog(), house_keep(), RunTitleScreen(), TheEndFireWorks(), update_lights(), UpdateShipTurretGuns(), and UpdateTargetCameraObject().
Definition at line 266 of file music.c.
References calculate_damage_level(), changetrack(), detect_enemy_tail(), FindMissileTargetingObject(), g_bJumpSequenceActive, g_nCombatMusicActive, g_nInFlightMusicActive, g_nInitialFlightMusicPending, g_nMissionMusicTrackOverride, g_nMusicTrackComplete, g_nSpaceFrame, gametrack(), is_ship_tailing_player_target(), report_kilrathi_rout(), and spacetrack().
Referenced by gametrack(), servicetrack(), and UpdateShipTurretGuns().
| unsigned int IsMusicTrackComplete | ( | void | ) |
Definition at line 168 of file music.c.
References g_nMusicDriverMode, g_nMusicTrackComplete, and IsMusicTrackComplete().
Referenced by IsMusicTrackComplete(), and UpdateShipTurretGuns().
| int LogUnknownSoundEffect | ( | const unsigned char * | definition, |
| short | sourceObject, | ||
| short | pan, | ||
| short | volume, | ||
| short | looping, | ||
| short | priority ) |
Definition at line 422 of file music.c.
References g_bFlightSoundEffectsEnabled, LogUnknownSoundEffect(), SoundDebugPrintf(), and StartSoundEffectHook().
Referenced by LogUnknownSoundEffect(), malf_sound(), and UpdateShipTurretGuns().
| void new_space_music_changes | ( | short | attacker, |
| short | victim ) |
Definition at line 198 of file music.c.
References g_acShipPortrait, g_asShipMissionIndex, g_asShipMissionParameter, g_asShipMissionType, g_asShipSide, g_nInFlightMusicActive, g_nYourWingman, MISSION_TYPE_DEFEND, MISSION_TYPE_ESCORT, new_space_music_changes(), RandomInRange(), report_kilrathi_rout(), SIDE_IMPERIAL, SIDE_KILRATHI, and spacetrack().
Referenced by analyze_kill(), new_space_music_changes(), and UpdateShipTurretGuns().
| void PlaySfxWaveFileByNumber | ( | int | soundNumber, |
| int | sourceObject, | ||
| int | looping ) |
Definition at line 490 of file music.c.
References ComputeVectorDelta(), EYE_OBJECT, g_aiSoundEffectSourceActiveValue, g_aShipPosition, g_szSfxWavePath, PlaySfxWaveFileByNumber(), playWAVE(), SoundDebugPrintf(), and Vector_magnitude().
Referenced by accelerate(), animate_object(), animate_shape(), ApplyCannedSceneSoundRecord(), BeginShipCloak(), BeginShipDestructionSequence(), capital_ship_strike_mission(), CheckTargetLockMalfunction(), Chosen_communicate_option(), cockpit_explosion(), death_sequence(), decrement_lock_time(), Explosion(), fire_weapon(), FireTargetCameraGuns(), HandleFleetOverviewInput(), HandleSpaceFlightControls(), inflict_damage(), InflightComputer(), malf_noise(), malf_sound(), object_collision(), PlayCockpitSelectionSfx(), PlaySfxWaveFileByNumber(), RunCutsceneScript(), RunTitleScreen(), servicetrack(), ShipExplosion(), TheEndFireWorks(), ToggleTargetCameraTracking(), unwarp(), update_lights(), UpdateShipTurretGuns(), UpdateShipTurretGuns(), UpdateTargetCameraObject(), warp(), and your_afterburner().
| unsigned short ProcessMusicScriptCommand | ( | int | track, |
| int | command, | ||
| short | enabled ) |
Definition at line 89 of file music.c.
References exit_squadron(), ForceStreamerTrigger(), g_acMusicTrackStreamFlags, g_nActiveMusicStreamMask, g_nCannedSceneMode, g_nCurrentMusicTrack, ProcessMusicScriptCommand(), RecordMusicCommandHook(), SetStreamerIntensity(), SetStreamerTrigger(), SoundDebugPrintf(), StopMusic(), Streamer_open(), and Streamer_stop().
Referenced by ApplyCannedSceneMusicRecord(), ProcessMusicScriptCommand(), spacetrack(), StartInteractiveMusic(), target_locking(), and UpdateShipTurretGuns().
Definition at line 381 of file music.c.
References FlushSoundEffects(), g_3_bAfterburnerSfxActive, g_4_nSevereDmgWarningSfxHandle, and ResetSoundState().
Referenced by auto_pilot_sequence(), ResetSoundState(), ResetSoundStateForFlight(), ResetSoundStateForScene(), and UpdateShipTurretGuns().
Definition at line 398 of file music.c.
References g_bFlightSoundEffectsEnabled, ResetSoundState(), and ResetSoundStateForFlight().
Referenced by ResetSoundStateForFlight(), and UpdateShipTurretGuns().
Definition at line 389 of file music.c.
References g_bFlightSoundEffectsEnabled, ResetSoundState(), and ResetSoundStateForScene().
Referenced by ResetSoundStateForScene(), and UpdateShipTurretGuns().
| void ScaleFixedVector | ( | FixedVector * | vector, |
| int | scale, | ||
| FixedVector * | result ) |
Definition at line 80 of file music.c.
References SceneLeaveHook().
Referenced by death_sequence(), SceneLeaveHook(), and UpdateShipTurretGuns().
Definition at line 318 of file music.c.
References AddFixedVectors(), ComputeVectorDelta(), dot_product(), EYE_OBJECT, g_abSoundEffectDefinitions, g_aeObjectClass, g_aShipPosition, g_aShipVelocity, g_asObjectDistance, g_asObjectScreenX, g_bFlightSoundEffectsEnabled, g_bJumpSequenceActive, g_nMusicDriverMode, g_nPassingShipSndCooldown, g_nPassingShipSoundCountdown, g_nPassingShipSoundObject, g_nSpaceFrame, gametrack(), OBJECT_CLASS_BASE, OBJECT_CLASS_CAPITAL_SHIP, OBJECT_CLASS_SHIP, PlaySfxWaveFileByNumber(), ScaleFixedVector(), servicetrack(), and SPACE_OBJECT_COUNT.
Referenced by servicetrack(), Update_3Space(), and UpdateShipTurretGuns().
| void SetMusBreakpt | ( | int | first, |
| int | second ) |
Definition at line 20 of file music.c.
References SetMusBreakpt().
Referenced by SetMusBreakpt(), UpdateShipTurretGuns(), and wait_for_end_of_music().
| void SetMusicOn | ( | short | enabled | ) |
Definition at line 25 of file music.c.
References SetMusicOn().
Referenced by EnableMusicForScene(), SetMusicOn(), and UpdateShipTurretGuns().
| void sound_effect | ( | signed char | soundNumber, |
| short | sourceObject, | ||
| short | looping ) |
Definition at line 451 of file music.c.
References ComputeVectorDelta(), dot_product(), EYE_OBJECT, g_10_nAlternateSampleToggle, g_14_anObjectSoundEffects, g_abSoundEffectDefinitions, g_aShipPosition, g_aShipRightVector, g_bFlightSoundEffectsEnabled, g_nCannedSceneMode, g_nMusicDriverMode, MaxShort(), NormalizeFixedVector(), RecordCannedSceneBriefingCharacter(), sound_effect(), SoundDebugPrintf(), StartSoundEffectHook(), and Vector_magnitude().
Referenced by sound_effect(), and UpdateShipTurretGuns().
| void spacetrack | ( | int | track, |
| int | mode, | ||
| int | enabled ) |
Definition at line 152 of file music.c.
References g_nMusicDriverMode, ProcessMusicScriptCommand(), and spacetrack().
Referenced by death_sequence(), gametrack(), new_space_music_changes(), RunCampaignChalkboardMenu(), RunTitleScreen(), spacetrack(), TryBeginStarSystemJump(), and UpdateShipTurretGuns().
| short StartInteractiveMusic | ( | int | track | ) |
Definition at line 44 of file music.c.
References ProcessMusicScriptCommand(), SoundDebugPrintf(), and StartInteractiveMusic().
Referenced by RunCutsceneScript(), StartInteractiveMusic(), and UpdateShipTurretGuns().
| short StartMusic | ( | void * | music | ) |
Definition at line 37 of file music.c.
References SoundDebugPrintf(), and StartMusic().
Referenced by StartMusic(), Title_Sequence(), and UpdateShipTurretGuns().
| int StartSoundEffectHook | ( | const unsigned char * | definition, |
| int | effectHandle, | ||
| int | volume, | ||
| int | pan, | ||
| int | sample, | ||
| int | looping ) |
Definition at line 54 of file music.c.
References StartSoundEffectHook().
Referenced by LogUnknownSoundEffect(), sound_effect(), StartSoundEffectHook(), and UpdateShipTurretGuns().
| void StopMusic | ( | short | enabled | ) |
Definition at line 30 of file music.c.
References g_nCurrentMusicTrack, StopMusic(), and Streamer_stop().
Referenced by lock_off(), ProcessMusicScriptCommand(), ReleaseSceneMusicPacket(), RunCutsceneScript(), RunLoadedCutscene(), StopMusic(), StopMusicUnlessSuppressed(), Title_Sequence(), UpdateShipTurretGuns(), and wait_for_end_of_music().
Definition at line 14 of file music.c.
References StopMusicStream(), and Streamer_stop().
Referenced by StopMusicIfDriverActive(), StopMusicStream(), and UpdateShipTurretGuns().
Definition at line 160 of file music.c.
References g_nMusicDriverMode, StopMusic(), and StopMusicUnlessSuppressed().
Referenced by death_sequence(), free_inflight_music(), PromptToContinueCampaign(), RunCampaignChalkboardMenu(), RunTitleScreen(), StopMusicUnlessSuppressed(), and UpdateShipTurretGuns().
Definition at line 178 of file music.c.
References g_bSceneEscapeRequested, g_nMusicDriverMode, g_nMusicTrackComplete, g_nWaitForMusicEnabled, SetMusBreakpt(), StopMusic(), wait_for_end_of_music(), and WaitForInputKey().
Referenced by UpdateShipTurretGuns(), and wait_for_end_of_music().
| short g_10_nAlternateSampleToggle |
Definition at line 610 of file music.c.
Referenced by sound_effect().
| int g_14_anObjectSoundEffects[SPACE_OBJECT_COUNT] |
Definition at line 611 of file music.c.
Referenced by sound_effect().
| unsigned char g_abSoundEffectDefinitions[0x1b8] |
Definition at line 547 of file music.c.
Referenced by malf_sound(), servicetrack(), and sound_effect().
|
static |
Definition at line 11 of file music.c.
Referenced by ProcessMusicScriptCommand().
| int g_aiSoundEffectSourceActiveValue[SPACE_OBJECT_COUNT] |
Definition at line 607 of file music.c.
Referenced by PlaySfxWaveFileByNumber().
| struct LimitedMusicBuffer g_aLimitedMusicBuffers[2] |
Definition at line 527 of file music.c.
Referenced by free_inflight_music(), InitializeMusicResources(), and ReleaseMusicTrack().
| MusicResource g_aTuneResources[66] |
Definition at line 608 of file music.c.
Referenced by free_inflight_music(), InitializeMusicResources(), PreloadMusicTrack(), ReleaseMusicTrack(), and ReleaseSceneMusicPacket().
| short g_bFlightSoundEffectsEnabled = 1 |
Definition at line 532 of file music.c.
Referenced by LogUnknownSoundEffect(), ResetSoundStateForFlight(), ResetSoundStateForScene(), servicetrack(), and sound_effect().
|
static |
Definition at line 10 of file music.c.
Referenced by ProcessMusicScriptCommand().
| short g_nCombatMusicActive = 0 |
Definition at line 542 of file music.c.
Referenced by gametrack(), and init_inflight_music().
| int g_nCurrentMusicTrack = -1 |
Definition at line 525 of file music.c.
Referenced by ProcessMusicScriptCommand(), and StopMusic().
| short g_nCutsceneMusicVolume = 0 |
Definition at line 523 of file music.c.
Referenced by RunCutsceneScript().
| short g_nInFlightMusicActive = 0 |
Definition at line 543 of file music.c.
Referenced by free_inflight_music(), gametrack(), init_inflight_music(), and new_space_music_changes().
| short g_nInitialFlightMusicPending = 1 |
Definition at line 541 of file music.c.
Referenced by gametrack(), and init_inflight_music().
| short g_nMusicDriverMode = 1 |
Definition at line 522 of file music.c.
Referenced by AddCutsceneMusicNode(), AnimateTitleOrchestra(), InitializeMusicResources(), IsMusicTrackComplete(), LoadOriginFxDrivers(), PlayTitleConductorCue(), PreloadMusicTrack(), ReleaseCutsceneMusicNodes(), ReleaseCutsceneSoundEffects(), ReleaseMusicTrack(), RewriteCutsceneMusicExtensionForDriver(), RunCutsceneScript(), servicetrack(), ShowVictoryScreen(), sound_effect(), spacetrack(), StopMusicIfDriverActive(), StopMusicUnlessSuppressed(), Title_Sequence(), and wait_for_end_of_music().
| short g_nMusicTrackComplete = 1 |
Definition at line 521 of file music.c.
Referenced by gametrack(), IsMusicTrackComplete(), UpdateStreamerStoppedFlag(), and wait_for_end_of_music().
| int g_nPassingShipSndCooldown |
Definition at line 609 of file music.c.
Referenced by init_3Space_objects(), and servicetrack().
| short g_nPassingShipSoundCountdown = 0 |
Definition at line 546 of file music.c.
Referenced by servicetrack().
| short g_nPassingShipSoundObject = -1 |
Definition at line 545 of file music.c.
Referenced by servicetrack().
| short g_nTitleMusicSequenceStage = 0 |
Definition at line 524 of file music.c.
Referenced by AnimateTitleOrchestra(), PlayTitleConductorCue(), ShowVictoryScreen(), and Title_Sequence().
| short g_nWaitForMusicEnabled = 1 |
Definition at line 531 of file music.c.
Referenced by EnableMusicForScene(), and wait_for_end_of_music().