sr2lua/mp_completion.lua

  1. -- Multiplayer Completion Screen shenanigans 
  2. Mp_completion_audio = { 
  3. 	top_3 = audio_get_audio_id("SYS_COMPLETION_START"), 
  4. 	top_2 = audio_get_audio_id("SYS_COMPLETION_START_2"), 
  5. 	cash = audio_get_audio_id("SYS_COMPLETION_CASH"), 
  6. 	respect = audio_get_audio_id("SYS_COMPLETION_RESPECT"), 
  7. 	image = audio_get_audio_id("SYS_COMPLETION_OBJECT"), 
  8. 	text = audio_get_audio_id("SYS_COMPLETION_TEXT"), 
  9. 	tips = audio_get_audio_id("SYS_COMPLETION_MENU"), 
  10. 	unlock = audio_get_audio_id("SYS_COMPLETION_UNLOCK"), 
  11. 	fail = audio_get_audio_id("SYS_COMPLETION_FAIL"), 
  12. 	cash_count = audio_get_audio_id("SYS_COMPLETION_CASH_COUNT"), 
  13. 	cash_hit = audio_get_audio_id("SYS_COMPLETION_CASH_HIT"), 
  14. 	respect_count = audio_get_audio_id("SYS_COMPLETION_CASH_COUNT"), 
  15. 	respect_hit = audio_get_audio_id("SYS_COMPLETION_RESPECT_HIT"), 
  16. 	respect_end = audio_get_audio_id("SYS_HUD_DIVERSION_COMPLETE"), 
  17. } 
  18.  
  19. Mp_completion_position_tag = { 
  20. 	[0] = "MP_1", 
  21. 	[1] = "MP_2", 
  22. 	[2] = "MP_3", 
  23. 	[3] = "MP_4", 
  24. 	[4] = "MP_5", 
  25. 	[5] = "MP_6", 
  26. 	[6] = "MP_7", 
  27. 	[7] = "MP_8", 
  28. 	[8] = "MP_9", 
  29. 	[9] = "MP_10", 
  30. 	[10] = "MP_11", 
  31. 	[11] = "MP_12", 
  32. } 
  33.  
  34. Mp_completion_rank_badge_tag = { 
  35. 	[0] = "MULTI_RANK_1", 
  36. 	[1] = "MULTI_RANK_2", 
  37. 	[2] = "MULTI_RANK_3", 
  38. 	[3] = "MULTI_RANK_4", 
  39. 	[4] = "MULTI_RANK_5", 
  40. 	[5] = "MULTI_RANK_6", 
  41. 	[6] = "MULTI_RANK_7", 
  42. 	[7] = "MULTI_RANK_8", 
  43. 	[8] = "MULTI_RANK_9", 
  44. 	[9] = "MULTI_RANK_10", 
  45. 	[10] = "MULTI_RANK_11", 
  46. 	[11] = "MULTI_RANK_12", 
  47. } 
  48.  
  49. Mp_completion_badge_description_tags = { 
  50. 	"MULTI_BADGE_1", 
  51. 	"MULTI_BADGE_2", 
  52. 	"MULTI_BADGE_3", 
  53. 	"MULTI_BADGE_4", 
  54. 	"MULTI_BADGE_5", 
  55. 	"MULTI_BADGE_6", 
  56. 	"MULTI_BADGE_7", 
  57. 	"MULTI_BADGE_8", 
  58. 	"MULTI_BADGE_9", 
  59. 	"MULTI_BADGE_10", 
  60. 	"MULTI_BADGE_11", 
  61. 	"MULTI_BADGE_12", 
  62. 	"MULTI_BADGE_13", 
  63. 	"MULTI_BADGE_14", 
  64. 	"MULTI_BADGE_15", 
  65. 	"MULTI_BADGE_16", 
  66. 	"MULTI_BADGE_17", 
  67. 	"MULTI_BADGE_18", 
  68. 	"MULTI_BADGE_19", 
  69. 	"MULTI_BADGE_20", 
  70. } 
  71.  
  72. Mp_completion_badges_done = false -- did we create the badges yet? 
  73.  
  74. Mp_completion_badges_again = false --init the global for doing the badge screen twice 
  75.  
  76. Mp_completion_is_animating = true --init the global, we will be animating the first screen 
  77.  
  78. MP_COMPLETION_SKIP_TIME = 60  --used to fast forward the documents 
  79.  
  80. MP_COMPLETION_GAP_VERT = 60 --pixel gap between content and tips 
  81.  
  82. MP_COMPLETION_RED = {["r"]=0.8, ["g"]=0, ["b"]=0} 
  83. MP_COMPLETION_BLUE = {["r"]=0.27, ["g"]=0.51, ["b"]=0.84} 
  84.  
  85. MAX_MULTI_PLAYERS = 12 
  86.  
  87. --------------------------------- 
  88. -- Initialization of the vint doc 
  89. function mp_completion_init() 
  90. 	local h = -1 
  91. 	local h2 = -1 
  92. 	local tween_h = -1 
  93. 	 
  94. 	--##################### 
  95. 	--GENERIC SHIT 
  96. 	--##################### 
  97. 	 
  98. 	--safe frame 
  99. 	Mp_completion.handles.safe_frame = vint_object_find("safe_frame") 
  100. 	 
  101. 	--black backgrounds 
  102. 	Mp_completion.handles.black_1 = vint_object_find("black_1") 
  103. 	Mp_completion.handles.black_2 = vint_object_find("black_2") 
  104. 	 
  105. 	--Tips 
  106. 	Mp_completion.handles.tips = vint_object_find("tips") 
  107. 	h = Mp_completion.handles.tips 
  108. 	Mp_completion.handles.btn_1 = vint_object_find("btn_1", h) 
  109. 	vint_set_property(Mp_completion.handles.btn_1, "image", get_a_button()) 
  110. 	Mp_completion.handles.btn_2 = vint_object_find("btn_2", h) 
  111. 	vint_set_property(Mp_completion.handles.btn_2, "image", get_x_button()) 
  112. 	Mp_completion.handles.btn_3 = vint_object_find("btn_3", h) 
  113. 	vint_set_property(Mp_completion.handles.btn_3, "image", get_b_button()) 
  114. 	 
  115. 	Mp_completion.handles.tip_1 = vint_object_find("tip_1", h) 
  116. 	Mp_completion.handles.tip_2 = vint_object_find("tip_2", h) 
  117. 	Mp_completion.handles.tip_3 = vint_object_find("tip_3", h) 
  118. 	 
  119. 	--Top Group of location, name, level 
  120. 	Mp_completion.handles.top_grp = vint_object_find("top_grp") 
  121. 	h = Mp_completion.handles.top_grp 
  122. 	Mp_completion.handles.top_1 = vint_object_find("top_1", h) 
  123. 	Mp_completion.handles.top_2 = vint_object_find("top_2", h) 
  124. 	Mp_completion.handles.top_3 = vint_object_find("top_3", h) 
  125. 		 
  126. 	--Wall 
  127. 	Mp_completion.handles.wall_h = vint_object_find("wall") 
  128. 	 
  129. 	--Column headings 
  130. 	Mp_completion.handles.headings_sa_h = vint_object_find("heading_sa") 
  131. 	Mp_completion.handles.headings_gb_h = vint_object_find("heading_gb") 
  132.  
  133. 	--##################### 
  134. 	--PAGE 1 
  135. 	--##################### 
  136. 	Mp_completion.handles.page_1 = vint_object_find("page_1") 
  137. 	 
  138. 		--AWARDS 
  139. 		Mp_completion.handles.awards = vint_object_find("awards") 
  140. 	 
  141. 		--..award 1 
  142. 		Mp_completion.handles.award_1 = vint_object_find("award_1") 
  143. 		h = Mp_completion.handles.award_1 
  144. 		Mp_completion.handles.a = { } 
  145. 		Mp_completion.handles.a[0] = {  
  146. 			grp = h, 
  147. 			handle_1 = vint_object_find("a_1_1", h), 
  148. 			handle_2 = vint_object_find("a_1_2", h), 
  149. 			handle_3 = vint_object_find("a_1_3", h), 
  150. 		} 
  151. 		 
  152. 		--..award 2 
  153. 		Mp_completion.handles.award_2 = vint_object_find("award_2") 
  154. 		h = Mp_completion.handles.award_2 
  155. 		Mp_completion.handles.a[1] = {  
  156. 			grp = h, 
  157. 			handle_1 = vint_object_find("a_2_1", h), 
  158. 			handle_2 = vint_object_find("a_2_2", h), 
  159. 			handle_3 = vint_object_find("a_2_3", h), 
  160. 		} 
  161. 		 
  162. 		--..award 3 
  163. 		Mp_completion.handles.award_3 = vint_object_find("award_3") 
  164. 		h = Mp_completion.handles.award_3 
  165. 		Mp_completion.handles.a[2] = {  
  166. 			grp = h, 
  167. 			handle_1 = vint_object_find("a_3_1", h), 
  168. 			handle_2 = vint_object_find("a_3_2", h), 
  169. 			handle_3 = vint_object_find("a_3_3", h), 
  170. 		} 
  171. 		 
  172. 		--..score blue 
  173. 		Mp_completion.handles.team_blue = vint_object_find("team_blue") 
  174. 		h = Mp_completion.handles.team_blue 
  175. 		Mp_completion.handles.blue_name = vint_object_find("blue_name", h) 
  176. 		Mp_completion.handles.blue_score = vint_object_find("blue_score", h) 
  177. 		Mp_completion.handles.blue_rank = vint_object_find("blue_rank", h) 
  178. 		Mp_completion.handles.blue_kills = vint_object_find("blue_kills", h) 
  179. 		 
  180. 		--..score red 
  181. 		Mp_completion.handles.team_red = vint_object_find("team_red") 
  182. 		h = Mp_completion.handles.team_red 
  183. 		Mp_completion.handles.red_name = vint_object_find("red_name", h) 
  184. 		Mp_completion.handles.red_score = vint_object_find("red_score", h) 
  185. 		Mp_completion.handles.red_rank = vint_object_find("red_rank", h) 
  186. 		Mp_completion.handles.red_kills = vint_object_find("red_kills", h) 
  187. 	 
  188. 	 
  189. 	--##################### 
  190. 	--PAGE 2 
  191. 	--##################### 
  192. 	 
  193. 	--page 2 group 
  194. 	Mp_completion.handles.page_2 = vint_object_find("page_2") 
  195. 	 
  196. 		--..unlocked_rewards 
  197. 		Mp_completion.handles.unlock = vint_object_find("unlock") 
  198. 		h = Mp_completion.handles.unlock 
  199. 		Mp_completion.handles.t_unlocked = vint_object_find("t_unlocked", h) 
  200. 		Mp_completion.handles.t_rewards = vint_object_find("t_rewards", h) 
  201. 					 
  202. 		--..badges: otherwise here's a group of 10 
  203. 		Mp_completion.handles.badges = vint_object_find("badges") 
  204. 		h = Mp_completion.handles.badges 
  205. 			 
  206. 		Mp_completion.handles.bdg = { } 
  207. 		Mp_completion.handles.bdg[0] = { 
  208. 			handle_1 =  vint_object_find("rwd_1", h), 
  209. 			handle_2 =  vint_object_find("txt_1", h), 
  210. 		} 
  211. 		 
  212. 		Mp_completion.handles.bdg[1] = { 
  213. 			handle_1 =  vint_object_find("rwd_2", h), 
  214. 			handle_2 =  vint_object_find("txt_2", h), 
  215. 		} 
  216. 		 
  217. 		Mp_completion.handles.bdg[2] = { 
  218. 			handle_1 =  vint_object_find("rwd_3", h), 
  219. 			handle_2 =  vint_object_find("txt_3", h), 
  220. 		} 
  221. 		 
  222. 		Mp_completion.handles.bdg[3] = { 
  223. 			handle_1 =  vint_object_find("rwd_4", h), 
  224. 			handle_2 =  vint_object_find("txt_4", h), 
  225. 		} 
  226. 		 
  227. 		Mp_completion.handles.bdg[4] = { 
  228. 			handle_1 =  vint_object_find("rwd_5", h), 
  229. 			handle_2 =  vint_object_find("txt_5", h), 
  230. 		} 
  231. 		 
  232. 		Mp_completion.handles.bdg[5] = { 
  233. 			handle_1 = vint_object_find("rwd_6", h) , 
  234. 			handle_2 =  vint_object_find("txt_6", h), 
  235. 		} 
  236. 		 
  237. 		Mp_completion.handles.bdg[6] = { 
  238. 			handle_1 =  vint_object_find("rwd_7", h), 
  239. 			handle_2 =  vint_object_find("txt_7", h), 
  240. 		} 
  241. 		 
  242. 		Mp_completion.handles.bdg[7] = { 
  243. 			handle_1 =  vint_object_find("rwd_8", h), 
  244. 			handle_2 =  vint_object_find("txt_8", h), 
  245. 		} 
  246. 		 
  247. 		Mp_completion.handles.bdg[8] = { 
  248. 			handle_1 =  vint_object_find("rwd_9", h), 
  249. 			handle_2 =  vint_object_find("txt_9", h), 
  250. 		} 
  251. 		 
  252. 		Mp_completion.handles.bdg[9] = { 
  253. 			handle_1 =  vint_object_find("rwd_10", h), 
  254. 			handle_2 =  vint_object_find("txt_10", h), 
  255. 		} 
  256. 		 
  257. 		 
  258. 		--badges 11 - 20  
  259. 		Mp_completion.handles.bdg[10] = { 
  260. 			handle_1 =  vint_object_find("rwd_1", h), 
  261. 			handle_2 =  vint_object_find("txt_1", h), 
  262. 		} 
  263. 		 
  264. 		Mp_completion.handles.bdg[11] = { 
  265. 			handle_1 =  vint_object_find("rwd_2", h), 
  266. 			handle_2 =  vint_object_find("txt_2", h), 
  267. 		} 
  268. 		 
  269. 		Mp_completion.handles.bdg[12] = { 
  270. 			handle_1 =  vint_object_find("rwd_3", h), 
  271. 			handle_2 =  vint_object_find("txt_3", h), 
  272. 		} 
  273. 		 
  274. 		Mp_completion.handles.bdg[13] = { 
  275. 			handle_1 =  vint_object_find("rwd_4", h), 
  276. 			handle_2 =  vint_object_find("txt_4", h), 
  277. 		} 
  278. 		 
  279. 		Mp_completion.handles.bdg[14] = { 
  280. 			handle_1 =  vint_object_find("rwd_5", h), 
  281. 			handle_2 =  vint_object_find("txt_5", h), 
  282. 		} 
  283. 		 
  284. 		Mp_completion.handles.bdg[15] = { 
  285. 			handle_1 = vint_object_find("rwd_6", h) , 
  286. 			handle_2 =  vint_object_find("txt_6", h), 
  287. 		} 
  288. 		 
  289. 		Mp_completion.handles.bdg[16] = { 
  290. 			handle_1 =  vint_object_find("rwd_7", h), 
  291. 			handle_2 =  vint_object_find("txt_7", h), 
  292. 		} 
  293. 		 
  294. 		Mp_completion.handles.bdg[17] = { 
  295. 			handle_1 =  vint_object_find("rwd_8", h), 
  296. 			handle_2 =  vint_object_find("txt_8", h), 
  297. 		} 
  298. 		 
  299. 		Mp_completion.handles.bdg[18] = { 
  300. 			handle_1 =  vint_object_find("rwd_9", h), 
  301. 			handle_2 =  vint_object_find("txt_9", h), 
  302. 		} 
  303. 		 
  304. 		Mp_completion.handles.bdg[19] = { 
  305. 			handle_1 =  vint_object_find("rwd_10", h), 
  306. 			handle_2 =  vint_object_find("txt_10", h), 
  307. 		} 
  308.  
  309. 		 
  310. 	--##################### 
  311. 	--PAGE 3 
  312. 	--##################### 
  313. 	 
  314. 	--page 3 group 
  315. 	Mp_completion.handles.page_3 = vint_object_find("page_3") 
  316. 	 
  317. 	--..scoreboard top text 
  318. 	Mp_completion.handles.scoreboard_top = vint_object_find("scoreboard_top") 
  319. 	h = Mp_completion.handles.scoreboard_top 
  320. 	Mp_completion.handles.results = vint_object_find("results", h) 
  321. 	Mp_completion.handles.sb_1 = vint_object_find("sb_1", h) 
  322. 	Mp_completion.handles.sb_2 = vint_object_find("sb_2", h) 
  323. 	Mp_completion.handles.sb_3 = vint_object_find("sb_3", h) 
  324. 	 
  325. 	--..scoreboard background 
  326. 	Mp_completion.handles.scoreboard_bg = vint_object_find("scoreboard_bg") 
  327. 	 
  328. 	--..stash 
  329. 	Mp_completion.handles.stash_h = vint_object_find("stash") 
  330. 	 
  331. 	--..player template 
  332. 	Mp_completion.handles.player = vint_object_find("player") 
  333. 	h = Mp_completion.handles.player 
  334. 	Mp_completion.handles.badge = vint_object_find("badge", h) 
  335. 	Mp_completion.handles.hr = vint_object_find("hr", h) 
  336. 	Mp_completion.handles.speaker = vint_object_find("speaker", h) 
  337. 		 
  338. 	--..stripe 
  339. 	Mp_completion.handles.stripe = vint_object_find("stripe", h) 
  340. 	 
  341. 	--..UNDER text 
  342. 	Mp_completion.handles.under = vint_object_find("under") 
  343. 	h = Mp_completion.handles.under 
  344. 	Mp_completion.handles.name = vint_object_find("name", h) 
  345. 	Mp_completion.handles.badge_name = vint_object_find("badge_name", h) 
  346. 	Mp_completion.handles.amt_1 = vint_object_find("amt_1", h) 
  347. 	Mp_completion.handles.amt_2 = vint_object_find("amt_2", h) 
  348. 	Mp_completion.handles.amt_3 = vint_object_find("amt_3", h) 
  349. 	Mp_completion.handles.amt_4 = vint_object_find("amt_4", h) 
  350. 	vint_set_property(Mp_completion.handles.amt_4, "text_tag", " ") 
  351. 	 
  352. 	--..OVER text 
  353. 	Mp_completion.handles.over = vint_object_find("over") 
  354. 	h = Mp_completion.handles.over 
  355. 	Mp_completion.handles.name_over = vint_object_find("name_over", h) 
  356. 	Mp_completion.handles.badge_name_over = vint_object_find("badge_name_over", h) 
  357. 	Mp_completion.handles.amt_1_over = vint_object_find("amt_1_over", h) 
  358. 	Mp_completion.handles.amt_2_over = vint_object_find("amt_2_over", h) 
  359. 	Mp_completion.handles.amt_3_over = vint_object_find("amt_3_over", h) 
  360. 	Mp_completion.handles.amt_4_over = vint_object_find("amt_4_over", h) 
  361. 	vint_set_property(Mp_completion.handles.amt_4_over, "text_tag", " ") 
  362. 	 
  363. 	Mp_completion.results = { data = { }, num_players = 0, cur_idx = 0 } 
  364. 	vint_set_property(Mp_completion.handles.player, "visible", false) 
  365. 	vint_set_property(Mp_completion.handles.under, "visible", false) 
  366. 	vint_set_property(Mp_completion.handles.over, "visible", false) 
  367.  
  368. 	for i = 0, MAX_MULTI_PLAYERS - 1 do   -- Max players: 12 
  369. 		Mp_completion.results[i] = { } 
  370. 		Mp_completion.results.data[i] = { enabled = false } 
  371. 		 
  372. 		Mp_completion.results[i].player 	= vint_object_clone(Mp_completion.handles.player) 
  373. 		Mp_completion.results[i].badge 	= vint_object_find("badge", Mp_completion.results[i].player) 
  374. 		Mp_completion.results[i].hr 		= vint_object_find("hr", Mp_completion.results[i].player) 
  375. 		Mp_completion.results[i].speaker = vint_object_find("speaker", Mp_completion.results[i].player) 
  376. 		Mp_completion.results[i].stripe 	= vint_object_find("stripe", Mp_completion.results[i].player) 
  377.  
  378. 		Mp_completion.results[i].under = { } 
  379. 		Mp_completion.results[i].over = { } 
  380.  
  381. 		Mp_completion.results[i].under.grp_h = vint_object_find("under", Mp_completion.results[i].player) 
  382. 		Mp_completion.results[i].over.grp_h = vint_object_find("over", Mp_completion.results[i].player) 
  383. 		 
  384. 		if i ~= 0 then 
  385. 			local x, y = vint_get_property(Mp_completion.results[i - 1].player, "anchor") 
  386. 			local w, h = element_get_actual_size(Mp_completion.results[i - 1].under.amt_1) 
  387. 			 
  388. 			vint_set_property(Mp_completion.results[i].player, "anchor", x, y + h + 12)		 
  389. 			vint_set_property(Mp_completion.results[i].hr, "visible", true) 
  390. 			 
  391. 		end 
  392. 		 
  393. 		--Find and assign objects within highlight line 
  394. 		Mp_completion.results[i].under.name = vint_object_find("name", Mp_completion.results[i].under.grp_h) 
  395. 		Mp_completion.results[i].under.badge_name = vint_object_find("badge_name", Mp_completion.results[i].under.grp_h) 
  396. 		Mp_completion.results[i].under.amt_1 = vint_object_find("amt_1", Mp_completion.results[i].under.grp_h) 
  397. 		Mp_completion.results[i].under.amt_2 = vint_object_find("amt_2", Mp_completion.results[i].under.grp_h) 
  398. 		Mp_completion.results[i].under.amt_3 = vint_object_find("amt_3", Mp_completion.results[i].under.grp_h) 
  399. 		Mp_completion.results[i].under.amt_4 = vint_object_find("amt_4", Mp_completion.results[i].under.grp_h) 
  400. 		 
  401. 		--..OVER text 
  402. 		Mp_completion.results[i].over.name = vint_object_find("name_over", Mp_completion.results[i].over.grp_h) 
  403. 		Mp_completion.results[i].over.badge_name = vint_object_find("badge_name_over", Mp_completion.results[i].over.grp_h) 
  404. 		Mp_completion.results[i].over.amt_1 = vint_object_find("amt_1_over", Mp_completion.results[i].over.grp_h) 
  405. 		Mp_completion.results[i].over.amt_2 = vint_object_find("amt_2_over", Mp_completion.results[i].over.grp_h) 
  406. 		Mp_completion.results[i].over.amt_3 = vint_object_find("amt_3_over", Mp_completion.results[i].over.grp_h) 
  407. 		Mp_completion.results[i].over.amt_4 = vint_object_find("amt_4_over", Mp_completion.results[i].over.grp_h) 
  408. 	end 
  409.  
  410. 	 
  411. 	--##################### 
  412. 	--ANIMATIONS 
  413. 	--##################### 
  414. 	Mp_completion.handles.awards_anim = vint_object_find("awards_anim") 
  415. 	Mp_completion.handles.badges_anim = vint_object_find("badges_anim") 
  416. 	Mp_completion.handles.black_1_anim = vint_object_find("black_1_anim") 
  417. 	Mp_completion.handles.black_2_anim = vint_object_find("black_2_anim") 
  418. 	Mp_completion.handles.page_1_fade_out = vint_object_find("page_1_fade_out") 
  419. 	Mp_completion.handles.page_1_skip_2_fade_out = vint_object_find("page_1_skip_2_fade_out") 
  420. 	Mp_completion.handles.page_2_fade_out = vint_object_find("page_2_fade_out") 
  421. 	Mp_completion.handles.page_2_badges_fade_out = vint_object_find("page_2_badges_fade_out") 
  422. 	Mp_completion.handles.page_3_anim = vint_object_find("page_3_anim") 
  423. 	Mp_completion.handles.screen_shake = vint_object_find("screen_shake") 
  424. 	Mp_completion.handles.team_blue_anim = vint_object_find("team_blue_anim") 
  425. 	Mp_completion.handles.team_blue_slam_anim = vint_object_find("team_blue_slam_anim") 
  426. 	Mp_completion.handles.team_red_anim = vint_object_find("team_red_anim") 
  427. 	Mp_completion.handles.team_red_slam_anim = vint_object_find("team_red_slam_anim") 
  428. 	Mp_completion.handles.tips_fade_in_anim = vint_object_find("tips_fade_in_anim") 
  429. 	Mp_completion.handles.tips_fade_out_anim = vint_object_find("tips_fade_out_anim") 
  430. 	Mp_completion.handles.top_grp_anim = vint_object_find("top_grp_anim") 
  431. 	Mp_completion.handles.top_grp_fade_out_anim = vint_object_find("top_grp_fade_out_anim") 
  432. 	Mp_completion.handles.unlocked_rewards_anim = vint_object_find("unlocked_rewards_anim") 
  433. 	Mp_completion.handles.wall_anim_h = vint_object_find("wall_anim") 
  434. 	Mp_completion.handles.tip_1_pulsate_h = vint_object_find("tip_1_pulsate") 
  435. 	 
  436. 	vint_set_property(Mp_completion.handles.awards_anim, "is_paused", true) 
  437. 	vint_set_property(Mp_completion.handles.badges_anim, "is_paused", true) 
  438. 	vint_set_property(Mp_completion.handles.black_1_anim, "is_paused", true) 
  439. 	vint_set_property(Mp_completion.handles.black_2_anim, "is_paused", true) 
  440. 	vint_set_property(Mp_completion.handles.page_1_fade_out, "is_paused", true) 
  441. 	vint_set_property(Mp_completion.handles.page_1_skip_2_fade_out, "is_paused", true) 
  442. 	vint_set_property(Mp_completion.handles.page_2_fade_out, "is_paused", true) 
  443. 	vint_set_property(Mp_completion.handles.page_2_badges_fade_out, "is_paused", true) 
  444. 	vint_set_property(Mp_completion.handles.page_3_anim, "is_paused", true) 
  445. 	vint_set_property(Mp_completion.handles.team_blue_anim, "is_paused", true) 
  446. 	vint_set_property(Mp_completion.handles.team_blue_slam_anim, "is_paused", true) 
  447. 	vint_set_property(Mp_completion.handles.team_red_anim, "is_paused", true) 
  448. 	vint_set_property(Mp_completion.handles.team_red_slam_anim, "is_paused", true) 
  449. 	vint_set_property(Mp_completion.handles.screen_shake, "is_paused", true) 
  450. 	vint_set_property(Mp_completion.handles.tips_fade_in_anim , "is_paused", true) 
  451. 	vint_set_property(Mp_completion.handles.tips_fade_out_anim, "is_paused", true) 
  452. 	vint_set_property(Mp_completion.handles.top_grp_anim , "is_paused", true) 
  453. 	vint_set_property(Mp_completion.handles.top_grp_fade_out_anim, "is_paused", true) 
  454. 	vint_set_property(Mp_completion.handles.unlocked_rewards_anim, "is_paused", true) 
  455. 	vint_set_property(Mp_completion.handles.wall_anim , "is_paused", true) 
  456. 	vint_set_property(Mp_completion.handles.tip_1_pulsate_h, "is_paused", true) 
  457. 	 
  458. 	--##################### 
  459. 	--SCREEN SHAKE 
  460. 	--##################### 
  461.  
  462. 	--SHAKERS WOOT WOOT 
  463. 	--the top stuff 
  464. 	--line 1 
  465. 	tween_h = vint_object_find("top_1_pos", Mp_completion.handles.top_grp_anim) 
  466. 	vint_set_property(tween_h, "end_event", "mp_completion_screen_shake") 
  467. 	 
  468. 	--line 2 
  469. 	tween_h = vint_object_find("top_2_pos", Mp_completion.handles.top_grp_anim) 
  470. 	vint_set_property(tween_h, "end_event", "mp_completion_screen_shake") 
  471. 	 
  472. 	--line 3 
  473. 	tween_h = vint_object_find("top_3_pos", Mp_completion.handles.top_grp_anim) 
  474. 	vint_set_property(tween_h, "end_event", "mp_completion_screen_shake") 
  475. 		 
  476. 	--page 1 stuff 
  477. 	tween_h = vint_object_find("blue_score_scale", Mp_completion.handles.team_blue_anim) 
  478. 	vint_set_property(tween_h, "end_event", "mp_completion_screen_shake") 
  479. 	 
  480. 	tween_h = vint_object_find("red_score_scale", Mp_completion.handles.team_red_anim) 
  481. 	vint_set_property(tween_h, "end_event", "mp_completion_screen_shake") 
  482. 	 
  483. 	tween_h = vint_object_find("blue_score_scale", Mp_completion.handles.team_blue_slam_anim) 
  484. 	vint_set_property(tween_h, "end_event", "mp_completion_screen_shake") 
  485. 	 
  486. 	tween_h = vint_object_find("red_score_scale", Mp_completion.handles.team_red_slam_anim) 
  487. 	vint_set_property(tween_h, "end_event", "mp_completion_screen_shake") 
  488. 		 
  489. 	--unlock 
  490. 	tween_h = vint_object_find("rewards_scale", Mp_completion.handles.unlocked_rewards_anim) 
  491. 	vint_set_property(tween_h, "end_event", "mp_completion_screen_shake") 
  492. 		 
  493. 	--mp_completion_shut_off_all_layers() 
  494. 	mp_completion_grab_input() 
  495. 	 
  496. 	-- Initialize the data 
  497. 	mp_completion_initialize() 
  498.  
  499. end 
  500.  
  501. function mp_completion_cleanup() 
  502.  
  503. 	-- Get rid of the player info popup if possible 
  504. 	local info_popup = vint_document_find("mp_player_info_popup") 
  505. 	if info_popup ~= nil then 
  506. 		vint_document_unload(info_popup) 
  507. 	end 
  508.  
  509. 	if Mp_completion.general.winner == true then 
  510. 		peg_unload("ui_c_wall_mp") 
  511. 	else 
  512. 		peg_unload("ui_c_wall_mp_red") 
  513. 	end 
  514. end 
  515.  
  516. -- End all function to close it 
  517. function mp_completion_exit() 
  518. 	mp_completion_release_input() 
  519. 	--fade out 
  520. 	screen_fx_fadeout(0) 
  521. 	-- Get rid of this screen 
  522. 	vint_document_unload(vint_document_find("mp_completion")) 
  523. end 
  524.  
  525. ------------------ 
  526. -- Input Handling 
  527. function mp_completion_grab_input() 
  528. 	Mp_completion.input[0] = vint_subscribe_to_input_event(nil, "select", 			"mp_completion_process_input") 
  529. 	Mp_completion.input[1] = vint_subscribe_to_input_event(nil, "back", 				"mp_completion_process_input") 
  530. 	Mp_completion.input[2] = vint_subscribe_to_input_event(nil, "alt_select", 		"mp_completion_process_input") 
  531. 	Mp_completion.input[3] = vint_subscribe_to_input_event(nil, "nav_up", 			"mp_completion_process_input") 
  532. 	Mp_completion.input[4] = vint_subscribe_to_input_event(nil, "nav_down", 		"mp_completion_process_input") 
  533. 	Mp_completion.input[5] = vint_subscribe_to_input_event(nil, "all_unassigned", "mp_completion_process_input") 
  534. end 
  535.  
  536. function mp_completion_finish_quit(result, action) 
  537. 	 
  538. 	if action ~= DIALOG_ACTION_CLOSE then 
  539. 		return 
  540. 	end 
  541. 	 
  542. 	if result == 0 then 
  543. 		mp_completion_quit_game() 
  544. 		mp_completion_exit() 
  545. 	end 
  546. end 
  547.  
  548. function mp_completion_process_input(target, event, accel) 
  549.  
  550. 	if Mp_completion.input_block == true then 
  551. 		return; 
  552. 	end 
  553.  
  554. 	local show_screen = false 
  555. 	 
  556. 	if Mp_completion_is_animating == false then 
  557. 		if event == "select" then 
  558. 			-- Progress to next screen (for now?) 
  559. 			if Mp_completion.screen_idx >= Mp_completion.num_screens - 1 then 
  560. 				if mp_completion_is_party_host() == true then 
  561. 					mp_completion_return_to_lobby() 
  562. 					mp_completion_exit() 
  563. 				else 
  564. 					if mp_completion_host_left() and mp_completion_is_party_client() then 
  565. 						dialog_box_message("MENU_TITLE_WARNING", "MP_DISCONNECT_HOST_LEFT") 
  566. 					elseif mp_completion_is_party_client() == false then 
  567. 						mp_completion_exit() 
  568. 					end 
  569. 					show_screen = false 
  570. 				end 
  571. 			else  
  572. 				Mp_completion.screen_idx = Mp_completion.screen_idx + 1 
  573. 				show_screen = true 
  574. 			end 
  575. 		elseif event == "back" then 
  576. 		-- B Button 
  577. 			if Mp_completion.screen_idx >= Mp_completion.num_screens - 1 then 
  578. 				-- Double check that they want to quit 
  579. 				dialog_box_confirmation("PAUSE_MENU_QUIT_TITLE", "QUIT_GAME_TEXT_SHORT", "mp_completion_finish_quit") 
  580. 			end 
  581. 		elseif event == "alt_select" then 
  582. 		-- X Button 
  583. 			if Mp_completion.screen_idx == 2 then 
  584. 				if get_is_syslink() == false then 
  585. 					mp_popup_open(Mp_completion.results[Mp_completion.results.cur_idx].handle, 1) 
  586. 				end 
  587. 			end 
  588. 		elseif event == "nav_up" then 
  589. 			if Mp_completion.screen_idx == 2 then 
  590. 				local old_idx = Mp_completion.results.cur_idx 
  591. 				Mp_completion.results.cur_idx = Mp_completion.results.cur_idx  - 1 
  592. 				 
  593. 				if Mp_completion.results.cur_idx < 0 then 
  594. 					Mp_completion.results.cur_idx = Mp_completion.results.num_players - 1 
  595. 				end 
  596. 				 
  597. 				mp_completion_update_result_selection(old_idx) 
  598. 			end 
  599. 		elseif event == "nav_down" then 
  600. 			if Mp_completion.screen_idx == 2 then 
  601. 				local old_idx = Mp_completion.results.cur_idx 
  602. 				Mp_completion.results.cur_idx = Mp_completion.results.cur_idx + 1 
  603. 				 
  604. 				if Mp_completion.results.cur_idx >= Mp_completion.results.num_players then 
  605. 					Mp_completion.results.cur_idx = 0 
  606. 				end 
  607.  
  608. 				mp_completion_update_result_selection(old_idx) 
  609. 			end 
  610. 		end 
  611. 		 
  612. 		if show_screen == true then 
  613. 			if Mp_completion.screen_idx >= Mp_completion.num_screens then 
  614. 				mp_completion_exit() 
  615. 			else 
  616. 				if Mp_completion_badges_again == true then 
  617. 					Mp_completion_badges_done = false 
  618. 					Mp_completion.screen_idx = 1 
  619. 				end 
  620. 				Mp_completion.screen_show_function[Mp_completion.screen_idx]() 
  621. 			end 
  622. 		end 
  623. 		return 
  624. 		 
  625. 	end 
  626. 	 
  627. 	 
  628. 	--set up the animation skipping 
  629. 	if Mp_completion_is_animating == true then 
  630. 		 
  631. 		if event == "select" or event == "back" then	 
  632. 			--set up var to kill threads 
  633. 			mp_completion_anim_threads_kill() 
  634.  
  635. 			if Mp_completion.handles.screen == "general" then 
  636. 				--do page 1 stuff 
  637. 				mp_completion_do_team_scores() 
  638. 				mp_completion_do_awards() 
  639. 				 
  640. 				--cancel any callbacks 
  641. 				local tween_h = vint_object_find("team_red_ender", Mp_completion.handles.team_red_anim) 
  642. 				vint_set_property(tween_h, "end_event", nil) 
  643.  
  644. 				local tween_h = vint_object_find("awards_ender", Mp_completion.handles.awards_anim) 
  645. 				vint_set_property(tween_h, "end_event", nil) 
  646. 				 
  647. 				--play all animations at once, so we can skip to end 
  648. 				--the top and blue score are already playing, no need to call again 
  649. 				mp_completion_team_red_anim() 
  650. 				mp_completion_awards_anim() 
  651. 				 
  652. 				--set the cash 
  653. 				if Mp_completion.general.gametype == "Braveheart" then 
  654. 					vint_set_property(Mp_completion.handles.blue_score, "text_tag", "$" .. format_cash(Mp_completion.general.player_score)) 
  655. 					vint_set_property(Mp_completion.handles.red_score, "text_tag", "$" .. format_cash(Mp_completion.general.other_score)) 
  656. 					 
  657. 				elseif Mp_completion.general.gametype == "Team Gangsta Brawl" then 
  658. 					vint_set_property(Mp_completion.handles.blue_score, "text_tag", format_cash(Mp_completion.general.player_score)) 
  659. 					vint_set_property(Mp_completion.handles.red_score, "text_tag", format_cash(Mp_completion.general.other_score)) 
  660. 					 
  661. 				elseif Mp_completion.general.gametype == "Gangsta Brawl" then 
  662. 					vint_set_property(Mp_completion.handles.blue_score, "text_tag", format_cash(Mp_completion.general.player_score)) 
  663. 					vint_set_property(Mp_completion.handles.blue_rank, "text_tag", Mp_completion.general.player_position) 
  664. 					vint_set_property(Mp_completion.handles.red_score, "text_tag", format_cash(Mp_completion.general.other_score)) 
  665. 					vint_set_property(Mp_completion.handles.red_rank, "text_tag", Mp_completion.general.other_position) 
  666. 				end 
  667. 				 
  668. 				mp_completion_move_page_1_tips() 
  669.  
  670. 			elseif Mp_completion.handles.screen == "badges" then 
  671. 				local tween = vint_object_find("unlock_scale", Mp_completion.handles.unlocked_rewards_anim) 
  672. 				vint_set_property(tween, "start_event", nil) 
  673.  
  674. 				local tween = vint_object_find("badges_alpha", Mp_completion.handles.badges_anim) 
  675. 				vint_set_property(tween, "start_event", nil) 
  676. 				 
  677. 				mp_completion_unlock_fade_in(0) 
  678. 				mp_completion_badges_anim(0) 
  679. 				mp_completion_move_page_2_tips() 
  680. 				mp_completion_do_badges() 
  681. 			elseif Mp_completion.handles.screen == "badges" and Mp_completion.screen_idx > 1 then 
  682. 				mp_completion_page_2_fade_out()				 
  683. 			elseif Mp_completion.handles.screen == "results" then 
  684.  
  685. 			end 
  686. 			 
  687. 			mp_completion_tips_fade_in() 
  688. 			 
  689. 			show_screen = false 
  690. 			Mp_completion_is_animating = false 
  691. 			 
  692. 			--give em some audio feedback, let em know they did something 
  693. 			mp_completion_text_sound() 
  694. 			 
  695. 			--time fast forward 
  696. 			Mp_completion_current_time = vint_get_time_index() 
  697. 			local current_time = Mp_completion_current_time 
  698. 			local future_time = current_time + MP_COMPLETION_SKIP_TIME 
  699. 			vint_set_time_index(future_time) 
  700. 		end 
  701. 	end 
  702. end 
  703.  
  704. function mp_completion_release_input() 
  705. 	for idx, val in Mp_completion.input do 
  706. 		vint_unsubscribe_to_input_event(val) 
  707. 	end 
  708. 	Mp_completion.input = { } 
  709. end 
  710.  
  711. --------------------------- 
  712. -- Retrieve necessary data 
  713. function mp_completion_initialize() 
  714. 	Mp_completion.general = { } 
  715. 	Mp_completion.awards = { num_awards = 0 } 
  716. 	Mp_completion.badges = { num_badges = 0 } 
  717. 	Mp_completion.screen_idx = 0 
  718. 	 
  719. 	vint_dataresponder_request("mp_completion_populate", "mp_completion_populate_general", 0, "mp_completion_general") 
  720. 	vint_dataresponder_request("mp_completion_populate", "mp_completion_populate_awards", 0, "mp_completion_awards") 
  721. 	vint_dataresponder_request("mp_completion_populate", "mp_completion_populate_badges", 0, "mp_completion_badges") 
  722. 	 
  723. 	Mp_completion.screen_show_function[Mp_completion.screen_idx]() 
  724. end 
  725.  
  726. function mp_completion_load_wall() 
  727. 	--Mp_completion.general.winner = true 
  728. 	if Mp_completion.general.winner == true then 
  729. 		peg_load("ui_c_wall_mp") 
  730. 		vint_set_property(Mp_completion.handles.wall_h, "image", "ui_ct_wall_mp.tga") 
  731. 	else 
  732. 		peg_load("ui_c_wall_mp_red") 
  733. 		vint_set_property(Mp_completion.handles.wall_h, "image", "ui_ct_wall_mp_red.tga") 
  734. 	end 
  735.  
  736. end 
  737.  
  738.  
  739. function mp_completion_populate_general(winner, opponents_left, player_score, other_score, gametype, map, player_name, position, other_name, cash_awarded) 
  740. 	Mp_completion.general.gametype = gametype 
  741. 	Mp_completion.general.map = map 
  742. 	Mp_completion.general.winner = winner					--	bool for if the player won 
  743. 	Mp_completion.general.opponents_left = opponents_left 
  744. 	 
  745. 	if cash_awarded == 0 then 
  746. 		vint_set_property(Mp_completion.handles.stash_h, "visible", false) 
  747. 	else 
  748. 		cash_awarded = "$" .. format_cash(cash_awarded) 
  749. 		cash_awarded = {[0] = cash_awarded} 
  750. 		cash_awarded = vint_insert_values_in_string("MULTI_CASH_AWARD", cash_awarded) 
  751. 		vint_set_property(Mp_completion.handles.stash_h, "text_tag", cash_awarded) 
  752. 	end 
  753. 	 
  754. 	if gametype == "Gangsta Brawl" then 
  755. 		vint_set_property(Mp_completion.handles.headings_gb_h, "visible", true) 
  756. 	 
  757. 		Mp_completion.general.player_position = Mp_completion_position_tag[position] --Mp_completion_rank_badge_tag[other_score]  --player's rank 
  758. 		Mp_completion.general.player_score = player_score --kills 
  759. 		Mp_completion.general.player_name = player_name 
  760.  
  761. 		if winner == true then -- If you won this is the second place 
  762. 			Mp_completion.general.other_position = Mp_completion_position_tag[1] 
  763. 		else	--	If you didn't win, this is the first place 
  764. 			Mp_completion.general.other_position = Mp_completion_position_tag[0] 
  765. 		end 
  766. 		 
  767. 		Mp_completion.general.other_score = other_score 
  768. 		Mp_completion.general.other_name = other_name 
  769. 	else  
  770. 		if gametype == "Team Gangsta Brawl" then 
  771. 			vint_set_property(Mp_completion.handles.headings_gb_h, "visible", true) 
  772. 		else 
  773. 			vint_set_property(Mp_completion.handles.headings_sa_h, "visible", true) 
  774. 		end 
  775. 	 
  776. 		Mp_completion.general.player_score = player_score	-- player's team score 
  777. 		Mp_completion.general.other_score = other_score		-- other team's score 
  778. 	end 
  779. 			 
  780. 	--load the wall 
  781. 	mp_completion_load_wall() 
  782. end 
  783.  
  784.  
  785. function mp_completion_populate_awards(player, award_text, award_description, team)	 
  786. 	local num_awards = Mp_completion.awards.num_awards 
  787. 	Mp_completion.awards[num_awards] = { player = player, text = award_text, description = award_description, team = team }		-- Both lines 
  788. 	Mp_completion.awards.num_awards = num_awards + 1  
  789. end 
  790.  
  791. function mp_completion_populate_badges(badge_image, badge_description, rank_badge, rank) 
  792. 	local num_badges = Mp_completion.badges.num_badges 
  793. 	Mp_completion.badges[num_badges] = { image = badge_image } 	-- image and description for the badges to display 
  794. 		 
  795. 	if rank_badge == true then 
  796. 		Mp_completion.badges[num_badges].description = Mp_completion_rank_badge_tag[rank] 
  797. 	else 
  798. 		Mp_completion.badges[num_badges].description = Mp_completion_badge_description_tags[badge_description] 
  799. 	end 
  800. 	 
  801. 	Mp_completion.badges.num_badges = num_badges + 1 
  802. end 
  803.  
  804. function mp_completion_populate_results(name, badge_description, badge_image, rank, team, handle, index, score, kills, deaths, suicides, disconnected) 
  805. 	local num_players = Mp_completion.results.num_players 
  806. 	local current = Mp_completion.results[num_players] 
  807. 	 
  808. 	current.sort_value = score 
  809. 	current.team = team 
  810. 	current.badge_image = badge_image 
  811. 	 
  812. 	if badge_description == 0 then 
  813. 		current.badge_name = Mp_completion_rank_badge_tag[rank] 
  814. 	else 
  815. 		current.badge_name = Mp_completion_badge_description_tags[badge_description] 
  816. 	end 
  817.  
  818. 	current.name = name 
  819. 	 
  820. 	current.score = format_cash(score) 
  821. 	 
  822. 	if Mp_completion.general.gametype == "Braveheart" then 
  823. 		current.score = "$" .. current.score 
  824. 	end 
  825. 	 
  826. 	current.kills = format_cash(kills) 
  827. 	current.deaths = format_cash(deaths) 
  828. 	 
  829. 	if suicides ~= nil then 
  830. 		current.suicides = format_cash(suicides) 
  831. 	end 
  832.  
  833. 	current.enabled = true 
  834. 	current.handle = handle 
  835. 	current.index = index 
  836. 	 
  837. 	current.disconnected = disconnected 
  838. 	 
  839. 	Mp_completion.results.num_players = num_players + 1 
  840. end 
  841.  
  842. function mp_completion_update_result_selection(old_idx) 
  843. 	vint_set_property(Mp_completion.results[old_idx].over.grp_h, "visible", false) 
  844. 	vint_set_property(Mp_completion.results[old_idx].stripe, "visible", false) 
  845. 	vint_set_property(Mp_completion.results[Mp_completion.results.cur_idx].over.grp_h, "visible", true) 
  846. 	vint_set_property(Mp_completion.results[Mp_completion.results.cur_idx].stripe, "visible", true) 
  847. end 
  848.  
  849. function mp_completion_swap_result(item1, item2) 
  850. 	local temp	 
  851.  
  852. 	temp = item2.sort_value 
  853. 	item2.sort_value = item1.sort_value 
  854. 	item1.sort_value = temp 
  855.  
  856. 	temp = item2.team 
  857. 	item2.team = item1.team 
  858. 	item1.team = temp 
  859.  
  860. 	temp = item2.badge_image 
  861. 	item2.badge_image = item1.badge_image 
  862. 	item1.badge_image = temp 
  863.  
  864. 	temp = item2.badge_name 
  865. 	item2.badge_name = item1.badge_name 
  866. 	item1.badge_name = temp 
  867.  
  868. 	temp = item2.name 
  869. 	item2.name = item1.name 
  870. 	item1.name = temp 
  871.  
  872. 	temp = item2.score 
  873. 	item2.score = item1.score 
  874. 	item1.score = temp 
  875.  
  876. 	temp = item2.kills 
  877. 	item2.kills = item1.kills 
  878. 	item1.kills = temp 
  879.  
  880. 	temp = item2.deaths 
  881. 	item2.deaths = item1.deaths 
  882. 	item1.deaths = temp 
  883.  
  884. 	temp = item2.suicides 
  885. 	item2.suicides = item1.suicides 
  886. 	item1.suicides = temp 
  887. 	 
  888. 	temp = item2.enabled 
  889. 	item2.enabled = item1.enabled 
  890. 	item1.enabled = temp 
  891. 	 
  892. 	temp = item2.handle 
  893. 	item2.handle = item1.handle 
  894. 	item1.handle = temp 
  895.  
  896. 	temp = item2.index 
  897. 	item2.index = item1.index 
  898. 	item1.index = temp 
  899. 	 
  900. 	temp = item2.disconnected 
  901. 	item2.disconnected = item1.disconnected 
  902. 	item1.disconnected = temp 
  903.  
  904. end 
  905.  
  906. function mp_completion_sort_results() 
  907. 	local to_sort = Mp_completion.results 
  908. 	 
  909. 	local temp 
  910. 	local flag = false 
  911. 	 
  912. 	if Mp_completion.general.gametype ~= "Braveheart" then 
  913. 		while flag == false do 
  914. 			flag = true 
  915. 			for i = 0, Mp_completion.results.num_players - 2 do 
  916. 				if to_sort[i].sort_value < to_sort[i + 1].sort_value or (to_sort[i].sort_value == to_sort[i + 1].sort_value and  to_sort[i].deaths > to_sort[i + 1].deaths) then 
  917. 					mp_completion_swap_result(to_sort[i], to_sort[i + 1]) 
  918. 					flag = false 
  919. 					i = Mp_completion.results.num_players 
  920. 				end 
  921. 			end 
  922. 		end 
  923. 	else 
  924. 		local team 
  925. 		for i = 0, 1 do 
  926. 			if i == 0 then 
  927. 				team = true 
  928. 			else 
  929. 				team = false 
  930. 			end 
  931. 		 
  932. 			flag = false 
  933. 			while flag == false do 
  934. 				flag = true 
  935. 				for j = 0, Mp_completion.results.num_players - 2 do 
  936. 					if to_sort[j].team == team and to_sort[j + 1].team == team then 
  937. 						if to_sort[j].sort_value < to_sort[j + 1].sort_value or (to_sort[j].sort_value == to_sort[j + 1].sort_value and  to_sort[j].deaths > to_sort[j + 1].deaths) then 
  938. 							mp_completion_swap_result(to_sort[j], to_sort[j + 1]) 
  939. 							flag = false 
  940. 							j = Mp_completion.results.num_players 
  941. 						end 
  942. 					end 
  943. 				end 
  944. 			end 
  945. 		end 
  946. 	end 
  947. 	 
  948. 	mp_completion_set_result_properties() 
  949. end 
  950.  
  951. function mp_completion_set_result_properties() 
  952. 	for i = 0, Mp_completion.results.num_players - 1 do 
  953. 		local current = Mp_completion.results[i] 
  954. 		vint_set_property(current.badge, "image", current.badge_image) 
  955. 		 
  956. 		vint_set_property(current.under.badge_name, "text_tag", current.badge_name) 
  957. 		vint_set_property(current.over.badge_name, "text_tag", current.badge_name) 
  958. 	 
  959. 		vint_set_property(current.under.name, "text_tag", current.name) 
  960. 		vint_set_property(current.over.name, "text_tag", current.name)	 
  961.  
  962. 		if Mp_completion.general.gametype ~= "Braveheart" then 
  963. 			-- Show 4 columns (everything) 
  964. 			vint_set_property(current.under.amt_1, "text_tag",  current.kills) 
  965. 			vint_set_property(current.over.amt_1, "text_tag",  current.kills) 
  966.  
  967. 			vint_set_property(current.under.amt_2, "text_tag", current.deaths) 
  968. 			vint_set_property(current.over.amt_2, "text_tag", current.deaths) 
  969. 		 
  970. 			vint_set_property(current.under.amt_3, "text_tag", current.suicides) 
  971. 			vint_set_property(current.over.amt_3, "text_tag", current.suicides) 
  972.  
  973. 			vint_set_property(current.under.amt_4, "text_tag", current.score) 
  974. 			vint_set_property(current.over.amt_4, "text_tag", current.score) 
  975.  
  976. 		else 
  977. 			-- Strong Arm 
  978. 			vint_set_property(current.under.amt_1, "text_tag",  current.score) 
  979. 			vint_set_property(current.over.amt_1, "text_tag",  current.score) 
  980.  
  981. 			vint_set_property(current.under.amt_2, "text_tag", current.kills) 
  982. 			vint_set_property(current.over.amt_2, "text_tag", current.kills) 
  983. 		 
  984. 			vint_set_property(current.under.amt_3, "text_tag", current.deaths) 
  985. 			vint_set_property(current.over.amt_3, "text_tag", current.deaths) 
  986. 		end 
  987.  
  988. 		if current.team == true then 
  989. 			vint_set_property(current.under.name, "tint", .27, .51, .84) 
  990. 			vint_set_property(current.speaker, "tint", .27, .51, .84) 
  991. 		else 
  992. 			vint_set_property(current.under.name, "tint", .71, 0, 0) 
  993. 			vint_set_property(current.speaker, "tint", .71, 0, 0) 
  994. 		end 
  995. 		 
  996. 		vint_set_property(Mp_completion.results[i].player, "visible", true) 
  997. 		vint_set_property(Mp_completion.results[i].under.grp_h, "visible", true) 
  998. 		 
  999. 		if current.disconnected == true then 
  1000. 			vint_set_property(current.badge, "visible", false) 
  1001. 			local insert = { [0] = "MULTI_LOBBY_DISCONNECTED" } 
  1002. 			local text = vint_insert_values_in_string("({0})", insert) 
  1003. 			vint_set_property(current.under.badge_name, "text_tag", text) 
  1004. 			vint_set_property(current.over.badge_name, "text_tag", text) 
  1005.  
  1006. 			vint_set_property(Mp_completion.results[i].under.grp_h, "alpha", 0.7) 
  1007. 		else 
  1008. 			vint_set_property(Mp_completion.results[i].under.grp_h, "alpha", 1) 
  1009. 		end 
  1010. 	end 
  1011. end 
  1012.  
  1013. ------------------------ 
  1014. -- Screen Management 
  1015. function mp_completion_show_general() 
  1016. 	vint_set_property(Mp_completion.handles.tip_2, "visible", false) 
  1017. 	vint_set_property(Mp_completion.handles.btn_2, "visible", false) 
  1018. 	vint_set_property(Mp_completion.handles.tip_3, "visible", false) 
  1019. 	vint_set_property(Mp_completion.handles.btn_3, "visible", false) 
  1020.  
  1021. 	Mp_completion.handles.screen = "general" 
  1022. 	vint_set_property(Mp_completion.handles.page_1, "visible", true) 
  1023. 	 
  1024. 	Mp_completion_is_animating = true 
  1025. 	Mp_completion_force_skip = false 
  1026. 	 
  1027. 	 
  1028. 	--################# 
  1029. 	--BUTTON INPUTS HERE 
  1030. 	--################# 
  1031. 	 
  1032. 	if Mp_completion_is_animating == false then 
  1033. 		-- place button inputs here plskthxbye 
  1034. 	end 
  1035.  
  1036. 	--################# 
  1037. 	--top stuff and scores 
  1038. 	--################# 
  1039.  
  1040. 	mp_completion_do_team_scores() 
  1041. 	 
  1042. 	--################# 
  1043. 	--awards 
  1044. 	--################# 
  1045.  
  1046. 	mp_completion_do_awards() 
  1047. 	 
  1048. 	--################# 
  1049. 	--placement 
  1050. 	--#################	 
  1051. 	 
  1052. 	--Mp_completion.handles.award_1 
  1053. 	--Mp_completion.handles.team_blue 
  1054. 	--Mp_completion.handles.blue_score 
  1055. 	--Mp_completion.handles.tips 
  1056. 	 
  1057. 	--Mp_completion.awards.num_awards = 4 
  1058. 	 
  1059. 	--set the awards 
  1060. 	local awardsx, awardsy = vint_get_property(Mp_completion.handles.awards, "anchor") 
  1061. 	 
  1062. 	if Mp_completion.general.gametype == "Gangsta Brawl" then 
  1063. 		vint_set_property(Mp_completion.handles.awards, "anchor", 0, awardsy + 20) 
  1064. 	else 
  1065. 		vint_set_property(Mp_completion.handles.blue_rank, "visible", false) 
  1066. 		vint_set_property(Mp_completion.handles.red_rank, "visible", false) 
  1067. 	end 
  1068. 	 
  1069. 	--move the 'kills' text next to the number 
  1070. 	mp_completion_move_kill_text() 
  1071. 	 
  1072. 	if Mp_completion.general.gametype == "Braveheart" then 
  1073. 		vint_set_property(Mp_completion.handles.blue_kills, "visble", false) 
  1074. 		vint_set_property(Mp_completion.handles.red_kills, "visble", false) 
  1075. 	end 
  1076. 	 
  1077. 	--move the tips based on the heights and anchors of the awards 
  1078. 	mp_completion_move_page_1_tips() 
  1079. 	 
  1080. 	 
  1081. 	--################# 
  1082. 	--animations 
  1083. 	--################# 
  1084. 	mp_completion_fade_in_wall_and_top() 
  1085. 	 
  1086. 	if Mp_completion.general.gametype == "Braveheart" then 
  1087. 		mp_completion_team_blue_anim(2) 
  1088. 		local tween_h = vint_object_find("team_blue_ender", Mp_completion.handles.team_blue_anim) 
  1089. 		vint_set_property(tween_h, "end_event", "mp_completion_animate_blue_cash") 
  1090. 	elseif Mp_completion.general.gametype == "Team Gangsta Brawl" then 
  1091. 		mp_completion_team_blue_slam_anim(2) 
  1092. 		if Mp_completion.general.opponents_left == false then 
  1093. 			mp_completion_team_red_slam_anim(2.75) 
  1094. 			mp_completion_awards_anim(3.25) 
  1095. 		else 
  1096. 			mp_completion_awards_anim(2.75) 
  1097. 		end 
  1098. 		local tween_h = vint_object_find("awards_ender", Mp_completion.handles.awards_anim) 
  1099. 		vint_set_property(tween_h, "end_event", "mp_completion_tips_fade_in") 
  1100. 	elseif Mp_completion.general.gametype == "Gangsta Brawl" then 
  1101. 		mp_completion_team_blue_slam_anim(2) 
  1102. 		if Mp_completion.general.opponents_left == false then 
  1103. 			mp_completion_team_red_slam_anim(2.75) 
  1104. 			mp_completion_awards_anim(3.25) 
  1105. 		else 
  1106. 			mp_completion_awards_anim(2.75) 
  1107. 		end 
  1108. 		 
  1109. 		local tween_h = vint_object_find("awards_ender", Mp_completion.handles.awards_anim) 
  1110. 		vint_set_property(tween_h, "end_event", "mp_completion_tips_fade_in") 
  1111. 	end 
  1112. 	 
  1113. 	if Mp_completion.badges.num_badges == 0 then 
  1114. 		--skip the badges screen if i don't have any badges 
  1115. 		Mp_completion.screen_idx = Mp_completion.screen_idx + 1 
  1116. 	end 
  1117. 	 
  1118. end 
  1119.  
  1120. function mp_completion_move_kill_text() 
  1121. 	local rsx, rsy = vint_get_property(Mp_completion.handles.red_score, "anchor") --red score anchor 
  1122. 	local rsw, rsh = element_get_actual_size(Mp_completion.handles.red_score, "screen_size")	--red score size 
  1123. 	local bsx, bsy = vint_get_property(Mp_completion.handles.blue_score, "anchor") --blue score anchor 
  1124. 	local bsw, bsh = element_get_actual_size(Mp_completion.handles.blue_score, "screen_size") --blue score size 
  1125. 	local gap = 14 
  1126. 	 
  1127. 	local bkw, bkh = vint_get_property(Mp_completion.handles.blue_kills, "screen_size") 
  1128. 	 
  1129. --	debug_print("vint", "bsx,bsy : " .. var_to_string(bsx) .. ", " .. var_to_string(bsy) .. "\n") 
  1130. --	debug_print("vint", "bsw,bsh : " .. var_to_string(bkw) .. ", " .. var_to_string(bkh) .. "\n") 
  1131. 	 
  1132. 	--set blue kills position 
  1133. 	vint_set_property(Mp_completion.handles.blue_kills, "anchor", bsx + bsw + gap, bsy) 
  1134. 	 
  1135. 	--set red kils position 
  1136. 	vint_set_property(Mp_completion.handles.red_kills, "anchor", rsx + rsw + gap, rsy) 
  1137. 	 
  1138. end 
  1139.  
  1140.  
  1141.  
  1142. function mp_completion_move_page_1_tips() 
  1143.  
  1144. 	--figure out all the positions and sizes 
  1145. 	local page1y = 246 
  1146. 	local page1h = 294 
  1147. 	local awards_y = 116 
  1148. 	local basic_gap = 30 
  1149. 	local awards_gap = 58 
  1150. 	local btn_h = 17 
  1151. 	local tipsx, tipsy = vint_get_property(Mp_completion.handles.tips, "anchor") 
  1152. 	 
  1153. 	--here's the equation of the X anchor to use for the tips placement 
  1154. 	local contentheight = page1y + awards_y + basic_gap + btn_h + (awards_gap * Mp_completion.awards.num_awards) 
  1155. 	--debug_print("vint", "y: " .. var_to_string(page1y) .. ", h: " .. var_to_string(page1h)	.. "\n") 
  1156. 	vint_set_property(Mp_completion.handles.tips, "anchor", tipsx, contentheight) 
  1157.  
  1158. end 
  1159.  
  1160. function mp_completion_do_team_scores() 
  1161. 	--enter the gametype 
  1162. 	local game_type_display_name = 0 
  1163. 	 
  1164. 	if Mp_completion.general.gametype == "Braveheart" then 
  1165. 		game_type_display_name = "MULTI_MODE_STRONGARM_ALL_CAPS" 
  1166. 	elseif Mp_completion.general.gametype == "Team Gangsta Brawl" then 
  1167. 		game_type_display_name = "MULTI_MODE_ALL_CAPS_14" 
  1168. 	else 
  1169. 		game_type_display_name = "MULTI_MODE_ALL_CAPS_13" 
  1170. 	end 
  1171. 	 
  1172. --local insertion_text2 	= { [0] = mission_name } 
  1173. --local subtitle = vint_insert_values_in_string("COMPLETION_MISSION_COMPLETE", insertion_text2 ) 
  1174. 	 
  1175. 	vint_set_property(Mp_completion.handles.top_1, "text_tag", game_type_display_name) --fake data 
  1176. 	 
  1177. 	--enter the map name 
  1178. 	vint_set_property(Mp_completion.handles.top_2, "text_tag", Mp_completion.general.map) --fake data 
  1179.  
  1180. 	--who won? 
  1181. 	if Mp_completion.general.gametype == "Braveheart" or Mp_completion.general.gametype == "Team Gangsta Brawl" then 
  1182. 		--STRONG ARM, or TEAM GANGSTA BRAWL 
  1183. 		if Mp_completion.general.winner == true then 
  1184. 			local insertion_text2 	= { [0] = "MULTI_MATCHMAKING_YOUR_TEAM" } 
  1185. 			local subtitle = vint_insert_values_in_string("MP_GAME_WON_ICASE", insertion_text2 ) 
  1186. 			vint_set_property(Mp_completion.handles.top_3, "text_tag", subtitle) 
  1187. 			vint_set_property(Mp_completion.handles.top_3, "tint", MP_COMPLETION_BLUE.r, MP_COMPLETION_BLUE.g, MP_COMPLETION_BLUE.b) 
  1188. 		else 
  1189. 			local insertion_text2 	= { [0] = "MULTI_MATCHMAKING_OPPONENTS" } 
  1190. 			local subtitle = vint_insert_values_in_string("MP_GAME_WON_ICASE", insertion_text2 ) 
  1191. 			vint_set_property(Mp_completion.handles.top_3, "text_tag", subtitle) 
  1192. 			vint_set_property(Mp_completion.handles.top_3, "tint", MP_COMPLETION_RED.r, MP_COMPLETION_RED.g, MP_COMPLETION_RED.b) 
  1193. 		end 
  1194. 	else 
  1195. 		--FREE FOR ALL 
  1196. 		if Mp_completion.general.winner == true then 
  1197. 			local insertion_text2 	= { [0] = "GENERAL_YOU" } 
  1198. 			local subtitle = vint_insert_values_in_string("MP_GAME_WON_ICASE", insertion_text2 ) 
  1199. 			vint_set_property(Mp_completion.handles.top_3, "text_tag", subtitle) 
  1200. 			vint_set_property(Mp_completion.handles.top_3, "tint", MP_COMPLETION_BLUE.r, MP_COMPLETION_BLUE.g, MP_COMPLETION_BLUE.b) 
  1201. 		else 
  1202. 			local insertion_text2 	= { [0] = "GENERAL_YOU" } 
  1203. 			local subtitle = vint_insert_values_in_string("MP_GAME_LOST_ICASE", insertion_text2 ) 
  1204. 			vint_set_property(Mp_completion.handles.top_3, "text_tag", subtitle) 
  1205. 			vint_set_property(Mp_completion.handles.top_3, "tint", MP_COMPLETION_RED.r, MP_COMPLETION_RED.g, MP_COMPLETION_RED.b) 
  1206. 		end 
  1207.  
  1208. 	end 
  1209. 	 
  1210. 	--set up team score name tags 
  1211. 	if Mp_completion.general.gametype == "Braveheart" then	 
  1212. 		--format blue team score 
  1213. 		vint_set_property(Mp_completion.handles.blue_name, "text_tag", "MULTI_MATCHMAKING_YOUR_TEAM") 
  1214. 		vint_set_property(Mp_completion.handles.blue_score, "text_tag", "$0") 
  1215.  
  1216. 		--format red team score 
  1217. 		vint_set_property(Mp_completion.handles.red_name, "text_tag", "MULTI_MATCHMAKING_OPPONENTS") 
  1218. 		vint_set_property(Mp_completion.handles.red_score, "text_tag", "$0") 
  1219. 		 
  1220. 	elseif Mp_completion.general.gametype == "Team Gangsta Brawl" then		 
  1221. 		vint_set_property(Mp_completion.handles.blue_name, "text_tag", "MULTI_MATCHMAKING_YOUR_TEAM") 
  1222. 		vint_set_property(Mp_completion.handles.blue_score, "text_tag", format_cash(Mp_completion.general.player_score)) 
  1223. 		vint_set_property(Mp_completion.handles.red_name, "text_tag", "MULTI_MATCHMAKING_OPPONENTS") 
  1224. 		vint_set_property(Mp_completion.handles.red_score, "text_tag", format_cash(Mp_completion.general.other_score)) 
  1225. 		 
  1226. 	elseif Mp_completion.general.gametype == "Gangsta Brawl" then	 
  1227. 		vint_set_property(Mp_completion.handles.blue_name, "text_tag", Mp_completion.general.player_name) 
  1228. 		vint_set_property(Mp_completion.handles.blue_score, "text_tag", format_cash(Mp_completion.general.player_score)) 
  1229. 		vint_set_property(Mp_completion.handles.blue_rank, "text_tag", Mp_completion.general.player_position) 
  1230. 		 
  1231. 		vint_set_property(Mp_completion.handles.red_name, "text_tag", Mp_completion.general.other_name) 
  1232. 		vint_set_property(Mp_completion.handles.red_score, "text_tag", format_cash(Mp_completion.general.other_score)) 
  1233. 		vint_set_property(Mp_completion.handles.red_rank, "text_tag", Mp_completion.general.other_position) 
  1234. 	--	vint_set_property(Mp_completion.handles.team_red, "visible", true) 
  1235. 	end 
  1236. end 
  1237.  
  1238. function mp_completion_do_awards() 
  1239. 	local awards = Mp_completion.awards 
  1240. 	for i = 0, awards.num_awards - 1 do 
  1241. 		vint_set_property(Mp_completion.handles.a[i].grp, "visible", true) 
  1242. 		 
  1243. 		--enter the text 
  1244. 		vint_set_property(Mp_completion.handles.a[i].handle_1, "text_tag", awards[i].player) 
  1245. 		vint_set_property(Mp_completion.handles.a[i].handle_2, "text_tag", awards[i].text) 
  1246. 		vint_set_property(Mp_completion.handles.a[i].handle_3, "text_tag", awards[i].description) 
  1247. 		 
  1248. 		--color the player name 
  1249. 		if awards[i].team == true then 
  1250. 			vint_set_property(Mp_completion.handles.a[i].handle_1, "tint", MP_COMPLETION_BLUE.r, MP_COMPLETION_BLUE.g, MP_COMPLETION_BLUE.b) 
  1251. 		else 
  1252. 			vint_set_property(Mp_completion.handles.a[i].handle_1, "tint", MP_COMPLETION_RED.r, MP_COMPLETION_RED.g, MP_COMPLETION_RED.b) 
  1253. 		end 
  1254. 		 
  1255. 		--adjust the text position 
  1256. 		local x, y =  element_get_actual_size(Mp_completion.handles.a[i].handle_1) 
  1257. 		vint_set_property(Mp_completion.handles.a[i].handle_2, "anchor", x + 7, 0) 
  1258. 	end 
  1259. end 
  1260.  
  1261. function mp_completion_animate_blue_cash() 
  1262.    thread_new("mp_completion_animate_blue_cash_thread") 
  1263. end 
  1264.  
  1265. function mp_completion_animate_blue_cash_thread() 
  1266. 	 
  1267. 	--Are we going to skip this? 
  1268. 	if Mp_completion_force_skip == true then 
  1269. 		Mp_completion_force_skip = false 
  1270. 		return 
  1271. 	end 
  1272. 		 
  1273. 	--init stuff 
  1274. 	local start_cash = 0 
  1275. 	local cash_this_frame = -1 
  1276. 	local is_complete = false 
  1277.  
  1278. 	--get the variables from the global 
  1279. 	local cash = Mp_completion.general.player_score 
  1280. 	 
  1281. 	local amt_min = 0 
  1282. 	local amt_max = 0 
  1283. 	 
  1284. 	--figure out whose score is higher 
  1285. 	if Mp_completion.general.player_score > Mp_completion.general.other_score then 
  1286. 		amt_max = Mp_completion.general.player_score 
  1287. 	else 
  1288. 		amt_max = Mp_completion.general.other_score 
  1289. 	end 
  1290. 	 
  1291. 	local time_min = 300 
  1292. 	local time_max = 2999 
  1293. 	local init_time = floor(vint_get_time_index() * 1000) 
  1294. 	local cur_time = init_time 
  1295. 	local time_to_count = floor(time_max * (cash / amt_max)) 
  1296. 	 
  1297. 	if time_to_count > time_max then 
  1298. 		time_to_count = time_max 
  1299. 	end 
  1300.  
  1301. 	--init sound IDs 
  1302. 	local activity_cash_count = 0 
  1303. 	local activity_cash_hit = 0 
  1304. 	 
  1305. 	if cash > 0 then 
  1306. 		activity_cash_count = audio_play(Mp_completion_audio.cash_count) 
  1307. 	end 
  1308. 	 
  1309. 	while is_complete == false do 
  1310. 		local cur_time = floor(vint_get_time_index() * 1000) - init_time 
  1311. 		 
  1312. 		--Are we going to skip this? 
  1313. 		if Mp_completion_force_skip == true then 
  1314. 			Mp_completion_force_skip = false 
  1315. 			audio_fade_out(activity_cash_count, 50) 
  1316. 			audio_fade_out(activity_cash_hit, 50) 
  1317. 			return 
  1318. 		end 
  1319. 		 
  1320. 		cash_this_frame = cash * (cur_time / time_to_count) 
  1321. 		vint_set_property(Mp_completion.handles.blue_score, "text_tag", "$" .. format_cash(cash_this_frame)) 
  1322. 		 
  1323. 		if cur_time >= time_to_count then 
  1324. 			is_complete = true 
  1325. 			audio_fade_out(activity_cash_count, 50) 
  1326. 			activity_cash_hit = audio_play(Mp_completion_audio.cash_hit) 
  1327. 			vint_set_property(Mp_completion.handles.blue_score, "text_tag", "$" .. format_cash(cash)) 
  1328. 					 
  1329. 			if Mp_completion.general.opponents_left == false then 
  1330. 				mp_completion_team_red_anim() 
  1331. 				local tween_h = vint_object_find("team_red_ender", Mp_completion.handles.team_red_anim) 
  1332. 				vint_set_property(tween_h, "end_event", "mp_completion_animate_red_cash") 
  1333. 			else 
  1334. 				mp_completion_awards_anim() 
  1335. 				local tween_h = vint_object_find("awards_ender", Mp_completion.handles.awards_anim) 
  1336. 				vint_set_property(tween_h, "end_event", "mp_completion_tips_fade_in") 
  1337. 			 
  1338. 				mp_completion_tips_fade_in_offset(.5) 
  1339. 			end 
  1340. 		end 
  1341. 		thread_yield() 
  1342. 	end		 
  1343. end 
  1344.  
  1345. function mp_completion_animate_red_cash() 
  1346.    thread_new("mp_completion_animate_red_cash_thread") 
  1347. end 
  1348.  
  1349. function mp_completion_animate_red_cash_thread() 
  1350. 	 
  1351. 	--Are we going to skip this? 
  1352. 	if Mp_completion_force_skip == true then 
  1353. 		Mp_completion_force_skip = false 
  1354. 		return 
  1355. 	end 
  1356. 		 
  1357. 	--init stuff 
  1358. 	local start_cash = 0 
  1359. 	local cash_this_frame = -1 
  1360. 	local is_complete = false 
  1361.  
  1362. 	--get the variables from the global 
  1363. 	local cash = Mp_completion.general.other_score 
  1364. 	 
  1365. 	local amt_min = 0 
  1366. 	local amt_max = 0 
  1367. 	 
  1368. 	--figure out whose score is higher 
  1369. 	if Mp_completion.general.player_score > Mp_completion.general.other_score then 
  1370. 		amt_max = Mp_completion.general.player_score 
  1371. 	else 
  1372. 		amt_max = Mp_completion.general.other_score 
  1373. 	end 
  1374. 	 
  1375. 	local time_min = 300 
  1376. 	local time_max = 2999 
  1377. 	local init_time = floor(vint_get_time_index() * 1000) 
  1378. 	local cur_time = init_time 
  1379. 	local time_to_count = floor(time_max * (cash / amt_max)) 
  1380. 	 
  1381. 	if time_to_count > time_max then 
  1382. 		time_to_count = time_max 
  1383. 	end 
  1384.  
  1385. 	--init sound IDs 
  1386. 	local activity_cash_count = 0 
  1387. 	local activity_cash_hit = 0 
  1388. 	 
  1389. 	if cash > 0 then 
  1390. 		activity_cash_count = audio_play(Mp_completion_audio.cash_count) 
  1391. 	end 
  1392. 	 
  1393. 	while is_complete == false do 
  1394. 		local cur_time = floor(vint_get_time_index() * 1000) - init_time 
  1395. 		 
  1396. 		--Are we going to skip this? 
  1397. 		if Mp_completion_force_skip == true then 
  1398. 			Mp_completion_force_skip = false 
  1399. 			audio_fade_out(activity_cash_count, 50) 
  1400. 			audio_fade_out(activity_cash_hit, 50) 
  1401. 			return 
  1402. 		end 
  1403. 		 
  1404. 		cash_this_frame = cash * (cur_time / time_to_count) 
  1405. 		vint_set_property(Mp_completion.handles.red_score, "text_tag", "$" .. format_cash(cash_this_frame)) 
  1406. 		 
  1407. 		if  cur_time >= time_to_count then 
  1408. 			vint_set_property(Mp_completion.handles.red_score, "text_tag", "$" .. format_cash(cash)) 
  1409. 			is_complete = true 
  1410. 			 
  1411. 			mp_completion_awards_anim() 
  1412. 			local tween_h = vint_object_find("awards_ender", Mp_completion.handles.awards_anim) 
  1413. 			vint_set_property(tween_h, "end_event", "mp_completion_tips_fade_in") 
  1414. 		end 
  1415. 		thread_yield() 
  1416. 	end	 
  1417. end 
  1418.  
  1419.  
  1420. function mp_completion_show_badges() 
  1421.  
  1422. 	vint_set_property(Mp_completion.handles.tip_2, "visible", false) 
  1423. 	vint_set_property(Mp_completion.handles.btn_2, "visible", false) 
  1424. 	vint_set_property(Mp_completion.handles.tip_3, "visible", false) 
  1425. 	vint_set_property(Mp_completion.handles.btn_3, "visible", false) 
  1426. 	 
  1427. 	Mp_completion.handles.screen = "badges" 
  1428. 	 
  1429. 	vint_set_property(Mp_completion.handles.page_2, "visible", true) 
  1430. 	 
  1431. 	Mp_completion_is_animating = true 
  1432. 	Mp_completion_force_skip = false 
  1433.  
  1434. 	if Mp_completion.start_idx == 0 then 
  1435. 	--fade out page 1 
  1436. 		mp_completion_page_1_fade_out() 
  1437. 	elseif Mp_completion_badges_again == true then 
  1438. 		mp_completion_turn_off_badges() 
  1439. 	end 
  1440.  
  1441. 	Mp_completion.input_block = true 
  1442. 	 
  1443. 	--do the badges 
  1444. 	if Mp_completion.badges.num_badges > 9 and Mp_completion_badges_again == false then 
  1445. 		Mp_completion.end_idx = 9 
  1446. 	else 
  1447. 		Mp_completion.end_idx = Mp_completion.badges.num_badges - 1 
  1448. 	end 
  1449. 	 
  1450. 	local start_idx = Mp_completion.start_idx 
  1451. 	local end_idx = Mp_completion.end_idx 
  1452. 	 
  1453. 	--fade in the unlocks 
  1454. 	mp_completion_unlock_fade_in(.25) 
  1455. 	mp_completion_badges_anim(.75) 
  1456. 	mp_completion_tips_fade_in_offset(1.25) 
  1457. 	 
  1458. 	 
  1459. 	local tween = vint_object_find("unlock_alpha", Mp_completion.handles.unlocked_rewards_anim) 
  1460. 	vint_set_property(tween, "start_event", "mp_completion_input_unblock") 
  1461. 	 
  1462. 	local tween = vint_object_find("badges_alpha", Mp_completion.handles.badges_anim) 
  1463. 	vint_set_property(tween, "start_event", "mp_completion_do_badges") 
  1464. 	 
  1465. 	local tween = vint_object_find("unlock_scale", Mp_completion.handles.unlocked_rewards_anim) 
  1466. 	vint_set_property(tween, "start_event", "mp_completion_move_page_2_tips") 
  1467. 	 
  1468.  
  1469. 	 
  1470. end 
  1471.  
  1472. function mp_completion_input_unblock() 
  1473. 	Mp_completion.input_block = false 
  1474. end 
  1475.  
  1476. function mp_completion_do_badges(start_idx, end_idx) 
  1477. 	if Mp_completion_badges_done == false then 
  1478.  
  1479. 		local badges = Mp_completion.badges 
  1480. 		local start_idx = Mp_completion.start_idx 
  1481. 		local end_idx = Mp_completion.end_idx 
  1482. 		 
  1483. 		for i = start_idx, end_idx do 
  1484. 			vint_set_property(Mp_completion.handles.bdg[i].handle_1, "visible", true) 
  1485. 			vint_set_property(Mp_completion.handles.bdg[i].handle_2, "visible", true) 
  1486. 			 
  1487. 			--enter the image and text 
  1488. 			vint_set_property(Mp_completion.handles.bdg[i].handle_1, "image", badges[i].image) 
  1489. 			vint_set_property(Mp_completion.handles.bdg[i].handle_2, "text_tag", badges[i].description) 
  1490. 		end 
  1491. 		 
  1492. 		Mp_completion_badges_done = true 
  1493.  
  1494. 		if Mp_completion_badges_again == true then 
  1495. 			--Mp_completion_badges_again = false 
  1496. 			Mp_completion.badges.num_badges = 1 
  1497. 		end 
  1498. 		 
  1499. 		if Mp_completion.badges.num_badges > 10 then 
  1500. 			Mp_completion.start_idx = 10 
  1501. 			Mp_completion.end_idx = Mp_completion.badges.num_badges - 1 
  1502. 			Mp_completion_badges_again = true 
  1503. 		else 
  1504. 			Mp_completion_badges_again = false 
  1505. 		end 
  1506. 	 
  1507. 	end 
  1508.  
  1509. end 
  1510.  
  1511. function mp_completion_move_page_2_tips() 
  1512. 	--figure out all the positions and sizes 
  1513. 	local page2x, page2y = vint_get_property(Mp_completion.handles.page_2, "anchor") 
  1514. 	local page2w, page2h = vint_get_property(Mp_completion.handles.page_2, "screen_size") 
  1515. 	local tipsx, tipsy = vint_get_property(Mp_completion.handles.tips, "anchor") 
  1516. 	local badge_places = Mp_completion.end_idx + 1 
  1517. 	 
  1518. 	if badge_places < 6 then 
  1519. 		--do nothing :D 
  1520. 	elseif badge_places > 10 and badge_places < 16 then 
  1521. 		badge_places = badge_places - 10 
  1522. 	else 
  1523. 		badge_places = 5 
  1524. 	end 
  1525. 	 
  1526. 	--here's the equation of the X anchor to use for the tips placement 
  1527. 	local contentheight = 597 - ((5 - badge_places) * 60) 
  1528. 	 
  1529. 	vint_set_property(Mp_completion.handles.tips, "anchor", tipsx, contentheight) 
  1530. end 
  1531.  
  1532. function mp_completion_show_voip(di_h, event) 
  1533. 	 
  1534. 	local player_index, voip_state = vint_dataitem_get(di_h) 
  1535. 	 
  1536. 	local result = nil 
  1537. 	 
  1538. 	for i = 0, Mp_completion.results.num_players - 1 do 
  1539. 		if Mp_completion.results[i].index == player_index then 
  1540. 			result = Mp_completion.results[i] 
  1541. 			i = Mp_completion.results.num_players 
  1542. 		end 
  1543. 	end 
  1544. 	 
  1545. 	-- How'd this happen? 
  1546. 	if result == nil then 
  1547. 		return 
  1548. 	end 
  1549. 	 
  1550. 	if voip_state == 0 then 
  1551. 		vint_set_property(result.speaker, "visible", false) 
  1552. 	elseif voip_state == 1 then 
  1553. 		vint_set_property(result.speaker, "visible", true) 
  1554. 		vint_set_property(result.speaker, "image", "mp_speaker_off") 
  1555. 	elseif voip_state == 2 then 
  1556. 		vint_set_property(result.speaker, "visible", true) 
  1557. 		vint_set_property(result.speaker, "image", "mp_speaker_on") 
  1558. 	end 
  1559. end 
  1560.  
  1561. function mp_completion_show_results() 
  1562.  
  1563. 	Mp_completion.handles.screen = "results" 
  1564. 	vint_dataresponder_request("mp_completion_populate", "mp_completion_populate_results", 0, "mp_completion_results") 
  1565. 	vint_datagroup_add_subscription("mp_completion_voice", "insert", "mp_completion_show_voip") 
  1566. 	vint_datagroup_add_subscription("mp_completion_voice", "update", "mp_completion_show_voip") 
  1567. 	vint_datagroup_add_subscription("mp_completion_voice", "remove", "mp_completion_show_voip") 
  1568. 	 
  1569. 	mp_completion_sort_results() 
  1570. 	 
  1571. 	--local results_w, results_h = element_get_actual_size(Mp_completion.handles.page_3) 
  1572. 	vint_set_property(Mp_completion.handles.page_3, "visible", true) 
  1573. 	 
  1574. 	local num_players = Mp_completion.results.num_players 
  1575. 	local new_y = 320 - (22 * num_players) 
  1576. 	vint_set_property(Mp_completion.handles.page_3, "anchor", 184, new_y - 30) 
  1577. 	 
  1578. 	Mp_completion.input_block = true 
  1579. 	 
  1580. 	mp_completion_update_result_selection(0) 
  1581. 	Mp_completion_is_animating = true 
  1582. 	Mp_completion_force_skip = false 
  1583.  
  1584. 	--fade out page 1 or 2? 
  1585. 	if Mp_completion.badges.num_badges == 0 then 
  1586. 		mp_completion_page_1_skip_2_fade_out() 
  1587. 	else 
  1588. 		mp_completion_page_2_fade_out() 
  1589. 	end 
  1590. 		 
  1591. 	mp_completion_page_3_anim(.25) 
  1592. 	mp_completion_tips_fade_in_offset(.5) 
  1593. 	 
  1594. 	--move the tips when the screen fades in 
  1595. 	local tween_h = vint_object_find("page_3_alpha", Mp_completion.handles.page_3_anim) 
  1596. 	vint_set_property(tween_h, "end_event", "mp_completion_tips_horizontal") 
  1597. 	 
  1598. 	local tween_h = vint_object_find("page_3_alpha", Mp_completion.handles.page_3_anim) 
  1599. 	vint_set_property(tween_h, "start_event", "mp_completion_input_unblock") 
  1600. 	 
  1601. end 
  1602.  
  1603. -------------------- 
  1604. -- Button Placement 
  1605.  
  1606. function mp_completion_tips_horizontal() 
  1607. 	 
  1608. 	--############################################################### 
  1609. 	--this is used to format the buttons for the results screen 
  1610. 	--############################################################### 
  1611.  
  1612. 	vint_set_property(Mp_completion.handles.tip_2, "visible", true) 
  1613. 	vint_set_property(Mp_completion.handles.btn_2, "visible", true) 
  1614. 	vint_set_property(Mp_completion.handles.tip_3, "visible", true) 
  1615. 	vint_set_property(Mp_completion.handles.btn_3, "visible", true) 
  1616. 	 
  1617. 	Mp_copmletion_isfinal = true 
  1618. 	 
  1619. 	local bx, by = 19, 17 
  1620. 	local gap = 36 
  1621. 	local text_y_offset = -1 
  1622. 	local is_client = mp_completion_is_party_client() 
  1623. 	 
  1624. 	vint_set_property(Mp_completion.handles.tip_1, "anchor", bx, 0 + text_y_offset) 
  1625.  
  1626. 	if is_client then 
  1627. 		-- Hide the Continue button 
  1628. 		vint_set_property(Mp_completion.handles.btn_1, "visible", false) 
  1629. 		 
  1630. 		-- Move the "waiting for host" text over to the left edge, change the color, and make it pulsate 
  1631. 		local b1a, b1b = vint_get_property(Mp_completion.handles.btn_1, "anchor") 
  1632. 		vint_set_property(Mp_completion.handles.tip_1, "anchor", b1a, text_y_offset) 
  1633. 		lua_play_anim(Mp_completion.handles.tip_1_pulsate_h) 
  1634. 		vint_set_property(Mp_completion.handles.tip_1, "text_tag", "MP_COMPLETION_WAITING") 
  1635. 	end 
  1636. 	 
  1637. 	if get_is_syslink() then 
  1638. 		-- Hide the middle tip 
  1639. 		vint_set_property(Mp_completion.handles.btn_2, "visible", false) 
  1640. 		vint_set_property(Mp_completion.handles.tip_2, "visible", false) 
  1641. 	 
  1642. 		-- Display the two other tips one line highter 
  1643. 		local t1a, t1b = vint_get_property(Mp_completion.handles.tip_1, "anchor") 
  1644. 		local t1x, t1y = element_get_actual_size(Mp_completion.handles.tip_1) 
  1645. 		vint_set_property(Mp_completion.handles.btn_3, "anchor", t1a + t1x + gap, 0) 
  1646. 		 
  1647. 		local b2a, b2b = vint_get_property(Mp_completion.handles.btn_3, "anchor") 
  1648. 		vint_set_property(Mp_completion.handles.tip_3, "anchor", bx + b2a, text_y_offset) 
  1649. 	else 
  1650. 		-- Show all 3 tips 
  1651. 		local t1a, t1b = vint_get_property(Mp_completion.handles.tip_1, "anchor") 
  1652. 		local t1x, t1y = element_get_actual_size(Mp_completion.handles.tip_1) 
  1653. 		vint_set_property(Mp_completion.handles.btn_2, "anchor", t1a + t1x + gap, -2 ) 
  1654. 		 
  1655. 		local b2a, b2b = vint_get_property(Mp_completion.handles.btn_2, "anchor") 
  1656. 		vint_set_property(Mp_completion.handles.tip_2, "anchor", 43 + b2a, text_y_offset) 
  1657. 		 
  1658. 		local t2x, t2y = element_get_actual_size(Mp_completion.handles.tip_2) 
  1659. 		local t2a, t2b = vint_get_property(Mp_completion.handles.tip_2, "anchor") 
  1660. 		vint_set_property(Mp_completion.handles.btn_3, "anchor", t2a + t2x + gap, -2 )	 
  1661.  
  1662. 		local b3a, b3b = vint_get_property(Mp_completion.handles.btn_3, "anchor") 
  1663. 		vint_set_property(Mp_completion.handles.tip_3, "anchor", b3a + bx, text_y_offset) 
  1664. 	end 
  1665. 	 
  1666. 	local p3x, p3y = vint_get_property(Mp_completion.handles.page_3, "anchor") 
  1667. 	vint_set_property(Mp_completion.handles.tips, "anchor", p3x + 60, 388 + (22 * Mp_completion.results.num_players)) 
  1668. end 
  1669.  
  1670.  
  1671.  
  1672.  
  1673. --------------- 
  1674. -- Animations 
  1675. function mp_completion_shut_off_all_layers() 
  1676. 	--turn off all layers 
  1677.  
  1678. 	vint_set_property(Mp_completion.handles.tips, "visible", false) 
  1679. 	vint_set_property(Mp_completion.handles.unlock, "visible", false)	 
  1680. 	vint_set_property(Mp_completion.handles.page_1, "visible", false)	 
  1681. 	vint_set_property(Mp_completion.handles.page_2, "visible", false)	 
  1682. 	vint_set_property(Mp_completion.handles.page_3, "visible", false)	 
  1683.  
  1684. 	--[[ 
  1685. 	if Mp_completion.exiting == true then 
  1686. 		vint_set_property(Mp_completion.handles.top_grp, "visible", false) 
  1687. 		vint_set_property(Mp_completion.handles.black_1, "visible", true)	 
  1688. 		vint_set_property(Mp_completion.handles.wall, "visible", false)	 
  1689. 		completion_finish() 
  1690. 	end 
  1691. 	]] 
  1692. end 
  1693.  
  1694. function mp_completion_screen_shake() 
  1695. 	if Mp_completion_force_skip == false then 
  1696. 		lua_play_anim(Mp_completion.handles.screen_shake, 0) 
  1697. 	end 
  1698. end 
  1699.  
  1700. function mp_completion_fade_in_wall_and_top() 
  1701.  
  1702. 	vint_set_property(Mp_completion.handles.top_grp, "visible", true) 
  1703. 	vint_set_property(Mp_completion.handles.wall, "visible", true)	 
  1704. 	--set up the sound stuff 
  1705. 	local tween_h = vint_object_find("top_1_pos", Mp_completion.handles.top_grp_anim) 
  1706. 	 
  1707. 	if Mp_completion_force_skip == false then 
  1708. 		if Mp_completion.general.winner == true then 
  1709. 			--play all top 3 sound 
  1710. 			vint_set_property(tween_h, "start_event", "mp_completion_top_3_sound") 
  1711. 			 
  1712. 		else 
  1713. 			--play the fail sound 
  1714. 			vint_set_property(tween_h, "start_event", "mp_completion_top_fail_sound") 
  1715. 		end 
  1716. 		 
  1717. 		--do the animations 
  1718. 		lua_play_anim(Mp_completion.handles.black_1_anim, 0) 
  1719. 		lua_play_anim(Mp_completion.handles.wall_anim, 0.33) 
  1720. 		lua_play_anim(Mp_completion.handles.top_grp_anim, 1) 
  1721. 	end 
  1722. end 
  1723.  
  1724. function mp_completion_fade_out_all() 
  1725. 	lua_play_anim(Mp_completion.handles.black_2_anim, 0) 
  1726. end 
  1727.  
  1728. function mp_completion_team_blue_anim(offset) 
  1729. 	lua_play_anim(Mp_completion.handles.team_blue_anim, offset) 
  1730. 	if Mp_completion_force_skip == false then 
  1731. 		local tween_h = vint_object_find("blue_name_alpha", Mp_completion.handles.team_blue_anim) 
  1732. 		vint_set_property(tween_h, "start_event", "mp_completion_respect_sound") 
  1733. 	end 
  1734. end 
  1735.  
  1736. function mp_completion_team_blue_slam_anim(offset) 
  1737. 	lua_play_anim(Mp_completion.handles.team_blue_slam_anim, offset) 
  1738. 	if Mp_completion_force_skip == false then 
  1739. 		local tween_h = vint_object_find("blue_name_alpha", Mp_completion.handles.team_blue_slam_anim) 
  1740. 		vint_set_property(tween_h, "start_event", "mp_completion_top_2_sound") 
  1741. 	end 
  1742. end 
  1743.  
  1744. function mp_completion_team_red_anim() 
  1745. 	lua_play_anim(Mp_completion.handles.team_red_anim, .5) 
  1746. 	if Mp_completion_force_skip == false then 
  1747. 		local tween_h = vint_object_find("red_name_alpha", Mp_completion.handles.team_red_anim) 
  1748. 		vint_set_property(tween_h, "start_event", "mp_completion_respect_sound") 
  1749. 	end 
  1750. end 
  1751.  
  1752. function mp_completion_team_red_slam_anim(offset) 
  1753. 	lua_play_anim(Mp_completion.handles.team_red_slam_anim, offset) 
  1754. 	if Mp_completion_force_skip == false then 
  1755. 		local tween_h = vint_object_find("red_name_alpha", Mp_completion.handles.team_red_slam_anim) 
  1756. 		vint_set_property(tween_h, "start_event", "mp_completion_top_2_sound") 
  1757. 	end 
  1758. end 
  1759.  
  1760.  
  1761. function mp_completion_awards_anim(offset) 
  1762. 	if offset == nil then 
  1763. 		offset = 0 
  1764. 	end 
  1765. 	lua_play_anim(Mp_completion.handles.awards_anim, offset) 
  1766. 	local tween_h = vint_object_find("award_1_alpha", Mp_completion.handles.awards_anim) 
  1767. 	if Mp_completion_force_skip == false then 
  1768. 		vint_set_property(tween_h, "start_event", "mp_completion_text_sound") 
  1769. 	end 
  1770. 	--vint_set_property(tween_h, "end_event", "mp_completion_anim_false") 
  1771. end 
  1772.  
  1773. function mp_completion_page_1_fade_out() 
  1774. 	lua_play_anim(Mp_completion.handles.page_1_fade_out, 0) 
  1775. end 
  1776.  
  1777. function mp_completion_page_1_skip_2_fade_out() 
  1778. 	lua_play_anim(Mp_completion.handles.page_1_skip_2_fade_out, 0) 
  1779. end 
  1780.  
  1781. function mp_completion_unlock_fade_in(offset) 
  1782. 	vint_set_property(Mp_completion.handles.unlock, "visible", true) 
  1783. 	vint_set_property(Mp_completion.handles.t_unlocked, "visible", true)	 
  1784. 	vint_set_property(Mp_completion.handles.t_rewards, "visible", true)	 
  1785.  
  1786. 	lua_play_anim(Mp_completion.handles.unlocked_rewards_anim, offset) 
  1787. 	local tween_h = vint_object_find("unlock_offset", Mp_completion.handles.unlocked_rewards_anim) 
  1788. 	vint_set_property(tween_h, "start_event", "mp_completion_top_2_sound") 
  1789. 	 
  1790. 	if Mp_completion_force_skip == false then 
  1791. 	--	vint_set_property(tween_h, "start_event", "mp_completion_top_2_sound") 
  1792. 	end 
  1793. end 
  1794.  
  1795. function mp_completion_badges_anim(offset) 
  1796. 	lua_play_anim(Mp_completion.handles.badges_anim, offset) 
  1797. 	local tween_h = vint_object_find("badges_alpha", Mp_completion.handles.badges_anim) 
  1798. 	if Mp_completion_force_skip == false then 
  1799. 		vint_set_property(tween_h, "start_event", "mp_completion_image_sound") 
  1800. 	end 
  1801. 	--vint_set_property(tween_h, "end_event", "mp_completion_anim_false") 
  1802. end 
  1803.  
  1804. function mp_completion_page_2_fade_out() 
  1805. 	lua_play_anim(Mp_completion.handles.page_2_fade_out, 0) 
  1806. end 
  1807.  
  1808. function mp_completion_page_2_badges_fade_out() 
  1809. 	lua_play_anim(Mp_completion.handles.page_2_badges_fade_out, 0) 
  1810. 	local tween_h = vint_object_find("page_2_alpha_out", Mp_completion.handles.page_2_badges_fade_out) 
  1811. 	vint_set_property(tween_h, "end_event", "mp_completion_turn_off_badges") 
  1812. 	 
  1813. end 
  1814.  
  1815. function mp_completion_turn_off_badges() 
  1816. 	vint_set_property(Mp_completion.handles.t_unlocked, "alpha", 0) 
  1817. 	vint_set_property(Mp_completion.handles.t_rewards, "alpha", 0) 
  1818. 	vint_set_property(Mp_completion.handles.tips, "alpha", 0) 
  1819.  
  1820. 	--1 
  1821. 	vint_set_property(Mp_completion.handles.bdg[0].handle_1, "visible", false) 
  1822. 	vint_set_property(Mp_completion.handles.bdg[0].handle_2, "visible", false) 
  1823. 	--2 
  1824. 	vint_set_property(Mp_completion.handles.bdg[1].handle_1, "visible", false) 
  1825. 	vint_set_property(Mp_completion.handles.bdg[1].handle_2, "visible", false) 
  1826. 	--3 
  1827. 	vint_set_property(Mp_completion.handles.bdg[2].handle_1, "visible", false) 
  1828. 	vint_set_property(Mp_completion.handles.bdg[2].handle_2, "visible", false) 
  1829. 	--4 
  1830. 	vint_set_property(Mp_completion.handles.bdg[3].handle_1, "visible", false) 
  1831. 	vint_set_property(Mp_completion.handles.bdg[3].handle_2, "visible", false) 
  1832. 	--5 
  1833. 	vint_set_property(Mp_completion.handles.bdg[4].handle_1, "visible", false) 
  1834. 	vint_set_property(Mp_completion.handles.bdg[4].handle_2, "visible", false) 
  1835. 	--6 
  1836. 	vint_set_property(Mp_completion.handles.bdg[5].handle_1, "visible", false) 
  1837. 	vint_set_property(Mp_completion.handles.bdg[5].handle_2, "visible", false) 
  1838. 	--7 
  1839. 	vint_set_property(Mp_completion.handles.bdg[6].handle_1, "visible", false) 
  1840. 	vint_set_property(Mp_completion.handles.bdg[6].handle_2, "visible", false) 
  1841. 	--8 
  1842. 	vint_set_property(Mp_completion.handles.bdg[7].handle_1, "visible", false) 
  1843. 	vint_set_property(Mp_completion.handles.bdg[7].handle_2, "visible", false) 
  1844. 	--9 
  1845. 	vint_set_property(Mp_completion.handles.bdg[8].handle_1, "visible", false) 
  1846. 	vint_set_property(Mp_completion.handles.bdg[8].handle_2, "visible", false) 
  1847. 	--10 
  1848. 	vint_set_property(Mp_completion.handles.bdg[9].handle_1, "visible", false) 
  1849. 	vint_set_property(Mp_completion.handles.bdg[9].handle_2, "visible", false)	 
  1850. end 
  1851.  
  1852. function mp_completion_page_3_anim(offset) 
  1853. 	vint_set_property(Mp_completion.handles.page_3, "visible", true) 
  1854. 	 
  1855. 	lua_play_anim(Mp_completion.handles.page_3_anim, offset) 
  1856. 	 
  1857. 	local tween_h = vint_object_find("page_3_ender", Mp_completion.handles.page_3_anim) 
  1858. 	if Mp_completion_force_skip == false then 
  1859. 		vint_set_property(tween_h, "start_event", "mp_completion_text_sound") 
  1860. 	end 
  1861. 	vint_set_property(tween_h, "end_event", "mp_completion_anim_false") 
  1862. end 
  1863.  
  1864. function mp_completion_tips_fade_in() 
  1865. 	vint_set_property(Mp_completion.handles.tips, "visible", true) 
  1866. 	lua_play_anim(Mp_completion.handles.tips_fade_in_anim, 0) 
  1867. 	local tween_h = vint_object_find("tips_fade_in", Mp_completion.handles.tips_fade_in_anim) 
  1868. 	if Mp_completion_force_skip == false then 
  1869. 		vint_set_property(tween_h, "start_event", "mp_completion_tips_sound") 
  1870. 	end 
  1871. 	vint_set_property(tween_h, "end_event", "mp_completion_anim_false") 
  1872. end 
  1873.  
  1874. function mp_completion_tips_fade_in_offset(offset) 
  1875. 	vint_set_property(Mp_completion.handles.tips, "visible", true) 
  1876. 	lua_play_anim(Mp_completion.handles.tips_fade_in_anim, offset) 
  1877. 	local tween_h = vint_object_find("tips_fade_in", Mp_completion.handles.tips_fade_in_anim) 
  1878. 	if Mp_completion_force_skip == false then 
  1879. 		vint_set_property(tween_h, "start_event", "mp_completion_tips_sound") 
  1880. 	end 
  1881. 	vint_set_property(tween_h, "end_event", "mp_completion_anim_false") 
  1882. end 
  1883.  
  1884. --------------- 
  1885. --AUDIO 
  1886. function mp_completion_image_sound() 
  1887. 	audio_play(Mp_completion_audio.image) 
  1888. end 
  1889.  
  1890. function mp_completion_text_sound() 
  1891. 	audio_play(Mp_completion_audio.text) 
  1892. end 
  1893.  
  1894. function mp_completion_respect_sound() 
  1895. 	audio_play(Mp_completion_audio.respect) 
  1896. end 
  1897.  
  1898. function mp_completion_cash_sound() 
  1899. 	audio_play(Mp_completion_audio.cash) 
  1900. end 
  1901.  
  1902. function mp_completion_tips_sound() 
  1903. 	audio_play(Mp_completion_audio.tips) 
  1904. end 
  1905.  
  1906. function mp_completion_top_3_sound() 
  1907. 	audio_play(Mp_completion_audio.top_3) 
  1908. end 
  1909.  
  1910. function mp_completion_top_2_sound() 
  1911. 	audio_play(Mp_completion_audio.top_2) 
  1912. end 
  1913.  
  1914. function mp_completion_top_fail_sound() 
  1915. 	audio_play(Mp_completion_audio.fail) 
  1916. end 
  1917.  
  1918.  
  1919. ------------------------ 
  1920. --thread killing 
  1921.  
  1922. Mp_completion_anim_thread_count = 0 
  1923. Mp_completion_force_skip = false 
  1924. Mp_completion_current_time = 0 
  1925. Mp_completion_cancelled_waiting = false 
  1926. Mp_copmletion_isfinal = false 
  1927.  
  1928. function mp_completion_anim_threads_is_killed() 
  1929. 	return Mp_completion_force_skip 
  1930. end 
  1931.  
  1932. function mp_completion_anim_false() 
  1933. 	Mp_completion_is_animating = false 
  1934. end 
  1935.  
  1936. function mp_completion_anim_threads_kill() 
  1937. 	Mp_completion_force_skip = true 
  1938. end 
  1939.  
  1940. function mp_completion_anim_threads_unkill() 
  1941. 	 
  1942. end 
  1943.  
  1944. function mp_completion_cancel_wait() 
  1945. 	if Mp_completion_cancelled_waiting == false then 
  1946. 		Mp_completion_cancelled_waiting = true 
  1947. 		 
  1948. 		-- Only show stuff if the host left while the client was in the final screen 
  1949. 		if Mp_copmletion_isfinal then 
  1950. 			vint_set_property(Mp_completion.handles.tip_1_pulsate_h, "is_paused", true) 
  1951. 			vint_set_property(Mp_completion.handles.tip_1, "text_tag", " ") 
  1952. 			dialog_box_message("MENU_TITLE_WARNING", "MP_DISCONNECT_HOST_LEFT") 
  1953. 		end 
  1954. 	end 
  1955. end 
  1956.  
  1957. -------- THANK YOU GOODNIGHT! -------- 
  1958. Mp_completion = {	 
  1959. 	handles = {}, 
  1960. 	input = { }, 
  1961. 	 
  1962. 	general = { },						--	Heading, team scores, etc 
  1963. 	awards = { num_awards = 0 },	--	Awards, i.e., "Noosh was the Ho's favorite" - Damn right, JHG 
  1964. 	badges = { num_badges =  0 },	--	Badges, i.e., "Brain Surgeon" 
  1965.  
  1966. 	input_block = false, 
  1967. 	 
  1968. 	num_screens = 3, 
  1969. 	screen_idx = 0, 
  1970. 	 
  1971. 	start_idx = 0, 
  1972. 	end_idx = 9, 
  1973. 	 
  1974. 	a_available = false, 
  1975. 	b_available = false, 
  1976. 	x_available = false, 
  1977. 	 
  1978. 	screen_show_function = {  
  1979. 		[0] = mp_completion_show_general, 
  1980. 		[1] = mp_completion_show_badges, 
  1981. 		[2] = mp_completion_show_results,	 
  1982. 	}, 
  1983. } 
  1984.  
  1985.  
  1986.