./hud_qte.lua

  1. --Document handle 
  2. Hud_qte_key_doc_h = 0 
  3.  
  4. -- handles 
  5. Hud_qte_btn_1_grp_h = 0 
  6. Hud_qte_btn_1_h = 0 
  7. Hud_qte_btn_2_h = 0 
  8. Hud_qte_sticks_grp_h = 0 
  9. Hud_qte_stick_pad_h = 0 
  10. Hud_qte_stick_base_h = 0 
  11. Hud_qte_stick_arrow_h = 0 
  12. Hud_qte_stick_label_h = 0 
  13. Hud_qte_success_grp_h = 0 
  14. Hud_qte_kb_grp_h = 0 
  15. Hud_qte_kb_dir_grp_h = 0 
  16. Hud_qte_mouse_grp_h = 0 
  17.  
  18. Hud_qte_btn_2_grp_h = 0 
  19. Hud_qte_btn_3_h = 0	 
  20. Hud_qte_btn_4_h = 0 
  21.  
  22. --QTE Vdo Objects 
  23. Hud_qte_kb_key = 0 
  24. Hud_qte_kb_dir_w = 0  
  25. Hud_qte_kb_dir_n = 0 
  26. Hud_qte_kb_dir_e = 0 
  27. Hud_qte_kb_dir_s = 0 
  28.  
  29. -- button_index values 
  30. HUD_QTE_BTN_HIDDEN 	= -1 
  31. HUD_QTE_BTN_A 			= 0 
  32. HUD_QTE_BTN_B 			= 1 
  33. HUD_QTE_BTN_X 			= 2 
  34. HUD_QTE_BTN_Y 			= 3 
  35. HUD_QTE_BTN_LT 		= 4 
  36. HUD_QTE_BTN_RT 		= 5 
  37. HUD_QTE_STICK_UP		= 6 
  38. HUD_QTE_STICK_DOWN	= 7 
  39. HUD_QTE_STICK_RIGHT	= 8 
  40. HUD_QTE_STICK_LEFT	= 9 
  41.  
  42. HUD_QTE_TOUCH_PAD_SWIPE_NONE	= 0	--HVS_JRP[PRINCE] 4/22/2014 
  43. HUD_QTE_TOUCH_PAD_SWIPE_UP		= 1	--HVS_JRP[PRINCE] 4/22/2014 
  44. HUD_QTE_TOUCH_PAD_SWIPE_DOWN	= 2	--HVS_JRP[PRINCE] 4/22/2014 
  45. HUD_QTE_TOUCH_PAD_SWIPE_RIGHT	= 3	--HVS_JRP[PRINCE] 4/22/2014 
  46. HUD_QTE_TOUCH_PAD_SWIPE_LEFT	= 4	--HVS_JRP[PRINCE] 4/22/2014 
  47.  
  48. -- button_animation values 
  49. HUD_QTE_ANIM_NONE							= -1 
  50. HUD_QTE_ANIM_MASH_STANDARD				= 0 
  51. HUD_QTE_ANIM_MASH_FAST					= 1 
  52. HUD_QTE_ANIM_ALTERNATE_TRIGGERS		= 2 
  53.  
  54. HUD_QTE_INVALID_DIRECTION = -1 
  55.  
  56. -- storage 
  57. Hud_qte_prev_btn = 0 
  58. Hud_qte_prev_anim = 0 
  59.  
  60. --Mouse key inputs... 
  61. local MOUSE_KEY_INVALID 	= -1 
  62. local MOUSE_KEY_LEFT 		= 0 
  63. local MOUSE_KEY_MIDDLE 		= 1 
  64. local MOUSE_KEY_RIGHT 		= 2 
  65. local MOUSE_KEY_4 			= 3 
  66. local MOUSE_KEY_5 			= 4 
  67. local MOUSE_KEY_WHEEL_UP 	= 5 
  68. local MOUSE_KEY_WHEEL_DOWN	= 6 
  69. 				 
  70. --mouse highlights... 
  71. local Hud_qte_mouse_highlights = { 
  72. 	[MOUSE_KEY_LEFT] 			= "ui_qte_mouse_0", 
  73. 	[MOUSE_KEY_MIDDLE] 		= "ui_qte_mouse_2", 
  74. 	[MOUSE_KEY_RIGHT] 		= "ui_qte_mouse_1", 
  75. 	[MOUSE_KEY_4] 				= "ui_qte_mouse_base_highlight", 
  76. 	[MOUSE_KEY_5] 				= "ui_qte_mouse_base_highlight", 
  77. 	[MOUSE_KEY_WHEEL_UP] 	= "ui_qte_mouse_scroll_up", 
  78. 	[MOUSE_KEY_WHEEL_DOWN] 	= "ui_qte_mouse_scroll_down", 
  79. } 
  80.  
  81. --mouse icons... 
  82. local Hud_qte_mouse_icons = { 
  83. 	[MOUSE_KEY_LEFT] 			= "ui_qte_mouse_fluer", 
  84. 	[MOUSE_KEY_MIDDLE] 		= "ui_qte_mouse_fluer", 
  85. 	[MOUSE_KEY_RIGHT] 		= "ui_qte_mouse_fluer", 
  86. 	[MOUSE_KEY_4] 				= "ui_qte_mouse_3", 
  87. 	[MOUSE_KEY_5] 				= "ui_qte_mouse_4", 
  88. 	[MOUSE_KEY_WHEEL_UP] 	= "ui_qte_mouse_fluer", 
  89. 	[MOUSE_KEY_WHEEL_DOWN] 	= "ui_qte_mouse_fluer", 
  90. } 
  91.  
  92. --warden meter 
  93. local Hud_warden_meter = { 
  94. 	grp_h = -1, 
  95. 	saints_fill_img_h = -1, 
  96. 	saints_fill_grad_img_h = -1, 
  97. 	saints_grad_static_img_h = -1, 
  98. 	saints_line_img_h = -1, 
  99. 	saints_clip_h = -1, 
  100. 	warden_fill_img_h = -1, 
  101. 	warden_fill_grad_img_h = -1, 
  102. 	warden_grad_static_img_h = -1, 
  103. 	warden_line_img_h = -1, 
  104. 	warden_clip_h = -1, 
  105. 	saints_pulse_anim_h = -1, 
  106. 	saints_energy_anim_h = -1, 
  107. 	warden_pulse_anim_h = -1, 
  108. 	warden_energy_anim_h = -1, 
  109. 	warden_next_btn_anim_h = -1, 
  110. 	qte_btn_change_grp_h = -1, 
  111. 	is_playing = false, 
  112. } 
  113.  
  114. Hud_qte_mouse_success_bitmaps = {} 
  115. Hud_qte_mouse_success_anims = {} 
  116.  
  117. function hud_qte_init() 
  118. 	Hud_qte_key_doc_h = vint_document_find("hud_qte") 
  119. 	 
  120. 	-- assign handles 
  121. 	Hud_qte_btn_1_grp_h = vint_object_find("btn_1_grp") 
  122. 	Hud_qte_btn_1_h = vint_object_find("btn_1")		 
  123. 	Hud_qte_btn_2_h = vint_object_find("btn_2") 
  124.  
  125. 	Hud_qte_btn_2_grp_h = vint_object_find("btn_2_grp") 
  126. 	Hud_qte_btn_3_h = vint_object_find("btn_3")		 
  127. 	Hud_qte_btn_4_h = vint_object_find("btn_4") 
  128. 	 
  129. 	Hud_qte_sticks_grp_h 	= vint_object_find("qte_sticks_grp") 
  130. 	Hud_qte_stick_pad_h 		= vint_object_find("stick_pad") 
  131. 	Hud_qte_stick_base_h 	= vint_object_find("stick_base_bmp") 
  132. 	Hud_qte_stick_arrow_h 	= vint_object_find("stick_arrow") 
  133. 	Hud_qte_stick_label_h 	= vint_object_find("stick_label") 
  134. 	Hud_qte_kb_grp_h 			= vint_object_find("qte_keyboard_grp") 
  135. 	Hud_qte_kb_key 			= Vdo_qte_key:new("qte_key", 0, Hud_qte_key_doc_h) 
  136. 	Hud_qte_mouse_grp_h 		= vint_object_find("qte_mouse_grp") 
  137. 		 
  138. 	Hud_qte_success_grp_h 	= vint_object_find("qte_success_grp") 
  139. 	 
  140. 	--Warden Meter 
  141. 	Hud_warden_meter.grp_h = vint_object_find("base_warden_grp") 
  142. 	Hud_warden_meter.saints_fill_img_h = vint_object_find("saints_fill_img") 
  143. 	Hud_warden_meter.saints_fill_grad_img_h = vint_object_find("saints_fill_grad_img") 
  144. 	Hud_warden_meter.saints_grad_static_img_h = vint_object_find("saints_grad_static_img") 
  145. 	Hud_warden_meter.saints_line_img_h = vint_object_find("saints_line_img") 
  146. 	Hud_warden_meter.saints_clip_h = vint_object_find("saints_clip") 
  147. 	Hud_warden_meter.warden_fill_img_h = vint_object_find("warden_fill_img") 
  148. 	Hud_warden_meter.warden_fill_grad_img_h = vint_object_find("warden_fill_grad_img") 
  149. 	Hud_warden_meter.warden_grad_static_img_h = vint_object_find("warden_grad_static_img") 
  150. 	Hud_warden_meter.warden_line_img_h = vint_object_find("warden_line_img") 
  151. 	Hud_warden_meter.warden_clip_h = vint_object_find("warden_clip") 
  152. 	Hud_warden_meter.saints_pulse_anim_h = vint_object_find("saints_pulse_anim") 
  153. 	Hud_warden_meter.saints_energy_anim_h = vint_object_find("saints_energy_anim") 
  154. 	Hud_warden_meter.warden_pulse_anim_h = vint_object_find("warden_pulse_anim") 
  155. 	Hud_warden_meter.warden_energy_anim_h = vint_object_find("warden_energy_anim") 
  156. 	Hud_warden_meter.warden_next_btn_anim_h = vint_object_find("warden_next_btn_anim") 
  157. 	Hud_warden_meter.qte_btn_change_grp_h = vint_object_find("qte_btn_change_grp") 
  158. 	Hud_warden_meter.is_playing = false 
  159. 	 
  160. 	vint_set_property(Hud_warden_meter.grp_h, "is_visible", false)	 
  161. 	vint_set_property(Hud_warden_meter.qte_btn_change_grp_h, "is_visible", false)	 
  162. 	 
  163. 	-- set animation loops for QTE's 
  164. 	local btn_1_off_standard_twn_h = vint_object_find("btn_1_off_standard") 
  165. 	local btn_1_off_fast_twn_h 	= vint_object_find("btn_1_off_fast") 
  166. 	local stick_pressed_twn_h 		= vint_object_find("stick_pressed_twn") 
  167. 	vint_set_property(btn_1_off_standard_twn_h, "end_event", "vint_anim_loop_callback")		 
  168. 	vint_set_property(btn_1_off_fast_twn_h, "end_event", "vint_anim_loop_callback")		 
  169. 	vint_set_property(stick_pressed_twn_h, "end_event", "vint_anim_loop_callback") 
  170. 	 
  171. 	local btn_3_off_standard_twn_h = vint_object_find("btn_4_on_standard01")		 
  172. 	vint_set_property(btn_3_off_standard_twn_h, "end_event", "vint_anim_loop_callback")	 
  173. 	--Keyboard Direction Setup... 
  174. 	Hud_qte_kb_dir_grp_h = vint_object_find("qte_keyboard_dir_grp") 
  175. 	Hud_qte_kb_dir_n = Vdo_qte_key:new("key_dir_n", Hud_qte_kb_dir_grp_h) 
  176. 	Hud_qte_kb_dir_e = Vdo_qte_key:new("key_dir_e", Hud_qte_kb_dir_grp_h) 
  177. 	Hud_qte_kb_dir_s = Vdo_qte_key:new("key_dir_s", Hud_qte_kb_dir_grp_h) 
  178. 	Hud_qte_kb_dir_w = Vdo_qte_key:new("key_dir_w", Hud_qte_kb_dir_grp_h) 
  179. 	 
  180. 	Hud_qte_kb_dir_n:show_arrows(true) 
  181. 	Hud_qte_kb_dir_e:show_arrows(true) 
  182. 	Hud_qte_kb_dir_s:show_arrows(true) 
  183. 	Hud_qte_kb_dir_w:show_arrows(true) 
  184. 	 
  185. 	Hud_qte_kb_dir_n:set_arrow_direction(HUD_QTE_KEY_ARROW_N) 
  186. 	Hud_qte_kb_dir_e:set_arrow_direction(HUD_QTE_KEY_ARROW_E) 
  187. 	Hud_qte_kb_dir_s:set_arrow_direction(HUD_QTE_KEY_ARROW_S) 
  188. 	Hud_qte_kb_dir_w:set_arrow_direction(HUD_QTE_KEY_ARROW_W) 
  189.  
  190. 	-- subscription 
  191. 	vint_dataitem_add_subscription("hud_qte", "update", "hud_qte_update") 
  192. 	vint_dataitem_add_subscription( "hud_warden_finisher", "update", "hud_qte_warden_update" ) 
  193. end 
  194.  
  195.  
  196. ------------------------------------------------------------------------------- 
  197. -- Update the warden meter 
  198. -- 
  199. function hud_qte_warden_update(di_h) 
  200. 	local warden_is_visible, warden_power, play_next_btn_anim = vint_dataitem_get(di_h) 
  201.  
  202. 	vint_set_property(Hud_warden_meter.grp_h, "visible", warden_is_visible) 
  203. 	 
  204. 	local WARDEN_METER_MAX = 604	 
  205. 	local warden_fill_width, warden_fill_height = element_get_actual_size(Hud_warden_meter.warden_fill_img_h) 
  206. 	local warden_clip_width, warden_clip_height = element_get_actual_size(Hud_warden_meter.warden_clip_h) 
  207. 	local line_img_width, line_img_height = element_get_actual_size(Hud_warden_meter.saints_line_img_h)	 
  208. 	local new_warden_width = WARDEN_METER_MAX - (warden_power * WARDEN_METER_MAX) 
  209. 	 
  210. 	--Set warden part 
  211. 	--Using 2px padding around fill and outline gradient/ 4px for line img 
  212. 	element_set_actual_size(Hud_warden_meter.warden_fill_img_h, new_warden_width - 2, warden_fill_height) 
  213. 	element_set_actual_size(Hud_warden_meter.warden_fill_grad_img_h, (new_warden_width - 2) * -1, warden_fill_height) 
  214. 	element_set_actual_size(Hud_warden_meter.warden_line_img_h, new_warden_width - 12, line_img_height) 
  215. 	element_set_actual_size(Hud_warden_meter.warden_clip_h, new_warden_width, warden_clip_height) 
  216. 	 
  217. 	--Get updated fill width and reposition gradient end cap 
  218. 	warden_fill_width, warden_fill_height = element_get_actual_size(Hud_warden_meter.warden_fill_img_h)	 
  219. 	local warden_grad_static_img_x, warden_grad_static_img_y = vint_get_property(Hud_warden_meter.warden_grad_static_img_h, "anchor") 
  220. 	 
  221. 	vint_set_property(Hud_warden_meter.warden_grad_static_img_h, "anchor", WARDEN_METER_MAX - (warden_fill_width + 6), warden_grad_static_img_y) 
  222. 	 
  223. 	--Set saints part 
  224. 	element_set_actual_size(Hud_warden_meter.saints_fill_img_h, WARDEN_METER_MAX - (new_warden_width + 4), warden_fill_height) 
  225. 	element_set_actual_size(Hud_warden_meter.saints_fill_grad_img_h, WARDEN_METER_MAX - (new_warden_width + 4), warden_fill_height) 
  226. 	element_set_actual_size(Hud_warden_meter.saints_line_img_h, WARDEN_METER_MAX - (new_warden_width + 12), line_img_height) 
  227. 	element_set_actual_size(Hud_warden_meter.saints_clip_h, WARDEN_METER_MAX - (new_warden_width + 2), warden_clip_height)	 
  228. 	 
  229. 	--Get updated fill width and reposition gradient end cap 
  230. 	local saints_fill_width, saints_fill_height = element_get_actual_size(Hud_warden_meter.saints_fill_img_h)	 
  231. 	local saints_grad_static_img_x, saints_grad_static_img_y = vint_get_property(Hud_warden_meter.saints_grad_static_img_h, "anchor")	 
  232. 	vint_set_property(Hud_warden_meter.saints_grad_static_img_h, "anchor", saints_fill_width + 2, saints_grad_static_img_y)	 
  233. 	 
  234. 	-- If we're already playing, don't play again 
  235. 	Hud_warden_meter.is_playing = not vint_get_property(Hud_warden_meter.saints_pulse_anim_h, "is_paused")	 
  236. 	if Hud_warden_meter.is_playing == false then 
  237. 		lua_play_anim(Hud_warden_meter.saints_pulse_anim_h) 
  238. 		lua_play_anim(Hud_warden_meter.saints_energy_anim_h) 
  239. 		lua_play_anim(Hud_warden_meter.warden_pulse_anim_h) 
  240. 		lua_play_anim(Hud_warden_meter.warden_energy_anim_h)		 
  241. 	end 
  242. 	 
  243. 	-- Play the btn ring flash anim to signal the button change 
  244. 	if play_next_btn_anim then 
  245. 	 
  246. 		-- Hide yellow button change animation if using keyboard 
  247. 		if game_is_active_input_gamepad() == true then	 
  248. 			vint_set_property(Hud_warden_meter.qte_btn_change_grp_h, "visible", true) 
  249. 		else 
  250. 			vint_set_property(Hud_warden_meter.qte_btn_change_grp_h, "visible", false) 
  251. 		end 
  252. 		 
  253. 		-- Tell code when the anim is done 
  254. 		local end_event_twn_h = vint_object_find("end_event_twn", Hud_warden_meter.warden_next_btn_anim_h) 
  255. 		vint_set_property(end_event_twn_h, "end_event", "warden_beatdown_button_anim_handler")	 
  256. 		 
  257. 		--Hide the ring 
  258. 		local hide_ring_twn_h = vint_object_find("hide_ring_twn", Hud_warden_meter.warden_next_btn_anim_h) 
  259. 		vint_set_property(hide_ring_twn_h, "end_event", "hud_qte_stop_next_btn_anim")	 
  260. 		 
  261. 		lua_play_anim(Hud_warden_meter.warden_next_btn_anim_h)		 
  262. 	end 
  263. end 
  264.  
  265. function warden_beatdown_button_anim_handler() 
  266. 	vint_scriptevent_post( "warden_beatdown_button_anim" ) 
  267. end 
  268.  
  269. function hud_qte_stop_next_btn_anim() 
  270. 	vint_set_property(Hud_warden_meter.qte_btn_change_grp_h, "visible", false)	 
  271. end 
  272.  
  273. ------------------------------------------------------------------------------- 
  274. -- Update via Dataitem 
  275. -- button_index: HUD_QTE_BTN_HIDDEN, HUD_QTE_BTN_A, HUD_QTE_BTN_B, HUD_QTE_BTN_X, etc... 
  276. -- button_animation: HUD_QTE_ANIM_NONE, HUD_QTE_ANIM_MASH_STANDARD, HUD_QTE_ANIM_MASH_FAST, HUD_QTE_ANIM_ALTERNATE_TRIGGER, etc... 
  277. -- x:	position on screen for qte button... 
  278. -- y:	 position on screen for qte button... 
  279. -- is_ps3: is this button for ps3? 
  280. -- kbm_name: name to display on the keyboard or mouse. 
  281. -- success: true or false, depending on if the user completed the qte 
  282. -- mouse_button_number: Button number of the mouse (MOUSE_KEY_INVALID, MOUSE_KEY_LEFT, MOUSE_KEY_MIDDLE, etc...) 
  283. -- kb_direction: Number indicating the direction(HUD_QTE_INVALID_DIRECTION, HUD_QTE_KEY_ARROW_N, HUD_QTE_KEY_ARROW_E, HUD_QTE_KEY_ARROW_S, HUD_QTE_KEY_ARROW_W)	 
  284. --  
  285. -- 
  286. function hud_qte_update(di_h, event) 
  287. 	local button_index, button_animation, x, y, is_ps3, kbm_name, success, mouse_button_number, kb_direction, alt_button_index,alt_button_animation,alt_x,alt_y = vint_dataitem_get(di_h) 
  288. 	 
  289. 	--mouse_button_number = MOUSE_KEY_4 
  290. 	--kb_direction = -1 
  291. 	 
  292. 	local mouse_scroll_down_bg_h = vint_object_find("mouse_scroll_down_bg") 
  293. 	local mouse_scroll_up_bg_h = vint_object_find("mouse_scroll_up_bg") 
  294. 	vint_set_property(mouse_scroll_down_bg_h, "visible", false) 
  295. 	vint_set_property(mouse_scroll_up_bg_h, "visible", false) 
  296. 	 
  297. 	 
  298. 	-- set button group position 
  299. 	vint_set_property(Hud_qte_btn_1_grp_h, 	"anchor", x, y)		 
  300. 	vint_set_property(Hud_qte_sticks_grp_h, 	"anchor", x, y)		 
  301. 	vint_set_property(Hud_qte_success_grp_h, 	"anchor", x, y)		 
  302. 	vint_set_property(Hud_qte_kb_grp_h, 		"anchor", x, y - 40)		--moving the key up so it does not interfere with subtitles... 
  303. 	vint_set_property(Hud_qte_mouse_grp_h, 	"anchor", x, y) 
  304. 	vint_set_property(Hud_qte_kb_dir_grp_h, 	"anchor", x, y) 
  305.  
  306. 	vint_set_property(Hud_qte_btn_2_grp_h, 	"anchor", alt_x, alt_y) 
  307. 	 
  308. 	 
  309. 	-- determine button visibility 
  310. 	vint_set_property(Hud_qte_btn_1_h, "visible", false) 
  311. 	vint_set_property(Hud_qte_btn_2_h, "visible", false) 
  312. 	vint_set_property(Hud_qte_btn_3_h, "visible", false) 
  313. 	vint_set_property(Hud_qte_btn_4_h, "visible", false) 
  314. 	vint_set_property(Hud_qte_sticks_grp_h, "visible", false) 
  315. 	vint_set_property(Hud_qte_success_grp_h, "visible", false) 
  316.  
  317. 	vint_set_property(Hud_qte_kb_grp_h, "visible", false) 
  318. 	vint_set_property(Hud_qte_mouse_grp_h, "visible", false) 
  319. 	vint_set_property(Hud_qte_kb_dir_grp_h, 	"visible", false) 
  320. 	update(button_index, button_animation, x, y, is_ps3, kbm_name, success, mouse_button_number, kb_direction, false,mouse_scroll_down_bg_h, mouse_scroll_up_bg_h) 
  321. 	update(alt_button_index, alt_button_animation, alt_x, alt_y, is_ps3, kbm_name, success, mouse_button_number, kb_direction, true, mouse_scroll_down_bg_h, mouse_scroll_up_bg_h) 
  322. 	if(button_index == HUD_QTE_BTN_HIDDEN) then 
  323. 		hud_qte_pause_all() 
  324. 	end 
  325. 	 
  326. end 
  327.  
  328. function update(button_index, button_animation, x, y, is_ps3, kbm_name, success, mouse_button_number, kb_direction, alt, mouse_scroll_down_bg_h,mouse_scroll_up_bg_h) 
  329. 	if (button_index ~= HUD_QTE_BTN_HIDDEN) then  
  330. 		if game_is_active_input_gamepad() == false then 
  331. 			--determine if mouse or key... 
  332. 			if mouse_button_number == -1 then 
  333. 			 
  334. 				if kb_direction == -1 then 
  335. 					--Show the keyboard key... 
  336. 					vint_set_property(Hud_qte_kb_grp_h, "visible", true) 
  337. 					 
  338. 					--Set text... 
  339. 					Hud_qte_kb_key:set_text(kbm_name) 
  340. 					 
  341. 					--Trigger animation... 
  342. 					Hud_qte_kb_key:mash(button_animation) 
  343. 					 
  344. 					--Center QTE 
  345. 					local width = Hud_qte_kb_key:get_width() 
  346. 					local x, y = vint_get_property(Hud_qte_kb_key.handle, "anchor") 
  347. 					vint_set_property(Hud_qte_kb_key.handle, "anchor", -width * .5, y) 
  348. 					 
  349. 					--Play succes animation? 
  350. 					Hud_qte_kb_key:success(success) 
  351. 				else 
  352. 					 
  353. 					vint_set_property(Hud_qte_kb_dir_grp_h, 	"visible", true) 
  354. 					 
  355. 					--Keyboard with directionals... 
  356. 					Hud_qte_kb_dir_n:mash(HUD_QTE_ANIM_NONE) 
  357. 					Hud_qte_kb_dir_e:mash(HUD_QTE_ANIM_NONE) 
  358. 					Hud_qte_kb_dir_s:mash(HUD_QTE_ANIM_NONE) 
  359. 					Hud_qte_kb_dir_w:mash(HUD_QTE_ANIM_NONE) 
  360. 					 
  361. 					--reset the text of all the keys... 
  362. 					 
  363. 					Hud_qte_kb_dir_n:set_text("") 
  364. 					Hud_qte_kb_dir_e:set_text("") 
  365. 					Hud_qte_kb_dir_s:set_text("") 
  366. 					Hud_qte_kb_dir_w:set_text("") 
  367. 					 
  368. 					local qte_key = 0 
  369. 					if kb_direction == HUD_QTE_KEY_ARROW_N then 
  370. 						qte_key = Hud_qte_kb_dir_n 
  371. 					elseif kb_direction == HUD_QTE_KEY_ARROW_E then 
  372. 						qte_key = Hud_qte_kb_dir_e 
  373. 					elseif kb_direction == HUD_QTE_KEY_ARROW_S then 
  374. 						qte_key = Hud_qte_kb_dir_s 
  375. 					elseif kb_direction == HUD_QTE_KEY_ARROW_W then 
  376. 						qte_key = Hud_qte_kb_dir_w 
  377. 					end 
  378. 					 
  379. 					qte_key:set_text(kbm_name) 
  380. 					qte_key:set_arrow_direction(kb_direction) 
  381. 					qte_key:mash(HUD_QTE_ANIM_MASH_STANDARD) 
  382. 					qte_key:success(success)		 
  383. 					 
  384. 					--Grab the key scale because the keys are scaled... 
  385. 					local key_scale = vint_get_property(Hud_qte_kb_dir_w.handle, "scale") 
  386. 					 
  387. 					--get width of each key * key_scale to get the actual screen width... 
  388. 					local w_width = Hud_qte_kb_dir_w:get_width() * key_scale 
  389. 					local n_width = Hud_qte_kb_dir_n:get_width() * key_scale 
  390. 					local e_width = Hud_qte_kb_dir_e:get_width() * key_scale 
  391. 					local s_width = Hud_qte_kb_dir_s:get_width() * key_scale 
  392.  
  393. 					--Reposition all the keys so they line up... 
  394. 					--center north icon 
  395. 					local x, y = vint_get_property(Hud_qte_kb_dir_n.handle, "anchor") 
  396. 					vint_set_property(Hud_qte_kb_dir_n.handle, "anchor", -n_width * .5, y) 
  397. 					 
  398. 					--center south icon 
  399. 					local s_width_half = s_width * 0.5 
  400. 					local key_spacing = 10 
  401. 					local base_x, base_y = vint_get_property(Hud_qte_kb_dir_s.handle, "anchor") 
  402. 					vint_set_property(Hud_qte_kb_dir_s.handle, "anchor", -s_width_half, base_y) 
  403. 					 
  404. 					--west icon 
  405. 					local x, y = vint_get_property(Hud_qte_kb_dir_w.handle, "anchor") 
  406. 					vint_set_property(Hud_qte_kb_dir_w.handle, "anchor", - s_width_half - key_spacing - (w_width), base_y) 
  407. 					local start_x = x 
  408. 					 
  409. 					--east icon 
  410. 					local x, y = vint_get_property(Hud_qte_kb_dir_e.handle, "anchor") 
  411. 					vint_set_property(Hud_qte_kb_dir_e.handle, "anchor",  s_width_half + key_spacing, base_y) 
  412. 					local end_x = s_width_half + key_spacing 
  413. 					 
  414. 					local total_width = e_width + end_x + abs(start_x) 
  415. 					local x, y = vint_get_property(Hud_qte_kb_dir_grp_h, "anchor") 
  416. 					local base_width = 193 
  417. 					if total_width > base_width then 
  418. 						vint_set_property(Hud_qte_kb_dir_grp_h, "anchor", x - ((total_width - base_width) * 0.5) - 20, y) 
  419. 					end 
  420. 				end 
  421. 			else 
  422.  
  423. 				--Show mouse 
  424. 				vint_set_property(Hud_qte_mouse_grp_h, "visible", true) 
  425. 				 
  426. 				--Update buttons 
  427. 				local mouse_highlight_h = vint_object_find("mouse_highlight") 
  428. 				local mouse_icon_h = vint_object_find("mouse_icon") 
  429. 				 
  430. 				local mouse_mash_standard_anim_h = vint_object_find("mouse_mash_standard_anim") 
  431. 				local mouse_icon_tint_twn_h = vint_object_find("mouse_icon_tint_twn", mouse_mash_standard_anim_h) 
  432. 				 
  433. 				--add bg for scroll arrow 
  434. 				if mouse_button_number == MOUSE_KEY_WHEEL_UP then 
  435. 					vint_set_property(mouse_scroll_up_bg_h, "visible", true) 
  436. 				elseif mouse_button_number == MOUSE_KEY_WHEEL_DOWN then 
  437. 					vint_set_property(mouse_scroll_down_bg_h, "visible", true) 
  438. 				end 
  439. 				 
  440. 				--animate tint of 4, 5 big nums on mouse body 
  441. 				if mouse_button_number == MOUSE_KEY_4 or mouse_button_number == MOUSE_KEY_5 then 
  442. 					vint_set_property(mouse_icon_tint_twn_h, "start_value", 192/255,0,1) 
  443. 				else 
  444. 					vint_set_property(mouse_icon_tint_twn_h, "start_value", 1,1,1) 
  445. 				end 
  446. 				 
  447. 				local mouse_highlight = Hud_qte_mouse_highlights[mouse_button_number] 
  448. 				local mouse_icon = Hud_qte_mouse_icons[mouse_button_number] 
  449. 				vint_set_property(mouse_highlight_h, "image", mouse_highlight) 
  450. 				vint_set_property(mouse_icon_h, "image", mouse_icon) 
  451.  
  452. 				if	(button_animation == HUD_QTE_ANIM_NONE) then 		 
  453. 					hud_qte_pause_all() 
  454. 					vint_set_property(mouse_highlight_h, "alpha", 0) 
  455. 				elseif (button_animation == HUD_QTE_ANIM_MASH_STANDARD or button_animation == HUD_QTE_ANIM_MASH_FAST) then 
  456. 					lua_play_anim(mouse_mash_standard_anim_h) 
  457. 				end 
  458. 				 
  459. 				local mouse_success_anim_h = vint_object_find("mouse_success_anim") 
  460. 				local mouse_success_h = vint_object_find("mouse_success") 
  461. 				vint_set_property(mouse_success_h, "alpha", 0) 
  462. 				 
  463. 				if #Hud_qte_mouse_success_bitmaps ~= 0 then 
  464. 					for i = 1, #Hud_qte_mouse_success_bitmaps do 
  465. 						vint_object_destroy(Hud_qte_mouse_success_bitmaps[i]) 
  466. 						vint_object_destroy(Hud_qte_mouse_success_anims[i]) 
  467. 					end 
  468. 					Hud_qte_mouse_success_bitmaps = {} 
  469. 					Hud_qte_mouse_success_anims = {} 
  470. 				end 
  471. 				 
  472. 				if success then 
  473. 					--create mouse success items 
  474. 					for i = 1, 4 do 
  475. 						Hud_qte_mouse_success_bitmaps[i] = vint_object_clone(mouse_success_h) 
  476. 						Hud_qte_mouse_success_anims[i] = vint_object_clone(mouse_success_anim_h) 
  477. 						vint_set_property(Hud_qte_mouse_success_anims[i], "target_handle", Hud_qte_mouse_success_bitmaps[i]) 
  478. 						lua_play_anim(Hud_qte_mouse_success_anims[i], (i - 1) * .1) 
  479. 					end 
  480. 					vint_set_property(mouse_highlight_h, "visible", false) 
  481. 				else 
  482. 					vint_set_property(mouse_highlight_h, "visible", true) 
  483. 				end 
  484. 			end 
  485. 		else 
  486. 			--Show buttons if index is lower than the stick indexes... 
  487. 			if button_index < HUD_QTE_STICK_UP then 
  488. 				if alt then 
  489. 					vint_set_property(Hud_qte_btn_3_h, "visible", true) 
  490. 				else 
  491. 					vint_set_property(Hud_qte_btn_1_h, "visible", true) 
  492. 				end 
  493. 				-- if animation exists make second image visible 
  494. 				if (button_animation ~= HUD_QTE_ANIM_NONE) then 
  495. 					if alt then 
  496. 						vint_set_property(Hud_qte_btn_4_h, "visible", true) 
  497. 					else 
  498. 						vint_set_property(Hud_qte_btn_2_h, "visible", true) 
  499. 					end 
  500. 				end		 
  501. 			end 
  502. 			 
  503. 			--Adjust stuff if button_index is a stick... 
  504. 			if (button_index >= HUD_QTE_STICK_UP and button_index <= HUD_QTE_STICK_LEFT ) then 
  505. 				--Uses stick index so show stick and adjust settings accordingly... 
  506. 				vint_set_property(Hud_qte_sticks_grp_h, "visible", true) 
  507. 				local stick_pressed_twn_h = vint_object_find("stick_pressed_twn") 
  508. 				 
  509. 				--Set Callback to playback anim... 
  510. 				vint_set_property(stick_pressed_twn_h, "end_event", "vint_anim_loop_callback")		 
  511. 				lua_play_anim(vint_object_find("stick_direction")) 
  512. 				 
  513. 				if (button_index == HUD_QTE_STICK_UP) then -- R2 
  514. 					-- Rotate arrow pointing up... 
  515. 					vint_set_property(Hud_qte_stick_arrow_h, "rotation", 0) 
  516. 					 
  517. 					--Modify Tweens to move stick up... 
  518. 					vint_set_property(stick_pressed_twn_h, "start_value", 0, -15) 
  519. 					vint_set_property(stick_pressed_twn_h, "end_value", 0, -15) 
  520. 					 
  521. 				elseif (button_index == HUD_QTE_STICK_DOWN) then 
  522. 					--Rotate arrow pointing down.. 
  523. 					vint_set_property(Hud_qte_stick_arrow_h, "rotation", 3.147) 
  524. 					 
  525. 					--Modify Tweens to move stick down... 
  526. 					vint_set_property(stick_pressed_twn_h, "start_value", 0, 15) 
  527. 					vint_set_property(stick_pressed_twn_h, "end_value", 0, 15) 
  528. 				elseif (button_index == HUD_QTE_STICK_RIGHT) then -- R2 
  529. 					-- Rotate arrow pointing right... 
  530. 					vint_set_property(Hud_qte_stick_arrow_h, "rotation", 90 * DEG_TO_RAD) 
  531. 					 
  532. 					--Modify Tweens to move stick right... 
  533. 					vint_set_property(stick_pressed_twn_h, "start_value", 0, 0) 
  534. 					vint_set_property(stick_pressed_twn_h, "end_value", 15, 0) 
  535. 					 
  536. 				elseif (button_index == HUD_QTE_STICK_LEFT) then 
  537. 					--Rotate arrow pointing left.. 
  538. 					vint_set_property(Hud_qte_stick_arrow_h, "rotation", 270 * DEG_TO_RAD) 
  539. 					 
  540. 					--Modify Tweens to move stick left... 
  541. 					vint_set_property(stick_pressed_twn_h, "start_value", 0, 0) 
  542. 					vint_set_property(stick_pressed_twn_h, "end_value", -15, 0)				 
  543. 				end 
  544. 			end 
  545. 			 
  546. 			-- Set button images 
  547. 			local platform = game_get_platform() 
  548. 			if (is_ps3 == true) then		 
  549. 				-- use PS3 button images 
  550. 				if			(button_index == HUD_QTE_BTN_A) then -- CROSS 
  551. 					if not alt then 
  552. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_cross_up_ps3") 
  553. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_cross_down_ps3") 
  554. 					else  
  555. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_cross_up_ps3") 
  556. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_cross_down_ps3") 
  557. 					end													 
  558. 				elseif	(button_index == HUD_QTE_BTN_B) then -- CIRCLE 
  559. 					if not alt then 
  560. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_circle_up_ps3") 
  561. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_circle_down_ps3") 
  562. 					else  
  563. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_circle_up_ps3") 
  564. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_circle_down_ps3") 
  565. 					end	 
  566. 				elseif	(button_index == HUD_QTE_BTN_X) then -- SQUARE 
  567. 					if not alt then 
  568. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_square_up_ps3") 
  569. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_square_down_ps3") 
  570. 					else  
  571. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_square_up_ps3") 
  572. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_square_down_ps3") 
  573. 					end	 
  574. 				elseif	(button_index == HUD_QTE_BTN_Y) then -- TRIANGLE 
  575. 					if not alt then 
  576. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_triangle_up_ps3") 
  577. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_triangle_down_ps3") 
  578. 					else  
  579. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_triangle_up_ps3") 
  580. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_triangle_down_ps3") 
  581. 					end	 
  582. 				elseif	(button_index == HUD_QTE_BTN_LT) then -- L1 
  583. 					if not alt then 
  584. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_l1_up_ps3") 
  585. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_l1_down_ps3") 
  586. 					else  
  587. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_l1_up_ps3") 
  588. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_l1_down_ps3") 
  589. 					end				 
  590. 				elseif	(button_index == HUD_QTE_BTN_RT) then -- **CHANGING RT TO MAP TO R1 ON PS3 BECAUSE R1 IS USED FOR SHOOTING ON PS3** 
  591. 					if not alt then 
  592. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_r1_up_ps3") 
  593. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_r1_down_ps3")	 
  594. 					else  
  595. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_r1_up_ps3") 
  596. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_r1_down_ps3") 
  597. 					end	 
  598. 				elseif	(button_index >= HUD_QTE_STICK_UP and button_index <= HUD_QTE_STICK_LEFT ) then --Stick			 
  599. 					vint_set_property(Hud_qte_stick_pad_h, "image", "ui_qte_stick_ps3") 
  600. 					vint_set_property(Hud_qte_stick_base_h, "image", "ui_qte_base_ps3") 
  601. 					vint_set_property(Hud_qte_stick_arrow_h, "image", "ui_qte_arrow_ps3") 
  602. 					vint_set_property(Hud_qte_stick_label_h, "text_tag", "L") 
  603. 				else 
  604. 					--If btn value isn't accounted for throw up a garbage texture to let us know in game 
  605. 					if not alt then 
  606. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_hud_not_police") 
  607. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_hud_not_police") 
  608. 					else  
  609. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_hud_not_police") 
  610. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_hud_not_police") 
  611. 					end				 
  612. 				end					 
  613. 			elseif platform == "PS4" then	-- HVS_JRP[PRINCE] 3/18/2014 
  614. 				-- use PS4 button images 
  615. 				if touch_pad_index == HUD_QTE_TOUCH_PAD_SWIPE_UP then 
  616. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_swipe_up_ps4") 
  617. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_swipe_up_ps4") 
  618. 				elseif touch_pad_index == HUD_QTE_TOUCH_PAD_SWIPE_DOWN then 
  619. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_swipe_down_ps4") 
  620. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_swipe_down_ps4") 
  621. 				elseif touch_pad_index == HUD_QTE_TOUCH_PAD_SWIPE_LEFT then 
  622. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_swipe_left_ps4") 
  623. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_swipe_left_ps4") 
  624. 				elseif touch_pad_index == HUD_QTE_TOUCH_PAD_SWIPE_RIGHT then 
  625. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_swipe_right_ps4") 
  626. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_swipe_right_ps4") 
  627. 				elseif			(button_index == HUD_QTE_BTN_A) then -- CROSS 
  628. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_cross_up_ps4") 
  629. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_cross_down_ps4") 
  630. 				elseif	(button_index == HUD_QTE_BTN_B) then -- CIRCLE 
  631. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_circle_up_ps4") 
  632. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_circle_down_ps4") 
  633. 				elseif	(button_index == HUD_QTE_BTN_X) then -- SQUARE 
  634. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_square_up_ps4") 
  635. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_square_down_ps4") 
  636. 				elseif	(button_index == HUD_QTE_BTN_Y) then -- TRIANGLE 
  637. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_triangle_up_ps4") 
  638. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_triangle_down_ps4") 
  639. 				--HVS_TBT 9/3/2014: UPDATED LT/RT ON PS4 ONLY 
  640. 				elseif	(button_index == HUD_QTE_BTN_LT) then -- L1 
  641. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_l2_up_ps4") 
  642. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_l2_down_ps4")			 
  643. 				elseif	(button_index == HUD_QTE_BTN_RT) then -- **CHANGING RT TO MAP TO R1 ON PS4 BECAUSE R1 IS USED FOR SHOOTING ON PS4** 
  644. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_r2_up_ps4") 
  645. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_r2_down_ps4")	 
  646. 				elseif	(button_index >= HUD_QTE_STICK_UP and button_index <= HUD_QTE_STICK_LEFT ) then --Stick			 
  647. 					vint_set_property(Hud_qte_stick_pad_h, "image", "ui_qte_stick_ps4") 
  648. 					vint_set_property(Hud_qte_stick_base_h, "image", "ui_qte_base_ps4") 
  649. 					vint_set_property(Hud_qte_stick_arrow_h, "image", "ui_qte_arrow_ps4") 
  650. 					vint_set_property(Hud_qte_stick_label_h, "text_tag", "L") 
  651. 					else  
  652. 					--If btn value isn't accounted for throw up a garbage texture to let us know in game 
  653. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_hud_not_police") 
  654. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_hud_not_police")			 
  655. 					end				 
  656. 			elseif platform == "XBOX3" then	-- HVS_JRP[PRINCE] 3/18/2014 
  657. 				-- use XBOX3 button images 
  658. 				if			(button_index == HUD_QTE_BTN_A) then  
  659. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_a_up_xbox3") 
  660. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_a_down_xbox3")													 
  661. 				elseif	(button_index == HUD_QTE_BTN_B) then  
  662. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_b_up_xbox3") 
  663. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_b_down_xbox3") 
  664. 				elseif	(button_index == HUD_QTE_BTN_X) then  
  665. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_x_up_xbox3") 
  666. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_x_down_xbox3") 
  667. 				elseif	(button_index == HUD_QTE_BTN_Y) then  
  668. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_y_up_xbox3") 
  669. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_y_down_xbox3") 
  670. 				elseif	(button_index == HUD_QTE_BTN_LT) then  
  671. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_lt_up_xbox3") 
  672. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_lt_down_xbox3")			 
  673. 				elseif	(button_index == HUD_QTE_BTN_RT) then  
  674. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_rt_up_xbox3") 
  675. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_rt_down_xbox3")			 
  676. 				elseif	(button_index >= HUD_QTE_STICK_UP and button_index <= HUD_QTE_STICK_LEFT ) then --Stick 
  677. 					vint_set_property(Hud_qte_stick_pad_h, "image", "ui_qte_stick_xbox3") 
  678. 					vint_set_property(Hud_qte_stick_base_h, "image", "ui_qte_base_xbox3") 
  679. 					vint_set_property(Hud_qte_stick_arrow_h, "image", "ui_qte_arrow_xbox3") 
  680. 					vint_set_property(Hud_qte_stick_label_h, "text_tag", "LS") 
  681. 				else 
  682. 					--If btn value isn't accounted for throw up a garbage texture to let us know in game 
  683. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_hud_not_police") 
  684. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_hud_not_police")			 
  685. 				end					 
  686. 			else	 
  687. 				-- use XBOX2 button images 
  688. 				if			(button_index == HUD_QTE_BTN_A) then  
  689. 					if not alt then 
  690. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_a_up_xbox2") 
  691. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_a_down_xbox2")	 
  692. 					else  
  693. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_a_up_xbox2") 
  694. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_a_down_xbox2") 
  695. 					end													 
  696. 				elseif	(button_index == HUD_QTE_BTN_B) then  
  697. 					if not alt then 
  698. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_b_up_xbox2") 
  699. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_b_down_xbox2") 
  700. 					else  
  701. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_b_up_xbox2") 
  702. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_b_down_xbox2") 
  703. 					end	 
  704. 				elseif	(button_index == HUD_QTE_BTN_X) then  
  705. 					if not alt then 
  706. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_x_up_xbox2") 
  707. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_x_down_xbox2") 
  708. 					else  
  709. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_x_up_xbox2") 
  710. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_x_down_xbox2") 
  711. 					end	 
  712. 				elseif	(button_index == HUD_QTE_BTN_Y) then  
  713. 					if not alt then 
  714. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_y_up_xbox2") 
  715. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_y_down_xbox2") 
  716. 					else  
  717. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_y_up_xbox2") 
  718. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_y_down_xbox2") 
  719. 					end	 
  720. 				elseif	(button_index == HUD_QTE_BTN_LT) then  
  721. 					if not alt then 
  722. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_lt_up_xbox2") 
  723. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_lt_down_xbox2")		 
  724. 					else  
  725. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_lt_up_xbox2") 
  726. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_lt_down_xbox2") 
  727. 					end		 
  728. 				elseif	(button_index == HUD_QTE_BTN_RT) then  
  729. 					if not alt then 
  730. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_rt_up_xbox2") 
  731. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_rt_down_xbox2")	 
  732. 					else  
  733. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_qte_rt_up_xbox2") 
  734. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_qte_rt_down_xbox2") 
  735. 					end			 
  736. 				elseif	(button_index >= HUD_QTE_STICK_UP and button_index <= HUD_QTE_STICK_LEFT ) then --Stick 
  737. 					vint_set_property(Hud_qte_stick_pad_h, "image", "ui_qte_stick_xbox2") 
  738. 					vint_set_property(Hud_qte_stick_base_h, "image", "ui_qte_base_xbox2") 
  739. 					vint_set_property(Hud_qte_stick_arrow_h, "image", "ui_qte_arrow_xbox2") 
  740. 					vint_set_property(Hud_qte_stick_label_h, "text_tag", "LS") 
  741. 				else 
  742. 					--If btn value isn't accounted for throw up a garbage texture to let us know in game 
  743. 					if not alt then 
  744. 						vint_set_property(Hud_qte_btn_1_h, "image", "ui_hud_not_police") 
  745. 						vint_set_property(Hud_qte_btn_2_h, "image", "ui_hud_not_police") 
  746. 					else  
  747. 						vint_set_property(Hud_qte_btn_3_h, "image", "ui_hud_not_police") 
  748. 						vint_set_property(Hud_qte_btn_4_h, "image", "ui_hud_not_police") 
  749. 					end				 
  750. 				end			 
  751. 			end 
  752. 			 
  753. 			--adjust success graphic anchor for buttons 
  754. 			 
  755. 			if (button_index >= HUD_QTE_BTN_A and button_index <= HUD_QTE_BTN_RT ) then 
  756. 				local button_width, button_height 
  757. 				if alt then 
  758. 					button_width, button_height = vint_get_property(Hud_qte_btn_3_h, "screen_size")--element_get_actual_size 
  759. 				else 
  760. 					button_width, button_height = vint_get_property(Hud_qte_btn_1_h, "screen_size")--element_get_actual_size 
  761. 				end 
  762. 				local qte_x, qte_y = vint_get_property(Hud_qte_success_grp_h, "anchor") 
  763. 				local new_y = qte_y - button_height * 0.5 
  764. 				 
  765. 				vint_set_property(Hud_qte_success_grp_h, "anchor", qte_x, new_y)			 
  766. 			end 
  767.  
  768. 			-- Play mash anim... 
  769. 			 
  770. 			if			(button_animation == HUD_QTE_ANIM_NONE) and not alt then 		 
  771. 				hud_qte_pause_all() 
  772. 			elseif (button_animation == HUD_QTE_ANIM_NONE) and alt then 
  773. 				vint_set_property(vint_object_find("mash_standard_alt"),"is_paused", true) 
  774. 			elseif	(button_animation == HUD_QTE_ANIM_MASH_STANDARD) then  
  775. 				if alt then 
  776. 					lua_play_anim(vint_object_find("mash_standard_alt")) 
  777. 				else 
  778. 					lua_play_anim(vint_object_find("mash_standard")) 
  779. 				end	 
  780. 				 
  781. 			elseif	(button_animation == HUD_QTE_ANIM_MASH_FAST) then 	 
  782. 				lua_play_anim(vint_object_find("mash_fast"))			 
  783. 			end 
  784. 				 
  785. 				-- if the qte is successful play the animation 
  786. 			if success then 
  787. 				vint_set_property(Hud_qte_success_grp_h, "visible", true) 
  788. 				hud_qte_play_success_anim() 
  789. 			end 
  790. 		end	 
  791. 	else 
  792. 		--Hide and pause everything 
  793. 		if alt then 
  794. 			vint_set_property(Hud_qte_btn_3_h, "visible", false) 
  795. 			vint_set_property(Hud_qte_btn_4_h, "visible", false) 
  796. 		else 
  797. 			vint_set_property(Hud_qte_btn_1_h, "visible", false) 
  798. 			vint_set_property(Hud_qte_btn_2_h, "visible", false) 
  799. 				 
  800. 			vint_set_property(Hud_qte_sticks_grp_h, "visible", false) 
  801. 			vint_set_property(Hud_qte_success_grp_h, "visible", false) 
  802.  
  803. 			vint_set_property(Hud_qte_kb_grp_h, "visible", false) 
  804. 			vint_set_property(Hud_qte_mouse_grp_h, "visible", false) 
  805. 		end 
  806. 		 
  807. 		 
  808. 		 
  809. 	end	 
  810. 	 
  811. 	-- store current btn and anim 
  812. 	Hud_qte_prev_btn = button_index 
  813. 	Hud_qte_prev_anim = button_animation 
  814. 	 
  815. 	debug_print("vint", "button_animation: " .. var_to_string(button_animation) .. "\n") 
  816. end 
  817.  
  818. -- Pause all animations 
  819. function hud_qte_pause_all() 
  820. 	vint_set_property(vint_object_find("mash_standard"),"is_paused", true)	 
  821. 	vint_set_property(vint_object_find("mash_standard_alt"),"is_paused", true)	 
  822. 	vint_set_property(vint_object_find("mash_fast"),"is_paused", true)	 
  823. 	vint_set_property(vint_object_find("stick_direction"),"is_paused", true)	 
  824. 	vint_set_property(vint_object_find("success"),"is_paused", true) 
  825. 	 
  826. 	vint_set_property(vint_object_find("mouse_mash_standard_anim"),"is_paused", true) 
  827. 	vint_set_property(vint_object_find("mouse_mash_fast_anima"),"is_paused", true) 
  828. 	Hud_qte_kb_key:mash(HUD_QTE_ANIM_NONE) 
  829. end 
  830.  
  831.  
  832. --Play "success" Animation 
  833. function hud_qte_play_success_anim() 
  834. 	lua_play_anim(vint_object_find("success")) 
  835. end