‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
replay_gun.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\array_shared;
4 #using scripts\shared\clientfield_shared;
5 #using scripts\shared\duplicaterender_mgr;
6 #using scripts\shared\filter_shared;
7 #using scripts\shared\flagsys_shared;
8 #using scripts\shared\system_shared;
9 #using scripts\shared\util_shared;
10 
11 #insert scripts\shared\duplicaterender.gsh;
12 #insert scripts\shared\weapons\replay_gun.gsh;
13 #insert scripts\shared\shared.gsh;
14 #insert scripts\shared\version.gsh;
15 
16 #namespace replay_gun;
17 
18 ‪REGISTER_SYSTEM( "replay_gun", &‪__init__, undefined )
19 
20 #define REPLAY_OUTLINE_MATERIAL "mc/hud_outline_model_red"
21 
22 function ‪__init__()
23 {
24  level thread ‪player_init();
25 
27  "replay_locked", undefined,
29 
30 }
31 
32 
33 function ‪player_init()
34 {
36 
37  players = getlocalplayers();
38 
39  foreach( player in players )
40  {
41  player thread ‪watch_lockon(0);
42  }
43 }
44 
45 
46 function ‪watch_lockon( localClientNum )
47 {
48 
49  while(1)
50  {
51  self waittill("lockon_changed",state,target);
52  if (IsDefined(self.replay_lock) && ( !IsDefined(target) || self.replay_lock!= target ) )
53  {
54  self.replay_lock ‪duplicate_render::change_dr_flags( localClientNum, undefined, "replay_locked" );
55  self.replay_lock = undefined;
56  }
57 
58  if ( IsDefined( target ) && (target IsPlayer() || target IsAi()) && IsAlive( target ) )
59  {
60  switch(state)
61  {
65  target ‪duplicate_render::change_dr_flags( localClientNum, undefined, "replay_locked" );
66  break;
67 
70  target ‪duplicate_render::change_dr_flags( localClientNum, "replay_locked", undefined );
71  self.replay_lock = target;
72  break;
73  }
74  }
75  }
76 }
77 
78 /*
79 function watch_lockon_old( localClientNum )
80 {
81 
82  while(1)
83  {
84  self waittill("lockon_changed",state,target);
85  if (IsDefined(self.replay_lock) && ( !IsDefined(target) || self.replay_lock!= target ) )
86  {
87  self.replay_lock ent_set_outline( TARGET_OUTLINE_OFF );
88  self.replay_lock = undefined;
89  }
90  target ent_set_outline( state );
91  switch(state)
92  {
93  case REPLAYGUN_TARGET_LOST:
94  target ent_set_outline( TARGET_OUTLINE_OFF );
95  //self playsound(localClientNum,"wpn_replay_lost");
96  break;
97  case REPLAYGUN_TARGET_LOCKING:
98  target ent_set_outline( TARGET_OUTLINE_OFF );
99  //self playsound(localClientNum,"wpn_replay_tracking");
100  break;
101  case REPLAYGUN_TARGET_SUSPEND:
102  target ent_set_outline( TARGET_OUTLINE_OFF );
103  break;
104  case REPLAYGUN_TARGET_LOCKED:
105  //self playsound(localClientNum,"wpn_replay_lock_on");
106  // fall through
107  case REPLAYGUN_TARGET_REGAIN:
108  target ent_set_outline( TARGET_OUTLINE_RED );
109  self.replay_lock = target;
110  break;
111  }
112  }
113 
114 
115 }
116 
117 
118 //*****************************************************************************
119 //*****************************************************************************
120 // Adding shader filters to Ents
121 //*****************************************************************************
122 //*****************************************************************************
123 
124 function init_ent_shader_materials( player )
125 {
126  // _filter::init_filter_indices();
127  filter::map_material_helper( player, "mc/hud_outline_model_red" );
128  filter::map_material_helper( player, "mc/hud_outline_model_green" );
129  filter::map_material_helper( player, "mc/hud_outline_model_orange" );
130 
131 }
132 
133 
134 function ent_set_outline( color )
135 {
136  switch( color )
137  {
138  case TARGET_OUTLINE_OFF :
139  case TARGET_OUTLINE_SUSPEND:
140  case TARGET_OUTLINE_LOCKING:
141  self addduplicaterenderoption( DR_TYPE_OFFSCREEN, DR_METHOD_OFF );
142  self addduplicaterenderoption( DR_TYPE_FRAMEBUFFER, DR_METHOD_DEFAULT_MATERIAL );
143  break;
144 
145  // Thermal Material
146  case TARGET_OUTLINE_THERMAL:
147  self addduplicaterenderoption( DR_TYPE_OFFSCREEN, DR_METHOD_OFF );
148  self addduplicaterenderoption( DR_TYPE_FRAMEBUFFER, DR_METHOD_DEFAULT_MATERIAL );
149  break;
150 
151  // Red Material
152  case TARGET_OUTLINE_LOCKED:
153  case TARGET_OUTLINE_RED:
154  self addduplicaterenderoption( DR_TYPE_FRAMEBUFFER, DR_METHOD_DEFAULT_MATERIAL );
155  self addduplicaterenderoption( DR_TYPE_OFFSCREEN, DR_METHOD_CUSTOM_MATERIAL, filter::mapped_material_id( "mc/hud_outline_model_red" ) );
156  break;
157 
158  // Green Material
159  case TARGET_OUTLINE_GREEN:
160  self addduplicaterenderoption( DR_TYPE_FRAMEBUFFER, DR_METHOD_DEFAULT_MATERIAL );
161  self addduplicaterenderoption( DR_TYPE_OFFSCREEN, DR_METHOD_CUSTOM_MATERIAL, filter::mapped_material_id( "mc/hud_outline_model_green" ) );
162  break;
163 
164  // Orange Material
165  case TARGET_OUTLINE_ORANGE:
166  self addduplicaterenderoption( DR_TYPE_FRAMEBUFFER, DR_METHOD_DEFAULT_MATERIAL );
167  self addduplicaterenderoption( DR_TYPE_OFFSCREEN, DR_METHOD_CUSTOM_MATERIAL, filter::mapped_material_id( "mc/hud_outline_model_orange" ) );
168  break;
169  }
170 }
171 
172 
173 */
‪waitforclient
‪function waitforclient(client)
Definition: util_shared.csc:60
‪REPLAY_OUTLINE_MATERIAL
‪#define REPLAY_OUTLINE_MATERIAL
Definition: replay_gun.csc:20
‪REPLAYGUN_TARGET_LOST
‪#define REPLAYGUN_TARGET_LOST
Definition: replay_gun.gsh:17
‪DR_CULL_ALWAYS
‪#define DR_CULL_ALWAYS
Definition: duplicaterender.gsh:14
‪DR_TYPE_OFFSCREEN
‪#define DR_TYPE_OFFSCREEN
Definition: duplicaterender.gsh:6
‪REPLAYGUN_TARGET_LOCKED
‪#define REPLAYGUN_TARGET_LOCKED
Definition: replay_gun.gsh:19
‪REPLAYGUN_TARGET_REGAIN
‪#define REPLAYGUN_TARGET_REGAIN
Definition: replay_gun.gsh:21
‪REPLAYGUN_TARGET_LOCKING
‪#define REPLAYGUN_TARGET_LOCKING
Definition: replay_gun.gsh:18
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪player_init
‪function player_init()
Definition: replay_gun.csc:33
‪set_dr_filter_offscreen
‪function set_dr_filter_offscreen(name, priority, require_flags, refuse_flags, drtype1, drval1, drcull1, drtype2, drval2, drcull2, drtype3, drval3, drcull3)
Definition: duplicaterender_mgr.csc:177
‪__init__
‪function __init__()
Definition: replay_gun.csc:22
‪change_dr_flags
‪function change_dr_flags(localClientNum, toset, toclear)
Definition: duplicaterender_mgr.csc:289
‪REPLAYGUN_TARGET_SUSPEND
‪#define REPLAYGUN_TARGET_SUSPEND
Definition: replay_gun.gsh:20
‪watch_lockon
‪function watch_lockon(localClientNum)
Definition: replay_gun.csc:46