sr2lua/completion.lua

  1. Completion = {	 
  2. 	handles = {}, 
  3. 	pegs = { }, 
  4. 	input = { }, 
  5. 	num_pegs = 0, 
  6. 	 
  7. 	input_block = false, 
  8. 	num_unlocks = 0, 
  9. 	cur_unlock = 0, 
  10. 	 
  11. 	a_available = false, 
  12. 	b_available = false, 
  13. 	x_available = false, 
  14. } 
  15.  
  16. Completion_Gang_Names = {  
  17. 	[0] = "GANG_SAINTS", 
  18. 	[1] = "GANG_NAME_TB", 
  19. 	[2] = "GANG_NAME_TR", 
  20. 	[3] = "GANG_NAME_SOS", 
  21. 	-- [4] is police/civilians/etc (unused here) 
  22. 	-- [5] is police/civilians/etc (unused here) 
  23. 	[6] = "GANG_ULTOR", 
  24. } 
  25.  
  26. Completion_Activity_Images = { 
  27. 	"demoderby", 
  28. 	"demoderby",	 
  29. 	"escort",  
  30. 	"fightclub", 
  31. 	"insfraud", 
  32. 	"fuzz", 
  33. 	"angel",		--	Guardian angel? 
  34. 	"humantorch", 
  35. 	"snatch", 
  36. 	"piracy", 
  37. 	"drug", 
  38. 	"crowdcontrol", 
  39. 	"septic", 
  40. 	"zombie",	-- Hmm?   
  41. 	"racing",	-- Another hmmm? 
  42. 	"heli", 
  43. 	"mayhem", 
  44. } 
  45.  
  46. Completion_Gang_Images = { 
  47. 	[0] = "saints", 
  48. 	[1] = "bhood", 
  49. 	[2] = "ronin", 
  50. 	[3] = "samedi", 
  51. 	-- [4] is police/civilians/etc (unused here) 
  52. 	-- [5] is police/civilians/etc (unused here) 
  53. 	[6] = "ultor", 
  54. } 
  55. --[[ 
  56. function Completion_is_coop() 
  57. 	return true 
  58. end 
  59. ]] 
  60. Completion_audio = { 
  61. 	top_3 = audio_get_audio_id("SYS_COMPLETION_START"), 
  62. 	top_2 = audio_get_audio_id("SYS_COMPLETION_START_2"), 
  63. 	cash = audio_get_audio_id("SYS_COMPLETION_CASH"), 
  64. 	respect = audio_get_audio_id("SYS_COMPLETION_RESPECT"), 
  65. 	image = audio_get_audio_id("SYS_COMPLETION_OBJECT"), 
  66. 	text = audio_get_audio_id("SYS_COMPLETION_TEXT"), 
  67. 	tips = audio_get_audio_id("SYS_COMPLETION_MENU"), 
  68. 	unlock = audio_get_audio_id("SYS_COMPLETION_UNLOCK"), 
  69. 	fail = audio_get_audio_id("SYS_COMPLETION_FAIL"), 
  70. 	cash_count = audio_get_audio_id("SYS_COMPLETION_CASH_COUNT"), 
  71. 	respect_count = audio_get_audio_id("SYS_COMPLETION_RESPECT_COUNT"), 
  72. 	cash_hit = audio_get_audio_id("SYS_COMPLETION_CASH_HIT"), 
  73. 	respect_hit = audio_get_audio_id("SYS_COMPLETION_RESPECT_HIT"), 
  74. 	respect_end = audio_get_audio_id("SYS_HUD_DIVERSION_COMPLETE"), 
  75.  
  76. } 
  77.  
  78. Completion_respect = { 
  79. --this stores the different variables from the activity respect bonus 
  80. } 
  81.  
  82. Completion_cash_reward = { 
  83. --this stores the one time cash bonus 
  84. } 
  85.  
  86. Completion_cash_per_day = { 
  87. --this stores the cash earned per day 
  88. } 
  89.  
  90. Completion.handles.level_number = -1 --init this for Special Derby check 
  91. Completion_allow_to_shut_off_layers = true 
  92. Completion_is_last_screen = false 
  93. Completion_show_respect_screen = false 
  94. Completion.is_respect_screen = false 
  95. Completion_is_hood_screen = false 
  96. Completion_is_animating = true --used for skipping animations 
  97. Completion_force_skip = false --set the init to not force skip 
  98. Completion.just_unlocks_really = false 
  99.  
  100.  
  101. Completion_coop_disconnected = false 
  102.  
  103. COMPLETION_LOAD_DELAY = 2			--Time to wait on all animations to play 
  104.  
  105. COMPLETION_UNLOCK_SPACE = 20 
  106.  
  107. SUCCESS_MISSION 		= 0  
  108. SUCCESS_STRONGHOLD 		= 1 
  109. SUCCESS_ACTIVITY 		= 2 
  110. FAILURE_MISSION 		= 3 
  111. FAILURE_STRONGHOLD 		= 4 
  112. FAILURE_ACTIVITY 		= 5 
  113. JUST_UNLOCKS			= 6 
  114. UNLOCK_REWARD 			= 7 
  115. SUCCESS_PUSHBACK		= 8 
  116.  
  117. COMPLETION_RADIAN = 3.141 
  118.  
  119. COMPLETION_AUDIO_DELAY = .2 
  120.  
  121. COMPLETION_RESTART							= 0 
  122. COMPLETION_RESTART_FROM_CHECKPOINT		= 1 
  123. COMPLETION_EXIT								= 2 
  124. COMPLETION_CONTINUE							= 3 
  125.  
  126.  
  127.  
  128. function completion_coop_disconnected() 
  129. 	Completion_coop_disconnected = true 
  130. 	 
  131. 	if Completion.type == FAILURE_MISSION then 
  132. 		completion_init_buttons("COMPLETION_RESTART_BEGINNING", nil, "COMPLETION_EXIT_MISSION") 
  133. 		if Completion.handles.image_base == "tss01" then 
  134. 			completion_init_buttons("COMPLETION_RESTART_BEGINNING", nil, nil) 
  135. 		end 
  136. 	elseif Completion.type == FAILURE_STRONGHOLD then 
  137. 		completion_init_buttons("COMPLETION_RETRY_STRONGHOLD", nil, "COMPLETION_EXIT_STRONGHOLD") 
  138. 	end	 
  139. end 
  140.  
  141. function completion_load_peg(peg_name) 
  142. 	peg_load("" .. peg_name) 
  143. 	Completion.pegs[Completion.num_pegs] = peg_name 
  144. 	Completion.num_pegs = Completion.num_pegs + 1 
  145. end 
  146.  
  147. function completion_unload_pegs() 
  148. 	for idx, val in Completion.pegs do 
  149. 		peg_unload(val) 
  150. 	end 
  151. 	 
  152. 	Completion.num_pegs = 0 
  153. end 
  154.  
  155. function completion_finish() 
  156. 	Completion_finalize_fade() 
  157. 	vint_document_unload(vint_document_find("completion"))	 
  158. end 
  159.  
  160. function completion_cleanup() 
  161. 	peg_unload("ui_c_wall_" .. Completion.handles.wall) 
  162. 	completion_unload_pegs() 
  163. 	completion_release_input() 
  164. 	hud_hide(false) 
  165. end 
  166.  
  167. function completion_init() 
  168. 	local h = -1 
  169. 	hud_hide(true) 
  170. 	 
  171. 	--safe frame 
  172. 	Completion.handles.safe_frame = vint_object_find("safe_frame") 
  173. 	 
  174. 	--Cash & Respect 
  175. 	Completion.handles.cash_respect_h = vint_object_find("cash_respect") 
  176. 	h = Completion.handles.cash_respect_h 
  177. 	Completion.handles.cash_t_h = vint_object_find("cash_t", h) 
  178. 	Completion.handles.cash_v_h = vint_object_find("cash_v", h) 
  179. 	Completion.handles.respect_t_h = vint_object_find("respect_t", h) 
  180. 	Completion.handles.respect_v_h = vint_object_find("respect_v", h) 
  181. 	-- ++ Respect bar sub group ++ 
  182. 	Completion.handles.respect_b_grp_h = vint_object_find("respect_b_grp", h) 
  183. 	h = Completion.handles.respect_b_grp_h 
  184. 	Completion.handles.respect_b_0_h = vint_object_find("respect_b_0", h) 
  185. 	Completion.handles.respect_b_1_h = vint_object_find("respect_b_1", h) 
  186. 	Completion.handles.respect_b_bg_h = vint_object_find("respect_b_bg", h) 
  187. 	Completion.handles.respect_multi_grp = vint_object_find("multi_grp") 
  188. 	h = Completion.handles.respect_multi_grp 
  189. 	Completion.handles.respect_multiplier = vint_object_find("respect_mult", h) 
  190. 	-- ++ Style Group ++ 
  191. 	Completion.handles.style_grp = vint_object_find("style_grp") 
  192. 	h = Completion.handles.style_grp 
  193. 	Completion.handles.style_txt = vint_object_find("style_txt", h) 
  194. 	 
  195. 	Completion.handles.black_1_h = vint_object_find("black_1") 
  196. 	Completion.handles.black_2_h = vint_object_find("black_2") 
  197. 	 
  198. 	--Fail message 
  199. 	Completion.handles.fail_msg_h = vint_object_find("fail_msg") 
  200. 	 
  201. 	--Tips 
  202. 	Completion.handles.tips_h = vint_object_find("tips") 
  203. 	h = Completion.handles.tips_h 
  204. 	Completion.handles.btn_1_h = vint_object_find("btn_1", h) 
  205. 	Completion.handles.btn_2_h = vint_object_find("btn_2", h) 
  206. 	Completion.handles.btn_3_h = vint_object_find("btn_3", h) 
  207. 	Completion.handles.tip_1_h = vint_object_find("tip_1", h) 
  208. 	Completion.handles.tip_2_h = vint_object_find("tip_2", h) 
  209. 	Completion.handles.tip_3_h = vint_object_find("tip_3", h) 
  210. 	--..Waiting 
  211. 	Completion.handles.waiting = vint_object_find("waiting", h) 
  212. 	vint_set_property(Completion.handles.waiting, "text_tag", "MP_COMPLETION_WAITING") 
  213. 	 
  214. 	--..Back : Quit to Main Menu 
  215. 	Completion.handles.quit_to_main	= vint_object_find("quit_to_main") 
  216. 	h = Completion.handles.quit_to_main 
  217. 	Completion.handles.quit_to_main_btn = vint_object_find("btn_4", h) 
  218. 	Completion.handles.quit_to_main_text = vint_object_find("tip_4", h) 
  219. 	 
  220. 	--Top Group of location, name, level 
  221. 	Completion.handles.top_grp_h = vint_object_find("top_grp") 
  222. 	h = Completion.handles.top_grp_h 
  223. 	Completion.handles.top_1_h = vint_object_find("top_1", h) 
  224. 	Completion.handles.top_2_h = vint_object_find("top_2", h) 
  225. 	Completion.handles.top_3_h = vint_object_find("top_3", h) 
  226. 	 
  227. 	--Unlockable group 
  228. 	Completion.handles.unlock_h = vint_object_find("unlock") 
  229. 	h = Completion.handles.unlock_h 
  230. 	Completion.handles.t_unlock_h = vint_object_find("t_unlocked", h) 
  231. 	Completion.handles.thing_desc_h = vint_object_find("thing_desc", h) 
  232. 	Completion.handles.thing_image_h = vint_object_find("thing_image", h) 
  233. 	Completion.handles.thing_name_h = vint_object_find("thing_name", h) 
  234. 	-- ++ Hood Cash and Hoods Owned ++ -- 
  235. 	Completion.handles.hood_cash_t_h = vint_object_find("hood_cash_t", h) 
  236. 	Completion.handles.hood_cash_v_h = vint_object_find("hood_cash_v", h) 
  237. 	Completion.handles.hood_owned_t_h = vint_object_find("hood_owned_t", h) 
  238. 	Completion.handles.hood_owned_v_h = vint_object_find("hood_owned_v", h) 
  239. 	 
  240. 	--Wall 
  241. 	Completion.handles.wall_h = vint_object_find("wall") 
  242. 	 
  243. 	--Find Animations, pause and store to globals 
  244. 	Completion.handles.audio_anim = vint_object_find("audio_anim") 
  245. 	Completion.handles.black_1_anim_h = vint_object_find("black_1_anim") 
  246. 	Completion.handles.black_2_anim_h = vint_object_find("black_2_anim") 
  247. 	Completion.handles.cr_cash_fade_in_anim_h = vint_object_find("cr_cash_fade_in") 
  248. 	Completion.handles.cr_cash_fade_out_anim_h = vint_object_find("cr_cash_fade_out") 
  249. 	Completion.handles.cr_respect_fade_in_anim_h = vint_object_find("cr_respect_fade_in") 
  250. 	Completion.handles.cr_respect_fade_out_anim_h = vint_object_find("cr_respect_fade_out") 
  251. 	Completion.handles.fail_fade_in_anim_h = vint_object_find("fail_fade_in_anim") 
  252. 	Completion.handles.hood_cash_fade_in_anim_h = vint_object_find("hood_cash_fade_in_anim") 
  253. 	Completion.handles.hood_cash_fade_out_anim_h = vint_object_find("hood_cash_fade_out_anim") 
  254. 	Completion.handles.hood_owned_fade_in_anim_h = vint_object_find("hood_owned_fade_in_anim") 
  255. 	Completion.handles.hood_owned_fade_out_anim_h = vint_object_find("hood_owned_fade_out_anim") 
  256. 	Completion.handles.news_clip_fade_in_anim_h = vint_object_find("news_clip_fade_in_anim") 
  257. 	Completion.handles.news_clip_fade_out_anim_h = vint_object_find("news_clip_fade_out_anim") 
  258. 	Completion.handles.style_grp_anim = vint_object_find("style_grp_anim") 
  259. 	Completion.handles.style_grp_fade_out_anim = vint_object_find("style_grp_fade_out_anim") 
  260. 	Completion.handles.tips_fade_in_anim_h = vint_object_find("tips_fade_in_anim") 
  261. 	Completion.handles.tips_fade_out_anim_h = vint_object_find("tips_fade_out_anim") 
  262. 	Completion.handles.top_grp_anim_h = vint_object_find("top_grp_anim") 
  263. 	Completion.handles.top2_grp_anim_h = vint_object_find("top2_grp_anim") --used for Diversion Unlocks 
  264. 	Completion.handles.top_grp_fade_out_anim_h = vint_object_find("top_grp_fade_out_anim") 
  265. 	Completion.handles.unlock_fade_in_anim_h = vint_object_find("unlock_fade_in_anim") 
  266. 	Completion.handles.unlock_fade_out_anim_h = vint_object_find("unlock_fade_out_anim") 
  267. 	Completion.handles.unlock_desc_fade_in_anim_h = vint_object_find("unlock_desc_fade_in_anim") 
  268. 	Completion.handles.unlock_desc_fade_out_anim_h = vint_object_find("unlock_desc_fade_out_anim") 
  269. 	Completion.handles.waiting_anim = vint_object_find("waiting_anim") 
  270. 	Completion.handles.waiting_fade_in = vint_object_find("waiting_fade_in") 
  271. 	Completion.handles.waiting_fade_out = vint_object_find("waiting_fade_out") 
  272. 	Completion.handles.wall_anim_h = vint_object_find("wall_anim") 
  273. 	 
  274. 	local tween_h = vint_object_find("black_2_alpha_in", Completion.handles.black_2_anim_h) 
  275. 	vint_set_property(tween_h, "end_event", "completion_shut_off_all_layers") 
  276.  
  277. 	vint_set_property(Completion.handles.black_1_anim_h, "is_paused", true) 
  278. 	vint_set_property(Completion.handles.black_2_anim_h, "is_paused", true) 
  279. 	vint_set_property(Completion.handles.black_3_anim_h, "is_paused", true) 
  280. 	vint_set_property(Completion.handles.cr_cash_fade_in_anim_h, "is_paused", true) 
  281. 	vint_set_property(Completion.handles.cr_cash_fade_out_anim_h, "is_paused", true) 
  282. 	vint_set_property(Completion.handles.cr_respect_fade_in_anim_h, "is_paused", true) 
  283. 	vint_set_property(Completion.handles.cr_respect_fade_out_anim_h, "is_paused", true) 
  284. 	vint_set_property(Completion.handles.fail_fade_in_anim_h, "is_paused", true) 
  285. 	vint_set_property(Completion.handles.hood_cash_fade_in_anim_h, "is_paused", true) 
  286. 	vint_set_property(Completion.handles.hood_cash_fade_out_anim_h, "is_paused", true) 
  287. 	vint_set_property(Completion.handles.hood_owned_fade_in_anim_h , "is_paused", true) 
  288. 	vint_set_property(Completion.handles.hood_owned_fade_out_anim_h, "is_paused", true) 
  289. 	vint_set_property(Completion.handles.news_clip_fade_in_anim_h, "is_paused", true) 
  290. 	vint_set_property(Completion.handles.news_clip_fade_out_anim_h, "is_paused", true) 
  291. 	vint_set_property(Completion.handles.style_grp_anim, "is_paused", true) 
  292. 	vint_set_property(Completion.handles.style_grp_fade_out_anim, "is_paused", true) 
  293. 	vint_set_property(Completion.handles.tips_fade_in_anim_h , "is_paused", true) 
  294. 	vint_set_property(Completion.handles.tips_fade_out_anim_h, "is_paused", true) 
  295. 	vint_set_property(Completion.handles.top_grp_anim_h , "is_paused", true) 
  296. 	vint_set_property(Completion.handles.top2_grp_anim_h , "is_paused", true) 
  297. 	vint_set_property(Completion.handles.top_grp_fade_out_anim_h, "is_paused", true) 
  298. 	vint_set_property(Completion.handles.unlock_fade_in_anim_h , "is_paused", true) 
  299. 	vint_set_property(Completion.handles.unlock_fade_out_anim_h , "is_paused", true) 
  300. 	vint_set_property(Completion.handles.unlock_desc_fade_in_anim_h , "is_paused", true) 
  301. 	vint_set_property(Completion.handles.unlock_desc_fade_out_anim_h , "is_paused", true) 
  302. 	vint_set_property(Completion.handles.waiting_anim , "is_paused", true) 
  303. 	vint_set_property(Completion.handles.waiting_fade_in , "is_paused", true) 
  304. 	vint_set_property(Completion.handles.waiting_fade_out , "is_paused", true) 
  305. 	vint_set_property(Completion.handles.wall_anim_h , "is_paused", true) 
  306. 	 
  307. 	--SAFE FRAME screen shake animation 
  308. 	Completion.handles.screen_shake = vint_object_find("screen_shake") 
  309. 	vint_set_property(Completion.handles.screen_shake, "is_paused", true) 
  310.  
  311. 	--------- Respect Screen 
  312. 	--handles 
  313. 	Completion.handles.gangs_grp_h = vint_object_find("gangs_grp")  
  314. 	local h = Completion.handles.gangs_grp_h  
  315. 	Completion.handles.st_h = vint_object_find("3st", h) 
  316. 	Completion.handles.bh_h = vint_object_find("bh", h)  
  317. 	Completion.handles.ep_h = vint_object_find("ep", h)  
  318. 	Completion.handles.rn_h = vint_object_find("rn", h)  
  319. 	Completion.handles.ss_h = vint_object_find("ss", h)  
  320. 	Completion.handles.you_got_respect_h = vint_object_find("you_got_respect", h) 
  321.  
  322. 	--Animations 
  323. 	Completion.handles.gang_zoom_st_h = vint_object_find("gang_zoom_3st")  
  324. 	Completion.handles.gang_zoom_bh_h = vint_object_find("gang_zoom_bh")  
  325. 	Completion.handles.gang_zoom_ep_h = vint_object_find("gang_zoom_ep")  
  326. 	Completion.handles.gang_zoom_rn_h = vint_object_find("gang_zoom_rn")  
  327. 	Completion.handles.gang_zoom_ss_h = vint_object_find("gang_zoom_ss")  
  328. 	Completion.handles.you_got_respect_fade_in_anim_h = vint_object_find("you_got_respect_fade_in_anim") 
  329. 	local tween_h = vint_object_find("you_got_respect_fade_in", Completion.handles.you_got_respect_fade_in_anim_h) 
  330. 	vint_set_property(tween_h, "start_event", "completion_text_sound") 
  331.  
  332. --	vint_set_property(tween_h, "end_event", "completion_reward_screen_finished") 
  333. 	 
  334. 	--Pause Animations 
  335. 	vint_set_property(Completion.handles.gang_zoom_st_h, "is_paused", true)  
  336. 	vint_set_property(Completion.handles.gang_zoom_bh_h, "is_paused", true)  
  337. 	vint_set_property(Completion.handles.gang_zoom_ep_h, "is_paused", true)  
  338. 	vint_set_property(Completion.handles.gang_zoom_rn_h, "is_paused", true)  
  339. 	vint_set_property(Completion.handles.gang_zoom_ss_h, "is_paused", true)  
  340. 	vint_set_property(Completion.handles.you_got_respect_fade_in_anim_h, "is_paused", true) 
  341. 	vint_set_property(Completion.handles.gangs_grp_h, "visible", false) 
  342. 	 
  343. 	--SHAKERS WOOT WOOT 
  344. 	--the top stuff 
  345. 		--line 1 
  346. 		tween_h = vint_object_find("top_1_pos", Completion.handles.top_grp_anim_h) 
  347. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  348. 		 
  349.  
  350. 		--line 2 
  351. 		tween_h = vint_object_find("top_2_pos", Completion.handles.top_grp_anim_h) 
  352. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  353.  
  354. 		--line 3 
  355. 		tween_h = vint_object_find("top_3_pos", Completion.handles.top_grp_anim_h) 
  356. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  357. 	 
  358. 	--unlockable animation		 
  359. 		--unlocked 
  360. 		tween_h = vint_object_find("unlock_1_t_pos", Completion.handles.unlock_fade_in_anim_h) 
  361. 		 
  362. 		--name 
  363. 		tween_h = vint_object_find("unlock_2_name_pos", Completion.handles.unlock_fade_in_anim_h) 
  364. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  365. 		 
  366. 		--reward image 
  367. 		tween_h = vint_object_find("unlock_3_image_pos", Completion.handles.unlock_fade_in_anim_h) 
  368. 		vint_set_property(tween_h, "end_event", "completion_screen_shake")	 
  369. 		--local tween_h = vint_object_find("unlock_3_image_pos", Completion.handles.unlock_fade_in_anim_h) 
  370.  
  371. 		 
  372. 	--hood gained / mission cash reward stuff 
  373. 		--news image 
  374. 		tween_h = vint_object_find("news_image_scale", Completion.handles.news_clip_fade_in_anim_h) 
  375. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  376.  
  377. 		 
  378. 		--cash reward title 
  379. 		tween_h = vint_object_find("hood_cash_t_pos", Completion.handles.hood_cash_fade_in_anim_h) 
  380. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  381. 		 
  382. 		--hoods owned title 
  383. 		tween_h = vint_object_find("hood_owned_t_pos", Completion.handles.hood_owned_fade_in_anim_h) 
  384. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  385. 		 
  386. 	--cash respect 
  387. 		--cash title 
  388. 		tween_h = vint_object_find("cash_t_pos", Completion.handles.cr_cash_fade_in_anim_h) 
  389. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  390. 		 
  391. 		--respect title 
  392. 		tween_h = vint_object_find("respect_t_pos", Completion.handles.cr_respect_fade_in_anim_h) 
  393. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  394. 		 
  395. 		--style bonus 
  396. 		tween_h = vint_object_find("style_ender", Completion.handles.style_grp_anim) 
  397. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  398. 		 
  399. 	--gang respect 
  400. 		--saints 
  401. 		tween_h = vint_object_find("3st_offset", Completion.handles.gang_zoom_st_h) 
  402. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  403. 		 
  404. 		--brotherhood 
  405. 		tween_h = vint_object_find("bh_offset", Completion.handles.gang_zoom_bh_h) 
  406. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  407. 		 
  408. 		--ronin 
  409. 		tween_h = vint_object_find("rn_offset", Completion.handles.gang_zoom_rn_h) 
  410. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  411. 		 
  412. 		--samedi 
  413. 		tween_h = vint_object_find("ss_offset", Completion.handles.gang_zoom_ss_h) 
  414. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  415. 		 
  416. 		--ultor 
  417. 		tween_h = vint_object_find("ep_offset", Completion.handles.gang_zoom_ep_h) 
  418. 		vint_set_property(tween_h, "end_event", "completion_screen_shake") 
  419. 	 
  420. 	--if this is international, scale and reposition some shit 
  421. 	 
  422. 	if get_language() ~= "US" and get_language() ~= "UK" then 
  423. 		local x = .84 
  424. 		local y = .84 
  425. 		 
  426. 		local top_x, top_y = vint_get_property(Completion.handles.top_grp_h, "anchor") 
  427. 		vint_set_property(Completion.handles.top_grp_h, "anchor",  top_x, top_y + 2) 
  428. 		 
  429. 		vint_set_property(Completion.handles.top_1_h, "text_scale", x, y ) 
  430. 		vint_set_property(Completion.handles.top_2_h, "text_scale", .84, .84 ) 
  431. 		local t_2_x, t_2_y = vint_get_property(Completion.handles.top_2_h, "anchor") 
  432. 		vint_set_property(Completion.handles.top_2_h, "anchor",  t_2_x, t_2_y + 13) 
  433. 		vint_set_property(Completion.handles.top_3_h, "text_scale", .75, .75 ) 
  434. 		local t_3_x, t_3_y = vint_get_property(Completion.handles.top_3_h, "anchor") 
  435. 		vint_set_property(Completion.handles.top_3_h, "anchor",  t_3_x, t_3_y + 21) 
  436. 		 
  437. 		vint_set_property(Completion.handles.thing_name_h, "text_scale", x, y ) 
  438. 		local name_x, name_y = vint_get_property(Completion.handles.thing_name_h, "anchor") 
  439. 		vint_set_property(Completion.handles.thing_name_h, "anchor", name_x, name_y + 10) 
  440. 		 
  441. 		local desc_x, desc_y = vint_get_property(Completion.handles.thing_desc_h, "anchor") 
  442. 		vint_set_property(Completion.handles.thing_desc_h, "anchor", desc_x, desc_y + 10) 
  443. 		 
  444. 		local fail_x, fail_y = vint_get_property(Completion.handles.fail_msg_h , "anchor") 
  445. 		vint_set_property(Completion.handles.fail_msg_h, "anchor", fail_x, fail_y + 16) 
  446. 	end 
  447. 	 
  448. 	completion_shut_off_all_layers() 
  449. 	completion_grab_input() 
  450. 	vint_dataresponder_request("completion_populate", "completion_initialize", 0) 
  451. 	 
  452. end 
  453.  
  454.  
  455. function completion_reward_screen_finished() 
  456. 	Completion_reset_respect_screen() 
  457. end 
  458.  
  459. function completion_do_respect_screen() 
  460. 		 
  461. 	Completion_is_last_screen = true 
  462. 	Completion_is_hood_screen = false 
  463. 	Completion.is_respect_screen = true 
  464. 	Completion_force_skip = false 
  465. 	Completion_is_animating = true 
  466. 	Completion.input_block = true  
  467. 	Completion.num_unlocks = 0 
  468. 	 
  469. 	vint_set_property(Completion.handles.you_got_respect_h, "text_tag", "COMPLETION_ENOUGH_RESPECT") 
  470.  
  471. 	completion_cr_cash_fade_out(0) 
  472. 	completion_cr_respect_fade_out(0) 
  473. 	completion_hood_cash_fade_out(0) 
  474. 	completion_hood_owned_fade_out(0) 
  475. 	completion_news_clip_fade_out(0) 
  476. 	completion_tips_fade_out(0) 
  477. 	completion_unlock_fade_out(0) 
  478. 	completion_unlock_desc_fade_out(0) 
  479. 	 
  480. 	local tween_h = vint_object_find("tips_fade_out_ender", Completion.handles.tips_fade_out_anim_h) 
  481. 	vint_set_property(tween_h, "end_event", "completion_load_respect_icons") 
  482. 	 
  483. 	--saints 
  484. 	lua_play_anim(Completion.handles.gang_zoom_st_h, 1)  
  485. 	local tween_h = vint_object_find("st_ender", Completion.handles.gang_zoom_st_h) 
  486. 	vint_set_property(tween_h, "start_event", "completion_respect_sound") 
  487. 	--brotherhood 
  488. 	lua_play_anim(Completion.handles.gang_zoom_bh_h, 1.5) 
  489. 	local tween_h = vint_object_find("bh_ender", Completion.handles.gang_zoom_bh_h) 
  490. 	vint_set_property(tween_h, "start_event", "completion_respect_sound") 
  491. 	--ronin 
  492. 	lua_play_anim(Completion.handles.gang_zoom_rn_h, 2 )  
  493. 	local tween_h = vint_object_find("rn_ender", Completion.handles.gang_zoom_rn_h) 
  494. 	vint_set_property(tween_h, "start_event", "completion_respect_sound") 
  495. 	--samedi 
  496. 	lua_play_anim(Completion.handles.gang_zoom_ss_h, 2.5) 
  497. 	local tween_h = vint_object_find("ss_ender", Completion.handles.gang_zoom_ss_h) 
  498. 	vint_set_property(tween_h, "start_event", "completion_respect_sound") 
  499. 	--ultor 
  500. 	lua_play_anim(Completion.handles.gang_zoom_ep_h, 3) 
  501. 	local tween_h = vint_object_find("ep_ender", Completion.handles.gang_zoom_ep_h) 
  502. 	vint_set_property(tween_h, "start_event", "completion_respect_sound") 
  503. 	 
  504. 	lua_play_anim(Completion.handles.you_got_respect_fade_in_anim_h, 3.5) 
  505. 	 
  506. 	local tween_h = vint_object_find("you_got_respect_ender", Completion.handles.you_got_respect_fade_in_anim_h) 
  507. 	vint_set_property(tween_h, "end_event", "completion_tips_fade_in") 
  508.  
  509. end 
  510.  
  511. function completion_load_respect_icons() 
  512. 	if Completion.type == SUCCESS_ACTIVITY or Completion.reward_source == SUCCESS_ACTIVITY then 
  513. 		if Completion.last_level == true then 
  514. 			if Completion.handles.activity_type == 13 then 
  515. 				completion_init_buttons("COMPLETION_QUIT_ZOMBIE", nil, nil) 
  516. 			else 
  517. 				completion_init_buttons("COMPLETION_EXIT_ACTIVITY", nil, nil) 
  518. 			end 
  519. 		else 
  520. 			completion_init_buttons("COMPLETION_CONTINUE_ACTIVITY", nil, "COMPLETION_EXIT_ACTIVITY") 
  521. 		end 
  522. 	else 
  523. 		completion_init_buttons("COMPLETION_CONTINUE")	 
  524. 	end 
  525.  
  526.  
  527. 	Completion.input_block = false 
  528. 	vint_set_property(Completion.handles.tips_h, "anchor", 104, 392) 
  529. 	vint_set_property(Completion.handles.gangs_grp_h, "visible", true) 
  530. 	completion_load_peg("ui_c_respect_icons") 
  531. end 
  532.  
  533. function completion_retry_mission_checkpoint(result, action) 
  534. 	if action ~= DIALOG_ACTION_CLOSE then 
  535. 		return 
  536. 	end 
  537. 	 
  538. 	if result == 0 then 
  539. 		completion_call_callback(COMPLETION_RESTART_FROM_CHECKPOINT) 
  540. 		Completion.exiting = true 
  541. 		completion_fade_out_all(0) 
  542. 	end 
  543. end 
  544.  
  545. function completion_exit_callback(result, action) 
  546. 	if action ~= DIALOG_ACTION_CLOSE then 
  547. 		return 
  548. 	end 
  549. 	 
  550. 	if result == 0 then 
  551. 		completion_call_callback(COMPLETION_EXIT) 
  552. 		Completion.exiting = true 
  553. 		completion_fade_out_all(0) 
  554. 	 
  555. 	end 
  556. end 
  557.  
  558. function completion_retry_mission_beginning(result, action) 
  559. 	if action ~= DIALOG_ACTION_CLOSE then 
  560. 		return 
  561. 	end 
  562. 	 
  563. 	if result == 0 then 
  564. 		completion_call_callback(COMPLETION_RESTART) 
  565. 		Completion.exiting = true 
  566. 		completion_fade_out_all(0) 
  567. 	end 
  568. end 
  569.  
  570.  
  571. function completion_grab_input() 
  572. 	Completion.input[0] = vint_subscribe_to_input_event(nil, "select", 			"completion_process_input") 
  573. 	Completion.input[1] = vint_subscribe_to_input_event(nil, "back", 				"completion_process_input") 
  574. 	Completion.input[2] = vint_subscribe_to_input_event(nil, "alt_select", 		"completion_process_input") 
  575. 	Completion.input[3] = vint_subscribe_to_input_event(nil, "all_unassigned", "completion_process_input") 
  576. 	Completion.input[4] = vint_subscribe_to_input_event(nil, "map", 				"completion_process_input") 
  577. end 
  578.  
  579. function completion_process_input(target, event, accel) 
  580. 	local process_event = false 
  581. 	local default = 0 
  582. 	local priority = DIALOG_PRIORITY_ACTION 
  583. 	 
  584. 	if Completion.input_block == true then 
  585. 		return 
  586. 	end 
  587. 	 
  588. 	if Completion_is_animating == false then 
  589. 		 
  590. 		if event == "map" and Completion_is_coop() == true then 
  591. 			local options = { [0] = "CONTROL_YES", [1] = "CONTROL_NO" } 
  592. 			dialog_box_open("MENU_TITLE_WARNING", "DIALOG_PAUSE_DISCONNECT_PROMPT", options, "dialog_pause_disconnect", 0, DIALOG_PRIORITY_SYSTEM_CRITICAL, true, nil, false, false) 
  593. 			return 
  594. 		end 
  595. 	 
  596. 		if event == "select" then 
  597. 			if Completion.is_respect_screen == true and Completion_is_coop() == false then 
  598. 				completion_call_callback(COMPLETION_CONTINUE) 
  599. 				process_event = true 
  600. 			elseif Completion.a_available == true  then 
  601. 				if Completion_cash_per_day.hood_name ~= nil and Completion_cash_per_day.finished ~= true then 
  602. 					Completion_cash_per_day.finished = true 
  603. 					-- Fade out the news image 
  604. 					Completion_force_skip = false 
  605. 					Completion_is_animating = true 
  606. 					Completion_is_hood_screen = true 
  607. 					completion_hood_cash_fade_out(0) 
  608. 					completion_news_clip_fade_out(0) 
  609. 					completion_tips_fade_out(0) 
  610. 					Completion.input_block = true 
  611. 					--set the call back that will unlock the hood 
  612. 					local tween_h = vint_object_find("news_image_alpha", Completion.handles.news_clip_fade_out_anim_h) 
  613. 					vint_set_property(tween_h, "end_event", "completion_shut_off_all_layers") 
  614. 	 
  615. 					local tween_h = vint_object_find("news_image_fade_out_ender", Completion.handles.news_clip_fade_out_anim_h) 
  616. 					vint_set_property(tween_h, "start_event", "completion_unload_pegs") 
  617. 					 
  618. 					local tween_h = vint_object_find("news_image_fade_out_ender", Completion.handles.news_clip_fade_out_anim_h) 
  619. 					vint_set_property(tween_h, "end_event", "completion_hood_unlock")	 
  620. 					return 
  621. 					 
  622. 				elseif Completion.cur_unlock < Completion.num_unlocks then 
  623. 					--	Need to do this so we know if the player was in an activity or not. 
  624. 					if Completion.cur_unlock == 0 then 
  625. 						Completion.reward_source = Completion.type 
  626. 					end 
  627. 					Completion_force_skip = false 
  628. 					Completion_is_animating = true 
  629. 					vint_dataresponder_request("completion_populate", "completion_initialize", 0, Completion.cur_unlock) 
  630. 					Completion.cur_unlock = Completion.cur_unlock + 1 
  631. 					return 
  632. 					 
  633. 				elseif Completion_show_respect_screen == true and Completion.is_respect_screen == false then 
  634. 					if Completion.type <= 2 or Completion.type == 7 then 
  635. 						completion_do_respect_screen() 
  636. 						return 
  637. 					end 
  638. 				elseif Completion_is_coop() == false then 
  639. 					 
  640. 					--redundant continue callback, just to make sure all bases are covered 
  641. 					completion_call_callback(COMPLETION_CONTINUE) 
  642. 					 
  643. 					-- Retry failure, no prompz 
  644. 					if Completion.type == FAILURE_MISSION or Completion.type == FAILURE_STRONGHOLD then 
  645. 					 
  646. 						if Completion_coop_disconnected == false then 
  647. 							completion_call_callback(COMPLETION_RESTART_FROM_CHECKPOINT) 
  648. 						else 
  649. 							completion_call_callback(COMPLETION_RESTART) 
  650. 						end 
  651. 					elseif Completion.type == FAILURE_ACTIVITY then 
  652. 					   completion_call_callback(COMPLETION_RESTART) 
  653. 					elseif Completion.type == SUCCESS_ACTIVITY and Completion.last_level == true then 
  654. 						completion_call_callback(COMPLETION_EXIT) 
  655. 					end 
  656. 					process_event = true 
  657. 				end 
  658. 				 
  659. 			end 
  660. 		elseif event == "back" and Completion.b_available == true and Completion_is_coop() == false then 
  661. 			 
  662. 			if Completion.handles.level_number ~= 0 then -- if this isn't a level 0 (special derby), then do this stuff 
  663. 			 
  664. 				-- Quit Activity 
  665. 				if Completion.type == FAILURE_ACTIVITY or Completion.type == SUCCESS_ACTIVITY then			 
  666. 					if Completion.handles.activity_type == 13 then 
  667. 						local options = { [0] = "COMPLETION_QUIT_ZOMBIE", [1] = "CONTROL_NO" } 
  668. 						dialog_box_open("COMPLETION_QUIT_ZOMBIE", "COMPLETION_QUIT_ZOMBIE_CONFIRMATION", options, "completion_exit_callback", default, priority, true, nil, false, false)	 
  669. 					else  
  670. 						local options = { [0] = "COMPLETION_EXIT_ACTIVITY", [1] = "CONTROL_NO" } 
  671. 						dialog_box_open("COMPLETION_EXIT_ACTIVITY", "COMPLETION_EXIT_ACTIVITY_CONFIRMATION", options, "completion_exit_callback", default, priority, true, nil, false, false) 
  672. 					end 
  673. 				--Quit Level 3 Activity Reward Screen		 
  674. 				elseif Completion.reward_source == SUCCESS_ACTIVITY and Completion.type == UNLOCK_REWARD then 
  675. 					local options = { [0] = "COMPLETION_EXIT_ACTIVITY", [1] = "CONTROL_NO" } 
  676. 					dialog_box_open("COMPLETION_EXIT_ACTIVITY", "COMPLETION_EXIT_ACTIVITY_CONFIRMATION", options, "completion_exit_callback", default, priority, true, nil, false, false) 
  677. 				-- Quit Mission 
  678. 				elseif Completion.type == FAILURE_MISSION then 
  679. 					local options = { [0] = "COMPLETION_EXIT_MISSION", [1] = "CONTROL_NO" } 
  680. 					dialog_box_open("COMPLETION_EXIT_MISSION", "COMPLETION_EXIT_MISSION_CONFIRMATION", options, "completion_exit_callback", default, priority, true, nil, false, false) 
  681. 					return 
  682.  
  683. 				-- Quit Stronghold 
  684. 				elseif Completion.type == FAILURE_STRONGHOLD then 
  685. 					local options = { [0] = "COMPLETION_EXIT_STRONGHOLD", [1] = "CONTROL_NO" } 
  686. 					dialog_box_open("COMPLETION_EXIT_STRONGHOLD", "COMPLETION_EXIT_STRONGHOLD_CONFIRMATION", options, "completion_exit_callback", default, priority, true, nil, false, false) 
  687. 					return 
  688. 				else 
  689. 					process_event = true 
  690. 				end 
  691. 			else 
  692. 				--this is just for Level 0 stuff (Special Derby) 
  693. 				completion_call_callback(COMPLETION_EXIT) 
  694. 				process_event = true 
  695. 			end 
  696. 		elseif event == "alt_select" and Completion_is_coop() == false and Completion.x_available == true  then 
  697. 			-- Retry from beginning (missions and sh) 
  698. 			local options = { [0] = "COMPLETION_RESTART_BEGINNING", [1] = "CONTROL_NO" } 
  699. 			dialog_box_open("SGI_RETRY", "HUD_RETRY_MISSION_MESSAGE_FULL", options, "completion_retry_mission_beginning", default, priority, true, nil, false, false) 
  700. 			return 
  701. 		end 
  702.  
  703.  
  704. 		if process_event == true then 
  705. 			Completion.input_block = true 
  706. 			Completion.exiting = true 
  707. 			completion_fade_out_all(0) 
  708. 		end 
  709. 		 
  710. 	end 
  711. 	 
  712. 	 
  713. 	--skip screens if i play A before the end 
  714. 	if Completion_is_animating == true then 
  715. 		if event == "select" or event == "back" then 
  716. 			--is an animation playing? 
  717. 			Completion_is_animating = false 
  718. 			Completion_force_skip = true 
  719. 			completion_tips_fade_in(0) 
  720. 			--Attempting to skip everything 
  721. 			 
  722. 			 
  723. 			if Completion.is_respect_screen ~= true then 
  724. 							 
  725. 				if Completion.type == SUCCESS_ACTIVITY then 
  726. 					 
  727. 					local tween_h = vint_object_find("top_ender", Completion.handles.top_grp_anim_h) 
  728. 					vint_set_property(tween_h, "end_event", nil) 
  729. 	 
  730. 					local tween_h = vint_object_find("cash_ender", Completion.handles.cr_cash_fade_in_anim_h) 
  731. 					vint_set_property(tween_h, "end_event", nil) 
  732. 					 
  733. 					local tween_h = vint_object_find("respect_ender", Completion.handles.cr_respect_fade_in_anim_h) 
  734. 					vint_set_property(tween_h, "end_event", nil) 
  735. 					 
  736. 					local tween_h = vint_object_find("style_ender", Completion.handles.style_grp_anim) 
  737. 					vint_set_property(tween_h, "end_event", nil) 
  738. 					 
  739. 					completion_cr_cash_fade_in() 
  740. 							  
  741. 					--Pop in cash 
  742. 					vint_set_property(Completion.handles.cash_v_h, "text_tag", "$" .. format_cash(Completion_cash_reward.cash)) 
  743. 					vint_set_property(Completion.handles.cash_t_h, "alpha", 1) 
  744. 					vint_set_property(Completion.handles.cash_v_h, "alpha", 1) 
  745. 					vint_set_property(Completion.handles.cash_t_h, "visible", true) 
  746. 					vint_set_property(Completion.handles.cash_v_h, "visible", true) 
  747. 					 
  748. 					--Respect if exists 
  749. 					if Completion_cash_reward.has_respect == true then 
  750. 						 
  751. 						completion_cr_respect_fade_in() 
  752. 					 
  753. 						--Pop in respect			 
  754. 						local bonus_style = Completion_respect.bonus_style 
  755. 						local new_respect = Completion_respect.new_respect 
  756. 						local cur_respect = Completion_respect.cur_respect 
  757. 						local props_to_unlock = Completion_respect.props_to_unlock 
  758. 						local respect_bonus = new_respect - cur_respect - bonus_style -- how much respect did i win 
  759. 						 
  760. 						--whats my respect multiplier on start 
  761. 						local multiplier = floor(Completion_respect.new_respect / props_to_unlock) 
  762. 						 
  763. 						--set the init angle value 
  764. 						local new_angle = ((new_respect - (props_to_unlock * multiplier)) / props_to_unlock) * COMPLETION_RADIAN  
  765. 						 
  766. 						--call the function that sets the angle and multiplier, just this once 
  767. 						completion_respect_meter_set(new_angle, multiplier, new_respect - cur_respect) 
  768. 				 
  769. 						vint_set_property(Completion.handles.respect_t_h, "alpha", 1) 
  770. 						vint_set_property(Completion.handles.respect_v_h, "alpha", 1) 
  771. 						vint_set_property(Completion.handles.respect_b_grp_h, "alpha", 1) 
  772. 					 
  773. 						--Respect bonus ? 
  774. 						if bonus_style > 0 then 
  775. 							completion_style_bonus_fade_in() 
  776. 							vint_set_property(Completion.handles.style_grp, "visible", true) 
  777. 							vint_set_property(Completion.handles.style_grp, "alpha", 1) 
  778. 						else 
  779. 							vint_set_property(Completion.handles.style_grp, "visible", false) 
  780. 						end		 
  781. 					end 
  782. 					 
  783. 				elseif Completion.type == SUCCESS_MISSION then 
  784. 					 
  785. 					if Completion_is_hood_screen == false then 
  786. 						--clear callbacks 
  787. 						local tween_h = vint_object_find("top_ender", Completion.handles.top_grp_anim_h) 
  788. 						vint_set_property(tween_h, "end_event", nil) 
  789. 						local tween_h = vint_object_find("news_image_ender", Completion.handles.news_clip_fade_in_anim_h) 
  790. 						vint_set_property(tween_h, "end_event", nil) 
  791. 						local tween_h = vint_object_find("hood_cash_ender", Completion.handles.hood_cash_fade_in_anim_h) 
  792. 						vint_set_property(tween_h, "end_event", nil)	 
  793. 						 
  794. 						vint_set_property(Completion.handles.hood_cash_v_h, "text_tag",  "$" .. format_cash(Completion_cash_reward.cash)) 
  795. 						vint_set_property(Completion.handles.hood_cash_t_h, "text_tag", "COMPLETION_CASH") 
  796.  
  797. 						completion_news_clip_fade_in() 
  798. 						completion_hood_cash_fade_in() 
  799. 					 
  800. 					else 
  801. 									 
  802. 						--clear callbacks 
  803. 						local tween_h = vint_object_find("unlock_ender", Completion.handles.unlock_fade_in_anim_h) 
  804. 						vint_set_property(tween_h, "end_event", nil) 
  805. 						local tween_h = vint_object_find("hood_cash_ender", Completion.handles.hood_cash_fade_in_anim_h) 
  806. 						vint_set_property(tween_h, "end_event", nil) 
  807. 						local tween_h = vint_object_find("hood_owned_ender", Completion.handles.hood_owned_fade_in_anim_h) 
  808. 						vint_set_property(tween_h, "end_event", nil) 
  809. 						 
  810. 						Completion_cash_per_day.finished = true 
  811. 					 
  812. 						vint_set_property(Completion.handles.unlock_h, "visible", true) 
  813. 						completion_unlock_fade_in() 
  814. 						completion_hood_cash_fade_in() 
  815. 						vint_set_property(Completion.handles.hood_cash_v_h, "text_tag", "$" .. format_cash(Completion_cash_per_day.cash)) 
  816. 						vint_set_property(Completion.handles.hood_owned_t_h, "visible", true) 
  817. 						vint_set_property(Completion.handles.hood_owned_v_h, "visible", true) 
  818. 						completion_hood_owned_fade_in(0) 
  819. 					 
  820. 					end 
  821. 				 
  822. 				elseif Completion.type == SUCCESS_STRONGHOLD then 
  823. 					 
  824. 					if Completion_is_hood_screen == false then					 
  825. 						--clear callbacks 
  826. 						local tween_h = vint_object_find("top_ender", Completion.handles.top_grp_anim_h) 
  827. 						vint_set_property(tween_h, "end_event", nil) 
  828. 						local tween_h = vint_object_find("news_image_ender", Completion.handles.news_clip_fade_in_anim_h) 
  829. 						vint_set_property(tween_h, "end_event", nil) 
  830. 						local tween_h = vint_object_find("hood_cash_ender", Completion.handles.hood_cash_fade_in_anim_h) 
  831. 						vint_set_property(tween_h, "end_event", nil)	 
  832. 				 
  833. 						vint_set_property(Completion.handles.hood_cash_v_h, "text_tag",  "$" .. format_cash(Completion_cash_reward.cash)) 
  834. 						vint_set_property(Completion.handles.hood_cash_t_h, "text_tag", "COMPLETION_CASH") 
  835.  
  836. 						completion_news_clip_fade_in() 
  837. 						completion_hood_cash_fade_in() 
  838. 					 
  839. 					else  
  840. 						local tween_h = vint_object_find("unlock_ender", Completion.handles.unlock_fade_in_anim_h) 
  841. 						vint_set_property(tween_h, "end_event", nil) 
  842. 						local tween_h = vint_object_find("hood_cash_ender", Completion.handles.hood_cash_fade_in_anim_h) 
  843. 						vint_set_property(tween_h, "end_event", nil) 
  844. 						local tween_h = vint_object_find("hood_owned_ender", Completion.handles.hood_owned_fade_in_anim_h) 
  845. 						vint_set_property(tween_h, "end_event", nil) 
  846. 						 
  847. 						Completion_cash_per_day.finished = true 
  848. 					 
  849. 						vint_set_property(Completion.handles.unlock_h, "visible", true) 
  850. 						completion_unlock_fade_in() 
  851. 						completion_hood_cash_fade_in() 
  852. 						vint_set_property(Completion.handles.hood_cash_v_h, "text_tag", "$" .. format_cash(Completion_cash_per_day.cash)) 
  853. 						vint_set_property(Completion.handles.hood_owned_t_h, "visible", true) 
  854. 						vint_set_property(Completion.handles.hood_owned_v_h, "visible", true) 
  855. 						completion_hood_owned_fade_in(0)			 
  856. 					end 
  857. 				 
  858. 				elseif Completion.type == FAILURE_MISSION then 
  859. 				 
  860. 					completion_fail_fade_in() 
  861. 				 
  862. 				elseif Completion.type == FAILURE_STRONGHOLD then 
  863.  
  864. 					completion_fail_fade_in() 
  865. 				 
  866. 				elseif Completion.type == FAILURE_ACTIVITY then 
  867.  
  868. 					completion_fail_fade_in() 
  869. 					 
  870. 				elseif Completion.type == JUST_UNLOCKS then 
  871.  
  872. 					completion_unlock_fade_in() 
  873. 					completion_unlock_desc_fade_in() 
  874. 				 
  875. 				elseif Completion.type == UNLOCK_REWARD then 
  876.  
  877. 					local tween_h = vint_object_find("unlock_ender", Completion.handles.unlock_fade_in_anim_h) 
  878. 					vint_set_property(tween_h, "end_event", nil) 
  879.  
  880. 					local tween_h = vint_object_find("unlock_desc_ender", Completion.handles.unlock_desc_fade_in_anim_h) 
  881. 					vint_set_property(tween_h, "end_event", nil) 
  882. 					 
  883. 					completion_unlock_fade_in() 
  884. 					completion_unlock_desc_fade_in() 
  885. 				 
  886. 			--	elseif Completion_show_reward_screen() == true and Completion.type ~= SUCCESS_ACTIVITY then 
  887. 				 
  888. 				end 
  889. 			 
  890. 			else 
  891.  
  892. 				local tween_h = vint_object_find("st_ender", Completion.handles.gang_zoom_st_h) 
  893. 				vint_set_property(tween_h, "start_event", nil) 
  894.  
  895. 				local tween_h = vint_object_find("bh_ender", Completion.handles.gang_zoom_bh_h) 
  896. 				vint_set_property(tween_h, "start_event", nil) 
  897.  
  898. 				local tween_h = vint_object_find("rn_ender", Completion.handles.gang_zoom_rn_h) 
  899. 				vint_set_property(tween_h, "start_event", nil) 
  900.  
  901. 				local tween_h = vint_object_find("ss_ender", Completion.handles.gang_zoom_ss_h) 
  902. 				vint_set_property(tween_h, "start_event", nil) 
  903.  
  904. 				local tween_h = vint_object_find("ep_ender", Completion.handles.gang_zoom_ep_h) 
  905. 				vint_set_property(tween_h, "start_event", nil) 
  906. 				 
  907. 				local tween_h = vint_object_find("you_got_respect_ender", Completion.handles.you_got_respect_fade_in_anim_h) 
  908. 				vint_set_property(tween_h, "end_event", nil) 
  909. 			 
  910. 			end 
  911.  
  912. 			--speed up time to kill any animations 
  913. 			audio_play(Completion_audio.tips) 
  914. 			local current_time = vint_get_time_index() 
  915. 			local future_time = current_time + 10 
  916. 			vint_set_time_index(future_time) 
  917. 			 
  918. 		end 
  919. 	end 
  920. end 
  921.  
  922. function completion_release_input() 
  923. 	for idx, val in Completion.input do 
  924. 		vint_unsubscribe_to_input_event(val) 
  925. 	end 
  926. 	Completion.input = { } 
  927. end 
  928.  
  929. function completion_init_mission_success(mission_number, team, mission_name, cash_reward, image_base, cur_respect, props_to_unlock, cash_per_day, hoods_owned, hoods_total, hood_name) 
  930. 	Completion.handles.failure = false 
  931. 	Completion_is_hood_screen = false 
  932. 	--local insertion_text 	= { [0] = mission_number } 
  933. 	local insertion_text2 	= { [0] = mission_name } 
  934. 	 
  935. 	 
  936. 	Completion.handles.cur_respect = cur_respect 
  937. 	Completion.handles.props_to_unlock = props_to_unlock 
  938. 	 
  939. 	if cur_respect >= props_to_unlock  then 
  940. 		Completion_show_respect_screen = true 
  941. 	end 
  942. 	 
  943. 	if Completion.num_unlocks == 0 and cur_respect < props_to_unlock and hood_name == nil then 
  944. 		Completion_is_last_screen = true 
  945. 	end 
  946. 	 
  947. 	--local pretitle = vint_insert_values_in_string("COMPLETION_MISSION_NUMBER", insertion_text) 
  948. 	local subtitle = vint_insert_values_in_string("COMPLETION_MISSION_COMPLETE", insertion_text2 ) 
  949. 	 
  950. 	Completion_force_skip = false 
  951. 	Completion_is_animating = true 
  952. 	Completion_is_hood_screen = false 
  953. 	 
  954. 	completion_init_title("COMPLETION_MISSION_NUMBER", Completion_Gang_Names[team], subtitle) 
  955. 	completion_init_wall(Completion_Gang_Images[team]) 
  956. 	completion_init_buttons("COMPLETION_CONTINUE") 
  957. 	 
  958. 	completion_move_unlockable_text(true) 
  959. 	 
  960. 	--store one time cash reward  
  961. 	Completion_cash_reward.cash = cash_reward 
  962. 	 
  963. 	--store hood cash per day that shit. we'll initialize later 
  964. 	Completion_cash_per_day.cash = cash_per_day 
  965. 	Completion_cash_per_day.image_base = image_base 
  966. 	Completion_cash_per_day.hood_name = hood_name 
  967. 	Completion_cash_per_day.hoods_owned = hoods_owned 
  968. 	Completion_cash_per_day.hoods_total = hoods_total 
  969. 	--completion_init_hood(cash_per_day, image_base, hood_name, hoods_owned, hoods_total) 
  970.  
  971. 	--cash reward init 
  972. 	vint_set_property(Completion.handles.hood_cash_v_h, "text_tag", "$0") 
  973. 	vint_set_property(Completion.handles.hood_cash_t_h, "text_tag", "COMPLETION_CASH") 
  974. 	 
  975. 	--load the image 
  976. 	if image_base ~= nil then 
  977. 		completion_load_peg("ui_c_news_" .. image_base) 
  978. 		vint_set_property(Completion.handles.thing_image_h, "image", "ui_ct_news_" .. image_base)	--	Newspaper clipping 
  979. 	end 
  980. 	 
  981. 	-- Animate in the main stuff 
  982. 	completion_fade_in_wall_and_top(1) 
  983.  
  984. 	--animate the newspaper 
  985. 	local tween_h = vint_object_find("top_ender", Completion.handles.top_grp_anim_h) 
  986. 	vint_set_property(tween_h, "end_event", "completion_news_clip_fade_in") 
  987.  
  988. 	--callback for cash reward fade in 
  989. 	local tween_h = vint_object_find("news_image_ender", Completion.handles.news_clip_fade_in_anim_h) 
  990. 	vint_set_property(tween_h, "end_event", "completion_hood_cash_fade_in") 
  991. 	 
  992. 	--shut off the images at fade out 
  993. 	local tween_h = vint_object_find("news_image_alpha", Completion.handles.news_clip_fade_out_anim_h) 
  994. 	vint_set_property(tween_h, "end_event", "completion_shut_off_all_layers")	 
  995. 	 
  996. 	--callback for the animate cash reward function 
  997. 	local tween_h = vint_object_find("hood_cash_ender", Completion.handles.hood_cash_fade_in_anim_h) 
  998. 	vint_set_property(tween_h, "end_event", "completion_animate_reward_cash") 
  999. 	 
  1000. 	completion_move_mission_tips() 
  1001. end 
  1002.  
  1003. function completion_init_pushback_success(team, hood_name, cash, respect) 
  1004. 	 
  1005. 	Completion_force_skip = false 
  1006. 	Completion_is_animating = true 
  1007.  
  1008. 	--some initializing stuff 
  1009. 	Completion.handles.failure = false 
  1010. 	completion_init_title(hood_name, Completion_Gang_Names[team], "PUSHBACK_SUCCESS_2") 
  1011. 	completion_init_wall(Completion_Gang_Images[team]) 
  1012. 	completion_init_buttons("COMPLETION_CONTINUE") 
  1013. 	completion_init_cash_respect(0, nil) 
  1014.  
  1015. 	--fade in stuff 
  1016. 	completion_fade_in_wall_and_top(1) 
  1017.  
  1018. 	Completion_cash_reward.cash = cash 
  1019. 	 
  1020. 	local tween_h = vint_object_find("top_ender", Completion.handles.top_grp_anim_h) 
  1021. 	vint_set_property(tween_h, "end_event", "completion_cr_cash_fade_in") 
  1022. 	 
  1023. 	local tween_h = vint_object_find("cash_ender", Completion.handles.cr_cash_fade_in_anim_h) 
  1024. 	vint_set_property(tween_h, "end_event", "completion_animate_cash") 
  1025. 	 
  1026. 	completion_move_activity_tips(0, 0, 0) 
  1027.  
  1028. 	-- remove this when you implement it. 
  1029. 	--vint_document_unload(vint_document_unload(vint_document_find("completion"))	 
  1030. end 
  1031.  
  1032. function completion_move_mission_tips() 
  1033. 	--move button tips 
  1034. 	local unlock_x, unlock_y = vint_get_property(Completion.handles.unlock_h, "anchor") 
  1035. 	local gap = 15 
  1036. 	local tax, tay = vint_get_property(Completion.handles.tips_h, "anchor")  --store tax for later 
  1037. 	local imagew, imageh = element_get_actual_size(Completion.handles.thing_image_h) 
  1038. 	local imagex, imagey = vint_get_property(Completion.handles.thing_image_h, "anchor") 
  1039. 	 
  1040. 	local height = 0 
  1041. 	 
  1042. 	if imageh > 412 then 
  1043. 		imageh = 412 
  1044. 	elseif Completion_is_hood_screen == true then 
  1045. 		imageh = 300 
  1046. 	end 
  1047. 		 
  1048. 	local height = imagey + imageh + unlock_y + gap 
  1049. 	 
  1050. 	vint_set_property(Completion.handles.tips_h, "anchor", tax, height) 
  1051. end 
  1052.  
  1053.  
  1054. function completion_init_stronghold_success(team, stronghold_name, hood_name, cash_per_day, hoods_owned, hoods_total, image_base, cash_reward, cur_respect, props_to_unlock) 
  1055. 	Completion.handles.failure = false 
  1056. 	 
  1057. 	local insertion_text = { [0] = stronghold_name } 
  1058. 	local subtitle = vint_insert_values_in_string("COMPLETION_MISSION_COMPLETE", insertion_text ) 
  1059. 	 
  1060. 	Completion.handles.cur_respect = cur_respect 
  1061. 	Completion.handles.props_to_unlock = props_to_unlock 
  1062. 	 
  1063. 	if cur_respect >= props_to_unlock  then 
  1064. 		Completion_show_respect_screen = true 
  1065. 	end 
  1066. 	 
  1067. 	if Completion.num_unlocks == 0 and cur_respect < props_to_unlock and hood_name == nil then 
  1068. 		Completion_is_last_screen = true 
  1069. 	end 
  1070. 	 
  1071. 	completion_move_unlockable_text(true) 
  1072. 	 
  1073. 	completion_init_title("COMPLETION_STRONGHOLD", Completion_Gang_Names[team], subtitle) 
  1074. 	completion_init_wall(Completion_Gang_Images[team]) 
  1075. 	 
  1076. 	Completion_force_skip = false 
  1077. 	Completion_is_animating = true 
  1078. 	Completion_is_hood_screen = false 
  1079. 	completion_init_buttons("COMPLETION_CONTINUE") 
  1080.  
  1081. 	--store one time cash reward  
  1082. 	Completion_cash_reward.cash = cash_reward 
  1083. 	 
  1084. 	--store hood cash per day that shit. we'll initialize later 
  1085. 	Completion_cash_per_day.cash = cash_per_day 
  1086. 	Completion_cash_per_day.image_base = image_base 
  1087. 	Completion_cash_per_day.hood_name = hood_name 
  1088. 	Completion_cash_per_day.hoods_owned = hoods_owned 
  1089. 	Completion_cash_per_day.hoods_total = hoods_total 
  1090. 	--completion_init_hood(cash_per_day, image_base, hood_name, hoods_owned, hoods_total) 
  1091. 	 
  1092. 	--cash reward init 
  1093. 	vint_set_property(Completion.handles.hood_cash_v_h, "text_tag", "$0") 
  1094. 	vint_set_property(Completion.handles.hood_cash_t_h, "text_tag", "COMPLETION_CASH") 
  1095. 	 
  1096. 	--load the image 
  1097. 	if image_base ~= nil then 
  1098. 		completion_load_peg("ui_c_news_" .. image_base) 
  1099. 		vint_set_property(Completion.handles.thing_image_h, "image", "ui_ct_news_" .. image_base)	--	Newspaper clipping 
  1100. 	end 
  1101. 	 
  1102. 	-- Animate in the main stuff 
  1103. 	completion_fade_in_wall_and_top(1) 
  1104.  
  1105. 	--animate the newspaper 
  1106. 	local tween_h = vint_object_find("top_ender", Completion.handles.top_grp_anim_h) 
  1107. 	vint_set_property(tween_h, "end_event", "completion_news_clip_fade_in") 
  1108.  
  1109. 	--callback for cash reward fade in 
  1110. 	local tween_h = vint_object_find("news_image_ender", Completion.handles.news_clip_fade_in_anim_h) 
  1111. 	vint_set_property(tween_h, "end_event", "completion_hood_cash_fade_in") 
  1112. 	 
  1113. 	--callback for the animate cash reward function 
  1114. 	local tween_h = vint_object_find("hood_cash_ender", Completion.handles.hood_cash_fade_in_anim_h) 
  1115. 	vint_set_property(tween_h, "end_event", "completion_animate_reward_cash")	 
  1116. 	 
  1117. 	--shut off the images at fade out 
  1118. 	local tween_h = vint_object_find("news_image_alpha", Completion.handles.news_clip_fade_out_anim_h) 
  1119. 	vint_set_property(tween_h, "end_event", "completion_shut_off_all_layers") 
  1120. 	 
  1121. 	completion_move_mission_tips() 
  1122. end 
  1123.  
  1124. function completion_init_activity_success(district, activity_name, level_number, cash, cur_respect, new_respect, style_level, bonus_style, props_to_unlock, activity_type, last_level) 
  1125. 		 
  1126. 	Completion_force_skip = false 
  1127. 	Completion_is_animating = true 
  1128. 	 
  1129. 	if new_respect >= props_to_unlock  then 
  1130. 		Completion_show_respect_screen = true 
  1131. 	end 
  1132. 	 
  1133. 	Completion.handles.cur_respect = new_respect 
  1134. 	Completion.handles.props_to_unlock = props_to_unlock 
  1135. 	 
  1136. 	debug_print("vint", "cur" .. var_to_string(new_respect) .. "\n") 
  1137. 	debug_print("vint", "props_to_unlock" .. var_to_string(props_to_unlock) .. "\n") 
  1138. 	 
  1139. 	--some initializing stuff 
  1140. 	Completion.handles.failure = false 
  1141. 	local insertion_text = { [0] = level_number } 
  1142. 	completion_init_title(district, activity_name, vint_insert_values_in_string("COMPLETION_ACTIVITY_LEVEL_COMPLETE", insertion_text)) 
  1143. 	completion_init_cash_respect(cash, new_respect - cur_respect) 
  1144. 	completion_init_wall(Completion_Activity_Images[activity_type + 1]) 
  1145. 	Completion.last_level = last_level 
  1146.  
  1147. 	if last_level == true and Completion.num_unlocks == 0 then 
  1148. 		--	If we have no unlocks, and there is no more activity to continue, show just exit 
  1149. 		Completion_is_last_screen = true 
  1150. 		if Completion_show_respect_screen ~= true then 
  1151. 			completion_init_buttons("COMPLETION_EXIT_ACTIVITY", nil, nil) 
  1152. 		else 
  1153. 			completion_init_buttons("COMPLETION_CONTINUE", nil, nil) 
  1154. 		end 
  1155. 		if activity_type == 13 then 
  1156. 			--change tips if zombie has no unlocks 
  1157. 			completion_init_buttons("COMPLETION_CONTINUE", nil, nil) 
  1158. 		end 
  1159. 	elseif Completion.num_unlocks > 0 or Completion_show_respect_screen == true then	 
  1160. 		--	Continue if there are unlocks coming up 
  1161. 		-- or continue if we are showing the respect screen 
  1162. 		--completion_tips_fade_in(1.5 + COMPLETION_LOAD_DELAY) 
  1163. 		completion_init_buttons("COMPLETION_CONTINUE", nil, nil) 
  1164. 	else  
  1165. 		--	Otherwise, show the proper "Continue Activity" or "Exit Activity" 
  1166. 		Completion_is_last_screen = true 
  1167. 		completion_init_buttons("COMPLETION_CONTINUE_ACTIVITY", nil, "COMPLETION_EXIT_ACTIVITY") 
  1168. 	end 
  1169.  
  1170.  
  1171. 	if activity_type == 13 then 
  1172. 		--change the top line if this is Zombie, just show respect... 
  1173. 		Completion.handles.activity_type = 13 
  1174. 		vint_set_property(Completion.handles.top_1_h, "text_tag", "Videogames") 
  1175. 		vint_set_property(Completion.handles.top_3_h, "text_tag", "COMPLETION_COMPLETE") 
  1176. 		vint_set_property(Completion.handles.cash_t_h, "visible", false) 
  1177. 		vint_set_property(Completion.handles.cash_v_h, "visible", false) 
  1178. 		local cr_x, cr_y = vint_get_property(Completion.handles.cash_respect_h, "anchor") 
  1179. 		vint_set_property(Completion.handles.cash_respect_h, "anchor", -85, cr_y) 
  1180. 	elseif level_number == 0 then 
  1181. 		Completion.handles.level_number = 0 
  1182. 		vint_set_property(Completion.handles.top_3_h, "text_tag", "COMPLETION_COMPLETE") 
  1183. 		if Completion_is_coop() then -- PC fix: client must display WAIT FOR HOST 
  1184. 			completion_coop_waiting() 
  1185. 		else 
  1186. 			completion_init_buttons(nil, nil, "COMPLETION_EXIT_ACTIVITY") 
  1187. 		end 
  1188. 	end 
  1189. 	 
  1190. 	--fade in stuff 
  1191. 	completion_fade_in_wall_and_top(1) 
  1192. 	 
  1193. 	--store the globals I'm gonna need for later  
  1194. 	Completion_respect.new_respect = new_respect 
  1195. 	Completion_respect.cur_respect = cur_respect 
  1196. 	Completion_respect.props_to_unlock = props_to_unlock 
  1197. 	Completion_respect.bonus_style = bonus_style 
  1198. 	Completion_cash_reward.cash = cash 
  1199. 	 
  1200. 	debug_print("vint", "cash" .. var_to_string(cash) .. "\n\n\n") 
  1201. 	 
  1202. 	if cash > 0 then 
  1203. 		local tween_h = vint_object_find("top_ender", Completion.handles.top_grp_anim_h) 
  1204. 		vint_set_property(tween_h, "end_event", "completion_cr_cash_fade_in") 
  1205. 		local tween_h = vint_object_find("cash_ender", Completion.handles.cr_cash_fade_in_anim_h) 
  1206. 		vint_set_property(tween_h, "end_event", "completion_animate_cash") 
  1207. 	elseif cash <= 0 and new_respect > cur_respect then 
  1208. 		completion_cr_respect_fade_in(3.25) 
  1209. 	elseif cash <= 0 and new_respect == cur_respect then 
  1210. 		completion_tips_fade_in_offset(3.25) 
  1211. 	end 
  1212. 	 
  1213. 	if new_respect > cur_respect then 
  1214. 		--tell the completion_animate_cash function that there should be respect 
  1215. 		Completion_cash_reward.has_respect = true 
  1216. 		--set up the respect count call back 
  1217. 		local tween_h = vint_object_find("respect_ender", Completion.handles.cr_respect_fade_in_anim_h) 
  1218. 		vint_set_property(tween_h, "end_event", "completion_animate_respect") 
  1219. 	else 
  1220. 		Completion_cash_reward.has_respect = false 
  1221. 		--turn the respect stuff off 
  1222. 		vint_set_property(Completion.handles.respect_b_grp_h, "visible", false) 
  1223. 		vint_set_property(Completion.handles.respect_t_h, "visible", false) 
  1224. 		vint_set_property(Completion.handles.respect_v_h, "visible", false) 
  1225. 	end 
  1226.  
  1227. 	 
  1228. 	--whats my respect multiplier on start 
  1229. 	local old_multiplier = floor(cur_respect / props_to_unlock) 
  1230. 	 
  1231. 	--set the init angle value 
  1232. 	local old_angle = ((cur_respect - (props_to_unlock * old_multiplier)) / props_to_unlock) * COMPLETION_RADIAN  
  1233. 	 
  1234. 	--my respect always counts from 0 
  1235. 	local old_respect = 0 
  1236. 	 
  1237. 	--call the function that sets the angle and multiplier, just this once 
  1238. 	completion_respect_meter_set(old_angle, old_multiplier, old_respect) 
  1239. 	 
  1240. 	completion_move_activity_tips(cur_respect, new_respect, bonus_style) 
  1241. 	 
  1242. end 
  1243.  
  1244. function completion_move_activity_tips(cur_respect, new_respect, bonus_style) 
  1245. 	local tax, tay = vint_get_property(Completion.handles.tips_h, "anchor") 
  1246. 	local content_y = 300 
  1247. 	 
  1248. 	if new_respect > cur_respect then 
  1249. 		content_y = 380 
  1250. 	end 
  1251. 	 
  1252. 	if bonus_style > 0 then 
  1253. 		content_y = 436 
  1254. 	end 
  1255. 	 
  1256. 	vint_set_property(Completion.handles.tips_h, "anchor", tax, content_y) 
  1257. 	 
  1258. end 
  1259.  
  1260.  
  1261. --+++++++++++++++++++++++++++++++++++++++ 
  1262. ----------------------------------------- 
  1263. --ACTIVITY CASH REWARD 
  1264. ----------------------------------------- 
  1265. --+++++++++++++++++++++++++++++++++++++++ 
  1266. function completion_animate_cash() 
  1267.    thread_new("completion_animate_cash_thread") 
  1268. end 
  1269.  
  1270. function completion_animate_cash_thread() 
  1271. 	--this is for activities 
  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 = Completion_cash_reward.cash 
  1280.  
  1281. 	local amt_min = 100 
  1282. 	local amt_max = 5000 
  1283. 	 
  1284. 	local time_min = 300 
  1285. 	local time_max = 2999 
  1286. 	local init_time = floor(vint_get_time_index() * 1000) 
  1287. 	local cur_time = init_time 
  1288. 	local time_to_count = floor(time_min + ((time_max - time_min) * (cash / amt_max))) 
  1289. 	 
  1290. 	if time_to_count > time_max then 
  1291. 		time_to_count = time_max 
  1292. 	end 
  1293.  
  1294. 	--Force close thread 
  1295. 	if Completion_force_skip == true then 
  1296. 		Completion_force_skip = false 
  1297. 		return 
  1298. 	end 
  1299. 	 
  1300. 	--init sound IDs 
  1301. 	local activity_cash_count = 0 
  1302. 	local activity_cash_hit = 0 
  1303. 	 
  1304. 	if cash > 0 then 
  1305. 		activity_cash_count = audio_play(Completion_audio.cash_count) 
  1306. 	end 
  1307. 	 
  1308. 	while is_complete == false do 
  1309. 		 
  1310. 		local cur_time = floor(vint_get_time_index() * 1000) - init_time 
  1311. 				 
  1312. 		--Force close thread 
  1313. 		if Completion_force_skip == true then 
  1314. 			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. 		--set my values 
  1321. 		cash_this_frame = cash * (cur_time / time_to_count) 
  1322. 		vint_set_property(Completion.handles.cash_v_h, "text_tag", "$" .. format_cash(cash_this_frame)) 
  1323. 		 
  1324. 		if cur_time >= time_to_count then 
  1325. 			audio_fade_out(activity_cash_count, 50) 
  1326. 			activity_cash_hit = audio_play(Completion_audio.cash_hit) 
  1327. 			vint_set_property(Completion.handles.cash_v_h, "text_tag", "$" .. format_cash(cash)) 
  1328. 			is_complete = true 
  1329. 			--audio_stop(Completion_audio.cash_count, 50) 
  1330. 			if Completion_cash_reward.has_respect == true then 
  1331. 				--fade in the respect 
  1332. 				completion_cr_respect_fade_in(.4) 
  1333. 			else 
  1334. 				--nah... show the buttons instead 
  1335. 				vint_set_property(Completion.handles.style_grp, "visible", false) 
  1336. 				completion_tips_fade_in_offset(.4) 
  1337. 			end 
  1338. 		end 
  1339. 		thread_yield() 
  1340. 	end		 
  1341. end 
  1342.  
  1343.  
  1344.  
  1345. function completion_respect_meter_set(end_angle, multiplier, respect) 
  1346.  
  1347. 	--set the current angle and multiplier of respect bar 
  1348. 	vint_set_property(Completion.handles.respect_b_0_h, "end_angle", end_angle)  
  1349. 	vint_set_property(Completion.handles.respect_b_1_h, "end_angle", end_angle) 
  1350. 	vint_set_property(Completion.handles.respect_multi_grp, "rotation", -end_angle) 
  1351. 	vint_set_property(Completion.handles.respect_multiplier, "rotation", end_angle) 
  1352. 	if multiplier == 0 then 
  1353. 		vint_set_property(Completion.handles.respect_multiplier, "visible", false) 
  1354. 	else 
  1355. 		vint_set_property(Completion.handles.respect_multiplier, "visible", true) 
  1356. 		vint_set_property(Completion.handles.respect_multiplier, "text_tag", "x" .. multiplier) 
  1357. 	end 
  1358. 	vint_set_property(Completion.handles.respect_v_h, "text_tag", format_cash(respect)) 
  1359. 	 
  1360. end 
  1361.  
  1362. --+++++++++++++++++++++++++++++++++++++++ 
  1363. ----------------------------------------- 
  1364. --ACTIVITY RESPECT COUNT UP 
  1365. ----------------------------------------- 
  1366. --+++++++++++++++++++++++++++++++++++++++ 
  1367.  
  1368. function completion_animate_respect() 
  1369.    thread_new("completion_animate_respect_thread") 
  1370. end 
  1371.  
  1372. function completion_animate_respect_thread() 
  1373. 	--init stuff 
  1374. 	local start_respect = 0 
  1375. 	local respect = -1 
  1376. 	local multiplier = -1 
  1377. 	local end_angle = -1 
  1378. 	local respect_this_frame = -1 
  1379. 	local is_complete = false 
  1380.  
  1381. 	--get the variables from the global 
  1382. 	local bonus_style = Completion_respect.bonus_style 
  1383. 	local new_respect = Completion_respect.new_respect 
  1384. 	local cur_respect = Completion_respect.cur_respect 
  1385. 	local props_to_unlock = Completion_respect.props_to_unlock 
  1386. 	local respect_bonus = new_respect - cur_respect - bonus_style -- how much respect did i win 
  1387. 	 
  1388. 	local amt_max = 14000 
  1389. 	 
  1390. 	local time_min = 300 
  1391. 	local time_max = 2999 
  1392. 	local init_time = floor(vint_get_time_index() * 1000) 
  1393. 	local cur_time = init_time 
  1394. 	local time_to_count = floor(time_min + ((time_max - time_min) * (respect_bonus / amt_max)))	 
  1395. 	 
  1396. 	if time_to_count > time_max then 
  1397. 		time_to_count = time_max 
  1398. 	end 
  1399. 	 
  1400. 	--Force close thread 
  1401. 	if Completion_force_skip == true then 
  1402. 		Completion_force_skip = false 
  1403. 		return 
  1404. 	end 
  1405.  
  1406. 	--init sounds 
  1407. 	local activity_respect_count = 0 
  1408. 	local activity_respect_hit = 0 
  1409. 	local activity_respect_end = 0 
  1410. 	activity_respect_count = audio_play(Completion_audio.respect_count) 
  1411. 	 
  1412. 	local multiplier_new = 999 
  1413. 	 
  1414. 	while is_complete == false do 
  1415. 		 
  1416. 		local cur_time = floor(vint_get_time_index() * 1000) - init_time 
  1417. 		 
  1418. 		--Force close thread 
  1419. 		if Completion_force_skip == true then 
  1420. 			Completion_force_skip = false 
  1421. 			audio_fade_out(activity_respect_count, 50) 
  1422. 			audio_fade_out(activity_respect_hit, 50) 
  1423. 			return 
  1424. 		end 
  1425. 			 
  1426. 		--set my values 
  1427. 		respect_this_frame = respect_bonus * (cur_time / time_to_count) 
  1428. 		vint_set_property(Completion.handles.respect_v_h, "text_tag", "" .. format_cash(respect_this_frame)) 
  1429. 		respect = cur_respect + respect_this_frame 
  1430. 		 
  1431. 		multiplier = floor(respect/ props_to_unlock) 
  1432. 		if multiplier > multiplier_new then 
  1433. 			activity_respect_hit = audio_play(Completion_audio.respect_hit) 
  1434. 		end 
  1435. 		multiplier_new = multiplier 
  1436. 		 
  1437. 		end_angle = ((respect - (props_to_unlock * multiplier)) / props_to_unlock) * COMPLETION_RADIAN  
  1438. 		 
  1439. 		--call the function to display this shit 
  1440. 		completion_respect_meter_set(end_angle, multiplier, respect_this_frame) 
  1441. 		 
  1442. 		if cur_time  >= time_to_count then 
  1443. 			audio_fade_out(activity_respect_count, 50) 
  1444. 			audio_fade_out(activity_respect_hit, 35) 
  1445. 			activity_respect_end = audio_play(Completion_audio.respect_end) 
  1446. 			vint_set_property(Completion.handles.respect_v_h, "text_tag", "" .. format_cash(respect_bonus)) 
  1447. 			is_complete = true 
  1448. 			if bonus_style > 0 then 
  1449. 				--play the style bonus graphic 
  1450. 				completion_style_bonus_fade_in() 
  1451. 				local tween_h = vint_object_find("style_ender", Completion.handles.style_grp_anim) 
  1452. 				vint_set_property(tween_h, "end_event", "completion_animate_style") 
  1453. 			else 
  1454. 				vint_set_property(Completion.handles.style_grp, "visible", false) 
  1455. 				completion_tips_fade_in_offset(.4) 
  1456. 			end 
  1457. 		end 
  1458. 		thread_yield() 
  1459. 	end 
  1460. end 
  1461.  
  1462. --+++++++++++++++++++++++++++++++++++++++ 
  1463. ----------------------------------------- 
  1464. --ACTIVITY RESPECT STYLE BONUS 
  1465. ----------------------------------------- 
  1466. --+++++++++++++++++++++++++++++++++++++++ 
  1467.  
  1468. function completion_animate_style() 
  1469.    thread_new("completion_animate_style_thread") 
  1470. end 
  1471.  
  1472. function completion_animate_style_thread() 
  1473. 		--init stuff 
  1474. 	local start_respect = 0 
  1475. 	local respect = -1 
  1476. 	local respect_this_frame = -1 
  1477. 	local multiplier = -1 
  1478. 	local end_angle = -1 
  1479. 	local respect_this_frame = -1 
  1480. 	local is_complete = false 
  1481.  
  1482. 	--get the variables from the global 
  1483. 	local bonus_style = Completion_respect.bonus_style   
  1484. 	local new_respect = Completion_respect.new_respect 
  1485. 	local cur_respect = Completion_respect.cur_respect 
  1486. 	local props_to_unlock = Completion_respect.props_to_unlock 
  1487. 	local respect_bonus = new_respect - cur_respect - bonus_style -- how much respect did i win 
  1488. 	 
  1489. 	start_respect = cur_respect + respect_bonus 
  1490. 	 
  1491. 	local amt_max = 10000 
  1492. 	 
  1493. 	local time_min = 150 
  1494. 	local time_max = 1498 
  1495. 	local init_time = floor(vint_get_time_index() * 1000) 
  1496. 	local cur_time = init_time 
  1497. 	local time_to_count = floor(time_min + ((time_max - time_min) * (bonus_style / amt_max)))	 
  1498. 	 
  1499. 	if time_to_count > time_max then 
  1500. 		time_to_count = time_max 
  1501. 	end 
  1502. 	 
  1503. 	local activity_style_count = 0 
  1504. 	local activity_style_hit = 0 
  1505. 	 
  1506. 	activity_style_count = audio_play(Completion_audio.respect_count) 
  1507. 	 
  1508. 	local multiplier_new = 999 
  1509. 	 
  1510. 	while is_complete == false do 
  1511. 	 
  1512. 		local cur_time = floor(vint_get_time_index() * 1000) - init_time 
  1513. 	 
  1514. 		--Force close thread 
  1515. 		if Completion_force_skip == true then 
  1516. 			Completion_force_skip = false 
  1517. 			audio_fade_out(activity_style_count, 50) 
  1518. 			audio_fade_out(activity_style_hit, 50) 
  1519. 			return 
  1520. 		end 
  1521.  
  1522.  
  1523. 		respect_this_frame = bonus_style * (cur_time / time_to_count) 
  1524. 		respect = start_respect + respect_this_frame 
  1525. 		 
  1526. 		multiplier = floor(respect / props_to_unlock) 
  1527. 		if multiplier > multiplier_new  and multiplier_new ~= nil then 
  1528. 			activity_style_hit = audio_play(Completion_audio.respect_hit) 
  1529. 		end 
  1530. 		 
  1531. 		multiplier_new = multiplier 
  1532. 		 
  1533. 		end_angle = ((respect - (props_to_unlock * multiplier)) / props_to_unlock) * COMPLETION_RADIAN  
  1534. 		 
  1535. 		--call the function to display this shit 
  1536. 		completion_respect_meter_set(end_angle, multiplier, (respect_this_frame + respect_bonus)) 
  1537.  
  1538. 		if cur_time  >= time_to_count then 
  1539. 			audio_fade_out(activity_style_count, 50) 
  1540. 			activity_style_hit = audio_play(Completion_audio.respect_hit) 
  1541. 			vint_set_property(Completion.handles.respect_v_h, "text_tag", "" .. format_cash(respect_bonus + bonus_style)) 
  1542. 			is_complete = true 
  1543. 			completion_tips_fade_in(.4) 
  1544. 		end 
  1545. 		thread_yield() 
  1546. 	end 
  1547. end 
  1548.  
  1549. --+++++++++++++++++++++++++++++++++++++++ 
  1550. ----------------------------------------- 
  1551. --HOOD UNLOCK, CASH PER DAY 
  1552. ----------------------------------------- 
  1553. --+++++++++++++++++++++++++++++++++++++++ 
  1554.  
  1555. function completion_animate_hood_cash() 
  1556.    thread_new("completion_animate_hood_cash_thread") 
  1557. end 
  1558.  
  1559. function completion_animate_hood_cash_thread() 
  1560.  
  1561. 	--init stuff 
  1562. 	local start_cash = 0 
  1563. 	local cash_this_frame = -1 
  1564. 	local is_complete = false 
  1565.  
  1566. 	--get the variables from the global 
  1567. 	local cash = Completion_cash_per_day.cash 
  1568. 	 
  1569. 	local amt_min = 100 
  1570. 	local amt_max = 33000 
  1571. 	 
  1572. 	local time_min = 300 
  1573. 	local time_max = 2999 
  1574. 	local init_time = floor(vint_get_time_index() * 1000) 
  1575. 	local cur_time = init_time 
  1576. 	local time_to_count = floor(time_min + ((time_max - time_min) * (cash / amt_max)))	 
  1577.  
  1578. 	if time_to_count > time_max then 
  1579. 		time_to_count = time_max 
  1580. 	end 
  1581. 	 
  1582. 	--Force close thread 
  1583. 	if Completion_force_skip == true then 
  1584. 		Completion_force_skip = false 
  1585. 		return 
  1586. 	end 
  1587. 	 
  1588. 	--init sound IDs 
  1589. 	local hood_cash_count = 0 
  1590. 	local hood_cash_hit = 0 
  1591. 	 
  1592. 	if cash > 0 then 
  1593. 		hood_cash_count = audio_play(Completion_audio.cash_count) 
  1594. 		 
  1595. 		while is_complete == false do 
  1596. 		 
  1597. 			local cur_time = floor(vint_get_time_index() * 1000) - init_time 
  1598. 			 
  1599. 			--Force close thread 
  1600. 			if Completion_force_skip == true then 
  1601. 				Completion_force_skip = false 
  1602. 				audio_fade_out(hood_cash_count, 50) 
  1603. 				audio_fade_out(hood_cash_hit, 50) 
  1604. 				return 
  1605. 			end 
  1606. 						 
  1607. 			--set my values 
  1608. 			cash_this_frame = cash * (cur_time / time_to_count) 
  1609. 			vint_set_property(Completion.handles.hood_cash_v_h, "text_tag", "$" .. format_cash(cash_this_frame)) 
  1610. 			 
  1611. 			if cur_time >= time_to_count then 
  1612. 			 
  1613. 				audio_fade_out(hood_cash_count, 50) 
  1614. 				hood_cash_hit = audio_play(Completion_audio.cash_hit) 
  1615. 				 
  1616. 				is_complete = true 
  1617. 			 
  1618. 				--this will be checked in the process_input 
  1619. 				Completion_cash_per_day.finished = true 
  1620. 				 
  1621. 				--force the values 
  1622. 				vint_set_property(Completion.handles.hood_cash_v_h, "text_tag", "$" .. format_cash(cash)) 
  1623. 				vint_set_property(Completion.handles.hood_owned_t_h, "visible", true) 
  1624. 				vint_set_property(Completion.handles.hood_owned_v_h, "visible", true) 
  1625. 				completion_hood_owned_fade_in(.4) 
  1626. 				 
  1627. 			end 
  1628. 			thread_yield() 
  1629. 		end 
  1630. 	else 
  1631. 		completion_hood_owned_fade_in(.4) 
  1632. 	end 
  1633. 	 
  1634. 	local tween_h = vint_object_find("hood_owned_ender", Completion.handles.hood_owned_fade_in_anim_h) 
  1635. 	vint_set_property(tween_h, "end_event", "completion_tips_fade_in") 
  1636.  
  1637. end 
  1638.  
  1639. --+++++++++++++++++++++++++++++++++++++++ 
  1640. ----------------------------------------- 
  1641. --MISSIONS, ONE TIME CASH REWARD 
  1642. ----------------------------------------- 
  1643. --+++++++++++++++++++++++++++++++++++++++ 
  1644. function completion_animate_reward_cash() 
  1645.    thread_new("completion_animate_reward_cash_thread") 
  1646. end 
  1647.  
  1648. function completion_animate_reward_cash_thread() 
  1649. 	--init stuff 
  1650. 	local start_cash = 0 
  1651. 	local cash_this_frame = -1 
  1652. 	local is_complete = false 
  1653.  
  1654. 	--get the variables from the global 
  1655. 	local cash = Completion_cash_reward.cash 
  1656. 		 
  1657. 	local amt_min = 100 
  1658. 	local amt_max = 33000 
  1659. 	 
  1660. 	local time_min = 300 
  1661. 	local time_max = 2999 
  1662. 	local init_time = floor(vint_get_time_index() * 1000) 
  1663. 	local cur_time = init_time 
  1664. 	local time_to_count = floor(time_min + ((time_max - time_min) * (cash / amt_max)))	 
  1665.  
  1666. 	if time_to_count > time_max then 
  1667. 		time_to_count = time_max 
  1668. 	end 
  1669. 	 
  1670. 	vint_set_property(Completion.handles.hood_owned_t_h, "visible", false) 
  1671. 	vint_set_property(Completion.handles.hood_owned_v_h, "visible", false) 
  1672. 	 
  1673. 	--Force close thread 
  1674. 	if Completion_force_skip == true then 
  1675. 		Completion_force_skip = false 
  1676. 		return 
  1677. 	end 
  1678. 	 
  1679. 	--init sound IDs 
  1680. 	local reward_cash_count = 0 
  1681. 	local reward_cash_hit = 0 
  1682. 	 
  1683. 	if cash > 0 then 
  1684. 		reward_cash_count = audio_play(Completion_audio.cash_count) 
  1685. 		 
  1686. 		while is_complete == false do 
  1687. 			local cur_time = floor(vint_get_time_index() * 1000) - init_time 
  1688. 		 
  1689. 			--Force close thread 
  1690. 			if Completion_force_skip == true then 
  1691. 				Completion_force_skip = false 
  1692. 				audio_fade_out(reward_cash_count, 50) 
  1693. 				audio_fade_out(reward_cash_hit, 50) 
  1694. 				return 
  1695. 			end 
  1696. 		 
  1697. 			--set my values 
  1698. 			cash_this_frame = cash * (cur_time / time_to_count) 
  1699. 			vint_set_property(Completion.handles.hood_cash_v_h, "text_tag", "$" .. format_cash(cash_this_frame)) 
  1700. 			 
  1701. 			if cur_time >= time_to_count then 
  1702. 			 
  1703. 				audio_fade_out(reward_cash_count, 50) 
  1704. 				reward_cash_hit = audio_play(Completion_audio.cash_hit) 
  1705. 				vint_set_property(Completion.handles.hood_cash_v_h, "text_tag", "$" .. format_cash(cash)) 
  1706. 				is_complete = true 
  1707. 				--button tips 
  1708. 				completion_tips_fade_in_offset(.4) 
  1709. 			end 
  1710. 			thread_yield() 
  1711. 		end 
  1712. 	else 
  1713. 		completion_tips_fade_in_offset(.4) 
  1714. 	end 
  1715. end 
  1716.  
  1717.  
  1718.  
  1719. function	completion_init_mission_failure(mission_number, team, mission_name, failure_text, image_base) 
  1720. 	Completion_is_last_screen = true 
  1721. 	Completion.handles.failure = true 
  1722. 	--local insertion_text = { [0] = mission_number } 
  1723. 	local insertion_text2 = { [0] = mission_name } 
  1724.  
  1725. 	Completion.handles.image_base = image_base 
  1726. 	Completion.handles.mission_number = mission_number 
  1727. 	Completion.handles.team = team 
  1728. 	 
  1729. 	debug_print("vint", "team " .. var_to_string(team) .. "\n") 
  1730. 	debug_print("vint", "mission_number " .. var_to_string(mission_number) .. "\n") 
  1731. 	debug_print("vint", "image_base " .. var_to_string(image_base) .. "\n") 
  1732.  
  1733. 	local subtitle = vint_insert_values_in_string("COMPLETION_MISSION_FAILED", insertion_text2) 
  1734.  
  1735. 	completion_init_title("COMPLETION_MISSION_NUMBER", Completion_Gang_Names[team], subtitle) 
  1736. 	completion_init_fail_message(failure_text) 
  1737. 	completion_init_wall(Completion_Gang_Images[team]) 
  1738. 	 
  1739. 	if Completion_coop_disconnected == true then 
  1740. 		--this is also called in Single Player if the checkpoint hasn't been reached 
  1741. 		completion_coop_disconnected() 
  1742. 	else 
  1743. 		if Completion.handles.image_base == "tss01" then 
  1744. 			completion_init_buttons("COMPLETION_RESTART_CHECKPOINT", "COMPLETION_RESTART_BEGINNING", nil) 
  1745. 		else 
  1746. 			completion_init_buttons("COMPLETION_RESTART_CHECKPOINT", "COMPLETION_RESTART_BEGINNING", "COMPLETION_EXIT_MISSION") 
  1747. 		end 
  1748. 	end 
  1749. 		 
  1750. 	--fade in stuff 
  1751. 	completion_fade_in_wall_and_top(1) 
  1752. 	completion_fail_fade_in(3) 
  1753. 	 
  1754. 	completion_tips_fade_in_offset(3.5) 
  1755.  
  1756. 	Completion_force_skip = false 
  1757. 	Completion_is_animating = true 
  1758. end 
  1759.  
  1760. function completion_init_stronghold_failure(team, stronghold_name, failure_text) 
  1761. 	Completion_is_last_screen = true 
  1762. 	Completion.handles.failure = true 
  1763. 	local insertion_text = { [0] = stronghold_name } 
  1764. 	local subtitle = vint_insert_values_in_string("COMPLETION_MISSION_FAILED", insertion_text) 
  1765. 	 
  1766. 	Completion_force_skip = false 
  1767. 	Completion_is_animating = true 
  1768. 	 
  1769. 	completion_init_title("COMPLETION_STRONGHOLD", Completion_Gang_Names[team], subtitle) 
  1770. 	completion_init_fail_message(failure_text) 
  1771. 	completion_init_wall(Completion_Gang_Images[team]) 
  1772. 	completion_init_buttons("COMPLETION_RESTART_CHECKPOINT", "COMPLETION_RETRY_STRONGHOLD", "COMPLETION_EXIT_STRONGHOLD") 
  1773. 	 
  1774. 	if Completion_coop_disconnected == true then 
  1775. 		completion_coop_disconnected() 
  1776. 	end 
  1777. 	 
  1778. 	--fade in stuff 
  1779. 	completion_fade_in_wall_and_top(1) 
  1780. 	completion_fail_fade_in(3) 
  1781. 	 
  1782. 	completion_tips_fade_in_offset(3.5) 
  1783.  
  1784. 	Completion_force_skip = false 
  1785. 	Completion_is_animating = true 
  1786.  
  1787. end 
  1788.  
  1789. function completion_init_activity_failure(district, activity_name, level, failure_text, activity_type) 
  1790. 	Completion_is_last_screen = true 
  1791. 	Completion.handles.failure = true 
  1792. 	local insertion_text = { [0] = level } 
  1793. 	completion_init_title(district, activity_name, vint_insert_values_in_string("COMPLETION_ACTIVITY_LEVEL_FAILED", insertion_text)) 
  1794. 	completion_init_fail_message(failure_text) 
  1795. 	completion_init_wall(Completion_Activity_Images[activity_type + 1]) 
  1796.  
  1797. 	Completion_force_skip = false 
  1798. 	Completion_is_animating = true 
  1799. 	 
  1800. 	--if this is level 0, then it's a Special Derby... change the button tips 
  1801. 	if level ~= 0 then 
  1802. 		completion_init_buttons("COMPLETION_RETRY_ACTIVITY", nil, "COMPLETION_EXIT_ACTIVITY") 
  1803. 	else 
  1804. 		Completion.handles.level_number = 0 
  1805. 		vint_set_property(Completion.handles.top_3_h, "text_tag", "COMPLETION_FAILED") 
  1806. 		completion_init_buttons(nil, nil, "COMPLETION_EXIT_ACTIVITY") 
  1807. 	end 
  1808. 	 
  1809. 	--change the fail message and tips if this is zombie 
  1810. 	if activity_type == 13 then 
  1811. 		Completion.handles.activity_type = 13 
  1812. 		vint_set_property(Completion.handles.top_1_h, "text_tag", "Videogames") 
  1813. 		vint_set_property(Completion.handles.top_3_h, "text_tag", "COMPLETION_FAILED") 
  1814. 		completion_init_buttons("COMPLETION_RETRY_ZOMBIE", nil, "COMPLETION_QUIT_ZOMBIE") 
  1815. 	end	 
  1816. 	 
  1817. 	--fade in stuff 
  1818. 	completion_fade_in_wall_and_top(1) 
  1819. 	completion_fail_fade_in(3) 
  1820. 	 
  1821. 	completion_tips_fade_in_offset(3.5) 
  1822.  
  1823. 	Completion_force_skip = false 
  1824. 	Completion_is_animating = true 
  1825. 	 
  1826. end 
  1827.  
  1828. function completion_initialize(completion_type, unlockables_to_follow, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13) 
  1829. 	Completion.num_unlocks = unlockables_to_follow 
  1830. 	Completion.type = completion_type 
  1831. 	 
  1832. 	--[[ 
  1833. 	debug_print("vint", "completion_type: " .. var_to_string( completion_type ) .. "\n" .. 
  1834. 						"unlockables_to_follow: " .. var_to_string( unlockables_to_follow ) .. "\n" ..  
  1835. 						"param3: " .. var_to_string( param3 ) .. "\n" ..  
  1836. 						"param4: " .. var_to_string( param4 ) .. "\n" ..  
  1837. 						"param5: " .. var_to_string( param5 ) .. "\n" ..  
  1838. 						"param6: " .. var_to_string( param6 ) .. "\n" ..  
  1839. 						"param7: " .. var_to_string( param7 ) .. "\n" ..  
  1840. 						"param8: " .. var_to_string( param8 ) .. "\n" ..  
  1841. 						"param9: " .. var_to_string( param9 ) .. "\n" ..  
  1842. 						"param10: " .. var_to_string( param10 ) .. "\n" ..  
  1843. 						"param11: " .. var_to_string( param11 ) .. "\n" ..  
  1844. 						"param12: " .. var_to_string( param12 ) .. "\n" .. 
  1845. 						"param13: " .. var_to_string( param13 ) .. "\n\n") 
  1846. 	]]				 
  1847. 						 
  1848. 	if completion_type == SUCCESS_MISSION then 
  1849. 		completion_init_mission_success(param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13) 
  1850. 	elseif completion_type == SUCCESS_STRONGHOLD then 
  1851. 		completion_init_stronghold_success(param3, param4, param5, param6, param7, param8, param9, param10, param11, param12) 
  1852. 	elseif completion_type == SUCCESS_ACTIVITY then 
  1853. 		completion_init_activity_success(param3, param4, param5, param6, param7, param11, param9, param10, param8, param12, param13) 
  1854. 	elseif completion_type == FAILURE_MISSION then 
  1855. 		Completion_coop_disconnected = param8 
  1856. 		completion_init_mission_failure(param3, param4, param5, param6, param7) 
  1857. 	elseif completion_type == FAILURE_STRONGHOLD then 
  1858. 		Completion_coop_disconnected = param6 
  1859. 		completion_init_stronghold_failure(param3, param4, param5) 
  1860. 	elseif completion_type == FAILURE_ACTIVITY then 
  1861. 		completion_init_activity_failure(param3, param4, param5, param6, param7) 
  1862. 	elseif completion_type == JUST_UNLOCKS then 
  1863. 		completion_init_just_unlocks(param3, param4) 
  1864. 	elseif completion_type == UNLOCK_REWARD then 
  1865. 		--	Do something yo' 
  1866. 		completion_init_unlock(param3, param4, param5) 
  1867. 	elseif completion_type == SUCCESS_PUSHBACK then 
  1868. 		completion_init_pushback_success(param3, param4, param5, param6) 
  1869. 	end 
  1870. 	 
  1871. end 
  1872.  
  1873. --Top Area 
  1874. function completion_init_title(pretitle, title, subtitle) 
  1875. 	if pretitle == nil then 
  1876. 		vint_set_property(Completion.handles.top_1_h, "visible", false) 
  1877. 		local top_x, top_y = vint_get_property(Completion.handles.top_grp_h, "anchor") 
  1878. 		top_y = top_y - 26 
  1879. 		vint_set_property(Completion.handles.top_grp_h, "anchor", top_x,  top_y) 
  1880. 	else 
  1881. 		vint_set_property(Completion.handles.top_1_h, "text_tag", pretitle) 
  1882. 	end 
  1883. 	 
  1884. 	vint_set_property(Completion.handles.top_2_h, "text_tag", title) 
  1885. 	vint_set_property(Completion.handles.top_3_h, "text_tag", subtitle) 
  1886. 	 
  1887. --	vint_set_property(Completion.handles.top_1_h, "text_tag", "วลวลวลวล วลวลวลวล ") 
  1888. --	vint_set_property(Completion.handles.top_2_h, "text_tag", "วลวลวลวลวลวล") 
  1889. --	vint_set_property(Completion.handles.top_3_h, "text_tag", "วลวลวลวลวลวล") 
  1890. end 
  1891.  
  1892. -- Cash/Respect 
  1893. function completion_init_cash_respect(cash, respect) 
  1894. 	vint_set_property(Completion.handles.cash_t_h, "text_tag", "COMPLETION_CASH") 
  1895. 	vint_set_property(Completion.handles.cash_v_h, "text_tag", "$0") 
  1896. 	 
  1897. 	if respect ~= nil then  
  1898. 		vint_set_property(Completion.handles.respect_t_h, "text_tag", "COMPLETION_RESPECT") 
  1899. 		vint_set_property(Completion.handles.respect_v_h, "text_tag", "0") 
  1900. 	else 
  1901. 		-- Hide the respect 
  1902. 		vint_set_property(Completion.handles.respect_v_h, "visible", false) 
  1903. 	end 
  1904. end 
  1905.  
  1906. function completion_move_unlockable_text(move_up) 
  1907. 	if move_up == true then 
  1908. 		vint_set_property(Completion.handles.unlock_h, "anchor", 104, 162) 
  1909. 	else 
  1910. 		vint_set_property(Completion.handles.unlock_h, "anchor", 104, 202) 
  1911. 	end 
  1912. end 
  1913.  
  1914. function completion_init_just_unlocks(title, description) 
  1915. 	--title = "TITLE" 
  1916. 	--description = "DESCRIPTION" 
  1917. 	completion_init_title(nil, title, description) 
  1918. 	completion_init_wall("blank") 
  1919. 	Completion.just_unlocks = true 
  1920. 	Completion.just_unlocks_really = true 
  1921.  
  1922. 	Completion_force_skip = false 
  1923. 	Completion_is_animating = true 
  1924. 	 
  1925. 	completion_move_unlockable_text(true) 
  1926. 	 
  1927. 	--fade in stuff 
  1928. 	completion_fade_in_wall_and_top(0) 
  1929.  
  1930. 	vint_dataresponder_request("completion_populate", "completion_initialize", 0, Completion.cur_unlock) 
  1931. 	Completion.cur_unlock = Completion.cur_unlock + 1 
  1932. end 
  1933.  
  1934. -- Unlocks 
  1935. function completion_init_unlock(name, image, description) 
  1936. 	Completion.unlock = { 
  1937. 		name = name, 
  1938. 		description = description, 
  1939. 		image = image, 
  1940. 	} 
  1941. 	 
  1942. 	if Completion.just_unlocks == true then 
  1943. 		completion_finish_unlock() 
  1944. 		return 
  1945. 	end 
  1946. 	 
  1947. 	--block input for the fade outs 
  1948. 	Completion.input_block = true 
  1949. 	 
  1950. 	-- Fade out everything 
  1951. 	completion_cr_cash_fade_out(0) 
  1952. 	completion_cr_respect_fade_out(0) 
  1953. 	completion_hood_cash_fade_out(0) 
  1954. 	completion_hood_owned_fade_out(0) 
  1955. 	completion_news_clip_fade_out(0) 
  1956. 	completion_tips_fade_out(0) 
  1957. 	completion_unlock_fade_out(0) 
  1958. 	completion_unlock_desc_fade_out(0) 
  1959. 	 
  1960. 	--unload the old pegs on call back 
  1961. 	 
  1962. 	local tween_h = vint_object_find("t_unlock_fade_out", Completion.handles.unlock_fade_out_anim_h) 
  1963. 	vint_set_property(tween_h, "end_event", "completion_shut_off_all_layers") 
  1964.  
  1965. 	local tween_h = vint_object_find("unlock_fade_out_ender", Completion.handles.unlock_fade_out_anim_h) 
  1966. 	vint_set_property(tween_h, "start_event", "completion_unload_pegs") 
  1967. 	 
  1968. 	--load the new peg, start the next function 
  1969. 	local tween_h = vint_object_find("unlock_fade_out_ender", Completion.handles.unlock_fade_out_anim_h) 
  1970. 	vint_set_property(tween_h, "end_event", "completion_finish_unlock") 
  1971.  
  1972. end 
  1973.  
  1974.  
  1975.  
  1976. function completion_finish_unlock()	 
  1977. 	if Completion.is_respect_screen == true then 
  1978. 		return 
  1979. 	end 
  1980. 	 
  1981. 	--allow inputs so the animations can be skipped	 
  1982. 	Completion.input_block = false	 
  1983.  
  1984. 	completion_load_peg(Completion.unlock.image) 
  1985. 	 
  1986. 	completion_move_unlockable_text(false) 
  1987.  
  1988. 	--	was this started by just unlocks?  if so, set the first delay time to be .5 
  1989. 	local delay_time = .50 
  1990. 	 
  1991. 	if Completion.just_unlocks_really == true and Completion.just_unlocks == true then 
  1992. 		delay_time = 2.5 
  1993. 	end 
  1994.  
  1995. 	Completion.just_unlocks = false 
  1996. 		 
  1997. 	Completion_force_skip = false 
  1998. 	Completion_is_animating = true 
  1999. 	Completion_is_hood_screen = false 
  2000. 	 
  2001. 	local text_anchor = 305 
  2002. 	 
  2003. 	vint_set_property(Completion.handles.t_unlock_h, "text_tag", "COMPLETION_UNLOCKED") 
  2004. 	vint_set_property(Completion.handles.thing_name_h, "text_tag", Completion.unlock.name) 
  2005. 	vint_set_property(Completion.handles.thing_desc_h, "text_tag", Completion.unlock.description ) 
  2006. 	vint_set_property(Completion.handles.thing_image_h, "image", Completion.unlock.image .. "") 
  2007. 	 
  2008. 	vint_set_property(Completion.handles.t_unlock_h, "anchor", text_anchor, 0) 
  2009. 	 
  2010. 	local name_x, name_y = vint_get_property(Completion.handles.thing_name_h, "anchor") 
  2011. 	vint_set_property(Completion.handles.thing_name_h, "anchor", text_anchor, name_y) 
  2012. 	 
  2013. 	local desc_x, desc_y = vint_get_property(Completion.handles.thing_desc_h, "anchor") 
  2014. 	vint_set_property(Completion.handles.thing_desc_h, "anchor", text_anchor, desc_y) 
  2015. 	 
  2016. 	vint_set_property(Completion.handles.thing_image_h, "anchor", -10, 0 ) 
  2017. 	vint_set_property(Completion.handles.tips_h, "anchor", 104.5, 610) 
  2018. 	 
  2019. 	-- Fade in things 
  2020. 	completion_unlock_fade_in(delay_time) 
  2021. 	 
  2022. 	local tween_h = vint_object_find("unlock_ender", Completion.handles.unlock_fade_in_anim_h) 
  2023. 	vint_set_property(tween_h, "end_event", "completion_unlock_desc_fade_in") 
  2024.  
  2025. 	local tween_h = vint_object_find("unlock_desc_ender", Completion.handles.unlock_desc_fade_in_anim_h) 
  2026. 	vint_set_property(tween_h, "end_event", "completion_tips_fade_in") 
  2027. 	 
  2028. 	if Completion.handles.cur_respect ~= nil and Completion.handles.props_to_unlock ~= nil then 
  2029. 		if Completion.num_unlocks == Completion.cur_unlock and Completion.handles.cur_respect < Completion.handles.props_to_unlock then 
  2030. 			Completion_is_last_screen = true 
  2031. 		end 
  2032. 	end 
  2033.  
  2034. 	if Completion.cur_unlock == Completion.num_unlocks then 
  2035. 			 
  2036. 		if Completion.reward_source == SUCCESS_ACTIVITY then 
  2037. 			if Completion.last_level == true then 
  2038. 				if Completion.handles.activity_type == 13 then 
  2039. 					completion_init_buttons("COMPLETION_QUIT_ZOMBIE", nil, nil) 
  2040. 				else 
  2041. 					completion_init_buttons("COMPLETION_EXIT_ACTIVITY", nil, nil) 
  2042. 				end 
  2043. 			else 
  2044. 				completion_init_buttons("COMPLETION_CONTINUE_ACTIVITY", nil, "COMPLETION_EXIT_ACTIVITY") 
  2045. 			end 
  2046. 		else 
  2047. 			completion_init_buttons("COMPLETION_CONTINUE")		 
  2048. 		end 
  2049. 	 
  2050. 	else	 
  2051. 		completion_init_buttons("COMPLETION_CONTINUE", nil, nil) 
  2052. 	end 
  2053. 	 
  2054. 	if Completion_show_respect_screen == true then 
  2055. 		completion_init_buttons("COMPLETION_CONTINUE", nil, nil) 
  2056. 	end 
  2057. 	 
  2058. 	completion_move_mission_tips() 
  2059. 	 
  2060. end 
  2061.  
  2062.  
  2063. --hood unlock only 
  2064. function completion_hood_unlock() 
  2065. 	 
  2066. 	 
  2067. 	local tween_h = vint_object_find("news_image_alpha", Completion.handles.news_clip_fade_out_anim_h) 
  2068. 	vint_set_property(tween_h, "end_event", nil) 
  2069.  
  2070. 	local tween_h = vint_object_find("news_image_fade_out_ender", Completion.handles.news_clip_fade_out_anim_h) 
  2071. 	vint_set_property(tween_h, "start_event", nil) 
  2072. 	 
  2073. 	local tween_h = vint_object_find("news_image_fade_out_ender", Completion.handles.news_clip_fade_out_anim_h) 
  2074. 	vint_set_property(tween_h, "end_event", nil)	 
  2075. 	 
  2076. 	local cur_respect = 	Completion.handles.cur_respect 
  2077. 	local props_to_unlock = Completion.handles.props_to_unlock 
  2078. 	 
  2079. 	 
  2080. 	if Completion.num_unlocks == 0 and cur_respect < props_to_unlock then 
  2081. 		Completion_is_last_screen = true 
  2082. 	end 
  2083. 	 
  2084. 	 
  2085. 	--init the hood 
  2086. 	local cash_per_day =	Completion_cash_per_day.cash 
  2087. 	local image_base = 		Completion_cash_per_day.image_base 
  2088. 	local hood_name =		Completion_cash_per_day.hood_name 
  2089. 	local hoods_owned =		Completion_cash_per_day.hoods_owned 
  2090. 	local hoods_total =		Completion_cash_per_day.hoods_total 
  2091. 	 
  2092. 	Completion.input_block = false 
  2093. 	 
  2094. 	completion_init_hood(cash_per_day, image_base, hood_name, hoods_owned, hoods_total) 
  2095. 	 
  2096. 	Completion.just_unlocks = false 
  2097. 	Completion_is_hood_screen = true 
  2098. 	Completion_force_skip = false 
  2099. 	Completion_is_animating = true 
  2100. 		 
  2101. 	completion_init_buttons("COMPLETION_CONTINUE", nil, nil) 
  2102. 	 
  2103. 	 
  2104. 	completion_move_unlockable_text(false) 
  2105. 	 
  2106. 	-- Fade in things 
  2107. 	vint_set_property(Completion.handles.unlock_h, "visible", true) 
  2108. 	completion_unlock_fade_in(.5) 
  2109. 	 
  2110. 	--hood cash callback 
  2111. 	local tween_h = vint_object_find("unlock_ender", Completion.handles.unlock_fade_in_anim_h) 
  2112. 	vint_set_property(tween_h, "end_event", "completion_hood_cash_fade_in") 
  2113. 	 
  2114. 	--animate hood_cash callback 
  2115. 	local tween_h = vint_object_find("hood_cash_ender", Completion.handles.hood_cash_fade_in_anim_h) 
  2116. 	vint_set_property(tween_h, "end_event", "completion_animate_hood_cash") 
  2117. 	 
  2118. 	completion_move_mission_tips() 
  2119. 	 
  2120. end 
  2121.  
  2122. -- Hood 
  2123. function completion_init_hood(cash_per_day, image_base, hood_name, hoods_owned, hoods_total) 
  2124. 	 
  2125. 	--load the post card peg	 
  2126. 	if image_base ~= nil then 
  2127. 		completion_load_peg("ui_c_hood_" .. image_base) 
  2128. 		vint_set_property(Completion.handles.thing_image_h, "image", "ui_ct_hood_" .. image_base .. ".tga") 
  2129. 	end  
  2130. 	 
  2131. 	if hood_name ~= nil then 
  2132. 		vint_set_property(Completion.handles.t_unlock_h, "text_tag", "COMPLETION_NEIGHBORHOOD_GAINED") 
  2133. 		vint_set_property(Completion.handles.thing_name_h, "text_tag", hood_name) 
  2134. 		 
  2135. 		--vint_set_property(Completion.handles.t_unlock_h, "text_tag", "วลวลวลวลวลวล วลวลวลวลวลวล") 
  2136. 		--vint_set_property(Completion.handles.thing_name_h, "text_tag", "วลวลวลวลวลวล ลวลวล")		 
  2137. 	end 
  2138. 	 
  2139. 	if get_language() ~= "US" and get_language() ~= "UK" then 
  2140. 		local name_x, name_y = vint_get_property(Completion.handles.thing_name_h, "anchor") 
  2141. 		vint_set_property(Completion.handles.thing_name_h, "anchor", name_x, name_y) 
  2142. 		 
  2143. 		local image_x, image_y = vint_get_property(Completion.handles.thing_image_h, "anchor") 
  2144. 		vint_set_property(Completion.handles.thing_image_h, "anchor", image_x, image_y + 12) 
  2145. 		 
  2146. 		vint_set_property(Completion.handles.unlock_h, "anchor", 104, 222) 
  2147. 	end 
  2148. 	 
  2149. 	vint_set_property(Completion.handles.hood_cash_v_h, "text_tag", "$0") 
  2150. 	 
  2151. 	if hoods_owned ~= nil and hoods_total ~= nil then 
  2152. 		vint_set_property(Completion.handles.hood_cash_t_h, "text_tag", "COMPLETION_CASH_PER_DAY") 
  2153. 		vint_set_property(Completion.handles.hood_owned_t_h, "text_tag", "COMPLETION_NEIGHBORHOODS_OWNED") 
  2154. 		vint_set_property(Completion.handles.hood_owned_v_h, "text_tag", (hoods_owned + 1) .. "/" .. hoods_total) 
  2155. 	end 
  2156.  
  2157. end 
  2158.  
  2159. function completion_init_cash_reward()  
  2160. 	vint_set_property(Completion.handles.hood_cash_v_h, "text_tag", "$0") 
  2161. 	vint_set_property(Completion.handles.hood_cash_t_h, "text_tag", "COMPLETION_CASH") 
  2162. end 
  2163.  
  2164. -- Specific to mission/activity 
  2165. function completion_init_wall(name) 
  2166. 	peg_load("ui_c_wall_" .. name) 
  2167. 	Completion.handles.wall = name 
  2168. 	vint_set_property(Completion.handles.wall_h, "image", "ui_ct_wall_" .. name .. ".tga") 
  2169. end 
  2170.  
  2171. --tips 
  2172. function completion_init_buttons(a_button, x_button, b_button) 
  2173. 	 
  2174. 	if Completion_is_last_screen == true and Completion_is_coop() == true then 
  2175. 		completion_coop_waiting() 
  2176. 	else 
  2177. 		if a_button ~= nil then 
  2178. 			Completion.a_available = true 
  2179. 			vint_set_property(Completion.handles.tip_1_h, "visible", true) 
  2180. 			vint_set_property(Completion.handles.btn_1_h, "visible", true) 
  2181. 			vint_set_property(Completion.handles.tip_1_h, "text_tag", a_button) 
  2182. 			vint_set_property(Completion.handles.btn_1_h, "image", get_a_button()) 
  2183. 		else 
  2184. 			Completion.a_available = false 
  2185. 			vint_set_property(Completion.handles.tip_1_h, "visible", false) 
  2186. 			vint_set_property(Completion.handles.btn_1_h, "visible", false) 
  2187. 		end 
  2188. 		 
  2189. 		if x_button ~= nil then 
  2190. 			Completion.x_available = true 
  2191. 			vint_set_property(Completion.handles.tip_2_h, "visible", true) 
  2192. 			vint_set_property(Completion.handles.btn_2_h, "visible", true) 
  2193. 			vint_set_property(Completion.handles.tip_2_h, "text_tag", x_button) 
  2194. 			vint_set_property(Completion.handles.btn_2_h, "image", get_x_button()) 
  2195. 		else 
  2196. 			Completion.x_available = false 
  2197. 			vint_set_property(Completion.handles.tip_2_h, "visible", false) 
  2198. 			vint_set_property(Completion.handles.btn_2_h, "visible", false) 
  2199. 		end 
  2200. 		 
  2201. 		if b_button ~= nil then 
  2202. 			Completion.b_available = true 
  2203. 			local tip_h, btn_h 
  2204. 			if x_button == nil then 
  2205. 				tip_h = Completion.handles.tip_2_h 
  2206. 				btn_h = Completion.handles.btn_2_h 
  2207. 			else 
  2208. 				tip_h = Completion.handles.tip_3_h 
  2209. 				btn_h = Completion.handles.btn_3_h 
  2210. 			end 
  2211. 			vint_set_property(tip_h, "visible", true) 
  2212. 			vint_set_property(btn_h, "visible", true) 
  2213.  
  2214. 			vint_set_property(btn_h, "image", get_b_button()) 
  2215. 			vint_set_property(tip_h, "text_tag", b_button) 
  2216. 		else 
  2217. 			Completion.b_available = false 
  2218. 		end 
  2219. 		 
  2220. 		if b_button == nil or x_button == nil then 
  2221. 			vint_set_property(Completion.handles.tip_3_h, "visible", false) 
  2222. 			vint_set_property(Completion.handles.btn_3_h, "visible", false) 
  2223. 		end 
  2224. 	 
  2225. 	end 
  2226. 	 
  2227. 	--do the back (quit to main menu) button 
  2228. 	if Completion_is_coop() == true then 
  2229. 		local button = "ui_ctrl_360_btn_back" 
  2230. 		if get_platform() == "PS3" then 
  2231. 			button = "ui_ctrl_ps3_btn_select" 
  2232. 		elseif get_platform() == "PC" then 
  2233. 			button = "ui_ctrl_PC_key_tab" 
  2234. 		end 
  2235. 		vint_set_property(Completion.handles.quit_to_main_btn, "image", button) 
  2236. 		local w, h = element_get_actual_size(Completion.handles.quit_to_main_text) 
  2237. 		vint_set_property(Completion.handles.quit_to_main_btn, "anchor", -w, 1) 
  2238. 		vint_set_property(Completion.handles.quit_to_main, "visible", true) 
  2239. 	else 
  2240. 		vint_set_property(Completion.handles.quit_to_main, "visible", false) 
  2241. 	end 
  2242. 	 
  2243. 	 
  2244. end 
  2245.  
  2246. --coop, hides the button tips, shows the waiting message 
  2247. function completion_coop_waiting() 
  2248. 		lua_play_anim(Completion.handles.waiting_anim , 0) 
  2249. 		lua_play_anim(Completion.handles.waiting_fade_in , 0) 
  2250. 		vint_set_property(Completion.handles.waiting, "visible", true) 
  2251. 		vint_set_property(Completion.handles.btn_1_h, "visible", false) 
  2252. 		vint_set_property(Completion.handles.btn_2_h, "visible", false) 
  2253. 		vint_set_property(Completion.handles.btn_3_h, "visible", false) 
  2254. 		vint_set_property(Completion.handles.tip_1_h , "visible", false) 
  2255. 		vint_set_property(Completion.handles.tip_2_h , "visible", false) 
  2256. 		vint_set_property(Completion.handles.tip_3_h , "visible", false) 
  2257. end 
  2258.  
  2259. --Fail message 
  2260. function completion_init_fail_message(message) 
  2261. 	vint_set_property(Completion.handles.top_3_h, "tint", 0.7, 0, 0)		--turn 'subtitle' text red 
  2262. 	vint_set_property(Completion.handles.top_3_h, "visible", true) 
  2263. 	vint_set_property(Completion.handles.fail_msg_h , "text_tag", message) 
  2264. 	 
  2265. 	local w,h = element_get_actual_size(Completion.handles.fail_msg_h) 
  2266. 	local x, y = vint_get_property(Completion.handles.fail_msg_h, "anchor") 
  2267. 	x = vint_get_property(Completion.handles.tips_h, "anchor") 
  2268. 	 
  2269. 	vint_set_property(Completion.handles.tips_h, "anchor", x, y + h + COMPLETION_UNLOCK_SPACE) 
  2270. end 
  2271.  
  2272.  
  2273. --animation functions 
  2274.  
  2275. function completion_screen_shake() 
  2276. 	 
  2277. 	lua_play_anim(Completion.handles.screen_shake, 0) 
  2278. end 
  2279.  
  2280. function completion_fade_in_wall_and_top(offset) 
  2281. 	Completion_is_animating = true 
  2282.  
  2283. 	vint_set_property(Completion.handles.top_grp_h, "visible", true) 
  2284. 	vint_set_property(Completion.handles.wall_h, "visible", true)	 
  2285. 	--set up the sound stuff 
  2286. 	local tween_h = vint_object_find("top_1_pos", Completion.handles.top_grp_anim_h) 
  2287.  
  2288. 		if Completion.handles.failure == true then 
  2289. 			--play the fail sound 
  2290. 			vint_set_property(tween_h, "start_event", "completion_top_fail_sound") 
  2291. 		elseif Completion.just_unlocks == true then 
  2292. 			--play just top 2 sound 
  2293. 			local tween_h = vint_object_find("top_2_pos", Completion.handles.top_grp_anim_h) 
  2294. 			vint_set_property(tween_h, "start_event", "completion_top_2_sound") 
  2295. 		else 
  2296. 			--play all top 3 sound 
  2297. 			vint_set_property(tween_h, "start_event", "completion_top_3_sound") 
  2298. 		end 
  2299.  
  2300. 	 
  2301. 	--do the animations 
  2302. 	lua_play_anim(Completion.handles.black_1_anim_h, offset ) 
  2303. 	lua_play_anim(Completion.handles.wall_anim_h, offset + 0.33 ) 
  2304. 	lua_play_anim(Completion.handles.top_grp_anim_h, offset + 1) 
  2305. 	 
  2306. end 
  2307.  
  2308.  
  2309.  
  2310. function completion_fail_fade_in(offset) 
  2311. 	vint_set_property(Completion.handles.fail_msg_h, "visible", true) 
  2312. 	 
  2313. 	lua_play_anim(Completion.handles.fail_fade_in_anim_h, offset) 
  2314.  
  2315. 	if Completion_force_skip == false then 
  2316. 		 
  2317. 		local	tween_h = vint_object_find("fail_fade_in", Completion.handles.fail_fade_in_anim_h) 
  2318. 		vint_set_property(tween_h, "start_event", "completion_text_sound") 
  2319. 	end 
  2320. end 
  2321.  
  2322.  
  2323. function completion_cr_cash_fade_in() 
  2324. 	vint_set_property(Completion.handles.cash_respect_h, "visible", true) 
  2325. 	 
  2326. 	lua_play_anim(Completion.handles.cr_cash_fade_in_anim_h, 0) 
  2327. 	if Completion_force_skip == false then 
  2328. 		local	tween_h = vint_object_find("cash_t_alpha", Completion.handles.cr_cash_fade_in_anim_h) 
  2329. 		vint_set_property(tween_h, "start_event", "completion_cash_sound") 
  2330. 	end 
  2331. end 
  2332.  
  2333. function completion_cr_cash_fade_out(offset) 
  2334. 	lua_play_anim(Completion.handles.cr_cash_fade_out_anim_h, offset) 
  2335. end 
  2336.  
  2337. function completion_cr_respect_fade_in(offset) 
  2338. 	vint_set_property(Completion.handles.cash_respect_h, "visible", true) 
  2339. 	lua_play_anim(Completion.handles.cr_respect_fade_in_anim_h, offset) 
  2340. 	if Completion_force_skip == false then	 
  2341. 		local	tween_h = vint_object_find("respect_t_alpha", Completion.handles.cr_respect_fade_in_anim_h) 
  2342. 		vint_set_property(tween_h, "start_event", "completion_respect_sound") 
  2343. 	end 
  2344. end 
  2345.  
  2346. function completion_cr_respect_fade_in_now() 
  2347. 	vint_set_property(Completion.handles.cash_respect_h, "visible", true) 
  2348. 	 
  2349. 	lua_play_anim(Completion.handles.cr_respect_fade_in_anim_h, 0) 
  2350. 	if Completion_force_skip == false then	 
  2351. 		local	tween_h = vint_object_find("respect_t_alpha", Completion.handles.cr_respect_fade_in_anim_h) 
  2352. 		vint_set_property(tween_h, "start_event", "completion_respect_sound") 
  2353. 	end 
  2354.  
  2355. end 
  2356.  
  2357. function completion_style_bonus_fade_in() 
  2358. 	vint_set_property(Completion.handles.style_grp, "visible", true) 
  2359. 	 
  2360. 	lua_play_anim(Completion.handles.style_grp_anim, .4) 
  2361. 	 
  2362. 	if Completion_force_skip == false then 
  2363. 		local	tween_h = vint_object_find("style_alpha", Completion.handles.style_grp_anim) 
  2364. 		vint_set_property(tween_h, "start_event", "completion_respect_sound") 
  2365. 	end 
  2366. end 
  2367.  
  2368. function completion_cr_respect_fade_out(offset) 
  2369. 	lua_play_anim(Completion.handles.cr_respect_fade_out_anim_h, offset) 
  2370. 	lua_play_anim(Completion.handles.style_grp_fade_out_anim, offset) 
  2371. end 
  2372.  
  2373. function completion_hood_cash_fade_in() 
  2374. 	vint_set_property(Completion.handles.hood_cash_t_h, "visible", true)	 
  2375. 	vint_set_property(Completion.handles.hood_cash_v_h, "visible", true) 
  2376. 	 
  2377. 	lua_play_anim(Completion.handles.hood_cash_fade_in_anim_h, 0) 
  2378. 	if Completion_force_skip == false then	 
  2379. 		local	tween_h = vint_object_find("hood_cash_t_alpha", Completion.handles.hood_cash_fade_in_anim_h) 
  2380. 		vint_set_property(tween_h, "start_event", "completion_cash_sound") 
  2381. 	end 
  2382. end 
  2383.  
  2384. function completion_hood_cash_fade_out(offset) 
  2385. 	lua_play_anim(Completion.handles.hood_cash_fade_out_anim_h, offset) 
  2386. end 
  2387.  
  2388. function completion_hood_owned_fade_in(offset) 
  2389. 	vint_set_property(Completion.handles.hood_owned_t_h, "visible", true)	 
  2390. 	vint_set_property(Completion.handles.hood_owned_v_h, "visible", true) 
  2391. 	 
  2392. 	lua_play_anim(Completion.handles.hood_owned_fade_in_anim_h, offset) 
  2393. 	 
  2394. 	if Completion_force_skip == false then	 
  2395. 		local	tween_h = vint_object_find("hood_owned_t_alpha", Completion.handles.hood_owned_fade_in_anim_h) 
  2396. 		vint_set_property(tween_h, "start_event", "completion_respect_sound") 
  2397. 		local	tween_h = vint_object_find("hood_owned_v_alpha", Completion.handles.hood_owned_fade_in_anim_h) 
  2398. 		vint_set_property(tween_h, "start_event", "completion_text_sound") 
  2399. 	end 
  2400.  
  2401. end 
  2402.  
  2403. function completion_hood_owned_fade_out(offset) 
  2404. 	lua_play_anim(Completion.handles.hood_owned_fade_out_anim_h, offset) 
  2405. end 
  2406.  
  2407. function completion_news_clip_fade_in() 
  2408. 	vint_set_property(Completion.handles.thing_image_h, "visible", true) 
  2409. 	 
  2410. 	lua_play_anim(Completion.handles.news_clip_fade_in_anim_h, 0) 
  2411. 	if Completion_force_skip == false then	 
  2412. 		 
  2413. 		local tween_h = vint_object_find("news_image_scale", Completion.handles.news_clip_fade_in_anim_h) 
  2414. 		vint_set_property(tween_h, "start_event", "completion_image_sound") 
  2415. 	end 
  2416.  
  2417. end 
  2418.  
  2419. function completion_news_clip_fade_out(offset) 
  2420. 	lua_play_anim(Completion.handles.news_clip_fade_out_anim_h, offset) 
  2421. end 
  2422.  
  2423. function completion_hide_image() 
  2424. 	vint_set_property(Completion.handles.thing_image_h, "visible", false) 
  2425. end 
  2426.  
  2427.  
  2428. function completion_unlock_fade_in(offset) 
  2429. 	if offset == nil then 
  2430. 		offset = 0 
  2431. 	end 
  2432.  
  2433. 	vint_set_property(Completion.handles.unlock_h, "visible", true) 
  2434. 	vint_set_property(Completion.handles.t_unlock_h, "visible", true)	 
  2435. 	vint_set_property(Completion.handles.thing_name_h, "visible", true)	 
  2436. 	vint_set_property(Completion.handles.thing_image_h, "visible", true)	 
  2437. 	 
  2438. 	lua_play_anim(Completion.handles.unlock_fade_in_anim_h, offset) 
  2439. 	 
  2440. 	if Completion_force_skip == false then	 
  2441. 		 
  2442. 		local tween_h = vint_object_find("unlock_1_t_pos", Completion.handles.unlock_fade_in_anim_h) 
  2443. 		vint_set_property(tween_h, "start_event", "completion_top_2_sound") 
  2444. 	 
  2445. 		local tween_h = vint_object_find("unlock_3_image_pos", Completion.handles.unlock_fade_in_anim_h) 
  2446. 		vint_set_property(tween_h, "start_event", "completion_image_sound") 
  2447. 	end 
  2448. end 
  2449.  
  2450.  
  2451. function completion_unlock_fade_out(offset) 
  2452. 	lua_play_anim(Completion.handles.unlock_fade_out_anim_h, offset) 
  2453. end 
  2454.  
  2455. function completion_unlock_desc_fade_in() 
  2456. 	vint_set_property(Completion.handles.thing_desc_h, "visible", true) 
  2457. 	 
  2458. 	lua_play_anim(Completion.handles.unlock_desc_fade_in_anim_h, 0) 
  2459. 	if Completion_force_skip == false then	 
  2460. 		 
  2461. 		local tween_h = vint_object_find("thing_desc_alpha_in", Completion.handles.unlock_desc_fade_in_anim_h) 
  2462. 		vint_set_property(tween_h, "start_event", "completion_text_sound") 
  2463. 	end 
  2464. end 
  2465.  
  2466. function completion_unlock_desc_fade_out(offset) 
  2467. 	lua_play_anim(Completion.handles.unlock_desc_fade_out_anim_h, offset) 
  2468.  
  2469. end 
  2470.  
  2471. function completion_tips_fade_in() 
  2472. 	--debug_print("freese", "Completion_allow_to_shut_off_layers set to true in completion_tips_fade_in\n") 
  2473. 	Completion_allow_to_shut_off_layers = true 
  2474. 	Completion_is_animating = false 
  2475. 	vint_set_property(Completion.handles.tips_h, "visible", true) 
  2476. 	lua_play_anim(Completion.handles.tips_fade_in_anim_h, 0) 
  2477. 	if Completion_force_skip == false then		 
  2478. 		local tween_h = vint_object_find("tips_fade_in", Completion.handles.tips_fade_in_anim_h) 
  2479. 		vint_set_property(tween_h, "start_event", "completion_tips_sound") 
  2480. 		 
  2481. 	end 
  2482. 	if Completion_is_coop() == true and Completion_is_last_screen == true then 
  2483. 		completion_coop_waiting() 
  2484. 	end 
  2485. end 
  2486.  
  2487. function completion_tips_fade_in_offset(offset) 
  2488. 	--debug_print("freese", "Completion_allow_to_shut_off_layers set to true in completion_tips_fade_in_offset\n") 
  2489. 	Completion_allow_to_shut_off_layers = true 
  2490. 	vint_set_property(Completion.handles.tips_h, "visible", true) 
  2491. 	lua_play_anim(Completion.handles.tips_fade_in_anim_h, offset) 
  2492. 	if Completion_force_skip == false then	 
  2493. 		local tween_h = vint_object_find("tips_fade_in", Completion.handles.tips_fade_in_anim_h) 
  2494. 		vint_set_property(tween_h, "start_event", "completion_tips_sound") 
  2495. 		 
  2496. 	end	 
  2497. 	if Completion_is_coop() == true and Completion_is_last_screen == true then 
  2498. 		completion_coop_waiting() 
  2499. 	end 
  2500. 	 
  2501. 	local tween_h = vint_object_find("tips_fade_in", Completion.handles.tips_fade_in_anim_h) 
  2502. 	vint_set_property(tween_h, "end_event", "completion_animating_false") 
  2503. end 
  2504.  
  2505. function completion_animating_false() 
  2506. 	Completion_is_animating = false 
  2507. end 
  2508.  
  2509. function completion_tips_fade_out(offset) 
  2510. 	lua_play_anim(Completion.handles.waiting_fade_out , offset) 
  2511. 	lua_play_anim(Completion.handles.tips_fade_out_anim_h, offset ) 
  2512. end 
  2513.  
  2514. function completion_fade_out_all(offset) 
  2515. 	lua_play_anim(Completion.handles.black_2_anim_h, offset) 
  2516. end 
  2517.  
  2518. function completion_top_grp_fade_out(offset) 
  2519. 	lua_play_anim(Completion.handles.top_grp_fade_out_anim_h, offset) 
  2520. end 
  2521.  
  2522. function completion_shut_off_all_layers() 
  2523. 	--debug_print("freese", "Testing Completion_allow_to_shut_off_layers in completion_shut_off_all_layers.... ") 
  2524. 	 
  2525. 	if Completion_allow_to_shut_off_layers == false then 
  2526. 	--	debug_print("freese", "not allowed \n") 
  2527. 	 
  2528. 		return 
  2529. 	end 
  2530.  
  2531. 	 
  2532. 	 
  2533. 	--debug_print("freese", "allowed allowed setting false for later.\n") 
  2534. 	Completion_allow_to_shut_off_layers = false 
  2535. 	 
  2536. 	--turn off all layers 
  2537. 	vint_set_property(Completion.handles.cash_respect_h, "visible", false) 
  2538. 	vint_set_property(Completion.handles.fail_msg_h, "visible", false) 
  2539. 	vint_set_property(Completion.handles.tips_h, "visible", false) 
  2540. 	--vint_set_property(Completion.handles.unlock_h, "visible", false) 
  2541. 	vint_set_property(Completion.handles.t_unlock_h, "visible", false) 
  2542. 	vint_set_property(Completion.handles.thing_desc_h, "visible", false) 
  2543. 	vint_set_property(Completion.handles.thing_image_h, "visible", false) 
  2544. 	vint_set_property(Completion.handles.thing_name_h, "visible", false)		 
  2545. 	vint_set_property(Completion.handles.hood_cash_t_h, "visible", false)	 
  2546. 	vint_set_property(Completion.handles.hood_cash_v_h, "visible", false) 
  2547. 	vint_set_property(Completion.handles.hood_owned_t_h, "visible", false)	 
  2548. 	vint_set_property(Completion.handles.hood_owned_v_h, "visible", false) 
  2549. 	vint_set_property(Completion.handles.style_grp, "visible", false) 
  2550.  
  2551. 	if Completion.is_respect_screen == true then 
  2552. 		Completion_reset_respect_screen()	 
  2553. 	end 
  2554. 	 
  2555. 	if Completion.exiting == true then 
  2556. 		vint_set_property(Completion.handles.top_grp_h, "visible", false) 
  2557. 		vint_set_property(Completion.handles.black_1_h, "visible", true)	 
  2558. 		vint_set_property(Completion.handles.wall_h, "visible", false)	 
  2559. 		completion_finish() 
  2560. 	end 
  2561. 	 
  2562. 	 
  2563. end 
  2564.  
  2565. ------------------------------- 
  2566. --SOUND  
  2567.  
  2568.  
  2569. function completion_top_3_sound() 
  2570. 	if Completion_is_animating == true then 
  2571. 		audio_play(Completion_audio.top_3) 
  2572. 	end 
  2573. end 
  2574.  
  2575. function completion_top_2_sound() 
  2576. 	if Completion_is_animating == true then 
  2577. 		audio_play(Completion_audio.top_2) 
  2578. 	end 
  2579. end 
  2580.  
  2581. function completion_top_fail_sound() 
  2582. 	if Completion_is_animating == true then 
  2583. 		audio_play(Completion_audio.fail) 
  2584. 	end 
  2585. end 
  2586.  
  2587. function completion_image_sound() 
  2588. 	if Completion_is_animating == true then 
  2589. 		audio_play(Completion_audio.image) 
  2590. 	end 
  2591. end 
  2592.  
  2593. function completion_text_sound() 
  2594. 	if Completion_is_animating == true then 
  2595. 		audio_play(Completion_audio.text) 
  2596. 	end 
  2597. end 
  2598.  
  2599. function completion_respect_sound() 
  2600. 	if Completion_is_animating == true then 
  2601. 		audio_play(Completion_audio.respect) 
  2602. 	end 
  2603. end 
  2604.  
  2605. function completion_cash_sound() 
  2606. 	if Completion_is_animating == true then 
  2607. 		audio_play(Completion_audio.cash) 
  2608. 	end 
  2609. end 
  2610.  
  2611. function completion_tips_sound() 
  2612. 	--if Completion_is_animating == true then 
  2613. 		audio_play(Completion_audio.tips) 
  2614. --	end 
  2615. end 
  2616.  
  2617. function completion_cash_count_sound() 
  2618. 	if Completion_is_animating == true then 
  2619. 		audio_play(Completion_audio.cash_count) 
  2620. 	end 
  2621. end 
  2622.  
  2623. function completion_respect_count_sound() 
  2624. 	if Completion_is_animating == true then 
  2625. 		audio_play(Completion_audio.respect_count) 
  2626. 	end 
  2627. end 
  2628.  
  2629.  
  2630. -------------------------------------------- 
  2631. --Store count of animation threads 
  2632. Completion_anim_thread_count = 0 
  2633. Completion_force_skip = false 
  2634.  
  2635. function completion_anim_threads_is_killed() 
  2636. 	return Completion_force_skip 
  2637. end 
  2638.  
  2639. function completion_anim_threads_kill() 
  2640. 	Completion_force_skip = true 
  2641. end 
  2642.  
  2643. function completion_anim_threads_unkill() 
  2644. 	 
  2645. end 
  2646.  
  2647.  
  2648. -------------------------------------------- 
  2649. --sound delay stuff 
  2650. function completion_sound_play_delay(sound_id, offset) 
  2651. 	thread_new("completion_sound_play_thread", sound_id, offset) 
  2652. end 
  2653.  
  2654. function completion_sound_play_thread(sound_id, offset) 
  2655. 	delay(offset) 
  2656. 	audio_play(sound_id) 
  2657. end 
  2658.