./msn_killbane.lua

  1. --This interface is used in the Mission 21 Killbane Mask removal sequence. 
  2.  
  3. local Input_tracker  
  4. local Mouse_input_tracker = 0 
  5. local Option_selected = -1 
  6.  
  7. local KILLBANE_OPTION_REMOVE_MASK = 0 
  8. local KILLBANE_OPTION_LET_GO = 1 
  9.  
  10. local Pressed_left_image = -1 
  11. local Pressed_right_image = -1 
  12. local Image_left_h 		= -1 
  13. local Image_right_h 		= -1 
  14.  
  15. function msn_killbane_init() 
  16. 	local platform = game_get_platform() 
  17.  
  18. 	--Do input subscription... 
  19. 	Input_tracker = Vdo_input_tracker:new() 
  20. 	-- Button images 
  21. 	Image_left_h = vint_object_find("button_left_img") 
  22. 	Image_right_h = vint_object_find("button_right_img") 
  23.  
  24. 	-- Different inputs for PC only (when gamepad is not active) 
  25. 	if game_is_active_input_gamepad() == false then 
  26. 		Input_tracker:add_input("key_left", "msn_killbane_nav", 50) 
  27. 		Input_tracker:add_input("key_right", "msn_killbane_nav", 50) 
  28. 		 
  29. 		vint_set_property(Image_left_h, "image", "ui_pc_qte_arrow_off") 
  30. 		vint_set_property(Image_right_h, "image", "ui_pc_qte_arrow_off") 
  31. 		 
  32. 		--Store to use for replacement later... 
  33. 		Pressed_left_image = "ui_pc_qte_arrow_on" 
  34. 		Pressed_right_image = "ui_pc_qte_arrow_on" 
  35. 		 
  36. 		vint_set_property(Image_left_h, "scale", -1.0, 1.0) 
  37. 	else 
  38. 		Input_tracker:add_input("scroll_left", "msn_killbane_nav", 50) 
  39. 		Input_tracker:add_input("scroll_right", "msn_killbane_nav", 50) 
  40. 	 
  41. 		if platform == "PS3" then 
  42. 			vint_set_property(Image_left_h, "image", "ui_qte_l1_up_ps3") 
  43. 			vint_set_property(Image_right_h, "image", "ui_qte_r1_up_ps3") 
  44.  
  45. 			--Store to use for replacement later... 
  46. 			Pressed_left_image = "ui_qte_l1_down_ps3" 
  47. 			Pressed_right_image = "ui_qte_r1_down_ps3" 
  48. 		else 
  49. 			vint_set_property(Image_left_h, "image", "ui_qte_lt_up_xbox2") 
  50. 			vint_set_property(Image_right_h, "image", "ui_qte_rt_up_xbox2") 
  51. 			 
  52. 			--Store to use for replacement later... 
  53. 			Pressed_left_image = "ui_qte_lt_down_xbox2" 
  54. 			Pressed_right_image = "ui_qte_rt_down_xbox2"		 
  55. 		end 
  56. 	end 
  57. 	 
  58. 	Input_tracker:subscribe(true) 
  59.  
  60. 	if game_get_platform() == "PC" then 
  61. 		Mouse_input_tracker = Input_tracker:new() 
  62. 		msn_killbane_mouse_input_add() 
  63. 	end 
  64.  
  65. 	 
  66. 	--Hide screen 
  67. 	local screen_grp_h = vint_object_find("screen_grp") 
  68. 	vint_set_property(screen_grp_h, "alpha", 0) 
  69. 	 
  70. 	--Fade in screen 
  71. 	local anim_h = vint_object_find("fade_in_anim") 
  72. 	lua_play_anim(anim_h) 
  73. 	 
  74. 	local anim_h = vint_object_find("fade_out_anim") 
  75. 	local twn_h  = vint_object_find("fade_out_twn", anim_h) 
  76. 	vint_set_property(twn_h, "end_event", "msn_killbane_select") 
  77. 	 
  78. 	-- hide this stuff if the game pauses 
  79. 	vint_dataitem_add_subscription("game_paused_item", "update", "msn_killbane_game_is_paused")	--to check if game is paused... 
  80. 	 
  81. end 
  82.  
  83. function msn_killbane_cleanup() 
  84. end 
  85.  
  86. function msn_killbane_game_is_paused(di_h) 
  87. 	local is_paused = vint_dataitem_get(di_h) 
  88. 	 
  89. 	local screen_grp_h = vint_object_find("screen_grp") 
  90. 	vint_set_property(screen_grp_h, "visible", is_paused == false) 
  91. end 
  92.  
  93. ------------------------------------------------------------------------------- 
  94. -- Input 
  95. ------------------------------------------------------------------------------- 
  96. function msn_killbane_nav(event) 
  97. 	if Option_selected == -1 then 
  98. 		if event == "scroll_right" or event == "key_right" then 
  99. 			Option_selected = KILLBANE_OPTION_REMOVE_MASK 
  100. 			vint_set_property(Image_right_h, "image", Pressed_right_image) 
  101. 		elseif event == "scroll_left" or event == "key_left" then 
  102. 			Option_selected = KILLBANE_OPTION_LET_GO 
  103. 			vint_set_property(Image_left_h, "image", Pressed_left_image) 
  104. 		end 
  105. 		local anim_h = vint_object_find("fade_out_anim") 
  106. 		lua_play_anim(anim_h) 
  107. 	end 
  108. end 
  109.  
  110. ------------------------------------------------------------------------------- 
  111. -- Callback from fade out animation tells the game we are finished,  
  112. -- what option we've selected and pops screen... 
  113. ------------------------------------------------------------------------------- 
  114. function msn_killbane_select() 
  115. 	--Tell game which option we've selected... 
  116. 	msn_killbane_selected_option(Option_selected) 
  117. 	--and Pop screen 
  118. 	pop_screen() 
  119. end 
  120.  
  121.  
  122. function msn_killbane_mouse_input_add() 
  123. 	Mouse_input_tracker:add_mouse_input("mouse_click", "msn_killbane_mouse_click", 50, Image_left_h) 
  124. 	Mouse_input_tracker:add_mouse_input("mouse_click", "msn_killbane_mouse_click", 50, Image_right_h) 
  125. 	Mouse_input_tracker:subscribe(true) 
  126. end 
  127.  
  128. ------------------------------------------------------------------------------- 
  129. -- Mouse inputs 
  130. function msn_killbane_mouse_click(event, target_handle, mouse_x, mouse_y) 
  131. 	if target_handle == Image_right_h then 
  132. 		msn_killbane_nav("key_right") 
  133. 	elseif target_handle == Image_left_h then 
  134. 		msn_killbane_nav("key_left") 
  135. 	end 
  136. end 
  137.  
  138. function msn_killbane_mouse_move(event, target_handle) 
  139. end 
  140.  
  141. function horde_results_mouse_drag(event, target_handle, mouse_x, mouse_y) 
  142. end 
  143.  
  144. function horde_results_mouse_drag_release(event, target_handle, mouse_x, mouse_y) 
  145. end 
  146.  
  147.