‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
scene_shared.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\animation_shared;
4 #using scripts\shared\array_shared;
5 #using scripts\shared\clientfield_shared;
6 #using scripts\shared\flagsys_shared;
7 #using scripts\shared\postfx_shared;
8 #using scripts\shared\lui_shared;
9 #using scripts\shared\scene_debug_shared;
10 #using scripts\shared\scriptbundle_shared;
11 #using scripts\shared\system_shared;
12 #using scripts\shared\util_shared;
13 #using scripts\shared\filter_shared;
14 #using scripts\shared\math_shared;
15 #using scripts\shared\callbacks_shared;
16 
17 #insert scripts\shared\shared.gsh;
18 #insert scripts\shared\version.gsh;
19 
20 #using_animtree( "generic" );
21 
22 #namespace scene;
23 
24 #define NEW_STATE(__state) flagsys::clear( "ready" );\
25  flagsys::clear( "done" );\
26  flagsys::clear( "main_done" );\
27  self notify( "new_state" );\
28  self endon( "new_state" );\
29  self notify(__state);\
30  waittillframeend;
31 
32 
33 function ‪player_scene_animation_skip( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
34 {
35  anim_name = self GetCurrentAnimScriptedName();
36 
37  if(isdefined(anim_name) && anim_name != "")
38  {
39  ‪is_looping = IsAnimLooping(localClientNum, anim_name);
40 
41  if(!‪is_looping)
42  {
43  self SetAnimTimebyName(anim_name, 1, true);
44  }
45  }
46 }
47 
48 function ‪player_scene_skip_completed( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
49 {
50  //clear any on screen subtitles
51  flushsubtitles( localClientNum );
52 
53  // assuming we are going back into gameplay, or the following scene has its own graphic content blur starts notify. clearing graphic content blur here so it doesn't affect gameplay.
54  SetDvar( "r_graphicContentBlur", false );
55  SetDvar( "r_makeDark_enable", false );
56 }
57 
59 // ___ ___ ___ _ _ ___ ___ ___ _ ___ ___ _____
60 // / __| / __| | __| | \| | | __| / _ \ | _ ) _ | | | __| / __| |_ _|
61 // \__ \ | (__ | _| | .` | | _| | (_) | | _ \ | || | | _| | (__ | |
62 // |___/ \___| |___| |_|\_| |___| \___/ |___/ \__/ |___| \___| |_|
63 //
65 
67 {
68  var ‪_e_align_array; // align entities for the objects
70 
72 
74 
76  {
77  ‪_b_spawnonce_used = false;
78  ‪_is_valid = true;
79  }
80 
82  {
83  }
84 
85  function ‪first_init( s_objdef, o_scene, e_ent, localclientnum )
86  {
87  ‪cScriptBundleObjectBase::init( s_objdef, o_scene, e_ent, localclientnum );
88 
90 
91  if ( ‪_e_array.size )
92  {
94  }
95 
96  return self;
97  }
98 
99  function ‪initialize()
100  {
101  if ( ‪IS_TRUE( ‪_s.spawnoninit ) )
102  {
103  if ( isdefined( ‪_n_clientnum ) )
104  {
105  ‪_spawn( ‪_n_clientnum, ‪IS_TRUE( ‪_s.firstframe ) || isdefined( ‪_s.initanim ) || isdefined( ‪_s.initanimloop ) );
106  }
107  else
108  {
109  ‪_spawn( 0, ‪IS_TRUE( ‪_s.firstframe ) || isdefined( ‪_s.initanim ) || isdefined( ‪_s.initanimloop ) );
110 
111  for ( clientNum = 1; clientNum < GetMaxLocalClients(); clientNum++ )
112  {
113  if ( isdefined( GetLocalPlayer( clientNum ) ) )
114  {
115  if ( ‪IS_TRUE( ‪_s.spawnoninit ) )
116  {
117  ‪_spawn( clientNum, ‪IS_TRUE( ‪_s.firstframe ) || isdefined( ‪_s.initanim ) || isdefined( ‪_s.initanimloop ) );
118  }
119  }
120  }
121  }
122  }
123 
124  ‪NEW_STATE( "init" );
125 
126  if ( isdefined( ‪_n_clientnum ) )
127  {
129  }
130  else
131  {
132  for ( clientNum = 1; clientNum < GetMaxLocalClients(); clientNum++ )
133  {
134  if ( isdefined( GetLocalPlayer( clientNum ) ) )
135  {
136  thread ‪initialize_per_client( clientNum );
137  }
138  }
139 
141  }
142  }
143 
144  function ‪initialize_per_client( clientNum )
145  {
146  self endon("new_state");
147 
148  if ( ‪IS_TRUE( ‪_s.firstframe ) )
149  {
150  if ( !‪error( !isdefined( ‪_s.mainanim ), "No animation defined for first frame." ) )
151  {
152  ‪_play_anim( clientNum, ‪_s.mainanim, 0, 0, 0, undefined, ‪_s.mainshot );
153  }
154  }
155  else if ( isdefined( ‪_s.initanim ) )
156  {
157  ‪_play_anim( clientNum, ‪_s.initanim, ‪_s.initdelaymin, ‪_s.initdelaymax, 1, undefined, ‪_s.initshot );
158 
159  if ( ‪is_alive( clientNum ) )
160  {
161  if ( isdefined( ‪_s.initanimloop ) )
162  {
163  ‪_play_anim( clientNum, ‪_s.initanimloop, 0, 0, 1, undefined, ‪_s.initshotloop, true );
164  }
165  }
166  }
167  else if ( isdefined( ‪_s.initanimloop ) )
168  {
169  ‪_play_anim( clientNum, ‪_s.initanimloop, ‪_s.initdelaymin, ‪_s.initdelaymax, 1, undefined, ‪_s.initshotloop, true );
170  }
171  else
172  {
173  ‪flagsys::set( "ready" );
174  }
175 
176  if ( !‪_is_valid )
177  {
178  ‪flagsys::set( "done" );
179  }
180  }
181 
182  function ‪play()
183  {
184  ‪NEW_STATE( "play" );
185 
186  if ( isdefined( ‪_n_clientnum ) )
187  {
189  }
190  else
191  {
192  for ( clientNum = 1; clientNum < GetMaxLocalClients(); clientNum++ )
193  {
194  if ( isdefined( GetLocalPlayer( clientNum ) ) )
195  {
196  thread ‪play_per_client( clientNum );
197  }
198  }
199 
200  ‪play_per_client( 0 );
201  }
202  }
203 
204  function ‪play_per_client( clientNum )
205  {
206  self endon("new_state");
207 
208  if ( isdefined( ‪_s.mainanim ) )
209  {
210  ‪_play_anim( clientNum, ‪_s.mainanim, ‪_s.maindelaymin, ‪_s.maindelaymax, 1, ‪_s.mainblend, ‪_s.mainshot );
211 
212  ‪flagsys::set( "main_done" );
213 
214  if ( ‪is_alive( clientNum ) )
215  {
216  if ( isdefined( ‪_s.endanim ) )
217  {
218  ‪_play_anim( clientNum, ‪_s.endanim, 0, 0, 1, undefined, ‪_s.endshot, true );
219 
220  if ( ‪is_alive( clientNum ) )
221  {
222  if ( isdefined( ‪_s.endanimloop ) )
223  {
224  ‪_play_anim( clientNum, ‪_s.endanimloop, 0, 0, 1, undefined, ‪_s.endshotloop, true );
225  }
226  }
227  }
228  else if ( isdefined( ‪_s.endanimloop ) )
229  {
230  ‪_play_anim( clientNum, ‪_s.endanimloop, 0, 0, 1, undefined, ‪_s.endshotloop, true );
231  }
232  }
233  }
234 
235  thread ‪finish_per_client( clientNum );
236  }
237 
238  function ‪finish( b_clear = false )
239  {
240  self notify( "new_state" );
241 
242  if ( isdefined( ‪_n_clientnum ) )
243  {
245  }
246  else
247  {
248  for ( clientNum = 1; clientNum < GetMaxLocalClients(); clientNum++ )
249  {
250  if ( isdefined( GetLocalPlayer( clientNum ) ) )
251  {
252  ‪finish_per_client( clientNum, b_clear );
253  }
254  }
255 
256  ‪finish_per_client( 0, b_clear );
257  }
258  }
259 
260  function ‪finish_per_client( clientNum, b_clear = false )
261  {
262  if ( !‪is_alive( clientNum ) )
263  {
264  ‪_cleanup( clientNum );
265 
266  ‪_e_array[ clientNum ] = undefined;
267  ‪_is_valid = false;
268  }
269 
270  ‪flagsys::set( "ready" );
271  ‪flagsys::set( "done" );
272 
273  if ( isdefined( ‪_e_array[ clientNum ] ) )
274  {
275  if ( ‪is_alive( clientNum ) && ( ‪IS_TRUE( ‪_s.deletewhenfinished ) || b_clear ) )
276  {
277  ‪_e_array[ clientNum ] Delete();
278  }
279  }
280 
281  ‪_cleanup( clientNum );
282  }
283 
284  function ‪get_align_ent( clientNum )
285  {
286  e_align = undefined;
287 
288  if ( isdefined( ‪_s.aligntarget ) )
289  {
290  a_scene_ents = [[‪_o_bundle]]->get_ents();
291  if ( isdefined( a_scene_ents[clientNum][ ‪_s.aligntarget ] ) )
292  {
293  e_align = a_scene_ents[clientNum][ ‪_s.aligntarget ];
294  }
295  else
296  {
297  e_align = ‪scene::get_existing_ent( clientNum, ‪_s.aligntarget );
298  }
299 
300  ‪error( !isdefined( e_align ), "Align target '" + ‪STR( ‪_s.aligntarget ) + "' doesn't exist for scene object." );
301  }
302 
303  if ( !isdefined( e_align ) )
304  {
305  e_align = [[‪scene()]]->get_align_ent( clientNum );
306  }
307 
308  return e_align;
309  }
310 
311  /* Scene Helpers */
312 
313  function ‪scene()
314  {
315  return ‪_o_bundle;
316  }
317 
318  /* internal functions */
319 
321  {
322  if ( [[‪scene()]]->‪allows_multiple() )
323  {
324  if ( isdefined( ‪_s.name ) )
325  {
326  ‪_str_name = ‪_s.name + "_gen" + level.scene_object_id;
327  }
328  else
329  {
330  ‪_str_name = [[‪scene()]]->get_name() + "_noname" + level.scene_object_id;
331  }
332 
333  level.scene_object_id++;
334  }
335  else
336  {
337  if ( isdefined( ‪_s.name ) )
338  {
339  ‪_str_name = ‪_s.name;
340  }
341  else
342  {
343  ‪_str_name = [[‪scene()]]->get_name() + "_noname" + [[‪scene()]]->get_object_id();
344  }
345  }
346  }
347 
348  function ‪get_name()
349  {
350  return ‪_str_name;
351  }
352 
353  function ‪get_orig_name()
354  {
355  return ‪_s.name;
356  }
357 
358  function ‪_spawn( clientNum, b_hide = true )
359  {
360  if ( !isdefined( ‪_e_array[clientNum] ) )
361  {
362  b_allows_multiple = [[‪scene()]]->allows_multiple();
363 
364  if ( /*error( !b_allows_multiple && !isdefined( _s.name ), "Scene that don't allow multiple instances must specify a name for all objects." )
365  || */‪error( b_allows_multiple && ‪IS_TRUE( ‪_s.nospawn ), "Scene that allow multiple instances must be allowed to spawn (uncheck 'Do Not Spawn')." ) )
366  {
367  return;
368  }
369 
370  ‪_e_array[clientNum] = ‪scene::get_existing_ent( clientNum, ‪_str_name );
371  if ( !isdefined( ‪_e_array[clientNum] ) && isdefined( ‪_s.name ) && !b_allows_multiple )
372  {
373  ‪_e_array[clientNum] = ‪scene::get_existing_ent( clientNum, ‪_s.name );
374  }
375 
376  if ( !isdefined( ‪_e_array[clientNum] ) && !‪IS_TRUE( ‪_s.nospawn ) && !‪_b_spawnonce_used )
377  {
378  _e_align = ‪get_align_ent( clientNum );
379  ‪_e_array[clientNum] = ‪util::spawn_model( clientNum, ‪_s.model, _e_align.origin, _e_align.angles );
380 
381  if ( isdefined( ‪_e_array[clientNum] ) )
382  {
383  if ( b_hide )
384  {
385  ‪_e_array[clientNum] Hide(); // Hide teleporting glitches
386  }
387 
388  ‪_e_array[clientNum].scene_spawned = ‪_o_bundle._s.name;
389  ‪_e_array[clientNum].targetname = ‪_s.name;
390  }
391  else
392  {
393  ‪error( !‪IS_TRUE( ‪_s.nospawn ), "No entity exists with matching name of scene object." );
394  }
395  }
396 
397  if ( ‪IS_TRUE( ‪_s.spawnonce ) && ‪_b_spawnonce_used )
398  {
399  return;
400  }
401 
402  if ( !‪error( !‪IS_TRUE( ‪_s.nospawn ) && !isdefined( ‪_e_array[clientNum] ), "No entity exists with matching name of scene object. Make sure a model is specified if you want to spawn it." ) )
403  {
404  ‪_prepare( clientNum );
405  }
406  }
407 
408  if ( isdefined( ‪_e_array[clientNum] ) )
409  {
410  ‪flagsys::set( "ready" );
411 
412  if ( ‪IS_TRUE( ‪_s.spawnonce ) )
413  {
414  ‪_b_spawnonce_used = true;
415  }
416  }
417  }
418 
419  function ‪_prepare( clientNum )
420  {
421  if ( !‪IS_TRUE( ‪_s.issiege ) )
422  {
423  if( !‪_e_array[clientNum] HasAnimTree() )
424  {
425  ‪_e_array[clientNum] UseAnimTree( #animtree );
426  }
427  }
428 
429  ‪_e_array[clientNum].animname = ‪_str_name;
430  ‪_e_array[clientNum].anim_debug_name = ‪_s.name;
431 
432  ‪_e_array[clientNum] ‪flagsys::set( "scene" );
433  ‪_e_array[clientNum] ‪flagsys::set( ‪_o_bundle._str_name );
434  ‪_e_array[clientNum].current_scene = ‪_o_bundle._str_name;
435  ‪_e_array[clientNum].finished_scene = undefined;
436  }
437 
438  function ‪_cleanup( clientNum )
439  {
440  if ( isdefined( ‪_e_array[clientNum] ) && isdefined( ‪_e_array[clientNum].current_scene ) )
441  {
442  ‪_e_array[clientNum] ‪flagsys::clear( ‪_o_bundle._str_name );
443 
444  if ( ‪_e_array[clientNum].current_scene == ‪_o_bundle._str_name )
445  {
446  ‪_e_array[clientNum] ‪flagsys::clear( "scene" );
447  ‪_e_array[clientNum].finished_scene = ‪_o_bundle._str_name;
448  ‪_e_array[clientNum].current_scene = undefined;
449  }
450  }
451 
452  if ( ( clientNum === ‪_n_clientnum ) || ( clientNum == 0 ) )
453  {
454  if ( isdefined( ‪_o_bundle ) && ‪IS_TRUE( ‪_o_bundle.scene_stopped ) ) // don't clear this if the scene is looping
455  {
456  ‪_o_bundle = undefined;
457  }
458  }
459  }
460 
461  function ‪_play_anim( clientNum, animation, n_delay_min = 0, n_delay_max = 0, n_rate = 1, n_blend, str_siege_shot, ‪loop )
462  {
463  n_delay = n_delay_min;
464  if ( n_delay_max > n_delay_min )
465  {
466  n_delay = RandomFloatRange( n_delay_min, n_delay_max );
467  }
468 
469  if ( n_delay > 0 )
470  {
471  ‪flagsys::set( "ready" ); // tell scene to go on without this object
472 
473  wait n_delay;
474  ‪_spawn( clientNum );
475  }
476  else
477  {
478  ‪_spawn( clientNum ) ;
479 
480  //[[scene()]]->wait_till_scene_ready();
481  }
482 
483  if ( ‪is_alive( clientNum ) )
484  {
485  /*
486  if ( IS_EQUAL( _e.scene_spawned, _o_bundle._s.name ) )
487  {
488  _e util::delay( .05, undefined, &Show ); // Entity was hidden to hide teleporting glitches
489  }
490  */
491  ‪_e_array[clientNum] Show();
492 
493  if ( ‪IS_TRUE( ‪_s.issiege ) )
494  {
495  ‪_e_array[clientNum] notify( "end" ); // make sure previous thread dies
496  ‪_e_array[clientNum] ‪animation::play_siege( animation, str_siege_shot, n_rate, ‪loop );
497  }
498  else
499  {
500  align = ‪get_align_ent( clientNum );
501  tag = ‪get_align_tag();
502 
503  if ( align == level )
504  {
505  align = ( 0, 0, 0 );
506  tag = ( 0, 0, 0 );
507  }
508 
509  ‪_e_array[clientNum] ‪animation::play( animation, align, tag, n_rate, n_blend );
510  }
511  }
512  else
513  {
514  /# ‪log( "No entity for animation '" + animation + "' so not playing it." ); #/
515  }
516 
517  ‪_is_valid = ‪is_alive( clientNum );
518  }
519 
520  function ‪get_align_tag()
521  {
522  if ( isdefined( ‪_s.AlignTargetTag ) )
523  {
524  return ‪_s.AlignTargetTag;
525  }
526  else
527  {
528  return ‪_o_bundle._s.AlignTargetTag;
529  }
530  }
531 
533  {
534  [[‪scene()]]->wait_till_scene_ready();
535  }
536 
537  function ‪has_init_state()
538  {
540  }
541 
542  function ‪is_alive( clientNum )
543  {
544  return isdefined( ‪_e_array[ clientNum ] );
545  }
546 
548  {
549  if ( isdefined( ‪_n_clientnum ) )
550  {
551  if ( isdefined( ‪_e_array[ ‪_n_clientnum ] ) && isdefined( ‪_e_array[ ‪_n_clientnum ].current_scene ) && ( ‪_e_array[ ‪_n_clientnum ].current_scene != ‪_o_bundle._str_name ) )
552  {
553  return true;
554  }
555  }
556  else
557  {
558  if ( isdefined( ‪_e_array[ 0 ] ) && isdefined( ‪_e_array[ 0 ].current_scene ) && ( ‪_e_array[ 0 ].current_scene != ‪_o_bundle._str_name ) )
559  {
560  return true;
561  }
562  }
563 
564  return false;
565  }
566 }
567 
569 // ___ ___ ___ _ _ ___
570 // / __| / __| | __| | \| | | __|
571 // \__ \ | (__ | _| | .` | | _|
572 // |___/ \___| |___| |_|\_| |___|
573 //
575 
576 class cScene : cScriptBundleBase
577 {
578  var ‪_e_root;
582 
584  {
585  ‪_n_object_id = 0;
586  ‪_str_state = "";
587  }
588 
590  {
591  }
592 
593  function ‪init( str_scenedef, s_scenedef, e_align, ‪a_ents, b_test_run )
594  {
595  ‪cScriptBundleBase::init( str_scenedef, s_scenedef, b_test_run );
596 
598 
599  if ( !‪error( ‪a_ents.size > ‪_s.objects.size, "Trying to use more entities than scene supports." ) )
600  {
601  ‪_e_root = e_align;
602 
603  ‪ARRAY_ADD( level.active_scenes[ ‪_str_name ], ‪_e_root );
604  ‪ARRAY_ADD( ‪_e_root.scenes, self );
605 
606  a_objs = ‪get_valid_object_defs();
607 
608  foreach ( str_name, e_ent in ArrayCopy( ‪a_ents ) )
609  {
610  foreach ( i, s_obj in ArrayCopy( a_objs ) )
611  {
612  if ( ‪IS_EQUAL( s_obj.name, ‪STR( str_name ) ) )
613  {
614  ‪add_object( [[ new ‪cSceneObject() ]]->first_init( s_obj, self, e_ent, ‪_e_root.localclientnum ) );
615 
616  ArrayRemoveIndex( ‪a_ents, str_name );
617  ArrayRemoveIndex( a_objs, i );
618 
619  break;
620  }
621  }
622  }
623 
624  foreach ( s_obj in a_objs )
625  {
626  ‪add_object( [[ new ‪cSceneObject() ]]->first_init( s_obj, self, array::pop( ‪a_ents ), ‪_e_root.localclientnum ) );
627  }
628 
629  self thread ‪initialize();
630  }
631  }
632 
633 /*
634  function init( str_scenedef, s_scenedef, e_align, a_ents, b_test_run )
635  {
636  cScriptBundleBase::init( str_scenedef, s_scenedef, b_test_run );
637 
638  _e_root = e_align;
639 
640  ARRAY_ADD( level.active_scenes[ _str_name ], _e_root );
641  ARRAY_ADD( _e_root.scenes, self );
642 
643  a_objs = get_valid_object_defs();
644 
645  foreach ( s_obj in a_objs )
646  {
647  add_object( [[new cSceneObject()]]->first_init( s_obj, self ) );
648  }
649 
650  _e_root thread scene::debug_display();
651 
652  self thread initialize();
653  }
654 */
655 
657  {
658  a_obj_defs = [];
659  foreach ( s_obj in ‪_s.objects )
660  {
661  if ( ‪_s.vmtype == "client" || s_obj.vmtype == "client" )
662  {
663  if ( isdefined( s_obj.name ) || isdefined( s_obj.model ) || isdefined( s_obj.initanim ) || isdefined( s_obj.mainanim ) )
664  {
665  if ( !‪IS_TRUE( s_obj.disabled ) )
666  {
667  ‪ARRAY_ADD( a_obj_defs, s_obj );
668  }
669  }
670  }
671  }
672  return a_obj_defs;
673  }
674 
675  function ‪initialize( b_playing = false )
676  {
677  self notify( "new_state" );
678  self endon( "new_state" );
679 
680  if ( ‪get_valid_objects().size > 0 )
681  {
682  level ‪flagsys::set( ‪_str_name + "_initialized" );
683  ‪_str_state = "init";
684 
685  foreach ( o_obj in ‪_a_objects )
686  {
687  thread [[o_obj]]->initialize();
688  }
689 
690  if ( !b_playing )
691  {
692  thread ‪_call_state_funcs( "init" );
693  }
694  }
695 
696  // stops the scene if all objects die in the initialize state
698  thread ‪stop();
699  }
700 
701  function ‪get_object_id()
702  {
703  ‪_n_object_id++;
704  return ‪_n_object_id;
705  }
706 
707  function ‪play( b_testing = false, str_mode = "" )
708  {
709  level endon("demo_jump"); // end when theater mode rewinds
710  self notify( "new_state" );
711  self endon( "new_state" );
712 
713  ‪_testing = b_testing;
714  ‪_str_mode = str_mode;
715 
716  if ( ‪get_valid_objects().size > 0 )
717  {
718  foreach ( o_obj in ‪_a_objects )
719  {
720  thread [[o_obj]]->play();
721  }
722 
723  level ‪flagsys::set( ‪_str_name + "_playing" );
724  ‪_str_state = "play";
725 
727 
728  thread ‪_call_state_funcs( "play" );
729 
731 
732  array::flagsys_wait_any_flag( ‪_a_objects, "done", "main_done" );
733 
734  if ( isdefined( ‪_e_root ) )
735  {
736  ‪_e_root notify( "scene_done", ‪_str_name );
737  thread ‪_call_state_funcs( "done" );
738  }
739 
740  array::flagsys_wait( ‪_a_objects, "done" );
741 
742  if ( ‪is_looping() || ( ‪_str_mode == "loop" ) )
743  {
744  if ( ‪has_init_state() )
745  {
746  level ‪flagsys::clear( ‪_str_name + "_playing" );
747 
748  thread ‪initialize();
749  }
750  else
751  {
752  level ‪flagsys::clear( ‪_str_name + "_initialized" );
753 
754  thread ‪play( b_testing, str_mode );
755  }
756  }
757  else
758  {
759  thread ‪run_next();
760  thread ‪stop( false, true );
761  }
762  }
763  else
764  {
765  thread ‪stop( false, true );
766  }
767  }
768 
769  function ‪run_next()
770  {
771  if ( isdefined( ‪_s.nextscenebundle ) && ( ‪_s.vmtype != "both" ) )
772  {
773  self waittill( "stopped", b_finished );
774 
775  if ( b_finished )
776  {
777  if ( ‪_s.scenetype == "fxanim" && ‪IS_EQUAL( ‪_s.nextscenemode, "init" ) )
778  {
779  if ( !‪error( !‪has_init_state(), "Scene can't init next scene '" + ‪_s.nextscenebundle + "' because it doesn't have an init state." ) )
780  {
781  if ( ‪allows_multiple() )
782  {
783  ‪_e_root thread ‪scene::init( ‪_s.nextscenebundle, ‪get_ents() );
784  }
785  else
786  {
787  ‪_e_root thread ‪scene::init( ‪_s.nextscenebundle );
788  }
789  }
790  }
791  else
792  {
793  if ( ‪allows_multiple() )
794  {
795  ‪_e_root thread ‪scene::play( ‪_s.nextscenebundle, ‪get_ents() );
796  }
797  else
798  {
799  ‪_e_root thread ‪scene::play( ‪_s.nextscenebundle );
800  }
801  }
802  }
803  }
804  }
805 
806  function ‪stop( b_clear = false, b_finished = false )
807  {
808  self notify( "new_state" );
809 
810  level ‪flagsys::clear( ‪_str_name + "_playing" );
811  level ‪flagsys::clear( ‪_str_name + "_initialized" );
812  ‪_str_state = "";
813 
814  thread ‪_call_state_funcs( "stop" );
815 
816  self.scene_stopped = true;
817 
818  foreach ( o_obj in ‪_a_objects )
819  {
820  if ( isdefined( o_obj ) && ![[ o_obj ]]->in_a_different_scene() )
821  {
822  thread [[o_obj]]->finish( b_clear );
823  }
824  }
825 
826  self notify( "stopped", b_finished );
827 
828  if ( IsDefined( level.active_scenes[ ‪_str_name ] ) )
829  {
830  ArrayRemoveValue( level.active_scenes[ ‪_str_name ], ‪_e_root );
831 
832  if ( level.active_scenes[ ‪_str_name ].size == 0 )
833  {
834  level.active_scenes[ ‪_str_name ] = undefined;
835  }
836  }
837 
838  if ( isdefined( ‪_e_root ) && IsDefined( ‪_e_root.scenes ) )
839  {
840  ArrayRemoveValue( ‪_e_root.scenes, self );
841 
842  if ( ‪_e_root.scenes.size == 0 )
843  {
844  ‪_e_root.scenes = undefined;
845  }
846 
847  ‪_e_root notify( "scene_done", ‪_str_name );
848  ‪_e_root.scene_played = true;
849  }
850  }
851 
852  function ‪has_init_state()
853  {
854  b_has_init_state = false;
855 
856  foreach ( o_scene_object in ‪_a_objects )
857  {
858  if ( [[o_scene_object]]->‪has_init_state() )
859  {
860  b_has_init_state = true;
861  break;
862  }
863  }
864 
865  return b_has_init_state;
866  }
867 
868  function ‪_call_state_funcs( str_state )
869  {
870  self endon( "stopped" );
871 
873 
874  if ( str_state == "play" )
875  {
876  waittillframeend; // HACK: need to allow init callbacks to happen first if init and play happen on same frame
877  }
878 
879  level notify( ‪_str_name + "_" + str_state );
880 
881  if ( isdefined( level.scene_funcs ) && isdefined( level.scene_funcs[ ‪_str_name ] ) && isdefined( level.scene_funcs[ ‪_str_name ][ str_state ] ) )
882  {
883  a_all_ents = ‪get_ents();
884 
885  foreach ( clientnum, ‪a_ents in a_all_ents )
886  {
887  foreach ( handler in level.scene_funcs[ ‪_str_name ][ str_state ] )
888  {
889  func = handler[0];
890  args = handler[1];
891 
892  switch ( args.size )
893  {
894  case 6:
895  ‪_e_root thread [[ func ]]( ‪a_ents, args[0], args[1], args[2], args[3], args[4], args[5] );
896  break;
897  case 5:
898  ‪_e_root thread [[ func ]]( ‪a_ents, args[0], args[1], args[2], args[3], args[4] );
899  break;
900  case 4:
901  ‪_e_root thread [[ func ]]( ‪a_ents, args[0], args[1], args[2], args[3] );
902  break;
903  case 3:
904  ‪_e_root thread [[ func ]]( ‪a_ents, args[0], args[1], args[2] );
905  break;
906  case 2:
907  ‪_e_root thread [[ func ]]( ‪a_ents, args[0], args[1] );
908  break;
909  case 1:
910  ‪_e_root thread [[ func ]]( ‪a_ents, args[0] );
911  break;
912  case 0:
913  ‪_e_root thread [[ func ]]( ‪a_ents );
914  break;
915  default: AssertMsg( "Too many args passed to scene func." );
916  }
917  }
918  }
919  }
920  }
921 
922  function ‪get_ents()
923  {
924  ‪a_ents = [];
925 
926  for ( clientNum = 0; clientNum < GetMaxLocalClients(); clientNum++ )
927  {
928  if ( isdefined( GetLocalPlayer( clientNum ) ) )
929  {
930  ‪a_ents[ clientNum ] = [];
931 
932  foreach ( o_obj in ‪_a_objects )
933  {
934  ent = [[ o_obj ]]->get_ent( clientNum );
935 
936  if ( isdefined( o_obj._s.name ) )
937  {
938  ‪a_ents[ clientNum ][ o_obj._s.name ] = ent;
939  }
940  else
941  {
942  ‪ARRAY_ADD( ‪a_ents, ent );
943  }
944  }
945  }
946  }
947 
948  return ‪a_ents;
949  }
950 
951  function ‪get_root()
952  {
953  return ‪_e_root;
954  }
955 
956  function ‪get_align_ent( clientNum )
957  {
958  e_align = ‪_e_root;
959 
960  if ( isdefined( ‪_s.aligntarget ) )
961  {
962  e_gdt_align = ‪scene::get_existing_ent( clientNum, ‪_s.aligntarget );
963  if ( isdefined( e_gdt_align ) )
964  {
965  e_align = e_gdt_align;
966  }
967  }
968 
969  return e_align;
970  }
971 
973  {
974  return ‪IS_TRUE( ‪_s.allowmultiple );
975  }
976 
977  function ‪is_looping()
978  {
979  return ‪IS_TRUE( ‪_s.looping );
980  }
981 
983  {
984  if ( isdefined( ‪_a_objects ) )
985  {
986  array::flagsys_wait( ‪_a_objects, "ready" );
987  }
988  }
989 
991  {
992  array::flagsys_wait( ‪_a_objects, "done" );
993  }
994 
996  {
997  a_obj = [];
998 
999  foreach ( obj in ‪_a_objects )
1000  {
1001  if ( obj._is_valid && ![[obj]]->in_a_different_scene() )
1002  {
1003  ‪ARRAY_ADD( a_obj, obj );
1004  }
1005  }
1006 
1007  return a_obj;
1008  }
1009 
1010  function ‪on_error()
1011  {
1012  ‪stop();
1013  }
1014 
1015  function ‪get_state()
1016  {
1017  return ‪_str_state;
1018  }
1019 }
1020 
1022 // _ _ ___ _ ___ ___ ___ ___
1023 // | || | | __| | | | _ \ | __| | _ \ / __|
1024 // | __ | | _| | |__ | _/ | _| | / \__ \
1025 // |_||_| |___| |____| |_| |___| |_|_\ |___/
1026 //
1028 
1029 function ‪get_existing_ent( clientNum, str_name )
1030 {
1031  e = GetEnt( clientNum, str_name, "animname" ); // entity already exists
1032  if ( !isdefined( e ) )
1033  {
1034  e = GetEnt( clientNum, str_name, "script_animname" ); // a spawner exists with script_animname
1035  if ( !isdefined( e ) )
1036  {
1037  e = GetEnt( clientNum, str_name, "targetname" ); // lastly grab any ent with targetname
1038  if ( !isdefined( e ) )
1039  {
1040  e = ‪struct::get( str_name, "targetname" ); // if no ent, grab struct with targetname
1041  }
1042  }
1043  }
1044 
1045  return e;
1046 }
1047 
1049 // _ _ _____ ___ _ ___ _____ __ __
1050 // | | | | |_ _| |_ _| | | |_ _| |_ _| \ \ / /
1051 // | |_| | | | | | | |__ | | | | \ V /
1052 // \___/ |_| |___| |____| |___| |_| |_|
1053 //
1055 
1056 ‪REGISTER_SYSTEM_EX( "scene", &‪__init__, &‪__main__, undefined )
1057 
1058 function ‪__init__()
1059 {
1060  a_scenedefs = ‪struct::get_script_bundles( "scene" );
1061 
1062  /* FIX UP STUFF FROM THE GDT */
1063 
1064  level.server_scenes = [];
1065 
1066  foreach ( s_scenedef in a_scenedefs )
1067  {
1068  s_scenedef.editaction = undefined; // only used in the asset editor
1069  s_scenedef.newobject = undefined; // only used in the asset editor
1070 
1071  if ( s_scenedef ‪is_igc() )
1072  {
1073  level.server_scenes[ s_scenedef.name ] = s_scenedef; // This is used in code callback through xcam code to make sure client scenes sync with the xcam
1074  }
1075  else if ( s_scenedef.vmtype == "both" )
1076  {
1077  n_clientbits = GetMinBitCountForNum( 3 );
1078 
1079  /#
1080  n_clientbits = GetMinBitCountForNum( 6 );
1081  #/
1082 
1083  ‪clientfield::register( "world", s_scenedef.name, ‪VERSION_SHIP, n_clientbits, "int", &‪cf_server_sync, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
1084  }
1085  }
1086 
1089 
1090  ‪clientfield::register( "toplayer", "player_scene_skip_completed", ‪VERSION_SHIP, 2, "counter", &‪player_scene_skip_completed, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
1091 
1092  ‪clientfield::register( "allplayers", "player_scene_animation_skip", ‪VERSION_SHIP, 2, "counter", &‪player_scene_animation_skip, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
1093  ‪clientfield::register( "actor", "player_scene_animation_skip", ‪VERSION_SHIP, 2, "counter", &‪player_scene_animation_skip, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
1094  ‪clientfield::register( "vehicle", "player_scene_animation_skip", ‪VERSION_SHIP, 2, "counter", &‪player_scene_animation_skip, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
1095  ‪clientfield::register( "scriptmover", "player_scene_animation_skip", ‪VERSION_SHIP, 2, "counter", &‪player_scene_animation_skip, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
1096 
1097 
1098  /* INIT SYSTEM VARS */
1099 
1100  level.scene_object_id = 0;
1101  level.active_scenes = [];
1102 
1104 }
1105 
1106 function ‪in_igc( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
1107 {
1108  player = GetLocalPlayer( localClientNum );
1109  n_entnum = player GetEntityNumber();
1110 
1111  b_igc_active = false;
1112 
1113  if ( newVal & ( 1 << n_entnum ) )
1114  {
1115  b_igc_active = true;
1116  }
1117 
1118  IGCactive( localClientNum, b_igc_active );
1119 
1120  /#
1121  //PrintTopRightln( "CLIENT " + n_entnum + ": 'in_igc' set to " + b_igc_active, ( b_igc_active ? RED : GREEN ), -1 );
1122  #/
1123 }
1124 
1125 #define TRANSITION_FILTER_INDEX 5
1126 #define TRANSITION_TIME 2000
1127 #define TRANSITION_STREAMER_TIMEOUT 5000
1128 #define TRANSITION_TIME_SHORT 850
1129 
1130 function private ‪on_localplayer_shutdown( localClientNum )
1131 {
1132  localPlayer = self;
1133  codeLocalPlayer = GetLocalPlayer( localClientNum );
1134  if ( isdefined( localPlayer ) && isdefined( localPlayer.localClientNum ) && isdefined( codeLocalPlayer ) && localPlayer == codeLocalPlayer )
1135  {
1139 
1140  localPlayer.postfx_igc_on = undefined;
1141  localPlayer.pstfx_world_construction = false;
1142  }
1143 }
1144 
1145 function ‪postfx_igc( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
1146 {
1147  self endon( "entityshutdown" );
1148 
1149  if ( ‪IS_TRUE( self.postfx_igc_on ) )
1150  {
1151  return;
1152  }
1153 
1154  if( SessionModeIsZombiesGame() )
1155  {
1156  ‪postfx_igc_zombies( localClientNum );
1157  return;
1158  }
1159 
1160  if( newVal == 3 ) //play shorter version of effect
1161  {
1162  self thread ‪postfx_igc_short( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump );
1163  return;
1164  }
1165 
1166  self.postfx_igc_on = 1;
1167 
1168  codeImageName = "postfx_igc_image" + localClientNum;
1169  CreateSceneCodeImage( localClientNum, codeImageName );
1170  CaptureFrame( localClientNum, codeImageName );
1171 
1175 
1176  setFilterPassCodeTexture( localClientNum, ‪TRANSITION_FILTER_INDEX, 0, 0, codeImageName );
1177  setFilterPassCodeTexture( localClientNum, ‪TRANSITION_FILTER_INDEX, 1, 0, codeImageName );
1178  setFilterPassCodeTexture( localClientNum, ‪TRANSITION_FILTER_INDEX, 2, 0, codeImageName );
1179 
1183 
1188 
1193 
1200 
1202  ‪filter::set_filter_sprite_transition_move_radii( self, ‪TRANSITION_FILTER_INDEX, 0, 0 ); // inner (outer - 256), outer (2000)
1203 
1206 
1207  n_hex = 0;
1208 
1209  b_streamer_wait = true;
1210 
1211  for ( i = 0; i < ‪TRANSITION_TIME; i += ( ‪CLIENT_FRAME * 1000 ) )
1212  {
1213  sT = i / 1000.0; //convert ms to sec
1214 
1215  if ( b_streamer_wait && ( sT >= .65 ) )
1216  {
1217  n_streamer_time_total = 0;
1218 
1219  while ( !IsStreamerReady() && ( n_streamer_time_total < ‪TRANSITION_STREAMER_TIMEOUT ) )
1220  {
1221  n_streamer_time = GetTime();
1222 
1223  for ( j = ( .65 * 1000 ); j < ( 1.15 * 1000 ); j += ( ‪CLIENT_FRAME * 1000 ) )
1224  {
1225  jT = j / 1000.0; //convert ms to sec
1226  ‪filter::set_filter_frame_transition_heavy_hexagons( self, ‪TRANSITION_FILTER_INDEX, MapFloat( 0.65, 1.15, 0, 1, jT ) );
1228  }
1229 
1230  for ( j = ( 1.15 * 1000 ); j < ( .65 * 1000 ); j -= ( ‪CLIENT_FRAME * 1000 ) )
1231  {
1232  jT = j / 1000.0; //convert ms to sec
1233  ‪filter::set_filter_frame_transition_heavy_hexagons( self, ‪TRANSITION_FILTER_INDEX, MapFloat( 0.65, 1.15, 0, 1, jT ) );
1235  }
1236 
1237  n_streamer_time_total += ( GetTime() - n_streamer_time );
1238  }
1239 
1240  b_streamer_wait = false;
1241  }
1242 
1243  if ( sT <= 0.5 )
1244  {
1245  ‪filter::set_filter_frame_transition_iris( self, ‪TRANSITION_FILTER_INDEX, MapFloat( 0, 0.5, 0, 1, sT ) );
1246  }
1247  else if ( sT > 0.5 && sT <= 0.85 )
1248  {
1249  ‪filter::set_filter_frame_transition_iris( self, ‪TRANSITION_FILTER_INDEX, 1 - MapFloat( 0.5, 0.85, 0, 1, sT ) );
1250  }
1251  else
1252  {
1254  }
1255 
1256  if ( newVal == 2 )
1257  {
1258  if ( sT > 1.0 && !‪IS_TRUE( self.pstfx_world_construction ) )
1259  {
1260  self thread postfx::playpostfxbundle( "pstfx_world_construction" );
1261  self.pstfx_world_construction = true;
1262  }
1263  }
1264 
1265  //LIGHT HEX
1266  if ( sT > 0.5 && sT <= 1.0 )
1267  {
1268  n_hex = MapFloat( 0.5, 1.0, 0, 1, sT );
1270 
1271  if ( sT >= 0.8 )
1272  {
1273  ‪filter::set_filter_frame_transition_flare( self, ‪TRANSITION_FILTER_INDEX, MapFloat( 0.8, 1, 0, 1, sT ) );
1274  }
1275  }
1276  else if ( sT > 1.0 && sT < 1.5 )
1277  {
1280  }
1281  else
1282  {
1285  }
1286 
1287  //HEAVY HEX
1288  if ( sT > 0.65 && sT <= 1.15 )
1289  {
1290  ‪filter::set_filter_frame_transition_heavy_hexagons( self, ‪TRANSITION_FILTER_INDEX, MapFloat( 0.65, 1.15, 0, 1, sT ) );
1291  }
1292  else if ( sT > 1.21 && sT < 1.50 )
1293  {
1295  }
1296  else
1297  {
1299  }
1300 
1301 
1302  if ( sT > 1.21 && sT <= 1.5 )
1303  {
1304  ‪filter::set_filter_frame_transition_blur( self, ‪TRANSITION_FILTER_INDEX, MapFloat( 1.0, 1.5, 0, 1, sT ) );
1305  ‪filter::set_filter_sprite_transition_boost( self, ‪TRANSITION_FILTER_INDEX, MapFloat( 1.0, 1.5, 0, 1, sT ) );
1307  ‪filter::set_filter_base_frame_transition_durden_blur( self, ‪TRANSITION_FILTER_INDEX, 1.0 - MapFloat( 1.0, 1.5, 0, 1, sT ) );
1308  ‪filter::set_filter_sprite_transition_blur( self, ‪TRANSITION_FILTER_INDEX, MapFloat( 1.0, 1.5, 0, 0.1, sT ) );
1309  }
1310  else if ( sT > 1.5 )
1311  {
1317  }
1318 
1319  if ( sT > 1.0 && sT <= 1.45 )
1320  {
1321  ‪filter::set_filter_base_frame_transition_boost( self, ‪TRANSITION_FILTER_INDEX, MapFloat( 1.0, 1.45, 0.5, 1, sT ) );
1322  }
1323  else if ( sT > 1.45 && sT < 1.75)
1324  {
1326  }
1327  else if ( sT >= 1.75 )
1328  {
1329  ‪filter::set_filter_base_frame_transition_boost( self, ‪TRANSITION_FILTER_INDEX, 1.0 - MapFloat(1.75, 2.0, 0, 1, sT ) );
1330  }
1331 
1332  if ( sT >= 1.75 )
1333  {
1334  val = 1.0 - MapFloat(1.75, 2.0, 0, 1, sT );
1337  }
1338 
1339  if ( sT >= 1.25 )
1340  {
1341  val = 1.0 - MapFloat( 1.25, 1.75, 0, 1, sT );
1343  }
1344 
1345  // RREVEAL SECRET FRAME
1346  if ( sT >= 1.75 && sT < 2.0 )
1347  {
1348  ‪filter::set_filter_base_frame_transition_durden( self, ‪TRANSITION_FILTER_INDEX, 1.0 - MapFloat( 1.75, 2.0, 0, 1, sT ) );
1349  }
1350 
1351  // update timings
1352  if ( sT > 1.0 )
1353  {
1355 
1356  outer_radii = MapFloat( 1.0, 1.50, 0, 2000, sT );
1357  ‪filter::set_filter_sprite_transition_move_radii( self, ‪TRANSITION_FILTER_INDEX, outer_radii - 256, outer_radii );
1358  }
1359 
1360  if ( sT > 1.15 && sT < 1.85 )
1361  {
1362  ‪filter::set_filter_frame_transition_warp( self, ‪TRANSITION_FILTER_INDEX, -1 * ( MapFloat( 1.15, 1.85, 0, 1, sT ) ) );
1363  }
1364  else if ( sT >= 1.85 )
1365  {
1366  ‪filter::set_filter_frame_transition_warp( self, ‪TRANSITION_FILTER_INDEX, -1 * ( 1 - MapFloat( 1.85, 2.0, 0, 1, sT ) ) );
1367  }
1368 
1370  }
1371 
1372 
1376 
1377  self.pstfx_world_construction = false;
1378 
1379  FreeCodeImage( localClientNum, codeImageName );
1380  self.postfx_igc_on = undefined;
1381 }
1382 
1383 function ‪postfx_igc_zombies( localClientNum )
1384 {
1385  ‪lui::screen_fade_out(0, "black");
1386 
1388 
1390 
1391  self.postfx_igc_on = undefined;
1392 }
1393 
1394 function ‪postfx_igc_short( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
1395 {
1396  self endon( "entityshutdown" );
1397 
1398  self.postfx_igc_on = 1;
1399 
1400  codeImageName = "postfx_igc_image" + localClientNum;
1401  CreateSceneCodeImage( localClientNum, codeImageName );
1402  CaptureFrame( localClientNum, codeImageName );
1403 
1407 
1408  setFilterPassCodeTexture( localClientNum, ‪TRANSITION_FILTER_INDEX, 0, 0, codeImageName );
1409  setFilterPassCodeTexture( localClientNum, ‪TRANSITION_FILTER_INDEX, 1, 0, codeImageName );
1410  setFilterPassCodeTexture( localClientNum, ‪TRANSITION_FILTER_INDEX, 2, 0, codeImageName );
1411 
1415 
1417 
1418  b_streamer_wait = true;
1419 
1420  for ( i = 0; i < ‪TRANSITION_TIME_SHORT; i += ( ‪CLIENT_FRAME * 1000 ) )
1421  {
1422  sT = i / 1000.0; //convert ms to sec
1423 
1424  if ( sT <= 0.5 )
1425  {
1426  ‪filter::set_filter_frame_transition_iris( self, ‪TRANSITION_FILTER_INDEX, MapFloat( 0, 0.5, 0, 1, sT ) );
1427  }
1428  else if ( sT > 0.5 && sT <= 0.85 )
1429  {
1430  ‪filter::set_filter_frame_transition_iris( self, ‪TRANSITION_FILTER_INDEX, 1 - MapFloat( 0.5, 0.85, 0, 1, sT ) );
1431  }
1432  else
1433  {
1435  }
1436 
1438  }
1439 
1443 
1444  FreeCodeImage( localClientNum, codeImageName );
1445  self.postfx_igc_on = undefined;
1446 }
1447 
1448 function ‪cf_server_sync( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
1449 {
1450  switch ( newVal )
1451  {
1452  case 0:
1453 
1454  if ( ‪is_active( fieldName ) )
1455  {
1456  level thread ‪scene::stop( fieldName );
1457  }
1458 
1459  break;
1460 
1461  case 1:
1462 
1463  level thread ‪scene::init( fieldName );
1464  break;
1465 
1466  case 2:
1467 
1468  level thread ‪scene::play( fieldName );
1469  break;
1470  }
1471 }
1472 
1473 function ‪remove_invalid_scene_objects( s_scenedef )
1474 {
1475  a_invalid_object_indexes = [];
1476 
1477  foreach ( i, s_object in s_scenedef.objects )
1478  {
1479  if ( !isdefined( s_object.name ) && !isdefined( s_object.model ) )
1480  {
1481  ‪ARRAY_ADD( a_invalid_object_indexes, i );
1482  }
1483  }
1484 
1485  for ( i = a_invalid_object_indexes.size - 1; i >= 0 ; i-- )
1486  {
1487  ArrayRemoveIndex( s_scenedef.objects, a_invalid_object_indexes[i] );
1488  }
1489 
1490  return s_scenedef;
1491 }
1492 
1493 function ‪is_igc()
1494 {
1495  return ( IsString( self.cameraswitcher )
1496  || IsString( self.extraCamSwitcher1 )
1497  || IsString( self.extraCamSwitcher2 )
1498  || IsString( self.extraCamSwitcher3 )
1499  || IsString( self.extraCamSwitcher4 ) );
1500 }
1501 
1502 function ‪__main__()
1503 {
1504  wait 0.05; // wait for initialization stage to end so we can toggle client fields
1505 
1506  /* RUN INSTANCES */
1507 
1508 // util::waitforallclients();
1509 
1510  if ( isdefined( level.disableFXAnimInSplitscreenCount ) )
1511  {
1512  if ( isdefined( level.localplayers ) )
1513  {
1514  if ( level.localplayers.size >= level.disableFXAnimInSplitscreenCount )
1515  {
1516  return;
1517  }
1518  }
1519  }
1520 
1521  a_instances = ArrayCombine(
1522  ‪struct::get_array( "scriptbundle_scene", "classname" ),
1523  ‪struct::get_array( "scriptbundle_fxanim", "classname" ),
1524  false, false
1525  );
1526 
1527  foreach ( s_instance in a_instances )
1528  {
1529  /* TODO: can we get these to work client side? The KVPs aren't currently available client side
1530  if ( isdefined( s_instance.scriptgroup_initscenes ) )
1531  {
1532  trigs = GetEntArray( 0, s_instance.scriptgroup_initscenes, "scriptgroup_initscenes" );
1533  if ( isdefined( trigs ) )
1534  {
1535  foreach ( trig in trigs )
1536  {
1537  s_instance thread _trigger_init( trig );
1538  }
1539  }
1540  }
1541 
1542  if ( isdefined( s_instance.scriptgroup_playscenes ) )
1543  {
1544  trigs = GetEntArray( 0, s_instance.scriptgroup_playscenes, "scriptgroup_playscenes" );
1545  if ( isdefined( trigs ) )
1546  {
1547  foreach ( trig in trigs )
1548  {
1549  s_instance thread _trigger_play( trig );
1550  }
1551  }
1552  }
1553 
1554  if ( isdefined( s_instance.scriptgroup_stopscenes ) )
1555  {
1556  trigs = GetEntArray( 0, s_instance.scriptgroup_stopscenes, "scriptgroup_stopscenes" );
1557  if ( isdefined( trigs ) )
1558  {
1559  foreach ( trig in trigs )
1560  {
1561  s_instance thread _trigger_stop( trig );
1562  }
1563  }
1564  }
1565  */
1566  }
1567 
1568  foreach ( s_instance in a_instances )
1569  {
1570  s_scenedef = ‪struct::get_script_bundle( "scene", s_instance.scriptbundlename );
1571 
1572  Assert( isdefined( s_scenedef ), "Scriptbundle @ " + s_instance.origin + " uses scriptbundle '" + s_instance.scriptbundlename + "' that doesn't exist." );
1573 
1574  if ( s_scenedef.vmtype == "client" )
1575  {
1576  if ( ‪SPAWNFLAG( s_instance, ‪SPAWNFLAG_SCRIPTBUNDLE_PLAY ) )
1577  {
1578  s_instance thread ‪play();
1579  }
1580  else if ( ‪SPAWNFLAG( s_instance, ‪SPAWNFLAG_SCRIPTBUNDLE_INIT ) )
1581  {
1582  s_instance thread ‪init();
1583  }
1584  }
1585  }
1586 }
1587 
1588 function ‪_trigger_init( trig )
1589 {
1590  trig endon( "entityshutdown" );
1591  trig waittill( "trigger" );
1593 }
1594 
1595 function ‪_trigger_play( trig )
1596 {
1597  trig endon( "entityshutdown" );
1598 
1599  do
1600  {
1601  trig waittill( "trigger" );
1603  }
1604  while ( ‪IS_TRUE( ‪get_scenedef( self.scriptbundlename ).looping ) );
1605 }
1606 
1607 function ‪_trigger_stop( trig )
1608 {
1609  trig endon( "entityshutdown" );
1610  trig waittill( "trigger" );
1612 }
1613 
1628 function ‪add_scene_func( str_scenedef, func, str_state = "play", ... )
1629 {
1630  /#
1631  Assert( isdefined( ‪get_scenedef( str_scenedef ) ), "Trying to add a scene function for scene '" + str_scenedef + "' that doesn't exist." );
1632  #/
1633 
1634  ‪DEFAULT( level.scene_funcs, [] );
1635  ‪DEFAULT( level.scene_funcs[ str_scenedef ], [] );
1636  ‪ARRAY_ADD( level.scene_funcs[ str_scenedef ][ str_state ], Array( func, vararg ) );
1637 }
1638 
1652 function ‪remove_scene_func( str_scenedef, func, str_state = "play" )
1653 {
1654  /#
1655  Assert( isdefined( ‪get_scenedef( str_scenedef ) ), "Trying to remove a scene function for scene '" + str_scenedef + "' that doesn't exist." );
1656  #/
1657 
1658  ‪DEFAULT( level.scene_funcs, [] );
1659 
1660  if ( isdefined( level.scene_funcs[ str_scenedef ] ) && isdefined( level.scene_funcs[ str_scenedef ][ str_state ] ) )
1661  {
1662  for ( i = level.scene_funcs[ str_scenedef ][ str_state ].size - 1; i >= 0; i-- )
1663  {
1664  if ( level.scene_funcs[ str_scenedef ][ str_state ][ i ][ 0 ] == func )
1665  {
1666  ArrayRemoveIndex( level.scene_funcs[ str_scenedef ][ str_state ], i );
1667  }
1668  }
1669  }
1670 }
1671 
1695 function ‪spawn( arg1, arg2, arg3, arg4, b_test_run )
1696 {
1697  str_scenedef = arg1;
1698 
1699  Assert( isdefined( str_scenedef ), "Cannot create a scene without a scene def." );
1700 
1701  if ( IsVec( arg2 ) )
1702  {
1703  v_origin = arg2;
1704  v_angles = arg3;
1705  ‪a_ents = arg4;
1706  }
1707  else // overloaded the params so you can put them in different orders
1708  {
1709  ‪a_ents = arg2;
1710  v_origin = arg3;
1711  v_angles = arg4;
1712  }
1713 
1714  s_instance = SpawnStruct();
1715  s_instance.origin = ( isdefined( v_origin ) ? v_origin : (0, 0, 0) );
1716  s_instance.angles = ( isdefined( v_angles ) ? v_angles : (0, 0, 0) );
1717  s_instance.classname = "scriptbundle_scene";
1718  s_instance.scriptbundlename = str_scenedef;
1719  s_instance ‪struct::init();
1720 
1721  s_instance ‪scene::init( str_scenedef, ‪a_ents, undefined, b_test_run );
1722 
1723  return s_instance;
1724 }
1725 
1760 function ‪init( arg1, arg2, arg3, b_test_run )
1761 {
1762  if ( self == level )
1763  {
1764  if ( IsString( arg1 ) )
1765  {
1766  if ( IsString( arg2 ) )
1767  {
1768  str_value = arg1;
1769  str_key = arg2;
1770  ‪a_ents = arg3;
1771  }
1772  else
1773  {
1774  str_value = arg1;
1775  ‪a_ents = arg2;
1776  }
1777 
1778  if ( isdefined( str_key ) )
1779  {
1780  a_instances = ‪struct::get_array( str_value, str_key );
1781 
1782  /#
1783  Assert( a_instances.size, "No scene instances with KVP '" + str_key + "'/'" + str_value + "'." );
1784  #/
1785  }
1786  else
1787  {
1788  a_instances = ‪struct::get_array( str_value, "targetname" );
1789  if ( !a_instances.size )
1790  {
1791  a_instances = ‪struct::get_array( str_value, "scriptbundlename" );
1792  }
1793  }
1794 
1795  if ( !a_instances.size )
1796  {
1797  ‪_init_instance( str_value, ‪a_ents, b_test_run );
1798  }
1799  else
1800  {
1801  foreach ( s_instance in a_instances )
1802  {
1803  if ( isdefined( s_instance ) )
1804  {
1805  s_instance thread ‪_init_instance( undefined, ‪a_ents, b_test_run );
1806  }
1807  }
1808  }
1809  }
1810  }
1811  else
1812  {
1813  if ( IsString( arg1 ) )
1814  {
1815  ‪_init_instance( arg1, arg2, b_test_run );
1816  }
1817  else
1818  {
1819  ‪_init_instance( arg2, arg1, b_test_run );
1820  }
1821 
1822  return self;
1823  }
1824 }
1825 
1826 function ‪get_scenedef( str_scenedef )
1827 {
1828  return ‪struct::get_script_bundle( "scene", str_scenedef );
1829 }
1830 
1831 function ‪get_scenedefs( str_type = "scene" )
1832 {
1833  a_scenedefs = [];
1834 
1835  foreach ( s_scenedef in ‪struct::get_script_bundles( "scene" ) )
1836  {
1837  if ( s_scenedef.sceneType == str_type )
1838  {
1839  ‪ARRAY_ADD( a_scenedefs, s_scenedef );
1840  }
1841  }
1842 
1843  return a_scenedefs;
1844 }
1845 
1846 function ‪_init_instance( str_scenedef, ‪a_ents, b_test_run = false )
1847 {
1848  ‪DEFAULT( str_scenedef, self.scriptbundlename );
1849 
1850  s_bundle = ‪get_scenedef( str_scenedef );
1851 
1852  /#
1853 
1854  Assert( isdefined( str_scenedef ), "Scene at (" + ( isdefined( self.origin ) ? self.origin : "level" ) + ") is missing its scene def." );
1855  Assert( isdefined( s_bundle ), "Scene at (" + ( isdefined( self.origin ) ? self.origin : "level" ) + ") is using a scene name '" + str_scenedef + "' that doesn't exist." );
1856 
1857  #/
1858 
1859  o_scene = ‪get_active_scene( str_scenedef );
1860 
1861  if ( isdefined( o_scene ) )
1862  {
1863  if ( isdefined( self.scriptbundlename ) && !b_test_run )
1864  {
1865  return o_scene;
1866  }
1867 
1868  thread [[o_scene]]->initialize( true );
1869  }
1870  else
1871  {
1872  o_scene = new cScene();
1873  [[o_scene]]->init( str_scenedef, s_bundle, self, ‪a_ents, b_test_run );
1874  }
1875 
1876  return o_scene;
1877 }
1878 
1913 function ‪play( arg1, arg2, arg3, b_test_run = false, str_mode = "" )
1914 {
1915  s_tracker = SpawnStruct();
1916  s_tracker.n_scene_count = 1;
1917 
1918  if ( self == level )
1919  {
1920  if ( IsString( arg1 ) )
1921  {
1922  if ( IsString( arg2 ) )
1923  {
1924  str_value = arg1;
1925  str_key = arg2;
1926  ‪a_ents = arg3;
1927  }
1928  else
1929  {
1930  str_value = arg1;
1931  ‪a_ents = arg2;
1932  }
1933 
1934  str_scenedef = str_value;
1935 
1936  if ( isdefined( str_key ) )
1937  {
1938  a_instances = ‪struct::get_array( str_value, str_key );
1939 
1940  str_scenedef = undefined; // use struct scenedef
1941 
1942  /#
1943  Assert( a_instances.size, "No scene instances with KVP '" + str_key + "'/'" + str_value + "'." );
1944  #/
1945  }
1946  else
1947  {
1948  a_instances = ‪struct::get_array( str_value, "targetname" );
1949  if ( !a_instances.size )
1950  {
1951  a_instances = ‪struct::get_array( str_value, "scriptbundlename" );
1952  }
1953  else
1954  {
1955  str_scenedef = undefined; // use struct scenedef
1956  }
1957  }
1958 
1959  if ( isdefined( str_scenedef ) )
1960  {
1961  a_active_instances = ‪get_active_scenes( str_scenedef );
1962  a_instances = ArrayCombine( a_active_instances, a_instances, false, false );
1963  }
1964 
1965  if ( !a_instances.size )
1966  {
1967  self thread ‪_play_instance( s_tracker, str_scenedef, ‪a_ents, b_test_run, str_mode );
1968  }
1969  else
1970  {
1971  s_tracker.n_scene_count = a_instances.size;
1972 
1973  foreach ( s_instance in a_instances )
1974  {
1975  if ( isdefined( s_instance ) )
1976  {
1977  s_instance thread ‪_play_instance( s_tracker, str_scenedef, ‪a_ents, b_test_run, str_mode );
1978  }
1979  }
1980  }
1981  }
1982  }
1983  else
1984  {
1985  if ( IsString( arg1 ) )
1986  {
1987  self thread ‪_play_instance( s_tracker, arg1, arg2, b_test_run, str_mode );
1988  }
1989  else
1990  {
1991  self thread ‪_play_instance( s_tracker, arg2, arg1, b_test_run, str_mode );
1992  }
1993  }
1994 
1995  ‪waittill_scene_done( s_tracker );
1996 }
1997 
1998 function private ‪waittill_scene_done( s_tracker )
1999 {
2000  level endon("demo_jump"); // end when theater mode rewinds
2001 
2002  for ( i = 0; i < s_tracker.n_scene_count; i++ )
2003  {
2004  s_tracker waittill( "scene_done" );
2005  }
2006 }
2007 
2008 
2009 function ‪_play_instance( s_tracker, str_scenedef, ‪a_ents, b_test_run, str_mode )
2010 {
2011  ‪DEFAULT( str_scenedef, self.scriptbundlename );
2012 
2013  if ( self.scriptbundlename === str_scenedef ) // Radiant placed scene, only play once unless specified to play more than once
2014  {
2015  str_scenedef = self.scriptbundlename;
2016 
2017 // if ( !IS_TRUE( self.script_play_multiple ) )
2018 // {
2019 // if ( IS_TRUE( self.scene_played ) && !b_test_run )
2020 // {
2021 // waittillframeend;
2022 // while ( is_playing( str_scenedef ) )
2023 // {
2024 // WAIT_SERVER_FRAME;
2025 // }
2026 //
2027 // s_tracker notify( "scene_done" );
2028 // return;
2029 // }
2030 // }
2031 
2032  self.scene_played = true;
2033  }
2034 
2035  o_scene = ‪_init_instance( str_scenedef, ‪a_ents, b_test_run );
2036  if ( isdefined(o_scene) )
2037  {
2038  thread [[o_scene]]->play( b_test_run, str_mode );
2039  }
2040 
2041  self ‪waittill_instance_scene_done( str_scenedef );
2042 
2043  if ( isdefined( self ) )
2044  {
2045  if ( isdefined( self.scriptbundlename ) && ‪IS_TRUE( ‪get_scenedef( self.scriptbundlename ).looping ) )
2046  {
2047  self.scene_played = false;
2048  }
2049  }
2050 
2051  s_tracker notify( "scene_done" );
2052 }
2053 
2054 function private ‪waittill_instance_scene_done( str_scenedef )
2055 {
2056  level endon("demo_jump"); // end when theater mode rewinds
2057 
2058  self waittillmatch( "scene_done", str_scenedef );
2059 }
2060 
2061 
2062 
2097 function ‪stop( arg1, arg2, arg3, b_cancel, b_no_assert = false )
2098 {
2099  if ( self == level )
2100  {
2101  if ( IsString( arg1 ) )
2102  {
2103  if ( IsString( arg2 ) )
2104  {
2105  str_value = arg1;
2106  str_key = arg2;
2107  b_clear = arg3;
2108  }
2109  else
2110  {
2111  str_value = arg1;
2112  b_clear = arg2;
2113  }
2114 
2115  if ( isdefined( str_key ) )
2116  {
2117  a_instances = ‪struct::get_array( str_value, str_key );
2118 
2119  /#
2120  Assert( b_no_assert || a_instances.size, "No scene instances with KVP '" + str_key + "'/'" + str_value + "'." );
2121  #/
2122 
2123  str_value = undefined;
2124  }
2125  else
2126  {
2127  a_instances = ‪struct::get_array( str_value, "targetname" );
2128  if ( !a_instances.size )
2129  {
2130  a_instances = ‪get_active_scenes( str_value );
2131  }
2132  else
2133  {
2134  str_value = undefined;
2135  }
2136  }
2137 
2138  foreach ( s_instance in ArrayCopy( a_instances ) )
2139  {
2140  if ( isdefined( s_instance ) )
2141  {
2142  s_instance ‪_stop_instance( b_clear, str_value, b_cancel );
2143  }
2144  }
2145  }
2146  }
2147  else
2148  {
2149  if ( IsString( arg1 ) )
2150  {
2151  ‪_stop_instance( arg2, arg1, b_cancel );
2152  }
2153  else
2154  {
2155  ‪_stop_instance( arg1, arg2, b_cancel );
2156  }
2157  }
2158 }
2159 
2160 function ‪_stop_instance( b_clear = false, str_scenedef, b_cancel = false )
2161 {
2162  if ( isdefined( self.scenes ) )
2163  {
2164  foreach ( o_scene in ArrayCopy( self.scenes ) )
2165  {
2166  str_scene_name = [[o_scene]]->get_name();
2167 
2168  if ( !isdefined( str_scenedef ) || ( str_scene_name == str_scenedef ) )
2169  {
2170  thread [[o_scene]]->stop( b_clear, b_cancel );
2171  }
2172  }
2173  }
2174 }
2175 
2176 function ‪cancel( arg1, arg2, arg3 )
2177 {
2178  ‪stop( arg1, arg2, arg3, true );
2179 }
2180 
2181 function ‪has_init_state( str_scenedef )
2182 {
2183  s_scenedef = ‪get_scenedef( str_scenedef );
2184  foreach ( s_obj in s_scenedef.objects )
2185  {
2186  if ( !‪IS_TRUE( s_obj.disabled ) && s_obj ‪_has_init_state() )
2187  {
2188  return true;
2189  }
2190  }
2191 
2192  return false;
2193 }
2194 
2196 {
2197  return ( ‪IS_TRUE( self.spawnoninit ) || isdefined( self.initanim ) || isdefined( self.initanimloop ) || ‪IS_TRUE( self.firstframe ) );
2198 }
2199 
2216 function ‪get_prop_count( str_scenedef )
2217 {
2218  return ‪_get_type_count( "prop", str_scenedef );
2219 }
2220 
2237 function ‪get_vehicle_count( str_scenedef )
2238 {
2239  return ‪_get_type_count( "vehicle", str_scenedef );
2240 }
2241 
2258 function ‪get_actor_count( str_scenedef )
2259 {
2260  return ‪_get_type_count( "actor", str_scenedef );
2261 }
2262 
2279 function ‪get_player_count( str_scenedef )
2280 {
2281  return ‪_get_type_count( "player", str_scenedef );
2282 }
2283 
2284 function ‪_get_type_count( str_type, str_scenedef )
2285 {
2286  s_scenedef = ( isdefined( str_scenedef ) ? ‪get_scenedef( str_scenedef ) : ‪get_scenedef( self.scriptbundlename ) );
2287 
2288  n_count = 0;
2289  foreach ( s_obj in s_scenedef.objects )
2290  {
2291  if ( isdefined( s_obj.type ) )
2292  {
2293  if ( ToLower( s_obj.type ) == ToLower( str_type ) )
2294  {
2295  n_count++;
2296  }
2297  }
2298  }
2299 
2300  return n_count;
2301 }
2302 
2314 function ‪is_active( str_scenedef )
2315 {
2316  if ( self == level )
2317  {
2318  return ( ‪get_active_scenes( str_scenedef ).size > 0 );
2319  }
2320  else
2321  {
2322  return ( isdefined( ‪get_active_scene( str_scenedef ) ) );
2323  }
2324 }
2325 
2336 function ‪is_playing( str_scenedef )
2337 {
2338  if ( self == level )
2339  {
2340  return ( level ‪flagsys::get( str_scenedef + "_playing" ) );
2341  }
2342  else
2343  {
2344  ‪DEFAULT( str_scenedef, self.scriptbundlename );
2345 
2346  o_scene = ‪get_active_scene( str_scenedef );
2347  if ( isdefined( o_scene ) )
2348  {
2349  return ( ‪IS_EQUAL( o_scene._str_state, "play" ) );
2350  }
2351  }
2352 
2353  return false;
2354 }
2355 
2356 function ‪get_active_scenes( str_scenedef )
2357 {
2358  ‪DEFAULT( level.active_scenes, [] );
2359 
2360  if ( isdefined( str_scenedef ) )
2361  {
2362  return ( isdefined( level.active_scenes[ str_scenedef ] ) ? level.active_scenes[ str_scenedef ] : [] );
2363  }
2364  else
2365  {
2366  a_active_scenes = [];
2367  foreach ( str_scenedef, _ in level.active_scenes )
2368  {
2369  a_active_scenes = ArrayCombine( a_active_scenes, level.active_scenes[ str_scenedef ], false, false );
2370  }
2371 
2372  return a_active_scenes;
2373  }
2374 }
2375 
2376 function ‪get_active_scene( str_scenedef )
2377 {
2378  if ( isdefined( str_scenedef ) && isdefined( self.scenes ) )
2379  {
2380  foreach ( o_scene in self.scenes )
2381  {
2382  if ( [[o_scene]]->‪get_name() == str_scenedef )
2383  {
2384  return o_scene;
2385  }
2386  }
2387  }
2388 }
2389 
2391 {
2392  str_mode = GetDvarString( "scene_menu_mode", "default" );
2393 
2394  if ( IsSubStr( str_mode, "capture" ) )
2395  {
2396  return true;
2397  }
2398  else
2399  {
2400  return false;
2401  }
2402 }
‪_stop_instance
‪function _stop_instance(b_clear=false, str_scenedef, b_cancel=false)
Definition: scene_shared.csc:2160
‪set_filter_sprite_transition_octogons
‪function set_filter_sprite_transition_octogons(player, filterid, octos)
Definition: filter_shared.csc:877
‪init_filter_base_frame_transition
‪function init_filter_base_frame_transition(player)
Definition: filter_shared.csc:972
‪is_igc
‪function is_igc()
Definition: scene_shared.csc:1493
‪wait_till_scene_done
‪function wait_till_scene_done()
Definition: scene_shared.csc:990
‪cSceneObject::destructor
‪destructor()
Definition: scene_shared.csc:81
‪is_active
‪function is_active(str_scenedef)
Definition: scene_shared.csc:2314
‪_trigger_stop
‪function _trigger_stop(trig)
Definition: scene_shared.csc:1607
‪get_script_bundles
‪function get_script_bundles(str_type)
Definition: struct.csc:77
‪enable_filter_sprite_transition
‪function enable_filter_sprite_transition(player, filterid)
Definition: filter_shared.csc:870
‪cSceneObject::_e_align_array
‪var _e_align_array
Definition: scene_shared.csc:68
‪set_filter_frame_transition_heavy_hexagons
‪function set_filter_frame_transition_heavy_hexagons(player, filterid, hexes)
Definition: filter_shared.csc:926
‪cSceneObject::_prepare
‪function _prepare(clientNum)
Definition: scene_shared.csc:419
‪cSceneObject::is_alive
‪function is_alive(clientNum)
Definition: scene_shared.csc:542
‪set_filter_base_frame_transition_durden_blur
‪function set_filter_base_frame_transition_durden_blur(player, filterid, blur)
Definition: filter_shared.csc:999
‪play
‪function play(b_testing=false, str_mode="")
Definition: scene_shared.csc:707
‪TRANSITION_TIME_SHORT
‪#define TRANSITION_TIME_SHORT
Definition: scene_shared.csc:1128
‪set_filter_frame_transition_light_hexagons
‪function set_filter_frame_transition_light_hexagons(player, filterid, hexes)
Definition: filter_shared.csc:931
‪cSceneObject::get_orig_name
‪function get_orig_name()
Definition: scene_shared.csc:353
‪spawn
‪function spawn(arg1, arg2, arg3, arg4, b_test_run)
Definition: scene_shared.csc:1695
‪set_filter_base_frame_transition_durden
‪function set_filter_base_frame_transition_durden(player, filterid, opacity)
Definition: filter_shared.csc:994
‪stop
‪function stop(b_clear=false, b_finished=false)
Definition: scene_shared.csc:806
‪cancel
‪function cancel(arg1, arg2, arg3)
Definition: scene_shared.csc:2176
‪cSceneObject
Definition: scene_shared.csc:66
‪postfx_igc
‪function postfx_igc(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: scene_shared.csc:1145
‪get_prop_count
‪function get_prop_count(str_scenedef)
Definition: scene_shared.csc:2216
‪cScriptBundleObjectBase
Definition: scriptbundle_shared.csc:7
‪enable_filter_base_frame_transition
‪function enable_filter_base_frame_transition(player, filterid)
Definition: filter_shared.csc:978
‪_a_objects
‪var _a_objects
Definition: scriptbundle_shared.csc:80
‪set_filter_sprite_transition_blur
‪function set_filter_sprite_transition_blur(player, filterid, blur)
Definition: filter_shared.csc:882
‪disable_filter_frame_transition
‪function disable_filter_frame_transition(player, filterid)
Definition: filter_shared.csc:961
‪_init_instance
‪function _init_instance(str_scenedef, a_ents, b_test_run=false)
Definition: scene_shared.csc:1846
‪_str_state
‪var _str_state
Definition: scene_shared.csc:579
‪cSceneObject::finish_per_client
‪function finish_per_client(clientNum, b_clear=false)
Definition: scene_shared.csc:260
‪init
‪function init(str_scenedef, s_scenedef, e_align, a_ents, b_test_run)
Definition: scene_shared.csc:593
‪clear
‪function clear(str_flag)
Definition: flag_shared.csc:130
‪remove_scene_func
‪function remove_scene_func(str_scenedef, func, str_state="play")
Definition: scene_shared.csc:1652
‪cSceneObject::_prepare
‪function _prepare()
Definition: scene_shared.gsc:593
‪cScriptBundleObjectBase::_e_array
‪var _e_array
Definition: scriptbundle_shared.csc:11
‪set_filter_base_frame_transition_boost
‪function set_filter_base_frame_transition_boost(player, filterid, boost)
Definition: filter_shared.csc:989
‪play_siege
‪function play_siege(str_anim, str_shot="default", n_rate=1, b_loop=false)
Definition: animation_shared.csc:168
‪_e_root
‪cSceneObject _e_root
‪set_filter_frame_transition_iris
‪function set_filter_frame_transition_iris(player, filterid, opacity)
Definition: filter_shared.csc:946
‪TRANSITION_TIME
‪#define TRANSITION_TIME
Definition: scene_shared.csc:1126
‪SPAWNFLAG_SCRIPTBUNDLE_PLAY
‪#define SPAWNFLAG_SCRIPTBUNDLE_PLAY
Definition: shared.gsh:93
‪get_existing_ent
‪function get_existing_ent(clientNum, str_name)
Definition: scene_shared.csc:1029
‪cSceneObject::scene
‪function scene()
Definition: scene_shared.csc:313
‪get_scenedef
‪function get_scenedef(str_scenedef)
Definition: scene_shared.csc:1826
‪disable_filter_sprite_transition
‪function disable_filter_sprite_transition(player, filterid)
Definition: filter_shared.csc:903
‪_str_mode
‪var _str_mode
Definition: scene_shared.csc:581
‪_play_instance
‪function _play_instance(s_tracker, str_scenedef, a_ents, b_test_run, str_mode)
Definition: scene_shared.csc:2009
‪cSceneObject::get_align_ent
‪function get_align_ent()
Definition: scene_shared.gsc:272
‪on_localclient_shutdown
‪function on_localclient_shutdown(func, obj)
Definition: callbacks_shared.csc:190
‪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
‪cSceneObject::_cleanup
‪function _cleanup(clientNum)
Definition: scene_shared.csc:438
‪get_array
‪function get_array(kvp_value, kvp_key="targetname")
Definition: struct.csc:34
‪screen_fade_in
‪function screen_fade_in(fadeintime)
Definition: hud_shared.gsc:264
‪cSceneObject::_is_valid
‪var _is_valid
Definition: scene_shared.csc:71
‪get_vehicle_count
‪function get_vehicle_count(str_scenedef)
Definition: scene_shared.csc:2237
‪get_player_count
‪function get_player_count(str_scenedef)
Definition: scene_shared.csc:2279
‪SPAWNFLAG_SCRIPTBUNDLE_INIT
‪#define SPAWNFLAG_SCRIPTBUNDLE_INIT
Definition: shared.gsh:92
‪cScriptBundleObjectBase::_s
‪var _s
Definition: scriptbundle_shared.csc:9
‪cSceneObject::get_align_ent
‪function get_align_ent(clientNum)
Definition: scene_shared.csc:284
‪set_filter_sprite_transition_move_radii
‪function set_filter_sprite_transition_move_radii(player, filterid, inner, outter)
Definition: filter_shared.csc:892
‪add_scene_func
‪function add_scene_func(str_scenedef, func, str_state="play",...)
Definition: scene_shared.csc:1628
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪cSceneObject::play
‪function play()
Definition: scene_shared.csc:182
‪has_init_state
‪function has_init_state()
Definition: scene_shared.csc:852
‪get_active_scene
‪function get_active_scene(str_scenedef)
Definition: scene_shared.csc:2376
‪postfx_igc_short
‪function postfx_igc_short(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: scene_shared.csc:1394
‪get
‪function get(kvp_value, kvp_key="targetname")
Definition: struct.csc:13
‪disable_filter_base_frame_transition
‪function disable_filter_base_frame_transition(player, filterid)
Definition: filter_shared.csc:1004
‪cSceneObject::initialize
‪function initialize()
Definition: scene_shared.csc:99
‪cSceneObject::_cleanup
‪function _cleanup()
Definition: scene_shared.gsc:1098
‪add_object
‪function add_object(o_object)
Definition: scriptbundle_shared.csc:128
‪is_playing
‪function is_playing(str_scenedef)
Definition: scene_shared.csc:2336
‪error
‪function error(msg)
Definition: _util.gsc:28
‪waittill_instance_scene_done
‪function private waittill_instance_scene_done(str_scenedef)
Definition: scene_shared.csc:2054
‪spawn_model
‪function spawn_model(n_client, str_model, origin=(0, 0, 0), angles=(0, 0, 0))
Definition: util_shared.csc:92
‪_testing
‪var _testing
Definition: scriptbundle_shared.csc:82
‪TRANSITION_STREAMER_TIMEOUT
‪#define TRANSITION_STREAMER_TIMEOUT
Definition: scene_shared.csc:1127
‪set_filter_sprite_transition_boost
‪function set_filter_sprite_transition_boost(player, filterid, boost)
Definition: filter_shared.csc:887
‪loop
‪function loop(clientNum)
Definition: fx_shared.csc:248
‪CLIENT_FRAME
‪#define CLIENT_FRAME
Definition: shared.gsh:263
‪constructor
‪constructor()
Definition: scene_shared.csc:583
‪get_actor_count
‪function get_actor_count(str_scenedef)
Definition: scene_shared.csc:2258
‪_get_type_count
‪function _get_type_count(str_type, str_scenedef)
Definition: scene_shared.csc:2284
‪cSceneObject::play_per_client
‪function play_per_client(clientNum)
Definition: scene_shared.csc:204
‪get_align_ent
‪function get_align_ent(clientNum)
Definition: scene_shared.csc:956
‪DEFAULT
‪#define DEFAULT(__var, __default)
Definition: shared.gsh:270
‪is_capture_mode
‪function is_capture_mode()
Definition: scene_shared.csc:2390
‪waittill_scene_done
‪function private waittill_scene_done(s_tracker)
Definition: scene_shared.csc:1998
‪TRANSITION_FILTER_INDEX
‪#define TRANSITION_FILTER_INDEX
Definition: scene_shared.csc:1125
‪NEW_STATE
‪#define NEW_STATE(__state)
Definition: scene_shared.csc:24
‪postfx_igc_zombies
‪function postfx_igc_zombies(localClientNum)
Definition: scene_shared.csc:1383
‪set_filter_sprite_transition_elapsed
‪function set_filter_sprite_transition_elapsed(player, filterid, time)
Definition: filter_shared.csc:898
‪_str_name
‪var _str_name
Definition: scriptbundle_shared.csc:79
‪__main__
‪function __main__()
Definition: scene_shared.csc:1502
‪cSceneObject::initialize_per_client
‪function initialize_per_client(clientNum)
Definition: scene_shared.csc:144
‪cSceneObject::_spawn
‪function _spawn(clientNum, b_hide=true)
Definition: scene_shared.csc:358
‪STR
‪#define STR(__var)
Definition: shared.gsh:297
‪is_looping
‪function is_looping()
Definition: scene_shared.csc:977
‪cScriptBundleObjectBase::_o_bundle
‪var _o_bundle
Definition: scriptbundle_shared.csc:10
‪REGISTER_SYSTEM_EX
‪#define REGISTER_SYSTEM_EX(__sys, __func_init_preload, __func_init_postload, __reqs)
Definition: shared.gsh:209
‪cScriptBundleObjectBase::log
‪function log(str_msg)
Definition: scriptbundle_shared.csc:45
‪get_active_scenes
‪function get_active_scenes(str_scenedef)
Definition: scene_shared.csc:2356
‪get_state
‪function get_state()
Definition: scene_shared.csc:1015
‪get_valid_object_defs
‪function get_valid_object_defs()
Definition: scene_shared.csc:656
‪_has_init_state
‪function _has_init_state()
Definition: scene_shared.csc:2195
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪ARRAY_ADD
‪#define ARRAY_ADD(__array, __item)
Definition: shared.gsh:304
‪cScriptBundleObjectBase::error
‪function error(condition, str_msg)
Definition: scriptbundle_shared.csc:50
‪SPAWNFLAG
‪#define SPAWNFLAG(__e, __f)
Definition: shared.gsh:95
‪destructor
‪destructor()
Definition: scene_shared.csc:589
‪on_error
‪function on_error()
Definition: scene_shared.csc:1010
‪player_scene_skip_completed
‪function player_scene_skip_completed(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: scene_shared.csc:48
‪cSceneObject::in_a_different_scene
‪function in_a_different_scene()
Definition: scene_shared.csc:547
‪cSceneObject::get_name
‪function get_name()
Definition: scene_shared.csc:348
‪cScriptBundleObjectBase::init
‪function init(s_objdef, o_bundle, e_ent, localclientnum)
Definition: scriptbundle_shared.csc:22
‪enable_filter_frame_transition
‪function enable_filter_frame_transition(player, filterid)
Definition: filter_shared.csc:920
‪init_filter_sprite_transition
‪function init_filter_sprite_transition(player)
Definition: filter_shared.csc:864
‪set_filter_frame_transition_blur
‪function set_filter_frame_transition_blur(player, filterid, amount)
Definition: filter_shared.csc:941
‪get_name
‪function get_name()
Definition: scriptbundle_shared.csc:108
‪cSceneObject::constructor
‪constructor()
Definition: scene_shared.csc:75
‪_call_state_funcs
‪function _call_state_funcs(str_state)
Definition: scene_shared.csc:868
‪set_filter_frame_transition_saved_frame_reveal
‪function set_filter_frame_transition_saved_frame_reveal(player, filterid, reveal)
Definition: filter_shared.csc:951
‪cf_server_sync
‪function cf_server_sync(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: scene_shared.csc:1448
‪get_ents
‪function get_ents()
Definition: scene_shared.csc:922
‪MAKE_ARRAY
‪#define MAKE_ARRAY(__array)
Definition: shared.gsh:303
‪cSceneObject::wait_till_scene_ready
‪function wait_till_scene_ready()
Definition: scene_shared.csc:532
‪__init__
‪function __init__()
Definition: scene_shared.csc:1058
‪_s
‪class cScriptBundleObjectBase _s
‪cSceneObject::_str_name
‪var _str_name
Definition: scene_shared.csc:69
‪a_ents
‪function _query_ents_by_substring_helper a_ents
Definition: util_shared.gsc:3334
‪set
‪function set(str_field_name, n_value)
Definition: clientfield_shared.gsc:34
‪_n_object_id
‪var _n_object_id
Definition: scene_shared.csc:580
‪IS_EQUAL
‪#define IS_EQUAL(__a, __b)
Definition: shared.gsh:250
‪cSceneObject::_b_spawnonce_used
‪var _b_spawnonce_used
Definition: scene_shared.csc:73
‪wait_till_scene_ready
‪function wait_till_scene_ready()
Definition: scene_shared.csc:982
‪screen_fade_out
‪function screen_fade_out(n_time, str_color)
Definition: lui_shared.csc:396
‪allows_multiple
‪function allows_multiple()
Definition: scene_shared.csc:972
‪cSceneObject::has_init_state
‪function has_init_state()
Definition: scene_shared.csc:537
‪run_next
‪function run_next()
Definition: scene_shared.csc:769
‪cSceneObject::get_align_tag
‪function get_align_tag()
Definition: scene_shared.csc:520
‪_trigger_init
‪function _trigger_init(trig)
Definition: scene_shared.csc:1588
‪_trigger_play
‪function _trigger_play(trig)
Definition: scene_shared.csc:1595
‪in_igc
‪function in_igc(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: scene_shared.csc:1106
‪player_scene_animation_skip
‪function player_scene_animation_skip(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: scene_shared.csc:33
‪cSceneObject::first_init
‪function first_init(s_objdef, o_scene, e_ent, localclientnum)
Definition: scene_shared.csc:85
‪get_root
‪function get_root()
Definition: scene_shared.csc:951
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪get_script_bundle
‪function get_script_bundle(str_type, str_name)
Definition: struct.csc:45
‪get_scenedefs
‪function get_scenedefs(str_type="scene")
Definition: scene_shared.csc:1831
‪cScriptBundleObjectBase::_n_clientnum
‪var _n_clientnum
Definition: scriptbundle_shared.csc:12
‪remove_invalid_scene_objects
‪function remove_invalid_scene_objects(s_scenedef)
Definition: scene_shared.csc:1473
‪get_valid_objects
‪function get_valid_objects()
Definition: scene_shared.csc:995
‪WAIT_CLIENT_FRAME
‪#define WAIT_CLIENT_FRAME
Definition: shared.gsh:266
‪cSceneObject::_play_anim
‪function _play_anim(clientNum, animation, n_delay_min=0, n_delay_max=0, n_rate=1, n_blend, str_siege_shot, loop)
Definition: scene_shared.csc:461
‪set_filter_frame_transition_flare
‪function set_filter_frame_transition_flare(player, filterid, opacity)
Definition: filter_shared.csc:936
‪cSceneObject::is_alive
‪function is_alive()
Definition: scene_shared.gsc:1688
‪initialize
‪function initialize(b_playing=false)
Definition: scene_shared.csc:675
‪cSceneObject::finish
‪function finish(b_clear=false)
Definition: scene_shared.csc:238
‪cSceneObject::_assign_unique_name
‪function _assign_unique_name()
Definition: scene_shared.csc:320
‪set_filter_base_frame_transition_warp
‪function set_filter_base_frame_transition_warp(player, filterid, warp)
Definition: filter_shared.csc:984
‪on_localplayer_shutdown
‪function private on_localplayer_shutdown(localClientNum)
Definition: scene_shared.csc:1130
‪init_filter_frame_transition
‪function init_filter_frame_transition(player)
Definition: filter_shared.csc:914
‪set_filter_frame_transition_warp
‪function set_filter_frame_transition_warp(player, filterid, amount)
Definition: filter_shared.csc:956
‪get_object_id
‪function get_object_id()
Definition: scene_shared.csc:701