‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
water_surface.csc
Go to the documentation of this file.
1 #using scripts\shared\system_shared;
2 #using scripts\shared\callbacks_shared;
3 #using scripts\shared\filter_shared;
4 #using scripts\shared\postfx_shared;
5 #insert scripts\shared\shared.gsh;
6 #using scripts\shared\util_shared;
7 
8 #namespace water_surface;
9 
10 #precache( "client_fx", "player/fx_plyr_water_jump_in_bubbles_1p" );
11 #precache( "client_fx", "player/fx_plyr_water_jump_out_splash_1p" );
12 
13 #define WATER_DIVE_OVERLAY_TIME 0.7
14 #define WATER_SHEETING_OVERLAY_TIME 2.0
15 
16 //#define START_WATER_SHEETING { filter::enable_filter_water_sheeting( self, FILTER_INDEX_WATER_SHEET ); }
17 #define STOP_WATER_SHEETING { filter::disable_filter_water_sheeting( self, FILTER_INDEX_WATER_SHEET ); stop_player_fx( self ); }
18 
19 //#define START_WATER_DIVE { filter::enable_filter_water_dive( self, FILTER_INDEX_WATER_SHEET ); }
20 #define STOP_WATER_DIVE { filter::disable_filter_water_dive( self, FILTER_INDEX_WATER_SHEET ); stop_player_fx( self );}
21 
22 ‪REGISTER_SYSTEM( "water_surface", &‪__init__, undefined )
23 
24 function ‪__init__()
25 {
26  level._effect["water_player_jump_in"] = "player/fx_plyr_water_jump_in_bubbles_1p";
27  level._effect["water_player_jump_out"] = "player/fx_plyr_water_jump_out_splash_1p";
28 
29  if ( isdefined( level.disableWaterSurfaceFX ) && level.disableWaterSurfaceFX == true )
30  {
31  return;
32  }
33 
35 }
36 
37 function ‪localplayer_spawned( localClientNum )
38 {
39  if( self != GetLocalPlayer( localClientNum ) )
40  return;
41 
42  if ( isdefined( level.disableWaterSurfaceFX ) && level.disableWaterSurfaceFX == true )
43  {
44  return;
45  }
46 
49 
50  self thread ‪underwaterWatchBegin();
51  self thread ‪underwaterWatchEnd();
52 
54 }
55 
57 {
58  self notify( "underwaterWatchBegin" );
59  self endon( "underwaterWatchBegin" );
60  self endon( "entityshutdown" );
61 
62  while( true )
63  {
64  self waittill( "underwater_begin", teleported );
65  if ( teleported )
66  {
69  }
70  else
71  {
72  self thread ‪underwaterBegin();
73  }
74  }
75 }
76 
78 {
79  self notify( "underwaterWatchEnd" );
80  self endon( "underwaterWatchEnd" );
81  self endon( "entityshutdown" );
82 
83  while( true )
84  {
85  self waittill( "underwater_end", teleported );
86  if ( teleported )
87  {
90  }
91  else
92  {
93  self thread ‪underwaterEnd();
94  }
95  }
96 }
97 
99 {
100  self notify( "water_surface_underwater_begin" );
101  self endon( "water_surface_underwater_begin" );
102  self endon( "entityshutdown" );
103 
104  localClientNum = self getlocalclientnumber();
105 
107 
108  if ( islocalclientdead( localClientNum ) == false )
109  {
110  self.firstperson_water_fx = PlayFXOnCamera( localClientNum, level._effect["water_player_jump_in"], (0,0,0), (1,0,0), (0,0,1) );
111  if ( !isdefined( self.playingPostfxBundle ) || self.playingPostfxBundle != "pstfx_watertransition" )
112  {
113  self thread postfx::PlayPostfxBundle( "pstfx_watertransition" );
114  }
115  }
116 }
117 
119 {
120  self notify( "water_surface_underwater_end" );
121  self endon( "water_surface_underwater_end" );
122  self endon( "entityshutdown" );
123 
124  localClientNum = self getlocalclientnumber();
125  if ( islocalclientdead( localClientNum ) == false )
126  {
127  if ( !isdefined( self.playingPostfxBundle ) || self.playingPostfxBundle != "pstfx_water_t_out" )
128  {
129  self thread postfx::PlayPostfxBundle( "pstfx_water_t_out" );
130  }
131  }
132 }
133 
134 
136 {
137  // turn on the water dive PostFX
139 
140  // allow the bubble clouds to proceed mostly straight upwards
142 
143  // set the tint color of the wash bubble wash
145 
146  // set the wash reveal direction to down
148  // reveal the wash
149  for ( i = 0; i < 0.05; i += 0.01 )
150  {
152  wait 0.01;
153  }
155 
156  // set the bubble cloud fade direction to up
158  // start the bubble clouds
160 
161  // set the wash reveal direction to up
163  // hide the wash
164  for ( i = 0.2; i > 0; i -= 0.01 )
165  {
167  wait 0.01;
168  }
170 
171  // allow the bubble clouds to play
172  wait 0.1;
173  // hide the bubble clouds
174  for ( i = 0.2; i > 0; i -= 0.01 )
175  {
177  wait 0.01;
178  }
179 }
180 
182 {
183  self notify( "startWaterSheeting_singleton" );
184  self endon( "startWaterSheeting_singleton" );
185 
186  self endon( "entityshutdown" );
187 
188  // enabled the filter
190 
191  // start everything revealed and scrolling
194 
195  // taper down and hide
196  for ( i = ‪WATER_SHEETING_OVERLAY_TIME; i > 0.0; i -= 0.01 )
197  {
200  // reveal the rivulets as well
201  rivulet1 = (i/2.0) - 0.19;
202  rivulet2 = (i/2.0) - 0.13;
203  rivulet3 = (i/2.0) - 0.07;
205  // pause
206  wait 0.01;
207  }
211 }
212 
213 function ‪stop_player_fx( localClient )
214 {
215  if ( IsDefined( localClient.firstperson_water_fx ) )
216  {
217  localClientNum = localClient getlocalclientnumber();
218  StopFx( localClientNum, localClient.firstperson_water_fx );
219  localClient.firstperson_water_fx = undefined;
220  }
221 }
‪localplayer_spawned
‪function localplayer_spawned(localClientNum)
Definition: water_surface.csc:37
‪on_localplayer_spawned
‪function on_localplayer_spawned(local_client_num)
Definition: _perks.csc:109
‪set_filter_water_dive_bubbles
‪function set_filter_water_dive_bubbles(player, filterid, amount)
Definition: filter_shared.csc:517
‪FILTER_INDEX_WATER_SHEET
‪#define FILTER_INDEX_WATER_SHEET
Definition: shared.gsh:483
‪startWaterDive
‪function startWaterDive()
Definition: water_surface.csc:135
‪set_filter_water_sheet_speed
‪function set_filter_water_sheet_speed(player, filterid, amount)
Definition: filter_shared.csc:476
‪__init__
‪function __init__()
Definition: water_surface.csc:24
‪init_filter_water_sheeting
‪function init_filter_water_sheeting(player)
Definition: filter_shared.csc:459
‪enable_filter_water_dive
‪function enable_filter_water_dive(player, filterid)
Definition: filter_shared.csc:506
‪STOP_WATER_DIVE
‪#define STOP_WATER_DIVE
Definition: water_surface.csc:20
‪WATER_SHEETING_OVERLAY_TIME
‪#define WATER_SHEETING_OVERLAY_TIME
Definition: water_surface.csc:14
‪set_filter_water_wash_color
‪function set_filter_water_wash_color(player, filterid, red, green, blue)
Definition: filter_shared.csc:542
‪underwaterWatchBegin
‪function underwaterWatchBegin()
Definition: water_surface.csc:56
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪init_filter_water_dive
‪function init_filter_water_dive(player)
Definition: filter_shared.csc:499
‪STOP_WATER_SHEETING
‪#define STOP_WATER_SHEETING
Definition: water_surface.csc:17
‪enable_filter_water_sheeting
‪function enable_filter_water_sheeting(player, filterid)
Definition: filter_shared.csc:465
‪set_filter_water_wash_reveal_dir
‪function set_filter_water_wash_reveal_dir(player, filterid, dir)
Definition: filter_shared.csc:537
‪underwaterEnd
‪function underwaterEnd()
Definition: water_surface.csc:118
‪underwaterWatchEnd
‪function underwaterWatchEnd()
Definition: water_surface.csc:77
‪set_filter_water_sheet_reveal
‪function set_filter_water_sheet_reveal(player, filterid, amount)
Definition: filter_shared.csc:471
‪set_filter_water_scuba_dive_speed
‪function set_filter_water_scuba_dive_speed(player, filterid, amount)
Definition: filter_shared.csc:527
‪startWaterSheeting
‪function startWaterSheeting()
Definition: water_surface.csc:181
‪underwaterBegin
‪function underwaterBegin()
Definition: water_surface.csc:98
‪set_filter_water_scuba_bubbles
‪function set_filter_water_scuba_bubbles(player, filterid, amount)
Definition: filter_shared.csc:522
‪set_filter_water_scuba_bubble_attitude
‪function set_filter_water_scuba_bubble_attitude(player, filterid, amount)
Definition: filter_shared.csc:532
‪stop_player_fx
‪function stop_player_fx(localClient)
Definition: water_surface.csc:213
‪set_filter_water_sheet_rivulet_reveal
‪function set_filter_water_sheet_rivulet_reveal(player, filterid, riv1, riv2, riv3)
Definition: filter_shared.csc:481