./vdo_gsi.lua

  1. ------------------------------------------------------------------------------- 
  2. --GSI  
  3. ------------------------------------------------------------------------------- 
  4. -- Inherited from Vdo_base_object 
  5. Vdo_gsi = Vdo_base_object:new_base() 
  6.  
  7. -- Standard Init Function 
  8. function vdo_gsi_init() 
  9. end 
  10.  
  11. -- Standard Cleanup Function 
  12. function vdo_gsi_cleanup() 
  13. end 
  14.  
  15. ------------------------------------------------------------------------------- 
  16. --CONSTANTS 
  17. ------------------------------------------------------------------------------- 
  18. --Order of creation is timer, x/y, meter, info 
  19. --GSI Indicator Indexes, increment these if there is more than one 
  20. --HVS_RCK - in gsi.cpp, the order of processing in gsi_update_local_player_gameplay_status_indicator is directly tied to these. 
  21. --			IF YOU ADD A TYPE MAKE SURE EVERYTHING IS LINED UP RIGHT 
  22. local GSI_TIMER 		= 0 
  23. local GSI_XY 			= 1 
  24. local GSI_METER		= 5 
  25. local GSI_INFO 		= 9 
  26. local GSI_COMBO 		= 13 
  27. local GSI_CAP_METER 		= 17 
  28.  
  29. --Config Indexes, used to define the arangement of a configuration 
  30. local GSI_CONFIG_ROW = 1		--Row Number 
  31. local GSI_CONFIG_SKIN = 2		--Skin Type (Indicator Specific) 
  32.  
  33. --Reused enums for special case things... 
  34. local GSI_CONFIG_MISSION = 1000 
  35. local GSI_CONFIG_RACING1 = 130 
  36. local GSI_CONFIG_RACING2 = 131 
  37.  
  38. --local 1 = initializing, 2 = running, 3 = end, 4 = mission change 
  39. local GSI_STATE_INITIALIZING			= 1 
  40. local GSI_STATE_RUNNING					= 2 
  41. local GSI_STATE_END						= 3 
  42. local GSI_STATE_MISSION_CHANGE		= 4 
  43.  
  44. HUD_KILL_ICON = 0 
  45. HUD_DEFEND_ICON = 1 
  46. HUD_USE_ICON = 2 
  47. HUD_REVIVE_ICON = 3 
  48. HUD_LOCATION_ICON = 4  
  49. HUD_COOP_ICON = 4  
  50. HUD_TELE_ICON = 18 
  51. HUD_STOMP_ICON = 20 
  52. HUD_FREEZE_ICON = 21 
  53. HUD_BLAST_ICON = 22 
  54. HUD_BUFF_ICON = 23 
  55. HUD_GIFT_ICON = 24 
  56. HUD_NAUGHTY_ICON = 25  
  57.  
  58. local GSI_OBJECTIVE_ICONS = { 
  59. 	[HUD_KILL_ICON] = "ui_hud_gsi_obj_kill", 
  60. 	[HUD_DEFEND_ICON] = "ui_hud_gsi_obj_protect", 
  61. 	[HUD_USE_ICON] = "ui_hud_gsi_obj_use", 
  62. 	[HUD_REVIVE_ICON] = "ui_hud_gsi_obj_revive", 
  63. 	[HUD_LOCATION_ICON] = "ui_hud_gsi_obj_goto", 
  64. 	[HUD_TELE_ICON] = "ui_hud_gsi_obj_tele", 
  65. 	[HUD_STOMP_ICON] = "ui_hud_gsi_obj_stomp", 
  66. 	[HUD_FREEZE_ICON] = "ui_hud_gsi_obj_freeze", 
  67. 	[HUD_BLAST_ICON] = "ui_hud_gsi_obj_blast", 
  68. 	[HUD_BUFF_ICON] = "ui_hud_gsi_obj_buff", 
  69. 	[HUD_GIFT_ICON] = "ui_hud_gsi_obj_gift", 
  70. 	[HUD_NAUGHTY_ICON] = "ui_hud_gsi_obj_naughty",  
  71. } 
  72.  
  73. GSI_SKIN = { 
  74. 	["Default"] = 		{ tint = {0.89, 0.749, 0.05}	},		--Default: Yellow			 
  75. 	["Health"] = 		{ tint = {0.75, 0 , 0} 			},		--Description: Health 
  76. 	["Damage"] = 		{ tint = {0.89, 0.749, 0.05}	}, 	--Description: Yellow 
  77. 	["Radioactivity"] = { tint = {0, 1, 0.25} 			},		--Description: NEON Greeen 
  78. 	["Fear"] = 			{ tint = {0.89, 0.749, 0.05}	}, 	--Description: Yellow 
  79. 	["Pleasure"] = 		{ tint = {1, 0, .5}				}, 	--Description: Pink (Escort) 
  80. 	["Footage"] = 		{ tint = {0, .5, 1} 			}, 	--Description: Blue (Escort) 
  81. 	["Mayhem"] =		{ tint = {0.89, 0.749, 0.05}	},		--Description: Mayhem has special properties where it grabs the colors from hud_mayhem.lua 
  82. 	["TankMayhem"] =	{ tint = {0.89, 0.749, 0.05}	},		--Description: Mayhem has special properties where it grabs the colors from hud_mayhem.lua 
  83. 	["Fight_Club"] =	{ tint = {0.75, 0 , 0} 			},		--Description: Fight club is basically a red bar but requires special update functionality because the label changes all the time. 
  84. 	["Nitrous"] =		{ tint = {0, .5, 1 } 			},		--Description: Blue 
  85. 	["Diversion1"] =	{ tint = {0.69, 0.06, 0.12}		}, 
  86. 	["Diversion2"] =	{ tint = {0.90, 0.25, 0.15}	 , bg = {0.69, 0.06, 0.12}	}, 
  87. 	["Diversion3"] =	{ tint = {0.93, 0.47, 0.16}	 , bg = {0.90, 0.25, 0.15}	}, 
  88. 	["Diversion4"] =	{ tint = {0.96, 0.72, 0.10}	 , bg = {0.93, 0.47, 0.16}	}, 
  89. 	["Diversion5"] =	{ tint = {0.95, 0.89, 0}	 , bg = {0.96, 0.72, 0.10}	}, 
  90. } 
  91.  
  92. --Enums for activity and other static configurations 
  93. local GSI_CONFIGS = { 
  94. 	--Insurance Fraud 
  95. 	[0] = {  
  96. 		--Row, Column, Indicator Handle, Indicator Type, Skin 
  97. 		[GSI_TIMER]			= { 0, "negative",				}, 
  98. 		[GSI_XY]				= { 1, "Cash",						}, 
  99. 		[GSI_METER]			= { 2, "Cash",						}, 
  100. 	},                            
  101. 	--Running Man 
  102. 	[1] = {  
  103. 		[GSI_TIMER]			= { 0, "running_man",			}, 
  104. 		[GSI_XY]				= { 1, "Cash",						}, 
  105. 	}, 
  106. 	--Tank Mayhem 
  107. 	[2] = { 
  108. 		[GSI_TIMER]			= { 0, "negative",				}, 
  109. 		[GSI_XY]				= { 1, "Cash",						}, 
  110. 	}, 
  111. 	--Flight Mayhem 
  112. 	[3] = { 
  113. 		[GSI_TIMER]			= { 0, "negative",				}, 
  114. 		[GSI_XY]			= { 1, "Cash",					}, 
  115. 	}, 
  116. 	--Fight Club 
  117. 	[10] = { 
  118. 		[GSI_TIMER]			= { 0, "positive",				}, 
  119. 		[GSI_XY]				= { 1, "",							}, 
  120. 		[GSI_XY + 1]		= { 2, "",							}, 
  121. 		[GSI_INFO]			= { 3, "",							}, 
  122. 	}, 
  123. 	-- FC, king of the hill mode 
  124. 	[11] = { 
  125. 		[GSI_TIMER]			= { 0, "positive",				}, 
  126. 		[GSI_XY]				= { 1, "",							}, 
  127. 		[GSI_METER]			= { 2, "Default",					}, 
  128. 		[GSI_INFO]			= { 3, "",							}, 
  129. 	}, 
  130. 	-- Survival Diversion 
  131. 	[30] = { 
  132. 		[GSI_XY]				= { 0, "",							}, 
  133. 		[GSI_XY + 1]		= { 1, "",							}, 
  134. 		[GSI_TIMER]			= { 2, "negative",				}, 
  135. 	}, 
  136. 	--Taxi, Hostage 
  137. 	[35] = { 
  138. 		[GSI_TIMER]			= { 0, "negative",				}, 
  139. 		[GSI_INFO]			= { 1, "Cash",						}, 
  140. 	}, 
  141. 	--Ambulance 
  142. 	[40] = {  
  143. 		[GSI_TIMER]			= { 0, "negative",				}, 
  144. 		[GSI_XY]				= { 1, "",							}, 
  145. 	}, 
  146. 	--Tow Truck, Flashing, Streaking, Snatch 
  147. 	[50] = { 
  148. 		[GSI_TIMER]			= { 0, "negative",				}, 
  149. 		[GSI_XY]				= { 1, "normal",					}, 
  150. 	}, 
  151. 	--Heli's alternate 
  152. 	[51] = { 
  153. 		[GSI_XY]				= { 0, "normal",					}, 
  154. 	}, 
  155. 	--Heli's Car and XY 
  156. 	[52] = { 
  157. 		[GSI_XY]				= { 0, "normal",					}, 
  158. 	}, 
  159. 	--Heli for hire (Standard) 
  160. 	[53] = { 
  161. 		[GSI_TIMER]			= { 0, "negative",				}, 
  162. 		[GSI_XY]				= { 1, "normal",					}, 
  163. 	}, 
  164. 	[56] = {	-- genki targets, mind over murder 
  165. 		[GSI_XY]				= { 0, "normal",					}, 
  166. 		[GSI_INFO]			= { 1, "",							}, 
  167. 		[GSI_TIMER]			= { 2, "negative",				}, 
  168. 	}, 
  169. 	--Trail Blazing 
  170. 	[70] = { 
  171. 		[GSI_TIMER]			= { 0, "negative",				}, 
  172. 		[GSI_XY]				= { 1, "normal",					}, 
  173. 		[GSI_INFO]			= { 2, "TrailBlazing"			}, 
  174. 	}, 
  175. 	-- Escort 
  176. 	[140] = { 
  177. 		[GSI_METER] 		= { 0, "Pleasure",				}, 
  178. 		[GSI_METER + 1]	= { 1, "Footage",					}, 
  179. 	}, 
  180. 	-- Guardian_angel 
  181. 	[150] = { 
  182. 		[GSI_INFO]			= { 0, "",							}, 
  183. 		[GSI_METER] 		= { 1, "",							}, 
  184. 	}, 
  185. 	--	Coop Diversions 
  186. 	[160] = { 
  187. 		[GSI_INFO]			= { 0, "", 							}, 
  188. 		[GSI_TIMER]			= { 1, "negative", 				}, 
  189. 		[GSI_INFO + 1]		= { 2, "", 							}, 
  190. 	}, 
  191. 	--	Paddle Fight 
  192. 	[200] = { 
  193. 		[GSI_TIMER]			= { 0, "negative",				}, 
  194. 		[GSI_XY]				= { 1, "Cash",						}, 
  195. 	}, 
  196. 	[1000] = { 
  197. 		--Mission HUD 
  198. 		--This is just used here as a blank slate... 
  199. 	}, 
  200. } 
  201.  
  202. --Audio Constants 
  203. GSI_AUDIO_COUNT_POSITIVE = game_audio_get_audio_id("SYS_HUD_CNTDWN_POS") 
  204. GSI_AUDIO_TRAIL_BLAZING = game_audio_get_audio_id("SYS_HUD_CNTDWN_POS") 
  205. GSI_AUDIO_DIV_COMPLETE = game_audio_get_audio_id("SYS_HUD_CNTDWN_POS") 
  206.  
  207. --Formatting Constants 
  208. GSI_TEXT_SPACING = 9 
  209.  
  210.  
  211. --Check for xy crc name, self doesnt work because its cloned each time. 
  212. Cur_xy_label_crc = -1 
  213.  
  214. ------------------------------------------------------------------------------- 
  215. --Initializes GSI 
  216. ------------------------------------------------------------------------------- 
  217. function Vdo_gsi:init()	 
  218. 	 
  219. 	--Setup Core Values for the GSI 
  220. 	self.status = { 
  221. 		config_index = -1, 
  222. 		config = -1, 
  223. 		indicator_count = 0, 
  224. 		grid_spacing = 10, 
  225. 		state = -1, 
  226. 		diversion_level = -1, 
  227. 		is_dirty = false, 
  228. 		debug_mode = false, 
  229. 	} 
  230.  
  231. 	--Store the vdo copies in memory... 
  232. 	self.indicators = {} 
  233. 	 
  234. 	--What grid the menu is using... 
  235. 	self.grid = {}  
  236. 				 
  237. 	--References to Animations 
  238. 	self.anims = {} 
  239.  
  240. 	--Store off references to indicators for later mothership cloning... 
  241. 	self.timer_obj = Vdo_gsi_timer:new("timer", self.handle) 
  242. 	self.xy_obj = Vdo_gsi_xy:new("xy", self.handle) 
  243. 	self.meter_obj = Vdo_gsi_meter:new("meter", self.handle) 
  244. 	self.cap_meter_obj = Vdo_gsi_capture_meter:new("capture_meter", self.handle) 
  245. 	self.info_obj = Vdo_gsi_info:new("info", self.handle) 
  246. 	self.combo_obj = Vdo_gsi_info:new("combo", self.handle) 
  247. 	self.icon_obj = Vdo_base_object:new("icon", self.handle) 
  248. 		 
  249. 	--Hide Mothership indicators 
  250. 	self.meter_obj:set_visible(false) 
  251. 	self.cap_meter_obj:set_visible(false) 
  252. 	self.info_obj:set_visible(false) 
  253. 	self.timer_obj:set_visible(false) 
  254. 	self.xy_obj:set_visible(false) 
  255. 	self.combo_obj:set_visible(false) 
  256. 	self.icon_obj:set_visible(false) 
  257. 	 
  258. 	self.gsi_move_anim_h = vint_object_find("gsi_move_anim", 0, self.doc_handle) 
  259. 	self.move_twn_2_h = vint_object_find("move_twn_2", self.gsi_move_anim_h) 
  260. 	local return_callback_string = self:package_tween_callback("blink_complete")	 
  261. 	vint_set_property(self.move_twn_2_h, "end_event", return_callback_string) 
  262. 	 
  263. 	 
  264. 	self.gsi_blink_is_active = false 
  265. 	 
  266. 	self.is_active = false 
  267. 	self.width, self.height = 0, 0 
  268. 	self.blink_width = 0 
  269. 	 
  270. 	--Close the GSI 
  271. 	self:close() 
  272. end 
  273.  
  274. ------------------------------------------------------------------------------- 
  275. -- Updates GSI via Data Item update... 
  276. -- **sr2_local_player_gameplay_indicator_status** 
  277. -- 
  278. -- The parameters are varied based on the data_type specified in the first  
  279. -- parameter from the dataitem.  
  280. ------------------------------------------------------------------------------- 
  281. function Vdo_gsi:update(di_h) 
  282. 	local data_type, param1, param2, param3, param4, param5, param6, param7, param8, param9 = vint_dataitem_get(di_h) 
  283. 	 
  284. 	if self.status.debug_mode == true then 
  285. 		debug_print("vint", "GSI Update: " .. var_to_string(data_type).. "\n") 
  286. 	end 
  287. 	 
  288. 	--Determine what datatype we are passing through so we can figure out what  
  289. 	--to do with the rest of the parameters.	 
  290. 	if data_type == nil then 
  291. 		--No specified data_type so don't do anything. 
  292. 	elseif data_type == "configuration" then 
  293. 		--Update configuration 
  294. 		self:update_configuration(param1, param2, param3, param4, param5, param6, param7, param8, param9)	 
  295. 	else 
  296. 		--Update Indicators 
  297. 		self:update_indicators(data_type, param1, param2, param3, param4, param5, param6, param7, param8, param9)	 
  298. 	end 
  299. 	 
  300. 	--TODO: figure out this part of the code... 
  301. 	 
  302. 	--Check if the gsi has been re-formatted 
  303. 	if self.status.is_dirty == true and self.status.state ~= 3 then 
  304. 		local indicators_created = 0 
  305. 		for i, val in pairs(self.indicators) do 
  306. 			indicators_created = indicators_created + 1 
  307. 		end 
  308. 		 
  309. 		--If we have all the data then format it! 
  310. 		if indicators_created == self.status.indicator_count and self.status.indicator_count ~= 0 then 
  311. 			if self.status.config_index == GSI_CONFIG_MISSION then 
  312. 				--Mission config doesn't exist until this is run 
  313. 				self:reset_config(GSI_CONFIG_MISSION) 
  314. 			end 
  315. 			 
  316. 			--If we are in state 4, it means to do a partial refresh. Otherwise play the opening animation. 
  317. 			if self.status.state == 4 then 
  318. 				local width, height = self:update_layout() 
  319. 			else 
  320. 				--Open up GSI 
  321. 				self:open() 
  322. 			end 
  323. 			 
  324. 			self.status.is_dirty = false 
  325. 		else 
  326. 			--Exit early since we don't have all the indicators... 
  327. 			return 
  328. 		end 
  329. 	end 
  330. 	 
  331. 	--Process the GSI and update it if it or any of its elements are dirty 
  332. 	for i, val in pairs(self.indicators) do 
  333. 		if val.indicator.is_dirty == true then 
  334. 			self:update_layout() 
  335. 			break 
  336. 		end 
  337. 	end 
  338. 	if self.blink_ready == true then 
  339. 		self:blink() 
  340. 	end 
  341. end 
  342.  
  343. function Vdo_gsi:update_complete() 
  344. 	 
  345. end 
  346.  
  347.  
  348. ------------------------------------------------------------------------------- 
  349. -- Updates Configuration, data is first processed by Vdo_gsi:update() then 
  350. -- sent here for processing. 
  351. -- 
  352. -- @param	gsi_state					1 = initializing, 2 = running, 3 = end, 4 = mission change 
  353. -- @param	config						Configuration # 
  354. -- @param	icon_bmp_name				Icon Bitmap Name     IGNORED BY THIS SCRIPT! 
  355. -- @param	gameplay_title_crc		Title CRC  
  356. -- @param	gameplay_title_string	Title String 
  357. -- @param	diversion_level			Diversion Level # string 
  358. -- @param	visible						Visible 
  359. -- @param	is_diversion				Is it a diversion? 
  360. -- @param	indicator_count			Indicator Count, used for missions to  
  361. --												determine how many indicators is needed  
  362. --												before building the ui. 
  363. ------------------------------------------------------------------------------- 
  364. function Vdo_gsi:update_configuration(gsi_state, config, icon_bmp_name, gameplay_title_crc, gameplay_title_string, diversion_level, visible, is_diversion, indicator_count) 
  365. 	--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
  366. 	--Debug Start 
  367. 	--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
  368. 	if self.status.debug_mode == true then	 
  369. 		debug_print("vint", " gsi state: " .. var_to_string(gsi_state) .. "\n") 
  370. 		debug_print("vint", " configuration: " .. var_to_string(config) .. "\n") 
  371. 		debug_print("vint", " icon_bitmap_name: " .. var_to_string(icon_bmp_name) .. "\n") 
  372. 		debug_print("vint", " gameplay_title crc: " .. var_to_string(gameplay_title_crc) .. "\n") 
  373. 		debug_print("vint", " gameplay_title string: " .. var_to_string(gameplay_title_string) .. "\n") 
  374. 		debug_print("vint", " diversion_level: " .. var_to_string(diversion_level) .. "\n") 
  375. 		debug_print("vint", " visible: " .. var_to_string(visible) .. "\n") 
  376. 		debug_print("vint", " is_diversion: " .. var_to_string(is_diversion) .. "\n") 
  377. 		debug_print("vint", " indicator_count: " .. var_to_string(indicator_count) .. "\n\n") 
  378. 	end 
  379. 	--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
  380.  
  381. 	--Update Diversion Level 
  382. 	if diversion_level ~= self.status.diversion_level then 
  383. 		--Diversion Level is no longer used... 
  384. 	end 
  385. 	 
  386. 	if gsi_state ~= self.status.state or gsi_state == GSI_STATE_MISSION_CHANGE then 
  387. 	 
  388. 		if gsi_state == GSI_STATE_INITIALIZING or (self.status.is_dirty == true and self.status.state == -1 and gsi_state ~= GSI_STATE_END) or (gsi_state == GSI_STATE_MISSION_CHANGE	 and config == GSI_CONFIG_MISSION and self.status.is_dirty == true ) then 
  389. 			 
  390. 			if config ~= GSI_CONFIG_MISSION then 
  391. 				--Use pre-configuration settings 
  392. 				 
  393. 				--Update configuration layout 
  394. 				local success = self:reset_config(config) 
  395. 				if success == false then 
  396. 					return 
  397. 				end 
  398.  
  399. 				--Start out with a fresh number of indicators 
  400. 				indicator_count = 0	 
  401. 				 
  402. 				--Get number of indicators used in configuration 
  403. 				for idx, val in pairs(self.status.config) do 
  404. 					indicator_count = indicator_count + 1 
  405. 				end 
  406.  
  407. 			else 
  408. 				--Use Mission config  
  409. 				 
  410. 				--Clear Indicator and Icon Objects 
  411. 				for idx, val in pairs(self.indicators) do 
  412. 					val.indicator:object_destroy() 
  413. 					val.icon:object_destroy() 
  414. 				end 
  415. 				 
  416. 				--Clear Indicator tables, grid and meter flash data 
  417. 				self.indicators = {} 
  418. 				self.grid = {} 
  419.  
  420. 				--Use Mission Configuration, then you have to wait until the indicators are setup here. 
  421. 				self.status.config_index = GSI_CONFIG_MISSION 
  422. 				self.status.config = GSI_CONFIGS[GSI_CONFIG_MISSION] 
  423. 				 
  424. 				if indicator_count > 2 then 
  425. 					debug_print("", "MISSION GSI ERROR!!! The mission is trying to use more than two indicators at once\n") 
  426. 				end 
  427. 			end	 
  428. 			 
  429. 			--Set the visual state to dirty so we clean up later 
  430. 			self.status.is_dirty = true 
  431. 			 
  432. 			--Store status data into files 
  433. 			self.status.indicator_count = indicator_count 
  434. 	 
  435. 			--Hide GSI until formatted... 
  436. 			self:show(false) 
  437. 			 
  438. 		elseif gsi_state == GSI_STATE_END then 
  439. 		 
  440. 			--Set the flag to unformatted. 
  441. 			self.status.is_dirty = true 
  442. 			 
  443. 			--Reset the diversion level 
  444. 			self.status.diversion_level = -1 
  445. 			 
  446. 			--GSI state should now close 
  447. 			self:close() 
  448.  
  449. 		elseif gsi_state == GSI_STATE_MISSION_CHANGE and config == GSI_CONFIG_MISSION then 
  450. 			 
  451. 			--This is used if the hud needs to change configuration midway through a mission 
  452. 			 
  453. 			--Set the visual state to dirty so we clean up later 
  454. 			self.status.is_dirty = true 
  455. 			 
  456. 			--Clear Indicator Objects 
  457. 			for idx, val in pairs(self.indicators) do 
  458. 				val.indicator:object_destroy() 
  459. 				val.icon:object_destroy() 
  460. 			end 
  461. 			 
  462. 			--Clear Indicator tables and grid 
  463. 			self.indicators = {} 
  464. 			self.grid = {} 
  465. 			 
  466. 			--Hide gsi until we can show the indicators... 
  467. 			self:show(false) 
  468. 			 
  469. 			--Use Mission Configuration, you have to wait until the indicators are setup here. 
  470. 			self.status.config_index = GSI_CONFIG_MISSION 
  471. 			self.status.config = GSI_CONFIGS[GSI_CONFIG_MISSION] 
  472. 			 
  473. 			--Store status data into files 
  474. 			self.status.indicator_count = indicator_count 
  475. 			 
  476. 		end 
  477. 		self.status.state = gsi_state 
  478. 	end 
  479. end 
  480.  
  481.  
  482. ------------------------------------------------------------------------------- 
  483. -- Updates any of the indicators. 
  484. -- 
  485. -- @param 	data_type		Determines what type of indicator we send the other 
  486. --									Parameters to. The additional paramters are generic 
  487. --									and re-used for all the indicators 
  488. --	@param	ind_index		Indicator Index, used to map indicators between game 
  489. --									and Interface Lua. 
  490. -- @param	visible			Is the indicator Visible? 
  491. -- @param	label_crc		Label for the indicator... 
  492. -- @param	icon_enum		Icon to use for this widget 
  493. -- @param.. param4-9			Generic parameters use for all the other indicators 
  494. ------------------------------------------------------------------------------- 
  495. function Vdo_gsi:update_indicators(data_type, ind_index, visible, label_crc, icon_enum, param5, param6, param7, param8, param9) 
  496. 	 
  497. 	--Error checking 
  498. 	if self.status.config == -1 then 
  499. 		debug_print("vint", "GSI: No configurations were created, so we do not update shit.\n") 
  500. 		return 
  501. 	end 
  502.  
  503. 	--Use Mission Configuration, you have to wait until the indicators are setup here.			 
  504. 	if self.status.config[ind_index] == nil and self.status.config ~= GSI_CONFIGS[GSI_CONFIG_MISSION] then 
  505. 		debug_print("vint", "GSI: Indicator not supported in current configuration. [element_type = " .. var_to_string(ind_index) .. " ]\n") 
  506. 		return 
  507. 	end 
  508. 	 
  509. 	--Get skin from the configuration index 
  510. 	local skin 
  511. 	if self.status.config ~= GSI_CONFIGS[GSI_CONFIG_MISSION] then 
  512. 		skin = self.status.config[ind_index][GSI_CONFIG_SKIN] 
  513. 	else 
  514. 		skin = "" 
  515. 	end 
  516.  
  517. 	if	data_type == "timer" then 
  518. 		----------------------------------------------------------------------		 
  519. 		-- TIMER 
  520. 		---------------------------------------------------------------------- 
  521. 		if self.status.debug_mode == true then 
  522. 			debug_print("vint", " timer index: " .. ind_index .. "\n") 
  523. 			debug_print("vint", " visible: " .. var_to_string(visible) .. "\n") 
  524. 			debug_print("vint", " description crc: " .. var_to_string(label_crc) .. "\n") 
  525. 			debug_print("vint", " description: " .. var_to_string(param5) .. "\n") 
  526. 			debug_print("vint", " seconds left: " .. var_to_string(param6) .. " is a positive timer: " .. var_to_string(param7) .. "\n\n") 
  527. 		end 
  528. 		 
  529. 		--Get specific indicator parameters 
  530. 		local seconds				=	param6	-- Time: seconds left  
  531. 		local is_countdown	=	param7		-- Are we counting down or up? 
  532. 		 
  533. 		 
  534. 		 
  535. 		--Clone the indicator from the mothership 
  536. 		if self.indicators[ind_index] == nil then 
  537. 			self.indicators[ind_index] = {} 
  538. 			self.indicators[ind_index].indicator = Vdo_gsi_timer:clone(self.timer_obj.handle) 
  539. 			self.indicators[ind_index].indicator:create(skin) 
  540. 			 
  541. 			--Also clone and set the icon 
  542. 			self.indicators[ind_index].icon = Vdo_base_object:clone(self.icon_obj.handle) 
  543. 		end 
  544. 		if icon_enum == nil or icon_enum == -1 then 
  545. 			self.indicators[ind_index].icon:set_visible(false) 
  546. 		else 
  547. 			local icon_name = GSI_OBJECTIVE_ICONS[icon_enum] 
  548. 			self.indicators[ind_index].icon:set_image(icon_name) 
  549. 			self.indicators[ind_index].icon:set_visible(true) 
  550. 		end 
  551. 		 
  552. 		--Update Indicator 
  553. 		self.indicators[ind_index].indicator:update(visible, skin, label_crc, seconds, is_countdown) 
  554. 	elseif data_type == "x_of_y_indicator" then 
  555. 		----------------------------------------------------------------------		 
  556. 		-- X of Y 
  557. 		---------------------------------------------------------------------- 
  558. 		if self.status.debug_mode == true then 
  559. 			debug_print("vint", " x_of_y_indicator index: " .. ind_index .. "\n") 
  560. 			debug_print("vint", " visible: " .. var_to_string(visible) .. "\n") 
  561. 			debug_print("vint", " description crc: " .. var_to_string(label_crc) .. "\n") 
  562. 			debug_print("vint", " description str: " .. var_to_string(param5)  .. "\n") 
  563. 			debug_print("vint", " current amount: " .. var_to_string(param6) .. " target amount: " .. var_to_string(param7) .. " is it money? " .. var_to_string(param8) .. " is it fraud? " .. var_to_string(param9) .. "\n\n") 
  564. 		end 
  565. 						 
  566. 		--Get specific indicator parameters 
  567. 		local x_value	=	param6	--Time: seconds left  
  568. 		local y_value	=	param7	--Is it a positive timer? 
  569. 		local is_cash	=	param8	--Is the indicator cash 
  570. 		local is_fraud	=	param9	--Is the indicator a fraud 
  571.  
  572. 		--Clone the indicator from the mothership 
  573. 		if self.indicators[ind_index] == nil then 
  574. 			self.indicators[ind_index] = {} 
  575. 			self.indicators[ind_index].indicator = Vdo_gsi_xy:clone(self.xy_obj.handle) 
  576. 			self.indicators[ind_index].indicator:create(skin) 
  577. 			self.indicators[ind_index].indicator.parent = self 
  578. 			 
  579. 			--Also clone and set the icon 
  580. 			self.indicators[ind_index].icon = Vdo_base_object:clone(self.icon_obj.handle) 
  581. 		end 
  582. 		if icon_enum == nil or icon_enum == -1 then 
  583. 			self.indicators[ind_index].icon:set_visible(false) 
  584. 		else 
  585. 			local icon_name = GSI_OBJECTIVE_ICONS[icon_enum] 
  586. 			self.indicators[ind_index].icon:set_image(icon_name) 
  587. 			self.indicators[ind_index].icon:set_visible(true) 
  588. 		end 
  589. 		 
  590. 		--Update Indicator 
  591. 		self.indicators[ind_index].indicator:update(visible, skin, label_crc, x_value, y_value, is_cash, is_fraud) 
  592. 	elseif data_type == "meter" then 
  593. 		----------------------------------------------------------------------		 
  594. 		--METER 
  595. 		---------------------------------------------------------------------- 
  596. 		if self.status.debug_mode == true then 
  597. 			debug_print("vint", " meter index: " .. ind_index .. "\n") 
  598. 			debug_print("vint", " visible: " .. var_to_string(visible) .. "\n") 
  599. 			debug_print("vint", " description crc:" .. var_to_string(label_crc) .. "\n") 
  600. 			debug_print("vint", " description: " .. var_to_string(param5) .. "\n") 
  601. 			debug_print("vint", " current amount: " .. var_to_string(param6) .. "\n\n") 
  602. 		end 
  603. 		 
  604. 		--Get specific indicator parameters 
  605. 		local meter_percent	=	param6	--Meter Percentage 
  606. 		local skin = param7					--Skin 
  607. 		local is_flashing = param8			--Is the meter flashing!? oooohhh 
  608. 		 
  609. 		--Override skin if not a mission 
  610. 		if self.status.config_index ~= GSI_CONFIG_MISSION then 
  611. 			skin = self.status.config[ind_index][GSI_CONFIG_SKIN] 
  612. 		end 
  613. 		 
  614. 		--Clone the indicator from the mothership 
  615. 		if self.indicators[ind_index] == nil then 
  616. 			self.indicators[ind_index] = {} 
  617. 			self.indicators[ind_index].indicator = Vdo_gsi_meter:clone(self.meter_obj.handle) 
  618. 			self.indicators[ind_index].indicator:create(skin) 
  619. 			self.indicators[ind_index].indicator:set_parent(self) 
  620. 			 
  621. 			--Also clone and set the icon 
  622. 			self.indicators[ind_index].icon = Vdo_base_object:clone(self.icon_obj.handle) 
  623. 		end 
  624. 		if icon_enum == nil or icon_enum == -1 then 
  625. 			self.indicators[ind_index].icon:set_visible(false) 
  626. 		else 
  627. 			local icon_name = GSI_OBJECTIVE_ICONS[icon_enum] 
  628. 			self.indicators[ind_index].icon:set_image(icon_name) 
  629. 			self.indicators[ind_index].icon:set_visible(true) 
  630. 		end 
  631. 		 
  632. 		--Update Indicator 
  633. 		self.indicators[ind_index].indicator:update(visible, skin, label_crc, meter_percent, is_flashing) 
  634. 	elseif data_type == "cap_meter" then 
  635. 		----------------------------------------------------------------------		 
  636. 		--EXTRACTION CAPTURE METER 
  637. 		---------------------------------------------------------------------- 
  638. 		if self.status.debug_mode == true then 
  639. 			debug_print("vint", " cap meter index: " .. ind_index .. "\n") 
  640. 			debug_print("vint", " visible: " .. var_to_string(visible) .. "\n") 
  641. 			debug_print("vint", " description crc:" .. var_to_string(label_crc) .. "\n") 
  642. 			debug_print("vint", " description: " .. var_to_string(param5) .. "\n") 
  643. 			debug_print("vint", " current amount: " .. var_to_string(param6) .. "\n\n") 
  644. 		end 
  645. 		 
  646. 		--Get specific indicator parameters 
  647. 		local meter_percent	=	param6	--Meter Percentage 
  648. 		local skin = param7					--Skin 
  649. 		local is_flashing = param8			--Is the meter flashing!? oooohhh 
  650. 		 
  651. 		--Override skin if not a mission 
  652. 		-- if self.status.config_index ~= GSI_CONFIG_MISSION then 
  653. 			-- skin = self.status.config[ind_index][GSI_CONFIG_SKIN] 
  654. 		-- end 
  655. 		 
  656. 		local cap_index = ind_index - GSI_CAP_METER 
  657. 		 
  658. 		--Clone the indicator from the mothership 
  659. 		if self.indicators[ind_index] == nil then 
  660. 			self.indicators[ind_index] = {} 
  661. 			self.indicators[ind_index].indicator = Vdo_gsi_capture_meter:clone(self.cap_meter_obj.handle) 
  662. 			self.indicators[ind_index].indicator:create(cap_index) 
  663. 			self.indicators[ind_index].indicator:set_parent(self) 
  664. 			 
  665. 			--Also clone and set the icon 
  666. 			self.indicators[ind_index].icon = Vdo_base_object:clone(self.icon_obj.handle) 
  667. 		end 
  668. 		if icon_enum == nil or icon_enum == -1 then 
  669. 			self.indicators[ind_index].icon:set_visible(false) 
  670. 		else 
  671. 			local icon_name = GSI_OBJECTIVE_ICONS[icon_enum] 
  672. 			self.indicators[ind_index].icon:set_image(icon_name) 
  673. 			self.indicators[ind_index].icon:set_visible(true) 
  674. 		end 
  675. 		 
  676. 		--Update Indicator 
  677. 		self.indicators[ind_index].indicator:update(visible, skin, label_crc, meter_percent, is_flashing) 
  678. 		 
  679. 	--INFORMATION INDICATOR 
  680. 	elseif data_type == "information_indicator" then 
  681. 		----------------------------------------------------------------------		 
  682. 		--INFORMATION INDICATOR 
  683. 		---------------------------------------------------------------------- 
  684. 		if self.status.debug_mode == true then 
  685. 			debug_print("vint", " information_indicator index: " 	.. ind_index .. "\n") 
  686. 			debug_print("vint", " visible: " .. var_to_string(visible) .. "\n") 
  687. 			debug_print("vint", " description crc: " .. var_to_string(label_crc) .. "\n") 
  688. 			debug_print("vint", " description: " .. var_to_string(param5) .. "\n") 
  689. 			debug_print("vint", " information crc: " .. param6 .. "\n") 
  690. 			debug_print("vint", " information: " .. var_to_string(param7) .. "\n\n") 
  691. 		end 
  692.  
  693. 		local info_crc = param6 
  694. 		local info_value = param7 
  695. 		 
  696. 		--Check if indicator has been created 
  697. 		if self.indicators[ind_index] == nil then 
  698. 			--Clone the indicator from the mothership 
  699. 			self.indicators[ind_index] = {} 
  700. 			self.indicators[ind_index].indicator = Vdo_gsi_info:clone(self.info_obj.handle) 
  701. 			self.indicators[ind_index].indicator:create(skin) 
  702. 			self.indicators[ind_index].indicator:set_parent(self) 
  703. 			 
  704. 			--Also clone and set the icon 
  705. 			self.indicators[ind_index].icon = Vdo_base_object:clone(self.icon_obj.handle) 
  706. 		end 
  707. 		if icon_enum == nil or icon_enum == -1 then 
  708. 			self.indicators[ind_index].icon:set_visible(false) 
  709. 		else 
  710. 			local icon_name = GSI_OBJECTIVE_ICONS[icon_enum] 
  711. 			self.indicators[ind_index].icon:set_image(icon_name) 
  712. 			self.indicators[ind_index].icon:set_visible(true) 
  713. 		end 
  714. 		 
  715. 		--Update Indicator 
  716. 		self.indicators[ind_index].indicator:update(visible, skin, label_crc, info_crc, info_value) 
  717. 	elseif data_type == "combo" then 
  718. 		----------------------------------------------------------------------		 
  719. 		--METER 
  720. 		---------------------------------------------------------------------- 
  721. 		if self.status.debug_mode == true then 
  722. 			debug_print("vint", " combo index: " .. ind_index .. "\n") 
  723. 			debug_print("vint", " visible: " .. var_to_string(visible) .. "\n") 
  724. 			debug_print("vint", " description crc: " .. var_to_string(label_crc) .. "\n") 
  725. 			debug_print("vint", " description str: " .. var_to_string(param5)  .. "\n") 
  726. 			debug_print("vint", " combo_value: " .. var_to_string(param6) .. "\n") 
  727. 			debug_print("vint", " Meter_pct: " .. var_to_string(param7) .. "\n\n") 
  728. 			debug_print("vint", " is_flashing: " .. var_to_string(param8) .. "\n\n") 
  729. 		end 
  730. 		 
  731. 		--Get specific indicator parameters 
  732. 		local combo_value	=	param6		--Combo Value 
  733. 		local meter_percent	=	param7	--Meter Percentage 
  734. 		local is_flashing = param8			--Is the meter flashing!? oooohhh 
  735. 		 
  736. 		--Override skin if not a mission 
  737. 		if self.status.config_index ~= GSI_CONFIG_MISSION then 
  738. 			skin = self.status.config[ind_index][GSI_CONFIG_SKIN] 
  739. 		end 
  740. 		 
  741. 		--Clone the indicator from the mothership 
  742. 		if self.indicators[ind_index] == nil then 
  743. 			self.indicators[ind_index] = {} 
  744. 			self.indicators[ind_index].indicator = Vdo_gsi_combo:clone(self.combo_obj.handle) 
  745. 			self.indicators[ind_index].indicator:create(skin) 
  746. 			 
  747. 			--Also clone and set the icon 
  748. 			self.indicators[ind_index].icon = Vdo_base_object:clone(self.icon_obj.handle) 
  749. 		end 
  750. 		if icon_enum == nil or icon_enum == -1 then 
  751. 			self.indicators[ind_index].icon:set_visible(false) 
  752. 		else 
  753. 			local icon_name = GSI_OBJECTIVE_ICONS[icon_enum] 
  754. 			self.indicators[ind_index].icon:set_image(icon_name) 
  755. 			self.indicators[ind_index].icon:set_visible(true) 
  756. 		end 
  757. 		 
  758. 		--Update Indicator 
  759. 		self.indicators[ind_index].indicator:update(visible, skin, label_crc, combo_value, meter_percent, is_flashing) 
  760. 	end	 
  761. end 
  762.  
  763.  
  764. ------------------------------------------------------------------------------- 
  765. --	Resets clears our the old configuration and elements. Then sets up the  
  766. -- new configuration to be populated. 
  767. -- 
  768. -- @param	config_index	index of GSI Configuration 
  769. ------------------------------------------------------------------------------- 
  770. function Vdo_gsi:reset_config(config_index) 
  771.  
  772. 	local config = GSI_CONFIGS[config_index] 
  773.  
  774. 	if config == nil then 
  775. 		debug_print("vint", "Failed to update config. Config index doesn't exist\n") 
  776. 		return false 
  777. 	end 
  778. 	 
  779. 	if config_index ~= GSI_CONFIG_MISSION then 
  780. 		--Standard Configuration	 
  781. 		 
  782. 		--Clear Indicator Objects 
  783. 		for idx, val in pairs(self.indicators) do 
  784. 			val.indicator:object_destroy() 
  785. 			val.icon:object_destroy() 
  786. 		end 
  787. 		 
  788. 		--Clear indicator tables and grid 
  789. 		self.indicators = {} 
  790. 		self.grid = {} 
  791. 		 
  792. 		--Build the new config 
  793. 		for idx, val in pairs(config) do 
  794. 			local row = val[GSI_CONFIG_ROW] 
  795. 			local indicator_index = idx 
  796. 			 
  797. 			--Add item to grid 
  798. 			self:grid_item_add(row, indicator_index) 
  799. 		end 
  800. 	else 
  801. 		--TODO: Mission Configuration 
  802. 		 
  803. 		--Oh shit this is all fucking crazy 
  804. 		local indicator_mess = {}		--Indicator mess will be a table full of indicator indexes and indicator priorities 
  805. 		local indicator_counter = 0 
  806. 		local indicator_priority = 1 
  807. 		 
  808.  
  809. 		--Prioritie defines ( 1 is highest priority and displays first...) 
  810. 		local priority_info 	= 1 
  811. 		local priority_xy 	= 2 
  812. 		local priority_meter = 3 
  813. 		local priority_cap_meter = 4 
  814. 		local priority_combo = 5 
  815. 		local priority_timer = 6 
  816. 		 
  817. 		--OK RIGHT HERE....  
  818. 		 
  819. 		--Store priorities of items into a table... This has to be lined up in order... 
  820. 		for idx, val in pairs(self.indicators) do 
  821. 			--Calculate priority 
  822. 			if idx == GSI_TIMER then 
  823. 				indicator_priority = priority_timer 
  824. 			elseif idx < GSI_METER then 
  825. 				--X of Y... 
  826. 				indicator_priority = priority_xy 
  827. 			elseif idx < GSI_INFO then 
  828. 				--Meter... 
  829. 				indicator_priority = priority_meter 
  830. 			elseif idx < GSI_COMBO then 
  831. 				--info 
  832. 				indicator_priority = priority_info 
  833. 			elseif idx < GSI_CAP_METER then 
  834. 				--Combo 
  835. 				indicator_priority = priority_combo 
  836. 			else 
  837. 				--Cap meter 
  838. 				indicator_priority = priority_cap_meter 
  839. 			end 
  840.  
  841. 			indicator_mess[indicator_counter] = {["index"] = idx,	["priority"] = indicator_priority}  
  842. 			indicator_counter = indicator_counter + 1 
  843. 		end 
  844.  
  845. 		--Assign priorities to the items 
  846. 		local temp_indicator_storage 
  847. 		local flag = false 
  848. 		while flag == false do 
  849. 		 
  850. 			flag = true 
  851. 			 
  852. 			for i = 0, self.status.indicator_count - 2 do 
  853. 				if indicator_mess[i].priority > indicator_mess[i + 1].priority then 
  854. 					--swap indexes if the priority is greater 
  855. 					temp_indicator_storage = table_clone(indicator_mess[i]) 
  856. 					indicator_mess[i] = table_clone(indicator_mess[i + 1]) 
  857. 					indicator_mess[i + 1] = temp_indicator_storage   
  858. 					flag = false 
  859. 					break 
  860. 				end 
  861. 			end 
  862. 		end 
  863. 		 
  864. 		--Add Grid Items 
  865. 		if indicator_counter ~= 0 then 
  866. 			--First Indicator 
  867. 			for i = 0, indicator_counter - 1 do 
  868. 				if i >= 6 then 
  869. 					--no more than two indicators allowd HVS_RCK - I don't know why this was 2. It's now 6. I don't know any reason not to do this. 
  870. 					break 
  871. 				end 
  872. 				if indicator_mess[i].index ~= nil then 
  873. 					self:grid_item_add(i, indicator_mess[i].index) 
  874. 				end 
  875. 			end 
  876. 		end 
  877. 	end 
  878. 	self.status.config_index = config_index 
  879. 	self.status.config = config 
  880. end 
  881.  
  882. function Vdo_gsi:grid_item_add(row, idx) 
  883. 	if self.grid[row] == nil then 
  884. 		self.grid[row] = idx 
  885. 	end 
  886. end 
  887.  
  888. ------------------------------------------------------------------------------- 
  889. -- Opens the GSI, causes the thing to creativly animate in...set_visible. true. 
  890. ------------------------------------------------------------------------------- 
  891. function Vdo_gsi:open() 
  892. 	debug_print("vint", "hud_gsi_open()\n") 
  893. 	self:set_visible(true) 
  894. 	self:blink_queue(true) 
  895. end 
  896.  
  897. ------------------------------------------------------------------------------- 
  898. -- Closes the GSI, rips the heart out bitches. My name is Kano. 
  899. ------------------------------------------------------------------------------- 
  900. function Vdo_gsi:close() 
  901. 	self.status.is_dirty = true 
  902. 	self:set_visible(false) 
  903. 	self.is_active = false 
  904. 	Cur_xy_label_crc = -1 
  905. end 
  906.  
  907. ------------------------------------------------------------------------------- 
  908. -- Show/Hide GSI 
  909. ------------------------------------------------------------------------------- 
  910. function Vdo_gsi:show(visible) 
  911. 	self:set_visible(visible) 
  912. 	self.is_active = true 
  913. end 
  914.  
  915. ------------------------------------------------------------------------------- 
  916. -- Updates the layout of the GSI, Puts the indicators on their assigned lines. 
  917. -- Updates background... 
  918. ------------------------------------------------------------------------------- 
  919. function Vdo_gsi:update_layout() 
  920. 	--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
  921. 		--Debug Start 
  922. 	--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
  923. 	if self.status.debug_mode == true then 
  924. 		debug_print("vint", "Updating Layout. Vdo_gsi:update_layout()\n") 
  925. 	end 
  926. 	--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
  927. 	 
  928. 	--Calculate size of box 
  929. 	local width = 0 
  930. 	local height = 20 
  931. 	local total_width = 0 
  932. 	local width_padding = 5 
  933. 	local scrim_spacing = 4			--spacing between timer and indicator boxes... 
  934. 	local first_ext_padding = 10 
  935. 	local extra_extraction_padding = 5 
  936. 	local skip_indicator_count = 0 
  937. 	local indicator_x_offset = 8.0		--Offset from left side of scrim... 
  938. 	local indicator_y_offset = 18			--Offset from top side of scrim... 
  939. 	local indicator_padding_y = 18 
  940. 	local indicator_height = 23			--Height of indicators.. 
  941. 	local indent = 0 
  942. 	local timer_width = 0 
  943. 	local timer_height = 0 
  944. 	local timer_h = -1 
  945. 	local indicator_count = 0 
  946. 	local indicator_meter_count = 0  
  947. 	local indicator_meters = {} 
  948. 		 
  949. 	local extraction = false 
  950.  
  951. 	for row = 0, 10 do 
  952. 		--Check to see if we have an item in that position in the grid... 
  953. 		if self.grid[row] == nil then 
  954. 			break 
  955. 		end 
  956. 	 
  957. 		local indicator_index = self.grid[row] 
  958. 		local indicator_table = self.indicators[indicator_index] 
  959. 		 
  960. 		if indicator_table == nil then 
  961. 			return 0, 0 
  962. 		end 
  963. 		 
  964. 		local indicator_obj = indicator_table.indicator 
  965. 		local icon_obj = indicator_table.icon 
  966. 		 
  967. 		--Since items can be hidden we need to be able to skip stuff for layouts 
  968. 		if indicator_obj.visible == false then 
  969. 			--Skipping this indicator because it is not visible or is a timer... 
  970. 			skip_indicator_count = skip_indicator_count + 1 
  971. 		elseif indicator_index == GSI_TIMER then  
  972. 			--Skipping this indicator because it is a timer... but we need to set its visibility to true... 
  973. 			indicator_obj:set_visible(true) 
  974. 			timer_width, timer_height = indicator_obj:get_size() 
  975. 			timer_h = indicator_obj.handle		--Store handle to timer for layout... 
  976. 			skip_indicator_count = skip_indicator_count + 1 
  977. 		else  
  978. 			--Do processing for layout 
  979. 			local y = (row - skip_indicator_count) * indicator_height + indicator_y_offset 
  980. 			 
  981. 			if icon_obj:get_visible() then 
  982. 				--indent indicator if icon is visible 
  983. 				indent = 30 
  984. 			end 
  985. 			 
  986. 			icon_obj:set_anchor(indicator_x_offset, y -1) 
  987. 			 
  988. 			--Get width for scrim 
  989. 			local width_test, height_test = indicator_obj:get_size() 
  990. 			width = max(width_test, width) 
  991. 			 
  992. 			--check to see if it is a meter if there is more than two of these we will align their parts... 
  993. 			if indicator_index >= GSI_METER and indicator_index < GSI_INFO then 
  994. 				--Increment meter count.. 
  995. 				indicator_meter_count = indicator_meter_count + 1 
  996. 				 
  997. 				-- Add meter to our indicator meter object... 
  998. 				indicator_meters[indicator_meter_count] = indicator_obj 
  999. 			end 
  1000. 			if indicator_index >= GSI_CAP_METER then 
  1001. 				--Increment meter count.. 
  1002. 				indicator_meter_count = indicator_meter_count + 1 
  1003. 				 
  1004. 				-- Add meter to our indicator meter object... 
  1005. 				indicator_meters[indicator_meter_count] = indicator_obj 
  1006. 				 
  1007. 				extraction = true 
  1008. 			end 
  1009. 			 
  1010. 			-- If extraction is true, then we've already passed the text indicator and don't have to worry about it. This is to keep the spacing between each ext meter the way art would like it to be. 
  1011. 			if extraction == true then			 
  1012. 				--Offset indicator by half of the indent amount... (because the icon is centered) 
  1013. 				if row == 1 then 
  1014. 					indicator_obj:set_anchor(indicator_x_offset + indent, y+first_ext_padding) 
  1015. 				else 
  1016. 					indicator_obj:set_anchor(indicator_x_offset + indent, y+first_ext_padding+(extra_extraction_padding*(row-1))) 
  1017. 				end 
  1018. 			else 
  1019. 				--Offset indicator by half of the indent amount... (because the icon is centered) 
  1020. 				indicator_obj:set_anchor(indicator_x_offset + indent, y) 
  1021. 			end 
  1022. 			 
  1023. 			--Calculate height for scrim 
  1024. 			height = y 
  1025. 			indicator_count = indicator_count + 1 
  1026. 		end 
  1027. 	end 
  1028. 	 
  1029. 	if extraction == true then 
  1030. 		height = indicator_y_offset 
  1031. 	end 
  1032. 	 
  1033. 	--Align meters... 
  1034. 	if indicator_meter_count > 1 then 
  1035. 		local max_meter_text_width = 0 
  1036. 		local meter_text_width = 0  
  1037. 		for i = 1, indicator_meter_count do 
  1038. 			meter_text_width = indicator_meters[i]:get_label_width() 
  1039. 			max_meter_text_width = max(max_meter_text_width, meter_text_width) 
  1040. 		end 
  1041. 		for i = 1, indicator_meter_count do  
  1042. 			indicator_meters[i]:set_meter_position(max_meter_text_width) 
  1043. 		end 
  1044. 	end 
  1045. 	 
  1046. 	--Position indicator groups... 
  1047. 	local indicators_h = vint_object_find("indicators", self.handle) 
  1048. 	local x, y = vint_get_property(indicators_h, "anchor") 
  1049. 	if timer_width == 0 then 
  1050. 		--No indicator so align box all the way to left... 
  1051. 		x = 0 
  1052. 	else 
  1053. 		--Align box next to timer.. 
  1054. 		x = timer_width + scrim_spacing 
  1055. 	end 
  1056.  
  1057. 	vint_set_property(indicators_h, "anchor", x, y) 
  1058. 	 
  1059. 	--Set Size of right scrim 
  1060. 	local scrim_width = timer_width  
  1061. 	local scrim_height = timer_height 
  1062. 	local timer_bg_width 	= timer_width 
  1063. 	local timer_bg_height 	= height + indicator_padding_y 
  1064. 	 
  1065. 	-- Right background... 
  1066. 	local scrim_h = vint_object_find("bg_indicators", self.handle) 
  1067. 	if indicator_count > 0 then 
  1068. 		width =  width + indent + width_padding 
  1069. 		element_set_actual_size(scrim_h, width, timer_bg_height) 
  1070. 		vint_set_property(scrim_h, "anchor", x, y)		--Move scrim to match indicator background. 
  1071. 		vint_set_property(scrim_h, "visible", true) 
  1072. 		total_width = width + x 
  1073. 	else 
  1074. 		vint_set_property(scrim_h, "visible", false) 
  1075. 		total_width = timer_bg_width 
  1076. 	end 
  1077. 	 
  1078. 	-- Timer background... 
  1079. 	local scrim_h = vint_object_find("bg_timer", self.handle) 
  1080. 	element_set_actual_size(scrim_h, timer_bg_width, timer_bg_height) 
  1081.  
  1082. 	-- Position timer so it is inline with the scrim... 
  1083. 	local vertical_center = timer_bg_height/2 
  1084. 	vint_set_property(timer_h, "anchor", 0, vertical_center) 
  1085.  
  1086. 	-- Objects themselves are no longer dirty... 
  1087. 	for i, val in pairs(self.indicators) do 
  1088. 		val.indicator.is_dirty = false 
  1089. 	end 
  1090. 	 
  1091. 	-- Unhide GSI... 
  1092. 	self:show(true) 
  1093. 	 
  1094. 	-- Frame is now not diry... 
  1095. 	self.is_dirty = false 
  1096. 	self.width, self.height = width, timer_bg_height 
  1097. 	self.blink_width = width + timer_bg_width 
  1098. 	return width, height 
  1099. end 
  1100.  
  1101. function Vdo_gsi:is_active_set(is_active) 
  1102. 	self.is_active = is_active 
  1103. end 
  1104.  
  1105.  
  1106. function Vdo_gsi:is_active_get() 
  1107. 	return self.is_active 
  1108. end 
  1109.  
  1110. function Vdo_gsi:get_size() 
  1111. 	return self.width, self.height 
  1112. end 
  1113.  
  1114. --[[ 
  1115. ######################################################################### 
  1116. TEST FUNCTIONS 
  1117. ######################################################################### 
  1118. ]] 
  1119.  
  1120. --Used to show the bounding box of an object. (NOTE: Does not work for offsets that are not 0,0) 
  1121. Bounds_util_data = {} 
  1122. function element_bounds_debug(element_handle) 
  1123. 	local h 
  1124. 	if Bounds_util_data[element_handle] == nil then 
  1125. 		h = vint_object_create("bounds_util", "bitmap", element_handle) 
  1126. 		vint_set_property(h, "image", "ui_blank") 
  1127. 		vint_set_property(h, "tint", rand_float(.3,1),rand_float(.3,1),rand_float(.3,1)) 
  1128. 		vint_set_property(h, "alpha", .5) 
  1129. 		vint_set_property(h, "depth", -5000) 
  1130. 		Bounds_util_data[element_handle] = h 
  1131. 	else 
  1132. 		h = Bounds_util_data[element_handle] 
  1133. 	end 
  1134. 	vint_set_property(h, "anchor", 0,0) 
  1135. 	local element_width, element_height = element_get_actual_size(element_handle) 
  1136. 	element_set_actual_size(h, element_width, element_height) 
  1137. end 
  1138.  
  1139. function element_bounds_debug_clear() 
  1140. 	for key, val in pairs(Bounds_util_data) do 
  1141. 		vint_object_destroy(val) 
  1142. 	end 
  1143. end 
  1144.  
  1145. --Starts the gsi in the upper-center of screen and blinks on new objective 
  1146. function Vdo_gsi:blink() 
  1147. 	 
  1148. 	if self.gsi_blink_is_active == false and Hud_gsi_supress_popout ~= true then 
  1149. 	 
  1150. 		--Center it 
  1151. 		local move_grp_h = vint_object_find("move_grp", self.handle) 
  1152. 		local move_twn_1_h = vint_object_find("move_twn_1", self.gsi_move_anim_h) 
  1153. 		 
  1154. 		local total_size_x, total_size_y = self.blink_width * 1.5, self.height * 1.5 
  1155. 		local position_x, position_y 
  1156. 		 
  1157. 		local parent_x, parent_y = vint_get_property(self.handle, "anchor") 
  1158. 		 
  1159. 		if vint_is_std_res() then 
  1160. 			position_x = (320 * 1.5) - (total_size_x * .5) - (parent_x * 1.5) 
  1161. 			position_y = (190) - (parent_y * 1.5) 
  1162. 		else 
  1163. 			position_x = 640 - (total_size_x * .5) - parent_x 
  1164. 			position_y = 190 - parent_y 
  1165. 		end 
  1166. 		 
  1167. 		vint_set_property(move_twn_1_h, "start_value", position_x, position_y) 
  1168. 		vint_set_property(move_twn_1_h, "end_value", position_x, position_y) 
  1169. 		vint_set_property(self.move_twn_2_h, "start_value", position_x, position_y) 
  1170. 		 
  1171. 		if Hud_super_reward.is_active == true and Hud_collection_is_active == true then 
  1172. 			--do nothing if both banners are up 
  1173. 		else 
  1174. 			--otherwise it will show up below the banner 
  1175. 			lua_play_anim(self.gsi_move_anim_h) 
  1176. 			self.gsi_blink_is_active = true 
  1177. 		end 
  1178. 		ui_audio_post_event("ui_hud_generic_div_complete") 
  1179. 	end 
  1180. 	 
  1181. 	self.blink_ready = false 
  1182. end 
  1183.  
  1184. ------------------------------------------------------------------------------- 
  1185. -- Toggles gsi is ready to blink on end of update... 
  1186. -- 
  1187. function Vdo_gsi:blink_queue(set_active) 
  1188. 	self.blink_ready = set_active 
  1189. end 
  1190.  
  1191. function Vdo_gsi:blink_complete() 
  1192. 	self.gsi_blink_is_active = false 
  1193. end