‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_weap_raygun_mark3.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\clientfield_shared;
5 #using scripts\shared\duplicaterender_mgr;
6 #using scripts\shared\fx_shared;
7 #using scripts\shared\system_shared;
8 #using scripts\shared\util_shared;
9 #using scripts\shared\visionset_mgr_shared;
10 
11 #insert scripts\shared\duplicaterender.gsh;
12 #insert scripts\shared\shared.gsh;
13 #insert scripts\shared\version.gsh;
14 
15 #insert scripts\zm\_zm_weap_raygun_mark3.gsh;
16 
17 #namespace _zm_weap_raygun_mark3;
18 
19 #precache( "client_fx", "dlc3/stalingrad/fx_raygun_l_projectile_blackhole_sm_hit" );
20 #precache( "client_fx", "dlc3/stalingrad/fx_raygun_l_projectile_blackhole_lg_hit" );
21 #precache( "client_fx", "dlc3/stalingrad/fx_raygun_l_projectile_blackhole_sm" );
22 #precache( "client_fx", "dlc3/stalingrad/fx_raygun_l_projectile_blackhole_lg" );
23 
24 #define DISSOLVE_MATERIAL "mc/mtl_c_zom_dlc3_zombie_dissolve_base"
25 
26 ‪REGISTER_SYSTEM( "zm_weap_raygun_mark3", &‪__init__, undefined )
27 
28 function ‪__init__()
29 {
30  level.w_raygun_mark3 = GetWeapon( ‪STR_RAYGUN_MARK3_WEAPON );
31  level.w_raygun_mark3_upgraded = GetWeapon( ‪STR_RAYGUN_MARK3_UPGRADED_WEAPON );
32 
34  level._effect[ "raygun_ai_slow_vortex_small" ] = "dlc3/stalingrad/fx_raygun_l_projectile_blackhole_sm_hit";
35  level._effect[ "raygun_ai_slow_vortex_large" ] = "dlc3/stalingrad/fx_raygun_l_projectile_blackhole_lg_hit";
36 
37  level._effect[ "raygun_slow_vortex_small" ] = "dlc3/stalingrad/fx_raygun_l_projectile_blackhole_sm";
38  level._effect[ "raygun_slow_vortex_large" ] = "dlc3/stalingrad/fx_raygun_l_projectile_blackhole_lg";
39 
42 
45 
48 
49  ‪visionset_mgr::register_visionset_info( "raygun_mark3_vortex_visionset", ‪VERSION_SHIP, ‪N_RAYGUN_MARK3_VORTEX_VISIONSET_LERP_COUNT, undefined, "zm_idgun_vortex" );
51 
52  // Register ghostly material for use
54 
56 }
57 
58 
59 // Is this the right-hand beam gun?
60 function ‪is_beam_raygun( weapon )
61 {
62  if ( weapon === level.w_raygun_mark3 || weapon === level.w_raygun_mark3_upgraded )
63  {
64  return true;
65  }
66 
67  return false;
68 }
69 
70 
71 // Check to see we switched to the weapon
72 function ‪monitor_raygun_mark3( n_local_client )
73 {
74  player = GetLocalPlayer( n_local_client );
75  player endon( "death" );
76 
77  while ( true )
78  {
79  player waittill( "weapon_change", weapon );
80 
81  if ( ‪is_beam_raygun( weapon ) )
82  {
83  player MapShaderConstant( n_local_client, 0, "scriptVector2", 0, 1, 0, 0 ); // turn ON red lights
84  player thread ‪glow_monitor( n_local_client );
85  }
86  else
87  {
88  player notify( "glow_monitor" );
89  player MapShaderConstant( n_local_client, 0, "scriptVector2", 0, 0, 0, 0 ); // turn OFF red lights
90  }
91  }
92 }
93 
94 
95 // Toggle the red glow on the ball of the right-hand beam weapon
96 // self is a player
97 function ‪glow_monitor( n_local_client )
98 {
99  self notify( "glow_monitor" );
100  self endon( "glow_monitor" );
101  self endon( "death" );
102 
103  while( true )
104  {
105  self ‪waittill_notetrack( "clamps_open" );
106 
107  self MapShaderConstant( n_local_client, 0, "scriptVector2", 0, 0, 0, 0 ); // turn OFF red lights
108 
109  self ‪waittill_notetrack( "clamps_close" );
110 
111  self MapShaderConstant( n_local_client, 0, "scriptVector2", 0, 1, 0, 0 ); // turn ON red lights
112  }
113 }
114 
115 
116 // Check for a specific notetrack
117 // self is a player
118 function ‪waittill_notetrack( str_notetrack )
119 {
120  self endon( "glow_monitor" );
121  self endon( "death" );
122 
123  while( true )
124  {
125  self waittill( "notetrack", str_note );
126 
127  if ( str_note == str_notetrack )
128  {
129  return;
130  }
131  }
132 }
133 
134 
135 // Callback Function for slow vortex generated by RGM3 left-weapon projectile impact
136 function ‪slow_vortex_fx( n_local_client, n_old, n_new, b_new_ent, b_initial_snap, str_field, b_was_time_jump ) // self == player
137 {
138  if ( isdefined( self.fx_slow_vortex ) )
139  {
140  KillFx( n_local_client, self.fx_slow_vortex );
141  }
142 
143  if ( n_new )
144  {
145  if ( n_new == ‪N_ZM_WEAP_RGM3_SLOW_VORTEX_SM )
146  {
147  self.fx_slow_vortex = PlayFxOnTag( n_local_client, level._effect[ "raygun_slow_vortex_small" ], self, "tag_origin" );
148  }
149  else
150  {
151  self.fx_slow_vortex = PlayFxOnTag( n_local_client, level._effect[ "raygun_slow_vortex_large" ], self, "tag_origin" );
152  self PlayRumbleOnEntity( n_local_client, "artillery_rumble" );
153  }
154 
155  self thread ‪vortex_shake_and_rumble( n_local_client, n_new );
156  }
157 }
158 
159 
160 // Callback Function for slow vortex fx on entities affected by slow vortex
161 function ‪ai_slow_vortex_fx( n_local_client, n_old, n_new, b_new_ent, b_initial_snap, str_field, b_was_time_jump ) // self == player
162 {
163  if ( n_new )
164  {
165  if ( n_new == ‪N_ZM_WEAP_RGM3_SLOW_VORTEX_SM )
166  {
167  self.fx_ai_slow_vortex = PlayFxOnTag( n_local_client, level._effect[ "raygun_ai_slow_vortex_small" ], self, "J_SpineUpper" );
168  self thread ‪zombie_blacken( n_local_client, true );
169  }
170  else
171  {
172  self.fx_ai_slow_vortex = PlayFxOnTag( n_local_client, level._effect[ "raygun_ai_slow_vortex_large" ], self, "J_SpineUpper" );
173  self thread ‪zombie_blacken( n_local_client, true );
174  }
175  }
176  else
177  {
178  if ( isdefined( self.fx_ai_slow_vortex ) )
179  {
180  KillFx( n_local_client, self.fx_ai_slow_vortex );
181  self thread ‪zombie_blacken( n_local_client, false );
182  }
183  }
184 }
185 
186 
187 // Looping rumble when player is inside vortex
188 function ‪vortex_shake_and_rumble( n_local_client, n_damage_level )
189 {
190  self notify( "vortex_shake_and_rumble" );
191  self endon( "vortex_shake_and_rumble" );
192 
193  self endon( "entity_shutdown" );
194 
195  if ( n_damage_level == ‪N_ZM_WEAP_RGM3_SLOW_VORTEX_SM )
196  {
197  str_rumble = "raygun_mark3_vortex_sm";
198  }
199  else
200  {
201  str_rumble = "raygun_mark3_vortex_lg";
202  }
203 
204  while( isdefined( self ) )
205  {
206  self PlayRumbleOnEntity( n_local_client, str_rumble );
207  wait 0.083;
208  }
209 }
210 
211 
212 // Blacken the zombies
213 function ‪zombie_blacken( n_local_client, b_blacken )
214 {
215  self endon( "entity_shutdown" );
216 
217  const N_STEP = 0.0166; // 1.0 / 60 ticks (1.0 sec)
218 
219  if ( !isdefined( self.n_blacken ) )
220  {
221  self.n_blacken = 0;
222  }
223 
224  if ( b_blacken )
225  {
226  while ( isdefined( self ) && self.n_blacken < 1.0 )
227  {
228  self.n_blacken += 0.2;
229  self MapShaderConstant( n_local_client, 0, "scriptVector0", self.n_blacken );
230  wait 0.05;
231  }
232  }
233  else
234  {
235  while ( isdefined( self ) && self.n_blacken > 0.0 )
236  {
237  self.n_blacken -= 0.2;
238  self MapShaderConstant( n_local_client, 0, "scriptVector0", self.n_blacken );
239  wait 0.05;
240  }
241  }
242 
243 }
244 
245 
246 // Activate disintegrate shader
247 function ‪ai_disintegrate( n_local_client, n_old, n_new, b_new_ent, b_initial_snap, str_field, b_was_time_jump ) // self == ai
248 {
249  self endon( "entity_shutdown" );
250 
251  const N_STEP = 0.0166; // 1.0 / 60 ticks (1.45 sec) , slightly less than the anim length
252 
253  // Ghostly material
254  self ‪duplicate_render::set_dr_flag( "dissolve_on", n_new );
255  self ‪duplicate_render::update_dr_filters( n_local_client );
256 
257  self.n_dissolve = 1;
258  while ( isdefined( self ) && self.n_dissolve > 0 )
259  {
260  self MapShaderConstant( n_local_client, 0, "scriptVector0", self.n_dissolve );
261 
262  self.n_dissolve -= N_STEP;
263  wait 0.0166;
264  }
265 
266  if ( isdefined( self ) )
267  {
268  self MapShaderConstant( n_local_client, 0, "scriptVector0", 0.0 );
269  }
270 }
271 
272 
‪STR_RAYGUN_MARK3_UPGRADED_WEAPON
‪#define STR_RAYGUN_MARK3_UPGRADED_WEAPON
Definition: _zm_weap_raygun_mark3.gsh:5
‪N_RAYGUN_MARK3_VORTEX_OVERLAY_BLUR_AMOUNT
‪#define N_RAYGUN_MARK3_VORTEX_OVERLAY_BLUR_AMOUNT
Definition: _zm_weap_raygun_mark3.gsh:15
‪slow_vortex_fx
‪function slow_vortex_fx(n_local_client, n_old, n_new, b_new_ent, b_initial_snap, str_field, b_was_time_jump)
Definition: _zm_weap_raygun_mark3.csc:136
‪ai_disintegrate
‪function ai_disintegrate(n_local_client, n_old, n_new, b_new_ent, b_initial_snap, str_field, b_was_time_jump)
Definition: _zm_weap_raygun_mark3.csc:247
‪__init__
‪function __init__()
Definition: _zm_weap_raygun_mark3.csc:28
‪is_beam_raygun
‪function is_beam_raygun(weapon)
Definition: _zm_weap_raygun_mark3.csc:60
‪CF_CALLBACK_ZERO_ON_NEW_ENT
‪#define CF_CALLBACK_ZERO_ON_NEW_ENT
Definition: version.gsh:103
‪VERSION_SHIP
‪#define VERSION_SHIP
Definition: version.gsh:36
‪DR_CULL_ALWAYS
‪#define DR_CULL_ALWAYS
Definition: duplicaterender.gsh:14
‪update_dr_filters
‪function update_dr_filters(localClientNum)
Definition: duplicaterender_mgr.csc:329
‪VERSION_DLC3
‪#define VERSION_DLC3
Definition: version.gsh:95
‪monitor_raygun_mark3
‪function monitor_raygun_mark3(n_local_client)
Definition: _zm_weap_raygun_mark3.csc:72
‪register_visionset_info
‪function register_visionset_info(name, version, lerp_step_count, visionset_from, visionset_to, visionset_type=VSMGR_VISIONSET_TYPE_NAKED)
Definition: visionset_mgr_shared.csc:50
‪N_RAYGUN_MARK3_VORTEX_OVERLAY_INNER_RADIUS
‪#define N_RAYGUN_MARK3_VORTEX_OVERLAY_INNER_RADIUS
Definition: _zm_weap_raygun_mark3.gsh:16
‪zombie_blacken
‪function zombie_blacken(n_local_client, b_blacken)
Definition: _zm_weap_raygun_mark3.csc:213
‪on_localclient_connect
‪function on_localclient_connect(localClientNum)
Definition: ctf.csc:20
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪vortex_shake_and_rumble
‪function vortex_shake_and_rumble(n_local_client, n_damage_level)
Definition: _zm_weap_raygun_mark3.csc:188
‪ai_slow_vortex_fx
‪function ai_slow_vortex_fx(n_local_client, n_old, n_new, b_new_ent, b_initial_snap, str_field, b_was_time_jump)
Definition: _zm_weap_raygun_mark3.csc:161
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪glow_monitor
‪function glow_monitor(n_local_client)
Definition: _zm_weap_raygun_mark3.csc:97
‪DR_TYPE_FRAMEBUFFER
‪#define DR_TYPE_FRAMEBUFFER
Definition: duplicaterender.gsh:4
‪N_ZM_WEAP_RGM3_SLOW_VORTEX_SM
‪#define N_ZM_WEAP_RGM3_SLOW_VORTEX_SM
Definition: _zm_weap_raygun_mark3.gsh:8
‪N_RAYGUN_MARK3_VORTEX_VISIONSET_LERP_COUNT
‪#define N_RAYGUN_MARK3_VORTEX_VISIONSET_LERP_COUNT
Definition: _zm_weap_raygun_mark3.gsh:14
‪STR_RAYGUN_MARK3_WEAPON
‪#define STR_RAYGUN_MARK3_WEAPON
Definition: _zm_weap_raygun_mark3.gsh:3
‪DISSOLVE_MATERIAL
‪#define DISSOLVE_MATERIAL
Definition: _zm_weap_raygun_mark3.csc:24
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪register_overlay_info_style_speed_blur
‪function register_overlay_info_style_speed_blur(name, version, lerp_step_count, amount, inner_radius, outer_radius, velocity_should_scale, velocity_scale, blur_in, blur_out, should_offset)
Definition: visionset_mgr_shared.csc:155
‪waittill_notetrack
‪function waittill_notetrack(str_notetrack)
Definition: _zm_weap_raygun_mark3.csc:118
‪set_dr_flag
‪function set_dr_flag(toset, setto=true)
Definition: duplicaterender_mgr.csc:251
‪set_dr_filter_framebuffer
‪function set_dr_filter_framebuffer(name, priority, require_flags, refuse_flags, drtype1, drval1, drcull1, drtype2, drval2, drcull2, drtype3, drval3, drcull3)
Definition: duplicaterender_mgr.csc:167