‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
audio_shared.gsc
Go to the documentation of this file.
1 #using scripts\shared\system_shared;
2 #using scripts\shared\clientfield_shared;
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\util_shared;
5 #using scripts\shared\flag_shared;
6 #using scripts\shared\vehicle_shared;
7 #using scripts\shared\music_shared;
8 
9 #insert scripts\shared\shared.gsh;
10 #insert scripts\shared\version.gsh;
11 
12 #namespace audio;
13 
14 ‪REGISTER_SYSTEM( "audio", &‪__init__, undefined )
15 
16 function ‪__init__()
17 {
23  level thread ‪register_clientfields();
24  level thread ‪sndChyronWatcher();
25  level thread ‪sndIGCskipWatcher();
26 }
27 
29 {
30  ‪clientfield::register( "world", "sndMatchSnapshot", ‪VERSION_SHIP, 2, "int" );
31  ‪clientfield::register( "world", "sndFoleyContext", ‪VERSION_SHIP, 1, "int" );
32  ‪clientfield::register( "scriptmover", "sndRattle", ‪VERSION_SHIP, 1, "int" );
33  ‪clientfield::register( "toplayer", "sndMelee", ‪VERSION_SHIP, 1, "int" );
34  ‪clientfield::register( "vehicle", "sndSwitchVehicleContext", ‪VERSION_SHIP, 3, "int" );
35  ‪clientfield::register( "toplayer", "sndCCHacking", ‪VERSION_SHIP, 2, "int" );
36  ‪clientfield::register( "toplayer", "sndTacRig", ‪VERSION_SHIP, 1, "int" );
37  ‪clientfield::register( "toplayer", "sndLevelStartSnapOff", ‪VERSION_SHIP, 1, "int" );
38  ‪clientfield::register( "world", "sndIGCsnapshot", ‪VERSION_SHIP, 4, "int" );
39  ‪clientfield::register( "world", "sndChyronLoop", ‪VERSION_SHIP, 1, "int" );
40  ‪clientfield::register( "world", "sndZMBFadeIn", ‪VERSION_SHIP, 1, "int" );
41 }
43 {
44  level waittill( "chyron_menu_open" );
45  level ‪clientfield::set( "sndChyronLoop", 1 );
46 
47  level waittill( "chyron_menu_closed" );
48  level ‪clientfield::set( "sndChyronLoop", 0 );
49 }
51 {
52  while(1)
53  {
54  level waittill( "scene_skip_sequence_started" );
55  music::setmusicstate( "death" );
56  }
57 }
59 {
60  self ‪clientfield::set_to_player( "sndMelee", 0 );
61  self util::clientnotify( "sndDEDe" );
62 }
64 {
65  if( !‪IS_TRUE(self.‪killcam) )
66  {
67  self util::clientnotify( "sndDED" );
68  }
69 }
71 {
72  self ‪clientfield::set( "sndSwitchVehicleContext", 1 );
73 }
75 {
76  if( !isdefined( self.sndOccupants ) )
77  {
78  self.sndOccupants = 0;
79  }
80 
81  if( added )
82  {
83  self.sndOccupants++;
84  }
85  else
86  {
87  self.sndOccupants--;
88  if( self.sndOccupants < 0 )
89  {
90  self.sndOccupants = 0;
91  }
92  }
93 
94  self ‪clientfield::set( "sndSwitchVehicleContext", (self.sndOccupants+1) );
95 }
96 
97 function ‪PlayTargetMissileSound( alias, looping )
98 {
99  self notify( "stop_target_missile_sound");
100  self endon( "stop_target_missile_sound" );
101  self endon( "disconnect" );
102  self endon( "death" );
103 
104  if (IsDefined(alias))
105  {
106  time = SoundGetPlaybackTime(alias)*0.001;
107  if (time>0)
108  {
109  do
110  {
111  self playLocalSound( alias );
112  wait(time);
113  }
114  while (looping);
115  }
116  }
117 }
118 
120 {
121  self endon("death");
122  self endon("disconnect");
123 
124  if (!self ‪flag::exists("playing_stinger_fired_at_me"))
125  {
126  self ‪flag::init("playing_stinger_fired_at_me",false);
127  }
128  else
129  {
130  self ‪flag::clear("playing_stinger_fired_at_me");
131  }
132  //plays lock on warning sounds for a player
133  while (1)
134  {
135  self waittill("missile_lock", attacker, weapon);
136  if (!‪flag::get("playing_stinger_fired_at_me"))
137  {
138  self thread ‪PlayTargetMissileSound( weapon.lockonTargetLockedSound, weapon.lockonTargetLockedSoundLoops );
139  self ‪util::waittill_any("stinger_fired_at_me","missile_unlocked","death");
140  self notify( "stop_target_missile_sound");
141  }
142  }
143 }
144 
146 {
147  self endon("death");
148  self endon("disconnect");
149 
150  //plays missile fired sounds for a player
151  while (1)
152  {
153  self waittill("stinger_fired_at_me",missile, weapon ,attacker);
154  waittillframeend;
155  self ‪flag::set("playing_stinger_fired_at_me");
156  self thread ‪PlayTargetMissileSound( weapon.lockonTargetFiredOnSound, weapon.lockonTargetFiredOnSoundLoops );
157  missile ‪util::waittill_any("projectile_impact_explode","death");
158  self notify( "stop_target_missile_sound");
159  self ‪flag::clear("playing_stinger_fired_at_me");
160  }
161 }
162 
163 //TODO: Add all this back in when UnlockSongByAlias is in with exes
164 function ‪unlockFrontendMusic(unlockName,allplayers=true)
165 {
166  if( ‪IS_TRUE( allplayers ) )
167  {
168  if( isdefined(level.players) && level.players.size > 0 )
169  {
170  foreach( player in level.players )
171  {
172  player UnlockSongByAlias(unlockName);
173  }
174  }
175  }
176  else
177  {
178  self UnlockSongByAlias(unlockName);
179  }
180 }
‪__init__
‪function __init__()
Definition: audio_shared.gsc:16
‪register_clientfields
‪function register_clientfields()
Definition: audio_shared.gsc:28
‪set_to_player
‪function set_to_player(str_field_name, n_value)
Definition: clientfield_shared.gsc:58
‪clear
‪function clear(str_flag)
Definition: flag_shared.csc:130
‪VERSION_SHIP
‪#define VERSION_SHIP
Definition: version.gsh:36
‪missileLockWatcher
‪function missileLockWatcher()
Definition: audio_shared.gsc:119
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪sndResetSoundSettings
‪function sndResetSoundSettings()
Definition: audio_shared.gsc:58
‪get
‪function get(kvp_value, kvp_key="targetname")
Definition: struct.csc:13
‪sndUpdateVehicleContext
‪function sndUpdateVehicleContext(added)
Definition: audio_shared.gsc:74
‪PlayTargetMissileSound
‪function PlayTargetMissileSound(alias, looping)
Definition: audio_shared.gsc:97
‪sndChyronWatcher
‪function sndChyronWatcher()
Definition: audio_shared.gsc:42
‪on_spawned
‪function on_spawned(func, obj)
Definition: callbacks_shared.csc:245
‪missileFireWatcher
‪function missileFireWatcher()
Definition: audio_shared.gsc:145
‪waittill_any
‪function waittill_any(str_notify1, str_notify2, str_notify3, str_notify4, str_notify5)
Definition: util_shared.csc:375
‪killcam
‪function killcam(attackerNum, targetNum, killcam_entity_info, weapon, meansOfDeath, deathTime, deathTimeOffset, offsetTime, respawn, maxtime, perks, killstreaks, attacker, keep_deathcam)
Definition: _killcam.gsc:234
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪init
‪function init()
Definition: struct.csc:1
‪unlockFrontendMusic
‪function unlockFrontendMusic(unlockName, allplayers=true)
Definition: audio_shared.gsc:164
‪on_vehicle_spawned
‪function on_vehicle_spawned()
Definition: _microwave_turret.gsc:138
‪set
‪function set(str_field_name, n_value)
Definition: clientfield_shared.gsc:34
‪exists
‪function exists(str_flag)
Definition: flag_shared.csc:43
‪vehicleSpawnContext
‪function vehicleSpawnContext()
Definition: audio_shared.gsc:70
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪on_player_killed
‪function on_player_killed()
Definition: audio_shared.gsc:63
‪sndIGCskipWatcher
‪function sndIGCskipWatcher()
Definition: audio_shared.gsc:50