‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_laststand.csc
Go to the documentation of this file.
1 #using scripts\zm\_load;
2 #using scripts\zm\_util;
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\system_shared;
5 #using scripts\shared\visionset_mgr_shared;
6 
7 #insert scripts\shared\version.gsh;
8 #insert scripts\shared\shared.gsh;
9 
10 #insert scripts\zm\_zm_laststand.gsh;
11 
12 #namespace zm_laststand;
13 
14 ‪REGISTER_SYSTEM( "zm_laststand", &‪__init__, undefined )
15 
16 function ‪__init__()
17 {
18  level.laststands = [];
19  for( i = 0; i < 4; i++ )
20  {
21  level.laststands[i] = SpawnStruct();
22  level.laststands[i].bleedoutTime = 0;
23  level.laststands[i].laststand_update_clientfields = "laststand_update" + i;
24  level.laststands[i].lastBleedoutTime = 0;
25 
26  ‪clientfield::register( "world", level.laststands[i].laststand_update_clientfields, ‪VERSION_SHIP, 5, "counter", &‪update_bleedout_timer, !‪CF_HOST_ONLY, !‪CF_CALLBACK_ZERO_ON_NEW_ENT );
27  }
28 
29 
31 
34 }
35 
37 {
38  while( 1 )
39  {
40  level waittill( "notetrack", localClientNum, note );
41  if( note == "revive_shader_constant" )
42  {
43  //received startup notetrack on revive weapon anim
44  player = GetLocalPlayer( localClientNum );
45  //the time at the end tells the flipbook shader what time to play relative to
46  player MapShaderConstant( localClientNum, 0, "scriptVector2", 0, 1, 0, GetServerTime( localClientNum ) / 1000.0 );
47  }
48  }
49 }
50 
51 function ‪animation_update( model, oldValue, newValue )
52 {
53  self endon( "new_val" );
54  ‪startTime = GetRealTime();
55  timeSinceLastUpdate = 0;
56 
57  if( oldValue == newValue )
58  {
59  newValue = oldValue - 1;
60  }
61 
62  while( timeSinceLastUpdate <= 1.0 )
63  {
64  timeSinceLastUpdate = ( ( GetRealTime() - ‪startTime ) / 1000.0 );
65  lerpValue = ( LerpFloat( oldValue, newValue, timeSinceLastUpdate ) / 30.0 );
66  SetUIModelValue( model, lerpValue );
68  }
69 }
70 
71 function ‪update_bleedout_timer( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
72 {
73  substr = GetSubStr( fieldName, 16 ) ;
74  playerNum = Int( substr );
75 
76  level.laststands[ playerNum ].lastBleedoutTime = level.laststands[ playerNum ].bleedoutTime;
77  level.laststands[ playerNum ].bleedoutTime = newVal - 1;
78 
79  if( level.laststands[ playerNum ].lastBleedoutTime < level.laststands[ playerNum ].bleedoutTime )
80  {
81  level.laststands[ playerNum ].lastBleedoutTime = level.laststands[ playerNum ].bleedoutTime;
82  }
83 
84  model = GetUIModel(GetUIModelForController(localClientNum), "WorldSpaceIndicators.bleedOutModel" + playerNum + ".bleedOutPercent" );
85  if( isdefined( model ) )
86  {
87  if( newVal == 30 )
88  {
89  level.laststands[ playerNum ].bleedoutTime = 0;
90  level.laststands[ playerNum ].lastBleedoutTime = 0;
91  SetUIModelValue( model, 1.0 );
92  }
93  else if( newVal == 29 )
94  {
95  level.laststands[ playerNum ] notify( "new_val" );
96  level.laststands[ playerNum ] thread ‪animation_update( model, 30, 28 );
97  }
98  else
99  {
100  level.laststands[ playerNum ] notify( "new_val" );
101  level.laststands[ playerNum ] thread ‪animation_update( model, level.laststands[ playerNum ].lastBleedoutTime, level.laststands[ playerNum ].bleedoutTime );
102  }
103  }
104 }
‪startTime
‪class AnimationAdjustmentInfoZ startTime
‪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
‪ZM_DEATH_VISIONSET
‪#define ZM_DEATH_VISIONSET
Definition: _zm_laststand.gsh:2
‪animation_update
‪function animation_update(model, oldValue, newValue)
Definition: _zm_laststand.csc:51
‪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
‪wait_and_set_revive_shader_constant
‪function wait_and_set_revive_shader_constant()
Definition: _zm_laststand.csc:36
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪update_bleedout_timer
‪function update_bleedout_timer(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _zm_laststand.csc:71
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪__init__
‪function __init__()
Definition: _zm_laststand.csc:16
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪WAIT_CLIENT_FRAME
‪#define WAIT_CLIENT_FRAME
Definition: shared.gsh:266
‪ZM_LASTSTAND_VISIONSET
‪#define ZM_LASTSTAND_VISIONSET
Definition: _zm_laststand.gsh:1