./hud_reticules.lua

  1. local HUD_RETICULE_OVERHEAT_RED 		= { R = 230/255, G = 5/255, B = 5/255} 
  2. local HUD_RETICULE_OVERHEAT_LIGHT 	= { R = 230/255, G = 109/255, B = 33/255} 
  3. local HUD_RETICULE_CHARGE_MAX 		= { R = 69/255, G = 185/255, B = 10/255} 
  4. local HUD_RETICULE_CHARGE_MIN 		= { R = 178/255, G = 218/255, B = 19/255} 
  5.  
  6.  
  7. local HUD_RETICULE_RING_SIZE_DIF 	= .44		--This is the scale difference between the small and large ring... 
  8.  
  9. local RET_CONFIG_NONE					= 0 
  10. local RET_CONFIG_PISTOL 				= 1 
  11. local RET_CONFIG_HOLT55					= 2 
  12. local RET_CONFIG_SHOTGUN 				= 3 
  13. local RET_CONFIG_SUB_RIFLE 			= 4 
  14. local RET_CONFIG_RIFLE 					= 5 
  15. local RET_CONFIG_RPG 					= 6 
  16. local RET_CONFIG_RPG_ANNIHILATOR 	= 7 
  17. local RET_CONFIG_THROWN 				= 8 
  18. local RET_CONFIG_SNIPER				 	= 9 
  19. local RET_CONFIG_PRESSURE			 	= 10 
  20. local RET_CONFIG_DOT						= 11 
  21. local RET_CONFIG_ARC					= 12 
  22.  
  23. local RET_SPREAD_DEFAULT			 	= 0 
  24. local RET_SPREAD_RIFLE				 	= 1 
  25. local RET_SPREAD_SMG				 		= 2 
  26. local RET_SPREAD_SNIPER				 	= 3 
  27.  
  28. local RET_CROSS_SIZE_NONE				= 0  
  29. local RET_CROSS_SIZE_SMALL 			= 1 
  30. local RET_CROSS_SIZE_LARGE 			= 2 
  31.  
  32. local RET_HIT_MAX							= 5 
  33.  
  34. local OVERKILL_TEXT_PADDING = 10 
  35.  
  36. Hud_reticules = { 
  37. 	configs = { 
  38. 		[RET_CONFIG_NONE] = { 
  39. 			dot = {false, false}, 
  40. 			ring = {false, false}, 
  41. 			ring_split = {false, false}, 
  42. 			cross = {false, false}, 
  43. 			cross_size = nil, 
  44. 			cross_orientation = nil, 
  45. 			spread = false, 
  46. 			spread_style = RET_SPREAD_DEFAULT, 
  47. 			sniper = false, 
  48. 			pressure = false, 
  49. 			arc = false, 
  50. 		}, 
  51. 		[RET_CONFIG_PISTOL] = { 
  52. 			dot = {true, false}, 
  53. 			ring = {true, true}, 
  54. 			ring_split = {false, false}, 
  55. 			cross = {false, false}, 
  56. 			cross_size = nil, 
  57. 			cross_orientation = nil, 
  58. 			spread = false, 
  59. 			spread_style = RET_SPREAD_DEFAULT, 
  60. 			sniper = false, 
  61. 			pressure = false, 
  62. 			arc = false, 
  63. 		}, 
  64. 		[RET_CONFIG_HOLT55] = { 
  65. 			dot = {false, false}, 
  66. 			ring = {true, true}, 
  67. 			ring_split = {false, false}, 
  68. 			cross = {false, false}, 
  69. 			cross_size = nil, 
  70. 			cross_orientation = nil, 
  71. 			spread = true, 
  72. 			spread_style = RET_SPREAD_DEFAULT, 
  73. 			sniper = false, 
  74. 			pressure = false, 
  75. 			arc = false, 
  76. 		}, 
  77. 		[RET_CONFIG_SHOTGUN] = { 
  78. 			dot = {false, false}, 
  79. 			ring = {true, true}, 
  80. 			ring_split = {false, false}, 
  81. 			cross = {false, false}, 
  82. 			cross_size = nil, 
  83. 			cross_orientation = nil, 
  84. 			spread = false, 
  85. 			spread_style = RET_CONFIG_SHOTGUN, 
  86. 			sniper = false, 
  87. 			pressure = false, 
  88. 			arc = false, 
  89. 		}, 
  90. 		[RET_CONFIG_SUB_RIFLE] = { 
  91. 			dot = {false, false}, 
  92. 			ring = {true, true}, 
  93. 			ring_split = {false, false}, 
  94. 			cross = {true, true}, 
  95. 			cross_size = RET_CROSS_SIZE_SMALL, 
  96. 			cross_orientation = 0, 
  97. 			spread = true, 
  98. 			spread_style = RET_SPREAD_SMG, 
  99. 			sniper = false, 
  100. 			pressure = false, 
  101. 			arc = false, 
  102. 		}, 
  103. 		[RET_CONFIG_RIFLE] = { 
  104. 			dot = {false, false}, 
  105. 			ring = {false, false}, 
  106. 			ring_split = {false, false}, 
  107. 			cross = {true, true}, 
  108. 			cross_size = RET_CROSS_SIZE_LARGE, 
  109. 			cross_orientation = 0, 
  110. 			spread = true, 
  111. 			spread_style = RET_SPREAD_DEFAULT, 
  112. 			sniper = false, 
  113. 			pressure = false, 
  114. 			arc = false, 
  115. 		}, 
  116. 		[RET_CONFIG_RPG] = { 
  117. 			dot = {false, false}, 
  118. 			ring = {false, false}, 
  119. 			ring_split = {false, false}, 
  120. 			cross = {true, true}, 
  121. 			cross_size = RET_CROSS_SIZE_LARGE, 
  122. 			cross_orientation = 1, 
  123. 			spread = false, 
  124. 			spread_style = RET_SPREAD_DEFAULT, 
  125. 			sniper = false, 
  126. 			pressure = false, 
  127. 			arc = false, 
  128. 		}, 
  129. 		[RET_CONFIG_RPG_ANNIHILATOR] = { 
  130. 			dot = {false, false}, 
  131. 			ring = {false, false}, 
  132. 			ring_split = {false, false}, 
  133. 			cross = {true, true}, 
  134. 			cross_size = RET_CROSS_SIZE_LARGE, 
  135. 			cross_orientation = 1, 
  136. 			spread = false, 
  137. 			spread_style = RET_SPREAD_DEFAULT, 
  138. 			sniper = false, 
  139. 			pressure = false, 
  140. 			arc = false, 
  141. 		}, 
  142. 		[RET_CONFIG_THROWN] = { 
  143. 			dot = {false, false}, 
  144. 			ring = {false, false}, 
  145. 			ring_split = {true, true}, 
  146. 			cross = {false, false}, 
  147. 			cross_size = nil, 
  148. 			cross_orientation = nil, 
  149. 			spread = false, 
  150. 			spread_style = RET_SPREAD_DEFAULT, 
  151. 			sniper = false, 
  152. 			pressure = false, 
  153. 			arc = false, 
  154. 		}, 
  155. 		[RET_CONFIG_SNIPER] = { 
  156. 			dot = {false, false}, 
  157. 			ring = {false, false}, 
  158. 			ring_split = {false, false}, 
  159. 			cross = {true, true}, 
  160. 			cross_size = "large", 
  161. 			cross_orientation = 0, 
  162. 			spread = false, 
  163. 			spread_style = RET_SPREAD_SNIPER, 
  164. 			sniper = true, 
  165. 			pressure = false, 
  166. 			arc = false, 
  167. 		}, 
  168. 		[RET_CONFIG_PRESSURE] = { 
  169. 			dot = {false, false}, 
  170. 			ring = {true, true}, 
  171. 			ring_split = {false, false}, 
  172. 			cross = {false, false}, 
  173. 			cross_size = nil, 
  174. 			cross_orientation = nil, 
  175. 			spread = false, 
  176. 			spread_style = RET_SPREAD_DEFAULT, 
  177. 			sniper = false, 
  178. 			pressure = true, 
  179. 			arc = false, 
  180. 		}, 
  181. 		[RET_CONFIG_DOT] = { 
  182. 			dot = {true, true}, 
  183. 			ring = {false, false}, 
  184. 			ring_split = {false, false}, 
  185. 			cross = {false, false}, 
  186. 			cross_size = nil, 
  187. 			cross_orientation = nil, 
  188. 			spread = false, 
  189. 			spread_style = RET_SPREAD_DEFAULT, 
  190. 			sniper = false, 
  191. 			pressure = false, 
  192. 			arc = false, 
  193. 		}, 
  194. 		[RET_CONFIG_ARC] = { 
  195. 			dot = {false, true}, 
  196. 			ring = {false, false}, 
  197. 			ring_split = {false, false}, 
  198. 			cross = {false, false}, 
  199. 			cross_size = nil, 
  200. 			cross_orientation = nil, 
  201. 			spread = false, 
  202. 			spread_style = RET_SPREAD_DEFAULT, 
  203. 			sniper = false, 
  204. 			pressure = false, 
  205. 			arc = true, 
  206. 		}, 
  207. 	}, 
  208. 	categories = { 
  209. 		["WPNCAT_MELEE"] = RET_CONFIG_NONE, 
  210. 		["WPNCAT_PISTOL"] = RET_CONFIG_PISTOL, 
  211. 		["WPNCAT_SHOTGUN"] = RET_CONFIG_SHOTGUN, 
  212. 		["WPNCAT_SUB_MACHINE_GUN"] = RET_CONFIG_SUB_RIFLE, 
  213. 		["WPNCAT_RIFLE"] = RET_CONFIG_RIFLE, 
  214. 		["WPNCAT_SPECIAL"] = RET_CONFIG_SHOTGUN, 
  215. 		["WPNCAT_THROWN"] = RET_CONFIG_THROWN, 
  216. 		["WPNCAT_HAVOK"] = RET_CONFIG_THROWN, 
  217. 		["WPNCAT_DOT"] = RET_CONFIG_DOT, 
  218. 	}, 
  219. 	wpn_names = { 
  220. 		["stun_gun"] = RET_CONFIG_PISTOL, 
  221. 		["Holt_55"] = RET_CONFIG_HOLT55, 
  222. 		["pepper_spray"] = RET_CONFIG_SHOTGUN, 
  223. 		["fireext"] = RET_CONFIG_SHOTGUN, 
  224. 		["minigun"] = RET_CONFIG_SHOTGUN, 
  225. 		["rpg_annihilator"] = RET_CONFIG_RPG_ANNIHILATOR, 
  226. 		["rpg_launcher"] = RET_CONFIG_RPG, 
  227. 		["mcmanus2010"] = RET_CONFIG_SNIPER, 
  228. 		["bean_bag_gun"] = RET_CONFIG_PISTOL, 
  229. 		["truck_2dr_septic01_Rear"] = RET_CONFIG_PRESSURE, 
  230. 		["truck_2dr_septic01_Front"] = RET_CONFIG_PRESSURE, 
  231. 		["truck_2dr_fire01"] = RET_CONFIG_PRESSURE, 
  232. 		["sp_novelty01"] = RET_CONFIG_PRESSURE, 
  233. 		 
  234. 		["sp_tank01_w"] = RET_CONFIG_RIFLE, 
  235. 		["sp_tank01_w2"] = RET_CONFIG_RIFLE, 
  236. 		["sp_tank02_w"] = RET_CONFIG_RIFLE, 
  237. 		["sp_tank03_w"] = RET_CONFIG_RIFLE, 
  238. 		["sp_tank03_w2"] = RET_CONFIG_RIFLE, 
  239. 		["Special-Glitch"] = RET_CONFIG_PISTOL, 
  240. 		["Pistol-Laser"] = RET_CONFIG_PISTOL, 
  241. 		["EnergyShield"] = RET_CONFIG_PISTOL, 
  242. 		["Explosive-ArmaRana"] = RET_CONFIG_ARC, 
  243. 		["ShipCannon"] = RET_CONFIG_ARC, 
  244. 		["Melee-EnvySword"] = RET_CONFIG_DOT, 
  245. 		["Special-GluttonyGun"] = RET_CONFIG_ARC, 
  246. 		["Melee-Warhammer"] = RET_CONFIG_DOT, 
  247.  
  248. 	}, 
  249. 	elements = { 
  250. 		reticule_h = -1, 
  251. 		dot_h = -1, 
  252. 		cross_h = -1, 
  253. 		cross_n_h = -1, 
  254. 		cross_e_h = -1, 
  255. 		cross_s_h = -1, 
  256. 		cross_w_h = -1, 
  257. 		ring_small_h = -1, 
  258. 		ring_large_h = -1, 
  259. 		ring_mask_nw_h = -1, 
  260. 		ring_mask_ne_h = -1, 
  261. 		ring_mask_sw_h = -1, 
  262. 		ring_mask_se_h = -1, 
  263. 		ring_split_h = -1, 
  264. 		sniper_h = -1, 
  265. 		sniper_reticule_rims_h = -1, 
  266. 		sniper_dir_grp_h = -1, 
  267. 		sniper_dir_bmp_h = -1, 
  268. 		friendly_h = -1, 
  269. 		pressure_grp_h = -1, 
  270. 		pressure_fill_h = -1, 
  271. 		pressure_bg_h = -1, 
  272. 		pressure_bg_gallows_h = -1, 
  273. 		overkill_skull = -1, 
  274. 		arc_grp	= -1, 
  275. 	}, 
  276. 	status = { 
  277. 		wpn_name = -1, 
  278. 		config = -1, 
  279. 		highlight = -1, 
  280. 		wpn_spread = -1, 
  281. 		fine_aim = -1, 
  282. 		y_screen_coord = -1, 
  283. 	},  
  284. 	spread_style = { 
  285. 		[RET_SPREAD_DEFAULT] = { 
  286. 			cross_mag_min = 3, 
  287. 			cross_mag_max = 6, 
  288. 			cross_mag_fineaim_min = -1, 
  289. 			cross_mag_fineaim_max = 16, 
  290. 			ring_alpha = .67,  
  291. 			ring_alpha_highlight = .9, 
  292. 			ring_min = 1,--0.7, 
  293. 			ring_max = 2.3, 
  294. 			ring_fineaim_min = 0.85,--0.5, 
  295. 			ring_fineaim_max = 1.8, 
  296. 			ring_mask_min = 0, 
  297. 			ring_mask_max = 20, 
  298. 			ring_mask_fineaim_min = 0, 
  299. 			ring_mask_fineaim_max = 20, 
  300. 		}, 
  301. 		[RET_SPREAD_SMG] = { 
  302. 			cross_mag_min = 1, 
  303. 			cross_mag_max = 8, 
  304. 			cross_mag_fineaim_min = -1, 
  305. 			cross_mag_fineaim_max = 8, 
  306. 			ring_alpha = .67,  
  307. 			ring_alpha_highlight = .9, 
  308. 			ring_min = 1, 
  309. 			ring_max = 1.2,--2.3, 
  310. 			ring_fineaim_min = .85, 
  311. 			ring_fineaim_max = 1.2, 
  312. 			ring_mask_min = 0, 
  313. 			ring_mask_max = 10, 
  314. 			ring_mask_fineaim_min = 0, 
  315. 			ring_mask_fineaim_max = 8, 
  316. 		}, 
  317. 		[RET_CONFIG_SHOTGUN] = { 
  318. 			cross_mag_min = 1, 
  319. 			cross_mag_max = 19, 
  320. 			cross_mag_fineaim_min = -1, 
  321. 			cross_mag_fineaim_max = 16, 
  322. 			ring_alpha = .67,  
  323. 			ring_alpha_highlight = .9, 
  324. 			ring_min = 1.6, 
  325. 			ring_max = 2.3, 
  326. 			ring_fineaim_min = 1.2, 
  327. 			ring_fineaim_max = 1.8, 
  328. 			ring_mask_min = 0, 
  329. 			ring_mask_max = 20, 
  330. 			ring_mask_fineaim_min = 0, 
  331. 			ring_mask_fineaim_max = 20, 
  332. 		}, 
  333. 		[RET_SPREAD_SNIPER] = { 
  334. 			cross_mag_min = 15, 
  335. 			cross_mag_max = 25, 
  336. 			cross_mag_fineaim_min =  15, 
  337. 			cross_mag_fineaim_max =  25, 
  338. 			ring_alpha = .67,  
  339. 			ring_alpha_highlight = .9, 
  340. 			ring_min = 1, 
  341. 			ring_max = 2.3, 
  342. 			ring_fineaim_min = .85, 
  343. 			ring_fineaim_max = 1.8, 
  344. 			ring_mask_min = 0, 
  345. 			ring_mask_max = 20, 
  346. 			ring_mask_fineaim_min = 0, 
  347. 			ring_mask_fineaim_max = 20, 
  348. 		} 
  349. 	}, 
  350. 	pressure = { 
  351. 		cur_value = -1, 
  352. 		start_angle = 3.147, 
  353. 		end_angle = 0 
  354. 	}, 
  355. 	overheat = { 
  356. 		is_overheated = -1, 
  357. 		pct = -1, 
  358. 		x_scale = 1, 
  359. 		y_scale = 1, 
  360. 	} 
  361. } 
  362.  
  363. Hud_sniper_arrows = {} 
  364.  
  365. Hud_hit_data = {} 
  366.  
  367. Hud_current_hit_index = 0 
  368.  
  369. local has_overheated = false; 
  370.  
  371. function hud_reticules_init() 
  372. 	--Reticules 
  373. 	 
  374. 	--Reticule Base for positioning(Controlled by game code) and doing master fades 
  375. 	local h = vint_object_find("reticules") 
  376. 	Hud_reticules.elements.reticule_base_h = h 
  377. 	 
  378. 	--Contains all the reticules but seperated from the persistant reticule which is used for fading. 
  379. 	local h = vint_object_find("reticule_container", h) 
  380. 	Hud_reticules.elements.reticule_h = h 
  381. 	 
  382. 	--Deep Reticule Parts 
  383. 	Hud_reticules.elements.dot_h = vint_object_find("dot", h) 
  384. 	Hud_reticules.elements.ring_small_h = vint_object_find("ring_small", h) 
  385. 	Hud_reticules.elements.ring_large_h = vint_object_find("ring_large", h) 
  386. 	Hud_reticules.elements.ring_split_h = vint_object_find("ring_split", h) 
  387. 	Hud_reticules.elements.ring_mask_nw_h  = vint_object_find("mask_nw", h) 
  388. 	Hud_reticules.elements.ring_mask_ne_h  = vint_object_find("mask_ne", h) 
  389. 	Hud_reticules.elements.ring_mask_sw_h  = vint_object_find("mask_sw", h) 
  390. 	Hud_reticules.elements.ring_mask_se_h  = vint_object_find("mask_se", h) 
  391. 	Hud_reticules.elements.cross_h = vint_object_find("cross", h) 
  392. 	Hud_reticules.elements.friendly_h = vint_object_find("friendly", h) 
  393. 	Hud_reticules.elements.overkill_skull = vint_object_find("overkill_skull", h) 
  394. 	Hud_reticules.elements.arc_grp = vint_object_find("arc_reticule_grp", h) 
  395. 	 
  396. 	--pressure group 
  397. 	Hud_reticules.elements.pressure_grp_h =  vint_object_find("pressure_grp", h) 
  398. 	Hud_reticules.elements.pressure_fill_h =  vint_object_find("pressure_fill", h) 
  399. 	Hud_reticules.elements.pressure_bg_h = vint_object_find("pressure_bg", h) 
  400. 	Hud_reticules.elements.pressure_bg_gallows_h = vint_object_find("pressure_bg_gallows", h) 
  401. 	 
  402. 	--Cross Hairs 
  403. 	h = Hud_reticules.elements.cross_h  
  404. 	Hud_reticules.elements.cross_n_h = vint_object_find("n", h) 
  405. 	Hud_reticules.elements.cross_e_h = vint_object_find("e", h) 
  406. 	Hud_reticules.elements.cross_s_h = vint_object_find("s", h) 
  407. 	Hud_reticules.elements.cross_w_h = vint_object_find("w", h) 
  408. 	 
  409. 	--Sniper! 
  410. 	Hud_reticules.elements.sniper_h = vint_object_find("sniper") 
  411. 	Hud_reticules.elements.sniper_dir_grp_h = vint_object_find("sniper_dir_grp") 
  412. 	Hud_reticules.elements.sniper_dir_bmp_h = vint_object_find("sniper_dir_bmp") 
  413. 	h = Hud_reticules.elements.sniper_h  
  414. 	 
  415. 	Hud_reticules.elements.sniper_reticule_rims_h = vint_object_find("sniper_reticule_rims", h) 
  416. 	 
  417. 	--Persistant Reticules 
  418. 	Hud_reticules.elements.dot_persistant_h = vint_object_find("dot_persistant") 
  419. 	 
  420. 	--Hit indication 
  421. 	Hud_reticules.elements.ret_hit_grp_h = vint_object_find("ret_hit") 
  422. 	Hud_reticules.elements.ret_hit_anim = vint_object_find("reticule_hit_anim") 
  423. 	 
  424. 	--Data subscriptions	 
  425. 	 
  426. 	--Sniper Directional Indicators 
  427. 	vint_datagroup_add_subscription("sniper_dir_arrows", "update", "hud_sniper_dir_update") 
  428. 	vint_datagroup_add_subscription("sniper_dir_arrows", "insert", "hud_sniper_dir_add") 
  429. 	vint_datagroup_add_subscription("sniper_dir_arrows", "remove", "hud_sniper_dir_remove") 
  430. 	 
  431. 	--Hit Indicators 
  432. 	vint_datagroup_add_subscription("sr2_local_player_hit_indicator", "insert", "Hud_hit_add") 
  433. end 
  434.  
  435. function Hud_reticule_process_hit(bullet_hit) 
  436. 	--process a hit 
  437. 	if bullet_hit then 
  438. 		lua_play_anim(Hud_reticules.elements.ret_hit_anim,0) 
  439. 	end 
  440. end 
  441.  
  442. --#################################################################### 
  443. --Reticules 
  444. --#################################################################### 
  445. function Hud_reticule_update(wpn_name, wpn_category, reticule_highlight )  
  446. 	 
  447. 	local reticule_layout_type = RET_CONFIG_NONE 
  448. 	 
  449. 	if wpn_category == "WPNCAT_DOT" then 
  450. 		reticule_layout_type = RET_CONFIG_DOT 
  451. 	elseif wpn_name == nil then 
  452. 		--Use default layout type  
  453. 	else 
  454. 		--Check weapon name first 
  455. 		reticule_layout_type = Hud_reticules.wpn_names[wpn_name] 
  456. 	 
  457. 		--If we didn't find a match then use default category 
  458. 		if reticule_layout_type == nil then 
  459. 			reticule_layout_type = Hud_reticules.categories[wpn_category] 
  460. 		end 
  461. 	end 
  462. 	 
  463. 	if wpn_category == "WPNCAT_MELEE" or wpn_category == nil then 
  464. 		if wpn_name == "stun_gun" or wpn_name == "Melee-EnvySword" then 
  465. 			vint_set_property(Hud_reticules.elements.reticule_h, "visible", true) 
  466. 			vint_set_property(Hud_reticules.elements.dot_persistant_h, "visible", true) 
  467. 		else 
  468. 			vint_set_property(Hud_reticules.elements.ret_hit_grp_h, "visible", false) 
  469. 			vint_set_property(Hud_reticules.elements.reticule_h, "visible", false) 
  470. 			vint_set_property(Hud_reticules.elements.dot_persistant_h, "visible", false) 
  471. 		end 
  472. 	else 
  473. 		vint_set_property(Hud_reticules.elements.ret_hit_grp_h, "visible", true) 
  474. 		vint_set_property(Hud_reticules.elements.reticule_h, "visible", true) 
  475. 		vint_set_property(Hud_reticules.elements.dot_persistant_h, "visible", true) 
  476. 	end 
  477.  
  478. 	local reticule_layout = Hud_reticules.configs[reticule_layout_type] 
  479. 	local spread_style = Hud_reticules.spread_style[Hud_reticules.configs[reticule_layout_type].spread_style] 
  480. 	 
  481. 	--Error Check 
  482.  	if reticule_layout == nil then 
  483. 		return 
  484. 	end 
  485.  
  486. 	--Process reticule highlighting 
  487. 	if reticule_highlight == "friendly" then 
  488.  
  489. 		--Tint Sniper reticules for friendly 
  490. 		vint_set_property(Hud_reticules.elements.sniper_reticule_rims_h, "tint", .164, .63, .18) 
  491. 		 
  492. 	elseif reticule_highlight == "enemy" then 
  493. 		 
  494. 		local r_0 = .89 
  495. 		if reticule_layout.dot[2] == true then 
  496. 			vint_set_property(Hud_reticules.elements.dot_h, "tint", r_0, 0, 0) 
  497. 		else 
  498. 			vint_set_property(Hud_reticules.elements.dot_h, "tint", 1, 1, 1) 
  499. 		end 
  500. 		 
  501. 		if reticule_layout.ring[2] == true then 
  502. 			vint_set_property(Hud_reticules.elements.ring_small_h, "tint", r_0, 0, 0) 
  503. 			vint_set_property(Hud_reticules.elements.ring_large_h, "tint", r_0, 0, 0) 
  504. 			 
  505. 			vint_set_property(Hud_reticules.elements.ring_small_h, "alpha", spread_style.ring_alpha_highlight) 
  506. 			vint_set_property(Hud_reticules.elements.ring_large_h, "alpha", spread_style.ring_alpha_highlight) 
  507. 			 
  508. 		else 
  509. 			vint_set_property(Hud_reticules.elements.ring_small_h, "tint", 1, 1, 1) 
  510. 			vint_set_property(Hud_reticules.elements.ring_large_h, "tint", 1, 1, 1) 
  511. 			 
  512. 			vint_set_property(Hud_reticules.elements.ring_small_h, "alpha", spread_style.ring_alpha) 
  513. 			vint_set_property(Hud_reticules.elements.ring_large_h, "alpha", spread_style.ring_alpha) 
  514. 			 
  515. 		end 
  516. 				 
  517. 		if reticule_layout.ring_split[2] == true then 
  518. 			vint_set_property(Hud_reticules.elements.ring_split_h, "tint", r_0, 0, 0) 
  519. 		else 
  520. 			vint_set_property(Hud_reticules.elements.ring_split_h, "tint", 1, 1, 1) 
  521. 		end 
  522. 		 
  523. 		if reticule_layout.cross[2] == true then 
  524. 			vint_set_property(Hud_reticules.elements.cross_h, "tint", r_0, 0, 0) 
  525. 		else 
  526. 			vint_set_property(Hud_reticules.elements.cross_h, "tint", 1, 1, 1) 
  527. 		end 
  528.  
  529. 		if reticule_layout.arc== true then 
  530. 			vint_set_property(Hud_reticules.elements.arc_grp, "tint", r_0, 0, 0) 
  531. 		else 
  532. 			vint_set_property(Hud_reticules.elements.arc_grp, "tint", 1, 1, 1) 
  533. 		end 
  534. 		 
  535. 		--Tint Sniper reticules for Enemy 
  536. 		vint_set_property(Hud_reticules.elements.sniper_reticule_rims_h, "tint", r_0, 0, 0) 
  537. 		 
  538. 	elseif reticule_highlight == "neutral" then 
  539. 		 
  540. 		 
  541. 		if reticule_layout.dot[2] == true then 
  542. 			vint_set_property(Hud_reticules.elements.dot_h, "tint", 1, 1, 1) 
  543. 		else 
  544. 			vint_set_property(Hud_reticules.elements.dot_h, "tint", 1, 1, 1) 
  545. 		end 
  546. 		 
  547. 		if reticule_layout.ring[2] == true then 
  548. 			vint_set_property(Hud_reticules.elements.ring_small_h, "tint", 1, 1, 1) 
  549. 			vint_set_property(Hud_reticules.elements.ring_large_h, "tint", 1, 1, 1) 
  550. 			 
  551. 			vint_set_property(Hud_reticules.elements.ring_small_h, "alpha", spread_style.ring_alpha_highlight) 
  552. 			vint_set_property(Hud_reticules.elements.ring_large_h, "alpha", spread_style.ring_alpha_highlight) 
  553. 			 
  554. 		else 
  555. 			vint_set_property(Hud_reticules.elements.ring_small_h, "tint", 1, 1, 1) 
  556. 			vint_set_property(Hud_reticules.elements.ring_large_h, "tint", 1, 1, 1) 
  557. 			 
  558. 			vint_set_property(Hud_reticules.elements.ring_small_h, "alpha", spread_style.ring_alpha) 
  559. 			vint_set_property(Hud_reticules.elements.ring_large_h, "alpha", spread_style.ring_alpha) 
  560. 			 
  561. 		end 
  562. 				 
  563. 		if reticule_layout.ring_split[2] == true then 
  564. 			vint_set_property(Hud_reticules.elements.ring_split_h, "tint", 1, 1, 1) 
  565. 		else 
  566. 			vint_set_property(Hud_reticules.elements.ring_split_h, "tint", 1, 1, 1) 
  567. 		end 
  568. 		 
  569. 		if reticule_layout.cross[2] == true then 
  570. 			vint_set_property(Hud_reticules.elements.cross_h, "tint", 1, 1, 1) 
  571. 		else 
  572. 			vint_set_property(Hud_reticules.elements.cross_h, "tint", 1, 1, 1) 
  573. 		end 
  574.  
  575. 		if reticule_layout.arc== true then 
  576. 			vint_set_property(Hud_reticules.elements.arc_grp, "tint", 1, 1, 1) 
  577. 		else 
  578. 			vint_set_property(Hud_reticules.elements.arc_grp, "tint", 1, 1, 1) 
  579. 		end 
  580. 		 
  581. 		--Tint Sniper reticules for Enemy 
  582. 		vint_set_property(Hud_reticules.elements.sniper_reticule_rims_h, "tint", 1, 1, 1) 
  583. 		 
  584. 		 
  585. 	elseif reticule_highlight == "none" then 
  586. 	 
  587. 		vint_set_property(Hud_reticules.elements.dot_h, "tint", 1, 1, 1) 
  588. 		vint_set_property(Hud_reticules.elements.ring_small_h, "tint", 1, 1, 1) 
  589. 		vint_set_property(Hud_reticules.elements.ring_large_h, "tint", 1, 1, 1) 
  590. 		vint_set_property(Hud_reticules.elements.ring_split_h, "tint", 1, 1, 1) 
  591. 		vint_set_property(Hud_reticules.elements.cross_h, "tint", 1, 1, 1) 
  592. 		vint_set_property(Hud_reticules.elements.arc_grp, "tint", 1, 1, 1) 
  593. 		 
  594. 		--Tint Sniper reticules 
  595. 		vint_set_property(Hud_reticules.elements.sniper_reticule_rims_h, "tint", 90/255, 173/255, 255/255) 
  596. 	end	 
  597. 	 
  598. 	--Toggle between friendly reticule and standard reticule parts 
  599. 	if reticule_highlight == "friendly" and reticule_layout_type ~= "none" then 
  600. 		--Display friendly reticule and hide other parts 
  601. 		vint_set_property(Hud_reticules.elements.friendly_h, "visible", true)  
  602. 		vint_set_property(Hud_reticules.elements.dot_h, "visible", false) 
  603. 		vint_set_property(Hud_reticules.elements.ring_small_h, "visible",false) 
  604. 		vint_set_property(Hud_reticules.elements.ring_large_h, "visible", false) 
  605. 		vint_set_property(Hud_reticules.elements.ring_split_h, "visible", false) 
  606. 		vint_set_property(Hud_reticules.elements.cross_h, "visible", false) 
  607. 		vint_set_property(Hud_reticules.elements.arc_grp, "visible", false) 
  608. 	 
  609. 	else 
  610. 		--Hide friendly reticule and display the proper parts 
  611. 		vint_set_property(Hud_reticules.elements.friendly_h, "visible", false) 	 
  612. 		vint_set_property(Hud_reticules.elements.dot_h, "visible", reticule_layout.dot[1]) 
  613. 		vint_set_property(Hud_reticules.elements.ring_small_h, "visible", reticule_layout.ring[1]) 
  614. 		vint_set_property(Hud_reticules.elements.ring_large_h, "visible", reticule_layout.ring[1]) 
  615. 		vint_set_property(Hud_reticules.elements.ring_split_h, "visible", reticule_layout.ring_split[1]) 
  616. 		vint_set_property(Hud_reticules.elements.cross_h, "visible", reticule_layout.cross[1]) 
  617. 		vint_set_property(Hud_reticules.elements.arc_grp, "visible", reticule_layout.arc) 
  618.  
  619. 		--Cross Size 
  620. 		if reticule_layout.cross_size == "large" then 
  621. 			--Set all bitmaps to the large size 
  622. 			vint_set_property(Hud_reticules.elements.cross_n_h, "image", "ui_hud_reticule_cross_large") 
  623. 			vint_set_property(Hud_reticules.elements.cross_e_h, "image", "ui_hud_reticule_cross_large") 
  624. 			vint_set_property(Hud_reticules.elements.cross_s_h, "image", "ui_hud_reticule_cross_large") 
  625. 			vint_set_property(Hud_reticules.elements.cross_w_h, "image", "ui_hud_reticule_cross_large") 
  626. 			vint_set_property(Hud_reticules.elements.cross_n_h, "offset", -8, -24) 
  627. 			vint_set_property(Hud_reticules.elements.cross_e_h, "offset", -8, -24) 
  628. 			vint_set_property(Hud_reticules.elements.cross_s_h, "offset", -8, -24) 
  629. 			vint_set_property(Hud_reticules.elements.cross_w_h, "offset", -8, -24) 
  630. 			 
  631. 		elseif reticule_layout.cross_size == "small" then 
  632. 			--Set all bitmaps to small size 
  633. 			vint_set_property(Hud_reticules.elements.cross_n_h, "image", "ui_hud_reticule_cross_small") 
  634. 			vint_set_property(Hud_reticules.elements.cross_e_h, "image", "ui_hud_reticule_cross_small") 
  635. 			vint_set_property(Hud_reticules.elements.cross_s_h, "image", "ui_hud_reticule_cross_small") 
  636. 			vint_set_property(Hud_reticules.elements.cross_w_h, "image", "ui_hud_reticule_cross_small") 
  637. 			vint_set_property(Hud_reticules.elements.cross_n_h, "offset", -8, -19) 
  638. 			vint_set_property(Hud_reticules.elements.cross_e_h, "offset", -8, -19) 
  639. 			vint_set_property(Hud_reticules.elements.cross_s_h, "offset", -8, -19) 
  640. 			vint_set_property(Hud_reticules.elements.cross_w_h, "offset", -8, -19) 
  641. 		end                                                         
  642. 		 
  643. 		--Cross Orientation 
  644. 		if reticule_layout.cross_orientation == 0 then 
  645. 			--Standard Orientation 
  646. 			vint_set_property(Hud_reticules.elements.cross_h, "rotation", 0) 
  647. 		elseif reticule_layout.cross_orientation == 1 then 
  648. 			--45 Degree Rotation 
  649. 			vint_set_property(Hud_reticules.elements.cross_h, "rotation", 0.785398163) 
  650. 		end 
  651. 		 
  652. 	end 
  653. 	 
  654. 	--Show pressure gauge? 
  655. 	--we don't have any pressure weapons in SR3, yet 
  656. 	--[[if reticule_layout.pressure == true then 
  657. 		vint_set_property(Hud_reticules.elements.pressure_grp_h, "visible", true) 
  658. 	else 
  659. 		vint_set_property(Hud_reticules.elements.pressure_grp_h, "visible", true)--false) 
  660. 	end]] 
  661. 	 
  662. 	--Store reticule status to internal data sets 
  663. 	Hud_reticules.status.wpn_name = wpn_name 
  664. 	Hud_reticules.status.highlight = reticule_highlight 
  665. 	Hud_reticules.status.config = reticule_layout_type 
  666. 	Hud_reticules.status.wpn_category = wpn_category 
  667. end 
  668.  
  669. function hud_reticule_spread_update(wpn_spread, show_spread) 
  670.  
  671. 	--debug_print("vint", "show_spread" .. var_to_string(show_spread) .. "\n") 
  672. 	 
  673. 	local fine_aim = Hud_weapon_status.fine_aim_transition 
  674. 	local spread_style = Hud_reticules.spread_style[Hud_reticules.configs[Hud_reticules.status.config].spread_style] 
  675. 	 
  676. 	if spread_style == nil then 
  677. 		--debug_print("vint", "Spread Style \"" .. Hud_reticules.configs[Hud_reticules.status.config].spread_style .. "\" not found in Hud_reticules.spread_style\n") 
  678. 		spread_style = Hud_reticules.spread_style[RET_SPREAD_DEFAULT] 
  679. 	end 
  680. 	 
  681. 	--Spread for to calculate crosshairs 
  682. 	local pixel_spread 
  683. 	 
  684. 	local cross_mag_min = spread_style.cross_mag_min 
  685. 	local cross_mag_max = spread_style.cross_mag_max 
  686. 	 
  687. 	cross_mag_min = cross_mag_min - ((cross_mag_min - spread_style.cross_mag_fineaim_min) * fine_aim) 
  688. 	cross_mag_max = cross_mag_max - ((cross_mag_max - spread_style.cross_mag_fineaim_max) * fine_aim) 
  689. 	 
  690. 	--debug_print("vint", "fine_aim: " .. fine_aim .. "\n") 
  691. 	--debug_print("vint", "cross_mag_min: " .. cross_mag_min .. "\n") 
  692. 	--debug_print("vint", "cross_mag_max: " .. cross_mag_max .. "\n") 
  693. 	 
  694. 	if show_spread == true then 
  695. 		pixel_spread = wpn_spread * cross_mag_max + cross_mag_min 
  696. 	else 
  697. 		pixel_spread = cross_mag_min 
  698. 	end 
  699. 	 
  700. 	vint_set_property(Hud_reticules.elements.cross_n_h, "anchor", 0, -pixel_spread) 
  701. 	vint_set_property(Hud_reticules.elements.cross_e_h, "anchor", pixel_spread, 0) 
  702. 	vint_set_property(Hud_reticules.elements.cross_s_h, "anchor", 0, pixel_spread) 
  703. 	vint_set_property(Hud_reticules.elements.cross_w_h, "anchor", -pixel_spread, 0) 
  704. 	 
  705. 	--If the reticule is highlighted over an enemy then the ring alpha is stronger 
  706. 	local ring_alpha = 0 
  707. 	if Hud_reticules.status.highlight == "enemy" or Hud_reticules.status.highlight == "neutral" then 
  708. 		ring_alpha = spread_style.ring_alpha_highlight 
  709. 	else 
  710. 		ring_alpha = spread_style.ring_alpha 
  711. 	end 
  712.  
  713. 	local ring_small_min = spread_style.ring_min  
  714. 	local ring_small_max = spread_style.ring_max 
  715. 	local ring_large_min = spread_style.ring_min * HUD_RETICULE_RING_SIZE_DIF 
  716. 	local ring_large_max = spread_style.ring_max * HUD_RETICULE_RING_SIZE_DIF 
  717. 	local ring_mask_min = spread_style.ring_mask_min 
  718. 	local ring_mask_max = spread_style.ring_mask_max 
  719. 	 
  720. 	local ring_small_fineaim_min = spread_style.ring_fineaim_min  
  721. 	local ring_small_fineaim_max = spread_style.ring_fineaim_max  
  722. 	local ring_large_fineaim_min = spread_style.ring_fineaim_min * HUD_RETICULE_RING_SIZE_DIF 
  723. 	local ring_large_fineaim_max = spread_style.ring_fineaim_max * HUD_RETICULE_RING_SIZE_DIF 
  724. 	local ring_mask_fineaim_min = spread_style.ring_mask_fineaim_min 
  725. 	local ring_mask_fineaim_max = spread_style.ring_mask_fineaim_max 
  726. 	 
  727. 	--Fine aim calculations 
  728. 	ring_small_min = ring_small_min  - ((ring_small_min 	- ring_small_fineaim_min) * fine_aim) 
  729. 	ring_small_max = ring_small_max  - ((ring_small_max 	- ring_small_fineaim_max) * fine_aim) 
  730. 	ring_large_min = ring_large_min  - ((ring_large_min 	- ring_large_fineaim_min) * fine_aim) 
  731. 	ring_large_max = ring_large_max  - ((ring_large_max 	- ring_large_fineaim_max) * fine_aim) 
  732. 	ring_mask_min 	= ring_mask_min 	- ((ring_mask_min 	- ring_mask_fineaim_min) * fine_aim) 
  733. 	ring_mask_max 	= ring_mask_max  	- ((ring_mask_max 	- ring_mask_fineaim_max) * fine_aim) 
  734. 	                                                       
  735. 	local ring_small_scale, ring_small_alpha, ring_large_scale, ring_large_alpha, ring_mask_offset 
  736. 	 
  737. 	if show_spread == true then 
  738. 		ring_small_scale = ring_small_min + wpn_spread * (ring_small_max - ring_small_min) 
  739. 		ring_small_alpha = ring_alpha - (wpn_spread * 1.5) * ring_alpha 
  740. 	 
  741. 		if ring_small_alpha < 0 then 
  742. 			ring_small_alpha = 0 
  743. 		end 
  744.  
  745. 		ring_large_scale = ring_large_min + wpn_spread * (ring_large_max - ring_large_min) 
  746. 		ring_large_alpha = (wpn_spread * 1.5) * ring_alpha 
  747. 		 
  748. 		if ring_large_alpha > ring_alpha then 
  749. 			ring_large_alpha = ring_alpha 
  750. 		end 
  751. 		 
  752. 		ring_mask_offset = ring_mask_min + wpn_spread * (ring_mask_max - ring_mask_min) 
  753. 		 
  754. 	else 
  755. 		--No Spread 
  756. 		ring_small_scale = ring_small_min 
  757. 		ring_small_alpha = ring_alpha 
  758. 		ring_large_scale = ring_large_min 
  759. 		ring_large_alpha = 0 
  760. 		ring_mask_offset = 0  
  761. 	end 
  762. 	 
  763. 	--Ring Cropping		 
  764. 	vint_set_property(Hud_reticules.elements.ring_mask_nw_h, "anchor", -ring_mask_offset, -ring_mask_offset) 
  765. 	vint_set_property(Hud_reticules.elements.ring_mask_ne_h, "anchor", ring_mask_offset, -ring_mask_offset) 
  766. 	vint_set_property(Hud_reticules.elements.ring_mask_sw_h, "anchor", -ring_mask_offset, ring_mask_offset) 
  767. 	vint_set_property(Hud_reticules.elements.ring_mask_se_h, "anchor", ring_mask_offset, ring_mask_offset)		 
  768. 	 
  769. 	--Ring Scaling 
  770. 	vint_set_property(Hud_reticules.elements.ring_small_h, "scale", ring_small_scale, ring_small_scale) 
  771. 	vint_set_property(Hud_reticules.elements.ring_small_h, "alpha", ring_small_alpha) 
  772. 	vint_set_property(Hud_reticules.elements.ring_large_h, "scale", ring_large_scale, ring_large_scale) 
  773. 	vint_set_property(Hud_reticules.elements.ring_large_h, "alpha", ring_large_alpha) 
  774. 	 
  775. 	--Dim for fine aim 
  776. 	--No more dimming because the vignette has been altered 
  777. --	local fine_aim_alpha =  fine_aim * .2 + .3 
  778. --	vint_set_property(Hud_vignettes.fine_aim_dim.grp_h, "alpha", fine_aim_alpha) 
  779. 	 
  780. 	Hud_reticules.status.fine_aim = fine_aim 
  781. end 
  782.  
  783. --#####################################################################  
  784. --Sniper Directional Indicators 
  785. --##################################################################### 
  786. function hud_sniper_dir_update(di_h) 
  787. 	local rotation = vint_dataitem_get(di_h) 
  788. 	 
  789. 	--Find the arrow to update 
  790. 	for index, value in pairs(Hud_sniper_arrows) do 
  791. 		if index == di_h then 
  792. 			--Found now update the rotation 
  793. 			vint_set_property(value.arrow_h, "rotation", rotation) 
  794. 			break 
  795. 		end 
  796. 	end 
  797. end 
  798.  
  799. function hud_sniper_dir_add(di_h) 
  800. 	 
  801. 	--TODO: look through the table to make sure we don't have one already 
  802. 	--Clone bitmap 
  803. 	local arrow_clone_h = vint_object_clone(Hud_reticules.elements.sniper_dir_bmp_h) 
  804. 	 
  805. 	vint_set_property(arrow_clone_h, "visible", true) 
  806. 	 
  807. 	--Add handle to data object 
  808. 	Hud_sniper_arrows[di_h] = { 
  809. 		arrow_h = arrow_clone_h 
  810. 	} 
  811. 	 
  812. 	--update the sniper arrow 
  813. 	hud_sniper_dir_update(di_h) 
  814. end 
  815.  
  816. function hud_sniper_dir_remove(di_h) 
  817. 	--Find the arrow to remove 
  818. 	for index, value in pairs(Hud_sniper_arrows) do 
  819. 		if index == di_h then 
  820. 			vint_object_destroy(value.arrow_h) 
  821. 			Hud_sniper_arrows[index] = nil 
  822. 			break 
  823. 		end 
  824. 	end 
  825. end 
  826.  
  827. function hud_reticule_update_pressure(pressure_value) 
  828. 	if pressure_value == nil then 
  829. 		return 
  830. 	end 
  831. 	--invert value 
  832. 	pressure_value = 1 - pressure_value 
  833. 	--TODO: Update pressure 
  834. 	if pressure_value ~= Hud_reticules.pressure.cur_value then 
  835. 		--calculate angle and set property 
  836. 		local angle = Hud_reticules.pressure.start_angle * pressure_value 
  837. 		vint_set_property(Hud_reticules.elements.pressure_fill_h, "start_angle", angle) 
  838. 		Hud_reticules.pressure.cur_value = pressure_value 
  839. 	end 
  840. end 
  841.  
  842. function hud_reticule_change_position(x_screen_coord, y_screen_coord) 
  843. 	--Change the y screen anchor of the reticule 
  844. 	if Hud_reticules.status.y_screen_coord ~= y_screen_coord or Hud_reticules.status.x_screen_coord ~= x_screen_coord then 
  845. 		vint_set_property(Hud_reticules.elements.reticule_base_h, "anchor", x_screen_coord, y_screen_coord) 
  846. 		hud_cruise_control_update_pos(x_screen_coord, y_screen_coord) 
  847. 		hud_hits_updates_pos(x_screen_coord, y_screen_coord) 
  848. 		Hud_reticules.status.x_screen_coord = x_screen_coord  
  849. 		Hud_reticules.status.y_screen_coord = y_screen_coord  
  850. 	end 
  851. end 
  852.  
  853.  
  854.  
  855. --#####################################################################  
  856. --hud_reticule_spread_update() 
  857. -- 
  858. --Updates the opacity of the reticule 
  859. --##################################################################### 
  860. function hud_reticule_opacity_update(opacity)  
  861.  
  862. 	local persistant_opacity = (1 - opacity) * .67 
  863. 	 
  864. 	vint_set_property(Hud_reticules.elements.dot_persistant_h, "alpha", persistant_opacity) 
  865. 	vint_set_property(Hud_reticules.elements.reticule_h, "alpha", opacity) 
  866. end 
  867.  
  868. --#####################################################################  
  869. -- Overheat Meter 
  870. --##################################################################### 
  871. function hud_reticule_overheat_update(pct, is_overheated) 
  872. 	 
  873. 	local anim_h = vint_object_find("reticule_overheat_flash_anim",0,HUD_DOC_HANDLE) 
  874. 	local twn_h = vint_object_find("overheat_twn_h") 
  875. 	local overkill_txt_anim_h = vint_object_find("overkill_txt_anim") 
  876. 	local overkill_reticule_anim_h = vint_object_find("overkill_reticule_anim") 
  877.  
  878. 	--get a short handle to the weapon name 
  879. 	local wpn_name = Hud_reticules.status.wpn_name 
  880.  
  881. 	if pct ~= Hud_reticules.overheat.pct then 
  882. 		 
  883. 		-- If pct is 0 or we are the crib ship weapon hide the overheat meter 
  884. 		if pct == 0 or wpn_name == "sp_crib_ship_w_new" then 
  885. 			vint_set_property(Hud_reticules.elements.pressure_grp_h, "visible", false) 
  886. 		else 
  887. 			vint_set_property(Hud_reticules.elements.pressure_grp_h, "visible", true) 
  888.  
  889. 			--if wpn_name == "Pistol-GallowsDodger" or wpn_name == "Special-GluttonyGun" then 
  890. 			--	vint_set_property(Hud_reticules.elements.pressure_bg_gallows_h, "visible", true) 
  891. 			--	vint_set_property(Hud_reticules.elements.pressure_bg_h, "visible", false) 
  892. 			--else 
  893. 				vint_set_property(Hud_reticules.elements.pressure_bg_gallows_h, "visible", false) 
  894. 				vint_set_property(Hud_reticules.elements.pressure_bg_h, "visible", true) 
  895. 			--end 
  896. 			 
  897. 			--check if we have a charge weapon 
  898. 			local charge = false 
  899. 			if wpn_name == "Special-SonicGun" or wpn_name == "Special-CyberCannon" or wpn_name == "Special-Abduction" or wpn_name == "Rifle-Disintegrator" or wpn_name == "Explosive-PlasmaCannon" then 
  900. 				charge = true 
  901. 			end 
  902. 			 
  903. 			local r,g,b 
  904. 			--set meter color based on charge or overheat 
  905. 			 
  906. 			if charge then 
  907. 				--charge 
  908. 				r = (HUD_RETICULE_CHARGE_MAX.R - HUD_RETICULE_OVERHEAT_RED.R) * pct	+ HUD_RETICULE_OVERHEAT_RED.R 
  909. 				g = (HUD_RETICULE_CHARGE_MAX.G - HUD_RETICULE_OVERHEAT_RED.G) * pct	+ HUD_RETICULE_OVERHEAT_RED.G 
  910. 				b = (HUD_RETICULE_CHARGE_MAX.B - HUD_RETICULE_OVERHEAT_RED.B) * pct	+ HUD_RETICULE_OVERHEAT_RED.B 
  911. 			else 
  912. 				--overheat 
  913. 				r = (HUD_RETICULE_OVERHEAT_RED.R - HUD_RETICULE_OVERHEAT_LIGHT.R) * pct	+ HUD_RETICULE_OVERHEAT_LIGHT.R 
  914. 				g = (HUD_RETICULE_OVERHEAT_RED.G - HUD_RETICULE_OVERHEAT_LIGHT.G) * pct	+ HUD_RETICULE_OVERHEAT_LIGHT.G 
  915. 				b = (HUD_RETICULE_OVERHEAT_RED.B - HUD_RETICULE_OVERHEAT_LIGHT.B) * pct	+ HUD_RETICULE_OVERHEAT_LIGHT.B 
  916. 			end 
  917. 			 
  918. 			 
  919. 			--if meter is full then flash tint 
  920. 			if pct >= 1.0 then 
  921. 				if charge then 
  922. 					--change to charge colors 
  923. 					vint_set_property(twn_h,"start_value",HUD_RETICULE_CHARGE_MAX.R,HUD_RETICULE_CHARGE_MAX.G,HUD_RETICULE_CHARGE_MAX.B) 
  924. 					vint_set_property(twn_h,"end_value",HUD_RETICULE_CHARGE_MIN.R,HUD_RETICULE_CHARGE_MIN.G,HUD_RETICULE_CHARGE_MIN.B) 
  925. 				else 
  926. 					--change to overheat colors 
  927. 					vint_set_property(twn_h,"start_value",HUD_RETICULE_OVERHEAT_RED.R,HUD_RETICULE_OVERHEAT_RED.G,HUD_RETICULE_OVERHEAT_RED.B) 
  928. 					vint_set_property(twn_h,"end_value",HUD_RETICULE_OVERHEAT_LIGHT.R,HUD_RETICULE_OVERHEAT_LIGHT.G,HUD_RETICULE_OVERHEAT_LIGHT.B) 
  929. 				end 
  930. 				--colors are set, play the animation 
  931. 				lua_play_anim(anim_h,0,HUD_DOC_HANDLE) 
  932. 			elseif is_overheated == false then 
  933. 				--stop the animation and handle colors dynamically 
  934. 				vint_set_property(anim_h, "is_paused", true) 
  935. 				vint_set_property(Hud_reticules.elements.pressure_fill_h, "tint", r, g, b) 
  936. 				has_overheated = false; 
  937. 			end 
  938.  
  939. 			if wpn_name == "Pistol-GallowsDodger" and pct >= 1.0 then 
  940. 				vint_set_property(Hud_reticules.elements.overkill_skull, "visible", true) 
  941. 				vint_set_property(Hud_reticules.elements.overkill_skull, "alpha", 1.0) 
  942. 			end 
  943.  
  944. 			local skull_alpha = vint_get_property(Hud_reticules.elements.overkill_skull, "alpha") 
  945.  
  946. 			if skull_alpha == 0.0 then 
  947. 				vint_set_property(Hud_reticules.elements.overkill_skull, "visible", false) 
  948. 			end 
  949. 			 
  950. 			if is_overheated and not has_overheated and wpn_name == "Pistol-GallowsDodger" then 
  951. 				has_overheated = true; 
  952. 				 
  953. 				-- apply start values first so it fades out/in correctly 
  954. 				vint_apply_start_values(overkill_txt_anim_h) 
  955.  
  956. 				local base_overkill_h = vint_object_find("base_overkill") 
  957.  
  958. 				local overkill_fill_twn_h = vint_object_find("tween_fill_scale", overkill_txt_anim_h)	 
  959. 				local overkill_cap_l_twn_h = vint_object_find("tween_cap_l_anchor", overkill_txt_anim_h) 
  960. 				local overkill_cap_r_twn_h = vint_object_find("tween_cap_r_anchor", overkill_txt_anim_h) 
  961. 				local overkill_txt_scale_h = Vdo_tween_object:new("new_tween124", overkill_txt_anim_h) 
  962.  
  963. 				local overkill_txt_h = Vdo_base_object:new("overkill_txt", base_overkill_h) 
  964. 				overkill_txt_h:set_text_crc(get_localized_crc_for_tag("CUST_WPN_UPGRADE_ULT_NAME_OVERKILL")) 
  965. 				local text_size_x, text_size_y = overkill_txt_h:get_actual_size() 
  966. 				local text_startvalue_scale_x, text_startvalue_scale_y = overkill_txt_scale_h:get_start_value() 
  967.  
  968. 				text_size_x = text_size_x / text_startvalue_scale_x 
  969. 				 
  970. 				local overkill_bg_h = Vdo_base_object:new("overkill_fill", base_overkill_h)  -- background 
  971. 				--local overkill_bg_l_h = Vdo_base_object:new("frame_cap_l") -- left cap 
  972. 				--local overkill_bg_r_h = Vdo_base_object:new("frame_cap_r") -- right cap 
  973.  
  974. 				local overkill_bg_anchor_x, overkill_bg_anchor_y = overkill_bg_h:get_anchor() --vint_get_property(overkill_bg_h, "anchor") 
  975. 				local overkill_background_size_x, overkill_background_size_y = overkill_bg_h:get_actual_size() --vint_get_property(overkill_bg_h, "screen_size") 
  976.  
  977. 				local new_overkill_background_size_x = text_size_x + OVERKILL_TEXT_PADDING 
  978. 				local old_overkill_scale_x, old_overkill_scale_y = overkill_bg_h:get_scale() 
  979.  
  980. 				local new_overkill_fill_scale = new_overkill_background_size_x / overkill_background_size_x * old_overkill_scale_x 
  981.  
  982. 				 
  983.  
  984. 				local left_cap_anchor = overkill_bg_anchor_x - new_overkill_background_size_x/2 
  985. 				local rght_cap_anchor = overkill_bg_anchor_x + new_overkill_background_size_x/2 
  986.  
  987. 				vint_set_property(overkill_fill_twn_h, "end_value", new_overkill_fill_scale, old_overkill_scale_y) 
  988. 				vint_set_property(overkill_cap_l_twn_h, "end_value", left_cap_anchor, overkill_bg_anchor_y) 
  989. 				vint_set_property(overkill_cap_r_twn_h, "end_value", rght_cap_anchor, overkill_bg_anchor_y) 
  990. 	 
  991. 				lua_play_anim(overkill_txt_anim_h, 0) 
  992. 				lua_play_anim(overkill_reticule_anim_h, 0) 
  993. 			end 
  994.  
  995. 			 
  996.  
  997. 			local overheat_value = 1 - pct 
  998. 			if overheat_value ~= Hud_reticules.overheat.pct then 
  999. 				--calculate angle and set property 
  1000. 				local angle = Hud_reticules.pressure.start_angle * overheat_value 
  1001. 				vint_set_property(Hud_reticules.elements.pressure_fill_h, "start_angle", angle) 
  1002. 			end 
  1003. 		end 
  1004. 		 
  1005. 		Hud_reticules.overheat.is_overheated = is_overheated 
  1006. 		Hud_reticules.overheat.pct = pct	 
  1007. 	end 
  1008. 	 
  1009. 	if wpn_name ~= "Pistol-GallowsDodger" then 
  1010. 		vint_set_property(Hud_reticules.elements.overkill_skull, "visible", false) 
  1011. 		vint_set_property(Hud_reticules.elements.overkill_skull, "alpha", 0.0) 
  1012. 	end 
  1013. 	 
  1014. end 
  1015.  
  1016. --[[ 
  1017. NOT USED ANYMORE BUT IT COULD COME BACK LATER 
  1018. function hud_reticule_process_hit() 
  1019. 	--we got a hit so add to the index 
  1020. 	Hud_current_hit_index = Hud_current_hit_index + 1 
  1021. 	 
  1022. 	--we don't want too many going, cap it at RET_HIT_MAX 
  1023. 	if Hud_current_hit_index > RET_HIT_MAX then 
  1024. 		Hud_current_hit_index = 1 
  1025. 	end 
  1026. 	 
  1027. 	--clear out the table 
  1028. 	if Hud_hit_data[Hud_current_hit_index] ~= nil then 
  1029. 		vint_object_destroy(Hud_hit_data[Hud_current_hit_index].image_h) 
  1030. 		vint_object_destroy(Hud_hit_data[Hud_current_hit_index].anim_h) 
  1031. 		Hud_hit_data[Hud_current_hit_index] = {}  
  1032. 	end 
  1033. 	 
  1034. 	--create the clones and store them 
  1035. 	local image_h = vint_object_find("hit_ring") 
  1036. 	local anim_h = vint_object_find("reticule_hit_anim") 
  1037. 	local image_clone_h = vint_object_clone(image_h) 
  1038. 	local anim_clone_h = vint_object_clone(anim_h) 
  1039. 	 
  1040. 	--Hud_hit_data[Hud_current_hit_index].image_h = image_clone_h 
  1041. 	--Hud_hit_data[Hud_current_hit_index].anim_h = anim_clone_h 
  1042. 	 
  1043. 	--turn on the clone 
  1044. 	vint_set_property(image_clone_h, "visible", true) 
  1045. 	 
  1046. 	--retarget the new animation to the new image 
  1047. 	vint_set_property(anim_clone_h, "target_handle", image_clone_h) 
  1048. 	 
  1049. 	--play the animation 
  1050. 	lua_play_anim(anim_clone_h,0) 
  1051. end--]] 
  1052.