./store_gang.lua

  1.  
  2. SCALE_FONT_STORE_GANG_LIST = 0.8 
  3.  
  4. Store_gang_doc_handle = -1 
  5.  
  6. -- Hint bar and store header vdo's. 
  7. local Store_logo1 
  8. local Store_logo2 
  9. local Not_popup_grp 
  10. local Reward_image 
  11.  
  12. -- We used this as a reference to the current submenu we are building. 
  13. local Store_gang_building_menu = {} 
  14.  
  15. -- Keeps track of the text tag crc for the category the player chose. 
  16. local Store_gang_category_label_crc = 0 
  17.  
  18. -- Slot id (0-3) that is currently the "front" character.  Entering interface starts at 0. 
  19. local Store_gang_current_slot = 0 
  20.  
  21. local Store_gang_slot_info = {} 
  22.  
  23. -- Similar to character slots, but for vehicles.  Entering interface starts at 0. 
  24. local Store_gang_current_vehicle_slot = 0 
  25.  
  26. local Store_gang_loaded_from_crib = false 
  27.  
  28. local Hint_bar_mouse_input_tracker 
  29. local Game_platform 
  30.  
  31. local Store_gang_input_allowed = false 
  32.  
  33. ---------------------------------------------------------------------------  
  34. -- Initialize Gang Store (Customization) 
  35. --------------------------------------------------------------------------- 
  36. function store_gang_init() 
  37.  
  38. 	Store_common_current_highlight_color = COLOR_STORE_CRIB_PRIMARY 
  39.  
  40. 	Game_platform = game_get_platform() 
  41.  
  42. 	Store_gang_loaded_from_crib = store_common_crib_is_loaded() 
  43.  
  44. 	Store_gang_doc_handle = vint_document_find("store_gang") 
  45. 	 
  46. 	-- Set up some callbacks for the common store script 
  47. 	Store_common_allow_input_cb	= store_gang_allow_input 
  48. 	Store_common_populate_list_cb = store_gang_populate_list 
  49. 	Store_common_exit_cb				= store_gang_exit 
  50.  
  51. 	-- Subscribe to the button presses we need, Input_tracker is created in store_common.lua 
  52. 	Input_tracker:subscribe(false) 
  53.  
  54. 	--Setup Button Hints 
  55. 	local hint_data = { 
  56. 		{CTRL_MENU_BUTTON_B, "MENU_BACK"},	 
  57. 	} 
  58. 	Store_common_hint_bar:set_hints(hint_data)  
  59. 	Store_common_hint_bar:set_visible(true)	 
  60. 	 
  61. 	if game_is_active_input_gamepad() then 
  62. 		local hint_rotate_data = { 
  63. 			{CTRL_BUTTON_RS, "CONTROL_ROTATE"}, 
  64. 		} 
  65. 		Store_common_rotate_hint:set_hints(hint_rotate_data) 	 
  66. 		Store_common_rotate_hint:set_visible(true) 
  67. 	end 
  68. 	character_enable_mouse_drag(true) 
  69.  
  70. 	-- Initialize mouse input trackers and create mouse tracker for the hint bar 
  71. 	if Game_platform == "PC" then 
  72. 		Mouse_input_tracker:subscribe(false) 
  73. 		 
  74. 		Hint_bar_mouse_input_tracker = Vdo_input_tracker:new() 
  75. 		Store_common_hint_bar:add_mouse_inputs("store_gang", Hint_bar_mouse_input_tracker) 
  76. 		Hint_bar_mouse_input_tracker:subscribe(true) 
  77. 	end 
  78. 	 
  79. 	-- Set Store Header colors 
  80. 	Store_header:set_color(COLOR_STORE_CRIB_PRIMARY, COLOR_STORE_CRIB_SECONDARY, COLOR_STORE_CRIB_TERTIARY) 
  81. 	Store_header:set_visible(true) 
  82. 	 
  83. 	Store_header:push_title(nil, "GANG_CUSTOMIZATION") 
  84.  
  85. 	Active_list:set_highlight_color(COLOR_STORE_CRIB_PRIMARY, COLOR_STORE_CRIB_SECONDARY)			 
  86. 		 
  87. 	-- Everything that is not in the popup so we can fade it when the popup is active 
  88. 	Not_popup_grp = Vdo_base_object:new("not_popup_grp", 0, Store_common_doc_handle) 
  89. 	 
  90. 	-- Setup purchase popup 
  91. 	Store_common_popup:set_visible(false) 
  92. 	Store_common_popup:set_color(COLOR_STORE_CRIB_PRIMARY, COLOR_STORE_CRIB_SECONDARY, COLOR_STORE_CRIB_TERTIARY) 
  93. 	Store_common_popup:set_size(STORE_COMMON_LIST_SIZE, (LIST_BUTTON_HEIGHT * 5) + (LIST_BUTTON_SPACE * 5)) 
  94. 	 
  95. 	-- Setup Color grid 
  96. 	Store_common_color_grid:set_visible(false) 
  97. 	 
  98. 	if Store_gang_loaded_from_crib then 
  99. 		-- crib specific stuff 
  100. 		local store_main_grp = Vdo_base_object:new("store_main_grp", 0, Store_common_doc_handle) 
  101. 		store_main_grp:set_anchor(0,0) 
  102. 		 
  103. 		bg_saints_set_type(BG_TYPE_CRIB,true,1280) 
  104. 		bg_saints_set_background(false) 
  105. 		 
  106. 		-- animate in ui for gang customization (shared by all stores) 
  107. 		local store_gang_in_anim = Vdo_anim_object:new("store_common_in_anim", 0, Store_common_doc_handle) 
  108. 		local end_event_twn = Vdo_tween_object:new("end_event_twn", store_gang_in_anim.handle, Store_common_doc_handle) 
  109. 		end_event_twn:set_end_event("store_unlock_controls") 
  110. 		 
  111. 		local twn_h = vint_object_find("store_megalist_grp_twn",store_gang_in_anim.handle,Store_common_doc_handle) 
  112. 		vint_set_property(twn_h,"start_event","store_gang_bg_anim_done") 
  113. 		 
  114. 		bg_saints_show(true) 
  115. 		 
  116. 		vint_apply_start_values(store_gang_in_anim.handle) 
  117. 		store_gang_in_anim:play(0) 
  118. 		 
  119. 	end 
  120. 	 
  121. 	-- Pass the table data to the megalist vdo. 
  122. 	Menu_data = Store_gang_top_menu 
  123. 	 
  124. 	-- Pass the table data to the megalist vdo. 
  125. 	store_gang_populate_list(Menu_data, 1)	 
  126. 	 
  127. 	-- acquire information about the 4 gang character slots 
  128. 	store_gang_slot_populate() 
  129. 	 
  130. 	vint_dataitem_add_subscription("store_gang_current_object_is_loaded", "update", "store_gang_load_status_update")	 
  131.  
  132. end 
  133.  
  134. -- Cleanup function called on document unload. 
  135. -- 
  136. function store_gang_cleanup() 
  137.  
  138. 	if Store_gang_loaded_from_crib == false then 
  139. 		bg_saints_show(false) 
  140.  
  141. 		-- Nuke all button subscriptions 
  142. 		Input_tracker:subscribe(false) 
  143. 		store_gang_enable_mouse(false) 
  144. 	end 
  145. 	 
  146. 	character_enable_mouse_drag(false) 
  147. 	 
  148. 	-- Some things need to be cleaned up right away when a store doc is unloading, particular disabled inputs which have 
  149. 	-- callbacks to the script that is unloading. 
  150. 	store_common_cleanup_current_store()	 
  151. end 
  152.  
  153. function store_lock_controls() 
  154. 	Input_tracker:subscribe(false) 
  155. 	store_gang_enable_mouse(false) 
  156. end 
  157.  
  158. function store_unlock_controls() 
  159. 	Input_tracker:subscribe(true) 
  160. 	store_gang_enable_mouse(true) 
  161. end 
  162.  
  163. function store_gang_slot_populate() 
  164.  
  165. 	Store_gang_slot_info = {} 
  166. 	vint_dataresponder_request("store_gang_slot_dr", "store_gang_slot_add", 0)		 
  167. end 
  168.  
  169. -- Called by data responder to add a new slot to the table 
  170. -- 
  171. function store_gang_slot_add(is_random, display_name_crc) 
  172. 	local menu_idx = #Store_gang_slot_info + 1 
  173.  
  174. 	local new_item = { 
  175. 		id = menu_idx - 1, 
  176. 		type = TYPE_BUTTON, 
  177. 		is_random = is_random, 
  178. 		label_crc = display_name_crc, 
  179. 	}		 
  180. 	 
  181. 	Store_gang_slot_info[menu_idx] = new_item 
  182. end 
  183.  
  184. function store_gang_slot_menu_enter() 
  185. 	-- We want left/right movement to rotate characters instead of moving sliders in this interface 
  186. 	Input_tracker:remove_input("nav_left") 
  187. 	Input_tracker:remove_input("nav_right") 
  188. 	Input_tracker:add_input("nav_left", "store_common_nav_up", 50) 
  189. 	Input_tracker:add_input("nav_right", "store_common_nav_down", 50)	 
  190. 	 
  191. 	-- update labels (gang selections may have been updated in a submenu). 
  192. 	for i = 1, #Menu_data do 
  193. 		local values 
  194. 		values = {[0] = i, [1] = Store_gang_slot_info[i].label_crc}	 
  195. 		Menu_data[i].label = vint_insert_values_in_string("GANG_CUST_SLOT", values) 
  196. 	end	 
  197. 	 
  198. 	local index = Active_list:get_selection() 
  199. 	 
  200. 	store_gang_populate_list(Menu_data, index) 
  201. 	 
  202. 	-- check for random 
  203. 	store_gang_handle_random() 
  204. 	 
  205. 	--store_gang_show_question_marks(true) 
  206. end 
  207.  
  208. function store_gang_rotate_characters() 
  209. 	-- We want left/right movement to rotate characters instead of moving sliders in this interface 
  210. 	Input_tracker:remove_input("nav_left") 
  211. 	Input_tracker:remove_input("nav_right") 
  212. 	Input_tracker:add_input("nav_left", "store_common_nav_left", 50) 
  213. 	Input_tracker:add_input("nav_right", "store_common_nav_right", 50) 
  214. 	 
  215. 	-- hide random text 
  216. 	local crib_random_grp = Vdo_base_object:new("crib_random_grp", 0, Store_common_doc_handle) 
  217. 	crib_random_grp:set_visible(false)		 
  218. end 
  219.  
  220. function store_gang_slot_menu_leave() 
  221. 	store_gang_rotate_characters() 
  222. 	 
  223. 	--store_gang_show_question_marks(false) 
  224. end 
  225.  
  226. -- Player is navigating to a new gang character slot.  We need to call C to rotate the players and set new slot 
  227. -- 
  228. function store_gang_slot_nav(menu_data) 
  229. 	vint_dataresponder_post("store_gang_character_dr", "Set_slot", menu_data.id) 
  230. 	Store_gang_current_slot = menu_data.id 
  231. 	store_gang_handle_random() 
  232. end 
  233.  
  234. function store_gang_handle_random() 
  235. 	-- if slot is random than display text for which category 
  236. 	local crib_random_grp = Vdo_base_object:new("crib_random_grp", 0, Store_common_doc_handle) 
  237. 	local crib_random_text = Vdo_base_object:new("crib_random_txt", 0, Store_common_doc_handle) 
  238. 	local crib_random_anim_out = Vdo_anim_object:new("crib_random_anim_out", 0, Store_common_doc_handle) 
  239. 	local end_event_twn = Vdo_tween_object:new("random_out_end_event", crib_random_anim_out.handle) 
  240. 	 
  241. 	end_event_twn:set_end_event("store_gang_random_anim_complete") 
  242. 	crib_random_anim_out:play(0)	 
  243. end 
  244.  
  245. function store_gang_random_anim_complete() 
  246. 	local crib_random_anim_in = Vdo_anim_object:new("crib_random_anim_in", 0, Store_common_doc_handle) 
  247. 	local crib_random_grp = Vdo_base_object:new("crib_random_grp", 0, Store_common_doc_handle) 
  248. 	local crib_random_text = Vdo_base_object:new("crib_random_txt", 0, Store_common_doc_handle) 
  249. 	 
  250. 	if Store_gang_slot_info[Store_gang_current_slot + 1].is_random == true then 
  251. 		local values, tag 
  252. 		values = {[0] = "GANG_CUST_RANDOM", [1] = Store_gang_slot_info[Store_gang_current_slot + 1].label_crc}	 
  253. 		tag = vint_insert_values_in_string("{0}  {1:text_tag_crc}", values)		 
  254. 		crib_random_text:set_text(tag) 
  255. 		crib_random_grp:set_visible(true)		 
  256. 		crib_random_anim_in:play(0)				 
  257. 	else 
  258. 		crib_random_grp:set_visible(false) 
  259. 	end	 
  260. end 
  261.  
  262. -- Player has chosen a gang character slot, and now we need to populate the submenu with the gang categories. 
  263. -- 
  264. function store_gang_category_populate(menu_data) 
  265. 	-- change our input for left/right back to default 
  266. 	store_gang_rotate_characters() 
  267. 	 
  268. 	Store_gang_building_menu = menu_data.sub_menu 
  269. 	Store_gang_building_menu.start_index = 1	 
  270. 	vint_dataresponder_request("store_gang_category_dr", "store_gang_category_add", 0)		 
  271. end 
  272.  
  273. -- Called by data responder to add a new category to the menu. 
  274. -- 
  275. function store_gang_category_add(id, display_name_crc, is_current) 
  276. 	local menu_idx = #Store_gang_building_menu + 1 
  277.  
  278. 	local new_item = { 
  279. 		id = id, 
  280. 		type = TYPE_BUTTON, 
  281. 		label = nil, 
  282. 		label_crc = display_name_crc, 
  283. 		on_sub_menu_fill = store_gang_character_populate, 
  284. 	}		 
  285.  
  286. 	Store_gang_building_menu[menu_idx] = new_item 
  287. 	 
  288. 	if is_current == true then 
  289. 		Store_gang_building_menu.start_index = menu_idx 
  290. 	end		 
  291. end 
  292.  
  293. -- The player has chosen a category; now we need to find the available characters in that category. 
  294. -- 
  295. -- menu_data: standard table with the contents of the menu entry chosen. 
  296. -- 
  297. function store_gang_character_populate(menu_data) 
  298. 	Store_gang_category_label_crc = menu_data.label_crc 
  299. 	Store_gang_building_menu = menu_data.sub_menu 
  300. 	Store_gang_building_menu.start_index = 1 
  301. 	vint_dataresponder_request("store_gang_character_dr", "store_gang_character_add", 0, menu_data.id) 
  302. 	store_gang_show_question_marks(true) 
  303. 	store_gang_character_nav(Store_gang_building_menu[Store_gang_building_menu.start_index]) 
  304. end 
  305.  
  306. -- When leaving the character style selection menu, we're going to stop showing question marks 
  307. -- 
  308. function store_gang_character_back(menu_data) 
  309. 	store_gang_show_question_marks(false) 
  310. end 
  311.  
  312. -- Called by data responder to add a new character to the menu. 
  313. -- 
  314. function store_gang_character_add(id, is_current, is_random) 
  315. 	 
  316. 	local menu_idx = #Store_gang_building_menu + 1 
  317. 	 
  318. 	local menu_label 
  319. 	local insert_values = { [0] = Store_gang_category_label_crc, [1] = menu_idx } 
  320. 	 
  321. 	if is_random then 
  322. 		menu_label = "GANG_CUST_RANDOM" 
  323. 	else 
  324. 		menu_label = vint_insert_values_in_string("{0:text_tag_crc} {1}", insert_values) 
  325. 	end 
  326. 	 
  327. 	local new_item = { 
  328. 		type = TYPE_BUTTON, 
  329. 		id = id, 
  330. 		label = menu_label, 
  331. 		label_crc = nil, 
  332. 		--is_locked = is_locked, 
  333. 		on_nav = store_gang_character_nav, 
  334. 		on_select = store_gang_character_update, 
  335. 		on_cancel = store_gang_character_revert, 
  336. 		on_back	 = store_gang_character_back, 
  337. 		is_random = is_random 
  338. 	}		 
  339.  
  340. 	Store_gang_building_menu[menu_idx] = new_item 
  341. 	 
  342. 	if is_current == true then 
  343. 		Store_gang_building_menu.start_index = menu_idx 
  344. 	end	 
  345. end 
  346.  
  347. -- Called when the player navigates the character list, and we spawn in the characters to show. 
  348. -- 
  349. function store_gang_character_nav(menu_data) 
  350. 	if #Store_gang_building_menu == 1 then 
  351. 		return 
  352. 	end 
  353. 	vint_dataresponder_post("store_gang_character_dr", "Load", menu_data.id) 
  354. 	store_gang_slot_populate() 
  355. end 
  356. 	 
  357. -- Called when the player hits accept to keep the character 
  358. --	 
  359. function store_gang_character_update(menu_data) 
  360. 	vint_dataresponder_post("store_gang_character_dr", "Update_char", menu_data.id) 
  361. 	 
  362. 	-- update our gang character slot info table 
  363. 	store_gang_slot_populate()	 
  364. 	 
  365. 	-- go back up 2 menus 
  366. 	store_common_back_menu() 
  367. 	store_common_back_menu() 
  368. end	 
  369. 	 
  370. -- Called when the player hits cancel to revert the character 
  371. --	 
  372. function store_gang_character_revert(menu_data) 
  373. 	vint_dataresponder_post("store_gang_character_dr", "Revert_char", menu_data.id) 
  374. 	store_gang_slot_populate()	 
  375. end		 
  376. 	 
  377. -- Player has chosen to see gang sign menu, and now we need to populate the submenu. 
  378. -- 
  379. function store_gang_sign_populate(menu_data) 
  380. 	 
  381. 	Store_gang_building_menu = menu_data.sub_menu 
  382. 	vint_dataresponder_request("store_gang_sign_dr", "store_gang_sign_add", 0)		 
  383. 	 
  384. 	--[[local hint_rotate_data = { 
  385. 		{CTRL_BUTTON_RS, "STORE_ZOOM"}, 
  386. 	} 
  387. 	Store_common_rotate_hint:set_hints(hint_rotate_data)]]-- 
  388. 	Store_common_rotate_hint:set_visible(false) 
  389. 	 
  390. 	character_enable_mouse_drag(false) 
  391. end 
  392.  
  393. -- Called by data responder to add a new gang sign to the menu. 
  394. -- 
  395. function store_gang_sign_add(sign_type, display_name, is_current) 
  396. 	local menu_idx = #Store_gang_building_menu + 1 
  397.  
  398. 	local new_item = { 
  399. 		id = menu_idx - 1, 
  400. 		type = TYPE_BUTTON, 
  401. 		label = display_name, 
  402. 		label_crc = nil, 
  403. 		on_nav = store_gang_sign_nav, 
  404. 		on_select = store_gang_sign_select, 
  405. 		on_cancel = store_gang_sign_revert, 
  406. 		on_back = store_gang_sign_on_back 
  407. 	}		 
  408.  
  409. 	Store_gang_building_menu[menu_idx] = new_item 
  410. 	 
  411. 	if is_current == true then 
  412. 		Store_gang_building_menu.start_index = menu_idx 
  413. 	end	 
  414. end	 
  415. 	 
  416. -- Called when navigating over a gang sign 
  417. -- 
  418. function store_gang_sign_nav(menu_data) 
  419. 	gang_customization_select_gang_sign(0, menu_data.id) 
  420. end 
  421. 	 
  422. 	 
  423. -- Called when selecting a gang sign 
  424. -- 
  425. function store_gang_sign_select(menu_data) 
  426. 	gang_customization_confirm_gang_sign(menu_data.id) 
  427. 	store_common_back_menu()	 
  428. end 
  429.  
  430. -- Called when reverting from a gang sign 
  431. -- 
  432. function store_gang_sign_revert(menu_data) 
  433. 	gang_customization_revert_gang_sign() 
  434. end 
  435. 	 
  436. -- Called when navigating to a different vehicle slot 
  437. -- 
  438. function store_gang_vehicle_slot_nav(menu_data) 
  439. 	vint_dataresponder_post("store_gang_vehicle_dr", "Set_slot", menu_data.id) 
  440. 	Store_gang_current_vehicle_slot = menu_data.id 
  441. end 
  442. 	 
  443. -- Called when we need to request the available vehicles list. 
  444. -- 
  445. function store_gang_vehicle_populate(menu_data) 
  446. 	Store_gang_building_menu = menu_data.sub_menu 
  447. 	vint_dataresponder_request("store_gang_vehicle_dr", "store_gang_vehicle_add", 0, menu_data.id)	 
  448. end 
  449.  
  450. -- Called by data responder to add a new vehicle to the menu. 
  451. -- 
  452. function store_gang_vehicle_add(name, is_current) 
  453. 	local menu_idx = #Store_gang_building_menu + 1 
  454. 	 
  455. 	local new_item = { 
  456. 		type = TYPE_BUTTON, 
  457. 		id = menu_idx - 1, 
  458. 		label = name, 
  459. 		label_crc = nil, 
  460. 		--is_locked = is_locked, 
  461. 		on_nav = store_gang_vehicle_nav, 
  462. 		on_select = store_gang_vehicle_update, 
  463. 		on_cancel = store_gang_vehicle_revert, 
  464. 	}		 
  465.  
  466. 	Store_gang_building_menu[menu_idx] = new_item 
  467. 	 
  468. 	if is_current == true then 
  469. 		Store_gang_building_menu.start_index = menu_idx 
  470. 	end	 
  471. end 
  472. 	 
  473. -- Called when the player navigates the vehicle list, and we spawn in the vehicle to show. 
  474. -- 
  475. function store_gang_vehicle_nav(menu_data) 
  476. 	gang_customization_select_vehicle(menu_data.id, Store_gang_current_vehicle_slot) 
  477. end 
  478. 	 
  479. -- Called when the player hits accept to keep the vehicle 
  480. --	 
  481. function store_gang_vehicle_update(menu_data) 
  482. 	gang_customization_confirm_vehicle(Store_gang_current_vehicle_slot) 
  483. 	store_common_back_menu() 
  484. end	 
  485. 	 
  486. -- Called when the player hits cancel to revert the vehicle 
  487. --	 
  488. function store_gang_vehicle_revert(menu_data) 
  489. 	gang_customization_revert_vehicle(Store_gang_current_vehicle_slot) 
  490. end		 
  491. 	 
  492. -- Called when player requests exiting store. 
  493. -- 
  494. function store_gang_exit() 
  495.  
  496. 	-- no confirmation needed if we're just going back to the crib menu 
  497. 	if Store_gang_loaded_from_crib then 
  498. 		game_UI_audio_play("UI_Main_Menu_Nav_Back") 
  499. 		-- lock input during animation 
  500. 		store_lock_controls() 
  501. 		-- make background so player is covered up 
  502. 		bg_saints_set_background(false) 
  503. 		local back_out_anim = Vdo_anim_object:new("store_crib_out_anim", 0, Store_common_doc_handle) 
  504. 		local back_out_end_twn = Vdo_tween_object:new("common_anchor_out_twn", back_out_anim.handle) 
  505. 		back_out_end_twn:set_end_event("store_gang_crib_exit") 
  506. 		back_out_anim:play(0) 
  507. 						 
  508. 		-- notify C code to reset camera (end customization camera_mode, customization near clip) 
  509. 		store_gang_begin_exit() 
  510.  
  511. 	else 
  512. 		Store_common_popup:populate_list(Yes_no_choices, 1, STORE_COMMON_LIST_SIZE, 2)	 
  513. 		Store_common_popup:set_title("MENU_TITLE_WARNING") 
  514. 		Store_common_popup:set_text("STORE_EXIT_WARNING_BODY")		 
  515. 		Store_common_popup:nav_enable(true, "store_gang_exit_final", "store_gang_popup_nav") 
  516. 		Not_popup_grp:set_alpha(.5) 
  517. 		 
  518. 		store_gang_enable_mouse(false) 
  519. 	end 
  520. end 
  521.  
  522. function store_gang_crib_exit() 
  523. 	pop_screen() 
  524. end 
  525. -- Called when player has responded to store exit confirmation dialog. 
  526. -- 
  527. -- event: input response from the player 
  528. -- 
  529. function store_gang_exit_final(event) 
  530. 	Store_common_popup:nav_enable(false, nil, nil) 
  531. 		 
  532. 	-- The user hit the B button and is exiting 
  533. 	-- This is redundant to selecting "No" in the list 
  534. 	if event == "back" then 
  535. 		game_UI_audio_play("UI_Main_Menu_Nav_Back") 
  536. 		Not_popup_grp:set_alpha(1) 
  537. 		store_gang_enable_mouse(true) 
  538. 		return 
  539. 	end 
  540. 	 
  541. 	game_UI_audio_play("UI_Main_Menu_Select") 
  542. 	 
  543. 	-- Did we select yes?  This assumes yes is the first item 
  544. 	if Store_common_popup:get_selected_data() ~= 1 then 
  545. 		Not_popup_grp:set_alpha(1) 
  546. 		store_gang_enable_mouse(true) 
  547. 		return 
  548. 	end 
  549. 	 
  550. 	Not_popup_grp:set_alpha(0) 
  551. 	-- exit the interface 
  552. 	pop_screen() 
  553. end 
  554.  
  555. -- Populate the active megalist menu, and hide the previous menu 
  556. -- 
  557. -- list_data: 		this table contains the data to populate the megalist 
  558. -- current_index: 	the current index in the menu that's selected 
  559. -- 
  560. function store_gang_populate_list(list_data, current_index) 
  561. 	Active_list:draw_items(list_data, current_index, STORE_COMMON_LIST_SIZE, 10, LIST_FONT_SCALE)	 
  562. 	Active_list:set_visible(true) 
  563. 	 
  564. 	if Game_platform == "PC" then 
  565. 		Mouse_input_tracker:remove_all() 
  566. 		 
  567. 		Active_list:set_store("store_gang") 
  568. 		Active_list:add_mouse_inputs("store_common", Mouse_input_tracker) 
  569. 		Mouse_input_tracker:subscribe(true) 
  570. 	end 
  571. end 
  572.  
  573. -- Clears the price and respect values from the store header. 
  574. -- 
  575. function store_gang_header_revert(menu_data) 
  576. 	Store_header:set_price(nil) 
  577. 	Store_header:set_respect(nil) 
  578. end 
  579.  
  580. -- Handles navigation of any popups 
  581. function store_gang_popup_nav(event, value) 
  582. 	 
  583. 	if event == "mouse_move" then 
  584. 		vint_set_mouse_cursor("") 
  585. 	end 
  586. 	 
  587. 	if event == "nav_up" then	 
  588. 		Store_common_popup.list:move_cursor(-1)	 
  589. 	elseif event == "nav_down" then 
  590. 		Store_common_popup.list:move_cursor(1) 
  591. 	elseif event == "mouse_move" then 
  592. 		-- value contains the target_handle in this case 
  593. 		local new_index = Store_common_popup.list:get_button_index(value) 
  594. 		if new_index ~= 0 then 
  595. 			Store_common_popup.list:set_selection(new_index) 
  596. 			Store_common_popup.list:move_cursor(0, true) 
  597. 		end 
  598. 		 
  599. 	else 
  600. 		--do nothing 
  601. 	end 
  602. end 
  603.  
  604. function store_gang_style_menu_select(menu_data) 
  605.  
  606. 	local slot_menu = { 
  607. 		on_enter = store_gang_slot_menu_enter, 
  608. 		on_back = store_gang_slot_menu_leave, 
  609. 		[1] = { type = TYPE_BUTTON, id = 0, on_nav = store_gang_slot_nav, on_sub_menu_fill = store_gang_category_populate, on_back = store_gang_slot_menu_leave}, 
  610. 		[2] = { type = TYPE_BUTTON, id = 1, on_nav = store_gang_slot_nav, on_sub_menu_fill = store_gang_category_populate, on_back = store_gang_slot_menu_leave}, 
  611. 		[3] = { type = TYPE_BUTTON, id = 2, on_nav = store_gang_slot_nav, on_sub_menu_fill = store_gang_category_populate, on_back = store_gang_slot_menu_leave}, 
  612. 		[4] = { type = TYPE_BUTTON, id = 3, on_nav = store_gang_slot_nav, on_sub_menu_fill = store_gang_category_populate, on_back = store_gang_slot_menu_leave} 
  613. 	} 
  614.  
  615. 	menu_data.sub_menu = slot_menu 
  616. 	 
  617. 	-- set starting choice according to current slot 
  618. 	menu_data.sub_menu.start_index = Store_gang_current_slot	+ 1 
  619. 	 
  620. 	character_enable_mouse_drag(true) 
  621.  
  622. end 
  623.  
  624. function store_gang_vehicle_slot_menu_enter(menu_data) 
  625. 	vint_dataresponder_post("store_gang_vehicle_dr", "Set_slot", 0) 
  626. 	Store_gang_current_vehicle_slot = 0 
  627. 	Store_common_rotate_hint:set_visible(false) 
  628. 	character_enable_mouse_drag(false) 
  629. end 
  630.  
  631. function store_gang_vehicle_slot_menu_leave(menu_data) 
  632. 	vint_dataresponder_post("store_gang_vehicle_dr", "Set_slot", -1) 
  633. 	if game_is_active_input_gamepad() then 
  634. 		Store_common_rotate_hint:set_visible(true) 
  635. 	end 
  636. 	character_enable_mouse_drag(true) 
  637. end 
  638.  
  639. -- While vehicles or gang characters are loading and visible on the screen, we need to set the background property to false. 
  640. -- 
  641. function store_gang_load_status_update(di_h) 
  642. 	--[[ 
  643. 		is_loaded = is the current preview target loaded? 
  644. 	]]-- 
  645. 	local is_loaded = vint_dataitem_get(di_h) 
  646. 	-- make character show if a character is loaded... 
  647. 	bg_saints_set_background(is_loaded) 
  648. 	Store_gang_input_allowed = is_loaded 
  649. end 
  650.  
  651. function store_gang_allow_input() 
  652. 	return Store_gang_input_allowed 
  653. end 
  654.  
  655. function store_gang_bg_anim_done(twn_h, event_name) 
  656. 	vint_set_property(twn_h,"start_event",nil) 
  657. 	store_gang_bg_covered() 
  658. 	store_common_bg_anim_complete() 
  659. 	--debug_print("vint","GANG BG DONE") 
  660. end 
  661.  
  662. function store_gang_sign_on_back() 
  663. 	character_enable_mouse_drag(true) 
  664. 	 
  665. 	if game_is_active_input_gamepad() then 
  666. 		local hint_rotate_data = { 
  667. 			{CTRL_BUTTON_RS, "CONTROL_ROTATE"}, 
  668. 		} 
  669. 		Store_common_rotate_hint:set_hints(hint_rotate_data) 
  670. 		Store_common_rotate_hint:set_visible(true) 
  671. 	else 
  672. 		Store_common_rotate_hint:set_visible(false) 
  673. 	end 
  674. end 
  675.  
  676. Store_gang_gang_menu = { 
  677. 	[1] = { label = "GANG_CUST_GANG_STYLE_OPT", type = TYPE_BUTTON, on_sub_menu_fill = store_gang_style_menu_select }, 
  678. 	[2] = { label = "GANG_CUST_GANG_SIGN_OPT", type = TYPE_BUTTON, on_sub_menu_fill = store_gang_sign_populate } 
  679. } 
  680.  
  681. Store_gang_vehicle_menu = { 
  682. 	[1] = { label = "GANG_CUST_SLOT_1", type = TYPE_BUTTON, id = 0, on_nav = store_gang_vehicle_slot_nav, on_sub_menu_fill = store_gang_vehicle_populate, }, 
  683. 	[2] = { label = "GANG_CUST_SLOT_2", type = TYPE_BUTTON, id = 1, on_nav = store_gang_vehicle_slot_nav, on_sub_menu_fill = store_gang_vehicle_populate, }, 
  684. 	[3] = { label = "GANG_CUST_SLOT_3", type = TYPE_BUTTON, id = 2, on_nav = store_gang_vehicle_slot_nav, on_sub_menu_fill = store_gang_vehicle_populate, }, 
  685. } 
  686.  
  687. Store_gang_top_menu = { 
  688. 	[1] = { label = "GANG_CUST_GANG_TITLE", type = TYPE_BUTTON, sub_menu = Store_gang_gang_menu, on_nav = store_gang_vehicle_slot_menu_leave }, 
  689. 	[2] = { label = "GANG_CUST_VEHICLE_TITLE", type = TYPE_BUTTON, sub_menu = Store_gang_vehicle_menu, on_nav = store_gang_vehicle_slot_menu_enter }  
  690. } 
  691.  
  692.  
  693. -- ===================================== 
  694. --       Mouse Specific Functions 
  695. -- ===================================== 
  696.  
  697. function store_gang_enable_mouse(enable) 
  698. 	if Game_platform == "PC" and enable ~= nil then 
  699. 		if Mouse_input_tracker ~= 0 then 
  700. 			Mouse_input_tracker:subscribe(enable) 
  701. 		end 
  702. 		 
  703. 		if Hint_bar_mouse_input_tracker ~= nil then 
  704. 			Hint_bar_mouse_input_tracker:subscribe(enable) 
  705. 		end 
  706. 	end 
  707. end 
  708.  
  709. function store_gang_mouse_click(event, target_handle) 
  710. 	local hint_index = Store_common_hint_bar:get_hint_index(target_handle) 
  711. 	if hint_index ~= 0 then 
  712. 		store_common_button_b() 
  713. 	end 
  714. end 
  715.  
  716. function store_gang_mouse_move(event, target_handle) 
  717.  
  718. 	vint_set_mouse_cursor("") 
  719.  
  720. 	-- Reset all highlights 
  721. 	Store_common_hint_bar:set_highlight(0) 
  722. 	 
  723. 	-- Check if the mouse is over the hint bar buttons 
  724. 	local hint_index = Store_common_hint_bar:get_hint_index(target_handle) 
  725. 	if hint_index ~= 0 then 
  726. 		Store_common_hint_bar:set_highlight(hint_index, Store_common_current_highlight_color) 
  727. 		return 
  728. 	end 
  729. 	 
  730. 	-- Check if the mouse is over a button on the mega list 
  731. 	local old_index = Active_list:get_selection() 
  732. 	local new_index = Active_list:get_button_index(target_handle) 
  733. 	if new_index ~= 0 and new_index ~= old_index then 
  734. 		Active_list:set_selection(new_index) 
  735. 		Active_list:move_cursor(0, true) 
  736. 		 
  737. 		-- If the item has a callback for navigation, do it (such as putting clothes on) 
  738. 		local data_item = Active_list:return_selected_data() 
  739. 		if data_item.on_nav ~= nil then 
  740. 			data_item.on_nav(data_item) 
  741. 		end 
  742. 		return 
  743. 	end 
  744. end 
  745.  
  746. function store_gang_mouse_scroll(event, target_handle, mouse_x, mouse_y, scroll_lines) 
  747. end 
  748.  
  749. function store_gang_mouse_drag(event, target_handle, mouse_x, mouse_y) 
  750. end 
  751.  
  752. function store_gang_mouse_drag_release(event, target_handle, mouse_x, mouse_y) 
  753. end 
  754.