./hud_collection.lua

  1. local	HUD_COLLECTION_FLASHPOINT				= 0 
  2. local	HUD_COLLECTION_HOTSPOT					= 1 
  3. local	HUD_COLLECTION_ALTER					= 2 
  4. local	HUD_COLLECTION_COMMENTARY				= 3 
  5. local	HUD_COLLECTION_EXTRACTION				= 4 
  6. local	HUD_COLLECTION_COLLECTIBLE_GENERIC		= 5 
  7. local	HUD_COLLECTION_HITMAN					= 6 
  8. local	HUD_COLLECTION_CHOP_SHOP				= 7 
  9. local	HUD_COLLECTION_REVENGE					= 8 
  10. local	HUD_COLLECTION_STUNT_JUMP				= 9 
  11. local	HUD_COLLECTION_BARNSTORMING				= 10 
  12. local	HUD_COLLECTION_SURVIVAL					= 11 
  13. local	HUD_COLLECTION_SECRET					= 12 
  14. local	HUD_COLLECTION_STAG						= 13 
  15. local HUD_COLLECTION_COLLECTIBLE_ORB			= 14 
  16. local HUD_COLLECTION_ACTIVITY_TIER_BRONZE		= 15 
  17. local HUD_COLLECTION_ACTIVITY_TIER_SILVER		= 16 
  18. local HUD_COLLECTION_ACTIVITY_TIER_GOLD			= 17 
  19. local HUD_COLLECTION_UNLOCKABLE					= 18 
  20. local HUD_COLLECTION_MISC_OBJECTIVE				= 19 
  21. local HUD_COLLECTION_QUEST						= 20 
  22. local HUD_COLLECTION_SILVERLINK					= 21 
  23. local HUD_COLLECTION_SEVEN_DEADLY_SINS			= 22 
  24. local	STATS_INVALID 		= -1 
  25.  
  26. local	DT_NONE				= -1 
  27. local	DT_CHOP_SHOP		= 1 
  28. local	DT_BARNSTORMING		= 4 
  29. local	DT_EXPLORATION		= 3 
  30. local	DT_FLASHPOINT		= 7 
  31. local	DT_HOTSPOT			= 8 
  32. local	DT_EXTRACTION		= 9 
  33. local	DT_HITMAN			= 13 
  34. local	DT_SURVIVAL			= 19 
  35. local	DT_REVENGE			= 16 
  36. local	DT_ALTAR			= 4 
  37. local   DT_COMMENTARY		= 5 
  38.  
  39. local Hud_collection_types = { 
  40. 	[HUD_COLLECTION_FLASHPOINT] =		{ 
  41. 		audio = "ui_hud_gang_flash_complete", 
  42. 		d_type = DT_FLASHPOINT, 
  43. 	}, 
  44. 	[HUD_COLLECTION_HOTSPOT] =		{ 
  45. 		audio = "ui_hud_generic_div_complete", 
  46. 		d_type = DT_HOTSPOT, 
  47. 	}, 
  48. 	[HUD_COLLECTION_ALTER] =		{ 
  49. 		audio = "ui_hud_generic_div_complete", 
  50. 		d_type = DT_ALTAR, 
  51. 	}, 
  52. 	[HUD_COLLECTION_COMMENTARY] =		{ 
  53. 		audio = "ui_hud_generic_div_complete", 
  54. 		d_type = DT_COMMENTARY, 
  55. 	}, 
  56. 	[HUD_COLLECTION_EXTRACTION] =		{ 
  57. 		audio = "ui_hud_generic_div_complete", 
  58. 		d_type = DT_EXTRACTION, 
  59. 	}, 
  60. 	[HUD_COLLECTION_COLLECTIBLE_GENERIC] =	{ 
  61. 		audio = "ui_hud_generic_div_complete", 
  62. 		d_type = DT_NONE, 
  63. 	}, 
  64. 	[HUD_COLLECTION_HITMAN] =		{ 
  65. 		audio = "ui_hud_hitman_complete", 
  66. 		d_type = DT_HITMAN, 
  67. 	}, 
  68. 	[HUD_COLLECTION_CHOP_SHOP] =		{ 
  69. 		audio = "ui_hud_chop_shop_complete", 
  70. 		d_type = DT_CHOP_SHOP, 
  71. 	}, 
  72. 	[HUD_COLLECTION_REVENGE] =		{ 
  73. 		audio = "ui_hud_revenge_complete", 
  74. 		d_type = DT_REVENGE, 
  75. 	}, 
  76. 	[HUD_COLLECTION_STUNT_JUMP] =		{ 
  77. 		d_type = DT_NONE, 
  78. 	}, 
  79. 	[HUD_COLLECTION_BARNSTORMING] =		{ 
  80. 		d_type = DT_BARNSTORMING, 
  81. 	}, 
  82. 	[HUD_COLLECTION_SURVIVAL] =		{ 
  83. 		audio = "ui_hud_survival_complete", 
  84. 		d_type = DT_SURVIVAL, 
  85. 	}, 
  86. 	[HUD_COLLECTION_SECRET] =		{ 
  87. 		d_type = DT_EXPLORATION, 
  88. 	}, 
  89. 	[HUD_COLLECTION_STAG] =		{ 
  90. 		audio = "ui_hud_generic_div_complete", 
  91. 		d_type = DT_NONE, 
  92. 	}, 
  93. 	[HUD_COLLECTION_COLLECTIBLE_ORB] =		{ 
  94. 		audio = "ui_hud_generic_div_complete", 
  95. 		d_type = DT_NONE, 
  96. 	}, 
  97. 	[HUD_COLLECTION_ACTIVITY_TIER_BRONZE] =		{ 
  98. 		audio = "UI_Activity_Complete_Bronze", 
  99. 		d_type = DT_NONE, 
  100. 	},	 
  101. 	[HUD_COLLECTION_ACTIVITY_TIER_SILVER] =		{ 
  102. 		audio = "UI_Activity_Complete_Silver", 
  103. 		d_type = DT_NONE, 
  104. 	},	 
  105. 	[HUD_COLLECTION_ACTIVITY_TIER_GOLD] =		{ 
  106. 		audio = "UI_Activity_Complete_Gold", 
  107. 		d_type = DT_NONE, 
  108. 	},		 
  109. 	[HUD_COLLECTION_UNLOCKABLE] =		{ 
  110. 		audio = "ui_hud_generic_div_complete", 
  111. 		d_type = DT_NONE, 
  112. 	},		 
  113. 	[HUD_COLLECTION_MISC_OBJECTIVE] =		{ 
  114. 		audio = "ui_hud_generic_div_complete", 
  115. 		d_type = DT_NONE, 
  116. 	},		 
  117. 	[HUD_COLLECTION_QUEST] =		{ 
  118. 		audio = "ui_hud_generic_div_complete", 
  119. 		d_type = DT_NONE, 
  120. 	},		 
  121. 	[HUD_COLLECTION_SILVERLINK] =		{ 
  122. 		audio = "ui_hud_generic_div_complete", 
  123. 		d_type = DT_NONE, 
  124. 	}, 
  125. 	[HUD_COLLECTION_SEVEN_DEADLY_SINS] =		{ 
  126. 		audio = "ui_hud_generic_div_complete", 
  127. 		d_type = DT_NONE, 
  128. 	},		 
  129. } 
  130.  
  131. local Hud_collection_anims = {} 
  132. local Hud_collection_data = {} 
  133. Hud_collection_is_active = false 
  134. local Current_collection_index = 0 
  135. local Num_collection_data = 0 
  136. local Queued_collection_data = { } 
  137.  
  138. local Hud_collection_control_meter 				= 0		--Control meter object... 
  139. local Hud_collection_respect_meter 				= 0		--Respect meter object... 
  140. local Hud_collection_cash_h 					 	= 0		--Cash Display... 
  141. local Hud_collection_bonus_grp_h					= 0		--Bonus Display... 
  142. local Hud_collection_bonus_txt_h					= 0		--Bonus text... 
  143. local Hud_collection_bonus_bmp_h					= 0		--Bonus bitmap 
  144.  
  145. local Collection_title_grp_h 
  146. local Title_x, Title_y 
  147.  
  148. local HUD_COLLECTION_ICON_WIDTH 			= 64 
  149. local HUD_COLLECTION_CONTROL_WIDTH		= 84 
  150. local HUD_COLLECTION_RESPECT_WIDTH 		= 84 
  151. local HUD_COLLECTION_BONUS_WIDTH			= 80 
  152. local HUD_COLLECTION_MAX_WIDTH 			= 818 
  153. local HUD_COLLECTION_HEADER_MAX_WIDTH 	= 495 
  154. local HUD_COLLECTION_ICON_DEFAULT_X		= 27 
  155. local HUD_COLLECTION_ICON_DEFAULT_Y		= 109 
  156. local HUD_COLLECTION_TITLE_DEFAULT_X	= 63 
  157. local HUD_COLLECTION_TITLE_DEFAULT_Y	= 100 
  158. local HUD_COLLECTION_ICON_TIER_X			= 50 
  159. local HUD_COLLECTION_TITLE_TIER_X		= 120 
  160. local HUD_COLLECTION_TIER_WIDTH			= 405 
  161.  
  162. ------------------------------------------------------------------------------- 
  163. -- This is included with hud.vint_doc 
  164. ------------------------------------------------------------------------------- 
  165. function hud_collection_init() 
  166. 	vint_dataitem_add_subscription("game_paused_item", "update", "hud_collection_game_is_paused")	--to check if game is paused... 
  167. 	 
  168. 	local h = vint_object_find("collection_grp") 
  169. 	vint_set_property(h, "visible", false) 
  170. 	 
  171. 	--Animations stored to globals 
  172. 	Hud_collection_anims.in_anim_h 				= vint_object_find("collection_in_anim") 
  173. 	Hud_collection_anims.in_deadly_h			= vint_object_find("collection_in_deadly") 
  174. 	Hud_collection_anims.district_anim_h		= vint_object_find("collection_district_anim") 
  175. 	Hud_collection_anims.respect_anim_h 		= vint_object_find("collection_respect_anim") 
  176. 	Hud_collection_anims.bonus_anim_h 			= vint_object_find("collection_bonus_anim") 
  177. 	Hud_collection_anims.cash_anim_h 			= vint_object_find("collection_cash_anim") 
  178. 	Hud_collection_anims.complete_anim_h		= vint_object_find("collection_complete_anim") 
  179. 	Hud_collection_anims.complete_deadly_h		= vint_object_find("collection_complete_deadly") 
  180. 	 
  181. 	-- Setup callbacks to tweens.... 
  182. 	local control_twn_h = vint_object_find("collection_control_twn") 
  183. 	local respect_twn_h = vint_object_find("collection_respect_twn") 
  184. 	local cash_twn_h = vint_object_find("collection_cash_twn") 
  185. 	local collection_start_fade_out_twn_h = vint_object_find("cbg_start_event_twn") 
  186. 	local collection_end_fade_out_twn_h = vint_object_find("cbg_end_event_twn") 
  187. 	local collection_meter_in_twn_h = vint_object_find("collection_meter_in_twn") 
  188. 	 
  189. 	vint_set_property(control_twn_h, "end_event", "hud_collection_start_control") 
  190. 	vint_set_property(respect_twn_h, "start_event", "hud_collection_show_respect") 
  191. 	vint_set_property(respect_twn_h, "end_event", "hud_collection_start_respect") 
  192. 	vint_set_property(cash_twn_h, "start_event", "hud_collection_start_cash") 
  193. 	vint_set_property(collection_start_fade_out_twn_h, "start_event", "hud_collection_audio_out")		--audio play out... 
  194. 	vint_set_property(collection_end_fade_out_twn_h, "end_event", "hud_collection_finished") 
  195. 	vint_set_property(collection_meter_in_twn_h, "end_event", "hud_collection_animate_meter") 
  196.  
  197. 	--Initialize control meter. 
  198. 	Hud_collection_control_meter = Vdo_city_control:new("collection_control_meter") 
  199. 	 
  200. 	--Initialize respect meter. 
  201. 	Hud_collection_respect_meter = Vdo_city_control:new("collection_respect_meter") 
  202. 	Hud_collection_respect_meter:change_to_respect() 
  203.  
  204. 	Hud_collection_cash_h = vint_object_find("collection_cash_txt") 
  205. 	 
  206. 	Hud_collection_bonus_grp_h = vint_object_find("collection_bonus_group") 
  207. 	Hud_collection_bonus_txt_h = vint_object_find("collection_bonus_text") 
  208. 	Hud_collection_bonus_bmp_h = vint_object_find("collection_bonus_image") 
  209. 	 
  210. 	Collection_title_grp_h = vint_object_find("collection_title_grp") 
  211. 	Title_x, Title_y = vint_get_property(Collection_title_grp_h, "anchor") 
  212. end 
  213.  
  214. ------------------------------------------------------------- 
  215. -- Fills in the data object for populating the screen... 
  216. ------------------------------------------------------------- 
  217. --		VINT_PROP_TYPE_INT,           // Collection type 
  218. --		VINT_PROP_TYPE_UINT,          // Title of the Collection message ("Gang Operation", "Hitman", "Chopshop")  
  219. --		VINT_PROP_TYPE_UINT,          // Subtitle (Destroyed, Completed, Found) 
  220. --		VINT_PROP_TYPE_INT,           // How many items the player has left in district or game 
  221. --		VINT_PROP_TYPE_INT,           // Total items in district or game 
  222. --		 
  223. --		// if the following are nil then we omit their display... 
  224. --		VINT_PROP_TYPE_FLOAT,         // Cash Reward 
  225. --		VINT_PROP_TYPE_INT,           // Respect Reward  
  226. --		VINT_PROP_TYPE_INT,           // Respect Bonus - for display purposes only - do not send back to game_award_respect  
  227. --		VINT_PROP_TYPE_FLOAT,  		 	// District percentage before... 
  228. --		VINT_PROP_TYPE_FLOAT,   		// District percentage after... 
  229. --		VINT_PROP_TYPE_STRING,  		// DISTRICT name 
  230. --		VINT_PROP_TYPE_BOOL,				// Whether the rewards should be saved on mission failure/restart 
  231. --		VINT_PROP_TYPE_BOOL,				// whether to award cash / respect 
  232.  
  233. function hud_collection_update(collection_type, title, sub_title, items_left, items_total, cash_reward, respect_reward, respect_bonus, district_pct_old, district_pct_new, district_name, save_in_mission, no_reward, bonus_reward, bonus_text, bonus_image) 
  234. 	--determine what kind of collection type we are and do some shit based on that... 
  235. 	local collection_type = collection_type 
  236.  
  237. 	if title == 0 then 
  238. 		--No data... Abort Collection screen. 
  239. 		return 
  240. 	end 
  241. 	local gained_pct = district_pct_new - district_pct_old	 
  242.  
  243. 	--Queue up any data into memory... 
  244. 	Queued_collection_data[Num_collection_data] = { 
  245. 		collection_type = collection_type, 
  246. 		title = title,  
  247. 		sub_title = sub_title,  
  248. 		items_left = items_left,  
  249. 		items_total = items_total,  
  250. 		cash_reward = cash_reward,  
  251. 		respect_reward = respect_reward,  
  252. 		respect_bonus = respect_bonus, 
  253. 		district_pct_old = district_pct_old,  
  254. 		district_pct_new = district_pct_new,  
  255. 		district_name = district_name, 
  256. 		save_in_mission = save_in_mission, 
  257. 		no_reward = no_reward, 
  258. 		bonus_reward = bonus_reward, --number, send 0 or nil for no reward 
  259. 		bonus_text = bonus_text, --text to display of bonus amount, x5 or +2 
  260. 		bonus_image = bonus_image, -- image to display either a homie head or the fluer 
  261. 	} 
  262. 	 
  263. 	Num_collection_data = Num_collection_data + 1 
  264. 	 
  265. 	 
  266. 	if Num_collection_data == 1 then 
  267. 		hud_collection_start() 
  268. 	end 
  269. 	 
  270. 	-- skip the current orb banner if this is an orb banner 
  271. 	if collection_type == HUD_COLLECTION_COLLECTIBLE_ORB then 
  272. 		local current_displayed = Queued_collection_data[ Current_collection_index ] 
  273. 		if current_displayed ~= nil and current_displayed.collection_type == HUD_COLLECTION_COLLECTIBLE_ORB then 
  274. 			hud_collection_finished() 
  275. 			return 
  276. 		end 
  277. 	end 
  278. end 
  279.  
  280.  
  281. function hud_collection_start() 
  282. 	Hud_collection_is_active = true 
  283. 	Hud_collection_data = Queued_collection_data[Current_collection_index] 
  284. 	Current_collection_index = Current_collection_index + 1 
  285. 	 
  286. 	--Determine what rewards to display... 
  287. 	Hud_collection_data.has_district 	= true 
  288. 	Hud_collection_data.has_respect	 	= true 
  289. 	Hud_collection_data.has_cash			= true 
  290. 	Hud_collection_data.has_bonus			= true 
  291. 	 
  292. 	if Hud_collection_data.district_pct_old == Hud_collection_data.district_pct_new then 
  293. 		--No district 
  294. 		Hud_collection_data.has_district = false 
  295. 	end 
  296. 	 
  297. 	if Hud_collection_data.respect_reward == 0 then 
  298. 		--No cash reward... 
  299. 		Hud_collection_data.has_respect = false 
  300. 	end 
  301. 	 
  302. 	if Hud_collection_data.cash_reward == 0 then 
  303. 		--No cash reward... 
  304. 		Hud_collection_data.has_cash = false 
  305. 	end 
  306. 	 
  307. 	if Hud_collection_data.bonus_reward == 0 or Hud_collection_data.bonus_reward == nil then 
  308. 		--No bonus reward... 
  309. 		Hud_collection_data.has_bonus = false 
  310. 	end 
  311.  
  312. 	--award the stuff for real... 
  313. 	if Hud_collection_data.has_respect and Hud_collection_data.no_reward ~= true then 
  314. 		game_award_respect(Hud_collection_data.respect_reward, STATS_INVALID, Hud_collection_types[Hud_collection_data.collection_type].d_type, Hud_collection_data.save_in_mission)		 
  315. 	end 
  316. 	if Hud_collection_data.has_cash and Hud_collection_data.no_reward ~= true then 
  317. 		game_award_cash(Hud_collection_data.cash_reward, Hud_collection_types[Hud_collection_data.collection_type].d_type, Hud_collection_data.save_in_mission)			 
  318. 	end 
  319.  
  320. 	 
  321. 	--All reward elements start out hidden... 
  322. 	Hud_collection_control_meter:set_alpha( 0 ) 
  323. 	Hud_collection_respect_meter:set_alpha( 0 ) 
  324. 	vint_set_property( Hud_collection_cash_h, "alpha", 0 ) 
  325. 	vint_set_property( Hud_collection_bonus_grp_h, "alpha", 0 ) 
  326.  
  327. 	--pause any animations that might be playing from the last collection 
  328. 	vint_set_property(Hud_collection_anims.district_anim_h, "is_paused", true) 
  329. 	vint_set_property(Hud_collection_anims.respect_anim_h, "is_paused", true) 
  330. 	vint_set_property(Hud_collection_anims.bonus_anim_h, "is_paused", true) 
  331. 	vint_set_property(Hud_collection_anims.cash_anim_h, "is_paused", true) 
  332. 	 
  333. 	--set the icon 
  334. 	local collect_icon_h = vint_object_find( "collect_icon" ) 
  335. 	if Hud_collection_data.collection_type == HUD_COLLECTION_COLLECTIBLE_ORB then 
  336. 		vint_set_property( collect_icon_h, "image", "ui_hud_unlock_orb" ) 
  337. 	elseif Hud_collection_data.collection_type == HUD_COLLECTION_SILVERLINK then 
  338. 		vint_set_property( collect_icon_h, "image", "ui_mainmenu_silverlink" ) 
  339. 	elseif Hud_collection_data.collection_type == HUD_COLLECTION_COMMENTARY and Hud_collection_data.bonus_image ~= "" and Hud_collection_data.bonus_image ~= nil then 
  340. 		vint_set_property( collect_icon_h, "image", Hud_collection_data.bonus_image) 
  341. 	else 
  342. 		vint_set_property( collect_icon_h, "image", "ui_hud_collect_saints" ) 
  343. 	end 
  344. 	 
  345. 	--Initialize Control meter... 
  346. 	Hud_collection_control_meter:update(Hud_collection_data.district_pct_old, false) 
  347. 	 
  348. 	--Do update of text items... 
  349. 	local header_txt_h = vint_object_find( "collection_header_txt" ) 
  350. 	local insert_values = { [0] = Hud_collection_data.title, [1] = Hud_collection_data.items_left, [2] = Hud_collection_data.items_total} 
  351. 	 
  352. 	local text_string 
  353. 	if Hud_collection_data.collection_type == HUD_COLLECTION_STAG then 
  354. 		text_string = Hud_collection_data.title		 
  355. 	elseif Hud_collection_data.collection_type == HUD_COLLECTION_REVENGE then	 
  356. 		if Hud_collection_data.items_total <= 0 then 
  357. 			text_string = vint_insert_values_in_string("{0} {1}", insert_values) 
  358. 		else 
  359. 			text_string = vint_insert_values_in_string("{0} {1}/{2}", insert_values) 
  360. 		end 
  361. 	elseif Hud_collection_data.items_total <= 0 then 
  362. 		text_string = Hud_collection_data.title 
  363. 	elseif Hud_collection_data.collection_type == HUD_COLLECTION_COLLECTIBLE_ORB then	 
  364. 		text_string = Hud_collection_data.title 
  365. 	elseif Hud_collection_data.collection_type == HUD_COLLECTION_HITMAN then 
  366. 		text_string = Hud_collection_data.title 
  367. 	elseif Hud_collection_data.collection_type == HUD_COLLECTION_CHOP_SHOP then 
  368. 		text_string = Hud_collection_data.title 
  369. 	else 
  370. 		text_string = vint_insert_values_in_string("{0} {1}/{2}", insert_values) 
  371. 	end 
  372. 	 
  373. 	vint_set_property(header_txt_h, "text_tag", text_string) 
  374. 	 
  375. 	local sub_txt_h = vint_object_find( "collection_sub_txt" ) 
  376. 	vint_set_property(sub_txt_h, "text_tag", Hud_collection_data.sub_title) 
  377. 	vint_set_property( sub_txt_h, "visible", true ) 
  378. 	 
  379. 	--center large text vertically in no small text 
  380. 	if text_string == "" or text_string == nil then 
  381. 		vint_set_property( sub_txt_h, "anchor", 0, -6) 
  382. 	else 
  383. 		vint_set_property( sub_txt_h, "anchor", 0, 6) 
  384. 	end 
  385.  
  386. 	--Set cash total... 
  387. 	vint_set_property(Hud_collection_cash_h, "text_tag", "{GAME_CASH}" .. format_cash(Hud_collection_data.cash_reward)) 
  388. 	 
  389. 	--set the bonus group 
  390. 	vint_set_property(Hud_collection_bonus_txt_h, "text_tag", Hud_collection_data.bonus_text) 
  391. 	vint_set_property(Hud_collection_bonus_bmp_h, "image", Hud_collection_data.bonus_image) 
  392. 	 
  393. 	--calculate widths of headers and cash 
  394. 	local header_width, header_height = element_get_actual_size( header_txt_h ) 
  395. 	local header_sub_width, header_sub_height = element_get_actual_size( sub_txt_h ) 
  396. 	 
  397. 	--set up collection meter 
  398. 	local meter_grp_h = vint_object_find( "collection_meter_grp" ) 
  399. 	local meter_h = vint_object_find( "collection_meter" )  
  400. 	local meter_twn_h = vint_object_find( "collection_meter_twn" ) 
  401. 	local meter_max = 200 
  402. 	vint_set_property( meter_grp_h, "visible", false ) 
  403.  
  404. 	--Need to scale but by how much? 
  405. 	local new_header_width = max( header_width, header_sub_width ) 
  406. 	local scale = 1.0 
  407. 	local max_width = HUD_COLLECTION_HEADER_MAX_WIDTH 
  408. 	 
  409. 	if header_width > header_sub_width then 
  410. 		if header_width > max_width then 
  411. 			scale = max_width / header_width 
  412. 			new_header_width = header_width * scale 
  413. 		end 
  414. 	else 
  415. 		if header_sub_width > max_width then 
  416. 			scale =  max_width / header_sub_width 
  417. 			new_header_width = header_sub_width * scale 
  418. 		end 
  419. 	end 
  420. 	 
  421. 	--Apply scale to whole text group... 
  422. 	vint_set_property(Collection_title_grp_h, "scale", scale, scale) 
  423. 	 
  424. 	local pos_y = 102							--Start position for reward elements... 
  425. 	local start_time = 1.5					--start offset for first reward... 
  426. 	local start_time_spacing = 1.2		--Time between rewards.. 
  427. 	local header_width_min = 0 			-- min size of element 		 
  428. 	local HUD_COLLECTION_TEXT_SPACING = 15 
  429. 	--positions 
  430. 	local x, y = Hud_collection_control_meter:get_anchor() 
  431. 	x = Title_x + new_header_width + HUD_COLLECTION_TEXT_SPACING 
  432. 	 
  433. 	--Positions for elements... 
  434. 	local control_x 	= 0					 
  435. 	local respect_x 	= 0 
  436. 	local bonus_x		= 0 
  437. 	local cash_x 		= 0 
  438. 	 
  439. 	--Start times for elements... 
  440. 	local control_start_time 	= 0 
  441. 	local respect_start_time 	= 0 
  442. 	local bonus_start_time		= 0 
  443. 	local cash_start_time 		= 0  
  444. 	local complete_start_time 	= 0 
  445. 	 
  446. 	local HUD_COLLECTION_ITEM_SPACING = 10 
  447. 	 
  448. 	--Determine what we have and then calculate each item based on that... 
  449. 	if Hud_collection_data.has_district then 
  450. 		local half_width = (HUD_COLLECTION_CONTROL_WIDTH *.5) 
  451. 		control_x = x + half_width 
  452. 		x = x + HUD_COLLECTION_CONTROL_WIDTH + HUD_COLLECTION_ITEM_SPACING 
  453. 		 
  454. 		control_start_time = start_time 
  455. 		start_time =  start_time + start_time_spacing 
  456. 	end 
  457. 	 
  458. 	if Hud_collection_data.has_respect then 
  459. 		local half_width = (HUD_COLLECTION_RESPECT_WIDTH *.5) 
  460. 		respect_x = x + half_width 
  461. 		x = x + HUD_COLLECTION_RESPECT_WIDTH + HUD_COLLECTION_ITEM_SPACING 
  462. 	 
  463. 		respect_start_time = start_time 
  464. 		start_time =  start_time + start_time_spacing 
  465. 	end 
  466. 	 
  467. 	if Hud_collection_data.has_bonus then 
  468. 		local half_width = (HUD_COLLECTION_BONUS_WIDTH *.5) 
  469. 		bonus_x = x + half_width 
  470. 		x = x + HUD_COLLECTION_BONUS_WIDTH + HUD_COLLECTION_ITEM_SPACING 
  471. 		 
  472. 		bonus_start_time = start_time 
  473. 		start_time =  start_time + start_time_spacing 
  474. 	end 
  475. 	 
  476. 	if Hud_collection_data.has_cash then 
  477. 		local cash_width, cash_height = element_get_actual_size(Hud_collection_cash_h) 
  478. 		local half_width = (cash_width *.5) 
  479. 		cash_x = x  + half_width 
  480. 		x = x + cash_width + HUD_COLLECTION_ITEM_SPACING		 
  481. 		 
  482. 		cash_start_time = start_time 
  483. 	end 
  484. 	 
  485. 	--Activity Tier Banners: These require custom spacing 
  486. 	--Tint and reposition the icon and title text group to fit the activity medal images	 
  487. 	 
  488. 	--Items we need to tint 
  489. 	local cbg_right_h = vint_object_find("cbg_right") 
  490. 	local cbg_left_h = vint_object_find("cbg_left") 
  491. 	local collect_icon_glow_h = vint_object_find("collect_icon_glow") 
  492. 	 
  493. 	--Tint everything to default in case we are not bronze, silver, or gold 
  494. 	local bg_tint_r, bg_tint_g, bg_tint_b = COLOR_HUD_COLLECTION_DEFAULT.R, COLOR_HUD_COLLECTION_DEFAULT.G, COLOR_HUD_COLLECTION_DEFAULT.B 
  495. 	local txt_tint_r, txt_tint_g, txt_tint_b = COLOR_HUD_COLLECTION_DEFAULT.R, COLOR_HUD_COLLECTION_DEFAULT.G, COLOR_HUD_COLLECTION_DEFAULT.B 
  496. 		 
  497. 	if Hud_collection_data.collection_type == HUD_COLLECTION_ACTIVITY_TIER_BRONZE then 
  498. 		 
  499. 		--Tint bronze 
  500. 		bg_tint_r, bg_tint_g, bg_tint_b = COLOR_HUD_COLLECTION_BRONZE_BG.R, COLOR_HUD_COLLECTION_BRONZE_BG.G, COLOR_HUD_COLLECTION_BRONZE_BG.B 
  501. 		txt_tint_r, txt_tint_g, txt_tint_b = COLOR_HUD_COLLECTION_BRONZE_TEXT.R, COLOR_HUD_COLLECTION_BRONZE_TEXT.G, COLOR_HUD_COLLECTION_BRONZE_TEXT.B		 
  502. 		 
  503. 		--Change image to bronze medal 
  504. 		vint_set_property(collect_icon_h, "image", "ui_hud_tier_bronze") 
  505. 		 
  506. 	elseif Hud_collection_data.collection_type == HUD_COLLECTION_ACTIVITY_TIER_SILVER then 
  507. 		 
  508. 		--Tint silver 
  509. 		bg_tint_r, bg_tint_g, bg_tint_b = COLOR_HUD_COLLECTION_SILVER_BG.R, COLOR_HUD_COLLECTION_SILVER_BG.G, COLOR_HUD_COLLECTION_SILVER_BG.B 
  510. 		txt_tint_r, txt_tint_g, txt_tint_b = COLOR_HUD_COLLECTION_SILVER_TEXT.R, COLOR_HUD_COLLECTION_SILVER_TEXT.G, COLOR_HUD_COLLECTION_SILVER_TEXT.B 
  511. 		 
  512. 		--Change image to silver medal 
  513. 		vint_set_property(collect_icon_h, "image", "ui_hud_tier_silver") 
  514. 		 
  515. 	elseif Hud_collection_data.collection_type == HUD_COLLECTION_ACTIVITY_TIER_GOLD then 
  516. 		 
  517. 		--Tint gold 
  518. 		bg_tint_r, bg_tint_g, bg_tint_b = COLOR_HUD_COLLECTION_GOLD_BG.R, COLOR_HUD_COLLECTION_GOLD_BG.G, COLOR_HUD_COLLECTION_GOLD_BG.B 
  519. 		txt_tint_r, txt_tint_g, txt_tint_b = COLOR_HUD_COLLECTION_GOLD_BG.R, COLOR_HUD_COLLECTION_GOLD_BG.G, COLOR_HUD_COLLECTION_GOLD_BG.B 
  520. 		 
  521. 		--Change image to gold medal 
  522. 		vint_set_property(collect_icon_h, "image", "ui_hud_tier_gold")		 
  523. 	end 
  524.  
  525. 	local collection_deadly_h = vint_object_find("collection_bg_deadly"); 
  526. 	if Hud_collection_data.collection_type == HUD_COLLECTION_SEVEN_DEADLY_SINS then 
  527. 		vint_set_property(collection_deadly_h, "visible", true) 
  528. 	else  
  529. 		vint_set_property(collection_deadly_h, "visible", false) 
  530. 	end 
  531. 			 
  532. 	--If we are a medal reposition the image and text group 
  533. 	if Hud_collection_data.collection_type == HUD_COLLECTION_ACTIVITY_TIER_BRONZE or Hud_collection_data.collection_type == HUD_COLLECTION_ACTIVITY_TIER_SILVER or Hud_collection_data.collection_type == HUD_COLLECTION_ACTIVITY_TIER_GOLD then 
  534.  
  535. 		--Reposition medal and text 
  536. 		vint_set_property(collect_icon_h, "anchor", HUD_COLLECTION_ICON_TIER_X, HUD_COLLECTION_ICON_DEFAULT_Y)		 
  537. 		vint_set_property(collect_icon_glow_h, "anchor", HUD_COLLECTION_ICON_TIER_X, HUD_COLLECTION_ICON_DEFAULT_Y)		 
  538. 			 
  539. 		--Update anchor twn with new position 
  540. 		local twn_h = vint_object_find("collection_title_anchor_twn") 
  541. 		vint_set_property(twn_h, "end_value", HUD_COLLECTION_TITLE_TIER_X, HUD_COLLECTION_TITLE_DEFAULT_Y)		 
  542. 		 
  543. 		--Set the width of the banner 
  544. 		x = HUD_COLLECTION_TIER_WIDTH 
  545. 	elseif Hud_collection_data.collection_type == HUD_COLLECTION_SILVERLINK then 
  546. 		--Accomodate for larger silverlink logo... add values to the x positions... 
  547. 		vint_set_property(collect_icon_h, "anchor", HUD_COLLECTION_TITLE_DEFAULT_X+5, HUD_COLLECTION_ICON_DEFAULT_Y) 
  548. 		vint_set_property(collect_icon_glow_h, "anchor", HUD_COLLECTION_TITLE_DEFAULT_X+5, HUD_COLLECTION_ICON_DEFAULT_Y) 
  549. 		 
  550. 		local twn_h = vint_object_find("collection_title_anchor_twn") 
  551. 		vint_set_property(twn_h, "end_value", HUD_COLLECTION_TITLE_TIER_X+35, HUD_COLLECTION_TITLE_DEFAULT_Y)	 
  552. 		 
  553. 		--Add 75 Pixels to width width of the banner, this accomodates for larger silverlink logo... 
  554. 		x = x + 75 
  555. 	else 
  556. 	 
  557. 		--Not a medal, set to default positions 
  558. 		vint_set_property(collect_icon_h, "anchor", HUD_COLLECTION_ICON_DEFAULT_X, HUD_COLLECTION_ICON_DEFAULT_Y)		 
  559. 		vint_set_property(collect_icon_glow_h, "anchor", HUD_COLLECTION_ICON_DEFAULT_X, HUD_COLLECTION_ICON_DEFAULT_Y)		 
  560. 		 
  561. 		local twn_h = vint_object_find("collection_title_anchor_twn") 
  562. 		vint_set_property(twn_h, "end_value", HUD_COLLECTION_TITLE_DEFAULT_X, HUD_COLLECTION_TITLE_DEFAULT_Y)		 
  563. 	end	 
  564. 	 
  565. 	--Tint sides, text, and glow image 
  566. 	vint_set_property(cbg_right_h, "tint", bg_tint_r, bg_tint_g, bg_tint_b) 
  567. 	vint_set_property(cbg_left_h, "tint", bg_tint_r, bg_tint_g, bg_tint_b) 
  568. 	vint_set_property(sub_txt_h, "tint", txt_tint_r, txt_tint_g, txt_tint_b) 
  569. 	vint_set_property(collect_icon_glow_h, "tint", bg_tint_r, bg_tint_g, bg_tint_b)	 
  570.  
  571. 	local total_width = x							--total width of the element is x....	 
  572. 	complete_start_time = start_time + 3		--Delay close out animation by 3 seconds... 
  573.  
  574. 	--Set positions... 
  575. 	Hud_collection_control_meter:set_anchor(control_x, y) 
  576. 	Hud_collection_respect_meter:set_anchor(respect_x, y) 
  577. 	vint_set_property(Hud_collection_bonus_grp_h, "anchor", bonus_x, y) 
  578. 	vint_set_property(Hud_collection_cash_h, "anchor", cash_x, y) 
  579. 	 
  580. 	local collection_elements_grp_h = vint_object_find("collection_elements_grp") 
  581. 	local collection_x, collection_y = vint_get_property(collection_elements_grp_h, "anchor") 
  582. 	collection_x = 640 - (total_width * 0.5) 
  583. 	vint_set_property(collection_elements_grp_h, "anchor", collection_x, collection_y) 
  584. 	vint_set_property(collection_elements_grp_h, "alpha", 1.0) 
  585. 	 
  586. 	--Unhide 
  587. 	local h = vint_object_find("collection_grp") 
  588. 	vint_set_property(h, "visible", true) 
  589. 	 
  590. 	--set the background width 
  591. 	local cbg_width = (total_width + 35.0) 
  592. 	local cbg_anchor_y = 51.0 
  593. 	 
  594. 	--set the background animate in end values since the size of the banner is dynamic 
  595. 	local cbg_main_scale_twn_h = vint_object_find("cbg_main_scale_twn") 
  596. 	vint_set_property(cbg_main_scale_twn_h, "end_value", (cbg_width / 16), 6.0) 
  597. 	 
  598. 	local cbg_left_anchor_twn_h = vint_object_find("cbg_left_anchor_twn") 
  599. 	vint_set_property(cbg_left_anchor_twn_h, "end_value", 640 - (cbg_width * 0.5), cbg_anchor_y) 
  600. 	 
  601. 	local cbg_right_anchor_twn_h = vint_object_find("cbg_right_anchor_twn") 
  602. 	vint_set_property(cbg_right_anchor_twn_h, "end_value", 640 + (cbg_width * 0.5), cbg_anchor_y) 
  603.  
  604. 	if Hud_collection_data.collection_type == HUD_COLLECTION_SEVEN_DEADLY_SINS then 
  605. 		 
  606. 		-- left side 
  607. 		local deadly_left_endcap_h = vint_object_find("cap_left_deadly"); 
  608. 		vint_set_property(deadly_left_endcap_h, "alpha", 1) 
  609.  
  610. 		local deadly_left_bar_anchor_twn_h = vint_object_find("deadly_left_anchor_twn") 
  611. 		vint_set_property(deadly_left_bar_anchor_twn_h, "end_value", 640 - (cbg_width * 0.5), cbg_anchor_y) 
  612.  
  613. 		local deadly_left_cap_anchor_twn_h = vint_object_find("cap_left_anchor_twn") 
  614. 		vint_set_property(deadly_left_cap_anchor_twn_h, "end_value", 640 - (cbg_width * 0.5), cbg_anchor_y) 
  615.  
  616. 		local deadly_left_corners_anchor_twn_h = vint_object_find("corner_left_anchor_twn") 
  617. 		vint_set_property(deadly_left_corners_anchor_twn_h, "end_value", 640 - (cbg_width * 0.5), cbg_anchor_y) 
  618.  
  619. 		-- right side 
  620. 		local deadly_right_endcap_h = vint_object_find("cap_right_deadly"); 
  621. 		vint_set_property(deadly_right_endcap_h, "alpha", 1) 
  622.  
  623. 		local deadly_right_bar_anchor_twn_h = vint_object_find("deadly_right_anchor_twn") 
  624. 		vint_set_property(deadly_right_bar_anchor_twn_h, "end_value", 640 + (cbg_width * 0.5), cbg_anchor_y) 
  625.  
  626. 		local deadly_right_cap_anchor_twn_h = vint_object_find("cap_right_anchor_twn") 
  627. 		vint_set_property(deadly_right_cap_anchor_twn_h, "end_value", 640 + (cbg_width * 0.5), cbg_anchor_y) 
  628.  
  629. 		local deadly_right_corners_anchor_twn_h = vint_object_find("corner_right_anchor_twn") 
  630. 		vint_set_property(deadly_right_corners_anchor_twn_h, "end_value", 640 + (cbg_width * 0.5), cbg_anchor_y) 
  631. 		  
  632. 	end 
  633. 	 
  634. 	--set the start values of the animate out to match 
  635. 	cbg_main_scale_twn_h = vint_object_find("cbg_main_scale_out_twn") 
  636. 	vint_set_property(cbg_main_scale_twn_h, "start_value", (cbg_width / 16), 6.0) 
  637. 	 
  638. 	cbg_left_anchor_twn_h = vint_object_find("cbg_left_anchor_out_twn") 
  639. 	vint_set_property(cbg_left_anchor_twn_h, "start_value", 640 - (cbg_width * 0.5), cbg_anchor_y) 
  640. 	 
  641. 	cbg_right_anchor_twn_h = vint_object_find("cbg_right_anchor_out_twn") 
  642. 	vint_set_property(cbg_right_anchor_twn_h, "start_value", 640 + (cbg_width * 0.5), cbg_anchor_y) 
  643.  
  644. 	if Hud_collection_data.collection_type == HUD_COLLECTION_SEVEN_DEADLY_SINS then 
  645. 		 
  646. 		-- left side 
  647. 		local deadly_left_bar_anchor_twn_h = vint_object_find("deadly_left_anchor_out_twn") 
  648. 		vint_set_property(deadly_left_bar_anchor_twn_h, "start_value", 640 - (cbg_width * 0.5), cbg_anchor_y) 
  649.  
  650. 		local deadly_left_cap_anchor_twn_h = vint_object_find("cap_left_anchor_out_twn") 
  651. 		vint_set_property(deadly_left_cap_anchor_twn_h, "start_value", 640 - (cbg_width * 0.5), cbg_anchor_y) 
  652.  
  653. 		local deadly_left_corners_anchor_twn_h = vint_object_find("corner_left_anchor_out_twn") 
  654. 		vint_set_property(deadly_left_corners_anchor_twn_h, "start_value", 640 - (cbg_width * 0.5), cbg_anchor_y) 
  655.  
  656. 		-- right side 
  657. 		local deadly_right_bar_anchor_twn_h = vint_object_find("deadly_right_anchor_out_twn") 
  658. 		vint_set_property(deadly_right_bar_anchor_twn_h, "start_value", 640 + (cbg_width * 0.5), cbg_anchor_y) 
  659.  
  660. 		local deadly_right_cap_anchor_twn_h = vint_object_find("cap_right_anchor_out_twn") 
  661. 		vint_set_property(deadly_right_cap_anchor_twn_h, "start_value", 640 + (cbg_width * 0.5), cbg_anchor_y) 
  662.  
  663. 		local deadly_right_corners_anchor_twn_h = vint_object_find("corner_right_anchor_out_twn") 
  664. 		vint_set_property(deadly_right_corners_anchor_twn_h, "start_value", 640 + (cbg_width * 0.5), cbg_anchor_y) 
  665.  
  666. 	end 
  667.  
  668. 	--Playback animations at different times... 
  669. 	 
  670. 	-- Play back main animation.... 
  671. 	lua_play_anim(Hud_collection_anims.in_anim_h, 0) 
  672. 	vint_apply_start_values( Hud_collection_anims.in_anim_h ) 
  673.  
  674. 	if Hud_collection_data.collection_type == HUD_COLLECTION_SEVEN_DEADLY_SINS then 
  675. 		lua_play_anim(Hud_collection_anims.in_deadly_h, 0) 
  676. 		vint_apply_start_values( Hud_collection_anims.in_deadly_h ) 
  677. 	end 
  678. 	 
  679. 	game_set_refraction_situation("screen_collection") 
  680. 	 
  681. 	ui_audio_post_event("ui_generic_band_anim_in") 
  682. 			 
  683. 	--Play back animations... but only if they are needed... this is to prevent bad callbacks... 
  684. 	if Hud_collection_data.has_district then 
  685. 		lua_play_anim(Hud_collection_anims.district_anim_h, control_start_time) 
  686. 	end 
  687. 	if Hud_collection_data.has_respect then 
  688. 		lua_play_anim(Hud_collection_anims.respect_anim_h, respect_start_time) 
  689. 	end 
  690. 	if Hud_collection_data.has_bonus then 
  691. 		lua_play_anim(Hud_collection_anims.bonus_anim_h, bonus_start_time) 
  692. 	end 
  693. 	if Hud_collection_data.has_cash then 
  694. 		lua_play_anim(Hud_collection_anims.cash_anim_h, cash_start_time) 
  695. 	end 
  696. 	 
  697. 	--This animation closes it out... 
  698. 	lua_play_anim(Hud_collection_anims.complete_anim_h, complete_start_time) 
  699. 	 
  700. 	if Hud_collection_data.collection_type == HUD_COLLECTION_SEVEN_DEADLY_SINS then 
  701. 		lua_play_anim(Hud_collection_anims.complete_deadly_h, complete_start_time) 
  702. 	end 
  703. 	 
  704. 	if Hud_super_reward.is_active ~= nil and Hud_super_reward.is_active == true then 
  705. 		vint_set_property(Hud_super_reward.move_grp, "anchor", 0, 110) 
  706. 	else 
  707. 		vint_set_property(Hud_super_reward.move_grp, "anchor", 0,0) 
  708. 	end 
  709. 	 
  710. 	--Get audio string from collection type... 
  711. 	local audio = Hud_collection_types[Hud_collection_data.collection_type].audio 
  712. 	if audio ~= nil then 
  713. 		--Play event... 
  714. 		audio_object_post_event(audio, nil, nil, nil, false) 
  715. 	end 
  716. end 
  717.  
  718. function hud_collection_audio_out() 
  719. 	ui_audio_post_event("ui_generic_band_anim_out") 
  720. end 
  721.  
  722. function hud_collection_finished() 
  723.  
  724. 	--pause looping bg animation.. 
  725. 	--award the stuff for real... 
  726. --	if Hud_collection_data.has_respect and Hud_collection_data.no_reward ~= true then 
  727. --		game_award_respect(Hud_collection_data.respect_reward, STATS_INVALID, Hud_collection_types[Hud_collection_data.collection_type].d_type, Hud_collection_data.save_in_mission)		 
  728. --	end 
  729. --	if Hud_collection_data.has_cash and Hud_collection_data.no_reward ~= true then 
  730. --		game_award_cash(Hud_collection_data.cash_reward, Hud_collection_types[Hud_collection_data.collection_type].d_type, Hud_collection_data.save_in_mission)			 
  731. --	end 
  732.  
  733. 	if Current_collection_index == Num_collection_data then 
  734. 		Num_collection_data = 0 
  735. 		Current_collection_index = 0 
  736. 		Queued_collection_data = { } 
  737. 		Hud_collection_is_active = false 
  738. 		 
  739. 		hud_collection_done() 
  740. 		 
  741. 		--only save after last collection is done... 
  742. 		game_autosave() 
  743. 	else 
  744. 		hud_collection_start() 
  745. 	end 
  746. end 
  747.  
  748. function hud_collection_animate_meter() 
  749. 	local meter_anim_h = vint_object_find( "collection_meter_anim" ) 
  750. 	lua_play_anim( meter_anim_h, 0 ) 
  751. end 
  752.  
  753. ------------------------------------------------------------- 
  754. -- Starts control meter fill/update (done via callback) 
  755. ------------------------------------------------------------- 
  756. function hud_collection_start_control() 
  757. 	Hud_collection_control_meter:update(Hud_collection_data.district_pct_new, true) 
  758. end 
  759.  
  760. ------------------------------------------------------------- 
  761. -- Makes respect meter visible....(done via callback) 
  762. ------------------------------------------------------------- 
  763. function hud_collection_show_respect() 
  764. 	--Query respect meter for current values... 
  765. 	local respect_total, respect_pct, respect_level = Hud_respect:get_data() 
  766. 	 
  767. 	local final_respect_reward = Hud_collection_data.respect_reward + Hud_collection_data.respect_bonus 
  768.  
  769. 	--Initialize meter... 
  770. 	Hud_collection_respect_meter:update_respect(final_respect_reward, respect_pct, respect_level, false) 
  771. end 
  772.  
  773. ------------------------------------------------------------- 
  774. -- Starts respect meter fill/update (done via callback) 
  775. ------------------------------------------------------------- 
  776. function hud_collection_start_respect() 
  777.  
  778. 	-- Query for the new values... 
  779. 	local respect_total_new, respect_pct_new, respect_level_new  = Hud_respect:get_data() 
  780.  
  781. 	local final_respect_reward = Hud_collection_data.respect_reward + Hud_collection_data.respect_bonus 
  782.  
  783. 	--Start animationg the meter... 
  784. 	Hud_collection_respect_meter:update_respect(final_respect_reward, respect_pct_new, respect_level_new, true) 
  785. end 
  786.  
  787. ------------------------------------------------------------- 
  788. -- Starts cash count/update (done via callback) 
  789. ------------------------------------------------------------- 
  790. function hud_collection_start_cash() 
  791. 	hud_collection_animate_cash()		 
  792. end 
  793.  
  794. ----------------------------------------- 
  795. --Cash count... 
  796. ----------------------------------------- 
  797. function hud_collection_animate_cash() 
  798.    thread_new("hud_collection_anim_cash_thread") 
  799. end 
  800.  
  801. function hud_collection_anim_cash_thread() 
  802. 	--init stuff 
  803. 	local start_cash = 0 
  804. 	local cash_this_frame = -1 
  805. 	local is_complete = false 
  806.  
  807. 	--get the variables from the global 
  808. 	local cash = Hud_collection_data.cash_reward 
  809.  
  810. 	local amt_min = 100 
  811. 	local amt_max = 5000 
  812. 	 
  813. 	local time_min = 300 
  814. 	local time_max = 2999 
  815. 	local init_time = floor(vint_get_time_index() * 1000) 
  816. 	local cur_time = init_time 
  817. 	local time_to_count = floor(time_min + ((time_max - time_min) * (cash / amt_max))) 
  818. 	 
  819. 	if time_to_count > time_max then 
  820. 		time_to_count = time_max 
  821. 	end 
  822. 	 
  823. 	--init sound IDs 
  824. 	local activity_cash_count = 0 
  825. 	local activity_cash_hit = 0 
  826.  
  827. 	while is_complete == false do 
  828. 		cur_time = floor(vint_get_time_index() * 1000) - init_time 
  829. 		 
  830. 		--set my values 
  831. 		cash_this_frame = cash * (cur_time / time_to_count) 
  832. 		vint_set_property(Hud_collection_cash_h, "text_tag", "{GAME_CASH}" .. format_cash(cash_this_frame)) 
  833. 		 
  834. 		if cur_time >= time_to_count then 
  835. 			--game_audio_stop(activity_cash_count) 
  836. 			--activity_cash_hit = game_audio_play(Completion_audio.cash_hit) 
  837. 			vint_set_property(Hud_collection_cash_h, "text_tag", "{GAME_CASH}" .. format_cash(cash)) 
  838. 			is_complete = true 
  839. 		end 
  840. 		thread_yield() 
  841. 	end		 
  842. end 
  843.  
  844. ------------------------------------------------------------------------------- 
  845. -- Pausing support for hud collection... 
  846. -- 
  847. function hud_collection_game_is_paused(di_h) 
  848. 	local is_paused = vint_dataitem_get(di_h) 
  849. 	if Hud_collection_is_active then 
  850. 		if is_paused == true then 
  851. 			--Stop anims 
  852. 			vint_set_property(Hud_collection_anims.complete_anim_h, "is_paused", true) 
  853. 			vint_set_property(Hud_collection_anims.complete_deadly_h, "is_paused", true) 
  854. 		else 
  855. 			--Play all anims 
  856. 			vint_set_property(Hud_collection_anims.complete_anim_h, "is_paused", false) 
  857. 			vint_set_property(Hud_collection_anims.complete_deadly_h, "is_paused", false) 
  858. 		end 
  859. 	end 
  860. end