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