‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_timer.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\system_shared;
4 
5 #insert scripts\shared\shared.gsh;
6 
7 #precache( "material", "zombie_stopwatchneedle" );
8 #precache( "material", "zombie_stopwatch" );
9 #precache( "material", "zombie_stopwatch_glass" );
10 
11 #namespace zm_timer;
12 
13 ‪REGISTER_SYSTEM_EX( "zm_timer", undefined, &‪__main__, undefined )
14 
15 function ‪__main__()
16 {
17  if( !isdefined( level.stopwatch_length_width ) )
18  {
19  level.stopwatch_length_width = 96;
20  }
21 }
22 
23 function ‪start_timer( time, stop_notify )
24 {
25  self notify ("stop_prev_timer");
26  self endon ("stop_prev_timer");
27  self endon ("disconnect");
28 
29  if( !isdefined( self.stopwatch_elem ) )
30  {
31  self.stopwatch_elem = newClientHudElem(self);
32  self.stopwatch_elem.horzAlign = "left";
33  self.stopwatch_elem.vertAlign = "top";
34  self.stopwatch_elem.alignX = "left";
35  self.stopwatch_elem.alignY = "top";
36  self.stopwatch_elem.x = 10;
37  self.stopwatch_elem.alpha = 0;
38  self.stopwatch_elem.sort = 2;
39 
40  self.stopwatch_elem_glass = newClientHudElem(self);
41  self.stopwatch_elem_glass.horzAlign = "left";
42  self.stopwatch_elem_glass.vertAlign = "top";
43  self.stopwatch_elem_glass.alignX = "left";
44  self.stopwatch_elem_glass.alignY = "top";
45  self.stopwatch_elem_glass.x = 10;
46  self.stopwatch_elem_glass.alpha = 0;
47  self.stopwatch_elem_glass.sort = 3;
48  self.stopwatch_elem_glass setShader( "zombie_stopwatch_glass", level.stopwatch_length_width, level.stopwatch_length_width );
49  }
50 
51  self thread ‪update_hud_position();
52 
53  if( isdefined( stop_notify ) )
54  {
55  self thread ‪wait_for_stop_notify( stop_notify );
56  }
57  if( time > 60 )
58  {
59  time = 0;
60  }
61  self.stopwatch_elem setClock( time, 60, "zombie_stopwatch", level.stopwatch_length_width, level.stopwatch_length_width );
62  self.stopwatch_elem.alpha = 1;
63  self.stopwatch_elem_glass.alpha = 1;
64  wait( time );
65  self notify( "countdown_finished" );
66  wait( 1 );
67  self.stopwatch_elem.alpha = 0;
68  self.stopwatch_elem_glass.alpha = 0;
69 
70 }
71 
72 function ‪wait_for_stop_notify( stop_notify )
73 {
74  self endon ("stop_prev_timer");
75  self endon( "countdown_finished" );
76 
77  self waittill( stop_notify );
78 
79  self.stopwatch_elem.alpha = 0;
80  self.stopwatch_elem_glass.alpha = 0;
81 }
82 
84 {
85  self endon( "disconnect" );
86  self endon ("stop_prev_timer");
87  self endon( "countdown_finished" );
88 
89  while( 1 )
90  {
91  self.stopwatch_elem.y = 20;
92  self.stopwatch_elem_glass.y = 20;
93 
95  }
96 }
‪wait_for_stop_notify
‪function wait_for_stop_notify(stop_notify)
Definition: _zm_timer.gsc:72
‪__main__
‪function __main__()
Definition: _zm_timer.gsc:15
‪REGISTER_SYSTEM_EX
‪#define REGISTER_SYSTEM_EX(__sys, __func_init_preload, __func_init_postload, __reqs)
Definition: shared.gsh:209
‪start_timer
‪function start_timer(time, stop_notify)
Definition: _zm_timer.gsc:23
‪update_hud_position
‪function update_hud_position()
Definition: _zm_timer.gsc:83
‪WAIT_SERVER_FRAME
‪#define WAIT_SERVER_FRAME
Definition: shared.gsh:265