./store_crib.lua

  1.  
  2. SCALE_FONT_STORE_CRIB_LIST = 0.8 
  3. STORE_CRIB_POPUP_X = 132 
  4. STORE_CRIB_POPUP_Y = 267 
  5.  
  6. Store_common_screen_grp_x = -640 
  7.  
  8. Store_crib_doc_handle = -1 
  9. Crib_title = -1 
  10. Store_crib_top_menu = {} 
  11. Store_crib_title_in_anim = -1 
  12.  
  13. -- Hint bar and store header vdo's. 
  14. local Store_logo1 
  15. local Store_logo2 
  16. local Not_popup_grp 
  17. local Reward_image 
  18.  
  19. local GVT_CARS					= 0 
  20. local	GVT_HELICOPTERS 		= 1 
  21. local	GVT_AIRPLANES 			= 2 
  22. local	GVT_WATERCRAFT			= 3 
  23.  
  24. local Previous_screen 
  25.  
  26. -- We used this as a reference to the current submenu we are building. 
  27. local Store_crib_building_menu = {} 
  28.  
  29. -- keeps track of which selection we were on when leaving to a sub-document 
  30. local Store_crib_current_menu_selection = 1 
  31. local Store_crib_screen_to_push = -1 
  32.  
  33. local Hint_bar_mouse_input_tracker 
  34. local Game_platform 
  35.  
  36. local Transition_to_garage_type = -1  
  37. local Wait_for_fade_thread_id = -1 
  38.  
  39. ---------------------------------------------------------------------------  
  40. -- Initialize crib Store (Customization) 
  41. --------------------------------------------------------------------------- 
  42. function store_crib_build_top_menu() 
  43. 	Store_crib_top_menu = {} 
  44.  
  45. 	local always_valid = true 
  46. 	-- cash MOVED TO CELL PHONE, MAYBE IT WILL COME BACK? 
  47. 	--[[if always_valid then 
  48. 		local index = #Store_crib_top_menu + 1 
  49. 		Store_crib_top_menu[index] = { label = "COMPLETION_CASH", type = TYPE_BUTTON, on_select = store_crib_open_cash, screen = "store_crib_cash", id = index } 
  50. 	end]] 
  51. 	 
  52. 	-- wardrobe 
  53. 	if always_valid then 
  54. 		local index = #Store_crib_top_menu + 1 
  55. 		Store_crib_top_menu[index] = { label = "MENU_SWAP_WARDROBE", type = TYPE_BUTTON, on_select = store_crib_open_screen, screen = "store_clothing",  id = index} 
  56. 	end 
  57. 	 
  58. 	local disable_garage = crib_is_garage_disabled()	 
  59. 	if disable_garage ~= true then 
  60. 		-- garage GVT_CARS 
  61. 		if crib_has_garage_with_vehicles_of_type(GVT_CARS) then 
  62. 			local index = #Store_crib_top_menu + 1 
  63. 			Store_crib_top_menu[index] = { label = "GARAGE_CRIB_NAME", type = TYPE_BUTTON, on_select = store_crib_open_garage, screen = "store_vehicle", id = index, garage_type = GVT_CARS } 
  64. 		end 
  65. 		 
  66. 		-- garage GVT_HELICOPTERS 
  67. 		if crib_has_garage_with_vehicles_of_type(GVT_HELICOPTERS) then 
  68. 			local index = #Store_crib_top_menu + 1 
  69. 			Store_crib_top_menu[index] = { label = "GARAGE_HELIPORT", type = TYPE_BUTTON, on_select = store_crib_open_garage, screen = "store_vehicle", id = index, garage_type = GVT_HELICOPTERS } 
  70. 		end 
  71. 		 
  72. 		-- garage GVT_AIRPLANES 
  73. 		if crib_has_garage_with_vehicles_of_type(GVT_AIRPLANES) then 
  74. 			local index = #Store_crib_top_menu + 1 
  75. 			Store_crib_top_menu[index] = { label = "GARAGE_HANGAR", type = TYPE_BUTTON, on_select = store_crib_open_garage, screen = "store_vehicle", id = index, garage_type = GVT_AIRPLANES } 
  76. 		end 
  77. 		 
  78. 		-- garage GVT_WATERCRAFT 
  79. 		if crib_has_garage_with_vehicles_of_type(GVT_WATERCRAFT) then 
  80. 			local index = #Store_crib_top_menu + 1 
  81. 			Store_crib_top_menu[index] = { label = "GARAGE_DOCK", type = TYPE_BUTTON, on_select = store_crib_open_garage, screen = "store_vehicle", id = index, garage_type = GVT_WATERCRAFT } 
  82. 		end 
  83. 	end 
  84. 	 
  85. 	-- weapons 
  86. 	if always_valid then 
  87. 		local index = #Store_crib_top_menu + 1 
  88. 		Store_crib_top_menu[index] = { label = "WPNSTOR_TITLE_WEAPON_CACHE", type = TYPE_BUTTON, on_select = store_crib_open_screen, screen = "store_weapon", id = index } 
  89. 	end 
  90. 	 
  91. 	-- Check to see if we've unlocked the gang customization menu... 
  92. 	if store_gang_is_unlocked() then 
  93. 		local index = #Store_crib_top_menu + 1 
  94. 		Store_crib_top_menu[index] = { label = "GANG_CUST_TITLE", type = TYPE_BUTTON, on_select = store_crib_open_screen, screen = "store_gang", id = index } 
  95. 	end 
  96.  
  97. 	-- Check if this is an upgradeable "stronghold" crib... 
  98. 	if crib_is_stronghold() and Completion_is_client() == false then 
  99. 		local index = #Store_crib_top_menu + 1 
  100. 		Store_crib_top_menu[index] = 	{ label = "MENU_STRONGHOLD_CUSTOMIZATION", type = TYPE_BUTTON, on_select = store_crib_open_screen, screen = "store_stronghold", id = index } 
  101. 	end	 
  102. 	 
  103. 	--add the exit option 
  104. 	local index = #Store_crib_top_menu + 1 
  105. 	Store_crib_top_menu[index] = 	{ label = "STORE_EXIT", type = TYPE_BUTTON, on_select = store_crib_exit, screen = "", id = index } 
  106. 	 
  107. end 
  108.  
  109. function store_crib_init() 
  110.  
  111. 	Store_common_current_highlight_color = COLOR_STORE_REWARDS_PRIMARY 
  112.  
  113. 	Wait_for_fade_thread_id = -1 
  114. 	 
  115. 	-- unload the full screen map to pillage memory 
  116. 	pause_map_dump() 
  117. 	 
  118. 	Game_platform = game_get_platform() 
  119.  
  120. 	Store_crib_doc_handle = vint_document_find("store_crib") 
  121. 	 
  122. 	Store_crib_title_in_anim = Vdo_anim_object:new("crib_title_anim", 0, Store_crib_doc_handle) 
  123. 	 
  124. 	local store_group = vint_object_find("screen_grp",0,Store_common_doc_handle) 
  125. 	vint_set_property(store_group,"visible",false) 
  126. 	 
  127. 	-- Set up some callbacks for the common store script 
  128. 	Store_common_populate_list_cb = store_crib_populate_list 
  129. 	Store_common_exit_cb				= store_crib_exit 
  130.  
  131. 	-- Subscribe to the button presses we need, Input_tracker is created in store_common.lua 
  132. 	Input_tracker:subscribe(false) 
  133. 	 
  134. 	bg_saints_set_type(BG_TYPE_STRONGHOLD) 
  135. 	 
  136. 	--Set Mask 
  137. 	local cell_mask = Vdo_base_object:new("cell_mask", 0, Store_common_doc_handle) 
  138. 	cell_mask:set_visible(true) 
  139. 	cell_mask:set_property("mask", true) 
  140. 	cell_mask:set_property("screen_size",488,720) 
  141. 	--cell_mask:set_anchor(344,360) 
  142.  
  143. 	if vint_is_std_res() then 
  144. 		Store_common_screen_grp_x = -320 
  145. 	end 
  146. 	 
  147. 	--Setup Button Hints 
  148. 	local hint_data = { 
  149. 		{CTRL_MENU_BUTTON_B, "MENU_BACK"},	 
  150. 	} 
  151. 	Store_common_hint_bar:set_hints(hint_data)  
  152. 	Store_common_hint_bar:set_visible(true) 
  153. 	 
  154. 	if game_is_active_input_gamepad() then 
  155. 		local hint_rotate_data = { 
  156. 			{CTRL_BUTTON_RS, "STORE_ZOOM_ROTATE"}, 
  157. 		} 
  158. 		Store_common_rotate_hint:set_hints(hint_rotate_data)  
  159. 	end 
  160. 	 
  161. 	if Game_platform == "PC" then 
  162. 		Mouse_input_tracker:subscribe(false) 
  163. 		 
  164. 		Hint_bar_mouse_input_tracker = Vdo_input_tracker:new() 
  165. 		Store_common_hint_bar:add_mouse_inputs("store_crib", Hint_bar_mouse_input_tracker) 
  166. 		Hint_bar_mouse_input_tracker:subscribe(true) 
  167. 	end 
  168. 	 
  169. 	local store_megalist_grp_h = vint_object_find("store_megalist_grp",0,Store_common_doc_handle) 
  170. 	vint_set_property(store_megalist_grp_h, "anchor", 0, 0) 
  171. 	 
  172. 	-- Set Store Header colors 
  173. 	Store_header:set_color(COLOR_STORE_REWARDS_PRIMARY, COLOR_STORE_REWARDS_SECONDARY, COLOR_STORE_REWARDS_TERTIARY) 
  174. 	Store_header:set_visible(true) 
  175.  
  176. 	Active_list:set_highlight_color(COLOR_STORE_REWARDS_PRIMARY, COLOR_STORE_REWARDS_SECONDARY)			 
  177. 		 
  178. 	-- Everything that is not in the popup so we can fade it when the popup is active 
  179. 	Not_popup_grp = Vdo_base_object:new("not_popup_grp", 0, Store_common_doc_handle) 
  180. 	 
  181. 	-- Setup purchase popup 
  182. 	Store_common_popup:set_visible(false) 
  183. 	Store_common_popup:set_color(COLOR_STORE_REWARDS_PRIMARY, COLOR_STORE_REWARDS_SECONDARY, COLOR_STORE_REWARDS_TERTIARY) 
  184. 	Store_common_popup:set_size(STORE_COMMON_LIST_SIZE, (LIST_BUTTON_HEIGHT * 5) + (LIST_BUTTON_SPACE * 5)) 
  185. 	 
  186. 	Store_common_popup:set_anchor(STORE_CRIB_POPUP_X,STORE_CRIB_POPUP_Y) 
  187. 	 
  188. 	Crib_title = vint_object_find("store_title_grp",0,Store_crib_doc_handle) 
  189. 	 
  190. 	store_crib_build_top_menu() 
  191. 	 
  192. 	-- Pass the table data to the megalist vdo. 
  193. 	Menu_data = Store_crib_top_menu 
  194. 	 
  195. 	-- Pass the table data to the megalist vdo. 
  196. 	store_crib_populate_list(Menu_data, 1)	 
  197. 	 
  198. 	ui_audio_post_event("Enter_Crib") 
  199. 	 
  200. 	--play background anim... 
  201. 	store_crib_bg_anim() 
  202. 	 
  203. 	store_unlock_controls() 
  204. 	 
  205. 	character_enable_mouse_drag(false) 
  206. end 
  207.  
  208. -- Cleanup function called on document unload. 
  209. -- 
  210. function store_crib_cleanup()	 
  211. 	if Wait_for_fade_thread_id ~= -1 then 
  212. 		thread_kill(Wait_for_fade_thread_id) 
  213. 	end 
  214. 	 
  215. 	-- Nuke all button subscriptions 
  216. 	Input_tracker:subscribe(false) 
  217. 	store_crib_enable_mouse(false) 
  218. 	 
  219. 	-- reload the full screen map 
  220. 	pause_map_restore() 
  221. 	 
  222. 	-- Some things need to be cleaned up right away when a store doc is unloading, particular disabled inputs which have 
  223. 	-- callbacks to the script that is unloading. 
  224. 	store_common_cleanup_current_store()	 
  225. end 
  226.  
  227. -- Called when this interface becomes the top one on the stack again. 
  228. -- 
  229. function store_crib_gained_focus() 
  230.  
  231. 	Store_common_current_highlight_color = COLOR_STORE_REWARDS_PRIMARY 
  232.  
  233. 	Wait_for_fade_thread_id = thread_new("store_crib_waiting_for_fade") 
  234. end 
  235.  
  236. function store_crib_waiting_for_fade() 
  237. 	while not sfx_faded_in() do 
  238. 		thread_yield() 
  239. 	end 
  240. 	-- Reset our header 
  241. 	Store_header:clear_titles() 
  242. 	--	Store_header:enable_price_respect(true) 
  243. 	Store_header:reformat_and_resize(false) 
  244. 	Store_header:set_price(nil) 
  245. 	 
  246. 	Store_common_popup:set_anchor(STORE_CRIB_POPUP_X,STORE_CRIB_POPUP_Y) 
  247. 	 
  248. 	--clear the rotate hint out 
  249. 	Store_common_rotate_hint:set_visible(false) 
  250. 	 
  251. 	-- make background so it covers up the world 
  252. 	 
  253. 	Input_tracker:subscribe(true)	 
  254. 	 
  255. 	vint_set_property(Crib_title,"visible",true) 
  256. 	 
  257. 	-- Need to clear out menu and menu stacks 
  258. 	store_common_stack_clear_menu() 
  259. 	store_common_stack_clear_id() 
  260. 	store_common_stack_clear_index() 
  261. 	 
  262. 	--reset the exit cb 
  263. 	Store_common_exit_cb = store_crib_exit 
  264. 	 
  265. 	-- Pass the table data to the megalist vdo. 
  266. 	Menu_data = Store_crib_top_menu 
  267. 	 
  268. 	--reset the bg to a strip 
  269. 	bg_saints_set_type(BG_TYPE_STRONGHOLD,true) 
  270. 	 
  271. 	local cell_mask = Vdo_base_object:new("cell_mask", 0, Store_common_doc_handle) 
  272. 	cell_mask:set_visible(true) 
  273. 	cell_mask:set_property("mask", true) 
  274. 	 
  275. 	local store_crib_in_anim = Vdo_anim_object:new("store_crib_in_anim", 0, Store_common_doc_handle) 
  276. 	local crib_in_mask_twn_h = Vdo_tween_object:new("crib_in_mask_twn", store_crib_in_anim.handle) 
  277. 	local mask_end_x,mask_end_y = crib_in_mask_twn_h:get_property("end_value") 
  278. 	crib_in_mask_twn_h:set_property("start_value", mask_end_x, mask_end_y) 
  279. 	 
  280. 	local store_common_screen_grp_h = vint_object_find("screen_grp", 0, Store_common_doc_handle) 
  281. 	local screen_x,screen_y = vint_get_property(store_common_screen_grp_h, "anchor") 
  282. 	 
  283. 	vint_set_property(store_common_screen_grp_h, "anchor", Store_common_screen_grp_x, screen_y) 
  284. 	 
  285. 	if Previous_screen == "store_stronghold" then 
  286. 		store_crib_build_top_menu() 
  287. 		store_crib_populate_list(Store_crib_top_menu, Store_crib_current_menu_selection)	 
  288. 		if Hint_bar_mouse_input_tracker ~= nil then 
  289. 			Store_common_hint_bar:add_mouse_inputs("store_crib", Hint_bar_mouse_input_tracker) 
  290. 			Hint_bar_mouse_input_tracker:subscribe(true) 
  291. 		end 
  292. 	end 
  293. 	 
  294. 	if Previous_screen == "store_stronghold" or Previous_screen == "store_vehicle" then 
  295. 		local title_twn = Vdo_tween_object:new("title_twn", 0, Store_crib_doc_handle) 
  296. 		title_twn:set_property("start_value",-800,0) 
  297. 		title_twn:set_property("end_value",0,0) 
  298. 		title_twn:set_end_event("store_crib_anim_complete") 
  299. 		 
  300. 		local mask_twn = Vdo_tween_object:new("mask_twn", 0, Store_crib_doc_handle) 
  301. 		local new_x = 104 
  302. 		if vint_is_std_res() then 
  303. 			new_x = 50 
  304. 		end 
  305. 		mask_twn:set_property("start_value", new_x, -52) 
  306. 		mask_twn:set_property("end_value", new_x, -52) 
  307. 		 
  308. 		vint_apply_start_values(Store_crib_title_in_anim.handle) 
  309. 		 
  310. 		Store_crib_title_in_anim:play() 
  311. 		 
  312. 		if Hint_bar_mouse_input_tracker ~= nil then 
  313. 			Hint_bar_mouse_input_tracker:subscribe(true) 
  314. 		end 
  315. 	end 
  316. 	 
  317. 	vint_apply_start_values(store_crib_in_anim.handle) 
  318.  
  319. 	store_crib_in_anim:play() 
  320. 	 
  321. 	Not_popup_grp:set_alpha(1) 
  322. 	 
  323. 	--reset the hints 
  324. 	local hint_data = {} 
  325. 	hint_data = { {CTRL_MENU_BUTTON_B, "MENU_BACK"}, }	 
  326. 	Store_common_hint_bar:set_hints(hint_data)  
  327. 	 
  328. 	-- Pass the table data to the megalist vdo. 
  329. 	store_crib_populate_list(Menu_data, Store_crib_current_menu_selection) 
  330. 	store_crib_enable_mouse(true) 
  331. 	 
  332. 	Wait_for_fade_thread_id = -1 
  333. end 
  334.  
  335. function store_crib_bg_anim() 
  336. 	 
  337. 	local store_crib_in_anim = Vdo_anim_object:new("store_crib_in_anim", 0, Store_common_doc_handle) 
  338. 	store_crib_in_anim:play() 
  339. 	 
  340. 	vint_apply_start_values(store_crib_in_anim.handle) 
  341. 	vint_apply_start_values(Store_crib_title_in_anim.handle) 
  342. 	 
  343. 	Store_crib_title_in_anim:play() 
  344. 	 
  345. 	local store_group = vint_object_find("screen_grp",0,Store_common_doc_handle) 
  346. 	vint_set_property(store_group,"visible",true) 
  347. 	 
  348. 	bg_saints_show(true) 
  349. 	bg_saints_slide_in() 
  350. 	 
  351. end 
  352.  
  353. function store_crib_back_out_anim( animate_title ) 
  354. 	 
  355. 	local back_out_anim = Vdo_anim_object:new("store_crib_out_anim", 0, Store_common_doc_handle) 
  356. 	local back_out_end_twn = Vdo_tween_object:new("common_anchor_out_twn", back_out_anim.handle) 
  357. 	back_out_end_twn:set_end_event("store_crib_back_out_anim_complete") 
  358. 	 
  359. 	if animate_title then 
  360. 		local title_twn = Vdo_tween_object:new("title_twn", 0, Store_crib_doc_handle) 
  361. 		title_twn:set_property("start_value",0,0) 
  362. 		title_twn:set_property("end_value",-800,0) 
  363. 		Store_crib_title_in_anim:play()	 
  364. 	end 
  365. 	 
  366. 	bg_saints_set_background(false) 
  367. 	 
  368. 	back_out_anim:play() 
  369. 	 
  370. end 
  371.  
  372. function store_crib_anim_complete() 
  373. end 
  374.  
  375. function store_crib_back_out_anim_complete(tween_h, event) 
  376. 	 
  377. 	-- if we are not going to the stronghold screen, kill the mask 
  378. 	if Store_crib_screen_to_push ~= "store_stronghold" then 
  379. 		local cell_mask = Vdo_base_object:new("cell_mask", 0, Store_common_doc_handle) 
  380. 		cell_mask:set_visible(false) 
  381. 		cell_mask:set_property("mask", false) 
  382. 	end 
  383.  
  384. 	if Transition_to_garage_type ~= -1 then 
  385. 		-- Set up going to garage 
  386. 		store_crib_init_crib_garage(Transition_to_garage_type) 
  387. 		Transition_to_garage_type = -1 
  388. 	end 
  389.  
  390. 	 
  391. 	if Previous_screen == "store_vehicle" then 
  392. 		bg_saints_set_type(BG_TYPE_CENTER, true, 1280) 
  393. 		return 
  394. 	end 
  395.  
  396. 	-- attempt to push screen.  If something bad happens kick the user back to game. 
  397. 	local success = push_screen(Store_crib_screen_to_push) 
  398. 	 
  399. 	if success == false then 
  400. 		pop_screen() 
  401. 	end 
  402. end 
  403.  
  404. function store_lock_controls() 
  405. 	Input_tracker:subscribe(false) 
  406. 	store_crib_enable_mouse(false) 
  407. end 
  408.  
  409. function store_unlock_controls() 
  410. 	debug_print("vint","THIS IS REALLY BAD\n") 
  411. 	Input_tracker:subscribe(true) 
  412. 	store_crib_enable_mouse(true) 
  413. end 
  414.  
  415. 	 
  416. -- Called when player requests exiting store. 
  417. -- 
  418. function store_crib_exit() 
  419. 	Store_common_popup:populate_list(Yes_no_choices, 2, STORE_COMMON_LIST_SIZE, 2)	 
  420. 	Store_common_popup:set_title("MENU_TITLE_WARNING") 
  421. 	Store_common_popup:set_text("MENU_EXIT_CRIB")	 
  422. 	Store_common_popup:nav_enable(true, "store_crib_exit_final", "store_crib_popup_nav") 
  423. 	Not_popup_grp:set_alpha(.5) 
  424. 	 
  425. 	store_crib_enable_mouse(false) 
  426. end 
  427.  
  428. -- Called when player has responded to store exit confirmation dialog. 
  429. -- 
  430. -- event: input response from the player 
  431. -- 
  432. function store_crib_exit_final(event) 
  433. 	Store_common_popup:nav_enable(false, nil, nil) 
  434. 		 
  435. 	-- The user hit the B button and is exiting 
  436. 	-- This is redundant to selecting "No" in the list 
  437. 	if event == "back" then 
  438. 		game_UI_audio_play("UI_Main_Menu_Nav_Back") 
  439. 		Not_popup_grp:set_alpha(1) 
  440. 		store_crib_enable_mouse(true) 
  441. 		return 
  442. 	end 
  443. 	 
  444. 	game_UI_audio_play("UI_Main_Menu_Select") 
  445. 	 
  446. 	-- Did we select yes?  This assumes yes is the first item 
  447. 	if Store_common_popup:get_selected_data() ~= 1 then 
  448. 		Not_popup_grp:set_alpha(1) 
  449. 		store_crib_enable_mouse(true) 
  450. 		return 
  451. 	end 
  452. 	 
  453. 	Not_popup_grp:set_alpha(0) 
  454. 	-- exit the interface 
  455. 	pop_screen() 
  456. end 
  457.  
  458. -- Populate the active megalist menu, and hide the previous menu 
  459. -- 
  460. -- list_data: 		this table contains the data to populate the megalist 
  461. -- current_index: 	the current index in the menu that's selected 
  462. -- 
  463. function store_crib_populate_list(list_data, current_index) 
  464. 	Active_list:draw_items(list_data, current_index, STORE_COMMON_LIST_SIZE, 10, SCALE_FONT_STORE_CRIB_LIST)	 
  465. 	Active_list:set_visible(true) 
  466. 	 
  467. 	if Game_platform == "PC" then 
  468. 		Mouse_input_tracker:remove_all() 
  469. 		 
  470. 		Active_list:set_store("store_crib") 
  471. 		Active_list:add_mouse_inputs("store_common", Mouse_input_tracker) 
  472. 		Mouse_input_tracker:subscribe(true) 
  473. 	end 
  474. end 
  475.  
  476. -- Clears the price and respect values from the store header. 
  477. -- 
  478. function store_crib_header_revert(menu_data) 
  479. 	Store_header:set_price(nil) 
  480. 	Store_header:set_respect(nil) 
  481. end 
  482.  
  483. -- Handles navigation of any popups 
  484. function store_crib_popup_nav(event, value) 
  485. 	 
  486. 	if event == "nav_up" then	 
  487. 		Store_common_popup.list:move_cursor(-1)	 
  488. 	elseif event == "nav_down" then 
  489. 		Store_common_popup.list:move_cursor(1) 
  490. 	elseif event == "mouse_move" then 
  491. 		-- value contains the target_handle in this case 
  492. 		local new_index = Store_common_popup.list:get_button_index(value) 
  493. 		if new_index ~= 0 then 
  494. 			Store_common_popup.list:set_selection(new_index) 
  495. 			Store_common_popup.list:move_cursor(0, true) 
  496. 		end 
  497. 		 
  498. 	else 
  499. 		--do nothing 
  500. 	end 
  501. end 
  502.  
  503. -- Pushes a new UI screen on the stack based on the "screen" parameter in menu_data. 
  504. -- 
  505. function store_crib_open_screen(menu_data) 
  506. 	 
  507. 	Previous_screen = menu_data.screen 
  508. 	Store_crib_current_menu_selection = menu_data.id 
  509. 	Store_crib_screen_to_push = menu_data.screen 
  510. 	 
  511. 	--LOCK INPUT 
  512. 	store_lock_controls() 
  513. 	 
  514. 	--local cell_mask = Vdo_base_object:new("cell_mask", 0, Store_common_doc_handle) 
  515. 	if menu_data.screen == "store_stronghold" then 
  516. 		bg_saints_set_type(BG_TYPE_STRONGHOLD,true) 
  517. 		store_crib_back_out_anim(true) 
  518. 		Hint_bar_mouse_input_tracker:subscribe(false) 
  519. 		Hint_bar_mouse_input_tracker:remove_all() 
  520. 	elseif menu_data.screen == "store_weapon" or menu_data.screen == "store_gang" or menu_data.screen == "store_clothing" then 
  521. 		store_crib_back_out_anim() 
  522. 	else	 
  523. 		bg_saints_set_type(BG_TYPE_DEFAULT,true) 
  524. 		store_crib_back_out_anim() 
  525. 	end 
  526.  
  527. end 
  528.  
  529. function store_crib_open_cash(menu_data) 
  530. 	 
  531. 	Previous_screen = menu_data.screen 
  532. 	Store_crib_current_menu_selection = menu_data.id 
  533. 	push_screen(menu_data.screen) 
  534. 	store_crib_enable_mouse(false) 
  535. end 
  536.  
  537. function store_crib_open_garage(menu_data) 
  538. 	--LOCK INPUT 
  539. 	store_lock_controls() 
  540. 	 
  541. 	Previous_screen = menu_data.screen 
  542. 	Store_crib_current_menu_selection = menu_data.id 
  543. 	 
  544. 	Transition_to_garage_type = menu_data.garage_type 
  545.  
  546. 	store_crib_back_out_anim(true) 
  547. 	store_crib_enable_mouse(false) 
  548. end 
  549. 		 
  550. -- Base Menu Options always available 
  551. --[[ 
  552. Store_crib_top_menu = { 
  553. 	[1] = { label = "COMPLETION_CASH", type = TYPE_BUTTON, on_select = store_crib_open_cash, screen = "store_crib_cash", id = 1 }, 
  554. 	[2] = { label = "MENU_SWAP_WARDROBE", type = TYPE_BUTTON, on_select = store_crib_open_screen, screen = "store_clothing",  id = 2}, 
  555. 	[3] = { label = "GARAGE_CRIB_NAME", type = TYPE_BUTTON, on_select = store_crib_open_garage, screen = "store_vehicle", id = 3 },	 
  556. 	[4] = { label = "WPNSTOR_TITLE_WEAPON_CACHE", type = TYPE_BUTTON, on_select = store_crib_open_screen, screen = "store_weapon", id = 4 }, 
  557. } 
  558. --]] 
  559.  
  560. -- ===================================== 
  561. --       Mouse Specific Functions 
  562. -- ===================================== 
  563.  
  564. function store_crib_enable_mouse(enable) 
  565. 	if Game_platform == "PC" and enable ~= nil then 
  566. 		if Mouse_input_tracker ~= 0 then 
  567. 			Mouse_input_tracker:subscribe(enable) 
  568. 		end 
  569. 		 
  570. 		if Hint_bar_mouse_input_tracker ~= nil then 
  571. 			Hint_bar_mouse_input_tracker:subscribe(enable) 
  572. 		end 
  573. 		 
  574. 	end 
  575. end 
  576.  
  577. function store_crib_mouse_click(event, target_handle) 
  578. 	local hint_index = Store_common_hint_bar:get_hint_index(target_handle) 
  579. 	if hint_index ~= 0 then 
  580. 		store_common_button_b() 
  581. 	end 
  582. end 
  583.  
  584. function store_crib_mouse_move(event, target_handle) 
  585. 	-- Reset all highlights 
  586. 	Store_common_hint_bar:set_highlight(0) 
  587. 	 
  588. 	-- Check if the mouse is over the hint bar buttons 
  589. 	local hint_index = Store_common_hint_bar:get_hint_index(target_handle) 
  590. 	if hint_index ~= 0 then 
  591. 		Store_common_hint_bar:set_highlight(hint_index, Store_common_current_highlight_color) 
  592. 		return 
  593. 	end 
  594. 	 
  595. 	-- Check if the mouse is over a button on the mega list 
  596. 	local old_index = Active_list:get_selection() 
  597. 	local new_index = Active_list:get_button_index(target_handle) 
  598. 	if new_index ~= 0 and new_index ~= old_index then 
  599. 		Active_list:set_selection(new_index) 
  600. 		Active_list:move_cursor(0, true) 
  601. 		return 
  602. 	end 
  603. end 
  604.  
  605. function store_crib_mouse_scroll(event, target_handle, mouse_x, mouse_y, scroll_lines) 
  606. end 
  607.  
  608. function store_crib_mouse_drag(event, target_handle, mouse_x, mouse_y) 
  609. end 
  610.  
  611. function store_crib_mouse_drag_release(event, target_handle, mouse_x, mouse_y) 
  612. end 
  613.